2015-02-20 Arnaud Charlet <charlet@adacore.com>
[official-gcc.git] / gcc / ada / gnat_rm.texi
blobbcf9b3c69b846766b5a93e5d2eb65f03157550dd
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename gnat_rm.info
4 @documentencoding UTF-8
5 @ifinfo
6 @*Generated by Sphinx 1.2.2.@*
7 @end ifinfo
8 @settitle GNAT Reference Manual
9 @defindex ge
10 @paragraphindent 0
11 @exampleindent 4
12 @finalout
13 @dircategory 
14 @direntry
15 * gnat_rm: (gnat_rm.info). gnat_rm
16 @end direntry
18 @definfoenclose strong,`,'
19 @definfoenclose emph,`,'
20 @c %**end of header
22 @copying
23 @quotation
24 GNAT Reference Manual , February 20, 2015
26 AdaCore
28 Copyright @copyright{} 2008-2015, Free Software Foundation
29 @end quotation
31 @end copying
33 @titlepage
34 @title GNAT Reference Manual
35 @insertcopying
36 @end titlepage
37 @contents
39 @c %** start of user preamble
41 @c %** end of user preamble
43 @ifnottex
44 @node Top
45 @top GNAT Reference Manual
46 @insertcopying
47 @end ifnottex
49 @c %**start of body
50 @anchor{gnat_rm doc}@anchor{0}
51 @emph{GNAT, The GNU Ada Development Environment}
54 @include gcc-common.texi
55 GCC version @value{version-GCC}@*
56 AdaCore
58 Permission is granted to copy, distribute and/or modify this document
59 under the terms of the GNU Free Documentation License, Version 1.3 or
60 any later version published by the Free Software Foundation; with no
61 Invariant Sections, with the Front-Cover Texts being "GNAT Reference
62 Manual", and with no Back-Cover Texts.  A copy of the license is
63 included in the section entitled @ref{1,,GNU Free Documentation License}.
65 @menu
66 * About This Guide:: 
67 * Implementation Defined Pragmas:: 
68 * Implementation Defined Aspects:: 
69 * Implementation Defined Attributes:: 
70 * Standard and Implementation Defined Restrictions:: 
71 * Implementation Advice:: 
72 * Implementation Defined Characteristics:: 
73 * Intrinsic Subprograms:: 
74 * Representation Clauses and Pragmas:: 
75 * Standard Library Routines:: 
76 * The Implementation of Standard I/O:: 
77 * The GNAT Library:: 
78 * Interfacing to Other Languages:: 
79 * Specialized Needs Annexes:: 
80 * Implementation of Specific Ada Features:: 
81 * Implementation of Ada 2012 Features:: 
82 * Obsolescent Features:: 
83 * Compatibility and Porting Guide:: 
84 * GNU Free Documentation License:: 
85 * Index:: 
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 Allow_Integer_Address:: 
107 * Pragma Annotate:: 
108 * Pragma Assert:: 
109 * Pragma Assert_And_Cut:: 
110 * Pragma Assertion_Policy:: 
111 * Pragma Assume:: 
112 * Pragma Assume_No_Invalid_Values:: 
113 * Pragma Async_Readers:: 
114 * Pragma Async_Writers:: 
115 * Pragma Attribute_Definition:: 
116 * Pragma C_Pass_By_Copy:: 
117 * Pragma Check:: 
118 * Pragma Check_Float_Overflow:: 
119 * Pragma Check_Name:: 
120 * Pragma Check_Policy:: 
121 * Pragma CIL_Constructor:: 
122 * Pragma Comment:: 
123 * Pragma Common_Object:: 
124 * Pragma Compile_Time_Error:: 
125 * Pragma Compile_Time_Warning:: 
126 * Pragma Compiler_Unit:: 
127 * Pragma Compiler_Unit_Warning:: 
128 * Pragma Complete_Representation:: 
129 * Pragma Complex_Representation:: 
130 * Pragma Component_Alignment:: 
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 Debug:: 
139 * Pragma Debug_Policy:: 
140 * Pragma Default_Scalar_Storage_Order:: 
141 * Pragma Default_Storage_Pool:: 
142 * Pragma Depends:: 
143 * Pragma Detect_Blocking:: 
144 * Pragma Disable_Atomic_Synchronization:: 
145 * Pragma Dispatching_Domain:: 
146 * Pragma Effective_Reads:: 
147 * Pragma Effective_Writes:: 
148 * Pragma Elaboration_Checks:: 
149 * Pragma Eliminate:: 
150 * Pragma Enable_Atomic_Synchronization:: 
151 * Pragma Export_Function:: 
152 * Pragma Export_Object:: 
153 * Pragma Export_Procedure:: 
154 * Pragma Export_Value:: 
155 * Pragma Export_Valued_Procedure:: 
156 * Pragma Extend_System:: 
157 * Pragma Extensions_Allowed:: 
158 * Pragma External:: 
159 * Pragma External_Name_Casing:: 
160 * Pragma Fast_Math:: 
161 * Pragma Favor_Top_Level:: 
162 * Pragma Finalize_Storage_Only:: 
163 * Pragma Float_Representation:: 
164 * Pragma Global:: 
165 * Pragma Ident:: 
166 * Pragma Implementation_Defined:: 
167 * Pragma Implemented:: 
168 * Pragma Implicit_Packing:: 
169 * Pragma Import_Function:: 
170 * Pragma Import_Object:: 
171 * Pragma Import_Procedure:: 
172 * Pragma Import_Valued_Procedure:: 
173 * Pragma Independent:: 
174 * Pragma Independent_Components:: 
175 * Pragma Initial_Condition:: 
176 * Pragma Initialize_Scalars:: 
177 * Pragma Initializes:: 
178 * Pragma Inline_Always:: 
179 * Pragma Inline_Generic:: 
180 * Pragma Interface:: 
181 * Pragma Interface_Name:: 
182 * Pragma Interrupt_Handler:: 
183 * Pragma Interrupt_State:: 
184 * Pragma Invariant:: 
185 * Pragma Java_Constructor:: 
186 * Pragma Java_Interface:: 
187 * Pragma Keep_Names:: 
188 * Pragma License:: 
189 * Pragma Link_With:: 
190 * Pragma Linker_Alias:: 
191 * Pragma Linker_Constructor:: 
192 * Pragma Linker_Destructor:: 
193 * Pragma Linker_Section:: 
194 * Pragma Lock_Free:: 
195 * Pragma Loop_Invariant:: 
196 * Pragma Loop_Optimize:: 
197 * Pragma Loop_Variant:: 
198 * Pragma Machine_Attribute:: 
199 * Pragma Main:: 
200 * Pragma Main_Storage:: 
201 * Pragma No_Body:: 
202 * Pragma No_Elaboration_Code_All:: 
203 * Pragma No_Inline:: 
204 * Pragma No_Return:: 
205 * Pragma No_Run_Time:: 
206 * Pragma No_Strict_Aliasing:: 
207 * Pragma No_Tagged_Streams:: 
208 * Pragma Normalize_Scalars:: 
209 * Pragma Obsolescent:: 
210 * Pragma Optimize_Alignment:: 
211 * Pragma Ordered:: 
212 * Pragma Overflow_Mode:: 
213 * Pragma Overriding_Renamings:: 
214 * Pragma Partition_Elaboration_Policy:: 
215 * Pragma Part_Of:: 
216 * Pragma Passive:: 
217 * Pragma Persistent_BSS:: 
218 * Pragma Polling:: 
219 * Pragma Post:: 
220 * Pragma Postcondition:: 
221 * Pragma Post_Class:: 
222 * Pragma Pre:: 
223 * Pragma Precondition:: 
224 * Pragma Predicate:: 
225 * Pragma Preelaborable_Initialization:: 
226 * Pragma Prefix_Exception_Messages:: 
227 * Pragma Pre_Class:: 
228 * Pragma Priority_Specific_Dispatching:: 
229 * Pragma Profile:: 
230 * Pragma Profile_Warnings:: 
231 * Pragma Propagate_Exceptions:: 
232 * Pragma Provide_Shift_Operators:: 
233 * Pragma Psect_Object:: 
234 * Pragma Pure_Function:: 
235 * Pragma Rational:: 
236 * Pragma Ravenscar:: 
237 * Pragma Refined_Depends:: 
238 * Pragma Refined_Global:: 
239 * Pragma Refined_Post:: 
240 * Pragma Refined_State:: 
241 * Pragma Relative_Deadline:: 
242 * Pragma Remote_Access_Type:: 
243 * Pragma Restricted_Run_Time:: 
244 * Pragma Restriction_Warnings:: 
245 * Pragma Reviewable:: 
246 * Pragma Share_Generic:: 
247 * Pragma Shared:: 
248 * Pragma Short_Circuit_And_Or:: 
249 * Pragma Short_Descriptors:: 
250 * Pragma Simple_Storage_Pool_Type:: 
251 * Pragma Source_File_Name:: 
252 * Pragma Source_File_Name_Project:: 
253 * Pragma Source_Reference:: 
254 * Pragma SPARK_Mode:: 
255 * Pragma Static_Elaboration_Desired:: 
256 * Pragma Stream_Convert:: 
257 * Pragma Style_Checks:: 
258 * Pragma Subtitle:: 
259 * Pragma Suppress:: 
260 * Pragma Suppress_All:: 
261 * Pragma Suppress_Debug_Info:: 
262 * Pragma Suppress_Exception_Locations:: 
263 * Pragma Suppress_Initialization:: 
264 * Pragma Task_Name:: 
265 * Pragma Task_Storage:: 
266 * Pragma Test_Case:: 
267 * Pragma Thread_Local_Storage:: 
268 * Pragma Time_Slice:: 
269 * Pragma Title:: 
270 * Pragma Type_Invariant:: 
271 * Pragma Type_Invariant_Class:: 
272 * Pragma Unchecked_Union:: 
273 * Pragma Unevaluated_Use_Of_Old:: 
274 * Pragma Unimplemented_Unit:: 
275 * Pragma Universal_Aliasing:: 
276 * Pragma Universal_Data:: 
277 * Pragma Unmodified:: 
278 * Pragma Unreferenced:: 
279 * Pragma Unreferenced_Objects:: 
280 * Pragma Unreserve_All_Interrupts:: 
281 * Pragma Unsuppress:: 
282 * Pragma Use_VADS_Size:: 
283 * Pragma Validity_Checks:: 
284 * Pragma Volatile:: 
285 * Pragma Warning_As_Error:: 
286 * Pragma Warnings:: 
287 * Pragma Weak_External:: 
288 * Pragma Wide_Character_Encoding:: 
290 Implementation Defined Aspects
292 * Aspect Abstract_State:: 
293 * Annotate:: 
294 * Aspect Async_Readers:: 
295 * Aspect Async_Writers:: 
296 * Aspect Contract_Cases:: 
297 * Aspect Depends:: 
298 * Aspect Dimension:: 
299 * Aspect Dimension_System:: 
300 * Aspect Effective_Reads:: 
301 * Aspect Effective_Writes:: 
302 * Aspect Favor_Top_Level:: 
303 * Aspect Global:: 
304 * Aspect Initial_Condition:: 
305 * Aspect Initializes:: 
306 * Aspect Inline_Always:: 
307 * Aspect Invariant:: 
308 * Aspect Invariant'Class:: 
309 * Aspect Iterable:: 
310 * Aspect Linker_Section:: 
311 * Aspect Lock_Free:: 
312 * Aspect No_Elaboration_Code_All:: 
313 * Aspect No_Tagged_Streams:: 
314 * Aspect Object_Size:: 
315 * Aspect Obsolescent:: 
316 * Aspect Part_Of:: 
317 * Aspect Persistent_BSS:: 
318 * Aspect Predicate:: 
319 * Aspect Pure_Function:: 
320 * Aspect Refined_Depends:: 
321 * Aspect Refined_Global:: 
322 * Aspect Refined_Post:: 
323 * Aspect Refined_State:: 
324 * Aspect Remote_Access_Type:: 
325 * Aspect Scalar_Storage_Order:: 
326 * Aspect Shared:: 
327 * Aspect Simple_Storage_Pool:: 
328 * Aspect Simple_Storage_Pool_Type:: 
329 * Aspect SPARK_Mode:: 
330 * Aspect Suppress_Debug_Info:: 
331 * Aspect Suppress_Initialization:: 
332 * Aspect Test_Case:: 
333 * Aspect Thread_Local_Storage:: 
334 * Aspect Universal_Aliasing:: 
335 * Aspect Universal_Data:: 
336 * Aspect Unmodified:: 
337 * Aspect Unreferenced:: 
338 * Aspect Unreferenced_Objects:: 
339 * Aspect Value_Size:: 
340 * Aspect Warnings:: 
342 Implementation Defined Attributes
344 * Attribute Abort_Signal:: 
345 * Attribute Address_Size:: 
346 * Attribute Asm_Input:: 
347 * Attribute Asm_Output:: 
348 * Attribute Atomic_Always_Lock_Free:: 
349 * Attribute Bit:: 
350 * Attribute Bit_Position:: 
351 * Attribute Code_Address:: 
352 * Attribute Compiler_Version:: 
353 * Attribute Constrained:: 
354 * Attribute Default_Bit_Order:: 
355 * Attribute Default_Scalar_Storage_Order:: 
356 * Attribute Descriptor_Size:: 
357 * Attribute Elaborated:: 
358 * Attribute Elab_Body:: 
359 * Attribute Elab_Spec:: 
360 * Attribute Elab_Subp_Body:: 
361 * Attribute Emax:: 
362 * Attribute Enabled:: 
363 * Attribute Enum_Rep:: 
364 * Attribute Enum_Val:: 
365 * Attribute Epsilon:: 
366 * Attribute Fast_Math:: 
367 * Attribute Fixed_Value:: 
368 * Attribute From_Any:: 
369 * Attribute Has_Access_Values:: 
370 * Attribute Has_Discriminants:: 
371 * Attribute Img:: 
372 * Attribute Integer_Value:: 
373 * Attribute Invalid_Value:: 
374 * Attribute Iterable:: 
375 * Attribute Large:: 
376 * Attribute Library_Level:: 
377 * Attribute Lock_Free:: 
378 * Attribute Loop_Entry:: 
379 * Attribute Machine_Size:: 
380 * Attribute Mantissa:: 
381 * Attribute Maximum_Alignment:: 
382 * Attribute Mechanism_Code:: 
383 * Attribute Null_Parameter:: 
384 * Attribute Object_Size:: 
385 * Attribute Old:: 
386 * Attribute Passed_By_Reference:: 
387 * Attribute Pool_Address:: 
388 * Attribute Range_Length:: 
389 * Attribute Ref:: 
390 * Attribute Restriction_Set:: 
391 * Attribute Result:: 
392 * Attribute Safe_Emax:: 
393 * Attribute Safe_Large:: 
394 * Attribute Safe_Small:: 
395 * Attribute Scalar_Storage_Order:: 
396 * Attribute Simple_Storage_Pool:: 
397 * Attribute Small:: 
398 * Attribute Storage_Unit:: 
399 * Attribute Stub_Type:: 
400 * Attribute System_Allocator_Alignment:: 
401 * Attribute Target_Name:: 
402 * Attribute To_Address:: 
403 * Attribute To_Any:: 
404 * Attribute Type_Class:: 
405 * Attribute Type_Key:: 
406 * Attribute TypeCode:: 
407 * Attribute UET_Address:: 
408 * Attribute Unconstrained_Array:: 
409 * Attribute Universal_Literal_String:: 
410 * Attribute Unrestricted_Access:: 
411 * Attribute Update:: 
412 * Attribute Valid_Scalars:: 
413 * Attribute VADS_Size:: 
414 * Attribute Value_Size:: 
415 * Attribute Wchar_T_Size:: 
416 * Attribute Word_Size:: 
418 Standard and Implementation Defined Restrictions
420 * Partition-Wide Restrictions:: 
421 * Program Unit Level Restrictions:: 
423 Partition-Wide Restrictions
425 * Immediate_Reclamation:: 
426 * Max_Asynchronous_Select_Nesting:: 
427 * Max_Entry_Queue_Length:: 
428 * Max_Protected_Entries:: 
429 * Max_Select_Alternatives:: 
430 * Max_Storage_At_Blocking:: 
431 * Max_Task_Entries:: 
432 * Max_Tasks:: 
433 * No_Abort_Statements:: 
434 * No_Access_Parameter_Allocators:: 
435 * No_Access_Subprograms:: 
436 * No_Allocators:: 
437 * No_Anonymous_Allocators:: 
438 * No_Calendar:: 
439 * No_Coextensions:: 
440 * No_Default_Initialization:: 
441 * No_Delay:: 
442 * No_Dependence:: 
443 * No_Direct_Boolean_Operators:: 
444 * No_Dispatch:: 
445 * No_Dispatching_Calls:: 
446 * No_Dynamic_Attachment:: 
447 * No_Dynamic_Priorities:: 
448 * No_Entry_Calls_In_Elaboration_Code:: 
449 * No_Enumeration_Maps:: 
450 * No_Exception_Handlers:: 
451 * No_Exception_Propagation:: 
452 * No_Exception_Registration:: 
453 * No_Exceptions:: 
454 * No_Finalization:: 
455 * No_Fixed_Point:: 
456 * No_Floating_Point:: 
457 * No_Implicit_Conditionals:: 
458 * No_Implicit_Dynamic_Code:: 
459 * No_Implicit_Heap_Allocations:: 
460 * No_Implicit_Loops:: 
461 * No_Initialize_Scalars:: 
462 * No_IO:: 
463 * No_Local_Allocators:: 
464 * No_Local_Protected_Objects:: 
465 * No_Local_Timing_Events:: 
466 * No_Long_Long_Integers:: 
467 * No_Multiple_Elaboration:: 
468 * No_Nested_Finalization:: 
469 * No_Protected_Type_Allocators:: 
470 * No_Protected_Types:: 
471 * No_Recursion:: 
472 * No_Reentrancy:: 
473 * No_Relative_Delay:: 
474 * No_Requeue_Statements:: 
475 * No_Secondary_Stack:: 
476 * No_Select_Statements:: 
477 * No_Specific_Termination_Handlers:: 
478 * No_Specification_of_Aspect:: 
479 * No_Standard_Allocators_After_Elaboration:: 
480 * No_Standard_Storage_Pools:: 
481 * No_Stream_Optimizations:: 
482 * No_Streams:: 
483 * No_Task_Allocators:: 
484 * No_Task_Attributes_Package:: 
485 * No_Task_Hierarchy:: 
486 * No_Task_Termination:: 
487 * No_Tasking:: 
488 * No_Terminate_Alternatives:: 
489 * No_Unchecked_Access:: 
490 * No_Use_Of_Entity:: 
491 * Simple_Barriers:: 
492 * Static_Priorities:: 
493 * Static_Storage_Size:: 
495 Program Unit Level Restrictions
497 * No_Elaboration_Code:: 
498 * No_Entry_Queue:: 
499 * No_Implementation_Aspect_Specifications:: 
500 * No_Implementation_Attributes:: 
501 * No_Implementation_Identifiers:: 
502 * No_Implementation_Pragmas:: 
503 * No_Implementation_Restrictions:: 
504 * No_Implementation_Units:: 
505 * No_Implicit_Aliasing:: 
506 * No_Obsolescent_Features:: 
507 * No_Wide_Characters:: 
508 * SPARK_05:: 
510 Implementation Advice
512 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
513 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
514 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
515 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
516 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
517 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
518 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
519 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
520 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
521 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
522 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
523 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
524 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
525 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
526 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
527 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
528 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
529 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
530 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
531 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
532 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
533 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
534 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
535 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
536 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
537 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
538 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
539 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
540 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
541 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
542 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
543 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
544 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
545 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
546 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
547 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
548 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
549 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
550 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
551 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
552 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
553 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
554 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
555 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
556 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
557 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
558 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
559 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
560 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
561 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
562 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
563 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
564 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
565 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
566 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
567 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
568 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
569 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
570 * RM G; Numerics: RM G Numerics. 
571 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
572 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
573 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
574 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
575 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
577 Intrinsic Subprograms
579 * Intrinsic Operators:: 
580 * Compilation_Date:: 
581 * Compilation_Time:: 
582 * Enclosing_Entity:: 
583 * Exception_Information:: 
584 * Exception_Message:: 
585 * Exception_Name:: 
586 * File:: 
587 * Line:: 
588 * Shifts and Rotates:: 
589 * Source_Location:: 
591 Representation Clauses and Pragmas
593 * Alignment Clauses:: 
594 * Size Clauses:: 
595 * Storage_Size Clauses:: 
596 * Size of Variant Record Objects:: 
597 * Biased Representation:: 
598 * Value_Size and Object_Size Clauses:: 
599 * Component_Size Clauses:: 
600 * Bit_Order Clauses:: 
601 * Effect of Bit_Order on Byte Ordering:: 
602 * Pragma Pack for Arrays:: 
603 * Pragma Pack for Records:: 
604 * Record Representation Clauses:: 
605 * Handling of Records with Holes:: 
606 * Enumeration Clauses:: 
607 * Address Clauses:: 
608 * Use of Address Clauses for Memory-Mapped I/O:: 
609 * Effect of Convention on Representation:: 
610 * Conventions and Anonymous Access Types:: 
611 * Determining the Representations chosen by GNAT:: 
613 The Implementation of Standard I/O
615 * Standard I/O Packages:: 
616 * FORM Strings:: 
617 * Direct_IO:: 
618 * Sequential_IO:: 
619 * Text_IO:: 
620 * Wide_Text_IO:: 
621 * Wide_Wide_Text_IO:: 
622 * Stream_IO:: 
623 * Text Translation:: 
624 * Shared Files:: 
625 * Filenames encoding:: 
626 * File content encoding:: 
627 * Open Modes:: 
628 * Operations on C Streams:: 
629 * Interfacing to C Streams:: 
631 Text_IO
633 * Stream Pointer Positioning:: 
634 * Reading and Writing Non-Regular Files:: 
635 * Get_Immediate:: 
636 * Treating Text_IO Files as Streams:: 
637 * Text_IO Extensions:: 
638 * Text_IO Facilities for Unbounded Strings:: 
640 Wide_Text_IO
642 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
643 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
645 Wide_Wide_Text_IO
647 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
648 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
650 The GNAT Library
652 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
653 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
654 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
655 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
656 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
657 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
658 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
659 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
660 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
661 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
662 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
663 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
664 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
665 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
666 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
667 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
668 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
669 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
670 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
671 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
672 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
673 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
674 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
675 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
676 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
677 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
678 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
679 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
680 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
681 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
682 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
683 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
684 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
685 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
686 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
687 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
688 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
689 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
690 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
691 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
692 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
693 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
694 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
695 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
696 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
697 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
698 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
699 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
700 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
701 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
702 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
703 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
704 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
705 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
706 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
707 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
708 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
709 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
710 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
711 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
712 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
713 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
714 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
715 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
716 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
717 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
718 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
719 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
720 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
721 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
722 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
723 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
724 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
725 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
726 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
727 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
728 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
729 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
730 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
731 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
732 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
733 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
734 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
735 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
736 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
737 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
738 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
739 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
740 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
741 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
742 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
743 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
744 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
745 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
746 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
747 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
748 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
749 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
750 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
751 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
752 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
753 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
754 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
755 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
756 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
757 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
758 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
759 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
760 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
761 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
762 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
763 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
764 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
765 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
766 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
767 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
768 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
769 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
770 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
771 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
772 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
773 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
774 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
775 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
776 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
777 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
778 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
779 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
780 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
781 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
782 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
783 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
784 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
785 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
786 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
787 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
788 * System.Memory (s-memory.ads): System Memory s-memory ads. 
789 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
790 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
791 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
792 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
793 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
794 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
795 * System.Rident (s-rident.ads): System Rident s-rident ads. 
796 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
797 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
798 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
799 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
801 Interfacing to Other Languages
803 * Interfacing to C:: 
804 * Interfacing to C++:: 
805 * Interfacing to COBOL:: 
806 * Interfacing to Fortran:: 
807 * Interfacing to non-GNAT Ada code:: 
809 Implementation of Specific Ada Features
811 * Machine Code Insertions:: 
812 * GNAT Implementation of Tasking:: 
813 * GNAT Implementation of Shared Passive Packages:: 
814 * Code Generation for Array Aggregates:: 
815 * The Size of Discriminated Records with Default Discriminants:: 
816 * Strict Conformance to the Ada Reference Manual:: 
818 GNAT Implementation of Tasking
820 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
821 * Ensuring Compliance with the Real-Time Annex:: 
823 Code Generation for Array Aggregates
825 * Static constant aggregates with static bounds:: 
826 * Constant aggregates with unconstrained nominal types:: 
827 * Aggregates with static bounds:: 
828 * Aggregates with non-static bounds:: 
829 * Aggregates in assignment statements:: 
831 Obsolescent Features
833 * pragma No_Run_Time:: 
834 * pragma Ravenscar:: 
835 * pragma Restricted_Run_Time:: 
836 * pragma Task_Info:: 
837 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
839 Compatibility and Porting Guide
841 * Writing Portable Fixed-Point Declarations:: 
842 * Compatibility with Ada 83:: 
843 * Compatibility between Ada 95 and Ada 2005:: 
844 * Implementation-dependent characteristics:: 
845 * Compatibility with Other Ada Systems:: 
846 * Representation Clauses:: 
847 * Compatibility with HP Ada 83:: 
849 Compatibility with Ada 83
851 * Legal Ada 83 programs that are illegal in Ada 95:: 
852 * More deterministic semantics:: 
853 * Changed semantics:: 
854 * Other language compatibility issues:: 
856 Implementation-dependent characteristics
858 * Implementation-defined pragmas:: 
859 * Implementation-defined attributes:: 
860 * Libraries:: 
861 * Elaboration order:: 
862 * Target-specific aspects:: 
864 @end detailmenu
865 @end menu
867 @node About This Guide,Implementation Defined Pragmas,Top,Top
868 @anchor{gnat_rm/about_this_guide about-this-guide}@anchor{2}@anchor{gnat_rm/about_this_guide doc}@anchor{3}@anchor{gnat_rm/about_this_guide gnat-reference-manual}@anchor{4}@anchor{gnat_rm/about_this_guide id1}@anchor{5}
869 @chapter About This Guide
873 This manual contains useful information in writing programs using the
874 GNAT compiler.  It includes information on implementation dependent
875 characteristics of GNAT, including all the information required by
876 Annex M of the Ada language standard.
878 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
879 invoked in Ada 83 compatibility mode.
880 By default, GNAT assumes Ada 2012,
881 but you can override with a compiler switch
882 to explicitly specify the language version.
883 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
884 Throughout this manual, references to 'Ada' without a year suffix
885 apply to all the Ada versions of the language.
887 Ada is designed to be highly portable.
888 In general, a program will have the same effect even when compiled by
889 different compilers on different platforms.
890 However, since Ada is designed to be used in a
891 wide variety of applications, it also contains a number of system
892 dependent features to be used in interfacing to the external world.
893 .. index:: Implementation-dependent features
895 @geindex Portability
897 Note: Any program that makes use of implementation-dependent features
898 may be non-portable.  You should follow good programming practice and
899 isolate and clearly document any sections of your program that make use
900 of these features in a non-portable manner.
902 @menu
903 * What This Reference Manual Contains:: 
904 * Conventions:: 
905 * Related Information:: 
907 @end menu
909 @node What This Reference Manual Contains,Conventions,,About This Guide
910 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
911 @section What This Reference Manual Contains
914 This reference manual contains the following chapters:
917 @itemize *
919 @item 
920 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
921 pragmas, which can be used to extend and enhance the functionality of the
922 compiler.
924 @item 
925 @ref{8,,Implementation Defined Attributes}, lists GNAT
926 implementation-dependent attributes, which can be used to extend and
927 enhance the functionality of the compiler.
929 @item 
930 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
931 implementation-dependent restrictions, which can be used to extend and
932 enhance the functionality of the compiler.
934 @item 
935 @ref{a,,Implementation Advice}, provides information on generally
936 desirable behavior which are not requirements that all compilers must
937 follow since it cannot be provided on all systems, or which may be
938 undesirable on some systems.
940 @item 
941 @ref{b,,Implementation Defined Characteristics}, provides a guide to
942 minimizing implementation dependent features.
944 @item 
945 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
946 implemented by GNAT, and how they can be imported into user
947 application programs.
949 @item 
950 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
951 way that GNAT represents data, and in particular the exact set
952 of representation clauses and pragmas that is accepted.
954 @item 
955 @ref{e,,Standard Library Routines}, provides a listing of packages and a
956 brief description of the functionality that is provided by Ada's
957 extensive set of standard library routines as implemented by GNAT.
959 @item 
960 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
961 implementation of the input-output facilities.
963 @item 
964 @ref{10,,The GNAT Library}, is a catalog of packages that complement
965 the Ada predefined library.
967 @item 
968 @ref{11,,Interfacing to Other Languages}, describes how programs
969 written in Ada using GNAT can be interfaced to other programming
970 languages.
972 @item 
973 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
974 of the specialized needs annexes.
976 @item 
977 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
978 to GNAT's implementation of machine code insertions, tasking, and several
979 other features.
981 @item 
982 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
983 GNAT implementation of the Ada 2012 language standard.
985 @item 
986 @ref{15,,Obsolescent Features} documents implementation dependent features,
987 including pragmas and attributes, which are considered obsolescent, since
988 there are other preferred ways of achieving the same results. These
989 obsolescent forms are retained for backwards compatibility.
991 @item 
992 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
993 developing portable Ada code, describes the compatibility issues that
994 may arise between GNAT and other Ada compilation systems (including those
995 for Ada 83), and shows how GNAT can expedite porting applications
996 developed in other Ada environments.
998 @item 
999 @ref{1,,GNU Free Documentation License} contains the license for this document.
1000 @end itemize
1002 @geindex Ada 95 Language Reference Manual
1004 @geindex Ada 2005 Language Reference Manual
1006 This reference manual assumes a basic familiarity with the Ada 95 language, as
1007 described in the
1008 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1009 It does not require knowledge of the new features introduced by Ada 2005,
1010 (officially known as @cite{ISO/IEC 8652:1995 with Technical Corrigendum 1 and Amendment 1}).
1011 Both reference manuals are included in the GNAT documentation
1012 package.
1014 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1015 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1016 @section Conventions
1019 @geindex Conventions
1020 @geindex typographical
1022 @geindex Typographical conventions
1024 Following are examples of the typographical and graphic conventions used
1025 in this guide:
1028 @itemize *
1030 @item 
1031 @cite{Functions}, @cite{utility program names}, @cite{standard names},
1032 and @cite{classes}.
1034 @item 
1035 @cite{Option flags}
1037 @item 
1038 @code{File names}
1040 @item 
1041 @cite{Variables}
1043 @item 
1044 @emph{Emphasis}
1046 @item 
1047 [optional information or parameters]
1049 @item 
1050 Examples are described by text
1052 @example
1053 and then shown this way.
1054 @end example
1056 @item 
1057 Commands that are entered by the user are shown as preceded by a prompt string
1058 comprising the @code{$} character followed by a space.
1059 @end itemize
1061 @node Related Information,,Conventions,About This Guide
1062 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1063 @section Related Information
1066 See the following documents for further information on GNAT:
1069 @itemize *
1071 @item 
1072 @cite{GNAT User's Guide for Native Platforms},
1073 which provides information on how to use the
1074 GNAT development environment.
1076 @item 
1077 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1079 @item 
1080 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1081 of the Ada 95 standard.  The annotations describe
1082 detailed aspects of the design decision, and in particular contain useful
1083 sections on Ada 83 compatibility.
1085 @item 
1086 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1088 @item 
1089 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1090 of the Ada 2005 standard.  The annotations describe
1091 detailed aspects of the design decision.
1093 @item 
1094 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1096 @item 
1097 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1098 which contains specific information on compatibility between GNAT and
1099 DEC Ada 83 systems.
1101 @item 
1102 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1103 describes in detail the pragmas and attributes provided by the DEC Ada 83
1104 compiler system.
1105 @end itemize
1107 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1108 @anchor{gnat_rm/implementation_defined_pragmas implementation-defined-pragmas}@anchor{7}@anchor{gnat_rm/implementation_defined_pragmas doc}@anchor{19}@anchor{gnat_rm/implementation_defined_pragmas id1}@anchor{1a}
1109 @chapter Implementation Defined Pragmas
1112 Ada defines a set of pragmas that can be used to supply additional
1113 information to the compiler.  These language defined pragmas are
1114 implemented in GNAT and work as described in the Ada Reference Manual.
1116 In addition, Ada allows implementations to define additional pragmas
1117 whose meaning is defined by the implementation.  GNAT provides a number
1118 of these implementation-defined pragmas, which can be used to extend
1119 and enhance the functionality of the compiler.  This section of the GNAT
1120 Reference Manual describes these additional pragmas.
1122 Note that any program using these pragmas might not be portable to other
1123 compilers (although GNAT implements this set of pragmas on all
1124 platforms).  Therefore if portability to other compilers is an important
1125 consideration, the use of these pragmas should be minimized.
1127 @menu
1128 * Pragma Abort_Defer:: 
1129 * Pragma Abstract_State:: 
1130 * Pragma Ada_83:: 
1131 * Pragma Ada_95:: 
1132 * Pragma Ada_05:: 
1133 * Pragma Ada_2005:: 
1134 * Pragma Ada_12:: 
1135 * Pragma Ada_2012:: 
1136 * Pragma Allow_Integer_Address:: 
1137 * Pragma Annotate:: 
1138 * Pragma Assert:: 
1139 * Pragma Assert_And_Cut:: 
1140 * Pragma Assertion_Policy:: 
1141 * Pragma Assume:: 
1142 * Pragma Assume_No_Invalid_Values:: 
1143 * Pragma Async_Readers:: 
1144 * Pragma Async_Writers:: 
1145 * Pragma Attribute_Definition:: 
1146 * Pragma C_Pass_By_Copy:: 
1147 * Pragma Check:: 
1148 * Pragma Check_Float_Overflow:: 
1149 * Pragma Check_Name:: 
1150 * Pragma Check_Policy:: 
1151 * Pragma CIL_Constructor:: 
1152 * Pragma Comment:: 
1153 * Pragma Common_Object:: 
1154 * Pragma Compile_Time_Error:: 
1155 * Pragma Compile_Time_Warning:: 
1156 * Pragma Compiler_Unit:: 
1157 * Pragma Compiler_Unit_Warning:: 
1158 * Pragma Complete_Representation:: 
1159 * Pragma Complex_Representation:: 
1160 * Pragma Component_Alignment:: 
1161 * Pragma Contract_Cases:: 
1162 * Pragma Convention_Identifier:: 
1163 * Pragma CPP_Class:: 
1164 * Pragma CPP_Constructor:: 
1165 * Pragma CPP_Virtual:: 
1166 * Pragma CPP_Vtable:: 
1167 * Pragma CPU:: 
1168 * Pragma Debug:: 
1169 * Pragma Debug_Policy:: 
1170 * Pragma Default_Scalar_Storage_Order:: 
1171 * Pragma Default_Storage_Pool:: 
1172 * Pragma Depends:: 
1173 * Pragma Detect_Blocking:: 
1174 * Pragma Disable_Atomic_Synchronization:: 
1175 * Pragma Dispatching_Domain:: 
1176 * Pragma Effective_Reads:: 
1177 * Pragma Effective_Writes:: 
1178 * Pragma Elaboration_Checks:: 
1179 * Pragma Eliminate:: 
1180 * Pragma Enable_Atomic_Synchronization:: 
1181 * Pragma Export_Function:: 
1182 * Pragma Export_Object:: 
1183 * Pragma Export_Procedure:: 
1184 * Pragma Export_Value:: 
1185 * Pragma Export_Valued_Procedure:: 
1186 * Pragma Extend_System:: 
1187 * Pragma Extensions_Allowed:: 
1188 * Pragma External:: 
1189 * Pragma External_Name_Casing:: 
1190 * Pragma Fast_Math:: 
1191 * Pragma Favor_Top_Level:: 
1192 * Pragma Finalize_Storage_Only:: 
1193 * Pragma Float_Representation:: 
1194 * Pragma Global:: 
1195 * Pragma Ident:: 
1196 * Pragma Implementation_Defined:: 
1197 * Pragma Implemented:: 
1198 * Pragma Implicit_Packing:: 
1199 * Pragma Import_Function:: 
1200 * Pragma Import_Object:: 
1201 * Pragma Import_Procedure:: 
1202 * Pragma Import_Valued_Procedure:: 
1203 * Pragma Independent:: 
1204 * Pragma Independent_Components:: 
1205 * Pragma Initial_Condition:: 
1206 * Pragma Initialize_Scalars:: 
1207 * Pragma Initializes:: 
1208 * Pragma Inline_Always:: 
1209 * Pragma Inline_Generic:: 
1210 * Pragma Interface:: 
1211 * Pragma Interface_Name:: 
1212 * Pragma Interrupt_Handler:: 
1213 * Pragma Interrupt_State:: 
1214 * Pragma Invariant:: 
1215 * Pragma Java_Constructor:: 
1216 * Pragma Java_Interface:: 
1217 * Pragma Keep_Names:: 
1218 * Pragma License:: 
1219 * Pragma Link_With:: 
1220 * Pragma Linker_Alias:: 
1221 * Pragma Linker_Constructor:: 
1222 * Pragma Linker_Destructor:: 
1223 * Pragma Linker_Section:: 
1224 * Pragma Lock_Free:: 
1225 * Pragma Loop_Invariant:: 
1226 * Pragma Loop_Optimize:: 
1227 * Pragma Loop_Variant:: 
1228 * Pragma Machine_Attribute:: 
1229 * Pragma Main:: 
1230 * Pragma Main_Storage:: 
1231 * Pragma No_Body:: 
1232 * Pragma No_Elaboration_Code_All:: 
1233 * Pragma No_Inline:: 
1234 * Pragma No_Return:: 
1235 * Pragma No_Run_Time:: 
1236 * Pragma No_Strict_Aliasing:: 
1237 * Pragma No_Tagged_Streams:: 
1238 * Pragma Normalize_Scalars:: 
1239 * Pragma Obsolescent:: 
1240 * Pragma Optimize_Alignment:: 
1241 * Pragma Ordered:: 
1242 * Pragma Overflow_Mode:: 
1243 * Pragma Overriding_Renamings:: 
1244 * Pragma Partition_Elaboration_Policy:: 
1245 * Pragma Part_Of:: 
1246 * Pragma Passive:: 
1247 * Pragma Persistent_BSS:: 
1248 * Pragma Polling:: 
1249 * Pragma Post:: 
1250 * Pragma Postcondition:: 
1251 * Pragma Post_Class:: 
1252 * Pragma Pre:: 
1253 * Pragma Precondition:: 
1254 * Pragma Predicate:: 
1255 * Pragma Preelaborable_Initialization:: 
1256 * Pragma Prefix_Exception_Messages:: 
1257 * Pragma Pre_Class:: 
1258 * Pragma Priority_Specific_Dispatching:: 
1259 * Pragma Profile:: 
1260 * Pragma Profile_Warnings:: 
1261 * Pragma Propagate_Exceptions:: 
1262 * Pragma Provide_Shift_Operators:: 
1263 * Pragma Psect_Object:: 
1264 * Pragma Pure_Function:: 
1265 * Pragma Rational:: 
1266 * Pragma Ravenscar:: 
1267 * Pragma Refined_Depends:: 
1268 * Pragma Refined_Global:: 
1269 * Pragma Refined_Post:: 
1270 * Pragma Refined_State:: 
1271 * Pragma Relative_Deadline:: 
1272 * Pragma Remote_Access_Type:: 
1273 * Pragma Restricted_Run_Time:: 
1274 * Pragma Restriction_Warnings:: 
1275 * Pragma Reviewable:: 
1276 * Pragma Share_Generic:: 
1277 * Pragma Shared:: 
1278 * Pragma Short_Circuit_And_Or:: 
1279 * Pragma Short_Descriptors:: 
1280 * Pragma Simple_Storage_Pool_Type:: 
1281 * Pragma Source_File_Name:: 
1282 * Pragma Source_File_Name_Project:: 
1283 * Pragma Source_Reference:: 
1284 * Pragma SPARK_Mode:: 
1285 * Pragma Static_Elaboration_Desired:: 
1286 * Pragma Stream_Convert:: 
1287 * Pragma Style_Checks:: 
1288 * Pragma Subtitle:: 
1289 * Pragma Suppress:: 
1290 * Pragma Suppress_All:: 
1291 * Pragma Suppress_Debug_Info:: 
1292 * Pragma Suppress_Exception_Locations:: 
1293 * Pragma Suppress_Initialization:: 
1294 * Pragma Task_Name:: 
1295 * Pragma Task_Storage:: 
1296 * Pragma Test_Case:: 
1297 * Pragma Thread_Local_Storage:: 
1298 * Pragma Time_Slice:: 
1299 * Pragma Title:: 
1300 * Pragma Type_Invariant:: 
1301 * Pragma Type_Invariant_Class:: 
1302 * Pragma Unchecked_Union:: 
1303 * Pragma Unevaluated_Use_Of_Old:: 
1304 * Pragma Unimplemented_Unit:: 
1305 * Pragma Universal_Aliasing:: 
1306 * Pragma Universal_Data:: 
1307 * Pragma Unmodified:: 
1308 * Pragma Unreferenced:: 
1309 * Pragma Unreferenced_Objects:: 
1310 * Pragma Unreserve_All_Interrupts:: 
1311 * Pragma Unsuppress:: 
1312 * Pragma Use_VADS_Size:: 
1313 * Pragma Validity_Checks:: 
1314 * Pragma Volatile:: 
1315 * Pragma Warning_As_Error:: 
1316 * Pragma Warnings:: 
1317 * Pragma Weak_External:: 
1318 * Pragma Wide_Character_Encoding:: 
1320 @end menu
1322 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1323 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1324 @section Pragma Abort_Defer
1327 @geindex Deferring aborts
1329 Syntax:
1331 @example
1332 pragma Abort_Defer;
1333 @end example
1335 This pragma must appear at the start of the statement sequence of a
1336 handled sequence of statements (right after the @cite{begin}).  It has
1337 the effect of deferring aborts for the sequence of statements (but not
1338 for the declarations or handlers, if any, associated with this statement
1339 sequence).
1341 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1342 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}
1343 @section Pragma Abstract_State
1346 For the description of this pragma, see SPARK 2014 Reference Manual,
1347 section 7.1.4.
1349 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1350 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1d}
1351 @section Pragma Ada_83
1354 Syntax:
1356 @example
1357 pragma Ada_83;
1358 @end example
1360 A configuration pragma that establishes Ada 83 mode for the unit to
1361 which it applies, regardless of the mode set by the command line
1362 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1363 the syntax and semantics of Ada 83, as defined in the original Ada
1364 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1365 and Ada 2005 are not recognized, optional package bodies are allowed,
1366 and generics may name types with unknown discriminants without using
1367 the @cite{(<>)} notation.  In addition, some but not all of the additional
1368 restrictions of Ada 83 are enforced.
1370 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1371 Ada 83 code to be compiled and adapted to GNAT with less effort.
1372 Secondly, it aids in keeping code backwards compatible with Ada 83.
1373 However, there is no guarantee that code that is processed correctly
1374 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1375 83 compiler, since GNAT does not enforce all the additional checks
1376 required by Ada 83.
1378 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1379 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{1e}
1380 @section Pragma Ada_95
1383 Syntax:
1385 @example
1386 pragma Ada_95;
1387 @end example
1389 A configuration pragma that establishes Ada 95 mode for the unit to which
1390 it applies, regardless of the mode set by the command line switches.
1391 This mode is set automatically for the @cite{Ada} and @cite{System}
1392 packages and their children, so you need not specify it in these
1393 contexts.  This pragma is useful when writing a reusable component that
1394 itself uses Ada 95 features, but which is intended to be usable from
1395 either Ada 83 or Ada 95 programs.
1397 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1398 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{1f}
1399 @section Pragma Ada_05
1402 Syntax:
1404 @example
1405 pragma Ada_05;
1406 pragma Ada_05 (local_NAME);
1407 @end example
1409 A configuration pragma that establishes Ada 2005 mode for the unit to which
1410 it applies, regardless of the mode set by the command line switches.
1411 This pragma is useful when writing a reusable component that
1412 itself uses Ada 2005 features, but which is intended to be usable from
1413 either Ada 83 or Ada 95 programs.
1415 The one argument form (which is not a configuration pragma)
1416 is used for managing the transition from
1417 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1418 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1419 mode will generate a warning. In addition, in Ada_83 or Ada_95
1420 mode, a preference rule is established which does not choose
1421 such an entity unless it is unambiguously specified. This avoids
1422 extra subprograms marked this way from generating ambiguities in
1423 otherwise legal pre-Ada_2005 programs. The one argument form is
1424 intended for exclusive use in the GNAT run-time library.
1426 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1427 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{20}
1428 @section Pragma Ada_2005
1431 Syntax:
1433 @example
1434 pragma Ada_2005;
1435 @end example
1437 This configuration pragma is a synonym for pragma Ada_05 and has the
1438 same syntax and effect.
1440 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1441 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{21}
1442 @section Pragma Ada_12
1445 Syntax:
1447 @example
1448 pragma Ada_12;
1449 pragma Ada_12 (local_NAME);
1450 @end example
1452 A configuration pragma that establishes Ada 2012 mode for the unit to which
1453 it applies, regardless of the mode set by the command line switches.
1454 This mode is set automatically for the @cite{Ada} and @cite{System}
1455 packages and their children, so you need not specify it in these
1456 contexts.  This pragma is useful when writing a reusable component that
1457 itself uses Ada 2012 features, but which is intended to be usable from
1458 Ada 83, Ada 95, or Ada 2005 programs.
1460 The one argument form, which is not a configuration pragma,
1461 is used for managing the transition from Ada
1462 2005 to Ada 2012 in the run-time library. If an entity is marked
1463 as Ada_201 only, then referencing the entity in any pre-Ada_2012
1464 mode will generate a warning. In addition, in any pre-Ada_2012
1465 mode, a preference rule is established which does not choose
1466 such an entity unless it is unambiguously specified. This avoids
1467 extra subprograms marked this way from generating ambiguities in
1468 otherwise legal pre-Ada_2012 programs. The one argument form is
1469 intended for exclusive use in the GNAT run-time library.
1471 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1472 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{22}
1473 @section Pragma Ada_2012
1476 Syntax:
1478 @example
1479 pragma Ada_2012;
1480 @end example
1482 This configuration pragma is a synonym for pragma Ada_12 and has the
1483 same syntax and effect.
1485 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1486 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{23}
1487 @section Pragma Allow_Integer_Address
1490 Syntax:
1492 @example
1493 pragma Allow_Integer_Address;
1494 @end example
1496 In almost all versions of GNAT, @cite{System.Address} is a private
1497 type in accordance with the implementation advice in the RM. This
1498 means that integer values,
1499 in particular integer literals, are not allowed as address values.
1500 If the configuration pragma
1501 @cite{Allow_Integer_Address} is given, then integer expressions may
1502 be used anywhere a value of type @cite{System.Address} is required.
1503 The effect is to introduce an implicit unchecked conversion from the
1504 integer value to type @cite{System.Address}. The reverse case of using
1505 an address where an integer type is required is handled analogously.
1506 The following example compiles without errors:
1508 @example
1509 pragma Allow_Integer_Address;
1510 with System; use System;
1511 package AddrAsInt is
1512    X : Integer;
1513    Y : Integer;
1514    for X'Address use 16#1240#;
1515    for Y use at 16#3230#;
1516    m : Address := 16#4000#;
1517    n : constant Address := 4000;
1518    p : constant Address := Address (X + Y);
1519    v : Integer := y'Address;
1520    w : constant Integer := Integer (Y'Address);
1521    type R is new integer;
1522    RR : R := 1000;
1523    Z : Integer;
1524    for Z'Address use RR;
1525 end AddrAsInt;
1526 @end example
1528 Note that pragma @cite{Allow_Integer_Address} is ignored if @cite{System.Address}
1529 is not a private type. In implementations of @cite{GNAT} where
1530 System.Address is a visible integer type,
1531 this pragma serves no purpose but is ignored
1532 rather than rejected to allow common sets of sources to be used
1533 in the two situations.
1535 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1536 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{24}
1537 @section Pragma Annotate
1540 Syntax:
1542 @example
1543 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1545 ARG ::= NAME | EXPRESSION
1546 @end example
1548 This pragma is used to annotate programs.  @cite{identifier} identifies
1549 the type of annotation.  GNAT verifies that it is an identifier, but does
1550 not otherwise analyze it. The second optional identifier is also left
1551 unanalyzed, and by convention is used to control the action of the tool to
1552 which the annotation is addressed.  The remaining @cite{arg} arguments
1553 can be either string literals or more generally expressions.
1554 String literals are assumed to be either of type
1555 @cite{Standard.String} or else @cite{Wide_String} or @cite{Wide_Wide_String}
1556 depending on the character literals they contain.
1557 All other kinds of arguments are analyzed as expressions, and must be
1558 unambiguous. The last argument if present must have the identifier
1559 @cite{Entity} and GNAT verifies that a local name is given.
1561 The analyzed pragma is retained in the tree, but not otherwise processed
1562 by any part of the GNAT compiler, except to generate corresponding note
1563 lines in the generated ALI file. For the format of these note lines, see
1564 the compiler source file lib-writ.ads. This pragma is intended for use by
1565 external tools, including ASIS. The use of pragma Annotate does not
1566 affect the compilation process in any way. This pragma may be used as
1567 a configuration pragma.
1569 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1570 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{25}
1571 @section Pragma Assert
1574 Syntax:
1576 @example
1577 pragma Assert (
1578   boolean_EXPRESSION
1579   [, string_EXPRESSION]);
1580 @end example
1582 The effect of this pragma depends on whether the corresponding command
1583 line switch is set to activate assertions.  The pragma expands into code
1584 equivalent to the following:
1586 @example
1587 if assertions-enabled then
1588    if not boolean_EXPRESSION then
1589       System.Assertions.Raise_Assert_Failure
1590         (string_EXPRESSION);
1591    end if;
1592 end if;
1593 @end example
1595 The string argument, if given, is the message that will be associated
1596 with the exception occurrence if the exception is raised.  If no second
1597 argument is given, the default message is @cite{file}:@cite{nnn},
1598 where @cite{file} is the name of the source file containing the assert,
1599 and @cite{nnn} is the line number of the assert.  A pragma is not a
1600 statement, so if a statement sequence contains nothing but a pragma
1601 assert, then a null statement is required in addition, as in:
1603 @example
1605 if J > 3 then
1606    pragma Assert (K > 3, "Bad value for K");
1607    null;
1608 end if;
1609 @end example
1611 Note that, as with the @cite{if} statement to which it is equivalent, the
1612 type of the expression is either @cite{Standard.Boolean}, or any type derived
1613 from this standard type.
1615 Assert checks can be either checked or ignored. By default they are ignored.
1616 They will be checked if either the command line switch @emph{-gnata} is
1617 used, or if an @cite{Assertion_Policy} or @cite{Check_Policy} pragma is used
1618 to enable @cite{Assert_Checks}.
1620 If assertions are ignored, then there
1621 is no run-time effect (and in particular, any side effects from the
1622 expression will not occur at run time).  (The expression is still
1623 analyzed at compile time, and may cause types to be frozen if they are
1624 mentioned here for the first time).
1626 If assertions are checked, then the given expression is tested, and if
1627 it is @cite{False} then @cite{System.Assertions.Raise_Assert_Failure} is called
1628 which results in the raising of @cite{Assert_Failure} with the given message.
1630 You should generally avoid side effects in the expression arguments of
1631 this pragma, because these side effects will turn on and off with the
1632 setting of the assertions mode, resulting in assertions that have an
1633 effect on the program.  However, the expressions are analyzed for
1634 semantic correctness whether or not assertions are enabled, so turning
1635 assertions on and off cannot affect the legality of a program.
1637 Note that the implementation defined policy @cite{DISABLE}, given in a
1638 pragma @cite{Assertion_Policy}, can be used to suppress this semantic analysis.
1640 Note: this is a standard language-defined pragma in versions
1641 of Ada from 2005 on. In GNAT, it is implemented in all versions
1642 of Ada, and the DISABLE policy is an implementation-defined
1643 addition.
1645 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1646 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{26}
1647 @section Pragma Assert_And_Cut
1650 Syntax:
1652 @example
1653 pragma Assert_And_Cut (
1654   boolean_EXPRESSION
1655   [, string_EXPRESSION]);
1656 @end example
1658 The effect of this pragma is identical to that of pragma @cite{Assert},
1659 except that in an @cite{Assertion_Policy} pragma, the identifier
1660 @cite{Assert_And_Cut} is used to control whether it is ignored or checked
1661 (or disabled).
1663 The intention is that this be used within a subprogram when the
1664 given test expresion sums up all the work done so far in the
1665 subprogram, so that the rest of the subprogram can be verified
1666 (informally or formally) using only the entry preconditions,
1667 and the expression in this pragma. This allows dividing up
1668 a subprogram into sections for the purposes of testing or
1669 formal verification. The pragma also serves as useful
1670 documentation.
1672 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1673 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{27}
1674 @section Pragma Assertion_Policy
1677 Syntax:
1679 @example
1680 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1682 pragma Assertion_Policy (
1683     ASSERTION_KIND => POLICY_IDENTIFIER
1684  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1686 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1688 RM_ASSERTION_KIND ::= Assert               |
1689                       Static_Predicate     |
1690                       Dynamic_Predicate    |
1691                       Pre                  |
1692                       Pre'Class            |
1693                       Post                 |
1694                       Post'Class           |
1695                       Type_Invariant       |
1696                       Type_Invariant'Class
1698 ID_ASSERTION_KIND ::= Assertions           |
1699                       Assert_And_Cut       |
1700                       Assume               |
1701                       Contract_Cases       |
1702                       Debug                |
1703                       Invariant            |
1704                       Invariant'Class      |
1705                       Loop_Invariant       |
1706                       Loop_Variant         |
1707                       Postcondition        |
1708                       Precondition         |
1709                       Predicate            |
1710                       Refined_Post         |
1711                       Statement_Assertions
1713 POLICY_IDENTIFIER ::= Check | Disable | Ignore
1714 @end example
1716 This is a standard Ada 2012 pragma that is available as an
1717 implementation-defined pragma in earlier versions of Ada.
1718 The assertion kinds @cite{RM_ASSERTION_KIND} are those defined in
1719 the Ada standard. The assertion kinds @cite{ID_ASSERTION_KIND}
1720 are implementation defined additions recognized by the GNAT compiler.
1722 The pragma applies in both cases to pragmas and aspects with matching
1723 names, e.g. @cite{Pre} applies to the Pre aspect, and @cite{Precondition}
1724 applies to both the @cite{Precondition} pragma
1725 and the aspect @cite{Precondition}. Note that the identifiers for
1726 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1727 Pre_Class and Post_Class), since these pragmas are intended to be
1728 identical to the corresponding aspects).
1730 If the policy is @cite{CHECK}, then assertions are enabled, i.e.
1731 the corresponding pragma or aspect is activated.
1732 If the policy is @cite{IGNORE}, then assertions are ignored, i.e.
1733 the corresponding pragma or aspect is deactivated.
1734 This pragma overrides the effect of the @emph{-gnata} switch on the
1735 command line.
1737 The implementation defined policy @cite{DISABLE} is like
1738 @cite{IGNORE} except that it completely disables semantic
1739 checking of the corresponding pragma or aspect. This is
1740 useful when the pragma or aspect argument references subprograms
1741 in a with'ed package which is replaced by a dummy package
1742 for the final build.
1744 The implementation defined assertion kind @cite{Assertions} applies to all
1745 assertion kinds. The form with no assertion kind given implies this
1746 choice, so it applies to all assertion kinds (RM defined, and
1747 implementation defined).
1749 The implementation defined assertion kind @cite{Statement_Assertions}
1750 applies to @cite{Assert}, @cite{Assert_And_Cut},
1751 @cite{Assume}, @cite{Loop_Invariant}, and @cite{Loop_Variant}.
1753 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1754 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{28}
1755 @section Pragma Assume
1758 Syntax:
1760 @example
1761 pragma Assume (
1762   boolean_EXPRESSION
1763   [, string_EXPRESSION]);
1764 @end example
1766 The effect of this pragma is identical to that of pragma @cite{Assert},
1767 except that in an @cite{Assertion_Policy} pragma, the identifier
1768 @cite{Assume} is used to control whether it is ignored or checked
1769 (or disabled).
1771 The intention is that this be used for assumptions about the
1772 external environment. So you cannot expect to verify formally
1773 or informally that the condition is met, this must be
1774 established by examining things outside the program itself.
1775 For example, we may have code that depends on the size of
1776 @cite{Long_Long_Integer} being at least 64. So we could write:
1778 @example
1779 pragma Assume (Long_Long_Integer'Size >= 64);
1780 @end example
1782 This assumption cannot be proved from the program itself,
1783 but it acts as a useful run-time check that the assumption
1784 is met, and documents the need to ensure that it is met by
1785 reference to information outside the program.
1787 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1788 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{29}
1789 @section Pragma Assume_No_Invalid_Values
1792 @geindex Invalid representations
1794 @geindex Invalid values
1796 Syntax:
1798 @example
1799 pragma Assume_No_Invalid_Values (On | Off);
1800 @end example
1802 This is a configuration pragma that controls the assumptions made by the
1803 compiler about the occurrence of invalid representations (invalid values)
1804 in the code.
1806 The default behavior (corresponding to an Off argument for this pragma), is
1807 to assume that values may in general be invalid unless the compiler can
1808 prove they are valid. Consider the following example:
1810 @example
1811 V1 : Integer range 1 .. 10;
1812 V2 : Integer range 11 .. 20;
1814 for J in V2 .. V1 loop
1815    ...
1816 end loop;
1817 @end example
1819 if V1 and V2 have valid values, then the loop is known at compile
1820 time not to execute since the lower bound must be greater than the
1821 upper bound. However in default mode, no such assumption is made,
1822 and the loop may execute. If @cite{Assume_No_Invalid_Values (On)}
1823 is given, the compiler will assume that any occurrence of a variable
1824 other than in an explicit @cite{'Valid} test always has a valid
1825 value, and the loop above will be optimized away.
1827 The use of @cite{Assume_No_Invalid_Values (On)} is appropriate if
1828 you know your code is free of uninitialized variables and other
1829 possible sources of invalid representations, and may result in
1830 more efficient code. A program that accesses an invalid representation
1831 with this pragma in effect is erroneous, so no guarantees can be made
1832 about its behavior.
1834 It is peculiar though permissible to use this pragma in conjunction
1835 with validity checking (-gnatVa). In such cases, accessing invalid
1836 values will generally give an exception, though formally the program
1837 is erroneous so there are no guarantees that this will always be the
1838 case, and it is recommended that these two options not be used together.
1840 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
1841 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{2a}
1842 @section Pragma Async_Readers
1845 For the description of this pragma, see SPARK 2014 Reference Manual,
1846 section 7.1.2.
1848 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
1849 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{2b}
1850 @section Pragma Async_Writers
1853 For the description of this pragma, see SPARK 2014 Reference Manual,
1854 section 7.1.2.
1856 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
1857 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{2c}
1858 @section Pragma Attribute_Definition
1861 Syntax:
1863 @example
1864 pragma Attribute_Definition
1865   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1866    [Entity     =>] LOCAL_NAME,
1867    [Expression =>] EXPRESSION | NAME);
1868 @end example
1870 If @cite{Attribute} is a known attribute name, this pragma is equivalent to
1871 the attribute definition clause:
1873 @example
1874 for Entity'Attribute use Expression;
1875 @end example
1877 If @cite{Attribute} is not a recognized attribute name, the pragma is
1878 ignored, and a warning is emitted. This allows source
1879 code to be written that takes advantage of some new attribute, while remaining
1880 compilable with earlier compilers.
1882 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
1883 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{2d}
1884 @section Pragma C_Pass_By_Copy
1887 @geindex Passing by copy
1889 Syntax:
1891 @example
1892 pragma C_Pass_By_Copy
1893   ([Max_Size =>] static_integer_EXPRESSION);
1894 @end example
1896 Normally the default mechanism for passing C convention records to C
1897 convention subprograms is to pass them by reference, as suggested by RM
1898 B.3(69).  Use the configuration pragma @cite{C_Pass_By_Copy} to change
1899 this default, by requiring that record formal parameters be passed by
1900 copy if all of the following conditions are met:
1903 @itemize *
1905 @item 
1906 The size of the record type does not exceed the value specified for
1907 @cite{Max_Size}.
1909 @item 
1910 The record type has @cite{Convention C}.
1912 @item 
1913 The formal parameter has this record type, and the subprogram has a
1914 foreign (non-Ada) convention.
1915 @end itemize
1917 If these conditions are met the argument is passed by copy; i.e., in a
1918 manner consistent with what C expects if the corresponding formal in the
1919 C prototype is a struct (rather than a pointer to a struct).
1921 You can also pass records by copy by specifying the convention
1922 @cite{C_Pass_By_Copy} for the record type, or by using the extended
1923 @cite{Import} and @cite{Export} pragmas, which allow specification of
1924 passing mechanisms on a parameter by parameter basis.
1926 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
1927 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{2e}
1928 @section Pragma Check
1931 @geindex Assertions
1933 @geindex Named assertions
1935 Syntax:
1937 @example
1938 pragma Check (
1939      [Name    =>] CHECK_KIND,
1940      [Check   =>] Boolean_EXPRESSION
1941   [, [Message =>] string_EXPRESSION] );
1943 CHECK_KIND ::= IDENTIFIER           |
1944                Pre'Class            |
1945                Post'Class           |
1946                Type_Invariant'Class |
1947                Invariant'Class
1948 @end example
1950 This pragma is similar to the predefined pragma @cite{Assert} except that an
1951 extra identifier argument is present. In conjunction with pragma
1952 @cite{Check_Policy}, this can be used to define groups of assertions that can
1953 be independently controlled. The identifier @cite{Assertion} is special, it
1954 refers to the normal set of pragma @cite{Assert} statements.
1956 Checks introduced by this pragma are normally deactivated by default. They can
1957 be activated either by the command line option @emph{-gnata}, which turns on
1958 all checks, or individually controlled using pragma @cite{Check_Policy}.
1960 The identifiers @cite{Assertions} and @cite{Statement_Assertions} are not
1961 permitted as check kinds, since this would cause confusion with the use
1962 of these identifiers in @cite{Assertion_Policy} and @cite{Check_Policy}
1963 pragmas, where they are used to refer to sets of assertions.
1965 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
1966 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{2f}
1967 @section Pragma Check_Float_Overflow
1970 @geindex Floating-point overflow
1972 Syntax:
1974 @example
1975 pragma Check_Float_Overflow;
1976 @end example
1978 In Ada, the predefined floating-point types (@cite{Short_Float},
1979 @cite{Float}, @cite{Long_Float}, @cite{Long_Long_Float}) are
1980 defined to be @emph{unconstrained}. This means that even though each
1981 has a well-defined base range, an operation that delivers a result
1982 outside this base range is not required to raise an exception.
1983 This implementation permission accommodates the notion
1984 of infinities in IEEE floating-point, and corresponds to the
1985 efficient execution mode on most machines. GNAT will not raise
1986 overflow exceptions on these machines; instead it will generate
1987 infinities and NaN's as defined in the IEEE standard.
1989 Generating infinities, although efficient, is not always desirable.
1990 Often the preferable approach is to check for overflow, even at the
1991 (perhaps considerable) expense of run-time performance.
1992 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
1993 range constraints -- and indeed such a subtype
1994 can have the same base range as its base type. For example:
1996 @example
1997 subtype My_Float is Float range Float'Range;
1998 @end example
2000 Here @cite{My_Float} has the same range as
2001 @cite{Float} but is constrained, so operations on
2002 @cite{My_Float} values will be checked for overflow
2003 against this range.
2005 This style will achieve the desired goal, but
2006 it is often more convenient to be able to simply use
2007 the standard predefined floating-point types as long
2008 as overflow checking could be guaranteed.
2009 The @cite{Check_Float_Overflow}
2010 configuration pragma achieves this effect. If a unit is compiled
2011 subject to this configuration pragma, then all operations
2012 on predefined floating-point types including operations on
2013 base types of these floating-point types will be treated as
2014 though those types were constrained, and overflow checks
2015 will be generated. The @cite{Constraint_Error}
2016 exception is raised if the result is out of range.
2018 This mode can also be set by use of the compiler
2019 switch @emph{-gnateF}.
2021 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2022 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{30}
2023 @section Pragma Check_Name
2026 @geindex Defining check names
2028 @geindex Check names
2029 @geindex defining
2031 Syntax:
2033 @example
2034 pragma Check_Name (check_name_IDENTIFIER);
2035 @end example
2037 This is a configuration pragma that defines a new implementation
2038 defined check name (unless IDENTIFIER matches one of the predefined
2039 check names, in which case the pragma has no effect). Check names
2040 are global to a partition, so if two or more configuration pragmas
2041 are present in a partition mentioning the same name, only one new
2042 check name is introduced.
2044 An implementation defined check name introduced with this pragma may
2045 be used in only three contexts: @cite{pragma Suppress},
2046 @cite{pragma Unsuppress},
2047 and as the prefix of a @cite{Check_Name'Enabled} attribute reference. For
2048 any of these three cases, the check name must be visible. A check
2049 name is visible if it is in the configuration pragmas applying to
2050 the current unit, or if it appears at the start of any unit that
2051 is part of the dependency set of the current unit (e.g., units that
2052 are mentioned in @cite{with} clauses).
2054 Check names introduced by this pragma are subject to control by compiler
2055 switches (in particular -gnatp) in the usual manner.
2057 @node Pragma Check_Policy,Pragma CIL_Constructor,Pragma Check_Name,Implementation Defined Pragmas
2058 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{31}
2059 @section Pragma Check_Policy
2062 @geindex Controlling assertions
2064 @geindex Assertions
2065 @geindex control
2067 @geindex Check pragma control
2069 @geindex Named assertions
2071 Syntax:
2073 @example
2074 pragma Check_Policy
2075  ([Name   =>] CHECK_KIND,
2076   [Policy =>] POLICY_IDENTIFIER);
2078 pragma Check_Policy (
2079     CHECK_KIND => POLICY_IDENTIFIER
2080  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2082 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2084 CHECK_KIND ::= IDENTIFIER           |
2085                Pre'Class            |
2086                Post'Class           |
2087                Type_Invariant'Class |
2088                Invariant'Class
2090 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2091 avoids confusion between the two possible syntax forms for this pragma.
2093 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2094 @end example
2096 This pragma is used to set the checking policy for assertions (specified
2097 by aspects or pragmas), the @cite{Debug} pragma, or additional checks
2098 to be checked using the @cite{Check} pragma. It may appear either as
2099 a configuration pragma, or within a declarative part of package. In the
2100 latter case, it applies from the point where it appears to the end of
2101 the declarative region (like pragma @cite{Suppress}).
2103 The @cite{Check_Policy} pragma is similar to the
2104 predefined @cite{Assertion_Policy} pragma,
2105 and if the check kind corresponds to one of the assertion kinds that
2106 are allowed by @cite{Assertion_Policy}, then the effect is identical.
2108 If the first argument is Debug, then the policy applies to Debug pragmas,
2109 disabling their effect if the policy is @cite{OFF}, @cite{DISABLE}, or
2110 @cite{IGNORE}, and allowing them to execute with normal semantics if
2111 the policy is @cite{ON} or @cite{CHECK}. In addition if the policy is
2112 @cite{DISABLE}, then the procedure call in @cite{Debug} pragmas will
2113 be totally ignored and not analyzed semantically.
2115 Finally the first argument may be some other identifier than the above
2116 possibilities, in which case it controls a set of named assertions
2117 that can be checked using pragma @cite{Check}. For example, if the pragma:
2119 @example
2120 pragma Check_Policy (Critical_Error, OFF);
2121 @end example
2123 is given, then subsequent @cite{Check} pragmas whose first argument is also
2124 @cite{Critical_Error} will be disabled.
2126 The check policy is @cite{OFF} to turn off corresponding checks, and @cite{ON}
2127 to turn on corresponding checks. The default for a set of checks for which no
2128 @cite{Check_Policy} is given is @cite{OFF} unless the compiler switch
2129 @emph{-gnata} is given, which turns on all checks by default.
2131 The check policy settings @cite{CHECK} and @cite{IGNORE} are recognized
2132 as synonyms for @cite{ON} and @cite{OFF}. These synonyms are provided for
2133 compatibility with the standard @cite{Assertion_Policy} pragma. The check
2134 policy setting @cite{DISABLE} causes the second argument of a corresponding
2135 @cite{Check} pragma to be completely ignored and not analyzed.
2137 @node Pragma CIL_Constructor,Pragma Comment,Pragma Check_Policy,Implementation Defined Pragmas
2138 @anchor{gnat_rm/implementation_defined_pragmas pragma-cil-constructor}@anchor{32}
2139 @section Pragma CIL_Constructor
2142 Syntax:
2144 @example
2145 pragma CIL_Constructor ([Entity =>] function_LOCAL_NAME);
2146 @end example
2148 This pragma is used to assert that the specified Ada function should be
2149 mapped to the .NET constructor for some Ada tagged record type.
2151 See section 4.1 of the
2152 @cite{GNAT User's Guide: Supplement for the .NET Platform.}
2153 for related information.
2155 @node Pragma Comment,Pragma Common_Object,Pragma CIL_Constructor,Implementation Defined Pragmas
2156 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{33}
2157 @section Pragma Comment
2160 Syntax:
2162 @example
2163 pragma Comment (static_string_EXPRESSION);
2164 @end example
2166 This is almost identical in effect to pragma @cite{Ident}.  It allows the
2167 placement of a comment into the object file and hence into the
2168 executable file if the operating system permits such usage.  The
2169 difference is that @cite{Comment}, unlike @cite{Ident}, has
2170 no limitations on placement of the pragma (it can be placed
2171 anywhere in the main source unit), and if more than one pragma
2172 is used, all comments are retained.
2174 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2175 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{34}
2176 @section Pragma Common_Object
2179 Syntax:
2181 @example
2182 pragma Common_Object (
2183      [Internal =>] LOCAL_NAME
2184   [, [External =>] EXTERNAL_SYMBOL]
2185   [, [Size     =>] EXTERNAL_SYMBOL] );
2187 EXTERNAL_SYMBOL ::=
2188   IDENTIFIER
2189 | static_string_EXPRESSION
2190 @end example
2192 This pragma enables the shared use of variables stored in overlaid
2193 linker areas corresponding to the use of @cite{COMMON}
2194 in Fortran.  The single
2195 object @cite{LOCAL_NAME} is assigned to the area designated by
2196 the @cite{External} argument.
2197 You may define a record to correspond to a series
2198 of fields.  The @cite{Size} argument
2199 is syntax checked in GNAT, but otherwise ignored.
2201 @cite{Common_Object} is not supported on all platforms.  If no
2202 support is available, then the code generator will issue a message
2203 indicating that the necessary attribute for implementation of this
2204 pragma is not available.
2206 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2207 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{35}
2208 @section Pragma Compile_Time_Error
2211 Syntax:
2213 @example
2214 pragma Compile_Time_Error
2215          (boolean_EXPRESSION, static_string_EXPRESSION);
2216 @end example
2218 This pragma can be used to generate additional compile time
2219 error messages. It
2220 is particularly useful in generics, where errors can be issued for
2221 specific problematic instantiations. The first parameter is a boolean
2222 expression. The pragma is effective only if the value of this expression
2223 is known at compile time, and has the value True. The set of expressions
2224 whose values are known at compile time includes all static boolean
2225 expressions, and also other values which the compiler can determine
2226 at compile time (e.g., the size of a record type set by an explicit
2227 size representation clause, or the value of a variable which was
2228 initialized to a constant and is known not to have been modified).
2229 If these conditions are met, an error message is generated using
2230 the value given as the second argument. This string value may contain
2231 embedded ASCII.LF characters to break the message into multiple lines.
2233 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2234 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{36}
2235 @section Pragma Compile_Time_Warning
2238 Syntax:
2240 @example
2241 pragma Compile_Time_Warning
2242          (boolean_EXPRESSION, static_string_EXPRESSION);
2243 @end example
2245 Same as pragma Compile_Time_Error, except a warning is issued instead
2246 of an error message. Note that if this pragma is used in a package that
2247 is with'ed by a client, the client will get the warning even though it
2248 is issued by a with'ed package (normally warnings in with'ed units are
2249 suppressed, but this is a special exception to that rule).
2251 One typical use is within a generic where compile time known characteristics
2252 of formal parameters are tested, and warnings given appropriately. Another use
2253 with a first parameter of True is to warn a client about use of a package,
2254 for example that it is not fully implemented.
2256 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2257 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{37}
2258 @section Pragma Compiler_Unit
2261 Syntax:
2263 @example
2264 pragma Compiler_Unit;
2265 @end example
2267 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2268 retained so that old versions of the GNAT run-time that use this pragma can
2269 be compiled with newer versions of the compiler.
2271 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2272 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{38}
2273 @section Pragma Compiler_Unit_Warning
2276 Syntax:
2278 @example
2279 pragma Compiler_Unit_Warning;
2280 @end example
2282 This pragma is intended only for internal use in the GNAT run-time library.
2283 It indicates that the unit is used as part of the compiler build. The effect
2284 is to generate warnings for the use of constructs (for example, conditional
2285 expressions) that would cause trouble when bootstrapping using an older
2286 version of GNAT. For the exact list of restrictions, see the compiler sources
2287 and references to Check_Compiler_Unit.
2289 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2290 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{39}
2291 @section Pragma Complete_Representation
2294 Syntax:
2296 @example
2297 pragma Complete_Representation;
2298 @end example
2300 This pragma must appear immediately within a record representation
2301 clause. Typical placements are before the first component clause
2302 or after the last component clause. The effect is to give an error
2303 message if any component is missing a component clause. This pragma
2304 may be used to ensure that a record representation clause is
2305 complete, and that this invariant is maintained if fields are
2306 added to the record in the future.
2308 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2309 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3a}
2310 @section Pragma Complex_Representation
2313 Syntax:
2315 @example
2316 pragma Complex_Representation
2317         ([Entity =>] LOCAL_NAME);
2318 @end example
2320 The @cite{Entity} argument must be the name of a record type which has
2321 two fields of the same floating-point type.  The effect of this pragma is
2322 to force gcc to use the special internal complex representation form for
2323 this record, which may be more efficient.  Note that this may result in
2324 the code for this type not conforming to standard ABI (application
2325 binary interface) requirements for the handling of record types.  For
2326 example, in some environments, there is a requirement for passing
2327 records by pointer, and the use of this pragma may result in passing
2328 this type in floating-point registers.
2330 @node Pragma Component_Alignment,Pragma Contract_Cases,Pragma Complex_Representation,Implementation Defined Pragmas
2331 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{3b}
2332 @section Pragma Component_Alignment
2335 @geindex Alignments of components
2337 @geindex Pragma Component_Alignment
2339 Syntax:
2341 @example
2342 pragma Component_Alignment (
2343      [Form =>] ALIGNMENT_CHOICE
2344   [, [Name =>] type_LOCAL_NAME]);
2346 ALIGNMENT_CHOICE ::=
2347   Component_Size
2348 | Component_Size_4
2349 | Storage_Unit
2350 | Default
2351 @end example
2353 Specifies the alignment of components in array or record types.
2354 The meaning of the @cite{Form} argument is as follows:
2356 @quotation
2358 @geindex Component_Size (in pragma Component_Alignment)
2359 @end quotation
2362 @table @asis
2364 @item @emph{Component_Size}
2366 Aligns scalar components and subcomponents of the array or record type
2367 on boundaries appropriate to their inherent size (naturally
2368 aligned).  For example, 1-byte components are aligned on byte boundaries,
2369 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2370 integer components are aligned on 4-byte boundaries and so on.  These
2371 alignment rules correspond to the normal rules for C compilers on all
2372 machines except the VAX.
2374 @geindex Component_Size_4 (in pragma Component_Alignment)
2376 @item @emph{Component_Size_4}
2378 Naturally aligns components with a size of four or fewer
2379 bytes.  Components that are larger than 4 bytes are placed on the next
2380 4-byte boundary.
2382 @geindex Storage_Unit (in pragma Component_Alignment)
2384 @item @emph{Storage_Unit}
2386 Specifies that array or record components are byte aligned, i.e.,
2387 aligned on boundaries determined by the value of the constant
2388 @cite{System.Storage_Unit}.
2390 @geindex Default (in pragma Component_Alignment)
2392 @item @emph{Default}
2394 Specifies that array or record components are aligned on default
2395 boundaries, appropriate to the underlying hardware or operating system or
2396 both. The @cite{Default} choice is the same as @cite{Component_Size} (natural
2397 alignment).
2398 @end table
2400 If the @cite{Name} parameter is present, @cite{type_LOCAL_NAME} must
2401 refer to a local record or array type, and the specified alignment
2402 choice applies to the specified type.  The use of
2403 @cite{Component_Alignment} together with a pragma @cite{Pack} causes the
2404 @cite{Component_Alignment} pragma to be ignored.  The use of
2405 @cite{Component_Alignment} together with a record representation clause
2406 is only effective for fields not specified by the representation clause.
2408 If the @cite{Name} parameter is absent, the pragma can be used as either
2409 a configuration pragma, in which case it applies to one or more units in
2410 accordance with the normal rules for configuration pragmas, or it can be
2411 used within a declarative part, in which case it applies to types that
2412 are declared within this declarative part, or within any nested scope
2413 within this declarative part.  In either case it specifies the alignment
2414 to be applied to any record or array type which has otherwise standard
2415 representation.
2417 If the alignment for a record or array type is not specified (using
2418 pragma @cite{Pack}, pragma @cite{Component_Alignment}, or a record rep
2419 clause), the GNAT uses the default alignment as described previously.
2421 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Component_Alignment,Implementation Defined Pragmas
2422 @anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{3c}
2423 @section Pragma Contract_Cases
2426 @geindex Contract cases
2428 Syntax:
2430 @example
2431 pragma Contract_Cases (
2432    Condition => Consequence
2433  @{,Condition => Consequence@});
2434 @end example
2436 The @cite{Contract_Cases} pragma allows defining fine-grain specifications
2437 that can complement or replace the contract given by a precondition and a
2438 postcondition. Additionally, the @cite{Contract_Cases} pragma can be used
2439 by testing and formal verification tools. The compiler checks its validity and,
2440 depending on the assertion policy at the point of declaration of the pragma,
2441 it may insert a check in the executable. For code generation, the contract
2442 cases
2444 @example
2445 pragma Contract_Cases (
2446   Cond1 => Pred1,
2447   Cond2 => Pred2);
2448 @end example
2450 are equivalent to
2452 @example
2453 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2454 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2455 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2456 pragma Postcondition (if C1 then Pred1);
2457 pragma Postcondition (if C2 then Pred2);
2458 @end example
2460 The precondition ensures that one and only one of the conditions is
2461 satisfied on entry to the subprogram.
2462 The postcondition ensures that for the condition that was True on entry,
2463 the corrresponding consequence is True on exit. Other consequence expressions
2464 are not evaluated.
2466 A precondition @cite{P} and postcondition @cite{Q} can also be
2467 expressed as contract cases:
2469 @example
2470 pragma Contract_Cases (P => Q);
2471 @end example
2473 The placement and visibility rules for @cite{Contract_Cases} pragmas are
2474 identical to those described for preconditions and postconditions.
2476 The compiler checks that boolean expressions given in conditions and
2477 consequences are valid, where the rules for conditions are the same as
2478 the rule for an expression in @cite{Precondition} and the rules for
2479 consequences are the same as the rule for an expression in
2480 @cite{Postcondition}. In particular, attributes @cite{'Old} and
2481 @cite{'Result} can only be used within consequence expressions.
2482 The condition for the last contract case may be @cite{others}, to denote
2483 any case not captured by the previous cases. The
2484 following is an example of use within a package spec:
2486 @example
2487 package Math_Functions is
2488    ...
2489    function Sqrt (Arg : Float) return Float;
2490    pragma Contract_Cases ((Arg in 0 .. 99) => Sqrt'Result < 10,
2491                           Arg >= 100       => Sqrt'Result >= 10,
2492                           others           => Sqrt'Result = 0);
2493    ...
2494 end Math_Functions;
2495 @end example
2497 The meaning of contract cases is that only one case should apply at each
2498 call, as determined by the corresponding condition evaluating to True,
2499 and that the consequence for this case should hold when the subprogram
2500 returns.
2502 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2503 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{3d}
2504 @section Pragma Convention_Identifier
2507 @geindex Conventions
2508 @geindex synonyms
2510 Syntax:
2512 @example
2513 pragma Convention_Identifier (
2514          [Name =>]       IDENTIFIER,
2515          [Convention =>] convention_IDENTIFIER);
2516 @end example
2518 This pragma provides a mechanism for supplying synonyms for existing
2519 convention identifiers. The @cite{Name} identifier can subsequently
2520 be used as a synonym for the given convention in other pragmas (including
2521 for example pragma @cite{Import} or another @cite{Convention_Identifier}
2522 pragma). As an example of the use of this, suppose you had legacy code
2523 which used Fortran77 as the identifier for Fortran. Then the pragma:
2525 @example
2526 pragma Convention_Identifier (Fortran77, Fortran);
2527 @end example
2529 would allow the use of the convention identifier @cite{Fortran77} in
2530 subsequent code, avoiding the need to modify the sources. As another
2531 example, you could use this to parameterize convention requirements
2532 according to systems. Suppose you needed to use @cite{Stdcall} on
2533 windows systems, and @cite{C} on some other system, then you could
2534 define a convention identifier @cite{Library} and use a single
2535 @cite{Convention_Identifier} pragma to specify which convention
2536 would be used system-wide.
2538 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2539 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{3e}
2540 @section Pragma CPP_Class
2543 @geindex Interfacing with C++
2545 Syntax:
2547 @example
2548 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2549 @end example
2551 The argument denotes an entity in the current declarative region that is
2552 declared as a record type. It indicates that the type corresponds to an
2553 externally declared C++ class type, and is to be laid out the same way
2554 that C++ would lay out the type. If the C++ class has virtual primitives
2555 then the record must be declared as a tagged record type.
2557 Types for which @cite{CPP_Class} is specified do not have assignment or
2558 equality operators defined (such operations can be imported or declared
2559 as subprograms as required). Initialization is allowed only by constructor
2560 functions (see pragma @cite{CPP_Constructor}). Such types are implicitly
2561 limited if not explicitly declared as limited or derived from a limited
2562 type, and an error is issued in that case.
2564 See @ref{3f,,Interfacing to C++} for related information.
2566 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
2567 for backward compatibility but its functionality is available
2568 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
2570 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2571 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{40}
2572 @section Pragma CPP_Constructor
2575 @geindex Interfacing with C++
2577 Syntax:
2579 @example
2580 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2581   [, [External_Name =>] static_string_EXPRESSION ]
2582   [, [Link_Name     =>] static_string_EXPRESSION ]);
2583 @end example
2585 This pragma identifies an imported function (imported in the usual way
2586 with pragma @cite{Import}) as corresponding to a C++ constructor. If
2587 @cite{External_Name} and @cite{Link_Name} are not specified then the
2588 @cite{Entity} argument is a name that must have been previously mentioned
2589 in a pragma @cite{Import} with @cite{Convention} = @cite{CPP}. Such name
2590 must be of one of the following forms:
2593 @itemize *
2595 @item 
2596 @strong{function} @cite{Fname} @strong{return} T`
2598 @item 
2599 @strong{function} @cite{Fname} @strong{return} T'Class
2601 @item 
2602 @strong{function} @cite{Fname} (...) @strong{return} T`
2604 @item 
2605 @strong{function} @cite{Fname} (...) @strong{return} T'Class
2606 @end itemize
2608 where @cite{T} is a limited record type imported from C++ with pragma
2609 @cite{Import} and @cite{Convention} = @cite{CPP}.
2611 The first two forms import the default constructor, used when an object
2612 of type @cite{T} is created on the Ada side with no explicit constructor.
2613 The latter two forms cover all the non-default constructors of the type.
2614 See the GNAT User's Guide for details.
2616 If no constructors are imported, it is impossible to create any objects
2617 on the Ada side and the type is implicitly declared abstract.
2619 Pragma @cite{CPP_Constructor} is intended primarily for automatic generation
2620 using an automatic binding generator tool (such as the @cite{-fdump-ada-spec}
2621 GCC switch).
2622 See @ref{3f,,Interfacing to C++} for more related information.
2624 Note: The use of functions returning class-wide types for constructors is
2625 currently obsolete. They are supported for backward compatibility. The
2626 use of functions returning the type T leave the Ada sources more clear
2627 because the imported C++ constructors always return an object of type T;
2628 that is, they never return an object whose type is a descendant of type T.
2630 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2631 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{41}
2632 @section Pragma CPP_Virtual
2635 @geindex Interfacing to C++
2637 This pragma is now obsolete and, other than generating a warning if warnings
2638 on obsolescent features are enabled, is completely ignored.
2639 It is retained for compatibility
2640 purposes. It used to be required to ensure compoatibility with C++, but
2641 is no longer required for that purpose because GNAT generates
2642 the same object layout as the G++ compiler by default.
2644 See @ref{3f,,Interfacing to C++} for related information.
2646 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2647 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{42}
2648 @section Pragma CPP_Vtable
2651 @geindex Interfacing with C++
2653 This pragma is now obsolete and, other than generating a warning if warnings
2654 on obsolescent features are enabled, is completely ignored.
2655 It used to be required to ensure compatibility with C++, but
2656 is no longer required for that purpose because GNAT generates
2657 the same object layout as the G++ compiler by default.
2659 See @ref{3f,,Interfacing to C++} for related information.
2661 @node Pragma CPU,Pragma Debug,Pragma CPP_Vtable,Implementation Defined Pragmas
2662 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{43}
2663 @section Pragma CPU
2666 Syntax:
2668 @example
2669 pragma CPU (EXPRESSION);
2670 @end example
2672 This pragma is standard in Ada 2012, but is available in all earlier
2673 versions of Ada as an implementation-defined pragma.
2674 See Ada 2012 Reference Manual for details.
2676 @node Pragma Debug,Pragma Debug_Policy,Pragma CPU,Implementation Defined Pragmas
2677 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{44}
2678 @section Pragma Debug
2681 Syntax:
2683 @example
2684 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2686 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2687   PROCEDURE_NAME
2688 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2689 @end example
2691 The procedure call argument has the syntactic form of an expression, meeting
2692 the syntactic requirements for pragmas.
2694 If debug pragmas are not enabled or if the condition is present and evaluates
2695 to False, this pragma has no effect. If debug pragmas are enabled, the
2696 semantics of the pragma is exactly equivalent to the procedure call statement
2697 corresponding to the argument with a terminating semicolon. Pragmas are
2698 permitted in sequences of declarations, so you can use pragma @cite{Debug} to
2699 intersperse calls to debug procedures in the middle of declarations. Debug
2700 pragmas can be enabled either by use of the command line switch @emph{-gnata}
2701 or by use of the pragma @cite{Check_Policy} with a first argument of
2702 @cite{Debug}.
2704 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2705 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{45}
2706 @section Pragma Debug_Policy
2709 Syntax:
2711 @example
2712 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2713 @end example
2715 This pragma is equivalent to a corresponding @cite{Check_Policy} pragma
2716 with a first argument of @cite{Debug}. It is retained for historical
2717 compatibility reasons.
2719 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2720 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{46}
2721 @section Pragma Default_Scalar_Storage_Order
2724 @geindex Default_Scalar_Storage_Order
2726 @geindex Scalar_Storage_Order
2728 Syntax:
2730 @example
2731 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2732 @end example
2734 Normally if no explicit @cite{Scalar_Storage_Order} is given for a record
2735 type or array type, then the scalar storage order defaults to the ordinary
2736 default for the target. But this default may be overridden using this pragma.
2737 The pragma may appear as a configuration pragma, or locally within a package
2738 spec or declarative part. In the latter case, it applies to all subsequent
2739 types declared within that package spec or declarative part.
2741 The following example shows the use of this pragma:
2743 @example
2744 pragma Default_Scalar_Storage_Order (High_Order_First);
2745 with System; use System;
2746 package DSSO1 is
2747    type H1 is record
2748       a : Integer;
2749    end record;
2751    type L2 is record
2752       a : Integer;
2753    end record;
2754    for L2'Scalar_Storage_Order use Low_Order_First;
2756    type L2a is new L2;
2758    package Inner is
2759       type H3 is record
2760          a : Integer;
2761       end record;
2763       pragma Default_Scalar_Storage_Order (Low_Order_First);
2765       type L4 is record
2766          a : Integer;
2767       end record;
2768    end Inner;
2770    type H4a is new Inner.L4;
2772    type H5 is record
2773       a : Integer;
2774    end record;
2775 end DSSO1;
2776 @end example
2778 In this example record types L.. have @cite{Low_Order_First} scalar
2779 storage order, and record types H.. have @cite{High_Order_First}.
2780 Note that in the case of @cite{H4a}, the order is not inherited
2781 from the parent type. Only an explicitly set @cite{Scalar_Storage_Order}
2782 gets inherited on type derivation.
2784 If this pragma is used as a configuration pragma which appears within a
2785 configuration pragma file (as opposed to appearing explicitly at the start
2786 of a single unit), then the binder will require that all units in a partition
2787 be compiled in a similar manner, other than run-time units, which are not
2788 affected by this pragma. Note that the use of this form is discouraged because
2789 it may significantly degrade the run-time performance of the software, instead
2790 the default scalar storage order ought to be changed only on a local basis.
2792 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2793 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{47}
2794 @section Pragma Default_Storage_Pool
2797 @geindex Default_Storage_Pool
2799 Syntax:
2801 @example
2802 pragma Default_Storage_Pool (storage_pool_NAME | null);
2803 @end example
2805 This pragma is standard in Ada 2012, but is available in all earlier
2806 versions of Ada as an implementation-defined pragma.
2807 See Ada 2012 Reference Manual for details.
2809 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
2810 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{48}
2811 @section Pragma Depends
2814 For the description of this pragma, see SPARK 2014 Reference Manual,
2815 section 6.1.5.
2817 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
2818 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{49}
2819 @section Pragma Detect_Blocking
2822 Syntax:
2824 @example
2825 pragma Detect_Blocking;
2826 @end example
2828 This is a standard pragma in Ada 2005, that is available in all earlier
2829 versions of Ada as an implementation-defined pragma.
2831 This is a configuration pragma that forces the detection of potentially
2832 blocking operations within a protected operation, and to raise Program_Error
2833 if that happens.
2835 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
2836 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{4a}
2837 @section Pragma Disable_Atomic_Synchronization
2840 @geindex Atomic Synchronization
2842 Syntax:
2844 @example
2845 pragma Disable_Atomic_Synchronization [(Entity)];
2846 @end example
2848 Ada requires that accesses (reads or writes) of an atomic variable be
2849 regarded as synchronization points in the case of multiple tasks.
2850 Particularly in the case of multi-processors this may require special
2851 handling, e.g. the generation of memory barriers. This capability may
2852 be turned off using this pragma in cases where it is known not to be
2853 required.
2855 The placement and scope rules for this pragma are the same as those
2856 for @cite{pragma Suppress}. In particular it can be used as a
2857 configuration  pragma, or in a declaration sequence where it applies
2858 till the end of the scope. If an @cite{Entity} argument is present,
2859 the action applies only to that entity.
2861 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
2862 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{4b}
2863 @section Pragma Dispatching_Domain
2866 Syntax:
2868 @example
2869 pragma Dispatching_Domain (EXPRESSION);
2870 @end example
2872 This pragma is standard in Ada 2012, but is available in all earlier
2873 versions of Ada as an implementation-defined pragma.
2874 See Ada 2012 Reference Manual for details.
2876 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
2877 @anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{4c}
2878 @section Pragma Effective_Reads
2881 For the description of this pragma, see SPARK 2014 Reference Manual,
2882 section 7.1.2.
2884 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
2885 @anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{4d}
2886 @section Pragma Effective_Writes
2889 For the description of this pragma, see SPARK 2014 Reference Manual,
2890 section 7.1.2.
2892 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
2893 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{4e}
2894 @section Pragma Elaboration_Checks
2897 @geindex Elaboration control
2899 Syntax:
2901 @example
2902 pragma Elaboration_Checks (Dynamic | Static);
2903 @end example
2905 This is a configuration pragma that provides control over the
2906 elaboration model used by the compilation affected by the
2907 pragma.  If the parameter is @cite{Dynamic},
2908 then the dynamic elaboration
2909 model described in the Ada Reference Manual is used, as though
2910 the @emph{-gnatE} switch had been specified on the command
2911 line.  If the parameter is @cite{Static}, then the default GNAT static
2912 model is used.  This configuration pragma overrides the setting
2913 of the command line.  For full details on the elaboration models
2914 used by the GNAT compiler, see the chapter on elaboration order handling
2915 in the @emph{GNAT User's Guide}.
2917 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
2918 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{4f}
2919 @section Pragma Eliminate
2922 @geindex Elimination of unused subprograms
2924 Syntax:
2926 @example
2927 pragma Eliminate ([Entity          =>] DEFINING_DESIGNATOR,
2928                   [Source_Location =>] STRING_LITERAL);
2929 @end example
2931 The string literal given for the source location is a string which
2932 specifies the line number of the occurrence of the entity, using
2933 the syntax for SOURCE_TRACE given below:
2935 @example
2936 SOURCE_TRACE     ::= SOURCE_REFERENCE [LBRACKET SOURCE_TRACE RBRACKET]
2938 LBRACKET         ::= [
2939 RBRACKET         ::= ]
2941 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
2943 LINE_NUMBER      ::= DIGIT @{DIGIT@}
2944 @end example
2946 Spaces around the colon in a @cite{Source_Reference} are optional.
2948 The @cite{DEFINING_DESIGNATOR} matches the defining designator used in an
2949 explicit subprogram declaration, where the @cite{entity} name in this
2950 designator appears on the source line specified by the source location.
2952 The source trace that is given as the @cite{Source_Location} shall obey the
2953 following rules. The @cite{FILE_NAME} is the short name (with no directory
2954 information) of an Ada source file, given using exactly the required syntax
2955 for the underlying file system (e.g. case is important if the underlying
2956 operating system is case sensitive). @cite{LINE_NUMBER} gives the line
2957 number of the occurrence of the @cite{entity}
2958 as a decimal literal without an exponent or point. If an @cite{entity} is not
2959 declared in a generic instantiation (this includes generic subprogram
2960 instances), the source trace includes only one source reference. If an entity
2961 is declared inside a generic instantiation, its source trace (when parsing
2962 from left to right) starts with the source location of the declaration of the
2963 entity in the generic unit and ends with the source location of the
2964 instantiation (it is given in square brackets). This approach is recursively
2965 used in case of nested instantiations: the rightmost (nested most deeply in
2966 square brackets) element of the source trace is the location of the outermost
2967 instantiation, the next to left element is the location of the next (first
2968 nested) instantiation in the code of the corresponding generic unit, and so
2969 on, and the leftmost element (that is out of any square brackets) is the
2970 location of the declaration of the entity to eliminate in a generic unit.
2972 Note that the @cite{Source_Location} argument specifies which of a set of
2973 similarly named entities is being eliminated, dealing both with overloading,
2974 and also appearance of the same entity name in different scopes.
2976 This pragma indicates that the given entity is not used in the program to be
2977 compiled and built. The effect of the pragma is to allow the compiler to
2978 eliminate the code or data associated with the named entity. Any reference to
2979 an eliminated entity causes a compile-time or link-time error.
2981 The intention of pragma @cite{Eliminate} is to allow a program to be compiled
2982 in a system-independent manner, with unused entities eliminated, without
2983 needing to modify the source text. Normally the required set of
2984 @cite{Eliminate} pragmas is constructed automatically using the gnatelim tool.
2986 Any source file change that removes, splits, or
2987 adds lines may make the set of Eliminate pragmas invalid because their
2988 @cite{Source_Location} argument values may get out of date.
2990 Pragma @cite{Eliminate} may be used where the referenced entity is a dispatching
2991 operation. In this case all the subprograms to which the given operation can
2992 dispatch are considered to be unused (are never called as a result of a direct
2993 or a dispatching call).
2995 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
2996 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{50}
2997 @section Pragma Enable_Atomic_Synchronization
3000 @geindex Atomic Synchronization
3002 Syntax:
3004 @example
3005 pragma Enable_Atomic_Synchronization [(Entity)];
3006 @end example
3008 Ada requires that accesses (reads or writes) of an atomic variable be
3009 regarded as synchronization points in the case of multiple tasks.
3010 Particularly in the case of multi-processors this may require special
3011 handling, e.g. the generation of memory barriers. This synchronization
3012 is performed by default, but can be turned off using
3013 @cite{pragma Disable_Atomic_Synchronization}. The
3014 @cite{Enable_Atomic_Synchronization} pragma can be used to turn
3015 it back on.
3017 The placement and scope rules for this pragma are the same as those
3018 for @cite{pragma Unsuppress}. In particular it can be used as a
3019 configuration  pragma, or in a declaration sequence where it applies
3020 till the end of the scope. If an @cite{Entity} argument is present,
3021 the action applies only to that entity.
3023 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3024 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{51}
3025 @section Pragma Export_Function
3028 @geindex Argument passing mechanisms
3030 Syntax:
3032 @example
3033 pragma Export_Function (
3034      [Internal         =>] LOCAL_NAME
3035   [, [External         =>] EXTERNAL_SYMBOL]
3036   [, [Parameter_Types  =>] PARAMETER_TYPES]
3037   [, [Result_Type      =>] result_SUBTYPE_MARK]
3038   [, [Mechanism        =>] MECHANISM]
3039   [, [Result_Mechanism =>] MECHANISM_NAME]);
3041 EXTERNAL_SYMBOL ::=
3042   IDENTIFIER
3043 | static_string_EXPRESSION
3044 | ""
3046 PARAMETER_TYPES ::=
3047   null
3048 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3050 TYPE_DESIGNATOR ::=
3051   subtype_NAME
3052 | subtype_Name ' Access
3054 MECHANISM ::=
3055   MECHANISM_NAME
3056 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3058 MECHANISM_ASSOCIATION ::=
3059   [formal_parameter_NAME =>] MECHANISM_NAME
3061 MECHANISM_NAME ::= Value | Reference
3062 @end example
3064 Use this pragma to make a function externally callable and optionally
3065 provide information on mechanisms to be used for passing parameter and
3066 result values.  We recommend, for the purposes of improving portability,
3067 this pragma always be used in conjunction with a separate pragma
3068 @cite{Export}, which must precede the pragma @cite{Export_Function}.
3069 GNAT does not require a separate pragma @cite{Export}, but if none is
3070 present, @cite{Convention Ada} is assumed, which is usually
3071 not what is wanted, so it is usually appropriate to use this
3072 pragma in conjunction with a @cite{Export} or @cite{Convention}
3073 pragma that specifies the desired foreign convention.
3074 Pragma @cite{Export_Function}
3075 (and @cite{Export}, if present) must appear in the same declarative
3076 region as the function to which they apply.
3078 @cite{internal_name} must uniquely designate the function to which the
3079 pragma applies.  If more than one function name exists of this name in
3080 the declarative part you must use the @cite{Parameter_Types} and
3081 @cite{Result_Type} parameters is mandatory to achieve the required
3082 unique designation.  @cite{subtype_mark`s in these parameters must exactly match the subtypes in the corresponding function specification@comma{} using positional notation to match parameters with subtype marks. The form with an `'Access} attribute can be used to match an
3083 anonymous access parameter.
3085 @geindex Suppressing external name
3087 Special treatment is given if the EXTERNAL is an explicit null
3088 string or a static string expressions that evaluates to the null
3089 string. In this case, no external name is generated. This form
3090 still allows the specification of parameter mechanisms.
3092 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3093 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{52}
3094 @section Pragma Export_Object
3097 Syntax:
3099 @example
3100 pragma Export_Object
3101       [Internal =>] LOCAL_NAME
3102    [, [External =>] EXTERNAL_SYMBOL]
3103    [, [Size     =>] EXTERNAL_SYMBOL]
3105 EXTERNAL_SYMBOL ::=
3106   IDENTIFIER
3107 | static_string_EXPRESSION
3108 @end example
3110 This pragma designates an object as exported, and apart from the
3111 extended rules for external symbols, is identical in effect to the use of
3112 the normal @cite{Export} pragma applied to an object.  You may use a
3113 separate Export pragma (and you probably should from the point of view
3114 of portability), but it is not required.  @cite{Size} is syntax checked,
3115 but otherwise ignored by GNAT.
3117 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3118 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{53}
3119 @section Pragma Export_Procedure
3122 Syntax:
3124 @example
3125 pragma Export_Procedure (
3126      [Internal        =>] LOCAL_NAME
3127   [, [External        =>] EXTERNAL_SYMBOL]
3128   [, [Parameter_Types =>] PARAMETER_TYPES]
3129   [, [Mechanism       =>] MECHANISM]);
3131 EXTERNAL_SYMBOL ::=
3132   IDENTIFIER
3133 | static_string_EXPRESSION
3134 | ""
3136 PARAMETER_TYPES ::=
3137   null
3138 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3140 TYPE_DESIGNATOR ::=
3141   subtype_NAME
3142 | subtype_Name ' Access
3144 MECHANISM ::=
3145   MECHANISM_NAME
3146 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3148 MECHANISM_ASSOCIATION ::=
3149   [formal_parameter_NAME =>] MECHANISM_NAME
3151 MECHANISM_NAME ::= Value | Reference
3152 @end example
3154 This pragma is identical to @cite{Export_Function} except that it
3155 applies to a procedure rather than a function and the parameters
3156 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3157 GNAT does not require a separate pragma @cite{Export}, but if none is
3158 present, @cite{Convention Ada} is assumed, which is usually
3159 not what is wanted, so it is usually appropriate to use this
3160 pragma in conjunction with a @cite{Export} or @cite{Convention}
3161 pragma that specifies the desired foreign convention.
3163 @geindex Suppressing external name
3165 Special treatment is given if the EXTERNAL is an explicit null
3166 string or a static string expressions that evaluates to the null
3167 string. In this case, no external name is generated. This form
3168 still allows the specification of parameter mechanisms.
3170 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3171 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{54}
3172 @section Pragma Export_Value
3175 Syntax:
3177 @example
3178 pragma Export_Value (
3179   [Value     =>] static_integer_EXPRESSION,
3180   [Link_Name =>] static_string_EXPRESSION);
3181 @end example
3183 This pragma serves to export a static integer value for external use.
3184 The first argument specifies the value to be exported. The Link_Name
3185 argument specifies the symbolic name to be associated with the integer
3186 value. This pragma is useful for defining a named static value in Ada
3187 that can be referenced in assembly language units to be linked with
3188 the application. This pragma is currently supported only for the
3189 AAMP target and is ignored for other targets.
3191 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3192 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{55}
3193 @section Pragma Export_Valued_Procedure
3196 Syntax:
3198 @example
3199 pragma Export_Valued_Procedure (
3200      [Internal        =>] LOCAL_NAME
3201   [, [External        =>] EXTERNAL_SYMBOL]
3202   [, [Parameter_Types =>] PARAMETER_TYPES]
3203   [, [Mechanism       =>] MECHANISM]);
3205 EXTERNAL_SYMBOL ::=
3206   IDENTIFIER
3207 | static_string_EXPRESSION
3208 | ""
3210 PARAMETER_TYPES ::=
3211   null
3212 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3214 TYPE_DESIGNATOR ::=
3215   subtype_NAME
3216 | subtype_Name ' Access
3218 MECHANISM ::=
3219   MECHANISM_NAME
3220 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3222 MECHANISM_ASSOCIATION ::=
3223   [formal_parameter_NAME =>] MECHANISM_NAME
3225 MECHANISM_NAME ::= Value | Reference
3226 @end example
3228 This pragma is identical to @cite{Export_Procedure} except that the
3229 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3230 mode @cite{OUT}, and externally the subprogram is treated as a function
3231 with this parameter as the result of the function.  GNAT provides for
3232 this capability to allow the use of @cite{OUT} and @cite{IN OUT}
3233 parameters in interfacing to external functions (which are not permitted
3234 in Ada functions).
3235 GNAT does not require a separate pragma @cite{Export}, but if none is
3236 present, @cite{Convention Ada} is assumed, which is almost certainly
3237 not what is wanted since the whole point of this pragma is to interface
3238 with foreign language functions, so it is usually appropriate to use this
3239 pragma in conjunction with a @cite{Export} or @cite{Convention}
3240 pragma that specifies the desired foreign convention.
3242 @geindex Suppressing external name
3244 Special treatment is given if the EXTERNAL is an explicit null
3245 string or a static string expressions that evaluates to the null
3246 string. In this case, no external name is generated. This form
3247 still allows the specification of parameter mechanisms.
3249 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3250 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{56}
3251 @section Pragma Extend_System
3254 @geindex System
3255 @geindex extending
3257 @geindex DEC Ada 83
3259 Syntax:
3261 @example
3262 pragma Extend_System ([Name =>] IDENTIFIER);
3263 @end example
3265 This pragma is used to provide backwards compatibility with other
3266 implementations that extend the facilities of package @cite{System}.  In
3267 GNAT, @cite{System} contains only the definitions that are present in
3268 the Ada RM.  However, other implementations, notably the DEC Ada 83
3269 implementation, provide many extensions to package @cite{System}.
3271 For each such implementation accommodated by this pragma, GNAT provides a
3272 package @cite{Aux_`xxx`}, e.g., @cite{Aux_DEC} for the DEC Ada 83
3273 implementation, which provides the required additional definitions.  You
3274 can use this package in two ways.  You can @cite{with} it in the normal
3275 way and access entities either by selection or using a @cite{use}
3276 clause.  In this case no special processing is required.
3278 However, if existing code contains references such as
3279 @cite{System.`xxx`} where @cite{xxx} is an entity in the extended
3280 definitions provided in package @cite{System}, you may use this pragma
3281 to extend visibility in @cite{System} in a non-standard way that
3282 provides greater compatibility with the existing code.  Pragma
3283 @cite{Extend_System} is a configuration pragma whose single argument is
3284 the name of the package containing the extended definition
3285 (e.g., @cite{Aux_DEC} for the DEC Ada case).  A unit compiled under
3286 control of this pragma will be processed using special visibility
3287 processing that looks in package @cite{System.Aux_`xxx`} where
3288 @cite{Aux_`xxx`} is the pragma argument for any entity referenced in
3289 package @cite{System}, but not found in package @cite{System}.
3291 You can use this pragma either to access a predefined @cite{System}
3292 extension supplied with the compiler, for example @cite{Aux_DEC} or
3293 you can construct your own extension unit following the above
3294 definition.  Note that such a package is a child of @cite{System}
3295 and thus is considered part of the implementation.
3296 To compile it you will have to use the @emph{-gnatg} switch
3297 for compiling System units, as explained in the
3298 GNAT User's Guide.
3300 @node Pragma Extensions_Allowed,Pragma External,Pragma Extend_System,Implementation Defined Pragmas
3301 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{57}
3302 @section Pragma Extensions_Allowed
3305 @geindex Ada Extensions
3307 @geindex GNAT Extensions
3309 Syntax:
3311 @example
3312 pragma Extensions_Allowed (On | Off);
3313 @end example
3315 This configuration pragma enables or disables the implementation
3316 extension mode (the use of Off as a parameter cancels the effect
3317 of the @emph{-gnatX} command switch).
3319 In extension mode, the latest version of the Ada language is
3320 implemented (currently Ada 2012), and in addition a small number
3321 of GNAT specific extensions are recognized as follows:
3324 @table @asis
3326 @item @emph{Constrained attribute for generic objects}
3328 The @cite{Constrained} attribute is permitted for objects of
3329 generic types. The result indicates if the corresponding actual
3330 is constrained.
3331 @end table
3333 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Allowed,Implementation Defined Pragmas
3334 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{58}
3335 @section Pragma External
3338 Syntax:
3340 @example
3341 pragma External (
3342   [   Convention    =>] convention_IDENTIFIER,
3343   [   Entity        =>] LOCAL_NAME
3344   [, [External_Name =>] static_string_EXPRESSION ]
3345   [, [Link_Name     =>] static_string_EXPRESSION ]);
3346 @end example
3348 This pragma is identical in syntax and semantics to pragma
3349 @cite{Export} as defined in the Ada Reference Manual.  It is
3350 provided for compatibility with some Ada 83 compilers that
3351 used this pragma for exactly the same purposes as pragma
3352 @cite{Export} before the latter was standardized.
3354 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3355 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{59}
3356 @section Pragma External_Name_Casing
3359 @geindex Dec Ada 83 casing compatibility
3361 @geindex External Names
3362 @geindex casing
3364 @geindex Casing of External names
3366 Syntax:
3368 @example
3369 pragma External_Name_Casing (
3370   Uppercase | Lowercase
3371   [, Uppercase | Lowercase | As_Is]);
3372 @end example
3374 This pragma provides control over the casing of external names associated
3375 with Import and Export pragmas.  There are two cases to consider:
3378 @itemize *
3380 @item 
3381 Implicit external names
3383 Implicit external names are derived from identifiers.  The most common case
3384 arises when a standard Ada Import or Export pragma is used with only two
3385 arguments, as in:
3387 @example
3388 pragma Import (C, C_Routine);
3389 @end example
3391 Since Ada is a case-insensitive language, the spelling of the identifier in
3392 the Ada source program does not provide any information on the desired
3393 casing of the external name, and so a convention is needed.  In GNAT the
3394 default treatment is that such names are converted to all lower case
3395 letters.  This corresponds to the normal C style in many environments.
3396 The first argument of pragma @cite{External_Name_Casing} can be used to
3397 control this treatment.  If @cite{Uppercase} is specified, then the name
3398 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3399 then the normal default of all lower case letters will be used.
3401 This same implicit treatment is also used in the case of extended DEC Ada 83
3402 compatible Import and Export pragmas where an external name is explicitly
3403 specified using an identifier rather than a string.
3405 @item 
3406 Explicit external names
3408 Explicit external names are given as string literals.  The most common case
3409 arises when a standard Ada Import or Export pragma is used with three
3410 arguments, as in:
3412 @example
3413 pragma Import (C, C_Routine, "C_routine");
3414 @end example
3416 In this case, the string literal normally provides the exact casing required
3417 for the external name.  The second argument of pragma
3418 @cite{External_Name_Casing} may be used to modify this behavior.
3419 If @cite{Uppercase} is specified, then the name
3420 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3421 then the name will be forced to all lowercase letters.  A specification of
3422 @cite{As_Is} provides the normal default behavior in which the casing is
3423 taken from the string provided.
3424 @end itemize
3426 This pragma may appear anywhere that a pragma is valid.  In particular, it
3427 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3428 case it applies to all subsequent compilations, or it can be used as a program
3429 unit pragma, in which case it only applies to the current unit, or it can
3430 be used more locally to control individual Import/Export pragmas.
3432 It was primarily intended for use with OpenVMS systems, where many
3433 compilers convert all symbols to upper case by default.  For interfacing to
3434 such compilers (e.g., the DEC C compiler), it may be convenient to use
3435 the pragma:
3437 @example
3438 pragma External_Name_Casing (Uppercase, Uppercase);
3439 @end example
3441 to enforce the upper casing of all external symbols.
3443 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3444 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{5a}
3445 @section Pragma Fast_Math
3448 Syntax:
3450 @example
3451 pragma Fast_Math;
3452 @end example
3454 This is a configuration pragma which activates a mode in which speed is
3455 considered more important for floating-point operations than absolutely
3456 accurate adherence to the requirements of the standard. Currently the
3457 following operations are affected:
3460 @table @asis
3462 @item @emph{Complex Multiplication}
3464 The normal simple formula for complex multiplication can result in intermediate
3465 overflows for numbers near the end of the range. The Ada standard requires that
3466 this situation be detected and corrected by scaling, but in Fast_Math mode such
3467 cases will simply result in overflow. Note that to take advantage of this you
3468 must instantiate your own version of @cite{Ada.Numerics.Generic_Complex_Types}
3469 under control of the pragma, rather than use the preinstantiated versions.
3470 @end table
3472 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3473 @anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{5b}
3474 @section Pragma Favor_Top_Level
3477 Syntax:
3479 @example
3480 pragma Favor_Top_Level (type_NAME);
3481 @end example
3483 The named type must be an access-to-subprogram type. This pragma is an
3484 efficiency hint to the compiler, regarding the use of 'Access or
3485 'Unrestricted_Access on nested (non-library-level) subprograms. The
3486 pragma means that nested subprograms are not used with this type, or
3487 are rare, so that the generated code should be efficient in the
3488 top-level case. When this pragma is used, dynamically generated
3489 trampolines may be used on some targets for nested subprograms.
3490 See also the No_Implicit_Dynamic_Code restriction.
3492 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3493 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{5c}
3494 @section Pragma Finalize_Storage_Only
3497 Syntax:
3499 @example
3500 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3501 @end example
3503 This pragma allows the compiler not to emit a Finalize call for objects
3504 defined at the library level.  This is mostly useful for types where
3505 finalization is only used to deal with storage reclamation since in most
3506 environments it is not necessary to reclaim memory just before terminating
3507 execution, hence the name.
3509 @node Pragma Float_Representation,Pragma Global,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3510 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{5d}
3511 @section Pragma Float_Representation
3514 Syntax:
3516 @example
3517 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3519 FLOAT_REP ::= VAX_Float | IEEE_Float
3520 @end example
3522 In the one argument form, this pragma is a configuration pragma which
3523 allows control over the internal representation chosen for the predefined
3524 floating point types declared in the packages @cite{Standard} and
3525 @cite{System}. This pragma is only provided for compatibility and has no effect.
3527 The two argument form specifies the representation to be used for
3528 the specified floating-point type. The argument must
3529 be @cite{IEEE_Float} to specify the use of IEEE format, as follows:
3532 @itemize *
3534 @item 
3535 For a digits value of 6, 32-bit IEEE short format will be used.
3537 @item 
3538 For a digits value of 15, 64-bit IEEE long format will be used.
3540 @item 
3541 No other value of digits is permitted.
3542 @end itemize
3544 @node Pragma Global,Pragma Ident,Pragma Float_Representation,Implementation Defined Pragmas
3545 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{5e}
3546 @section Pragma Global
3549 For the description of this pragma, see SPARK 2014 Reference Manual,
3550 section 6.1.4.
3552 @node Pragma Ident,Pragma Implementation_Defined,Pragma Global,Implementation Defined Pragmas
3553 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{5f}
3554 @section Pragma Ident
3557 Syntax:
3559 @example
3560 pragma Ident (static_string_EXPRESSION);
3561 @end example
3563 This pragma is identical in effect to pragma @cite{Comment}. It is provided
3564 for compatibility with other Ada compilers providing this pragma.
3566 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ident,Implementation Defined Pragmas
3567 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{60}
3568 @section Pragma Implementation_Defined
3571 Syntax:
3573 @example
3574 pragma Implementation_Defined (local_NAME);
3575 @end example
3577 This pragma marks a previously declared entioty as implementation-defined.
3578 For an overloaded entity, applies to the most recent homonym.
3580 @example
3581 pragma Implementation_Defined;
3582 @end example
3584 The form with no arguments appears anywhere within a scope, most
3585 typically a package spec, and indicates that all entities that are
3586 defined within the package spec are Implementation_Defined.
3588 This pragma is used within the GNAT runtime library to identify
3589 implementation-defined entities introduced in language-defined units,
3590 for the purpose of implementing the No_Implementation_Identifiers
3591 restriction.
3593 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3594 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{61}
3595 @section Pragma Implemented
3598 Syntax:
3600 @example
3601 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3603 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3604 @end example
3606 This is an Ada 2012 representation pragma which applies to protected, task
3607 and synchronized interface primitives. The use of pragma Implemented provides
3608 a way to impose a static requirement on the overriding operation by adhering
3609 to one of the three implementation kinds: entry, protected procedure or any of
3610 the above. This pragma is available in all earlier versions of Ada as an
3611 implementation-defined pragma.
3613 @example
3614 type Synch_Iface is synchronized interface;
3615 procedure Prim_Op (Obj : in out Iface) is abstract;
3616 pragma Implemented (Prim_Op, By_Protected_Procedure);
3618 protected type Prot_1 is new Synch_Iface with
3619    procedure Prim_Op;  --  Legal
3620 end Prot_1;
3622 protected type Prot_2 is new Synch_Iface with
3623    entry Prim_Op;      --  Illegal
3624 end Prot_2;
3626 task type Task_Typ is new Synch_Iface with
3627    entry Prim_Op;      --  Illegal
3628 end Task_Typ;
3629 @end example
3631 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3632 Implemented determines the runtime behavior of the requeue. Implementation kind
3633 By_Entry guarantees that the action of requeueing will proceed from an entry to
3634 another entry. Implementation kind By_Protected_Procedure transforms the
3635 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3636 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3637 the target's overriding subprogram kind.
3639 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
3640 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{62}
3641 @section Pragma Implicit_Packing
3644 @geindex Rational Profile
3646 Syntax:
3648 @example
3649 pragma Implicit_Packing;
3650 @end example
3652 This is a configuration pragma that requests implicit packing for packed
3653 arrays for which a size clause is given but no explicit pragma Pack or
3654 specification of Component_Size is present. It also applies to records
3655 where no record representation clause is present. Consider this example:
3657 @example
3658 type R is array (0 .. 7) of Boolean;
3659 for R'Size use 8;
3660 @end example
3662 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3663 does not change the layout of a composite object. So the Size clause in the
3664 above example is normally rejected, since the default layout of the array uses
3665 8-bit components, and thus the array requires a minimum of 64 bits.
3667 If this declaration is compiled in a region of code covered by an occurrence
3668 of the configuration pragma Implicit_Packing, then the Size clause in this
3669 and similar examples will cause implicit packing and thus be accepted. For
3670 this implicit packing to occur, the type in question must be an array of small
3671 components whose size is known at compile time, and the Size clause must
3672 specify the exact size that corresponds to the number of elements in the array
3673 multiplied by the size in bits of the component type (both single and
3674 multi-dimensioned arrays can be controlled with this pragma).
3676 @geindex Array packing
3678 Similarly, the following example shows the use in the record case
3680 @example
3681 type r is record
3682    a, b, c, d, e, f, g, h : boolean;
3683    chr                    : character;
3684 end record;
3685 for r'size use 16;
3686 @end example
3688 Without a pragma Pack, each Boolean field requires 8 bits, so the
3689 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
3690 sufficient. The use of pragma Implicit_Packing allows this record
3691 declaration to compile without an explicit pragma Pack.
3693 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
3694 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{63}
3695 @section Pragma Import_Function
3698 Syntax:
3700 @example
3701 pragma Import_Function (
3702      [Internal                 =>] LOCAL_NAME,
3703   [, [External                 =>] EXTERNAL_SYMBOL]
3704   [, [Parameter_Types          =>] PARAMETER_TYPES]
3705   [, [Result_Type              =>] SUBTYPE_MARK]
3706   [, [Mechanism                =>] MECHANISM]
3707   [, [Result_Mechanism         =>] MECHANISM_NAME]);
3709 EXTERNAL_SYMBOL ::=
3710   IDENTIFIER
3711 | static_string_EXPRESSION
3713 PARAMETER_TYPES ::=
3714   null
3715 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3717 TYPE_DESIGNATOR ::=
3718   subtype_NAME
3719 | subtype_Name ' Access
3721 MECHANISM ::=
3722   MECHANISM_NAME
3723 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3725 MECHANISM_ASSOCIATION ::=
3726   [formal_parameter_NAME =>] MECHANISM_NAME
3728 MECHANISM_NAME ::=
3729   Value
3730 | Reference
3731 @end example
3733 This pragma is used in conjunction with a pragma @cite{Import} to
3734 specify additional information for an imported function.  The pragma
3735 @cite{Import} (or equivalent pragma @cite{Interface}) must precede the
3736 @cite{Import_Function} pragma and both must appear in the same
3737 declarative part as the function specification.
3739 The @cite{Internal} argument must uniquely designate
3740 the function to which the
3741 pragma applies.  If more than one function name exists of this name in
3742 the declarative part you must use the @cite{Parameter_Types} and
3743 @cite{Result_Type} parameters to achieve the required unique
3744 designation.  Subtype marks in these parameters must exactly match the
3745 subtypes in the corresponding function specification, using positional
3746 notation to match parameters with subtype marks.
3747 The form with an @cite{'Access} attribute can be used to match an
3748 anonymous access parameter.
3750 You may optionally use the @cite{Mechanism} and @cite{Result_Mechanism}
3751 parameters to specify passing mechanisms for the
3752 parameters and result.  If you specify a single mechanism name, it
3753 applies to all parameters.  Otherwise you may specify a mechanism on a
3754 parameter by parameter basis using either positional or named
3755 notation.  If the mechanism is not specified, the default mechanism
3756 is used.
3758 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
3759 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{64}
3760 @section Pragma Import_Object
3763 Syntax:
3765 @example
3766 pragma Import_Object
3767      [Internal =>] LOCAL_NAME
3768   [, [External =>] EXTERNAL_SYMBOL]
3769   [, [Size     =>] EXTERNAL_SYMBOL]);
3771 EXTERNAL_SYMBOL ::=
3772   IDENTIFIER
3773 | static_string_EXPRESSION
3774 @end example
3776 This pragma designates an object as imported, and apart from the
3777 extended rules for external symbols, is identical in effect to the use of
3778 the normal @cite{Import} pragma applied to an object.  Unlike the
3779 subprogram case, you need not use a separate @cite{Import} pragma,
3780 although you may do so (and probably should do so from a portability
3781 point of view).  @cite{size} is syntax checked, but otherwise ignored by
3782 GNAT.
3784 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
3785 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{65}
3786 @section Pragma Import_Procedure
3789 Syntax:
3791 @example
3792 pragma Import_Procedure (
3793      [Internal                 =>] LOCAL_NAME
3794   [, [External                 =>] EXTERNAL_SYMBOL]
3795   [, [Parameter_Types          =>] PARAMETER_TYPES]
3796   [, [Mechanism                =>] MECHANISM]);
3798 EXTERNAL_SYMBOL ::=
3799   IDENTIFIER
3800 | static_string_EXPRESSION
3802 PARAMETER_TYPES ::=
3803   null
3804 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3806 TYPE_DESIGNATOR ::=
3807   subtype_NAME
3808 | subtype_Name ' Access
3810 MECHANISM ::=
3811   MECHANISM_NAME
3812 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3814 MECHANISM_ASSOCIATION ::=
3815   [formal_parameter_NAME =>] MECHANISM_NAME
3817 MECHANISM_NAME ::= Value | Reference
3818 @end example
3820 This pragma is identical to @cite{Import_Function} except that it
3821 applies to a procedure rather than a function and the parameters
3822 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3824 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
3825 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{66}
3826 @section Pragma Import_Valued_Procedure
3829 Syntax:
3831 @example
3832 pragma Import_Valued_Procedure (
3833      [Internal                 =>] LOCAL_NAME
3834   [, [External                 =>] EXTERNAL_SYMBOL]
3835   [, [Parameter_Types          =>] PARAMETER_TYPES]
3836   [, [Mechanism                =>] MECHANISM]);
3838 EXTERNAL_SYMBOL ::=
3839   IDENTIFIER
3840 | static_string_EXPRESSION
3842 PARAMETER_TYPES ::=
3843   null
3844 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3846 TYPE_DESIGNATOR ::=
3847   subtype_NAME
3848 | subtype_Name ' Access
3850 MECHANISM ::=
3851   MECHANISM_NAME
3852 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3854 MECHANISM_ASSOCIATION ::=
3855   [formal_parameter_NAME =>] MECHANISM_NAME
3857 MECHANISM_NAME ::= Value | Reference
3858 @end example
3860 This pragma is identical to @cite{Import_Procedure} except that the
3861 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3862 mode @cite{OUT}, and externally the subprogram is treated as a function
3863 with this parameter as the result of the function.  The purpose of this
3864 capability is to allow the use of @cite{OUT} and @cite{IN OUT}
3865 parameters in interfacing to external functions (which are not permitted
3866 in Ada functions).  You may optionally use the @cite{Mechanism}
3867 parameters to specify passing mechanisms for the parameters.
3868 If you specify a single mechanism name, it applies to all parameters.
3869 Otherwise you may specify a mechanism on a parameter by parameter
3870 basis using either positional or named notation.  If the mechanism is not
3871 specified, the default mechanism is used.
3873 Note that it is important to use this pragma in conjunction with a separate
3874 pragma Import that specifies the desired convention, since otherwise the
3875 default convention is Ada, which is almost certainly not what is required.
3877 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
3878 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{67}
3879 @section Pragma Independent
3882 Syntax:
3884 @example
3885 pragma Independent (Local_NAME);
3886 @end example
3888 This pragma is standard in Ada 2012 mode (which also provides an aspect
3889 of the same name). It is also available as an implementation-defined
3890 pragma in all earlier versions. It specifies that the
3891 designated object or all objects of the designated type must be
3892 independently addressable. This means that separate tasks can safely
3893 manipulate such objects. For example, if two components of a record are
3894 independent, then two separate tasks may access these two components.
3895 This may place
3896 constraints on the representation of the object (for instance prohibiting
3897 tight packing).
3899 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
3900 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{68}
3901 @section Pragma Independent_Components
3904 Syntax:
3906 @example
3907 pragma Independent_Components (Local_NAME);
3908 @end example
3910 This pragma is standard in Ada 2012 mode (which also provides an aspect
3911 of the same name). It is also available as an implementation-defined
3912 pragma in all earlier versions. It specifies that the components of the
3913 designated object, or the components of each object of the designated
3914 type, must be
3915 independently addressable. This means that separate tasks can safely
3916 manipulate separate components in the composite object. This may place
3917 constraints on the representation of the object (for instance prohibiting
3918 tight packing).
3920 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
3921 @anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{69}
3922 @section Pragma Initial_Condition
3925 For the description of this pragma, see SPARK 2014 Reference Manual,
3926 section 7.1.6.
3928 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
3929 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{6a}
3930 @section Pragma Initialize_Scalars
3933 @geindex debugging with Initialize_Scalars
3935 Syntax:
3937 @example
3938 pragma Initialize_Scalars;
3939 @end example
3941 This pragma is similar to @cite{Normalize_Scalars} conceptually but has
3942 two important differences.  First, there is no requirement for the pragma
3943 to be used uniformly in all units of a partition, in particular, it is fine
3944 to use this just for some or all of the application units of a partition,
3945 without needing to recompile the run-time library.
3947 In the case where some units are compiled with the pragma, and some without,
3948 then a declaration of a variable where the type is defined in package
3949 Standard or is locally declared will always be subject to initialization,
3950 as will any declaration of a scalar variable.  For composite variables,
3951 whether the variable is initialized may also depend on whether the package
3952 in which the type of the variable is declared is compiled with the pragma.
3954 The other important difference is that you can control the value used
3955 for initializing scalar objects.  At bind time, you can select several
3956 options for initialization. You can
3957 initialize with invalid values (similar to Normalize_Scalars, though for
3958 Initialize_Scalars it is not always possible to determine the invalid
3959 values in complex cases like signed component fields with non-standard
3960 sizes). You can also initialize with high or
3961 low values, or with a specified bit pattern.  See the GNAT
3962 User's Guide for binder options for specifying these cases.
3964 This means that you can compile a program, and then without having to
3965 recompile the program, you can run it with different values being used
3966 for initializing otherwise uninitialized values, to test if your program
3967 behavior depends on the choice.  Of course the behavior should not change,
3968 and if it does, then most likely you have an incorrect reference to an
3969 uninitialized value.
3971 It is even possible to change the value at execution time eliminating even
3972 the need to rebind with a different switch using an environment variable.
3973 See the GNAT User's Guide for details.
3975 Note that pragma @cite{Initialize_Scalars} is particularly useful in
3976 conjunction with the enhanced validity checking that is now provided
3977 in GNAT, which checks for invalid values under more conditions.
3978 Using this feature (see description of the @emph{-gnatV} flag in the
3979 GNAT User's Guide) in conjunction with
3980 pragma @cite{Initialize_Scalars}
3981 provides a powerful new tool to assist in the detection of problems
3982 caused by uninitialized variables.
3984 Note: the use of @cite{Initialize_Scalars} has a fairly extensive
3985 effect on the generated code. This may cause your code to be
3986 substantially larger. It may also cause an increase in the amount
3987 of stack required, so it is probably a good idea to turn on stack
3988 checking (see description of stack checking in the GNAT
3989 User's Guide) when using this pragma.
3991 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
3992 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{6b}
3993 @section Pragma Initializes
3996 For the description of this pragma, see SPARK 2014 Reference Manual,
3997 section 7.1.5.
3999 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4000 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{6c}
4001 @section Pragma Inline_Always
4004 Syntax:
4006 @example
4007 pragma Inline_Always (NAME [, NAME]);
4008 @end example
4010 Similar to pragma @cite{Inline} except that inlining is not subject to
4011 the use of option @emph{-gnatn} or @emph{-gnatN} and the inlining
4012 happens regardless of whether these options are used.
4014 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4015 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{6d}
4016 @section Pragma Inline_Generic
4019 Syntax:
4021 @example
4022 pragma Inline_Generic (GNAME @{, GNAME@});
4024 GNAME ::= generic_unit_NAME | generic_instance_NAME
4025 @end example
4027 This pragma is provided for compatibility with Dec Ada 83. It has
4028 no effect in @cite{GNAT} (which always inlines generics), other
4029 than to check that the given names are all names of generic units or
4030 generic instances.
4032 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4033 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{6e}
4034 @section Pragma Interface
4037 Syntax:
4039 @example
4040 pragma Interface (
4041      [Convention    =>] convention_identifier,
4042      [Entity        =>] local_NAME
4043   [, [External_Name =>] static_string_expression]
4044   [, [Link_Name     =>] static_string_expression]);
4045 @end example
4047 This pragma is identical in syntax and semantics to
4048 the standard Ada pragma @cite{Import}.  It is provided for compatibility
4049 with Ada 83.  The definition is upwards compatible both with pragma
4050 @cite{Interface} as defined in the Ada 83 Reference Manual, and also
4051 with some extended implementations of this pragma in certain Ada 83
4052 implementations.  The only difference between pragma @cite{Interface}
4053 and pragma @cite{Import} is that there is special circuitry to allow
4054 both pragmas to appear for the same subprogram entity (normally it
4055 is illegal to have multiple @cite{Import} pragmas. This is useful in
4056 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4057 Ada 83 compilers.
4059 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4060 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{6f}
4061 @section Pragma Interface_Name
4064 Syntax:
4066 @example
4067 pragma Interface_Name (
4068      [Entity        =>] LOCAL_NAME
4069   [, [External_Name =>] static_string_EXPRESSION]
4070   [, [Link_Name     =>] static_string_EXPRESSION]);
4071 @end example
4073 This pragma provides an alternative way of specifying the interface name
4074 for an interfaced subprogram, and is provided for compatibility with Ada
4075 83 compilers that use the pragma for this purpose.  You must provide at
4076 least one of @cite{External_Name} or @cite{Link_Name}.
4078 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4079 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{70}
4080 @section Pragma Interrupt_Handler
4083 Syntax:
4085 @example
4086 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4087 @end example
4089 This program unit pragma is supported for parameterless protected procedures
4090 as described in Annex C of the Ada Reference Manual. On the AAMP target
4091 the pragma can also be specified for nonprotected parameterless procedures
4092 that are declared at the library level (which includes procedures
4093 declared at the top level of a library package). In the case of AAMP,
4094 when this pragma is applied to a nonprotected procedure, the instruction
4095 @cite{IERET} is generated for returns from the procedure, enabling
4096 maskable interrupts, in place of the normal return instruction.
4098 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4099 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{71}
4100 @section Pragma Interrupt_State
4103 Syntax:
4105 @example
4106 pragma Interrupt_State
4107  ([Name  =>] value,
4108   [State =>] SYSTEM | RUNTIME | USER);
4109 @end example
4111 Normally certain interrupts are reserved to the implementation.  Any attempt
4112 to attach an interrupt causes Program_Error to be raised, as described in
4113 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
4114 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4115 reserved to the implementation, so that @code{Ctrl-C} can be used to
4116 interrupt execution.  Additionally, signals such as @cite{SIGSEGV},
4117 @cite{SIGABRT}, @cite{SIGFPE} and @cite{SIGILL} are often mapped to specific
4118 Ada exceptions, or used to implement run-time functions such as the
4119 @cite{abort} statement and stack overflow checking.
4121 Pragma @cite{Interrupt_State} provides a general mechanism for overriding
4122 such uses of interrupts.  It subsumes the functionality of pragma
4123 @cite{Unreserve_All_Interrupts}.  Pragma @cite{Interrupt_State} is not
4124 available on Windows or VMS.  On all other platforms than VxWorks,
4125 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4126 and may be used to mark interrupts required by the board support package
4127 as reserved.
4129 Interrupts can be in one of three states:
4132 @itemize *
4134 @item 
4135 System
4137 The interrupt is reserved (no Ada handler can be installed), and the
4138 Ada run-time may not install a handler. As a result you are guaranteed
4139 standard system default action if this interrupt is raised.
4141 @item 
4142 Runtime
4144 The interrupt is reserved (no Ada handler can be installed). The run time
4145 is allowed to install a handler for internal control purposes, but is
4146 not required to do so.
4148 @item 
4149 User
4151 The interrupt is unreserved.  The user may install a handler to provide
4152 some other action.
4153 @end itemize
4155 These states are the allowed values of the @cite{State} parameter of the
4156 pragma.  The @cite{Name} parameter is a value of the type
4157 @cite{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4158 @cite{Ada.Interrupts.Names}.
4160 This is a configuration pragma, and the binder will check that there
4161 are no inconsistencies between different units in a partition in how a
4162 given interrupt is specified. It may appear anywhere a pragma is legal.
4164 The effect is to move the interrupt to the specified state.
4166 By declaring interrupts to be SYSTEM, you guarantee the standard system
4167 action, such as a core dump.
4169 By declaring interrupts to be USER, you guarantee that you can install
4170 a handler.
4172 Note that certain signals on many operating systems cannot be caught and
4173 handled by applications.  In such cases, the pragma is ignored.  See the
4174 operating system documentation, or the value of the array @cite{Reserved}
4175 declared in the spec of package @cite{System.OS_Interface}.
4177 Overriding the default state of signals used by the Ada runtime may interfere
4178 with an application's runtime behavior in the cases of the synchronous signals,
4179 and in the case of the signal used to implement the @cite{abort} statement.
4181 @node Pragma Invariant,Pragma Java_Constructor,Pragma Interrupt_State,Implementation Defined Pragmas
4182 @anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{72}
4183 @section Pragma Invariant
4186 Syntax:
4188 @example
4189 pragma Invariant
4190   ([Entity =>]    private_type_LOCAL_NAME,
4191    [Check  =>]    EXPRESSION
4192    [,[Message =>] String_Expression]);
4193 @end example
4195 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4196 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4197 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4198 requires the use of the aspect syntax, which is not available except in 2012
4199 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4200 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4201 note that the aspect Invariant is a synonym in GNAT for the aspect
4202 Type_Invariant, but there is no pragma Type_Invariant.
4204 The pragma must appear within the visible part of the package specification,
4205 after the type to which its Entity argument appears. As with the Invariant
4206 aspect, the Check expression is not analyzed until the end of the visible
4207 part of the package, so it may contain forward references. The Message
4208 argument, if present, provides the exception message used if the invariant
4209 is violated. If no Message parameter is provided, a default message that
4210 identifies the line on which the pragma appears is used.
4212 It is permissible to have multiple Invariants for the same type entity, in
4213 which case they are and'ed together. It is permissible to use this pragma
4214 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4215 invariant pragma for the same entity.
4217 For further details on the use of this pragma, see the Ada 2012 documentation
4218 of the Type_Invariant aspect.
4220 @node Pragma Java_Constructor,Pragma Java_Interface,Pragma Invariant,Implementation Defined Pragmas
4221 @anchor{gnat_rm/implementation_defined_pragmas pragma-java-constructor}@anchor{73}
4222 @section Pragma Java_Constructor
4225 Syntax:
4227 @example
4228 pragma Java_Constructor ([Entity =>] function_LOCAL_NAME);
4229 @end example
4231 This pragma is used to assert that the specified Ada function should be
4232 mapped to the Java constructor for some Ada tagged record type.
4234 See section 7.3.2 of the
4235 @cite{GNAT User's Guide: Supplement for the JVM Platform.}
4236 for related information.
4238 @node Pragma Java_Interface,Pragma Keep_Names,Pragma Java_Constructor,Implementation Defined Pragmas
4239 @anchor{gnat_rm/implementation_defined_pragmas pragma-java-interface}@anchor{74}
4240 @section Pragma Java_Interface
4243 Syntax:
4245 @example
4246 pragma Java_Interface ([Entity =>] abstract_tagged_type_LOCAL_NAME);
4247 @end example
4249 This pragma is used to assert that the specified Ada abstract tagged type
4250 is to be mapped to a Java interface name.
4252 See sections 7.1 and 7.2 of the
4253 @cite{GNAT User's Guide: Supplement for the JVM Platform.}
4254 for related information.
4256 @node Pragma Keep_Names,Pragma License,Pragma Java_Interface,Implementation Defined Pragmas
4257 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{75}
4258 @section Pragma Keep_Names
4261 Syntax:
4263 @example
4264 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4265 @end example
4267 The @cite{LOCAL_NAME} argument
4268 must refer to an enumeration first subtype
4269 in the current declarative part. The effect is to retain the enumeration
4270 literal names for use by @cite{Image} and @cite{Value} even if a global
4271 @cite{Discard_Names} pragma applies. This is useful when you want to
4272 generally suppress enumeration literal names and for example you therefore
4273 use a @cite{Discard_Names} pragma in the @code{gnat.adc} file, but you
4274 want to retain the names for specific enumeration types.
4276 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4277 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{76}
4278 @section Pragma License
4281 @geindex License checking
4283 Syntax:
4285 @example
4286 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4287 @end example
4289 This pragma is provided to allow automated checking for appropriate license
4290 conditions with respect to the standard and modified GPL.  A pragma
4291 @cite{License}, which is a configuration pragma that typically appears at
4292 the start of a source file or in a separate @code{gnat.adc} file, specifies
4293 the licensing conditions of a unit as follows:
4296 @itemize *
4298 @item 
4299 Unrestricted
4300 This is used for a unit that can be freely used with no license restrictions.
4301 Examples of such units are public domain units, and units from the Ada
4302 Reference Manual.
4304 @item 
4306 This is used for a unit that is licensed under the unmodified GPL, and which
4307 therefore cannot be @cite{with}'ed by a restricted unit.
4309 @item 
4310 Modified_GPL
4311 This is used for a unit licensed under the GNAT modified GPL that includes
4312 a special exception paragraph that specifically permits the inclusion of
4313 the unit in programs without requiring the entire program to be released
4314 under the GPL.
4316 @item 
4317 Restricted
4318 This is used for a unit that is restricted in that it is not permitted to
4319 depend on units that are licensed under the GPL.  Typical examples are
4320 proprietary code that is to be released under more restrictive license
4321 conditions.  Note that restricted units are permitted to @cite{with} units
4322 which are licensed under the modified GPL (this is the whole point of the
4323 modified GPL).
4324 @end itemize
4326 Normally a unit with no @cite{License} pragma is considered to have an
4327 unknown license, and no checking is done.  However, standard GNAT headers
4328 are recognized, and license information is derived from them as follows.
4330 A GNAT license header starts with a line containing 78 hyphens.  The following
4331 comment text is searched for the appearance of any of the following strings.
4333 If the string 'GNU General Public License' is found, then the unit is assumed
4334 to have GPL license, unless the string 'As a special exception' follows, in
4335 which case the license is assumed to be modified GPL.
4337 If one of the strings
4338 'This specification is adapted from the Ada Semantic Interface' or
4339 'This specification is derived from the Ada Reference Manual' is found
4340 then the unit is assumed to be unrestricted.
4342 These default actions means that a program with a restricted license pragma
4343 will automatically get warnings if a GPL unit is inappropriately
4344 @cite{with}'ed.  For example, the program:
4346 @example
4347 with Sem_Ch3;
4348 with GNAT.Sockets;
4349 procedure Secret_Stuff is
4350   ...
4351 end Secret_Stuff
4352 @end example
4354 if compiled with pragma @cite{License} (@cite{Restricted}) in a
4355 @code{gnat.adc} file will generate the warning:
4357 @example
4358 1.  with Sem_Ch3;
4359         |
4360    >>> license of withed unit "Sem_Ch3" is incompatible
4362 2.  with GNAT.Sockets;
4363 3.  procedure Secret_Stuff is
4364 @end example
4366 Here we get a warning on @cite{Sem_Ch3} since it is part of the GNAT
4367 compiler and is licensed under the
4368 GPL, but no warning for @cite{GNAT.Sockets} which is part of the GNAT
4369 run time, and is therefore licensed under the modified GPL.
4371 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4372 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{77}
4373 @section Pragma Link_With
4376 Syntax:
4378 @example
4379 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4380 @end example
4382 This pragma is provided for compatibility with certain Ada 83 compilers.
4383 It has exactly the same effect as pragma @cite{Linker_Options} except
4384 that spaces occurring within one of the string expressions are treated
4385 as separators. For example, in the following case:
4387 @example
4388 pragma Link_With ("-labc -ldef");
4389 @end example
4391 results in passing the strings @cite{-labc} and @cite{-ldef} as two
4392 separate arguments to the linker. In addition pragma Link_With allows
4393 multiple arguments, with the same effect as successive pragmas.
4395 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4396 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{78}
4397 @section Pragma Linker_Alias
4400 Syntax:
4402 @example
4403 pragma Linker_Alias (
4404   [Entity =>] LOCAL_NAME,
4405   [Target =>] static_string_EXPRESSION);
4406 @end example
4408 @cite{LOCAL_NAME} must refer to an object that is declared at the library
4409 level. This pragma establishes the given entity as a linker alias for the
4410 given target. It is equivalent to @cite{__attribute__((alias))} in GNU C
4411 and causes @cite{LOCAL_NAME} to be emitted as an alias for the symbol
4412 @cite{static_string_EXPRESSION} in the object file, that is to say no space
4413 is reserved for @cite{LOCAL_NAME} by the assembler and it will be resolved
4414 to the same address as @cite{static_string_EXPRESSION} by the linker.
4416 The actual linker name for the target must be used (e.g., the fully
4417 encoded name with qualification in Ada, or the mangled name in C++),
4418 or it must be declared using the C convention with @cite{pragma Import}
4419 or @cite{pragma Export}.
4421 Not all target machines support this pragma. On some of them it is accepted
4422 only if @cite{pragma Weak_External} has been applied to @cite{LOCAL_NAME}.
4424 @example
4425 --  Example of the use of pragma Linker_Alias
4427 package p is
4428   i : Integer := 1;
4429   pragma Export (C, i);
4431   new_name_for_i : Integer;
4432   pragma Linker_Alias (new_name_for_i, "i");
4433 end p;
4434 @end example
4436 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4437 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{79}
4438 @section Pragma Linker_Constructor
4441 Syntax:
4443 @example
4444 pragma Linker_Constructor (procedure_LOCAL_NAME);
4445 @end example
4447 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4448 is declared at the library level. A procedure to which this pragma is
4449 applied will be treated as an initialization routine by the linker.
4450 It is equivalent to @cite{__attribute__((constructor))} in GNU C and
4451 causes @cite{procedure_LOCAL_NAME} to be invoked before the entry point
4452 of the executable is called (or immediately after the shared library is
4453 loaded if the procedure is linked in a shared library), in particular
4454 before the Ada run-time environment is set up.
4456 Because of these specific contexts, the set of operations such a procedure
4457 can perform is very limited and the type of objects it can manipulate is
4458 essentially restricted to the elementary types. In particular, it must only
4459 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4461 This pragma is used by GNAT to implement auto-initialization of shared Stand
4462 Alone Libraries, which provides a related capability without the restrictions
4463 listed above. Where possible, the use of Stand Alone Libraries is preferable
4464 to the use of this pragma.
4466 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4467 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{7a}
4468 @section Pragma Linker_Destructor
4471 Syntax:
4473 @example
4474 pragma Linker_Destructor (procedure_LOCAL_NAME);
4475 @end example
4477 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4478 is declared at the library level. A procedure to which this pragma is
4479 applied will be treated as a finalization routine by the linker.
4480 It is equivalent to @cite{__attribute__((destructor))} in GNU C and
4481 causes @cite{procedure_LOCAL_NAME} to be invoked after the entry point
4482 of the executable has exited (or immediately before the shared library
4483 is unloaded if the procedure is linked in a shared library), in particular
4484 after the Ada run-time environment is shut down.
4486 See @cite{pragma Linker_Constructor} for the set of restrictions that apply
4487 because of these specific contexts.
4489 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4490 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{7b}
4491 @section Pragma Linker_Section
4494 Syntax:
4496 @example
4497 pragma Linker_Section (
4498   [Entity  =>] LOCAL_NAME,
4499   [Section =>] static_string_EXPRESSION);
4500 @end example
4502 @cite{LOCAL_NAME} must refer to an object, type, or subprogram that is
4503 declared at the library level. This pragma specifies the name of the
4504 linker section for the given entity. It is equivalent to
4505 @cite{__attribute__((section))} in GNU C and causes @cite{LOCAL_NAME} to
4506 be placed in the @cite{static_string_EXPRESSION} section of the
4507 executable (assuming the linker doesn't rename the section).
4508 GNAT also provides an implementation defined aspect of the same name.
4510 In the case of specifying this aspect for a type, the effect is to
4511 specify the corresponding for all library level objects of the type which
4512 do not have an explicit linker section set. Note that this only applies to
4513 whole objects, not to components of composite objects.
4515 In the case of a subprogram, the linker section applies to all previously
4516 declared matching overloaded subprograms in the current declarative part
4517 which do not already have a linker section assigned. The linker section
4518 aspect is useful in this case for specifying different linker sections
4519 for different elements of such an overloaded set.
4521 Note that an empty string specifies that no linker section is specified.
4522 This is not quite the same as omitting the pragma or aspect, since it
4523 can be used to specify that one element of an overloaded set of subprograms
4524 has the default linker section, or that one object of a type for which a
4525 linker section is specified should has the default linker section.
4527 The compiler normally places library-level entities in standard sections
4528 depending on the class: procedures and functions generally go in the
4529 @cite{.text} section, initialized variables in the @cite{.data} section
4530 and uninitialized variables in the @cite{.bss} section.
4532 Other, special sections may exist on given target machines to map special
4533 hardware, for example I/O ports or flash memory. This pragma is a means to
4534 defer the final layout of the executable to the linker, thus fully working
4535 at the symbolic level with the compiler.
4537 Some file formats do not support arbitrary sections so not all target
4538 machines support this pragma. The use of this pragma may cause a program
4539 execution to be erroneous if it is used to place an entity into an
4540 inappropriate section (e.g., a modified variable into the @cite{.text}
4541 section). See also @cite{pragma Persistent_BSS}.
4543 @example
4544 --  Example of the use of pragma Linker_Section
4546 package IO_Card is
4547   Port_A : Integer;
4548   pragma Volatile (Port_A);
4549   pragma Linker_Section (Port_A, ".bss.port_a");
4551   Port_B : Integer;
4552   pragma Volatile (Port_B);
4553   pragma Linker_Section (Port_B, ".bss.port_b");
4555   type Port_Type is new Integer with Linker_Section => ".bss";
4556   PA : Port_Type with Linker_Section => ".bss.PA";
4557   PB : Port_Type; --  ends up in linker section ".bss"
4559   procedure Q with Linker_Section => "Qsection";
4560 end IO_Card;
4561 @end example
4563 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4564 @anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{7c}
4565 @section Pragma Lock_Free
4568 Syntax:
4569 This pragma may be specified for protected types or objects. It specifies that
4570 the implementation of protected operations must be implemented without locks.
4571 Compilation fails if the compiler cannot generate lock-free code for the
4572 operations.
4574 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
4575 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{7d}
4576 @section Pragma Loop_Invariant
4579 Syntax:
4581 @example
4582 pragma Loop_Invariant ( boolean_EXPRESSION );
4583 @end example
4585 The effect of this pragma is similar to that of pragma @cite{Assert},
4586 except that in an @cite{Assertion_Policy} pragma, the identifier
4587 @cite{Loop_Invariant} is used to control whether it is ignored or checked
4588 (or disabled).
4590 @cite{Loop_Invariant} can only appear as one of the items in the sequence
4591 of statements of a loop body, or nested inside block statements that
4592 appear in the sequence of statements of a loop body.
4593 The intention is that it be used to
4594 represent a "loop invariant" assertion, i.e. something that is true each
4595 time through the loop, and which can be used to show that the loop is
4596 achieving its purpose.
4598 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4599 apply to the same loop should be grouped in the same sequence of
4600 statements.
4602 To aid in writing such invariants, the special attribute @cite{Loop_Entry}
4603 may be used to refer to the value of an expression on entry to the loop. This
4604 attribute can only be used within the expression of a @cite{Loop_Invariant}
4605 pragma. For full details, see documentation of attribute @cite{Loop_Entry}.
4607 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
4608 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{7e}
4609 @section Pragma Loop_Optimize
4612 Syntax:
4614 @example
4615 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4617 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
4618 @end example
4620 This pragma must appear immediately within a loop statement.  It allows the
4621 programmer to specify optimization hints for the enclosing loop.  The hints
4622 are not mutually exclusive and can be freely mixed, but not all combinations
4623 will yield a sensible outcome.
4625 There are five supported optimization hints for a loop:
4628 @itemize *
4630 @item 
4631 Ivdep
4633 The programmer asserts that there are no loop-carried dependencies
4634 which would prevent consecutive iterations of the loop from being
4635 executed simultaneously.
4637 @item 
4638 No_Unroll
4640 The loop must not be unrolled.  This is a strong hint: the compiler will not
4641 unroll a loop marked with this hint.
4643 @item 
4644 Unroll
4646 The loop should be unrolled.  This is a weak hint: the compiler will try to
4647 apply unrolling to this loop preferably to other optimizations, notably
4648 vectorization, but there is no guarantee that the loop will be unrolled.
4650 @item 
4651 No_Vector
4653 The loop must not be vectorized.  This is a strong hint: the compiler will not
4654 vectorize a loop marked with this hint.
4656 @item 
4657 Vector
4659 The loop should be vectorized.  This is a weak hint: the compiler will try to
4660 apply vectorization to this loop preferably to other optimizations, notably
4661 unrolling, but there is no guarantee that the loop will be vectorized.
4662 @end itemize
4664 These hints do not remove the need to pass the appropriate switches to the
4665 compiler in order to enable the relevant optimizations, that is to say
4666 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
4667 vectorization.
4669 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
4670 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{7f}
4671 @section Pragma Loop_Variant
4674 Syntax:
4676 @example
4677 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
4678 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
4679 CHANGE_DIRECTION ::= Increases | Decreases
4680 @end example
4682 @cite{Loop_Variant} can only appear as one of the items in the sequence
4683 of statements of a loop body, or nested inside block statements that
4684 appear in the sequence of statements of a loop body.
4685 It allows the specification of quantities which must always
4686 decrease or increase in successive iterations of the loop. In its simplest
4687 form, just one expression is specified, whose value must increase or decrease
4688 on each iteration of the loop.
4690 In a more complex form, multiple arguments can be given which are intepreted
4691 in a nesting lexicographic manner. For example:
4693 @example
4694 pragma Loop_Variant (Increases => X, Decreases => Y);
4695 @end example
4697 specifies that each time through the loop either X increases, or X stays
4698 the same and Y decreases. A @cite{Loop_Variant} pragma ensures that the
4699 loop is making progress. It can be useful in helping to show informally
4700 or prove formally that the loop always terminates.
4702 @cite{Loop_Variant} is an assertion whose effect can be controlled using
4703 an @cite{Assertion_Policy} with a check name of @cite{Loop_Variant}. The
4704 policy can be @cite{Check} to enable the loop variant check, @cite{Ignore}
4705 to ignore the check (in which case the pragma has no effect on the program),
4706 or @cite{Disable} in which case the pragma is not even checked for correct
4707 syntax.
4709 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4710 apply to the same loop should be grouped in the same sequence of
4711 statements.
4713 The @cite{Loop_Entry} attribute may be used within the expressions of the
4714 @cite{Loop_Variant} pragma to refer to values on entry to the loop.
4716 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
4717 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{80}
4718 @section Pragma Machine_Attribute
4721 Syntax:
4723 @example
4724 pragma Machine_Attribute (
4725      [Entity         =>] LOCAL_NAME,
4726      [Attribute_Name =>] static_string_EXPRESSION
4727   [, [Info           =>] static_EXPRESSION] );
4728 @end example
4730 Machine-dependent attributes can be specified for types and/or
4731 declarations.  This pragma is semantically equivalent to
4732 @cite{__attribute__((`attribute_name}))` (if @cite{info} is not
4733 specified) or @cite{__attribute__((`attribute_name`(`info})))
4734 in GNU C, where @code{attribute_name} is recognized by the
4735 compiler middle-end or the @cite{TARGET_ATTRIBUTE_TABLE} machine
4736 specific macro.  A string literal for the optional parameter @cite{info}
4737 is transformed into an identifier, which may make this pragma unusable
4738 for some attributes.
4739 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
4741 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
4742 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{81}
4743 @section Pragma Main
4746 Syntax:
4748 @example
4749 pragma Main
4750  (MAIN_OPTION [, MAIN_OPTION]);
4752 MAIN_OPTION ::=
4753   [Stack_Size              =>] static_integer_EXPRESSION
4754 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
4755 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
4756 @end example
4758 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4759 no effect in GNAT, other than being syntax checked.
4761 @node Pragma Main_Storage,Pragma No_Body,Pragma Main,Implementation Defined Pragmas
4762 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{82}
4763 @section Pragma Main_Storage
4766 Syntax:
4768 @example
4769 pragma Main_Storage
4770   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
4772 MAIN_STORAGE_OPTION ::=
4773   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
4774 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
4775 @end example
4777 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4778 no effect in GNAT, other than being syntax checked.
4780 @node Pragma No_Body,Pragma No_Elaboration_Code_All,Pragma Main_Storage,Implementation Defined Pragmas
4781 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{83}
4782 @section Pragma No_Body
4785 Syntax:
4787 @example
4788 pragma No_Body;
4789 @end example
4791 There are a number of cases in which a package spec does not require a body,
4792 and in fact a body is not permitted. GNAT will not permit the spec to be
4793 compiled if there is a body around. The pragma No_Body allows you to provide
4794 a body file, even in a case where no body is allowed. The body file must
4795 contain only comments and a single No_Body pragma. This is recognized by
4796 the compiler as indicating that no body is logically present.
4798 This is particularly useful during maintenance when a package is modified in
4799 such a way that a body needed before is no longer needed. The provision of a
4800 dummy body with a No_Body pragma ensures that there is no interference from
4801 earlier versions of the package body.
4803 @node Pragma No_Elaboration_Code_All,Pragma No_Inline,Pragma No_Body,Implementation Defined Pragmas
4804 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{84}
4805 @section Pragma No_Elaboration_Code_All
4808 Syntax:
4810 @example
4811 pragma No_Elaboration_Code_All [(program_unit_NAME)];
4812 @end example
4814 This is a program unit pragma (there is also an equivalent aspect of the
4815 same name) that establishes the restriction @cite{No_Elaboration_Code} for
4816 the current unit and any extended main source units (body and subunits.
4817 It also has has the effect of enforcing a transitive application of this
4818 aspect, so that if any unit is implicitly or explicitly WITH'ed by the
4819 current unit, it must also have the No_Elaboration_Code_All aspect set.
4820 It may be applied to package or subprogram specs or their generic versions.
4822 @node Pragma No_Inline,Pragma No_Return,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
4823 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{85}
4824 @section Pragma No_Inline
4827 Syntax:
4829 @example
4830 pragma No_Inline (NAME @{, NAME@});
4831 @end example
4833 This pragma suppresses inlining for the callable entity or the instances of
4834 the generic subprogram designated by @cite{NAME}, including inlining that
4835 results from the use of pragma @cite{Inline}.  This pragma is always active,
4836 in particular it is not subject to the use of option @emph{-gnatn} or
4837 @emph{-gnatN}.  It is illegal to specify both pragma @cite{No_Inline} and
4838 pragma @cite{Inline_Always} for the same @cite{NAME}.
4840 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
4841 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{86}
4842 @section Pragma No_Return
4845 Syntax:
4847 @example
4848 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
4849 @end example
4851 Each @cite{procedure_LOCAL_NAME} argument must refer to one or more procedure
4852 declarations in the current declarative part.  A procedure to which this
4853 pragma is applied may not contain any explicit @cite{return} statements.
4854 In addition, if the procedure contains any implicit returns from falling
4855 off the end of a statement sequence, then execution of that implicit
4856 return will cause Program_Error to be raised.
4858 One use of this pragma is to identify procedures whose only purpose is to raise
4859 an exception. Another use of this pragma is to suppress incorrect warnings
4860 about missing returns in functions, where the last statement of a function
4861 statement sequence is a call to such a procedure.
4863 Note that in Ada 2005 mode, this pragma is part of the language. It is
4864 available in all earlier versions of Ada as an implementation-defined
4865 pragma.
4867 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
4868 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{87}
4869 @section Pragma No_Run_Time
4872 Syntax:
4874 @example
4875 pragma No_Run_Time;
4876 @end example
4878 This is an obsolete configuration pragma that historically was used to
4879 set up a runtime library with no object code. It is now used only for
4880 internal testing. The pragma has been superseded by the reconfigurable
4881 runtime capability of @cite{GNAT}.
4883 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
4884 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{88}
4885 @section Pragma No_Strict_Aliasing
4888 Syntax:
4890 @example
4891 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
4892 @end example
4894 @cite{type_LOCAL_NAME} must refer to an access type
4895 declaration in the current declarative part.  The effect is to inhibit
4896 strict aliasing optimization for the given type.  The form with no
4897 arguments is a configuration pragma which applies to all access types
4898 declared in units to which the pragma applies. For a detailed
4899 description of the strict aliasing optimization, and the situations
4900 in which it must be suppressed, see the section on Optimization and Strict Aliasing
4901 in the @cite{GNAT User's Guide}.
4903 This pragma currently has no effects on access to unconstrained array types.
4905 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
4906 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{89}
4907 @section Pragma No_Tagged_Streams
4910 Syntax:
4912 @example
4913 pragma No_Tagged_Streams;
4914 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
4915 @end example
4917 Normally when a tagged type is introduced using a full type declaration,
4918 part of the processing includes generating stream access routines to be
4919 used by stream attributes referencing the type (or one of its subtypes
4920 or derived types). This can involve the generation of significant amounts
4921 of code which is wasted space if stream routines are not needed for the
4922 type in question.
4924 The @cite{No_Tagged_Streams} pragma causes the generation of these stream
4925 routines to be skipped, and any attempt to use stream operations on
4926 types subject to this pragma will be statically rejected as illegal.
4928 There are two forms of the pragma. The form with no arguments must appear
4929 in a declarative sequence or in the declarations of a package spec. This
4930 pragma affects all subsequent root tagged types declared in the declaration
4931 sequence, and specifies that no stream routines be generated. The form with
4932 an argument (for which there is also a corresponding aspect) specifies a
4933 single root tagged type for which stream routines are not to be generated.
4935 Once the pragma has been given for a particular root tagged type, all subtypes
4936 and derived types of this type inherit the pragma automatically, so the effect
4937 applies to a complete hierarchy (this is necessary to deal with the class-wide
4938 dispatching versions of the stream routines).
4940 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
4941 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{8a}
4942 @section Pragma Normalize_Scalars
4945 Syntax:
4947 @example
4948 pragma Normalize_Scalars;
4949 @end example
4951 This is a language defined pragma which is fully implemented in GNAT.  The
4952 effect is to cause all scalar objects that are not otherwise initialized
4953 to be initialized.  The initial values are implementation dependent and
4954 are as follows:
4957 @table @asis
4959 @item @emph{Standard.Character}
4961 Objects whose root type is Standard.Character are initialized to
4962 Character'Last unless the subtype range excludes NUL (in which case
4963 NUL is used). This choice will always generate an invalid value if
4964 one exists.
4966 @item @emph{Standard.Wide_Character}
4968 Objects whose root type is Standard.Wide_Character are initialized to
4969 Wide_Character'Last unless the subtype range excludes NUL (in which case
4970 NUL is used). This choice will always generate an invalid value if
4971 one exists.
4973 @item @emph{Standard.Wide_Wide_Character}
4975 Objects whose root type is Standard.Wide_Wide_Character are initialized to
4976 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
4977 which case NUL is used). This choice will always generate an invalid value if
4978 one exists.
4980 @item @emph{Integer types}
4982 Objects of an integer type are treated differently depending on whether
4983 negative values are present in the subtype. If no negative values are
4984 present, then all one bits is used as the initial value except in the
4985 special case where zero is excluded from the subtype, in which case
4986 all zero bits are used. This choice will always generate an invalid
4987 value if one exists.
4989 For subtypes with negative values present, the largest negative number
4990 is used, except in the unusual case where this largest negative number
4991 is in the subtype, and the largest positive number is not, in which case
4992 the largest positive value is used. This choice will always generate
4993 an invalid value if one exists.
4995 @item @emph{Floating-Point Types}
4997 Objects of all floating-point types are initialized to all 1-bits. For
4998 standard IEEE format, this corresponds to a NaN (not a number) which is
4999 indeed an invalid value.
5001 @item @emph{Fixed-Point Types}
5003 Objects of all fixed-point types are treated as described above for integers,
5004 with the rules applying to the underlying integer value used to represent
5005 the fixed-point value.
5007 @item @emph{Modular types}
5009 Objects of a modular type are initialized to all one bits, except in
5010 the special case where zero is excluded from the subtype, in which
5011 case all zero bits are used. This choice will always generate an
5012 invalid value if one exists.
5014 @item @emph{Enumeration types}
5016 Objects of an enumeration type are initialized to all one-bits, i.e., to
5017 the value @cite{2 ** typ'Size - 1} unless the subtype excludes the literal
5018 whose Pos value is zero, in which case a code of zero is used. This choice
5019 will always generate an invalid value if one exists.
5020 @end table
5022 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5023 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{8b}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{8c}
5024 @section Pragma Obsolescent
5027 Syntax:
5029 @example
5030 pragma Obsolescent;
5032 pragma Obsolescent (
5033   [Message =>] static_string_EXPRESSION
5034 [,[Version =>] Ada_05]]);
5036 pragma Obsolescent (
5037   [Entity  =>] NAME
5038 [,[Message =>] static_string_EXPRESSION
5039 [,[Version =>] Ada_05]] );
5040 @end example
5042 This pragma can occur immediately following a declaration of an entity,
5043 including the case of a record component. If no Entity argument is present,
5044 then this declaration is the one to which the pragma applies. If an Entity
5045 parameter is present, it must either match the name of the entity in this
5046 declaration, or alternatively, the pragma can immediately follow an enumeration
5047 type declaration, where the Entity argument names one of the enumeration
5048 literals.
5050 This pragma is used to indicate that the named entity
5051 is considered obsolescent and should not be used. Typically this is
5052 used when an API must be modified by eventually removing or modifying
5053 existing subprograms or other entities. The pragma can be used at an
5054 intermediate stage when the entity is still present, but will be
5055 removed later.
5057 The effect of this pragma is to output a warning message on a reference to
5058 an entity thus marked that the subprogram is obsolescent if the appropriate
5059 warning option in the compiler is activated. If the Message parameter is
5060 present, then a second warning message is given containing this text. In
5061 addition, a reference to the entity is considered to be a violation of pragma
5062 Restrictions (No_Obsolescent_Features).
5064 This pragma can also be used as a program unit pragma for a package,
5065 in which case the entity name is the name of the package, and the
5066 pragma indicates that the entire package is considered
5067 obsolescent. In this case a client @cite{with}'ing such a package
5068 violates the restriction, and the @cite{with} statement is
5069 flagged with warnings if the warning option is set.
5071 If the Version parameter is present (which must be exactly
5072 the identifier Ada_05, no other argument is allowed), then the
5073 indication of obsolescence applies only when compiling in Ada 2005
5074 mode. This is primarily intended for dealing with the situations
5075 in the predefined library where subprograms or packages
5076 have become defined as obsolescent in Ada 2005
5077 (e.g., in Ada.Characters.Handling), but may be used anywhere.
5079 The following examples show typical uses of this pragma:
5081 @example
5082 package p is
5083    pragma Obsolescent (p, Message => "use pp instead of p");
5084 end p;
5086 package q is
5087    procedure q2;
5088    pragma Obsolescent ("use q2new instead");
5090    type R is new integer;
5091    pragma Obsolescent
5092      (Entity  => R,
5093       Message => "use RR in Ada 2005",
5094       Version => Ada_05);
5096    type M is record
5097       F1 : Integer;
5098       F2 : Integer;
5099       pragma Obsolescent;
5100       F3 : Integer;
5101    end record;
5103    type E is (a, bc, 'd', quack);
5104    pragma Obsolescent (Entity => bc)
5105    pragma Obsolescent (Entity => 'd')
5107    function "+"
5108      (a, b : character) return character;
5109    pragma Obsolescent (Entity => "+");
5110 end;
5111 @end example
5113 Note that, as for all pragmas, if you use a pragma argument identifier,
5114 then all subsequent parameters must also use a pragma argument identifier.
5115 So if you specify "Entity =>" for the Entity argument, and a Message
5116 argument is present, it must be preceded by "Message =>".
5118 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5119 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{8d}
5120 @section Pragma Optimize_Alignment
5123 @geindex Alignment
5124 @geindex default settings
5126 Syntax:
5128 @example
5129 pragma Optimize_Alignment (TIME | SPACE | OFF);
5130 @end example
5132 This is a configuration pragma which affects the choice of default alignments
5133 for types and objects where no alignment is explicitly specified. There is a
5134 time/space trade-off in the selection of these values. Large alignments result
5135 in more efficient code, at the expense of larger data space, since sizes have
5136 to be increased to match these alignments. Smaller alignments save space, but
5137 the access code is slower. The normal choice of default alignments for types
5138 and individual alignment promotions for objects (which is what you get if you
5139 do not use this pragma, or if you use an argument of OFF), tries to balance
5140 these two requirements.
5142 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5143 First any packed record is given an alignment of 1. Second, if a size is given
5144 for the type, then the alignment is chosen to avoid increasing this size. For
5145 example, consider:
5147 @example
5148 type R is record
5149    X : Integer;
5150    Y : Character;
5151 end record;
5153 for R'Size use 5*8;
5154 @end example
5156 In the default mode, this type gets an alignment of 4, so that access to the
5157 Integer field X are efficient. But this means that objects of the type end up
5158 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5159 allowed to be bigger than the size of the type, but it can waste space if for
5160 example fields of type R appear in an enclosing record. If the above type is
5161 compiled in @cite{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5163 However, there is one case in which SPACE is ignored. If a variable length
5164 record (that is a discriminated record with a component which is an array
5165 whose length depends on a discriminant), has a pragma Pack, then it is not
5166 in general possible to set the alignment of such a record to one, so the
5167 pragma is ignored in this case (with a warning).
5169 Specifying SPACE also disables alignment promotions for standalone objects,
5170 which occur when the compiler increases the alignment of a specific object
5171 without changing the alignment of its type.
5173 Specifying TIME causes larger default alignments to be chosen in the case of
5174 small types with sizes that are not a power of 2. For example, consider:
5176 @example
5177 type R is record
5178    A : Character;
5179    B : Character;
5180    C : Boolean;
5181 end record;
5183 pragma Pack (R);
5184 for R'Size use 17;
5185 @end example
5187 The default alignment for this record is normally 1, but if this type is
5188 compiled in @cite{Optimize_Alignment (Time)} mode, then the alignment is set
5189 to 4, which wastes space for objects of the type, since they are now 4 bytes
5190 long, but results in more efficient access when the whole record is referenced.
5192 As noted above, this is a configuration pragma, and there is a requirement
5193 that all units in a partition be compiled with a consistent setting of the
5194 optimization setting. This would normally be achieved by use of a configuration
5195 pragma file containing the appropriate setting. The exception to this rule is
5196 that units with an explicit configuration pragma in the same file as the source
5197 unit are excluded from the consistency check, as are all predefined units. The
5198 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5199 pragma appears at the start of the file.
5201 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5202 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{8e}
5203 @section Pragma Ordered
5206 Syntax:
5208 @example
5209 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5210 @end example
5212 Most enumeration types are from a conceptual point of view unordered.
5213 For example, consider:
5215 @example
5216 type Color is (Red, Blue, Green, Yellow);
5217 @end example
5219 By Ada semantics @cite{Blue > Red} and @cite{Green > Blue},
5220 but really these relations make no sense; the enumeration type merely
5221 specifies a set of possible colors, and the order is unimportant.
5223 For unordered enumeration types, it is generally a good idea if
5224 clients avoid comparisons (other than equality or inequality) and
5225 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5226 other than the unit where the type is declared, its body, and its subunits.)
5227 For example, if code buried in some client says:
5229 @example
5230 if Current_Color < Yellow then ...
5231 if Current_Color in Blue .. Green then ...
5232 @end example
5234 then the client code is relying on the order, which is undesirable.
5235 It makes the code hard to read and creates maintenance difficulties if
5236 entries have to be added to the enumeration type. Instead,
5237 the code in the client should list the possibilities, or an
5238 appropriate subtype should be declared in the unit that declares
5239 the original enumeration type. E.g., the following subtype could
5240 be declared along with the type @cite{Color}:
5242 @example
5243 subtype RBG is Color range Red .. Green;
5244 @end example
5246 and then the client could write:
5248 @example
5249 if Current_Color in RBG then ...
5250 if Current_Color = Blue or Current_Color = Green then ...
5251 @end example
5253 However, some enumeration types are legitimately ordered from a conceptual
5254 point of view. For example, if you declare:
5256 @example
5257 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5258 @end example
5260 then the ordering imposed by the language is reasonable, and
5261 clients can depend on it, writing for example:
5263 @example
5264 if D in Mon .. Fri then ...
5265 if D < Wed then ...
5266 @end example
5268 The pragma @emph{Ordered} is provided to mark enumeration types that
5269 are conceptually ordered, alerting the reader that clients may depend
5270 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5271 rather than one to mark them as unordered, since in our experience,
5272 the great majority of enumeration types are conceptually unordered.
5274 The types @cite{Boolean}, @cite{Character}, @cite{Wide_Character},
5275 and @cite{Wide_Wide_Character}
5276 are considered to be ordered types, so each is declared with a
5277 pragma @cite{Ordered} in package @cite{Standard}.
5279 Normally pragma @cite{Ordered} serves only as documentation and a guide for
5280 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5281 requests warnings for inappropriate uses (comparisons and explicit
5282 subranges) for unordered types. If this switch is used, then any
5283 enumeration type not marked with pragma @cite{Ordered} will be considered
5284 as unordered, and will generate warnings for inappropriate uses.
5286 Note that generic types are not considered ordered or unordered (since the
5287 template can be instantiated for both cases), so we never generate warnings
5288 for the case of generic enumerated types.
5290 For additional information please refer to the description of the
5291 @emph{-gnatw.u} switch in the GNAT User's Guide.
5293 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5294 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{8f}
5295 @section Pragma Overflow_Mode
5298 Syntax:
5300 @example
5301 pragma Overflow_Mode
5302  (  [General    =>] MODE
5303   [,[Assertions =>] MODE]);
5305 MODE ::= STRICT | MINIMIZED | ELIMINATED
5306 @end example
5308 This pragma sets the current overflow mode to the given setting. For details
5309 of the meaning of these modes, please refer to the
5310 'Overflow Check Handling in GNAT' appendix in the
5311 GNAT User's Guide. If only the @cite{General} parameter is present,
5312 the given mode applies to all expressions. If both parameters are present,
5313 the @cite{General} mode applies to expressions outside assertions, and
5314 the @cite{Eliminated} mode applies to expressions within assertions.
5316 The case of the @cite{MODE} parameter is ignored,
5317 so @cite{MINIMIZED}, @cite{Minimized} and
5318 @cite{minimized} all have the same effect.
5320 The @cite{Overflow_Mode} pragma has the same scoping and placement
5321 rules as pragma @cite{Suppress}, so it can occur either as a
5322 configuration pragma, specifying a default for the whole
5323 program, or in a declarative scope, where it applies to the
5324 remaining declarations and statements in that scope.
5326 The pragma @cite{Suppress (Overflow_Check)} suppresses
5327 overflow checking, but does not affect the overflow mode.
5329 The pragma @cite{Unsuppress (Overflow_Check)} unsuppresses (enables)
5330 overflow checking, but does not affect the overflow mode.
5332 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5333 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{90}
5334 @section Pragma Overriding_Renamings
5337 @geindex Rational profile
5339 @geindex Rational compatibility
5341 Syntax:
5343 @example
5344 pragma Overriding_Renamings;
5345 @end example
5347 This is a GNAT configuration pragma to simplify porting
5348 legacy code accepted by the Rational
5349 Ada compiler. In the presence of this pragma, a renaming declaration that
5350 renames an inherited operation declared in the same scope is legal if selected
5351 notation is used as in:
5353 @example
5354 pragma Overriding_Renamings;
5356 package R is
5357   function F (..);
5358   ...
5359   function F (..) renames R.F;
5360 end R;
5361 @end example
5363 even though
5364 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5365 declaration of the overriding operation.
5367 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5368 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{91}
5369 @section Pragma Partition_Elaboration_Policy
5372 Syntax:
5374 @example
5375 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5377 POLICY_IDENTIFIER ::= Concurrent | Sequential
5378 @end example
5380 This pragma is standard in Ada 2005, but is available in all earlier
5381 versions of Ada as an implementation-defined pragma.
5382 See Ada 2012 Reference Manual for details.
5384 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5385 @anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{92}
5386 @section Pragma Part_Of
5389 For the description of this pragma, see SPARK 2014 Reference Manual,
5390 section 7.2.6.
5392 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
5393 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{93}
5394 @section Pragma Passive
5397 Syntax:
5399 @example
5400 pragma Passive [(Semaphore | No)];
5401 @end example
5403 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5404 compatibility with DEC Ada 83 implementations, where it is used within a
5405 task definition to request that a task be made passive.  If the argument
5406 @cite{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5407 treats the pragma as an assertion that the containing task is passive
5408 and that optimization of context switch with this task is permitted and
5409 desired.  If the argument @cite{No} is present, the task must not be
5410 optimized.  GNAT does not attempt to optimize any tasks in this manner
5411 (since protected objects are available in place of passive tasks).
5413 For more information on the subject of passive tasks, see the section
5414 'Passive Task Optimization' in the GNAT Users Guide.
5416 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
5417 @anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{94}
5418 @section Pragma Persistent_BSS
5421 Syntax:
5423 @example
5424 pragma Persistent_BSS [(LOCAL_NAME)]
5425 @end example
5427 This pragma allows selected objects to be placed in the @cite{.persistent_bss}
5428 section. On some targets the linker and loader provide for special
5429 treatment of this section, allowing a program to be reloaded without
5430 affecting the contents of this data (hence the name persistent).
5432 There are two forms of usage. If an argument is given, it must be the
5433 local name of a library level object, with no explicit initialization
5434 and whose type is potentially persistent. If no argument is given, then
5435 the pragma is a configuration pragma, and applies to all library level
5436 objects with no explicit initialization of potentially persistent types.
5438 A potentially persistent type is a scalar type, or an untagged,
5439 non-discriminated record, all of whose components have no explicit
5440 initialization and are themselves of a potentially persistent type,
5441 or an array, all of whose constraints are static, and whose component
5442 type is potentially persistent.
5444 If this pragma is used on a target where this feature is not supported,
5445 then the pragma will be ignored. See also @cite{pragma Linker_Section}.
5447 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
5448 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{95}
5449 @section Pragma Polling
5452 Syntax:
5454 @example
5455 pragma Polling (ON | OFF);
5456 @end example
5458 This pragma controls the generation of polling code.  This is normally off.
5459 If @cite{pragma Polling (ON)} is used then periodic calls are generated to
5460 the routine @cite{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5461 runtime library, and can be found in file @code{a-excpol.adb}.
5463 Pragma @cite{Polling} can appear as a configuration pragma (for example it
5464 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
5465 can be used in the statement or declaration sequence to control polling
5466 more locally.
5468 A call to the polling routine is generated at the start of every loop and
5469 at the start of every subprogram call.  This guarantees that the @cite{Poll}
5470 routine is called frequently, and places an upper bound (determined by
5471 the complexity of the code) on the period between two @cite{Poll} calls.
5473 The primary purpose of the polling interface is to enable asynchronous
5474 aborts on targets that cannot otherwise support it (for example Windows
5475 NT), but it may be used for any other purpose requiring periodic polling.
5476 The standard version is null, and can be replaced by a user program.  This
5477 will require re-compilation of the @cite{Ada.Exceptions} package that can
5478 be found in files @code{a-except.ads} and @code{a-except.adb}.
5480 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
5481 distribution) is used to enable the asynchronous abort capability on
5482 targets that do not normally support the capability.  The version of
5483 @cite{Poll} in this file makes a call to the appropriate runtime routine
5484 to test for an abort condition.
5486 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
5487 See the section on switches for gcc in the @cite{GNAT User's Guide}.
5489 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
5490 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{96}
5491 @section Pragma Post
5494 @geindex Post
5496 @geindex Checks
5497 @geindex postconditions
5499 Syntax:
5501 @example
5502 pragma Post (Boolean_Expression);
5503 @end example
5505 The @cite{Post} pragma is intended to be an exact replacement for
5506 the language-defined
5507 @cite{Post} aspect, and shares its restrictions and semantics.
5508 It must appear either immediately following the corresponding
5509 subprogram declaration (only other pragmas may intervene), or
5510 if there is no separate subprogram declaration, then it can
5511 appear at the start of the declarations in a subprogram body
5512 (preceded only by other pragmas).
5514 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
5515 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{97}
5516 @section Pragma Postcondition
5519 @geindex Postcondition
5521 @geindex Checks
5522 @geindex postconditions
5524 Syntax:
5526 @example
5527 pragma Postcondition (
5528    [Check   =>] Boolean_Expression
5529  [,[Message =>] String_Expression]);
5530 @end example
5532 The @cite{Postcondition} pragma allows specification of automatic
5533 postcondition checks for subprograms. These checks are similar to
5534 assertions, but are automatically inserted just prior to the return
5535 statements of the subprogram with which they are associated (including
5536 implicit returns at the end of procedure bodies and associated
5537 exception handlers).
5539 In addition, the boolean expression which is the condition which
5540 must be true may contain references to function'Result in the case
5541 of a function to refer to the returned value.
5543 @cite{Postcondition} pragmas may appear either immediately following the
5544 (separate) declaration of a subprogram, or at the start of the
5545 declarations of a subprogram body. Only other pragmas may intervene
5546 (that is appear between the subprogram declaration and its
5547 postconditions, or appear before the postcondition in the
5548 declaration sequence in a subprogram body). In the case of a
5549 postcondition appearing after a subprogram declaration, the
5550 formal arguments of the subprogram are visible, and can be
5551 referenced in the postcondition expressions.
5553 The postconditions are collected and automatically tested just
5554 before any return (implicit or explicit) in the subprogram body.
5555 A postcondition is only recognized if postconditions are active
5556 at the time the pragma is encountered. The compiler switch @emph{gnata}
5557 turns on all postconditions by default, and pragma @cite{Check_Policy}
5558 with an identifier of @cite{Postcondition} can also be used to
5559 control whether postconditions are active.
5561 The general approach is that postconditions are placed in the spec
5562 if they represent functional aspects which make sense to the client.
5563 For example we might have:
5565 @example
5566 function Direction return Integer;
5567 pragma Postcondition
5568  (Direction'Result = +1
5569     or else
5570   Direction'Result = -1);
5571 @end example
5573 which serves to document that the result must be +1 or -1, and
5574 will test that this is the case at run time if postcondition
5575 checking is active.
5577 Postconditions within the subprogram body can be used to
5578 check that some internal aspect of the implementation,
5579 not visible to the client, is operating as expected.
5580 For instance if a square root routine keeps an internal
5581 counter of the number of times it is called, then we
5582 might have the following postcondition:
5584 @example
5585 Sqrt_Calls : Natural := 0;
5587 function Sqrt (Arg : Float) return Float is
5588   pragma Postcondition
5589     (Sqrt_Calls = Sqrt_Calls'Old + 1);
5590   ...
5591 end Sqrt
5592 @end example
5594 As this example, shows, the use of the @cite{Old} attribute
5595 is often useful in postconditions to refer to the state on
5596 entry to the subprogram.
5598 Note that postconditions are only checked on normal returns
5599 from the subprogram. If an abnormal return results from
5600 raising an exception, then the postconditions are not checked.
5602 If a postcondition fails, then the exception
5603 @cite{System.Assertions.Assert_Failure} is raised. If
5604 a message argument was supplied, then the given string
5605 will be used as the exception message. If no message
5606 argument was supplied, then the default message has
5607 the form "Postcondition failed at file_name:line". The
5608 exception is raised in the context of the subprogram
5609 body, so it is possible to catch postcondition failures
5610 within the subprogram body itself.
5612 Within a package spec, normal visibility rules
5613 in Ada would prevent forward references within a
5614 postcondition pragma to functions defined later in
5615 the same package. This would introduce undesirable
5616 ordering constraints. To avoid this problem, all
5617 postcondition pragmas are analyzed at the end of
5618 the package spec, allowing forward references.
5620 The following example shows that this even allows
5621 mutually recursive postconditions as in:
5623 @example
5624 package Parity_Functions is
5625    function Odd  (X : Natural) return Boolean;
5626    pragma Postcondition
5627      (Odd'Result =
5628         (x = 1
5629           or else
5630         (x /= 0 and then Even (X - 1))));
5632    function Even (X : Natural) return Boolean;
5633    pragma Postcondition
5634      (Even'Result =
5635         (x = 0
5636           or else
5637         (x /= 1 and then Odd (X - 1))));
5639 end Parity_Functions;
5640 @end example
5642 There are no restrictions on the complexity or form of
5643 conditions used within @cite{Postcondition} pragmas.
5644 The following example shows that it is even possible
5645 to verify performance behavior.
5647 @example
5648 package Sort is
5650    Performance : constant Float;
5651    --  Performance constant set by implementation
5652    --  to match target architecture behavior.
5654    procedure Treesort (Arg : String);
5655    --  Sorts characters of argument using N*logN sort
5656    pragma Postcondition
5657      (Float (Clock - Clock'Old) <=
5658         Float (Arg'Length) *
5659         log (Float (Arg'Length)) *
5660         Performance);
5661 end Sort;
5662 @end example
5664 Note: postcondition pragmas associated with subprograms that are
5665 marked as Inline_Always, or those marked as Inline with front-end
5666 inlining (-gnatN option set) are accepted and legality-checked
5667 by the compiler, but are ignored at run-time even if postcondition
5668 checking is enabled.
5670 Note that pragma @cite{Postcondition} differs from the language-defined
5671 @cite{Post} aspect (and corresponding @cite{Post} pragma) in allowing
5672 multiple occurrences, allowing occurences in the body even if there
5673 is a separate spec, and allowing a second string parameter, and the
5674 use of the pragma identifier @cite{Check}. Historically, pragma
5675 @cite{Postcondition} was implemented prior to the development of
5676 Ada 2012, and has been retained in its original form for
5677 compatibility purposes.
5679 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
5680 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{98}
5681 @section Pragma Post_Class
5684 @geindex Post
5686 @geindex Checks
5687 @geindex postconditions
5689 Syntax:
5691 @example
5692 pragma Post_Class (Boolean_Expression);
5693 @end example
5695 The @cite{Post_Class} pragma is intended to be an exact replacement for
5696 the language-defined
5697 @cite{Post'Class} aspect, and shares its restrictions and semantics.
5698 It must appear either immediately following the corresponding
5699 subprogram declaration (only other pragmas may intervene), or
5700 if there is no separate subprogram declaration, then it can
5701 appear at the start of the declarations in a subprogram body
5702 (preceded only by other pragmas).
5704 Note: This pragma is called @cite{Post_Class} rather than
5705 @cite{Post'Class} because the latter would not be strictly
5706 conforming to the allowed syntax for pragmas. The motivation
5707 for provinding pragmas equivalent to the aspects is to allow a program
5708 to be written using the pragmas, and then compiled if necessary
5709 using an Ada compiler that does not recognize the pragmas or
5710 aspects, but is prepared to ignore the pragmas. The assertion
5711 policy that controls this pragma is @cite{Post'Class}, not
5712 @cite{Post_Class}.
5714 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
5715 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{99}
5716 @section Pragma Pre
5719 @geindex Pre
5721 @geindex Checks
5722 @geindex preconditions
5724 Syntax:
5726 @example
5727 pragma Pre (Boolean_Expression);
5728 @end example
5730 The @cite{Pre} pragma is intended to be an exact replacement for
5731 the language-defined
5732 @cite{Pre} aspect, and shares its restrictions and semantics.
5733 It must appear either immediately following the corresponding
5734 subprogram declaration (only other pragmas may intervene), or
5735 if there is no separate subprogram declaration, then it can
5736 appear at the start of the declarations in a subprogram body
5737 (preceded only by other pragmas).
5739 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
5740 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{9a}
5741 @section Pragma Precondition
5744 @geindex Preconditions
5746 @geindex Checks
5747 @geindex preconditions
5749 Syntax:
5751 @example
5752 pragma Precondition (
5753    [Check   =>] Boolean_Expression
5754  [,[Message =>] String_Expression]);
5755 @end example
5757 The @cite{Precondition} pragma is similar to @cite{Postcondition}
5758 except that the corresponding checks take place immediately upon
5759 entry to the subprogram, and if a precondition fails, the exception
5760 is raised in the context of the caller, and the attribute 'Result
5761 cannot be used within the precondition expression.
5763 Otherwise, the placement and visibility rules are identical to those
5764 described for postconditions. The following is an example of use
5765 within a package spec:
5767 @example
5768 package Math_Functions is
5769    ...
5770    function Sqrt (Arg : Float) return Float;
5771    pragma Precondition (Arg >= 0.0)
5772    ...
5773 end Math_Functions;
5774 @end example
5776 @cite{Precondition} pragmas may appear either immediately following the
5777 (separate) declaration of a subprogram, or at the start of the
5778 declarations of a subprogram body. Only other pragmas may intervene
5779 (that is appear between the subprogram declaration and its
5780 postconditions, or appear before the postcondition in the
5781 declaration sequence in a subprogram body).
5783 Note: precondition pragmas associated with subprograms that are
5784 marked as Inline_Always, or those marked as Inline with front-end
5785 inlining (-gnatN option set) are accepted and legality-checked
5786 by the compiler, but are ignored at run-time even if precondition
5787 checking is enabled.
5789 Note that pragma @cite{Precondition} differs from the language-defined
5790 @cite{Pre} aspect (and corresponding @cite{Pre} pragma) in allowing
5791 multiple occurrences, allowing occurences in the body even if there
5792 is a separate spec, and allowing a second string parameter, and the
5793 use of the pragma identifier @cite{Check}. Historically, pragma
5794 @cite{Precondition} was implemented prior to the development of
5795 Ada 2012, and has been retained in its original form for
5796 compatibility purposes.
5798 @node Pragma Predicate,Pragma Preelaborable_Initialization,Pragma Precondition,Implementation Defined Pragmas
5799 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{9b}
5800 @section Pragma Predicate
5803 Syntax:
5805 @example
5806 pragma Predicate
5807   ([Entity =>] type_LOCAL_NAME,
5808    [Check  =>] EXPRESSION);
5809 @end example
5811 This pragma (available in all versions of Ada in GNAT) encompasses both
5812 the @cite{Static_Predicate} and @cite{Dynamic_Predicate} aspects in
5813 Ada 2012. A predicate is regarded as static if it has an allowed form
5814 for @cite{Static_Predicate} and is otherwise treated as a
5815 @cite{Dynamic_Predicate}. Otherwise, predicates specified by this
5816 pragma behave exactly as described in the Ada 2012 reference manual.
5817 For example, if we have
5819 @example
5820 type R is range 1 .. 10;
5821 subtype S is R;
5822 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
5823 subtype Q is R
5824 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
5825 @end example
5827 the effect is identical to the following Ada 2012 code:
5829 @example
5830 type R is range 1 .. 10;
5831 subtype S is R with
5832   Static_Predicate => S not in 4 .. 6;
5833 subtype Q is R with
5834   Dynamic_Predicate => F(Q) or G(Q);
5835 @end example
5837 Note that there is are no pragmas @cite{Dynamic_Predicate}
5838 or @cite{Static_Predicate}. That is
5839 because these pragmas would affect legality and semantics of
5840 the program and thus do not have a neutral effect if ignored.
5841 The motivation behind providing pragmas equivalent to
5842 corresponding aspects is to allow a program to be written
5843 using the pragmas, and then compiled with a compiler that
5844 will ignore the pragmas. That doesn't work in the case of
5845 static and dynamic predicates, since if the corresponding
5846 pragmas are ignored, then the behavior of the program is
5847 fundamentally changed (for example a membership test
5848 @cite{A in B} would not take into account a predicate
5849 defined for subtype B). When following this approach, the
5850 use of predicates should be avoided.
5852 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate,Implementation Defined Pragmas
5853 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{9c}
5854 @section Pragma Preelaborable_Initialization
5857 Syntax:
5859 @example
5860 pragma Preelaborable_Initialization (DIRECT_NAME);
5861 @end example
5863 This pragma is standard in Ada 2005, but is available in all earlier
5864 versions of Ada as an implementation-defined pragma.
5865 See Ada 2012 Reference Manual for details.
5867 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
5868 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{9d}
5869 @section Pragma Prefix_Exception_Messages
5872 @geindex Prefix_Exception_Messages
5874 @geindex exception
5876 @geindex Exception_Message
5878 Syntax:
5880 @example
5881 pragma Prefix_Exception_Messages;
5882 @end example
5884 This is an implementation-defined configuration pragma that affects the
5885 behavior of raise statements with a message given as a static string
5886 constant (typically a string literal). In such cases, the string will
5887 be automatically prefixed by the name of the enclosing entity (giving
5888 the package and subprogram containing the raise statement). This helps
5889 to identify where messages are coming from, and this mode is automatic
5890 for the run-time library.
5892 The pragma has no effect if the message is computed with an expression other
5893 than a static string constant, since the assumption in this case is that
5894 the program computes exactly the string it wants. If you still want the
5895 prefixing in this case, you can always call
5896 @cite{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
5898 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
5899 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{9e}
5900 @section Pragma Pre_Class
5903 @geindex Pre_Class
5905 @geindex Checks
5906 @geindex preconditions
5908 Syntax:
5910 @example
5911 pragma Pre_Class (Boolean_Expression);
5912 @end example
5914 The @cite{Pre_Class} pragma is intended to be an exact replacement for
5915 the language-defined
5916 @cite{Pre'Class} aspect, and shares its restrictions and semantics.
5917 It must appear either immediately following the corresponding
5918 subprogram declaration (only other pragmas may intervene), or
5919 if there is no separate subprogram declaration, then it can
5920 appear at the start of the declarations in a subprogram body
5921 (preceded only by other pragmas).
5923 Note: This pragma is called @cite{Pre_Class} rather than
5924 @cite{Pre'Class} because the latter would not be strictly
5925 conforming to the allowed syntax for pragmas. The motivation
5926 for providing pragmas equivalent to the aspects is to allow a program
5927 to be written using the pragmas, and then compiled if necessary
5928 using an Ada compiler that does not recognize the pragmas or
5929 aspects, but is prepared to ignore the pragmas. The assertion
5930 policy that controls this pragma is @cite{Pre'Class}, not
5931 @cite{Pre_Class}.
5933 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
5934 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{9f}
5935 @section Pragma Priority_Specific_Dispatching
5938 Syntax:
5940 @example
5941 pragma Priority_Specific_Dispatching (
5942    POLICY_IDENTIFIER,
5943    first_priority_EXPRESSION,
5944    last_priority_EXPRESSION)
5946 POLICY_IDENTIFIER ::=
5947    EDF_Across_Priorities            |
5948    FIFO_Within_Priorities           |
5949    Non_Preemptive_Within_Priorities |
5950    Round_Robin_Within_Priorities
5951 @end example
5953 This pragma is standard in Ada 2005, but is available in all earlier
5954 versions of Ada as an implementation-defined pragma.
5955 See Ada 2012 Reference Manual for details.
5957 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
5958 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{a0}
5959 @section Pragma Profile
5962 Syntax:
5964 @example
5965 pragma Profile (Ravenscar | Restricted | Rational);
5966 @end example
5968 This pragma is standard in Ada 2005, but is available in all earlier
5969 versions of Ada as an implementation-defined pragma. This is a
5970 configuration pragma that establishes a set of configuration pragmas
5971 that depend on the argument. @cite{Ravenscar} is standard in Ada 2005.
5972 The other two possibilities (@cite{Restricted} or @cite{Rational})
5973 are implementation-defined. The set of configuration pragmas
5974 is defined in the following sections.
5977 @itemize *
5979 @item 
5980 Pragma Profile (Ravenscar)
5982 The @cite{Ravenscar} profile is standard in Ada 2005,
5983 but is available in all earlier
5984 versions of Ada as an implementation-defined pragma. This profile
5985 establishes the following set of configuration pragmas:
5988 @itemize *
5990 @item 
5991 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
5993 [RM D.2.2] Tasks are dispatched following a preemptive
5994 priority-ordered scheduling policy.
5996 @item 
5997 @code{Locking_Policy (Ceiling_Locking)}
5999 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6000 the ceiling priority of the corresponding protected object.
6002 @item 
6003 @code{Detect_Blocking}
6005 This pragma forces the detection of potentially blocking operations within a
6006 protected operation, and to raise Program_Error if that happens.
6007 @end itemize
6009 plus the following set of restrictions:
6012 @itemize *
6014 @item 
6015 @code{Max_Entry_Queue_Length => 1}
6017 No task can be queued on a protected entry.
6019 @item 
6020 @code{Max_Protected_Entries => 1}
6022 @item 
6023 @code{Max_Task_Entries => 0}
6025 No rendezvous statements are allowed.
6027 @item 
6028 @code{No_Abort_Statements}
6030 @item 
6031 @code{No_Dynamic_Attachment}
6033 @item 
6034 @code{No_Dynamic_Priorities}
6036 @item 
6037 @code{No_Implicit_Heap_Allocations}
6039 @item 
6040 @code{No_Local_Protected_Objects}
6042 @item 
6043 @code{No_Local_Timing_Events}
6045 @item 
6046 @code{No_Protected_Type_Allocators}
6048 @item 
6049 @code{No_Relative_Delay}
6051 @item 
6052 @code{No_Requeue_Statements}
6054 @item 
6055 @code{No_Select_Statements}
6057 @item 
6058 @code{No_Specific_Termination_Handlers}
6060 @item 
6061 @code{No_Task_Allocators}
6063 @item 
6064 @code{No_Task_Hierarchy}
6066 @item 
6067 @code{No_Task_Termination}
6069 @item 
6070 @code{Simple_Barriers}
6071 @end itemize
6073 The Ravenscar profile also includes the following restrictions that specify
6074 that there are no semantic dependences on the corresponding predefined
6075 packages:
6078 @itemize *
6080 @item 
6081 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6083 @item 
6084 @code{No_Dependence => Ada.Calendar}
6086 @item 
6087 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6089 @item 
6090 @code{No_Dependence => Ada.Execution_Time.Timers}
6092 @item 
6093 @code{No_Dependence => Ada.Task_Attributes}
6095 @item 
6096 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6097 @end itemize
6099 This set of configuration pragmas and restrictions correspond to the
6100 definition of the 'Ravenscar Profile' for limited tasking, devised and
6101 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6102 A description is also available at
6103 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6105 The original definition of the profile was revised at subsequent IRTAW
6106 meetings. It has been included in the ISO
6107 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6108 and was made part of the Ada 2005 standard.
6109 The formal definition given by
6110 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6111 AI-305) available at
6112 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6113 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6115 The above set is a superset of the restrictions provided by pragma
6116 @code{Profile (Restricted)}, it includes six additional restrictions
6117 (@code{Simple_Barriers}, @code{No_Select_Statements},
6118 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6119 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6120 that pragma @code{Profile (Ravenscar)}, like the pragma
6121 @code{Profile (Restricted)},
6122 automatically causes the use of a simplified,
6123 more efficient version of the tasking run-time library.
6125 @item 
6126 Pragma Profile (Restricted)
6128 This profile corresponds to the GNAT restricted run time. It
6129 establishes the following set of restrictions:
6132 @itemize *
6134 @item 
6135 @code{No_Abort_Statements}
6137 @item 
6138 @code{No_Entry_Queue}
6140 @item 
6141 @code{No_Task_Hierarchy}
6143 @item 
6144 @code{No_Task_Allocators}
6146 @item 
6147 @code{No_Dynamic_Priorities}
6149 @item 
6150 @code{No_Terminate_Alternatives}
6152 @item 
6153 @code{No_Dynamic_Attachment}
6155 @item 
6156 @code{No_Protected_Type_Allocators}
6158 @item 
6159 @code{No_Local_Protected_Objects}
6161 @item 
6162 @code{No_Requeue_Statements}
6164 @item 
6165 @code{No_Task_Attributes_Package}
6167 @item 
6168 @code{Max_Asynchronous_Select_Nesting =  0}
6170 @item 
6171 @code{Max_Task_Entries =  0}
6173 @item 
6174 @code{Max_Protected_Entries = 1}
6176 @item 
6177 @code{Max_Select_Alternatives = 0}
6178 @end itemize
6180 This set of restrictions causes the automatic selection of a simplified
6181 version of the run time that provides improved performance for the
6182 limited set of tasking functionality permitted by this set of restrictions.
6184 @item 
6185 Pragma Profile (Rational)
6187 The Rational profile is intended to facilitate porting legacy code that
6188 compiles with the Rational APEX compiler, even when the code includes non-
6189 conforming Ada constructs.  The profile enables the following three pragmas:
6192 @itemize *
6194 @item 
6195 @code{pragma Implicit_Packing}
6197 @item 
6198 @code{pragma Overriding_Renamings}
6200 @item 
6201 @code{pragma Use_VADS_Size}
6202 @end itemize
6203 @end itemize
6205 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6206 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{a1}
6207 @section Pragma Profile_Warnings
6210 Syntax:
6212 @example
6213 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6214 @end example
6216 This is an implementation-defined pragma that is similar in
6217 effect to @cite{pragma Profile} except that instead of
6218 generating @cite{Restrictions} pragmas, it generates
6219 @cite{Restriction_Warnings} pragmas. The result is that
6220 violations of the profile generate warning messages instead
6221 of error messages.
6223 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6224 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{a2}
6225 @section Pragma Propagate_Exceptions
6228 @geindex Interfacing to C++
6230 Syntax:
6232 @example
6233 pragma Propagate_Exceptions;
6234 @end example
6236 This pragma is now obsolete and, other than generating a warning if warnings
6237 on obsolescent features are enabled, is ignored.
6238 It is retained for compatibility
6239 purposes. It used to be used in connection with optimization of
6240 a now-obsolete mechanism for implementation of exceptions.
6242 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6243 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{a3}
6244 @section Pragma Provide_Shift_Operators
6247 @geindex Shift operators
6249 Syntax:
6251 @example
6252 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6253 @end example
6255 This pragma can be applied to a first subtype local name that specifies
6256 either an unsigned or signed type. It has the effect of providing the
6257 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6258 Rotate_Left and Rotate_Right) for the given type. It is similar to
6259 including the function declarations for these five operators, together
6260 with the pragma Import (Intrinsic, ...) statements.
6262 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6263 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{a4}
6264 @section Pragma Psect_Object
6267 Syntax:
6269 @example
6270 pragma Psect_Object (
6271      [Internal =>] LOCAL_NAME,
6272   [, [External =>] EXTERNAL_SYMBOL]
6273   [, [Size     =>] EXTERNAL_SYMBOL]);
6275 EXTERNAL_SYMBOL ::=
6276   IDENTIFIER
6277 | static_string_EXPRESSION
6278 @end example
6280 This pragma is identical in effect to pragma @cite{Common_Object}.
6282 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6283 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{a5}
6284 @section Pragma Pure_Function
6287 Syntax:
6289 @example
6290 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6291 @end example
6293 This pragma appears in the same declarative part as a function
6294 declaration (or a set of function declarations if more than one
6295 overloaded declaration exists, in which case the pragma applies
6296 to all entities).  It specifies that the function @cite{Entity} is
6297 to be considered pure for the purposes of code generation.  This means
6298 that the compiler can assume that there are no side effects, and
6299 in particular that two calls with identical arguments produce the
6300 same result.  It also means that the function can be used in an
6301 address clause.
6303 Note that, quite deliberately, there are no static checks to try
6304 to ensure that this promise is met, so @cite{Pure_Function} can be used
6305 with functions that are conceptually pure, even if they do modify
6306 global variables.  For example, a square root function that is
6307 instrumented to count the number of times it is called is still
6308 conceptually pure, and can still be optimized, even though it
6309 modifies a global variable (the count).  Memo functions are another
6310 example (where a table of previous calls is kept and consulted to
6311 avoid re-computation).
6313 Note also that the normal rules excluding optimization of subprograms
6314 in pure units (when parameter types are descended from System.Address,
6315 or when the full view of a parameter type is limited), do not apply
6316 for the Pure_Function case. If you explicitly specify Pure_Function,
6317 the compiler may optimize away calls with identical arguments, and
6318 if that results in unexpected behavior, the proper action is not to
6319 use the pragma for subprograms that are not (conceptually) pure.
6321 Note: Most functions in a @cite{Pure} package are automatically pure, and
6322 there is no need to use pragma @cite{Pure_Function} for such functions.  One
6323 exception is any function that has at least one formal of type
6324 @cite{System.Address} or a type derived from it.  Such functions are not
6325 considered pure by default, since the compiler assumes that the
6326 @cite{Address} parameter may be functioning as a pointer and that the
6327 referenced data may change even if the address value does not.
6328 Similarly, imported functions are not considered to be pure by default,
6329 since there is no way of checking that they are in fact pure.  The use
6330 of pragma @cite{Pure_Function} for such a function will override these default
6331 assumption, and cause the compiler to treat a designated subprogram as pure
6332 in these cases.
6334 Note: If pragma @cite{Pure_Function} is applied to a renamed function, it
6335 applies to the underlying renamed function.  This can be used to
6336 disambiguate cases of overloading where some but not all functions
6337 in a set of overloaded functions are to be designated as pure.
6339 If pragma @cite{Pure_Function} is applied to a library level function, the
6340 function is also considered pure from an optimization point of view, but the
6341 unit is not a Pure unit in the categorization sense. So for example, a function
6342 thus marked is free to @cite{with} non-pure units.
6344 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6345 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{a6}
6346 @section Pragma Rational
6349 Syntax:
6351 @example
6352 pragma Rational;
6353 @end example
6355 This pragma is considered obsolescent, but is retained for
6356 compatibility purposes. It is equivalent to:
6358 @example
6359 pragma Profile (Rational);
6360 @end example
6362 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6363 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{a7}
6364 @section Pragma Ravenscar
6367 Syntax:
6369 @example
6370 pragma Ravenscar;
6371 @end example
6373 This pragma is considered obsolescent, but is retained for
6374 compatibility purposes. It is equivalent to:
6376 @example
6377 pragma Profile (Ravenscar);
6378 @end example
6380 which is the preferred method of setting the @cite{Ravenscar} profile.
6382 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6383 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{a8}
6384 @section Pragma Refined_Depends
6387 For the description of this pragma, see SPARK 2014 Reference Manual,
6388 section 6.1.5.
6390 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6391 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{a9}
6392 @section Pragma Refined_Global
6395 For the description of this pragma, see SPARK 2014 Reference Manual,
6396 section 6.1.4.
6398 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
6399 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{aa}
6400 @section Pragma Refined_Post
6403 For the description of this pragma, see SPARK 2014 Reference Manual,
6404 section 7.2.7.
6406 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
6407 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{ab}
6408 @section Pragma Refined_State
6411 For the description of this pragma, see SPARK 2014 Reference Manual,
6412 section 7.2.2.
6414 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
6415 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{ac}
6416 @section Pragma Relative_Deadline
6419 Syntax:
6421 @example
6422 pragma Relative_Deadline (time_span_EXPRESSION);
6423 @end example
6425 This pragma is standard in Ada 2005, but is available in all earlier
6426 versions of Ada as an implementation-defined pragma.
6427 See Ada 2012 Reference Manual for details.
6429 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
6430 @anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{ad}
6431 @section Pragma Remote_Access_Type
6434 Syntax:
6436 @example
6437 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
6438 @end example
6440 This pragma appears in the formal part of a generic declaration.
6441 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
6442 the use of a remote access to class-wide type as actual for a formal
6443 access type.
6445 When this pragma applies to a formal access type @cite{Entity}, that
6446 type is treated as a remote access to class-wide type in the generic.
6447 It must be a formal general access type, and its designated type must
6448 be the class-wide type of a formal tagged limited private type from the
6449 same generic declaration.
6451 In the generic unit, the formal type is subject to all restrictions
6452 pertaining to remote access to class-wide types. At instantiation, the
6453 actual type must be a remote access to class-wide type.
6455 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
6456 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{ae}
6457 @section Pragma Restricted_Run_Time
6460 Syntax:
6462 @example
6463 pragma Restricted_Run_Time;
6464 @end example
6466 This pragma is considered obsolescent, but is retained for
6467 compatibility purposes. It is equivalent to:
6469 @example
6470 pragma Profile (Restricted);
6471 @end example
6473 which is the preferred method of setting the restricted run time
6474 profile.
6476 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
6477 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{af}
6478 @section Pragma Restriction_Warnings
6481 Syntax:
6483 @example
6484 pragma Restriction_Warnings
6485   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
6486 @end example
6488 This pragma allows a series of restriction identifiers to be
6489 specified (the list of allowed identifiers is the same as for
6490 pragma @cite{Restrictions}). For each of these identifiers
6491 the compiler checks for violations of the restriction, but
6492 generates a warning message rather than an error message
6493 if the restriction is violated.
6495 One use of this is in situations where you want to know
6496 about violations of a restriction, but you want to ignore some of
6497 these violations. Consider this example, where you want to set
6498 Ada_95 mode and enable style checks, but you want to know about
6499 any other use of implementation pragmas:
6501 @example
6502 pragma Restriction_Warnings (No_Implementation_Pragmas);
6503 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
6504 pragma Ada_95;
6505 pragma Style_Checks ("2bfhkM160");
6506 pragma Warnings (On, "violation of No_Implementation_Pragmas");
6507 @end example
6509 By including the above lines in a configuration pragmas file,
6510 the Ada_95 and Style_Checks pragmas are accepted without
6511 generating a warning, but any other use of implementation
6512 defined pragmas will cause a warning to be generated.
6514 @node Pragma Reviewable,Pragma Share_Generic,Pragma Restriction_Warnings,Implementation Defined Pragmas
6515 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{b0}
6516 @section Pragma Reviewable
6519 Syntax:
6521 @example
6522 pragma Reviewable;
6523 @end example
6525 This pragma is an RM-defined standard pragma, but has no effect on the
6526 program being compiled, or on the code generated for the program.
6528 To obtain the required output specified in RM H.3.1, the compiler must be
6529 run with various special switches as follows:
6532 @itemize *
6534 @item 
6535 @emph{Where compiler-generated run-time checks remain}
6537 The switch @emph{-gnatGL}
6538 may be used to list the expanded code in pseudo-Ada form.
6539 Runtime checks show up in the listing either as explicit
6540 checks or operators marked with @{@} to indicate a check is present.
6542 @item 
6543 @emph{An identification of known exceptions at compile time}
6545 If the program is compiled with @emph{-gnatwa},
6546 the compiler warning messages will indicate all cases where the compiler
6547 detects that an exception is certain to occur at run time.
6549 @item 
6550 @emph{Possible reads of uninitialized variables}
6552 The compiler warns of many such cases, but its output is incomplete.
6553 @end itemize
6556 A supplemental static analysis tool
6557 may be used to obtain a comprehensive list of all
6558 possible points at which uninitialized data may be read.
6561 @itemize *
6563 @item 
6564 @emph{Where run-time support routines are implicitly invoked}
6566 In the output from @emph{-gnatGL},
6567 run-time calls are explicitly listed as calls to the relevant
6568 run-time routine.
6570 @item 
6571 @emph{Object code listing}
6573 This may be obtained either by using the @emph{-S} switch,
6574 or the objdump utility.
6576 @item 
6577 @emph{Constructs known to be erroneous at compile time}
6579 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
6581 @item 
6582 @emph{Stack usage information}
6584 Static stack usage data (maximum per-subprogram) can be obtained via the
6585 @emph{-fstack-usage} switch to the compiler.
6586 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
6587 to gnatbind
6588 @end itemize
6592 @itemize *
6594 @item 
6595 @emph{Object code listing of entire partition}
6597 This can be obtained by compiling the partition with @emph{-S},
6598 or by applying objdump
6599 to all the object files that are part of the partition.
6601 @item 
6602 @emph{A description of the run-time model}
6604 The full sources of the run-time are available, and the documentation of
6605 these routines describes how these run-time routines interface to the
6606 underlying operating system facilities.
6608 @item 
6609 @emph{Control and data-flow information}
6610 @end itemize
6613 A supplemental static analysis tool
6614 may be used to obtain complete control and data-flow information, as well as
6615 comprehensive messages identifying possible problems based on this
6616 information.
6618 @node Pragma Share_Generic,Pragma Shared,Pragma Reviewable,Implementation Defined Pragmas
6619 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{b1}
6620 @section Pragma Share_Generic
6623 Syntax:
6625 @example
6626 pragma Share_Generic (GNAME @{, GNAME@});
6628 GNAME ::= generic_unit_NAME | generic_instance_NAME
6629 @end example
6631 This pragma is provided for compatibility with Dec Ada 83. It has
6632 no effect in @cite{GNAT} (which does not implement shared generics), other
6633 than to check that the given names are all names of generic units or
6634 generic instances.
6636 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
6637 @anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{b2}
6638 @section Pragma Shared
6641 This pragma is provided for compatibility with Ada 83. The syntax and
6642 semantics are identical to pragma Atomic.
6644 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
6645 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{b3}
6646 @section Pragma Short_Circuit_And_Or
6649 Syntax:
6651 @example
6652 pragma Short_Circuit_And_Or;
6653 @end example
6655 This configuration pragma causes any occurrence of the AND operator applied to
6656 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
6657 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
6658 may be useful in the context of certification protocols requiring the use of
6659 short-circuited logical operators. If this configuration pragma occurs locally
6660 within the file being compiled, it applies only to the file being compiled.
6661 There is no requirement that all units in a partition use this option.
6663 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
6664 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{b4}
6665 @section Pragma Short_Descriptors
6668 Syntax:
6670 @example
6671 pragma Short_Descriptors
6672 @end example
6674 This pragma is provided for compatibility with other Ada implementations. It
6675 is recognized but ignored by all current versions of GNAT.
6677 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
6678 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{b5}
6679 @section Pragma Simple_Storage_Pool_Type
6682 @geindex Storage pool
6683 @geindex simple
6685 @geindex Simple storage pool
6687 Syntax:
6689 @example
6690 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
6691 @end example
6693 A type can be established as a 'simple storage pool type' by applying
6694 the representation pragma @cite{Simple_Storage_Pool_Type} to the type.
6695 A type named in the pragma must be a library-level immutably limited record
6696 type or limited tagged type declared immediately within a package declaration.
6697 The type can also be a limited private type whose full type is allowed as
6698 a simple storage pool type.
6700 For a simple storage pool type @cite{SSP}, nonabstract primitive subprograms
6701 @cite{Allocate}, @cite{Deallocate}, and @cite{Storage_Size} can be declared that
6702 are subtype conformant with the following subprogram declarations:
6704 @example
6705 procedure Allocate
6706   (Pool                     : in out SSP;
6707    Storage_Address          : out System.Address;
6708    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6709    Alignment                : System.Storage_Elements.Storage_Count);
6711 procedure Deallocate
6712   (Pool : in out SSP;
6713    Storage_Address          : System.Address;
6714    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6715    Alignment                : System.Storage_Elements.Storage_Count);
6717 function Storage_Size (Pool : SSP)
6718   return System.Storage_Elements.Storage_Count;
6719 @end example
6721 Procedure @cite{Allocate} must be declared, whereas @cite{Deallocate} and
6722 @cite{Storage_Size} are optional. If @cite{Deallocate} is not declared, then
6723 applying an unchecked deallocation has no effect other than to set its actual
6724 parameter to null. If @cite{Storage_Size} is not declared, then the
6725 @cite{Storage_Size} attribute applied to an access type associated with
6726 a pool object of type SSP returns zero. Additional operations can be declared
6727 for a simple storage pool type (such as for supporting a mark/release
6728 storage-management discipline).
6730 An object of a simple storage pool type can be associated with an access
6731 type by specifying the attribute
6732 @ref{b6,,Simple_Storage_Pool}. For example:
6734 @example
6735 My_Pool : My_Simple_Storage_Pool_Type;
6737 type Acc is access My_Data_Type;
6739 for Acc'Simple_Storage_Pool use My_Pool;
6740 @end example
6742 See attribute @ref{b6,,Simple_Storage_Pool}
6743 for further details.
6745 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
6746 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{b7}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{b8}
6747 @section Pragma Source_File_Name
6750 Syntax:
6752 @example
6753 pragma Source_File_Name (
6754   [Unit_Name   =>] unit_NAME,
6755   Spec_File_Name =>  STRING_LITERAL,
6756   [Index => INTEGER_LITERAL]);
6758 pragma Source_File_Name (
6759   [Unit_Name   =>] unit_NAME,
6760   Body_File_Name =>  STRING_LITERAL,
6761   [Index => INTEGER_LITERAL]);
6762 @end example
6764 Use this to override the normal naming convention.  It is a configuration
6765 pragma, and so has the usual applicability of configuration pragmas
6766 (i.e., it applies to either an entire partition, or to all units in a
6767 compilation, or to a single unit, depending on how it is used.
6768 @cite{unit_name} is mapped to @cite{file_name_literal}.  The identifier for
6769 the second argument is required, and indicates whether this is the file
6770 name for the spec or for the body.
6772 The optional Index argument should be used when a file contains multiple
6773 units, and when you do not want to use @cite{gnatchop} to separate then
6774 into multiple files (which is the recommended procedure to limit the
6775 number of recompilations that are needed when some sources change).
6776 For instance, if the source file @code{source.ada} contains
6778 @example
6779 package B is
6781 end B;
6783 with B;
6784 procedure A is
6785 begin
6786    ..
6787 end A;
6788 @end example
6790 you could use the following configuration pragmas:
6792 @example
6793 pragma Source_File_Name
6794   (B, Spec_File_Name => "source.ada", Index => 1);
6795 pragma Source_File_Name
6796   (A, Body_File_Name => "source.ada", Index => 2);
6797 @end example
6799 Note that the @cite{gnatname} utility can also be used to generate those
6800 configuration pragmas.
6802 Another form of the @cite{Source_File_Name} pragma allows
6803 the specification of patterns defining alternative file naming schemes
6804 to apply to all files.
6806 @example
6807 pragma Source_File_Name
6808   (  [Spec_File_Name  =>] STRING_LITERAL
6809    [,[Casing          =>] CASING_SPEC]
6810    [,[Dot_Replacement =>] STRING_LITERAL]);
6812 pragma Source_File_Name
6813   (  [Body_File_Name  =>] STRING_LITERAL
6814    [,[Casing          =>] CASING_SPEC]
6815    [,[Dot_Replacement =>] STRING_LITERAL]);
6817 pragma Source_File_Name
6818   (  [Subunit_File_Name =>] STRING_LITERAL
6819    [,[Casing            =>] CASING_SPEC]
6820    [,[Dot_Replacement   =>] STRING_LITERAL]);
6822 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
6823 @end example
6825 The first argument is a pattern that contains a single asterisk indicating
6826 the point at which the unit name is to be inserted in the pattern string
6827 to form the file name.  The second argument is optional.  If present it
6828 specifies the casing of the unit name in the resulting file name string.
6829 The default is lower case.  Finally the third argument allows for systematic
6830 replacement of any dots in the unit name by the specified string literal.
6832 Note that Source_File_Name pragmas should not be used if you are using
6833 project files. The reason for this rule is that the project manager is not
6834 aware of these pragmas, and so other tools that use the projet file would not
6835 be aware of the intended naming conventions. If you are using project files,
6836 file naming is controlled by Source_File_Name_Project pragmas, which are
6837 usually supplied automatically by the project manager. A pragma
6838 Source_File_Name cannot appear after a @ref{b9,,Pragma Source_File_Name_Project}.
6840 For more details on the use of the @cite{Source_File_Name} pragma, see the
6841 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
6843 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
6844 @anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{ba}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{b9}
6845 @section Pragma Source_File_Name_Project
6848 This pragma has the same syntax and semantics as pragma Source_File_Name.
6849 It is only allowed as a stand alone configuration pragma.
6850 It cannot appear after a @ref{b7,,Pragma Source_File_Name}, and
6851 most importantly, once pragma Source_File_Name_Project appears,
6852 no further Source_File_Name pragmas are allowed.
6854 The intention is that Source_File_Name_Project pragmas are always
6855 generated by the Project Manager in a manner consistent with the naming
6856 specified in a project file, and when naming is controlled in this manner,
6857 it is not permissible to attempt to modify this naming scheme using
6858 Source_File_Name or Source_File_Name_Project pragmas (which would not be
6859 known to the project manager).
6861 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
6862 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{bb}
6863 @section Pragma Source_Reference
6866 Syntax:
6868 @example
6869 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
6870 @end example
6872 This pragma must appear as the first line of a source file.
6873 @cite{integer_literal} is the logical line number of the line following
6874 the pragma line (for use in error messages and debugging
6875 information).  @cite{string_literal} is a static string constant that
6876 specifies the file name to be used in error messages and debugging
6877 information.  This is most notably used for the output of @cite{gnatchop}
6878 with the @emph{-r} switch, to make sure that the original unchopped
6879 source file is the one referred to.
6881 The second argument must be a string literal, it cannot be a static
6882 string expression other than a string literal.  This is because its value
6883 is needed for error messages issued by all phases of the compiler.
6885 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
6886 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{bc}
6887 @section Pragma SPARK_Mode
6890 Syntax:
6892 @example
6893 pragma SPARK_Mode [(On | Off)] ;
6894 @end example
6896 In general a program can have some parts that are in SPARK 2014 (and
6897 follow all the rules in the SPARK Reference Manual), and some parts
6898 that are full Ada 2012.
6900 The SPARK_Mode pragma is used to identify which parts are in SPARK
6901 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
6902 be used in the following places:
6905 @itemize *
6907 @item 
6908 As a configuration pragma, in which case it sets the default mode for
6909 all units compiled with this pragma.
6911 @item 
6912 Immediately following a library-level subprogram spec
6914 @item 
6915 Immediately within a library-level package body
6917 @item 
6918 Immediately following the @cite{private} keyword of a library-level
6919 package spec
6921 @item 
6922 Immediately following the @cite{begin} keyword of a library-level
6923 package body
6925 @item 
6926 Immediately within a library-level subprogram body
6927 @end itemize
6929 Normally a subprogram or package spec/body inherits the current mode
6930 that is active at the point it is declared. But this can be overridden
6931 by pragma within the spec or body as above.
6933 The basic consistency rule is that you can't turn SPARK_Mode back
6934 @cite{On}, once you have explicitly (with a pragma) turned if
6935 @cite{Off}. So the following rules apply:
6937 If a subprogram spec has SPARK_Mode @cite{Off}, then the body must
6938 also have SPARK_Mode @cite{Off}.
6940 For a package, we have four parts:
6943 @itemize *
6945 @item 
6946 the package public declarations
6948 @item 
6949 the package private part
6951 @item 
6952 the body of the package
6954 @item 
6955 the elaboration code after @cite{begin}
6956 @end itemize
6958 For a package, the rule is that if you explicitly turn SPARK_Mode
6959 @cite{Off} for any part, then all the following parts must have
6960 SPARK_Mode @cite{Off}. Note that this may require repeating a pragma
6961 SPARK_Mode (@cite{Off}) in the body. For example, if we have a
6962 configuration pragma SPARK_Mode (@cite{On}) that turns the mode on by
6963 default everywhere, and one particular package spec has pragma
6964 SPARK_Mode (@cite{Off}), then that pragma will need to be repeated in
6965 the package body.
6967 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
6968 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{bd}
6969 @section Pragma Static_Elaboration_Desired
6972 Syntax:
6974 @example
6975 pragma Static_Elaboration_Desired;
6976 @end example
6978 This pragma is used to indicate that the compiler should attempt to initialize
6979 statically the objects declared in the library unit to which the pragma applies,
6980 when these objects are initialized (explicitly or implicitly) by an aggregate.
6981 In the absence of this pragma, aggregates in object declarations are expanded
6982 into assignments and loops, even when the aggregate components are static
6983 constants. When the aggregate is present the compiler builds a static expression
6984 that requires no run-time code, so that the initialized object can be placed in
6985 read-only data space. If the components are not static, or the aggregate has
6986 more that 100 components, the compiler emits a warning that the pragma cannot
6987 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
6988 construction of larger aggregates with static components that include an others
6989 choice.)
6991 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
6992 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{be}
6993 @section Pragma Stream_Convert
6996 Syntax:
6998 @example
6999 pragma Stream_Convert (
7000   [Entity =>] type_LOCAL_NAME,
7001   [Read   =>] function_NAME,
7002   [Write  =>] function_NAME);
7003 @end example
7005 This pragma provides an efficient way of providing user-defined stream
7006 attributes.  Not only is it simpler to use than specifying the attributes
7007 directly, but more importantly, it allows the specification to be made in such
7008 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7009 needed (i.e. unless the stream attributes are actually used); the use of
7010 the Stream_Convert pragma adds no overhead at all, unless the stream
7011 attributes are actually used on the designated type.
7013 The first argument specifies the type for which stream functions are
7014 provided.  The second parameter provides a function used to read values
7015 of this type.  It must name a function whose argument type may be any
7016 subtype, and whose returned type must be the type given as the first
7017 argument to the pragma.
7019 The meaning of the @cite{Read} parameter is that if a stream attribute directly
7020 or indirectly specifies reading of the type given as the first parameter,
7021 then a value of the type given as the argument to the Read function is
7022 read from the stream, and then the Read function is used to convert this
7023 to the required target type.
7025 Similarly the @cite{Write} parameter specifies how to treat write attributes
7026 that directly or indirectly apply to the type given as the first parameter.
7027 It must have an input parameter of the type specified by the first parameter,
7028 and the return type must be the same as the input type of the Read function.
7029 The effect is to first call the Write function to convert to the given stream
7030 type, and then write the result type to the stream.
7032 The Read and Write functions must not be overloaded subprograms.  If necessary
7033 renamings can be supplied to meet this requirement.
7034 The usage of this attribute is best illustrated by a simple example, taken
7035 from the GNAT implementation of package Ada.Strings.Unbounded:
7037 @example
7038 function To_Unbounded (S : String) return Unbounded_String
7039   renames To_Unbounded_String;
7041 pragma Stream_Convert
7042   (Unbounded_String, To_Unbounded, To_String);
7043 @end example
7045 The specifications of the referenced functions, as given in the Ada
7046 Reference Manual are:
7048 @example
7049 function To_Unbounded_String (Source : String)
7050   return Unbounded_String;
7052 function To_String (Source : Unbounded_String)
7053   return String;
7054 @end example
7056 The effect is that if the value of an unbounded string is written to a stream,
7057 then the representation of the item in the stream is in the same format that
7058 would be used for @cite{Standard.String'Output}, and this same representation
7059 is expected when a value of this type is read from the stream. Note that the
7060 value written always includes the bounds, even for Unbounded_String'Write,
7061 since Unbounded_String is not an array type.
7063 Note that the @cite{Stream_Convert} pragma is not effective in the case of
7064 a derived type of a non-limited tagged type. If such a type is specified then
7065 the pragma is silently ignored, and the default implementation of the stream
7066 attributes is used instead.
7068 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7069 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{bf}
7070 @section Pragma Style_Checks
7073 Syntax:
7075 @example
7076 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7077                      On | Off [, LOCAL_NAME]);
7078 @end example
7080 This pragma is used in conjunction with compiler switches to control the
7081 built in style checking provided by GNAT.  The compiler switches, if set,
7082 provide an initial setting for the switches, and this pragma may be used
7083 to modify these settings, or the settings may be provided entirely by
7084 the use of the pragma.  This pragma can be used anywhere that a pragma
7085 is legal, including use as a configuration pragma (including use in
7086 the @code{gnat.adc} file).
7088 The form with a string literal specifies which style options are to be
7089 activated.  These are additive, so they apply in addition to any previously
7090 set style check options.  The codes for the options are the same as those
7091 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7092 For example the following two methods can be used to enable
7093 layout checking:
7096 @itemize *
7098 @item 
7099 @example
7100 pragma Style_Checks ("l");
7101 @end example
7103 @item 
7104 @example
7105 gcc -c -gnatyl ...
7106 @end example
7107 @end itemize
7109 The form ALL_CHECKS activates all standard checks (its use is equivalent
7110 to the use of the @cite{gnaty} switch with no options.
7111 See the @cite{GNAT User's Guide} for details.)
7113 Note: the behavior is slightly different in GNAT mode (@emph{-gnatg} used).
7114 In this case, ALL_CHECKS implies the standard set of GNAT mode style check
7115 options (i.e. equivalent to @emph{-gnatyg}).
7117 The forms with @cite{Off} and @cite{On}
7118 can be used to temporarily disable style checks
7119 as shown in the following example:
7121 @example
7122 pragma Style_Checks ("k"); -- requires keywords in lower case
7123 pragma Style_Checks (Off); -- turn off style checks
7124 NULL;                      -- this will not generate an error message
7125 pragma Style_Checks (On);  -- turn style checks back on
7126 NULL;                      -- this will generate an error message
7127 @end example
7129 Finally the two argument form is allowed only if the first argument is
7130 @cite{On} or @cite{Off}.  The effect is to turn of semantic style checks
7131 for the specified entity, as shown in the following example:
7133 @example
7134 pragma Style_Checks ("r"); -- require consistency of identifier casing
7135 Arg : Integer;
7136 Rf1 : Integer := ARG;      -- incorrect, wrong case
7137 pragma Style_Checks (Off, Arg);
7138 Rf2 : Integer := ARG;      -- OK, no error
7139 @end example
7141 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7142 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{c0}
7143 @section Pragma Subtitle
7146 Syntax:
7148 @example
7149 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7150 @end example
7152 This pragma is recognized for compatibility with other Ada compilers
7153 but is ignored by GNAT.
7155 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7156 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{c1}
7157 @section Pragma Suppress
7160 Syntax:
7162 @example
7163 pragma Suppress (Identifier [, [On =>] Name]);
7164 @end example
7166 This is a standard pragma, and supports all the check names required in
7167 the RM. It is included here because GNAT recognizes some additional check
7168 names that are implementation defined (as permitted by the RM):
7171 @itemize *
7173 @item 
7174 @cite{Alignment_Check} can be used to suppress alignment checks
7175 on addresses used in address clauses. Such checks can also be suppressed
7176 by suppressing range checks, but the specific use of @cite{Alignment_Check}
7177 allows suppression of alignment checks without suppressing other range checks.
7179 @item 
7180 @cite{Atomic_Synchronization} can be used to suppress the special memory
7181 synchronization instructions that are normally generated for access to
7182 @cite{Atomic} variables to ensure correct synchronization between tasks
7183 that use such variables for synchronization purposes.
7185 @item 
7186 @cite{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7187 for a duplicated tag value when a tagged type is declared.
7189 @item 
7190 @cite{Predicate_Check} can be used to control whether predicate checks are
7191 active. It is applicable only to predicates for which the policy is
7192 @cite{Check}. Unlike @cite{Assertion_Policy}, which determines if a given
7193 predicate is ignored or checked for the whole program, the use of
7194 @cite{Suppress} and @cite{Unsuppress} with this check name allows a given
7195 predicate to be turned on and off at specific points in the program.
7197 @item 
7198 @cite{Validity_Check} can be used specifically to control validity checks.
7199 If @cite{Suppress} is used to suppress validity checks, then no validity
7200 checks are performed, including those specified by the appropriate compiler
7201 switch or the @cite{Validity_Checks} pragma.
7203 @item 
7204 Additional check names previously introduced by use of the @cite{Check_Name}
7205 pragma are also allowed.
7206 @end itemize
7208 Note that pragma Suppress gives the compiler permission to omit
7209 checks, but does not require the compiler to omit checks. The compiler
7210 will generate checks if they are essentially free, even when they are
7211 suppressed. In particular, if the compiler can prove that a certain
7212 check will necessarily fail, it will generate code to do an
7213 unconditional 'raise', even if checks are suppressed. The compiler
7214 warns in this case.
7216 Of course, run-time checks are omitted whenever the compiler can prove
7217 that they will not fail, whether or not checks are suppressed.
7219 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7220 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{c2}
7221 @section Pragma Suppress_All
7224 Syntax:
7226 @example
7227 pragma Suppress_All;
7228 @end example
7230 This pragma can appear anywhere within a unit.
7231 The effect is to apply @cite{Suppress (All_Checks)} to the unit
7232 in which it appears.  This pragma is implemented for compatibility with DEC
7233 Ada 83 usage where it appears at the end of a unit, and for compatibility
7234 with Rational Ada, where it appears as a program unit pragma.
7235 The use of the standard Ada pragma @cite{Suppress (All_Checks)}
7236 as a normal configuration pragma is the preferred usage in GNAT.
7238 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7239 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{c3}
7240 @section Pragma Suppress_Debug_Info
7243 Syntax:
7245 @example
7246 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7247 @end example
7249 This pragma can be used to suppress generation of debug information
7250 for the specified entity. It is intended primarily for use in debugging
7251 the debugger, and navigating around debugger problems.
7253 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7254 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{c4}
7255 @section Pragma Suppress_Exception_Locations
7258 Syntax:
7260 @example
7261 pragma Suppress_Exception_Locations;
7262 @end example
7264 In normal mode, a raise statement for an exception by default generates
7265 an exception message giving the file name and line number for the location
7266 of the raise. This is useful for debugging and logging purposes, but this
7267 entails extra space for the strings for the messages. The configuration
7268 pragma @cite{Suppress_Exception_Locations} can be used to suppress the
7269 generation of these strings, with the result that space is saved, but the
7270 exception message for such raises is null. This configuration pragma may
7271 appear in a global configuration pragma file, or in a specific unit as
7272 usual. It is not required that this pragma be used consistently within
7273 a partition, so it is fine to have some units within a partition compiled
7274 with this pragma and others compiled in normal mode without it.
7276 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7277 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{c5}
7278 @section Pragma Suppress_Initialization
7281 @geindex Suppressing initialization
7283 @geindex Initialization
7284 @geindex suppression of
7286 Syntax:
7288 @example
7289 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
7290 @end example
7292 Here variable_or_subtype_Name is the name introduced by a type declaration
7293 or subtype declaration or the name of a variable introduced by an
7294 object declaration.
7296 In the case of a type or subtype
7297 this pragma suppresses any implicit or explicit initialization
7298 for all variables of the given type or subtype,
7299 including initialization resulting from the use of pragmas
7300 Normalize_Scalars or Initialize_Scalars.
7302 This is considered a representation item, so it cannot be given after
7303 the type is frozen. It applies to all subsequent object declarations,
7304 and also any allocator that creates objects of the type.
7306 If the pragma is given for the first subtype, then it is considered
7307 to apply to the base type and all its subtypes. If the pragma is given
7308 for other than a first subtype, then it applies only to the given subtype.
7309 The pragma may not be given after the type is frozen.
7311 Note that this includes eliminating initialization of discriminants
7312 for discriminated types, and tags for tagged types. In these cases,
7313 you will have to use some non-portable mechanism (e.g. address
7314 overlays or unchecked conversion) to achieve required initialization
7315 of these fields before accessing any object of the corresponding type.
7317 For the variable case, implicit initialization for the named variable
7318 is suppressed, just as though its subtype had been given in a pragma
7319 Suppress_Initialization, as described above.
7321 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
7322 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{c6}
7323 @section Pragma Task_Name
7326 Syntax
7328 @example
7329 pragma Task_Name (string_EXPRESSION);
7330 @end example
7332 This pragma appears within a task definition (like pragma
7333 @cite{Priority}) and applies to the task in which it appears.  The
7334 argument must be of type String, and provides a name to be used for
7335 the task instance when the task is created.  Note that this expression
7336 is not required to be static, and in particular, it can contain
7337 references to task discriminants.  This facility can be used to
7338 provide different names for different tasks as they are created,
7339 as illustrated in the example below.
7341 The task name is recorded internally in the run-time structures
7342 and is accessible to tools like the debugger.  In addition the
7343 routine @cite{Ada.Task_Identification.Image} will return this
7344 string, with a unique task address appended.
7346 @example
7347 --  Example of the use of pragma Task_Name
7349 with Ada.Task_Identification;
7350 use Ada.Task_Identification;
7351 with Text_IO; use Text_IO;
7352 procedure t3 is
7354    type Astring is access String;
7356    task type Task_Typ (Name : access String) is
7357       pragma Task_Name (Name.all);
7358    end Task_Typ;
7360    task body Task_Typ is
7361       Nam : constant String := Image (Current_Task);
7362    begin
7363       Put_Line ("-->" & Nam (1 .. 14) & "<--");
7364    end Task_Typ;
7366    type Ptr_Task is access Task_Typ;
7367    Task_Var : Ptr_Task;
7369 begin
7370    Task_Var :=
7371      new Task_Typ (new String'("This is task 1"));
7372    Task_Var :=
7373      new Task_Typ (new String'("This is task 2"));
7374 end;
7375 @end example
7377 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
7378 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{c7}
7379 @section Pragma Task_Storage
7382 Syntax:
7384 @example
7385 pragma Task_Storage (
7386   [Task_Type =>] LOCAL_NAME,
7387   [Top_Guard =>] static_integer_EXPRESSION);
7388 @end example
7390 This pragma specifies the length of the guard area for tasks.  The guard
7391 area is an additional storage area allocated to a task.  A value of zero
7392 means that either no guard area is created or a minimal guard area is
7393 created, depending on the target.  This pragma can appear anywhere a
7394 @cite{Storage_Size} attribute definition clause is allowed for a task
7395 type.
7397 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
7398 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{c8}
7399 @section Pragma Test_Case
7402 @geindex Test cases
7404 Syntax:
7406 @example
7407 pragma Test_Case (
7408    [Name     =>] static_string_Expression
7409   ,[Mode     =>] (Nominal | Robustness)
7410  [, Requires =>  Boolean_Expression]
7411  [, Ensures  =>  Boolean_Expression]);
7412 @end example
7414 The @cite{Test_Case} pragma allows defining fine-grain specifications
7415 for use by testing tools.
7416 The compiler checks the validity of the @cite{Test_Case} pragma, but its
7417 presence does not lead to any modification of the code generated by the
7418 compiler.
7420 @cite{Test_Case} pragmas may only appear immediately following the
7421 (separate) declaration of a subprogram in a package declaration, inside
7422 a package spec unit. Only other pragmas may intervene (that is appear
7423 between the subprogram declaration and a test case).
7425 The compiler checks that boolean expressions given in @cite{Requires} and
7426 @cite{Ensures} are valid, where the rules for @cite{Requires} are the
7427 same as the rule for an expression in @cite{Precondition} and the rules
7428 for @cite{Ensures} are the same as the rule for an expression in
7429 @cite{Postcondition}. In particular, attributes @cite{'Old} and
7430 @cite{'Result} can only be used within the @cite{Ensures}
7431 expression. The following is an example of use within a package spec:
7433 @example
7434 package Math_Functions is
7435    ...
7436    function Sqrt (Arg : Float) return Float;
7437    pragma Test_Case (Name     => "Test 1",
7438                      Mode     => Nominal,
7439                      Requires => Arg < 10000,
7440                      Ensures  => Sqrt'Result < 10);
7441    ...
7442 end Math_Functions;
7443 @end example
7445 The meaning of a test case is that there is at least one context where
7446 @cite{Requires} holds such that, if the associated subprogram is executed in
7447 that context, then @cite{Ensures} holds when the subprogram returns.
7448 Mode @cite{Nominal} indicates that the input context should also satisfy the
7449 precondition of the subprogram, and the output context should also satisfy its
7450 postcondition. Mode @cite{Robustness} indicates that the precondition and
7451 postcondition of the subprogram should be ignored for this test case.
7453 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
7454 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{c9}
7455 @section Pragma Thread_Local_Storage
7458 @geindex Task specific storage
7460 @geindex TLS (Thread Local Storage)
7462 @geindex Task_Attributes
7464 Syntax:
7466 @example
7467 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
7468 @end example
7470 This pragma specifies that the specified entity, which must be
7471 a variable declared in a library level package, is to be marked as
7472 "Thread Local Storage" (@cite{TLS}). On systems supporting this (which
7473 include Solaris, GNU/Linux and VxWorks 6), this causes each thread
7474 (and hence each Ada task) to see a distinct copy of the variable.
7476 The variable may not have default initialization, and if there is
7477 an explicit initialization, it must be either @cite{null} for an
7478 access variable, or a static expression for a scalar variable.
7479 This provides a low level mechanism similar to that provided by
7480 the @cite{Ada.Task_Attributes} package, but much more efficient
7481 and is also useful in writing interface code that will interact
7482 with foreign threads.
7484 If this pragma is used on a system where @cite{TLS} is not supported,
7485 then an error message will be generated and the program will be rejected.
7487 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
7488 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{ca}
7489 @section Pragma Time_Slice
7492 Syntax:
7494 @example
7495 pragma Time_Slice (static_duration_EXPRESSION);
7496 @end example
7498 For implementations of GNAT on operating systems where it is possible
7499 to supply a time slice value, this pragma may be used for this purpose.
7500 It is ignored if it is used in a system that does not allow this control,
7501 or if it appears in other than the main program unit.
7503 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
7504 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{cb}
7505 @section Pragma Title
7508 Syntax:
7510 @example
7511 pragma Title (TITLING_OPTION [, TITLING OPTION]);
7513 TITLING_OPTION ::=
7514   [Title    =>] STRING_LITERAL,
7515 | [Subtitle =>] STRING_LITERAL
7516 @end example
7518 Syntax checked but otherwise ignored by GNAT.  This is a listing control
7519 pragma used in DEC Ada 83 implementations to provide a title and/or
7520 subtitle for the program listing.  The program listing generated by GNAT
7521 does not have titles or subtitles.
7523 Unlike other pragmas, the full flexibility of named notation is allowed
7524 for this pragma, i.e., the parameters may be given in any order if named
7525 notation is used, and named and positional notation can be mixed
7526 following the normal rules for procedure calls in Ada.
7528 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
7529 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{cc}
7530 @section Pragma Type_Invariant
7533 Syntax:
7535 @example
7536 pragma Type_Invariant
7537   ([Entity =>] type_LOCAL_NAME,
7538    [Check  =>] EXPRESSION);
7539 @end example
7541 The @cite{Type_Invariant} pragma is intended to be an exact
7542 replacement for the language-defined @cite{Type_Invariant}
7543 aspect, and shares its restrictions and semantics. It differs
7544 from the language defined @cite{Invariant} pragma in that it
7545 does not permit a string parameter, and it is
7546 controlled by the assertion identifier @cite{Type_Invariant}
7547 rather than @cite{Invariant}.
7549 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
7550 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{cd}
7551 @section Pragma Type_Invariant_Class
7554 Syntax:
7556 @example
7557 pragma Type_Invariant_Class
7558   ([Entity =>] type_LOCAL_NAME,
7559    [Check  =>] EXPRESSION);
7560 @end example
7562 The @cite{Type_Invariant_Class} pragma is intended to be an exact
7563 replacement for the language-defined @cite{Type_Invariant'Class}
7564 aspect, and shares its restrictions and semantics.
7566 Note: This pragma is called @cite{Type_Invariant_Class} rather than
7567 @cite{Type_Invariant'Class} because the latter would not be strictly
7568 conforming to the allowed syntax for pragmas. The motivation
7569 for providing pragmas equivalent to the aspects is to allow a program
7570 to be written using the pragmas, and then compiled if necessary
7571 using an Ada compiler that does not recognize the pragmas or
7572 aspects, but is prepared to ignore the pragmas. The assertion
7573 policy that controls this pragma is @cite{Type_Invariant'Class},
7574 not @cite{Type_Invariant_Class}.
7576 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
7577 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{ce}
7578 @section Pragma Unchecked_Union
7581 @geindex Unions in C
7583 Syntax:
7585 @example
7586 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
7587 @end example
7589 This pragma is used to specify a representation of a record type that is
7590 equivalent to a C union. It was introduced as a GNAT implementation defined
7591 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
7592 pragma, making it language defined, and GNAT fully implements this extended
7593 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
7594 details, consult the Ada 2012 Reference Manual, section B.3.3.
7596 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
7597 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{cf}
7598 @section Pragma Unevaluated_Use_Of_Old
7601 @geindex Attribute Old
7603 @geindex Attribute Loop_Entry
7605 @geindex Unevaluated_Use_Of_Old
7607 Syntax:
7609 @example
7610 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
7611 @end example
7613 This pragma controls the processing of attributes Old and Loop_Entry.
7614 If either of these attributes is used in a potentially unevaluated
7615 expression  (e.g. the then or else parts of an if expression), then
7616 normally this usage is considered illegal if the prefix of the attribute
7617 is other than an entity name. The language requires this
7618 behavior for Old, and GNAT copies the same rule for Loop_Entry.
7620 The reason for this rule is that otherwise, we can have a situation
7621 where we save the Old value, and this results in an exception, even
7622 though we might not evaluate the attribute. Consider this example:
7624 @example
7625 package UnevalOld is
7626    K : Character;
7627    procedure U (A : String; C : Boolean)  -- ERROR
7628      with Post => (if C then A(1)'Old = K else True);
7629 end;
7630 @end example
7632 If procedure U is called with a string with a lower bound of 2, and
7633 C false, then an exception would be raised trying to evaluate A(1)
7634 on entry even though the value would not be actually used.
7636 Although the rule guarantees against this possibility, it is sometimes
7637 too restrictive. For example if we know that the string has a lower
7638 bound of 1, then we will never raise an exception.
7639 The pragma @cite{Unevaluated_Use_Of_Old} can be
7640 used to modify this behavior. If the argument is @cite{Error} then an
7641 error is given (this is the default RM behavior). If the argument is
7642 @cite{Warn} then the usage is allowed as legal but with a warning
7643 that an exception might be raised. If the argument is @cite{Allow}
7644 then the usage is allowed as legal without generating a warning.
7646 This pragma may appear as a configuration pragma, or in a declarative
7647 part or package specification. In the latter case it applies to
7648 uses up to the end of the corresponding statement sequence or
7649 sequence of package declarations.
7651 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
7652 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{d0}
7653 @section Pragma Unimplemented_Unit
7656 Syntax:
7658 @example
7659 pragma Unimplemented_Unit;
7660 @end example
7662 If this pragma occurs in a unit that is processed by the compiler, GNAT
7663 aborts with the message @code{xxx not implemented}, where
7664 @cite{xxx} is the name of the current compilation unit.  This pragma is
7665 intended to allow the compiler to handle unimplemented library units in
7666 a clean manner.
7668 The abort only happens if code is being generated.  Thus you can use
7669 specs of unimplemented packages in syntax or semantic checking mode.
7671 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
7672 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{d1}
7673 @section Pragma Universal_Aliasing
7676 Syntax:
7678 @example
7679 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
7680 @end example
7682 @cite{type_LOCAL_NAME} must refer to a type declaration in the current
7683 declarative part.  The effect is to inhibit strict type-based aliasing
7684 optimization for the given type.  In other words, the effect is as though
7685 access types designating this type were subject to pragma No_Strict_Aliasing.
7686 For a detailed description of the strict aliasing optimization, and the
7687 situations in which it must be suppressed, see the section on
7688 @cite{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
7690 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
7691 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{d2}
7692 @section Pragma Universal_Data
7695 Syntax:
7697 @example
7698 pragma Universal_Data [(library_unit_Name)];
7699 @end example
7701 This pragma is supported only for the AAMP target and is ignored for
7702 other targets. The pragma specifies that all library-level objects
7703 (Counter 0 data) associated with the library unit are to be accessed
7704 and updated using universal addressing (24-bit addresses for AAMP5)
7705 rather than the default of 16-bit Data Environment (DENV) addressing.
7706 Use of this pragma will generally result in less efficient code for
7707 references to global data associated with the library unit, but
7708 allows such data to be located anywhere in memory. This pragma is
7709 a library unit pragma, but can also be used as a configuration pragma
7710 (including use in the @code{gnat.adc} file). The functionality
7711 of this pragma is also available by applying the -univ switch on the
7712 compilations of units where universal addressing of the data is desired.
7714 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
7715 @anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{d3}
7716 @section Pragma Unmodified
7719 @geindex Warnings
7720 @geindex unmodified
7722 Syntax:
7724 @example
7725 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
7726 @end example
7728 This pragma signals that the assignable entities (variables,
7729 @cite{out} parameters, @cite{in out} parameters) whose names are listed are
7730 deliberately not assigned in the current source unit. This
7731 suppresses warnings about the
7732 entities being referenced but not assigned, and in addition a warning will be
7733 generated if one of these entities is in fact assigned in the
7734 same unit as the pragma (or in the corresponding body, or one
7735 of its subunits).
7737 This is particularly useful for clearly signaling that a particular
7738 parameter is not modified, even though the spec suggests that it might
7741 For the variable case, warnings are never given for unreferenced variables
7742 whose name contains one of the substrings
7743 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
7744 are typically to be used in cases where such warnings are expected.
7745 Thus it is never necessary to use @cite{pragma Unmodified} for such
7746 variables, though it is harmless to do so.
7748 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
7749 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{d4}
7750 @section Pragma Unreferenced
7753 @geindex Warnings
7754 @geindex unreferenced
7756 Syntax:
7758 @example
7759 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
7760 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
7761 @end example
7763 This pragma signals that the entities whose names are listed are
7764 deliberately not referenced in the current source unit after the
7765 occurrence of the pragma. This
7766 suppresses warnings about the
7767 entities being unreferenced, and in addition a warning will be
7768 generated if one of these entities is in fact subsequently referenced in the
7769 same unit as the pragma (or in the corresponding body, or one
7770 of its subunits).
7772 This is particularly useful for clearly signaling that a particular
7773 parameter is not referenced in some particular subprogram implementation
7774 and that this is deliberate. It can also be useful in the case of
7775 objects declared only for their initialization or finalization side
7776 effects.
7778 If @cite{LOCAL_NAME} identifies more than one matching homonym in the
7779 current scope, then the entity most recently declared is the one to which
7780 the pragma applies. Note that in the case of accept formals, the pragma
7781 Unreferenced may appear immediately after the keyword @cite{do} which
7782 allows the indication of whether or not accept formals are referenced
7783 or not to be given individually for each accept statement.
7785 The left hand side of an assignment does not count as a reference for the
7786 purpose of this pragma. Thus it is fine to assign to an entity for which
7787 pragma Unreferenced is given.
7789 Note that if a warning is desired for all calls to a given subprogram,
7790 regardless of whether they occur in the same unit as the subprogram
7791 declaration, then this pragma should not be used (calls from another
7792 unit would not be flagged); pragma Obsolescent can be used instead
7793 for this purpose, see @ref{8b,,Pragma Obsolescent}.
7795 The second form of pragma @cite{Unreferenced} is used within a context
7796 clause. In this case the arguments must be unit names of units previously
7797 mentioned in @cite{with} clauses (similar to the usage of pragma
7798 @cite{Elaborate_All}. The effect is to suppress warnings about unreferenced
7799 units and unreferenced entities within these units.
7801 For the variable case, warnings are never given for unreferenced variables
7802 whose name contains one of the substrings
7803 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
7804 are typically to be used in cases where such warnings are expected.
7805 Thus it is never necessary to use @cite{pragma Unreferenced} for such
7806 variables, though it is harmless to do so.
7808 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
7809 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{d5}
7810 @section Pragma Unreferenced_Objects
7813 @geindex Warnings
7814 @geindex unreferenced
7816 Syntax:
7818 @example
7819 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
7820 @end example
7822 This pragma signals that for the types or subtypes whose names are
7823 listed, objects which are declared with one of these types or subtypes may
7824 not be referenced, and if no references appear, no warnings are given.
7826 This is particularly useful for objects which are declared solely for their
7827 initialization and finalization effect. Such variables are sometimes referred
7828 to as RAII variables (Resource Acquisition Is Initialization). Using this
7829 pragma on the relevant type (most typically a limited controlled type), the
7830 compiler will automatically suppress unwanted warnings about these variables
7831 not being referenced.
7833 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
7834 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{d6}
7835 @section Pragma Unreserve_All_Interrupts
7838 Syntax:
7840 @example
7841 pragma Unreserve_All_Interrupts;
7842 @end example
7844 Normally certain interrupts are reserved to the implementation.  Any attempt
7845 to attach an interrupt causes Program_Error to be raised, as described in
7846 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
7847 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
7848 reserved to the implementation, so that @code{Ctrl-C} can be used to
7849 interrupt execution.
7851 If the pragma @cite{Unreserve_All_Interrupts} appears anywhere in any unit in
7852 a program, then all such interrupts are unreserved.  This allows the
7853 program to handle these interrupts, but disables their standard
7854 functions.  For example, if this pragma is used, then pressing
7855 @code{Ctrl-C} will not automatically interrupt execution.  However,
7856 a program can then handle the @cite{SIGINT} interrupt as it chooses.
7858 For a full list of the interrupts handled in a specific implementation,
7859 see the source code for the spec of @cite{Ada.Interrupts.Names} in
7860 file @code{a-intnam.ads}.  This is a target dependent file that contains the
7861 list of interrupts recognized for a given target.  The documentation in
7862 this file also specifies what interrupts are affected by the use of
7863 the @cite{Unreserve_All_Interrupts} pragma.
7865 For a more general facility for controlling what interrupts can be
7866 handled, see pragma @cite{Interrupt_State}, which subsumes the functionality
7867 of the @cite{Unreserve_All_Interrupts} pragma.
7869 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
7870 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{d7}
7871 @section Pragma Unsuppress
7874 Syntax:
7876 @example
7877 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
7878 @end example
7880 This pragma undoes the effect of a previous pragma @cite{Suppress}.  If
7881 there is no corresponding pragma @cite{Suppress} in effect, it has no
7882 effect.  The range of the effect is the same as for pragma
7883 @cite{Suppress}.  The meaning of the arguments is identical to that used
7884 in pragma @cite{Suppress}.
7886 One important application is to ensure that checks are on in cases where
7887 code depends on the checks for its correct functioning, so that the code
7888 will compile correctly even if the compiler switches are set to suppress
7889 checks. For example, in a program that depends on external names of tagged
7890 types and wants to ensure that the duplicated tag check occurs even if all
7891 run-time checks are suppressed by a compiler switch, the following
7892 configuration pragma will ensure this test is not suppressed:
7894 @example
7895 pragma Unsuppress (Duplicated_Tag_Check);
7896 @end example
7898 This pragma is standard in Ada 2005. It is available in all earlier versions
7899 of Ada as an implementation-defined pragma.
7901 Note that in addition to the checks defined in the Ada RM, GNAT recogizes
7902 a number of implementation-defined check names. See description of pragma
7903 @cite{Suppress} for full details.
7905 @node Pragma Use_VADS_Size,Pragma Validity_Checks,Pragma Unsuppress,Implementation Defined Pragmas
7906 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{d8}
7907 @section Pragma Use_VADS_Size
7910 @geindex Size
7911 @geindex VADS compatibility
7913 @geindex Rational profile
7915 Syntax:
7917 @example
7918 pragma Use_VADS_Size;
7919 @end example
7921 This is a configuration pragma.  In a unit to which it applies, any use
7922 of the 'Size attribute is automatically interpreted as a use of the
7923 'VADS_Size attribute.  Note that this may result in incorrect semantic
7924 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
7925 the handling of existing code which depends on the interpretation of Size
7926 as implemented in the VADS compiler.  See description of the VADS_Size
7927 attribute for further details.
7929 @node Pragma Validity_Checks,Pragma Volatile,Pragma Use_VADS_Size,Implementation Defined Pragmas
7930 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{d9}
7931 @section Pragma Validity_Checks
7934 Syntax:
7936 @example
7937 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
7938 @end example
7940 This pragma is used in conjunction with compiler switches to control the
7941 built-in validity checking provided by GNAT.  The compiler switches, if set
7942 provide an initial setting for the switches, and this pragma may be used
7943 to modify these settings, or the settings may be provided entirely by
7944 the use of the pragma.  This pragma can be used anywhere that a pragma
7945 is legal, including use as a configuration pragma (including use in
7946 the @code{gnat.adc} file).
7948 The form with a string literal specifies which validity options are to be
7949 activated.  The validity checks are first set to include only the default
7950 reference manual settings, and then a string of letters in the string
7951 specifies the exact set of options required.  The form of this string
7952 is exactly as described for the @emph{-gnatVx} compiler switch (see the
7953 GNAT User's Guide for details).  For example the following two
7954 methods can be used to enable validity checking for mode @cite{in} and
7955 @cite{in out} subprogram parameters:
7958 @itemize *
7960 @item 
7961 @example
7962 pragma Validity_Checks ("im");
7963 @end example
7965 @item 
7966 @example
7967 $ gcc -c -gnatVim ...
7968 @end example
7969 @end itemize
7971 The form ALL_CHECKS activates all standard checks (its use is equivalent
7972 to the use of the @cite{gnatva} switch.
7974 The forms with @cite{Off} and @cite{On}
7975 can be used to temporarily disable validity checks
7976 as shown in the following example:
7978 @example
7979 pragma Validity_Checks ("c"); -- validity checks for copies
7980 pragma Validity_Checks (Off); -- turn off validity checks
7981 A := B;                       -- B will not be validity checked
7982 pragma Validity_Checks (On);  -- turn validity checks back on
7983 A := C;                       -- C will be validity checked
7984 @end example
7986 @node Pragma Volatile,Pragma Warning_As_Error,Pragma Validity_Checks,Implementation Defined Pragmas
7987 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{da}
7988 @section Pragma Volatile
7991 Syntax:
7993 @example
7994 pragma Volatile (LOCAL_NAME);
7995 @end example
7997 This pragma is defined by the Ada Reference Manual, and the GNAT
7998 implementation is fully conformant with this definition.  The reason it
7999 is mentioned in this section is that a pragma of the same name was supplied
8000 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8001 implementation of pragma Volatile is upwards compatible with the
8002 implementation in DEC Ada 83.
8004 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile,Implementation Defined Pragmas
8005 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{db}
8006 @section Pragma Warning_As_Error
8009 Syntax:
8011 @example
8012 pragma Warning_As_Error (static_string_EXPRESSION);
8013 @end example
8015 This configuration pragma allows the programmer to specify a set
8016 of warnings that will be treated as errors. Any warning which
8017 matches the pattern given by the pragma argument will be treated
8018 as an error. This gives much more precise control that -gnatwe
8019 which treats all warnings as errors.
8021 The pattern may contain asterisks, which match zero or more characters in
8022 the message. For example, you can use
8023 @cite{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8024 message @cite{warning: 960 bits of "a" unused} as an error. No other regular
8025 expression notations are permitted. All characters other than asterisk in
8026 these three specific cases are treated as literal characters in the match.
8027 The match is case insensitive, for example XYZ matches xyz.
8029 Note that the pattern matches if it occurs anywhere within the warning
8030 message string (it is not necessary to put an asterisk at the start and
8031 the end of the message, since this is implied).
8033 Another possibility for the static_string_EXPRESSION which works whether
8034 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8035 @emph{-gnatw} tag string, enclosed in brackets,
8036 as shown in the example below, to treat a class of warnings as errors.
8038 The above use of patterns to match the message applies only to warning
8039 messages generated by the front end. This pragma can also be applied to
8040 warnings provided by the back end and mentioned in @ref{dc,,Pragma Warnings}.
8041 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8042 can also be treated as errors.
8044 The pragma can appear either in a global configuration pragma file
8045 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8046 configuration pragma file containing:
8048 @example
8049 pragma Warning_As_Error ("[-gnatwj]");
8050 @end example
8052 which will treat all obsolescent feature warnings as errors, the
8053 following program compiles as shown (compile options here are
8054 @emph{-gnatwa.d -gnatl -gnatj55}).
8056 @example
8057     1. pragma Warning_As_Error ("*never assigned*");
8058     2. function Warnerr return String is
8059     3.    X : Integer;
8060           |
8061        >>> error: variable "X" is never read and
8062            never assigned [-gnatwv] [warning-as-error]
8064     4.    Y : Integer;
8065           |
8066        >>> warning: variable "Y" is assigned but
8067            never read [-gnatwu]
8069     5. begin
8070     6.    Y := 0;
8071     7.    return %ABC%;
8072                  |
8073        >>> error: use of "%" is an obsolescent
8074            feature (RM J.2(4)), use """ instead
8075            [-gnatwj] [warning-as-error]
8077     8. end;
8079 8 lines: No errors, 3 warnings (2 treated as errors)
8080 @end example
8082 Note that this pragma does not affect the set of warnings issued in
8083 any way, it merely changes the effect of a matching warning if one
8084 is produced as a result of other warnings options. As shown in this
8085 example, if the pragma results in a warning being treated as an error,
8086 the tag is changed from "warning:" to "error:" and the string
8087 "[warning-as-error]" is appended to the end of the message.
8089 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8090 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{dd}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{dc}
8091 @section Pragma Warnings
8094 Syntax:
8096 @example
8097 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8099 DETAILS ::= On | Off
8100 DETAILS ::= On | Off, local_NAME
8101 DETAILS ::= static_string_EXPRESSION
8102 DETAILS ::= On | Off, static_string_EXPRESSION
8104 TOOL_NAME ::= GNAT | GNATProve
8106 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8107 @end example
8109 Note: in Ada 83 mode, a string literal may be used in place of a static string
8110 expression (which does not exist in Ada 83).
8112 Note if the second argument of @cite{DETAILS} is a @cite{local_NAME} then the
8113 second form is always understood. If the intention is to use
8114 the fourth form, then you can write @cite{NAME & ""} to force the
8115 intepretation as a @cite{static_string_EXPRESSION}.
8117 Note: if the first argument is a valid @cite{TOOL_NAME}, it will be interpreted
8118 that way. The use of the @cite{TOOL_NAME} argument is relevant only to users
8119 of SPARK and GNATprove, see last part of this section for details.
8121 Normally warnings are enabled, with the output being controlled by
8122 the command line switch.  Warnings (@cite{Off}) turns off generation of
8123 warnings until a Warnings (@cite{On}) is encountered or the end of the
8124 current unit.  If generation of warnings is turned off using this
8125 pragma, then some or all of the warning messages are suppressed,
8126 regardless of the setting of the command line switches.
8128 The @cite{Reason} parameter may optionally appear as the last argument
8129 in any of the forms of this pragma. It is intended purely for the
8130 purposes of documenting the reason for the @cite{Warnings} pragma.
8131 The compiler will check that the argument is a static string but
8132 otherwise ignore this argument. Other tools may provide specialized
8133 processing for this string.
8135 The form with a single argument (or two arguments if Reason present),
8136 where the first argument is @cite{ON} or @cite{OFF}
8137 may be used as a configuration pragma.
8139 If the @cite{LOCAL_NAME} parameter is present, warnings are suppressed for
8140 the specified entity.  This suppression is effective from the point where
8141 it occurs till the end of the extended scope of the variable (similar to
8142 the scope of @cite{Suppress}). This form cannot be used as a configuration
8143 pragma.
8145 In the case where the first argument is other than @cite{ON} or
8146 @cite{OFF},
8147 the third form with a single static_string_EXPRESSION argument (and possible
8148 reason) provides more precise
8149 control over which warnings are active. The string is a list of letters
8150 specifying which warnings are to be activated and which deactivated. The
8151 code for these letters is the same as the string used in the command
8152 line switch controlling warnings. For a brief summary, use the gnatmake
8153 command with no arguments, which will generate usage information containing
8154 the list of warnings switches supported. For
8155 full details see the section on @cite{Warning Message Control} in the
8156 @cite{GNAT User's Guide}.
8157 This form can also be used as a configuration pragma.
8159 The warnings controlled by the @emph{-gnatw} switch are generated by the
8160 front end of the compiler. The GCC back end can provide additional warnings
8161 and they are controlled by the @emph{-W} switch. Such warnings can be
8162 identified by the appearance of a string of the form @cite{[-Wxxx]} in the
8163 message which designates the @emph{-Wxxx} switch that controls the message.
8164 The form with a single static_string_EXPRESSION argument also works for these
8165 warnings, but the string must be a single full @emph{-Wxxx} switch in this
8166 case. The above reference lists a few examples of these additional warnings.
8168 The specified warnings will be in effect until the end of the program
8169 or another pragma Warnings is encountered. The effect of the pragma is
8170 cumulative. Initially the set of warnings is the standard default set
8171 as possibly modified by compiler switches. Then each pragma Warning
8172 modifies this set of warnings as specified. This form of the pragma may
8173 also be used as a configuration pragma.
8175 The fourth form, with an @cite{On|Off} parameter and a string, is used to
8176 control individual messages, based on their text. The string argument
8177 is a pattern that is used to match against the text of individual
8178 warning messages (not including the initial "warning: " tag).
8180 The pattern may contain asterisks, which match zero or more characters in
8181 the message. For example, you can use
8182 @cite{pragma Warnings (Off@comma{} "bits of*unused")} to suppress the warning
8183 message @cite{warning: 960 bits of "a" unused}. No other regular
8184 expression notations are permitted. All characters other than asterisk in
8185 these three specific cases are treated as literal characters in the match.
8186 The match is case insensitive, for example XYZ matches xyz.
8188 Note that the pattern matches if it occurs anywhere within the warning
8189 message string (it is not necessary to put an asterisk at the start and
8190 the end of the message, since this is implied).
8192 The above use of patterns to match the message applies only to warning
8193 messages generated by the front end. This form of the pragma with a string
8194 argument can also be used to control warnings provided by the back end and
8195 mentioned above. By using a single full @emph{-Wxxx} switch in the pragma,
8196 such warnings can be turned on and off.
8198 There are two ways to use the pragma in this form. The OFF form can be used
8199 as a configuration pragma. The effect is to suppress all warnings (if any)
8200 that match the pattern string throughout the compilation (or match the
8201 -W switch in the back end case).
8203 The second usage is to suppress a warning locally, and in this case, two
8204 pragmas must appear in sequence:
8206 @example
8207 pragma Warnings (Off, Pattern);
8208 ... code where given warning is to be suppressed
8209 pragma Warnings (On, Pattern);
8210 @end example
8212 In this usage, the pattern string must match in the Off and On
8213 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
8214 warning must be suppressed.
8216 Note: to write a string that will match any warning, use the string
8217 @cite{"***"}. It will not work to use a single asterisk or two
8218 asterisks since this looks like an operator name. This form with three
8219 asterisks is similar in effect to specifying @cite{pragma Warnings (Off)} except (if @emph{-gnatw.w} is given) that a matching
8220 @cite{pragma Warnings (On@comma{} "***")} will be required. This can be
8221 helpful in avoiding forgetting to turn warnings back on.
8223 Note: the debug flag -gnatd.i (@cite{/NOWARNINGS_PRAGMAS} in VMS) can be
8224 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
8225 be useful in checking whether obsolete pragmas in existing programs are hiding
8226 real problems.
8228 Note: pragma Warnings does not affect the processing of style messages. See
8229 separate entry for pragma Style_Checks for control of style messages.
8231 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
8232 use the version of the pragma with a @cite{TOOL_NAME} parameter.
8234 If present, @cite{TOOL_NAME} is the name of a tool, currently either @cite{GNAT} for the
8235 compiler or @cite{GNATprove} for the formal verification tool. A given tool only
8236 takes into account pragma Warnings that do not specify a tool name, or that
8237 specify the matching tool name. This makes it possible to disable warnings
8238 selectively for each tool, and as a consequence to detect useless pragma
8239 Warnings with switch @cite{-gnatw.w}.
8241 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
8242 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{de}
8243 @section Pragma Weak_External
8246 Syntax:
8248 @example
8249 pragma Weak_External ([Entity =>] LOCAL_NAME);
8250 @end example
8252 @cite{LOCAL_NAME} must refer to an object that is declared at the library
8253 level. This pragma specifies that the given entity should be marked as a
8254 weak symbol for the linker. It is equivalent to @cite{__attribute__((weak))}
8255 in GNU C and causes @cite{LOCAL_NAME} to be emitted as a weak symbol instead
8256 of a regular symbol, that is to say a symbol that does not have to be
8257 resolved by the linker if used in conjunction with a pragma Import.
8259 When a weak symbol is not resolved by the linker, its address is set to
8260 zero. This is useful in writing interfaces to external modules that may
8261 or may not be linked in the final executable, for example depending on
8262 configuration settings.
8264 If a program references at run time an entity to which this pragma has been
8265 applied, and the corresponding symbol was not resolved at link time, then
8266 the execution of the program is erroneous. It is not erroneous to take the
8267 Address of such an entity, for example to guard potential references,
8268 as shown in the example below.
8270 Some file formats do not support weak symbols so not all target machines
8271 support this pragma.
8273 @example
8274 --  Example of the use of pragma Weak_External
8276 package External_Module is
8277   key : Integer;
8278   pragma Import (C, key);
8279   pragma Weak_External (key);
8280   function Present return boolean;
8281 end External_Module;
8283 with System; use System;
8284 package body External_Module is
8285   function Present return boolean is
8286   begin
8287     return key'Address /= System.Null_Address;
8288   end Present;
8289 end External_Module;
8290 @end example
8292 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
8293 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{df}
8294 @section Pragma Wide_Character_Encoding
8297 Syntax:
8299 @example
8300 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
8301 @end example
8303 This pragma specifies the wide character encoding to be used in program
8304 source text appearing subsequently. It is a configuration pragma, but may
8305 also be used at any point that a pragma is allowed, and it is permissible
8306 to have more than one such pragma in a file, allowing multiple encodings
8307 to appear within the same file.
8309 The argument can be an identifier or a character literal. In the identifier
8310 case, it is one of @cite{HEX}, @cite{UPPER}, @cite{SHIFT_JIS},
8311 @cite{EUC}, @cite{UTF8}, or @cite{BRACKETS}. In the character literal
8312 case it is correspondingly one of the characters @code{h}, @code{u},
8313 @code{s}, @code{e}, @code{8}, or @code{b}.
8315 Note that when the pragma is used within a file, it affects only the
8316 encoding within that file, and does not affect withed units, specs,
8317 or subunits.
8319 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
8320 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{e0}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{e1}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{e2}
8321 @chapter Implementation Defined Aspects
8324 Ada defines (throughout the Ada 2012 reference manual, summarized
8325 in Annex K) a set of aspects that can be specified for certain entities.
8326 These language defined aspects are implemented in GNAT in Ada 2012 mode
8327 and work as described in the Ada 2012 Reference Manual.
8329 In addition, Ada 2012 allows implementations to define additional aspects
8330 whose meaning is defined by the implementation.  GNAT provides
8331 a number of these implementation-defined aspects which can be used
8332 to extend and enhance the functionality of the compiler.  This section of
8333 the GNAT reference manual describes these additional aspects.
8335 Note that any program using these aspects may not be portable to
8336 other compilers (although GNAT implements this set of aspects on all
8337 platforms).  Therefore if portability to other compilers is an important
8338 consideration, you should minimize the use of these aspects.
8340 Note that for many of these aspects, the effect is essentially similar
8341 to the use of a pragma or attribute specification with the same name
8342 applied to the entity. For example, if we write:
8344 @example
8345 type R is range 1 .. 100
8346   with Value_Size => 10;
8347 @end example
8349 then the effect is the same as:
8351 @example
8352 type R is range 1 .. 100;
8353 for R'Value_Size use 10;
8354 @end example
8356 and if we write:
8358 @example
8359 type R is new Integer
8360   with Shared => True;
8361 @end example
8363 then the effect is the same as:
8365 @example
8366 type R is new Integer;
8367 pragma Shared (R);
8368 @end example
8370 In the documentation below, such cases are simply marked
8371 as being boolean aspects equivalent to the corresponding pragma
8372 or attribute definition clause.
8374 @menu
8375 * Aspect Abstract_State:: 
8376 * Annotate:: 
8377 * Aspect Async_Readers:: 
8378 * Aspect Async_Writers:: 
8379 * Aspect Contract_Cases:: 
8380 * Aspect Depends:: 
8381 * Aspect Dimension:: 
8382 * Aspect Dimension_System:: 
8383 * Aspect Effective_Reads:: 
8384 * Aspect Effective_Writes:: 
8385 * Aspect Favor_Top_Level:: 
8386 * Aspect Global:: 
8387 * Aspect Initial_Condition:: 
8388 * Aspect Initializes:: 
8389 * Aspect Inline_Always:: 
8390 * Aspect Invariant:: 
8391 * Aspect Invariant'Class:: 
8392 * Aspect Iterable:: 
8393 * Aspect Linker_Section:: 
8394 * Aspect Lock_Free:: 
8395 * Aspect No_Elaboration_Code_All:: 
8396 * Aspect No_Tagged_Streams:: 
8397 * Aspect Object_Size:: 
8398 * Aspect Obsolescent:: 
8399 * Aspect Part_Of:: 
8400 * Aspect Persistent_BSS:: 
8401 * Aspect Predicate:: 
8402 * Aspect Pure_Function:: 
8403 * Aspect Refined_Depends:: 
8404 * Aspect Refined_Global:: 
8405 * Aspect Refined_Post:: 
8406 * Aspect Refined_State:: 
8407 * Aspect Remote_Access_Type:: 
8408 * Aspect Scalar_Storage_Order:: 
8409 * Aspect Shared:: 
8410 * Aspect Simple_Storage_Pool:: 
8411 * Aspect Simple_Storage_Pool_Type:: 
8412 * Aspect SPARK_Mode:: 
8413 * Aspect Suppress_Debug_Info:: 
8414 * Aspect Suppress_Initialization:: 
8415 * Aspect Test_Case:: 
8416 * Aspect Thread_Local_Storage:: 
8417 * Aspect Universal_Aliasing:: 
8418 * Aspect Universal_Data:: 
8419 * Aspect Unmodified:: 
8420 * Aspect Unreferenced:: 
8421 * Aspect Unreferenced_Objects:: 
8422 * Aspect Value_Size:: 
8423 * Aspect Warnings:: 
8425 @end menu
8427 @node Aspect Abstract_State,Annotate,,Implementation Defined Aspects
8428 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{e3}
8429 @section Aspect Abstract_State
8432 @geindex Abstract_State
8434 This aspect is equivalent to pragma @cite{Abstract_State}.
8436 @node Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
8437 @anchor{gnat_rm/implementation_defined_aspects annotate}@anchor{e4}
8438 @section Annotate
8441 @geindex Annotate
8443 There are three forms of this aspect (where ID is an identifier,
8444 and ARG is a general expression).
8447 @table @asis
8449 @item @emph{Annotate => ID}
8451 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8453 @item @emph{Annotate => (ID)}
8455 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8457 @item @emph{Annotate => (ID ,ID @{, ARG@})}
8459 Equivalent to @cite{pragma Annotate (ID@comma{} ID @{@comma{} ARG@}@comma{} Entity => Name);}
8460 @end table
8462 @node Aspect Async_Readers,Aspect Async_Writers,Annotate,Implementation Defined Aspects
8463 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{e5}
8464 @section Aspect Async_Readers
8467 @geindex Async_Readers
8469 This boolean aspect is equivalent to pragma @cite{Async_Readers}.
8471 @node Aspect Async_Writers,Aspect Contract_Cases,Aspect Async_Readers,Implementation Defined Aspects
8472 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{e6}
8473 @section Aspect Async_Writers
8476 @geindex Async_Writers
8478 This boolean aspect is equivalent to pragma @cite{Async_Writers}.
8480 @node Aspect Contract_Cases,Aspect Depends,Aspect Async_Writers,Implementation Defined Aspects
8481 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{e7}
8482 @section Aspect Contract_Cases
8485 @geindex Contract_Cases
8487 This aspect is equivalent to pragma @cite{Contract_Cases}, the sequence
8488 of clauses being enclosed in parentheses so that syntactically it is an
8489 aggregate.
8491 @node Aspect Depends,Aspect Dimension,Aspect Contract_Cases,Implementation Defined Aspects
8492 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{e8}
8493 @section Aspect Depends
8496 @geindex Depends
8498 This aspect is equivalent to pragma @cite{Depends}.
8500 @node Aspect Dimension,Aspect Dimension_System,Aspect Depends,Implementation Defined Aspects
8501 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{e9}
8502 @section Aspect Dimension
8505 @geindex Dimension
8507 The @cite{Dimension} aspect is used to specify the dimensions of a given
8508 subtype of a dimensioned numeric type. The aspect also specifies a symbol
8509 used when doing formatted output of dimensioned quantities. The syntax is:
8511 @example
8512 with Dimension =>
8513   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
8515 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
8517 DIMENSION_VALUE ::=
8518   RATIONAL
8519 | others               => RATIONAL
8520 | DISCRETE_CHOICE_LIST => RATIONAL
8522 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
8523 @end example
8525 This aspect can only be applied to a subtype whose parent type has
8526 a @cite{Dimension_Systen} aspect. The aspect must specify values for
8527 all dimensions of the system. The rational values are the powers of the
8528 corresponding dimensions that are used by the compiler to verify that
8529 physical (numeric) computations are dimensionally consistent. For example,
8530 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
8531 For further examples of the usage
8532 of this aspect, see package @cite{System.Dim.Mks}.
8533 Note that when the dimensioned type is an integer type, then any
8534 dimension value must be an integer literal.
8536 @node Aspect Dimension_System,Aspect Effective_Reads,Aspect Dimension,Implementation Defined Aspects
8537 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{ea}
8538 @section Aspect Dimension_System
8541 @geindex Dimension_System
8543 The @cite{Dimension_System} aspect is used to define a system of
8544 dimensions that will be used in subsequent subtype declarations with
8545 @cite{Dimension} aspects that reference this system. The syntax is:
8547 @example
8548 with Dimension_System => (DIMENSION @{, DIMENSION@});
8550 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
8551                [Unit_Symbol =>] SYMBOL,
8552                [Dim_Symbol  =>] SYMBOL)
8554 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
8555 @end example
8557 This aspect is applied to a type, which must be a numeric derived type
8558 (typically a floating-point type), that
8559 will represent values within the dimension system. Each @cite{DIMENSION}
8560 corresponds to one particular dimension. A maximum of 7 dimensions may
8561 be specified. @cite{Unit_Name} is the name of the dimension (for example
8562 @cite{Meter}). @cite{Unit_Symbol} is the shorthand used for quantities
8563 of this dimension (for example @cite{m} for @cite{Meter}).
8564 @cite{Dim_Symbol} gives
8565 the identification within the dimension system (typically this is a
8566 single letter, e.g. @cite{L} standing for length for unit name @cite{Meter}).
8567 The @cite{Unit_Symbol} is used in formatted output of dimensioned quantities.
8568 The @cite{Dim_Symbol} is used in error messages when numeric operations have
8569 inconsistent dimensions.
8571 GNAT provides the standard definition of the International MKS system in
8572 the run-time package @cite{System.Dim.Mks}. You can easily define
8573 similar packages for cgs units or British units, and define conversion factors
8574 between values in different systems. The MKS system is characterized by the
8575 following aspect:
8577 @example
8578 type Mks_Type is new Long_Long_Float with
8579   Dimension_System => (
8580     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
8581     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
8582     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
8583     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
8584     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
8585     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
8586     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
8587 @end example
8589 Note that in the above type definition, we use the @cite{at} symbol (@code{@@}) to
8590 represent a theta character (avoiding the use of extended Latin-1
8591 characters in this context).
8593 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
8594 Guide for detailed examples of use of the dimension system.
8596 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Dimension_System,Implementation Defined Aspects
8597 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{eb}
8598 @section Aspect Effective_Reads
8601 @geindex Effective_Reads
8603 This aspect is equivalent to pragma @cite{Effective_Reads}.
8605 @node Aspect Effective_Writes,Aspect Favor_Top_Level,Aspect Effective_Reads,Implementation Defined Aspects
8606 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{ec}
8607 @section Aspect Effective_Writes
8610 @geindex Effective_Writes
8612 This aspect is equivalent to pragma @cite{Effective_Writes}.
8614 @node Aspect Favor_Top_Level,Aspect Global,Aspect Effective_Writes,Implementation Defined Aspects
8615 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{ed}
8616 @section Aspect Favor_Top_Level
8619 @geindex Favor_Top_Level
8621 This boolean aspect is equivalent to pragma @cite{Favor_Top_Level}.
8623 @node Aspect Global,Aspect Initial_Condition,Aspect Favor_Top_Level,Implementation Defined Aspects
8624 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{ee}
8625 @section Aspect Global
8628 @geindex Global
8630 This aspect is equivalent to pragma @cite{Global}.
8632 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
8633 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{ef}
8634 @section Aspect Initial_Condition
8637 @geindex Initial_Condition
8639 This aspect is equivalent to pragma @cite{Initial_Condition}.
8641 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
8642 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{f0}
8643 @section Aspect Initializes
8646 @geindex Initializes
8648 This aspect is equivalent to pragma @cite{Initializes}.
8650 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
8651 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{f1}
8652 @section Aspect Inline_Always
8655 @geindex Inline_Always
8657 This boolean aspect is equivalent to pragma @cite{Inline_Always}.
8659 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
8660 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{f2}
8661 @section Aspect Invariant
8664 @geindex Invariant
8666 This aspect is equivalent to pragma @cite{Invariant}. It is a
8667 synonym for the language defined aspect @cite{Type_Invariant} except
8668 that it is separately controllable using pragma @cite{Assertion_Policy}.
8670 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
8671 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{f3}
8672 @section Aspect Invariant'Class
8675 @geindex Invariant'Class
8677 This aspect is equivalent to pragma @cite{Type_Invariant_Class}. It is a
8678 synonym for the language defined aspect @cite{Type_Invariant'Class} except
8679 that it is separately controllable using pragma @cite{Assertion_Policy}.
8681 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
8682 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{f4}
8683 @section Aspect Iterable
8686 @geindex Iterable
8688 This aspect provides a light-weight mechanism for loops and quantified
8689 expressions over container types, without the overhead imposed by the tampering
8690 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
8691 with four named components: @cite{First}, @cite{Next}, @cite{Has_Element}, and @cite{Element} (the
8692 last one being optional). When only 3 components are specified, only the
8693 @cite{for .. in} form of iteration over cursors is available. When all 4 components
8694 are specified, both this form and the @cite{for .. of} form of iteration over
8695 elements are available. The following is a typical example of use:
8697 @example
8698 type List is private with
8699     Iterable => (First        => First_Cursor,
8700                  Next         => Advance,
8701                  Has_Element  => Cursor_Has_Element,
8702                 [Element      => Get_Element]);
8703 @end example
8706 @itemize *
8708 @item 
8709 The value denoted by @cite{First} must denote a primitive operation of the
8710 container type that returns a @cite{Cursor}, which must a be a type declared in
8711 the container package or visible from it. For example:
8712 @end itemize
8714 @example
8715 function First_Cursor (Cont : Container) return Cursor;
8716 @end example
8719 @itemize *
8721 @item 
8722 The value of @cite{Next} is a primitive operation of the container type that takes
8723 both a container and a cursor and yields a cursor. For example:
8724 @end itemize
8726 @example
8727 function Advance (Cont : Container; Position : Cursor) return Cursor;
8728 @end example
8731 @itemize *
8733 @item 
8734 The value of @cite{Has_Element} is a primitive operation of the container type
8735 that takes both a container and a cursor and yields a boolean. For example:
8736 @end itemize
8738 @example
8739 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
8740 @end example
8743 @itemize *
8745 @item 
8746 The value of @cite{Element} is a primitive operation of the container type that
8747 takes both a container and a cursor and yields an @cite{Element_Type}, which must
8748 be a type declared in the container package or visible from it. For example:
8749 @end itemize
8751 @example
8752 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
8753 @end example
8755 This aspect is used in the GNAT-defined formal container packages.
8757 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
8758 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{f5}
8759 @section Aspect Linker_Section
8762 @geindex Linker_Section
8764 This aspect is equivalent to an @cite{Linker_Section} pragma.
8766 @node Aspect Lock_Free,Aspect No_Elaboration_Code_All,Aspect Linker_Section,Implementation Defined Aspects
8767 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{f6}
8768 @section Aspect Lock_Free
8771 @geindex Lock_Free
8773 This boolean aspect is equivalent to pragma @cite{Lock_Free}.
8775 @node Aspect No_Elaboration_Code_All,Aspect No_Tagged_Streams,Aspect Lock_Free,Implementation Defined Aspects
8776 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{f7}
8777 @section Aspect No_Elaboration_Code_All
8780 @geindex No_Elaboration_Code_All
8782 This aspect is equivalent to a @cite{pragma No_Elaboration_Code_All}
8783 statement for a program unit.
8785 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
8786 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{f8}
8787 @section Aspect No_Tagged_Streams
8790 @geindex No_Tagged_Streams
8792 This aspect is equivalent to a @cite{pragma No_Tagged_Streams} with an
8793 argument specifying a root tagged type (thus this aspect can only be
8794 applied to such a type).
8796 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
8797 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{f9}
8798 @section Aspect Object_Size
8801 @geindex Object_Size
8803 This aspect is equivalent to an @cite{Object_Size} attribute definition
8804 clause.
8806 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
8807 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{fa}
8808 @section Aspect Obsolescent
8811 @geindex Obsolsecent
8813 This aspect is equivalent to an @cite{Obsolescent} pragma. Note that the
8814 evaluation of this aspect happens at the point of occurrence, it is not
8815 delayed until the freeze point.
8817 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
8818 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{fb}
8819 @section Aspect Part_Of
8822 @geindex Part_Of
8824 This aspect is equivalent to pragma @cite{Part_Of}.
8826 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
8827 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{fc}
8828 @section Aspect Persistent_BSS
8831 @geindex Persistent_BSS
8833 This boolean aspect is equivalent to pragma @cite{Persistent_BSS}.
8835 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
8836 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{fd}
8837 @section Aspect Predicate
8840 @geindex Predicate
8842 This aspect is equivalent to pragma @cite{Predicate}. It is thus
8843 similar to the language defined aspects @cite{Dynamic_Predicate}
8844 and @cite{Static_Predicate} except that whether the resulting
8845 predicate is static or dynamic is controlled by the form of the
8846 expression. It is also separately controllable using pragma
8847 @cite{Assertion_Policy}.
8849 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
8850 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{fe}
8851 @section Aspect Pure_Function
8854 @geindex Pure_Function
8856 This boolean aspect is equivalent to pragma @cite{Pure_Function}.
8858 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
8859 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{ff}
8860 @section Aspect Refined_Depends
8863 @geindex Refined_Depends
8865 This aspect is equivalent to pragma @cite{Refined_Depends}.
8867 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
8868 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{100}
8869 @section Aspect Refined_Global
8872 @geindex Refined_Global
8874 This aspect is equivalent to pragma @cite{Refined_Global}.
8876 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
8877 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{101}
8878 @section Aspect Refined_Post
8881 @geindex Refined_Post
8883 This aspect is equivalent to pragma @cite{Refined_Post}.
8885 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
8886 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{102}
8887 @section Aspect Refined_State
8890 @geindex Refined_State
8892 This aspect is equivalent to pragma @cite{Refined_State}.
8894 @node Aspect Remote_Access_Type,Aspect Scalar_Storage_Order,Aspect Refined_State,Implementation Defined Aspects
8895 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{103}
8896 @section Aspect Remote_Access_Type
8899 @geindex Remote_Access_Type
8901 This aspect is equivalent to pragma @cite{Remote_Access_Type}.
8903 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Remote_Access_Type,Implementation Defined Aspects
8904 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{104}
8905 @section Aspect Scalar_Storage_Order
8908 @geindex Scalar_Storage_Order
8910 This aspect is equivalent to a @cite{Scalar_Storage_Order}
8911 attribute definition clause.
8913 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
8914 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{105}
8915 @section Aspect Shared
8918 @geindex Shared
8920 This boolean aspect is equivalent to pragma @cite{Shared},
8921 and is thus a synonym for aspect @cite{Atomic}.
8923 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
8924 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{106}
8925 @section Aspect Simple_Storage_Pool
8928 @geindex Simple_Storage_Pool
8930 This aspect is equivalent to a @cite{Simple_Storage_Pool}
8931 attribute definition clause.
8933 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
8934 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{107}
8935 @section Aspect Simple_Storage_Pool_Type
8938 @geindex Simple_Storage_Pool_Type
8940 This boolean aspect is equivalent to pragma @cite{Simple_Storage_Pool_Type}.
8942 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
8943 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{108}
8944 @section Aspect SPARK_Mode
8947 @geindex SPARK_Mode
8949 This aspect is equivalent to pragma @cite{SPARK_Mode} and
8950 may be specified for either or both of the specification and body
8951 of a subprogram or package.
8953 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
8954 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{109}
8955 @section Aspect Suppress_Debug_Info
8958 @geindex Suppress_Debug_Info
8960 This boolean aspect is equivalent to pragma @cite{Suppress_Debug_Info}.
8962 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
8963 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{10a}
8964 @section Aspect Suppress_Initialization
8967 @geindex Suppress_Initialization
8969 This boolean aspect is equivalent to pragma @cite{Suppress_Initialization}.
8971 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
8972 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{10b}
8973 @section Aspect Test_Case
8976 @geindex Test_Case
8978 This aspect is equivalent to pragma @cite{Test_Case}.
8980 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
8981 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{10c}
8982 @section Aspect Thread_Local_Storage
8985 @geindex Thread_Local_Storage
8987 This boolean aspect is equivalent to pragma @cite{Thread_Local_Storage}.
8989 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
8990 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{10d}
8991 @section Aspect Universal_Aliasing
8994 @geindex Universal_Aliasing
8996 This boolean aspect is equivalent to pragma @cite{Universal_Aliasing}.
8998 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
8999 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{10e}
9000 @section Aspect Universal_Data
9003 @geindex Universal_Data
9005 This aspect is equivalent to pragma @cite{Universal_Data}.
9007 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
9008 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{10f}
9009 @section Aspect Unmodified
9012 @geindex Unmodified
9014 This boolean aspect is equivalent to pragma @cite{Unmodified}.
9016 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9017 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{110}
9018 @section Aspect Unreferenced
9021 @geindex Unreferenced
9023 This boolean aspect is equivalent to pragma @cite{Unreferenced}. Note that
9024 in the case of formal parameters, it is not permitted to have aspects for
9025 a formal parameter, so in this case the pragma form must be used.
9027 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9028 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{111}
9029 @section Aspect Unreferenced_Objects
9032 @geindex Unreferenced_Objects
9034 This boolean aspect is equivalent to pragma @cite{Unreferenced_Objects}.
9036 @node Aspect Value_Size,Aspect Warnings,Aspect Unreferenced_Objects,Implementation Defined Aspects
9037 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{112}
9038 @section Aspect Value_Size
9041 @geindex Value_Size
9043 This aspect is equivalent to a @cite{Value_Size}
9044 attribute definition clause.
9046 @node Aspect Warnings,,Aspect Value_Size,Implementation Defined Aspects
9047 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{113}
9048 @section Aspect Warnings
9051 @geindex Warnings
9053 This aspect is equivalent to the two argument form of pragma @cite{Warnings},
9054 where the first argument is @cite{ON} or @cite{OFF} and the second argument
9055 is the entity.
9057 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9058 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{114}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{115}
9059 @chapter Implementation Defined Attributes
9062 Ada defines (throughout the Ada reference manual,
9063 summarized in Annex K),
9064 a set of attributes that provide useful additional functionality in all
9065 areas of the language.  These language defined attributes are implemented
9066 in GNAT and work as described in the Ada Reference Manual.
9068 In addition, Ada allows implementations to define additional
9069 attributes whose meaning is defined by the implementation.  GNAT provides
9070 a number of these implementation-dependent attributes which can be used
9071 to extend and enhance the functionality of the compiler.  This section of
9072 the GNAT reference manual describes these additional attributes.  It also
9073 describes additional implementation-dependent features of standard
9074 language-defined attributes.
9076 Note that any program using these attributes may not be portable to
9077 other compilers (although GNAT implements this set of attributes on all
9078 platforms).  Therefore if portability to other compilers is an important
9079 consideration, you should minimize the use of these attributes.
9081 @menu
9082 * Attribute Abort_Signal:: 
9083 * Attribute Address_Size:: 
9084 * Attribute Asm_Input:: 
9085 * Attribute Asm_Output:: 
9086 * Attribute Atomic_Always_Lock_Free:: 
9087 * Attribute Bit:: 
9088 * Attribute Bit_Position:: 
9089 * Attribute Code_Address:: 
9090 * Attribute Compiler_Version:: 
9091 * Attribute Constrained:: 
9092 * Attribute Default_Bit_Order:: 
9093 * Attribute Default_Scalar_Storage_Order:: 
9094 * Attribute Descriptor_Size:: 
9095 * Attribute Elaborated:: 
9096 * Attribute Elab_Body:: 
9097 * Attribute Elab_Spec:: 
9098 * Attribute Elab_Subp_Body:: 
9099 * Attribute Emax:: 
9100 * Attribute Enabled:: 
9101 * Attribute Enum_Rep:: 
9102 * Attribute Enum_Val:: 
9103 * Attribute Epsilon:: 
9104 * Attribute Fast_Math:: 
9105 * Attribute Fixed_Value:: 
9106 * Attribute From_Any:: 
9107 * Attribute Has_Access_Values:: 
9108 * Attribute Has_Discriminants:: 
9109 * Attribute Img:: 
9110 * Attribute Integer_Value:: 
9111 * Attribute Invalid_Value:: 
9112 * Attribute Iterable:: 
9113 * Attribute Large:: 
9114 * Attribute Library_Level:: 
9115 * Attribute Lock_Free:: 
9116 * Attribute Loop_Entry:: 
9117 * Attribute Machine_Size:: 
9118 * Attribute Mantissa:: 
9119 * Attribute Maximum_Alignment:: 
9120 * Attribute Mechanism_Code:: 
9121 * Attribute Null_Parameter:: 
9122 * Attribute Object_Size:: 
9123 * Attribute Old:: 
9124 * Attribute Passed_By_Reference:: 
9125 * Attribute Pool_Address:: 
9126 * Attribute Range_Length:: 
9127 * Attribute Ref:: 
9128 * Attribute Restriction_Set:: 
9129 * Attribute Result:: 
9130 * Attribute Safe_Emax:: 
9131 * Attribute Safe_Large:: 
9132 * Attribute Safe_Small:: 
9133 * Attribute Scalar_Storage_Order:: 
9134 * Attribute Simple_Storage_Pool:: 
9135 * Attribute Small:: 
9136 * Attribute Storage_Unit:: 
9137 * Attribute Stub_Type:: 
9138 * Attribute System_Allocator_Alignment:: 
9139 * Attribute Target_Name:: 
9140 * Attribute To_Address:: 
9141 * Attribute To_Any:: 
9142 * Attribute Type_Class:: 
9143 * Attribute Type_Key:: 
9144 * Attribute TypeCode:: 
9145 * Attribute UET_Address:: 
9146 * Attribute Unconstrained_Array:: 
9147 * Attribute Universal_Literal_String:: 
9148 * Attribute Unrestricted_Access:: 
9149 * Attribute Update:: 
9150 * Attribute Valid_Scalars:: 
9151 * Attribute VADS_Size:: 
9152 * Attribute Value_Size:: 
9153 * Attribute Wchar_T_Size:: 
9154 * Attribute Word_Size:: 
9156 @end menu
9158 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
9159 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{116}
9160 @section Attribute Abort_Signal
9163 @geindex Abort_Signal
9165 @cite{Standard'Abort_Signal} (@cite{Standard} is the only allowed
9166 prefix) provides the entity for the special exception used to signal
9167 task abort or asynchronous transfer of control.  Normally this attribute
9168 should only be used in the tasking runtime (it is highly peculiar, and
9169 completely outside the normal semantics of Ada, for a user program to
9170 intercept the abort exception).
9172 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
9173 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{117}
9174 @section Attribute Address_Size
9177 @geindex Size of `Address`
9179 @geindex Address_Size
9181 @cite{Standard'Address_Size} (@cite{Standard} is the only allowed
9182 prefix) is a static constant giving the number of bits in an
9183 @cite{Address}. It is the same value as System.Address'Size,
9184 but has the advantage of being static, while a direct
9185 reference to System.Address'Size is non-static because Address
9186 is a private type.
9188 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
9189 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{118}
9190 @section Attribute Asm_Input
9193 @geindex Asm_Input
9195 The @cite{Asm_Input} attribute denotes a function that takes two
9196 parameters.  The first is a string, the second is an expression of the
9197 type designated by the prefix.  The first (string) argument is required
9198 to be a static expression, and is the constraint for the parameter,
9199 (e.g., what kind of register is required).  The second argument is the
9200 value to be used as the input argument.  The possible values for the
9201 constant are the same as those used in the RTL, and are dependent on
9202 the configuration file used to built the GCC back end.
9203 @ref{119,,Machine Code Insertions}
9205 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
9206 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{11a}
9207 @section Attribute Asm_Output
9210 @geindex Asm_Output
9212 The @cite{Asm_Output} attribute denotes a function that takes two
9213 parameters.  The first is a string, the second is the name of a variable
9214 of the type designated by the attribute prefix.  The first (string)
9215 argument is required to be a static expression and designates the
9216 constraint for the parameter (e.g., what kind of register is
9217 required).  The second argument is the variable to be updated with the
9218 result.  The possible values for constraint are the same as those used in
9219 the RTL, and are dependent on the configuration file used to build the
9220 GCC back end.  If there are no output operands, then this argument may
9221 either be omitted, or explicitly given as @cite{No_Output_Operands}.
9222 @ref{119,,Machine Code Insertions}
9224 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
9225 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{11b}
9226 @section Attribute Atomic_Always_Lock_Free
9229 @geindex Atomic_Always_Lock_Free
9231 The prefix of the @cite{Atomic_Always_Lock_Free} attribute is a type.
9232 The result is a Boolean value which is True if the type has discriminants,
9233 and False otherwise.  The result indicate whether atomic operations are
9234 supported by the target for the given type.
9236 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
9237 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{11c}
9238 @section Attribute Bit
9241 @geindex Bit
9243 @code{obj'Bit}, where @cite{obj} is any object, yields the bit
9244 offset within the storage unit (byte) that contains the first bit of
9245 storage allocated for the object.  The value of this attribute is of the
9246 type @cite{Universal_Integer}, and is always a non-negative number not
9247 exceeding the value of @cite{System.Storage_Unit}.
9249 For an object that is a variable or a constant allocated in a register,
9250 the value is zero.  (The use of this attribute does not force the
9251 allocation of a variable to memory).
9253 For an object that is a formal parameter, this attribute applies
9254 to either the matching actual parameter or to a copy of the
9255 matching actual parameter.
9257 For an access object the value is zero.  Note that
9258 @code{obj.all'Bit} is subject to an @cite{Access_Check} for the
9259 designated object.  Similarly for a record component
9260 @code{X.C'Bit} is subject to a discriminant check and
9261 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
9262 are subject to index checks.
9264 This attribute is designed to be compatible with the DEC Ada 83 definition
9265 and implementation of the @cite{Bit} attribute.
9267 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
9268 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{11d}
9269 @section Attribute Bit_Position
9272 @geindex Bit_Position
9274 @code{R.C'Bit_Position}, where @cite{R} is a record object and @cite{C} is one
9275 of the fields of the record type, yields the bit
9276 offset within the record contains the first bit of
9277 storage allocated for the object.  The value of this attribute is of the
9278 type @cite{Universal_Integer}.  The value depends only on the field
9279 @cite{C} and is independent of the alignment of
9280 the containing record @cite{R}.
9282 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
9283 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{11e}
9284 @section Attribute Code_Address
9287 @geindex Code_Address
9289 @geindex Subprogram address
9291 @geindex Address of subprogram code
9293 The @cite{'Address}
9294 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
9295 intended effect seems to be to provide
9296 an address value which can be used to call the subprogram by means of
9297 an address clause as in the following example:
9299 @example
9300 procedure K is ...
9302 procedure L;
9303 for L'Address use K'Address;
9304 pragma Import (Ada, L);
9305 @end example
9307 A call to @cite{L} is then expected to result in a call to @cite{K}.
9308 In Ada 83, where there were no access-to-subprogram values, this was
9309 a common work-around for getting the effect of an indirect call.
9310 GNAT implements the above use of @cite{Address} and the technique
9311 illustrated by the example code works correctly.
9313 However, for some purposes, it is useful to have the address of the start
9314 of the generated code for the subprogram.  On some architectures, this is
9315 not necessarily the same as the @cite{Address} value described above.
9316 For example, the @cite{Address} value may reference a subprogram
9317 descriptor rather than the subprogram itself.
9319 The @cite{'Code_Address} attribute, which can only be applied to
9320 subprogram entities, always returns the address of the start of the
9321 generated code of the specified subprogram, which may or may not be
9322 the same value as is returned by the corresponding @cite{'Address}
9323 attribute.
9325 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
9326 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{11f}
9327 @section Attribute Compiler_Version
9330 @geindex Compiler_Version
9332 @cite{Standard'Compiler_Version} (@cite{Standard} is the only allowed
9333 prefix) yields a static string identifying the version of the compiler
9334 being used to compile the unit containing the attribute reference.
9336 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
9337 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{120}
9338 @section Attribute Constrained
9341 @geindex Constrained
9343 In addition to the usage of this attribute in the Ada RM, @cite{GNAT}
9344 also permits the use of the @cite{'Constrained} attribute
9345 in a generic template
9346 for any type, including types without discriminants. The value of this
9347 attribute in the generic instance when applied to a scalar type or a
9348 record type without discriminants is always @cite{True}. This usage is
9349 compatible with older Ada compilers, including notably DEC Ada.
9351 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
9352 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{121}
9353 @section Attribute Default_Bit_Order
9356 @geindex Big endian
9358 @geindex Little endian
9360 @geindex Default_Bit_Order
9362 @cite{Standard'Default_Bit_Order} (@cite{Standard} is the only
9363 permissible prefix), provides the value @cite{System.Default_Bit_Order}
9364 as a @cite{Pos} value (0 for @cite{High_Order_First}, 1 for
9365 @cite{Low_Order_First}).  This is used to construct the definition of
9366 @cite{Default_Bit_Order} in package @cite{System}.
9368 @node Attribute Default_Scalar_Storage_Order,Attribute Descriptor_Size,Attribute Default_Bit_Order,Implementation Defined Attributes
9369 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{122}
9370 @section Attribute Default_Scalar_Storage_Order
9373 @geindex Big endian
9375 @geindex Little endian
9377 @geindex Default_Scalar_Storage_Order
9379 @cite{Standard'Default_Scalar_Storage_Order} (@cite{Standard} is the only
9380 permissible prefix), provides the current value of the default scalar storage
9381 order (as specified using pragma @cite{Default_Scalar_Storage_Order}, or
9382 equal to @cite{Default_Bit_Order} if unspecified) as a
9383 @cite{System.Bit_Order} value. This is a static attribute.
9385 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
9386 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{123}
9387 @section Attribute Descriptor_Size
9390 @geindex Descriptor
9392 @geindex Dope vector
9394 @geindex Descriptor_Size
9396 Non-static attribute @cite{Descriptor_Size} returns the size in bits of the
9397 descriptor allocated for a type.  The result is non-zero only for unconstrained
9398 array types and the returned value is of type universal integer.  In GNAT, an
9399 array descriptor contains bounds information and is located immediately before
9400 the first element of the array.
9402 @example
9403 type Unconstr_Array is array (Positive range <>) of Boolean;
9404 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
9405 @end example
9407 The attribute takes into account any additional padding due to type alignment.
9408 In the example above, the descriptor contains two values of type
9409 @cite{Positive} representing the low and high bound.  Since @cite{Positive} has
9410 a size of 31 bits and an alignment of 4, the descriptor size is @cite{2 * Positive'Size + 2} or 64 bits.
9412 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
9413 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{124}
9414 @section Attribute Elaborated
9417 @geindex Elaborated
9419 The prefix of the @cite{'Elaborated} attribute must be a unit name.  The
9420 value is a Boolean which indicates whether or not the given unit has been
9421 elaborated.  This attribute is primarily intended for internal use by the
9422 generated code for dynamic elaboration checking, but it can also be used
9423 in user programs.  The value will always be True once elaboration of all
9424 units has been completed.  An exception is for units which need no
9425 elaboration, the value is always False for such units.
9427 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
9428 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{125}
9429 @section Attribute Elab_Body
9432 @geindex Elab_Body
9434 This attribute can only be applied to a program unit name.  It returns
9435 the entity for the corresponding elaboration procedure for elaborating
9436 the body of the referenced unit.  This is used in the main generated
9437 elaboration procedure by the binder and is not normally used in any
9438 other context.  However, there may be specialized situations in which it
9439 is useful to be able to call this elaboration procedure from Ada code,
9440 e.g., if it is necessary to do selective re-elaboration to fix some
9441 error.
9443 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
9444 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{126}
9445 @section Attribute Elab_Spec
9448 @geindex Elab_Spec
9450 This attribute can only be applied to a program unit name.  It returns
9451 the entity for the corresponding elaboration procedure for elaborating
9452 the spec of the referenced unit.  This is used in the main
9453 generated elaboration procedure by the binder and is not normally used
9454 in any other context.  However, there may be specialized situations in
9455 which it is useful to be able to call this elaboration procedure from
9456 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
9457 some error.
9459 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
9460 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{127}
9461 @section Attribute Elab_Subp_Body
9464 @geindex Elab_Subp_Body
9466 This attribute can only be applied to a library level subprogram
9467 name and is only allowed in CodePeer mode. It returns the entity
9468 for the corresponding elaboration procedure for elaborating the body
9469 of the referenced subprogram unit. This is used in the main generated
9470 elaboration procedure by the binder in CodePeer mode only and is unrecognized
9471 otherwise.
9473 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
9474 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{128}
9475 @section Attribute Emax
9478 @geindex Ada 83 attributes
9480 @geindex Emax
9482 The @cite{Emax} attribute is provided for compatibility with Ada 83.  See
9483 the Ada 83 reference manual for an exact description of the semantics of
9484 this attribute.
9486 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
9487 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{129}
9488 @section Attribute Enabled
9491 @geindex Enabled
9493 The @cite{Enabled} attribute allows an application program to check at compile
9494 time to see if the designated check is currently enabled. The prefix is a
9495 simple identifier, referencing any predefined check name (other than
9496 @cite{All_Checks}) or a check name introduced by pragma Check_Name. If
9497 no argument is given for the attribute, the check is for the general state
9498 of the check, if an argument is given, then it is an entity name, and the
9499 check indicates whether an @cite{Suppress} or @cite{Unsuppress} has been
9500 given naming the entity (if not, then the argument is ignored).
9502 Note that instantiations inherit the check status at the point of the
9503 instantiation, so a useful idiom is to have a library package that
9504 introduces a check name with @cite{pragma Check_Name}, and then contains
9505 generic packages or subprograms which use the @cite{Enabled} attribute
9506 to see if the check is enabled. A user of this package can then issue
9507 a @cite{pragma Suppress} or @cite{pragma Unsuppress} before instantiating
9508 the package or subprogram, controlling whether the check will be present.
9510 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
9511 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{12a}
9512 @section Attribute Enum_Rep
9515 @geindex Representation of enums
9517 @geindex Enum_Rep
9519 For every enumeration subtype @cite{S}, @code{S'Enum_Rep} denotes a
9520 function with the following spec:
9522 @example
9523 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
9524 @end example
9526 It is also allowable to apply @cite{Enum_Rep} directly to an object of an
9527 enumeration type or to a non-overloaded enumeration
9528 literal.  In this case @code{S'Enum_Rep} is equivalent to
9529 @code{typ'Enum_Rep(S)} where @cite{typ} is the type of the
9530 enumeration literal or object.
9532 The function returns the representation value for the given enumeration
9533 value.  This will be equal to value of the @cite{Pos} attribute in the
9534 absence of an enumeration representation clause.  This is a static
9535 attribute (i.e.,:the result is static if the argument is static).
9537 @code{S'Enum_Rep} can also be used with integer types and objects,
9538 in which case it simply returns the integer value.  The reason for this
9539 is to allow it to be used for @cite{(<>)} discrete formal arguments in
9540 a generic unit that can be instantiated with either enumeration types
9541 or integer types.  Note that if @cite{Enum_Rep} is used on a modular
9542 type whose upper bound exceeds the upper bound of the largest signed
9543 integer type, and the argument is a variable, so that the universal
9544 integer calculation is done at run time, then the call to @cite{Enum_Rep}
9545 may raise @cite{Constraint_Error}.
9547 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
9548 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{12b}
9549 @section Attribute Enum_Val
9552 @geindex Representation of enums
9554 @geindex Enum_Val
9556 For every enumeration subtype @cite{S}, @code{S'Enum_Val} denotes a
9557 function with the following spec:
9559 @example
9560 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
9561 @end example
9563 The function returns the enumeration value whose representation matches the
9564 argument, or raises Constraint_Error if no enumeration literal of the type
9565 has the matching value.
9566 This will be equal to value of the @cite{Val} attribute in the
9567 absence of an enumeration representation clause.  This is a static
9568 attribute (i.e., the result is static if the argument is static).
9570 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
9571 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{12c}
9572 @section Attribute Epsilon
9575 @geindex Ada 83 attributes
9577 @geindex Epsilon
9579 The @cite{Epsilon} attribute is provided for compatibility with Ada 83.  See
9580 the Ada 83 reference manual for an exact description of the semantics of
9581 this attribute.
9583 @node Attribute Fast_Math,Attribute Fixed_Value,Attribute Epsilon,Implementation Defined Attributes
9584 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{12d}
9585 @section Attribute Fast_Math
9588 @geindex Fast_Math
9590 @cite{Standard'Fast_Math} (@cite{Standard} is the only allowed
9591 prefix) yields a static Boolean value that is True if pragma
9592 @cite{Fast_Math} is active, and False otherwise.
9594 @node Attribute Fixed_Value,Attribute From_Any,Attribute Fast_Math,Implementation Defined Attributes
9595 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{12e}
9596 @section Attribute Fixed_Value
9599 @geindex Fixed_Value
9601 For every fixed-point type @cite{S}, @code{S'Fixed_Value} denotes a
9602 function with the following specification:
9604 @example
9605 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
9606 @end example
9608 The value returned is the fixed-point value @cite{V} such that:
9610 @example
9611 V = Arg * S'Small
9612 @end example
9614 The effect is thus similar to first converting the argument to the
9615 integer type used to represent @cite{S}, and then doing an unchecked
9616 conversion to the fixed-point type.  The difference is
9617 that there are full range checks, to ensure that the result is in range.
9618 This attribute is primarily intended for use in implementation of the
9619 input-output functions for fixed-point values.
9621 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
9622 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{12f}
9623 @section Attribute From_Any
9626 @geindex From_Any
9628 This internal attribute is used for the generation of remote subprogram
9629 stubs in the context of the Distributed Systems Annex.
9631 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
9632 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{130}
9633 @section Attribute Has_Access_Values
9636 @geindex Access values
9637 @geindex testing for
9639 @geindex Has_Access_Values
9641 The prefix of the @cite{Has_Access_Values} attribute is a type.  The result
9642 is a Boolean value which is True if the is an access type, or is a composite
9643 type with a component (at any nesting depth) that is an access type, and is
9644 False otherwise.
9645 The intended use of this attribute is in conjunction with generic
9646 definitions.  If the attribute is applied to a generic private type, it
9647 indicates whether or not the corresponding actual type has access values.
9649 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
9650 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{131}
9651 @section Attribute Has_Discriminants
9654 @geindex Discriminants
9655 @geindex testing for
9657 @geindex Has_Discriminants
9659 The prefix of the @cite{Has_Discriminants} attribute is a type.  The result
9660 is a Boolean value which is True if the type has discriminants, and False
9661 otherwise.  The intended use of this attribute is in conjunction with generic
9662 definitions.  If the attribute is applied to a generic private type, it
9663 indicates whether or not the corresponding actual type has discriminants.
9665 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
9666 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{132}
9667 @section Attribute Img
9670 @geindex Img
9672 The @cite{Img} attribute differs from @cite{Image} in that it is applied
9673 directly to an object, and yields the same result as
9674 @cite{Image} for the subtype of the object.  This is convenient for
9675 debugging:
9677 @example
9678 Put_Line ("X = " & X'Img);
9679 @end example
9681 has the same meaning as the more verbose:
9683 @example
9684 Put_Line ("X = " & T'Image (X));
9685 @end example
9687 where @cite{T} is the (sub)type of the object @cite{X}.
9689 Note that technically, in analogy to @cite{Image},
9690 @cite{X'Img} returns a parameterless function
9691 that returns the appropriate string when called. This means that
9692 @cite{X'Img} can be renamed as a function-returning-string, or used
9693 in an instantiation as a function parameter.
9695 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
9696 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{133}
9697 @section Attribute Integer_Value
9700 @geindex Integer_Value
9702 For every integer type @cite{S}, @code{S'Integer_Value} denotes a
9703 function with the following spec:
9705 @example
9706 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
9707 @end example
9709 The value returned is the integer value @cite{V}, such that:
9711 @example
9712 Arg = V * T'Small
9713 @end example
9715 where @cite{T} is the type of @cite{Arg}.
9716 The effect is thus similar to first doing an unchecked conversion from
9717 the fixed-point type to its corresponding implementation type, and then
9718 converting the result to the target integer type.  The difference is
9719 that there are full range checks, to ensure that the result is in range.
9720 This attribute is primarily intended for use in implementation of the
9721 standard input-output functions for fixed-point values.
9723 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
9724 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{134}
9725 @section Attribute Invalid_Value
9728 @geindex Invalid_Value
9730 For every scalar type S, S'Invalid_Value returns an undefined value of the
9731 type. If possible this value is an invalid representation for the type. The
9732 value returned is identical to the value used to initialize an otherwise
9733 uninitialized value of the type if pragma Initialize_Scalars is used,
9734 including the ability to modify the value with the binder -Sxx flag and
9735 relevant environment variables at run time.
9737 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
9738 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{135}
9739 @section Attribute Iterable
9742 @geindex Iterable
9744 Equivalent to Aspect Iterable.
9746 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
9747 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{136}
9748 @section Attribute Large
9751 @geindex Ada 83 attributes
9753 @geindex Large
9755 The @cite{Large} attribute is provided for compatibility with Ada 83.  See
9756 the Ada 83 reference manual for an exact description of the semantics of
9757 this attribute.
9759 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
9760 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{137}
9761 @section Attribute Library_Level
9764 @geindex Library_Level
9766 @cite{P'Library_Level}, where P is an entity name,
9767 returns a Boolean value which is True if the entity is declared
9768 at the library level, and False otherwise. Note that within a
9769 generic instantition, the name of the generic unit denotes the
9770 instance, which means that this attribute can be used to test
9771 if a generic is instantiated at the library level, as shown
9772 in this example:
9774 @example
9775 generic
9776   ...
9777 package Gen is
9778   pragma Compile_Time_Error
9779     (not Gen'Library_Level,
9780      "Gen can only be instantiated at library level");
9781   ...
9782 end Gen;
9783 @end example
9785 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
9786 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{138}
9787 @section Attribute Lock_Free
9790 @geindex Lock_Free
9792 @cite{P'Lock_Free}, where P is a protected object, returns True if a
9793 pragma @cite{Lock_Free} applies to P.
9795 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
9796 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{139}
9797 @section Attribute Loop_Entry
9800 @geindex Loop_Entry
9802 Syntax:
9804 @example
9805 X'Loop_Entry [(loop_name)]
9806 @end example
9808 The @cite{Loop_Entry} attribute is used to refer to the value that an
9809 expression had upon entry to a given loop in much the same way that the
9810 @cite{Old} attribute in a subprogram postcondition can be used to refer
9811 to the value an expression had upon entry to the subprogram. The
9812 relevant loop is either identified by the given loop name, or it is the
9813 innermost enclosing loop when no loop name is given.
9815 A @cite{Loop_Entry} attribute can only occur within a
9816 @cite{Loop_Variant} or @cite{Loop_Invariant} pragma. A common use of
9817 @cite{Loop_Entry} is to compare the current value of objects with their
9818 initial value at loop entry, in a @cite{Loop_Invariant} pragma.
9820 The effect of using @cite{X'Loop_Entry} is the same as declaring
9821 a constant initialized with the initial value of @cite{X} at loop
9822 entry. This copy is not performed if the loop is not entered, or if the
9823 corresponding pragmas are ignored or disabled.
9825 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
9826 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{13a}
9827 @section Attribute Machine_Size
9830 @geindex Machine_Size
9832 This attribute is identical to the @cite{Object_Size} attribute.  It is
9833 provided for compatibility with the DEC Ada 83 attribute of this name.
9835 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
9836 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{13b}
9837 @section Attribute Mantissa
9840 @geindex Ada 83 attributes
9842 @geindex Mantissa
9844 The @cite{Mantissa} attribute is provided for compatibility with Ada 83.  See
9845 the Ada 83 reference manual for an exact description of the semantics of
9846 this attribute.
9848 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
9849 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{13c}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{13d}
9850 @section Attribute Maximum_Alignment
9853 @geindex Alignment
9854 @geindex maximum
9856 @geindex Maximum_Alignment
9858 @cite{Standard'Maximum_Alignment} (@cite{Standard} is the only
9859 permissible prefix) provides the maximum useful alignment value for the
9860 target.  This is a static value that can be used to specify the alignment
9861 for an object, guaranteeing that it is properly aligned in all
9862 cases.
9864 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
9865 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{13e}
9866 @section Attribute Mechanism_Code
9869 @geindex Return values
9870 @geindex passing mechanism
9872 @geindex Parameters
9873 @geindex passing mechanism
9875 @geindex Mechanism_Code
9877 @code{function'Mechanism_Code} yields an integer code for the
9878 mechanism used for the result of function, and
9879 @code{subprogram'Mechanism_Code (n)} yields the mechanism
9880 used for formal parameter number @cite{n} (a static integer value with 1
9881 meaning the first parameter) of @cite{subprogram}.  The code returned is:
9884 @table @asis
9886 @item @emph{1}
9888 by copy (value)
9890 @item @emph{2}
9892 by reference
9893 @end table
9895 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
9896 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{13f}
9897 @section Attribute Null_Parameter
9900 @geindex Zero address
9901 @geindex passing
9903 @geindex Null_Parameter
9905 A reference @code{T'Null_Parameter} denotes an imaginary object of
9906 type or subtype @cite{T} allocated at machine address zero.  The attribute
9907 is allowed only as the default expression of a formal parameter, or as
9908 an actual expression of a subprogram call.  In either case, the
9909 subprogram must be imported.
9911 The identity of the object is represented by the address zero in the
9912 argument list, independent of the passing mechanism (explicit or
9913 default).
9915 This capability is needed to specify that a zero address should be
9916 passed for a record or other composite object passed by reference.
9917 There is no way of indicating this without the @cite{Null_Parameter}
9918 attribute.
9920 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
9921 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{140}
9922 @section Attribute Object_Size
9925 @geindex Size
9926 @geindex used for objects
9928 @geindex Object_Size
9930 The size of an object is not necessarily the same as the size of the type
9931 of an object.  This is because by default object sizes are increased to be
9932 a multiple of the alignment of the object.  For example,
9933 @cite{Natural'Size} is
9934 31, but by default objects of type @cite{Natural} will have a size of 32 bits.
9935 Similarly, a record containing an integer and a character:
9937 @example
9938 type Rec is record
9939    I : Integer;
9940    C : Character;
9941 end record;
9942 @end example
9944 will have a size of 40 (that is @cite{Rec'Size} will be 40).  The
9945 alignment will be 4, because of the
9946 integer field, and so the default size of record objects for this type
9947 will be 64 (8 bytes).
9949 If the alignment of the above record is specified to be 1, then the
9950 object size will be 40 (5 bytes). This is true by default, and also
9951 an object size of 40 can be explicitly specified in this case.
9953 A consequence of this capability is that different object sizes can be
9954 given to subtypes that would otherwise be considered in Ada to be
9955 statically matching.  But it makes no sense to consider such subtypes
9956 as statically matching.  Consequently, in @cite{GNAT} we add a rule
9957 to the static matching rules that requires object sizes to match.
9958 Consider this example:
9960 @example
9961  1. procedure BadAVConvert is
9962  2.    type R is new Integer;
9963  3.    subtype R1 is R range 1 .. 10;
9964  4.    subtype R2 is R range 1 .. 10;
9965  5.    for R1'Object_Size use 8;
9966  6.    for R2'Object_Size use 16;
9967  7.    type R1P is access all R1;
9968  8.    type R2P is access all R2;
9969  9.    R1PV : R1P := new R1'(4);
9970 10.    R2PV : R2P;
9971 11. begin
9972 12.    R2PV := R2P (R1PV);
9973                |
9974        >>> target designated subtype not compatible with
9975            type "R1" defined at line 3
9977 13. end;
9978 @end example
9980 In the absence of lines 5 and 6,
9981 types @cite{R1} and @cite{R2} statically match and
9982 hence the conversion on line 12 is legal. But since lines 5 and 6
9983 cause the object sizes to differ, @cite{GNAT} considers that types
9984 @cite{R1} and @cite{R2} are not statically matching, and line 12
9985 generates the diagnostic shown above.
9987 Similar additional checks are performed in other contexts requiring
9988 statically matching subtypes.
9990 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
9991 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{141}
9992 @section Attribute Old
9995 @geindex Old
9997 In addition to the usage of @cite{Old} defined in the Ada 2012 RM (usage
9998 within @cite{Post} aspect), GNAT also permits the use of this attribute
9999 in implementation defined pragmas @cite{Postcondition},
10000 @cite{Contract_Cases} and @cite{Test_Case}. Also usages of
10001 @cite{Old} which would be illegal according to the Ada 2012 RM
10002 definition are allowed under control of
10003 implementation defined pragma @cite{Unevaluated_Use_Of_Old}.
10005 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
10006 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{142}
10007 @section Attribute Passed_By_Reference
10010 @geindex Parameters
10011 @geindex when passed by reference
10013 @geindex Passed_By_Reference
10015 @code{type'Passed_By_Reference} for any subtype @cite{type} returns
10016 a value of type @cite{Boolean} value that is @cite{True} if the type is
10017 normally passed by reference and @cite{False} if the type is normally
10018 passed by copy in calls.  For scalar types, the result is always @cite{False}
10019 and is static.  For non-scalar types, the result is non-static.
10021 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
10022 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{143}
10023 @section Attribute Pool_Address
10026 @geindex Parameters
10027 @geindex when passed by reference
10029 @geindex Pool_Address
10031 @code{X'Pool_Address} for any object @cite{X} returns the address
10032 of X within its storage pool. This is the same as
10033 @code{X'Address}, except that for an unconstrained array whose
10034 bounds are allocated just before the first component,
10035 @code{X'Pool_Address} returns the address of those bounds,
10036 whereas @code{X'Address} returns the address of the first
10037 component.
10039 Here, we are interpreting 'storage pool' broadly to mean
10040 @code{wherever the object is allocated}, which could be a
10041 user-defined storage pool,
10042 the global heap, on the stack, or in a static memory area.
10043 For an object created by @cite{new}, @code{Ptr.all'Pool_Address} is
10044 what is passed to @cite{Allocate} and returned from @cite{Deallocate}.
10046 @node Attribute Range_Length,Attribute Ref,Attribute Pool_Address,Implementation Defined Attributes
10047 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{144}
10048 @section Attribute Range_Length
10051 @geindex Range_Length
10053 @code{type'Range_Length} for any discrete type @cite{type} yields
10054 the number of values represented by the subtype (zero for a null
10055 range).  The result is static for static subtypes.  @cite{Range_Length}
10056 applied to the index subtype of a one dimensional array always gives the
10057 same result as @cite{Length} applied to the array itself.
10059 @node Attribute Ref,Attribute Restriction_Set,Attribute Range_Length,Implementation Defined Attributes
10060 @anchor{gnat_rm/implementation_defined_attributes attribute-ref}@anchor{145}
10061 @section Attribute Ref
10064 @geindex Ref
10066 @node Attribute Restriction_Set,Attribute Result,Attribute Ref,Implementation Defined Attributes
10067 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{146}
10068 @section Attribute Restriction_Set
10071 @geindex Restriction_Set
10073 @geindex Restrictions
10075 This attribute allows compile time testing of restrictions that
10076 are currently in effect. It is primarily intended for specializing
10077 code in the run-time based on restrictions that are active (e.g.
10078 don't need to save fpt registers if restriction No_Floating_Point
10079 is known to be in effect), but can be used anywhere.
10081 There are two forms:
10083 @example
10084 System'Restriction_Set (partition_boolean_restriction_NAME)
10085 System'Restriction_Set (No_Dependence => library_unit_NAME);
10086 @end example
10088 In the case of the first form, the only restriction names
10089 allowed are parameterless restrictions that are checked
10090 for consistency at bind time. For a complete list see the
10091 subtype @cite{System.Rident.Partition_Boolean_Restrictions}.
10093 The result returned is True if the restriction is known to
10094 be in effect, and False if the restriction is known not to
10095 be in effect. An important guarantee is that the value of
10096 a Restriction_Set attribute is known to be consistent throughout
10097 all the code of a partition.
10099 This is trivially achieved if the entire partition is compiled
10100 with a consistent set of restriction pragmas. However, the
10101 compilation model does not require this. It is possible to
10102 compile one set of units with one set of pragmas, and another
10103 set of units with another set of pragmas. It is even possible
10104 to compile a spec with one set of pragmas, and then WITH the
10105 same spec with a different set of pragmas. Inconsistencies
10106 in the actual use of the restriction are checked at bind time.
10108 In order to achieve the guarantee of consistency for the
10109 Restriction_Set pragma, we consider that a use of the pragma
10110 that yields False is equivalent to a violation of the
10111 restriction.
10113 So for example if you write
10115 @example
10116 if System'Restriction_Set (No_Floating_Point) then
10117    ...
10118 else
10119    ...
10120 end if;
10121 @end example
10123 And the result is False, so that the else branch is executed,
10124 you can assume that this restriction is not set for any unit
10125 in the partition. This is checked by considering this use of
10126 the restriction pragma to be a violation of the restriction
10127 No_Floating_Point. This means that no other unit can attempt
10128 to set this restriction (if some unit does attempt to set it,
10129 the binder will refuse to bind the partition).
10131 Technical note: The restriction name and the unit name are
10132 intepreted entirely syntactically, as in the corresponding
10133 Restrictions pragma, they are not analyzed semantically,
10134 so they do not have a type.
10136 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
10137 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{147}
10138 @section Attribute Result
10141 @geindex Result
10143 @code{function'Result} can only be used with in a Postcondition pragma
10144 for a function. The prefix must be the name of the corresponding function. This
10145 is used to refer to the result of the function in the postcondition expression.
10146 For a further discussion of the use of this attribute and examples of its use,
10147 see the description of pragma Postcondition.
10149 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
10150 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{148}
10151 @section Attribute Safe_Emax
10154 @geindex Ada 83 attributes
10156 @geindex Safe_Emax
10158 The @cite{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
10159 the Ada 83 reference manual for an exact description of the semantics of
10160 this attribute.
10162 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
10163 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{149}
10164 @section Attribute Safe_Large
10167 @geindex Ada 83 attributes
10169 @geindex Safe_Large
10171 The @cite{Safe_Large} attribute is provided for compatibility with Ada 83.  See
10172 the Ada 83 reference manual for an exact description of the semantics of
10173 this attribute.
10175 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
10176 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{14a}
10177 @section Attribute Safe_Small
10180 @geindex Ada 83 attributes
10182 @geindex Safe_Small
10184 The @cite{Safe_Small} attribute is provided for compatibility with Ada 83.  See
10185 the Ada 83 reference manual for an exact description of the semantics of
10186 this attribute.
10188 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
10189 @anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{14b}
10190 @section Attribute Scalar_Storage_Order
10193 @geindex Endianness
10195 @geindex Scalar storage order
10197 @geindex Scalar_Storage_Order
10199 For every array or record type @cite{S}, the representation attribute
10200 @cite{Scalar_Storage_Order} denotes the order in which storage elements
10201 that make up scalar components are ordered within S. The value given must
10202 be a static expression of type System.Bit_Order. The following is an example
10203 of the use of this feature:
10205 @example
10206 --  Component type definitions
10208 subtype Yr_Type is Natural range 0 .. 127;
10209 subtype Mo_Type is Natural range 1 .. 12;
10210 subtype Da_Type is Natural range 1 .. 31;
10212 --  Record declaration
10214 type Date is record
10215    Years_Since_1980 : Yr_Type;
10216    Month            : Mo_Type;
10217    Day_Of_Month     : Da_Type;
10218 end record;
10220 --  Record representation clause
10222 for Date use record
10223    Years_Since_1980 at 0 range 0  ..  6;
10224    Month            at 0 range 7  .. 10;
10225    Day_Of_Month     at 0 range 11 .. 15;
10226 end record;
10228 --  Attribute definition clauses
10230 for Date'Bit_Order use System.High_Order_First;
10231 for Date'Scalar_Storage_Order use System.High_Order_First;
10232 --  If Scalar_Storage_Order is specified, it must be consistent with
10233 --  Bit_Order, so it's best to always define the latter explicitly if
10234 --  the former is used.
10235 @end example
10237 Other properties are as for standard representation attribute @cite{Bit_Order},
10238 as defined by Ada RM 13.5.3(4). The default is @cite{System.Default_Bit_Order}.
10240 For a record type @cite{T}, if @code{T'Scalar_Storage_Order} is
10241 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
10242 this means that if a @cite{Scalar_Storage_Order} attribute definition
10243 clause is not confirming, then the type's @cite{Bit_Order} shall be
10244 specified explicitly and set to the same value.
10246 Derived types inherit an explicitly set scalar storage order from their parent
10247 types. This may be overridden for the derived type by giving an explicit scalar
10248 storage order for the derived type. For a record extension, the derived type
10249 must have the same scalar storage order as the parent type.
10251 If a component of @cite{T} is of a record or array type, then that type must
10252 also have a @cite{Scalar_Storage_Order} attribute definition clause.
10254 A component of a record or array type that is a packed array, or that
10255 does not start on a byte boundary, must have the same scalar storage order
10256 as the enclosing record or array type.
10258 No component of a type that has an explicit @cite{Scalar_Storage_Order}
10259 attribute definition may be aliased.
10261 A confirming @cite{Scalar_Storage_Order} attribute definition clause (i.e.
10262 with a value equal to @cite{System.Default_Bit_Order}) has no effect.
10264 If the opposite storage order is specified, then whenever the value of
10265 a scalar component of an object of type @cite{S} is read, the storage
10266 elements of the enclosing machine scalar are first reversed (before
10267 retrieving the component value, possibly applying some shift and mask
10268 operatings on the enclosing machine scalar), and the opposite operation
10269 is done for writes.
10271 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
10272 are relaxed. Instead, the following rules apply:
10275 @itemize *
10277 @item 
10278 the underlying storage elements are those at positions
10279 @cite{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
10281 @item 
10282 the sequence of underlying storage elements shall have
10283 a size no greater than the largest machine scalar
10285 @item 
10286 the enclosing machine scalar is defined as the smallest machine
10287 scalar starting at a position no greater than
10288 @cite{position + first_bit / storage_element_size} and covering
10289 storage elements at least up to @cite{position + (last_bit + storage_element_size - 1) / storage_element_size}
10291 @item 
10292 the position of the component is interpreted relative to that machine
10293 scalar.
10294 @end itemize
10296 If no scalar storage order is specified for a type (either directly, or by
10297 inheritance in the case of a derived type), then the default is normally
10298 the native ordering of the target, but this default can be overridden using
10299 pragma @cite{Default_Scalar_Storage_Order}.
10301 Note that the scalar storage order only affects the in-memory data
10302 representation. It has no effect on the representation used by stream
10303 attributes.
10305 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
10306 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{b6}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{14c}
10307 @section Attribute Simple_Storage_Pool
10310 @geindex Storage pool
10311 @geindex simple
10313 @geindex Simple storage pool
10315 @geindex Simple_Storage_Pool
10317 For every nonformal, nonderived access-to-object type @cite{Acc}, the
10318 representation attribute @cite{Simple_Storage_Pool} may be specified
10319 via an attribute_definition_clause (or by specifying the equivalent aspect):
10321 @example
10322 My_Pool : My_Simple_Storage_Pool_Type;
10324 type Acc is access My_Data_Type;
10326 for Acc'Simple_Storage_Pool use My_Pool;
10327 @end example
10329 The name given in an attribute_definition_clause for the
10330 @cite{Simple_Storage_Pool} attribute shall denote a variable of
10331 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
10333 The use of this attribute is only allowed for a prefix denoting a type
10334 for which it has been specified. The type of the attribute is the type
10335 of the variable specified as the simple storage pool of the access type,
10336 and the attribute denotes that variable.
10338 It is illegal to specify both @cite{Storage_Pool} and @cite{Simple_Storage_Pool}
10339 for the same access type.
10341 If the @cite{Simple_Storage_Pool} attribute has been specified for an access
10342 type, then applying the @cite{Storage_Pool} attribute to the type is flagged
10343 with a warning and its evaluation raises the exception @cite{Program_Error}.
10345 If the Simple_Storage_Pool attribute has been specified for an access
10346 type @cite{S}, then the evaluation of the attribute @code{S'Storage_Size}
10347 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
10348 which is intended to indicate the number of storage elements reserved for
10349 the simple storage pool. If the Storage_Size function has not been defined
10350 for the simple storage pool type, then this attribute returns zero.
10352 If an access type @cite{S} has a specified simple storage pool of type
10353 @cite{SSP}, then the evaluation of an allocator for that access type calls
10354 the primitive @cite{Allocate} procedure for type @cite{SSP}, passing
10355 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
10356 semantics of such allocators is the same as those defined for allocators
10357 in section 13.11 of the @cite{Ada Reference Manual}, with the term
10358 @cite{simple storage pool} substituted for @cite{storage pool}.
10360 If an access type @cite{S} has a specified simple storage pool of type
10361 @cite{SSP}, then a call to an instance of the @cite{Ada.Unchecked_Deallocation}
10362 for that access type invokes the primitive @cite{Deallocate} procedure
10363 for type @cite{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
10364 parameter. The detailed semantics of such unchecked deallocations is the same
10365 as defined in section 13.11.2 of the Ada Reference Manual, except that the
10366 term 'simple storage pool' is substituted for 'storage pool'.
10368 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
10369 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{14d}
10370 @section Attribute Small
10373 @geindex Ada 83 attributes
10375 @geindex Small
10377 The @cite{Small} attribute is defined in Ada 95 (and Ada 2005) only for
10378 fixed-point types.
10379 GNAT also allows this attribute to be applied to floating-point types
10380 for compatibility with Ada 83.  See
10381 the Ada 83 reference manual for an exact description of the semantics of
10382 this attribute when applied to floating-point types.
10384 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
10385 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{14e}
10386 @section Attribute Storage_Unit
10389 @geindex Storage_Unit
10391 @cite{Standard'Storage_Unit} (@cite{Standard} is the only permissible
10392 prefix) provides the same value as @cite{System.Storage_Unit}.
10394 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
10395 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{14f}
10396 @section Attribute Stub_Type
10399 @geindex Stub_Type
10401 The GNAT implementation of remote access-to-classwide types is
10402 organized as described in AARM section E.4 (20.t): a value of an RACW type
10403 (designating a remote object) is represented as a normal access
10404 value, pointing to a "stub" object which in turn contains the
10405 necessary information to contact the designated remote object. A
10406 call on any dispatching operation of such a stub object does the
10407 remote call, if necessary, using the information in the stub object
10408 to locate the target partition, etc.
10410 For a prefix @cite{T} that denotes a remote access-to-classwide type,
10411 @cite{T'Stub_Type} denotes the type of the corresponding stub objects.
10413 By construction, the layout of @cite{T'Stub_Type} is identical to that of
10414 type @cite{RACW_Stub_Type} declared in the internal implementation-defined
10415 unit @cite{System.Partition_Interface}. Use of this attribute will create
10416 an implicit dependency on this unit.
10418 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
10419 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{150}
10420 @section Attribute System_Allocator_Alignment
10423 @geindex Alignment
10424 @geindex allocator
10426 @geindex System_Allocator_Alignment
10428 @cite{Standard'System_Allocator_Alignment} (@cite{Standard} is the only
10429 permissible prefix) provides the observable guaranted to be honored by
10430 the system allocator (malloc). This is a static value that can be used
10431 in user storage pools based on malloc either to reject allocation
10432 with alignment too large or to enable a realignment circuitry if the
10433 alignment request is larger than this value.
10435 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
10436 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{151}
10437 @section Attribute Target_Name
10440 @geindex Target_Name
10442 @cite{Standard'Target_Name} (@cite{Standard} is the only permissible
10443 prefix) provides a static string value that identifies the target
10444 for the current compilation. For GCC implementations, this is the
10445 standard gcc target name without the terminating slash (for
10446 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
10448 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
10449 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{152}
10450 @section Attribute To_Address
10453 @geindex To_Address
10455 The @cite{System'To_Address}
10456 (@cite{System} is the only permissible prefix)
10457 denotes a function identical to
10458 @cite{System.Storage_Elements.To_Address} except that
10459 it is a static attribute.  This means that if its argument is
10460 a static expression, then the result of the attribute is a
10461 static expression.  This means that such an expression can be
10462 used in contexts (e.g., preelaborable packages) which require a
10463 static expression and where the function call could not be used
10464 (since the function call is always non-static, even if its
10465 argument is static). The argument must be in the range
10466 -(2**(m-1) .. 2**m-1, where m is the memory size
10467 (typically 32 or 64). Negative values are intepreted in a
10468 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
10469 a 32 bits machine).
10471 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
10472 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{153}
10473 @section Attribute To_Any
10476 @geindex To_Any
10478 This internal attribute is used for the generation of remote subprogram
10479 stubs in the context of the Distributed Systems Annex.
10481 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
10482 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{154}
10483 @section Attribute Type_Class
10486 @geindex Type_Class
10488 @code{type'Type_Class} for any type or subtype @cite{type} yields
10489 the value of the type class for the full type of @cite{type}.  If
10490 @cite{type} is a generic formal type, the value is the value for the
10491 corresponding actual subtype.  The value of this attribute is of type
10492 @code{System.Aux_DEC.Type_Class}, which has the following definition:
10494 @example
10495 type Type_Class is
10496   (Type_Class_Enumeration,
10497    Type_Class_Integer,
10498    Type_Class_Fixed_Point,
10499    Type_Class_Floating_Point,
10500    Type_Class_Array,
10501    Type_Class_Record,
10502    Type_Class_Access,
10503    Type_Class_Task,
10504    Type_Class_Address);
10505 @end example
10507 Protected types yield the value @cite{Type_Class_Task}, which thus
10508 applies to all concurrent types.  This attribute is designed to
10509 be compatible with the DEC Ada 83 attribute of the same name.
10511 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
10512 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{155}
10513 @section Attribute Type_Key
10516 @geindex Type_Key
10518 The @cite{Type_Key} attribute is applicable to a type or subtype and
10519 yields a value of type Standard.String containing encoded information
10520 about the type or subtype. This provides improved compatibility with
10521 other implementations that support this attribute.
10523 @node Attribute TypeCode,Attribute UET_Address,Attribute Type_Key,Implementation Defined Attributes
10524 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{156}
10525 @section Attribute TypeCode
10528 @geindex TypeCode
10530 This internal attribute is used for the generation of remote subprogram
10531 stubs in the context of the Distributed Systems Annex.
10533 @node Attribute UET_Address,Attribute Unconstrained_Array,Attribute TypeCode,Implementation Defined Attributes
10534 @anchor{gnat_rm/implementation_defined_attributes attribute-uet-address}@anchor{157}
10535 @section Attribute UET_Address
10538 @geindex UET_Address
10540 The @cite{UET_Address} attribute can only be used for a prefix which
10541 denotes a library package.  It yields the address of the unit exception
10542 table when zero cost exception handling is used.  This attribute is
10543 intended only for use within the GNAT implementation.  See the unit
10544 @cite{Ada.Exceptions} in files @code{a-except.ads} and @code{a-except.adb}
10545 for details on how this attribute is used in the implementation.
10547 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute UET_Address,Implementation Defined Attributes
10548 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{158}
10549 @section Attribute Unconstrained_Array
10552 @geindex Unconstrained_Array
10554 The @cite{Unconstrained_Array} attribute can be used with a prefix that
10555 denotes any type or subtype. It is a static attribute that yields
10556 @cite{True} if the prefix designates an unconstrained array,
10557 and @cite{False} otherwise. In a generic instance, the result is
10558 still static, and yields the result of applying this test to the
10559 generic actual.
10561 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
10562 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{159}
10563 @section Attribute Universal_Literal_String
10566 @geindex Named numbers
10567 @geindex representation of
10569 @geindex Universal_Literal_String
10571 The prefix of @cite{Universal_Literal_String} must be a named
10572 number.  The static result is the string consisting of the characters of
10573 the number as defined in the original source.  This allows the user
10574 program to access the actual text of named numbers without intermediate
10575 conversions and without the need to enclose the strings in quotes (which
10576 would preclude their use as numbers).
10578 For example, the following program prints the first 50 digits of pi:
10580 @example
10581 with Text_IO; use Text_IO;
10582 with Ada.Numerics;
10583 procedure Pi is
10584 begin
10585    Put (Ada.Numerics.Pi'Universal_Literal_String);
10586 end;
10587 @end example
10589 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
10590 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{15a}
10591 @section Attribute Unrestricted_Access
10594 @geindex Access
10595 @geindex unrestricted
10597 @geindex Unrestricted_Access
10599 The @cite{Unrestricted_Access} attribute is similar to @cite{Access}
10600 except that all accessibility and aliased view checks are omitted.  This
10601 is a user-beware attribute.
10603 For objects, it is similar to @cite{Address}, for which it is a
10604 desirable replacement where the value desired is an access type.
10605 In other words, its effect is similar to first applying the
10606 @cite{Address} attribute and then doing an unchecked conversion to a
10607 desired access type.
10609 For subprograms, @cite{P'Unrestricted_Access} may be used where
10610 @cite{P'Access} would be illegal, to construct a value of a
10611 less-nested named access type that designates a more-nested
10612 subprogram. This value may be used in indirect calls, so long as the
10613 more-nested subprogram still exists; once the subprogram containing it
10614 has returned, such calls are erroneous. For example:
10616 @example
10617 package body P is
10619    type Less_Nested is not null access procedure;
10620    Global : Less_Nested;
10622    procedure P1 is
10623    begin
10624       Global.all;
10625    end P1;
10627    procedure P2 is
10628       Local_Var : Integer;
10630       procedure More_Nested is
10631       begin
10632          ... Local_Var ...
10633       end More_Nested;
10634    begin
10635       Global := More_Nested'Unrestricted_Access;
10636       P1;
10637    end P2;
10639 end P;
10640 @end example
10642 When P1 is called from P2, the call via Global is OK, but if P1 were
10643 called after P2 returns, it would be an erroneous use of a dangling
10644 pointer.
10646 For objects, it is possible to use @cite{Unrestricted_Access} for any
10647 type. However, if the result is of an access-to-unconstrained array
10648 subtype, then the resulting pointer has the same scope as the context
10649 of the attribute, and must not be returned to some enclosing scope.
10650 For instance, if a function uses @cite{Unrestricted_Access} to create
10651 an access-to-unconstrained-array and returns that value to the caller,
10652 the result will involve dangling pointers. In addition, it is only
10653 valid to create pointers to unconstrained arrays using this attribute
10654 if the pointer has the normal default 'fat' representation where a
10655 pointer has two components, one points to the array and one points to
10656 the bounds. If a size clause is used to force 'thin' representation
10657 for a pointer to unconstrained where there is only space for a single
10658 pointer, then the resulting pointer is not usable.
10660 In the simple case where a direct use of Unrestricted_Access attempts
10661 to make a thin pointer for a non-aliased object, the compiler will
10662 reject the use as illegal, as shown in the following example:
10664 @example
10665 with System; use System;
10666 procedure SliceUA2 is
10667    type A is access all String;
10668    for A'Size use Standard'Address_Size;
10670    procedure P (Arg : A) is
10671    begin
10672       null;
10673    end P;
10675    X : String := "hello world!";
10676    X2 : aliased String := "hello world!";
10678    AV : A := X'Unrestricted_Access;    -- ERROR
10679              |
10680 >>> illegal use of Unrestricted_Access attribute
10681 >>> attempt to generate thin pointer to unaliased object
10683 begin
10684    P (X'Unrestricted_Access);          -- ERROR
10685       |
10686 >>> illegal use of Unrestricted_Access attribute
10687 >>> attempt to generate thin pointer to unaliased object
10689    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
10690       |
10691 >>> illegal use of Unrestricted_Access attribute
10692 >>> attempt to generate thin pointer to unaliased object
10694    P (X2'Unrestricted_Access);         -- OK
10695 end;
10696 @end example
10698 but other cases cannot be detected by the compiler, and are
10699 considered to be erroneous. Consider the following example:
10701 @example
10702 with System; use System;
10703 with System; use System;
10704 procedure SliceUA is
10705    type AF is access all String;
10707    type A is access all String;
10708    for A'Size use Standard'Address_Size;
10710    procedure P (Arg : A) is
10711    begin
10712       if Arg'Length /= 6 then
10713          raise Program_Error;
10714       end if;
10715    end P;
10717    X : String := "hello world!";
10718    Y : AF := X (7 .. 12)'Unrestricted_Access;
10720 begin
10721    P (A (Y));
10722 end;
10723 @end example
10725 A normal unconstrained array value
10726 or a constrained array object marked as aliased has the bounds in memory
10727 just before the array, so a thin pointer can retrieve both the data and
10728 the bounds.  But in this case, the non-aliased object @cite{X} does not have the
10729 bounds before the string.  If the size clause for type @cite{A}
10730 were not present, then the pointer
10731 would be a fat pointer, where one component is a pointer to the bounds,
10732 and all would be well.  But with the size clause present, the conversion from
10733 fat pointer to thin pointer in the call loses the bounds, and so this
10734 is erroneous, and the program likely raises a @cite{Program_Error} exception.
10736 In general, it is advisable to completely
10737 avoid mixing the use of thin pointers and the use of
10738 @cite{Unrestricted_Access} where the designated type is an
10739 unconstrained array.  The use of thin pointers should be restricted to
10740 cases of porting legacy code that implicitly assumes the size of pointers,
10741 and such code should not in any case be using this attribute.
10743 Another erroneous situation arises if the attribute is
10744 applied to a constant. The resulting pointer can be used to access the
10745 constant, but the effect of trying to modify a constant in this manner
10746 is not well-defined. Consider this example:
10748 @example
10749 P : constant Integer := 4;
10750 type R is access all Integer;
10751 RV : R := P'Unrestricted_Access;
10753 RV.all := 3;
10754 @end example
10756 Here we attempt to modify the constant P from 4 to 3, but the compiler may
10757 or may not notice this attempt, and subsequent references to P may yield
10758 either the value 3 or the value 4 or the assignment may blow up if the
10759 compiler decides to put P in read-only memory. One particular case where
10760 @cite{Unrestricted_Access} can be used in this way is to modify the
10761 value of an @cite{IN} parameter:
10763 @example
10764 procedure K (S : in String) is
10765    type R is access all Character;
10766    RV : R := S (3)'Unrestricted_Access;
10767 begin
10768    RV.all := 'a';
10769 end;
10770 @end example
10772 In general this is a risky approach. It may appear to "work" but such uses of
10773 @cite{Unrestricted_Access} are potentially non-portable, even from one version
10774 of @cite{GNAT} to another, so are best avoided if possible.
10776 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
10777 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{15b}
10778 @section Attribute Update
10781 @geindex Update
10783 The @cite{Update} attribute creates a copy of an array or record value
10784 with one or more modified components. The syntax is:
10786 @example
10787 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
10788 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
10789 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
10790                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
10792 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
10793 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
10794 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
10795 @end example
10797 where @cite{PREFIX} is the name of an array or record object, the
10798 association list in parentheses does not contain an @cite{others}
10799 choice and the box symbol @cite{<>} may not appear in any
10800 expression. The effect is to yield a copy of the array or record value
10801 which is unchanged apart from the components mentioned in the
10802 association list, which are changed to the indicated value. The
10803 original value of the array or record value is not affected. For
10804 example:
10806 @example
10807 type Arr is Array (1 .. 5) of Integer;
10809 Avar1 : Arr := (1,2,3,4,5);
10810 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
10811 @end example
10813 yields a value for @cite{Avar2} of 1,10,20,20,5 with @cite{Avar1}
10814 begin unmodified. Similarly:
10816 @example
10817 type Rec is A, B, C : Integer;
10819 Rvar1 : Rec := (A => 1, B => 2, C => 3);
10820 Rvar2 : Rec := Rvar1'Update (B => 20);
10821 @end example
10823 yields a value for @cite{Rvar2} of (A => 1, B => 20, C => 3),
10824 with @cite{Rvar1} being unmodifed.
10825 Note that the value of the attribute reference is computed
10826 completely before it is used. This means that if you write:
10828 @example
10829 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
10830 @end example
10832 then the value of @cite{Avar1} is not modified if @cite{Function_Call}
10833 raises an exception, unlike the effect of a series of direct assignments
10834 to elements of @cite{Avar1}. In general this requires that
10835 two extra complete copies of the object are required, which should be
10836 kept in mind when considering efficiency.
10838 The @cite{Update} attribute cannot be applied to prefixes of a limited
10839 type, and cannot reference discriminants in the case of a record type.
10840 The accessibility level of an Update attribute result object is defined
10841 as for an aggregate.
10843 In the record case, no component can be mentioned more than once. In
10844 the array case, two overlapping ranges can appear in the association list,
10845 in which case the modifications are processed left to right.
10847 Multi-dimensional arrays can be modified, as shown by this example:
10849 @example
10850 A : array (1 .. 10, 1 .. 10) of Integer;
10852 A := A'Update ((1, 2) => 20, (3, 4) => 30);
10853 @end example
10855 which changes element (1,2) to 20 and (3,4) to 30.
10857 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
10858 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{15c}
10859 @section Attribute Valid_Scalars
10862 @geindex Valid_Scalars
10864 The @cite{'Valid_Scalars} attribute is intended to make it easier to
10865 check the validity of scalar subcomponents of composite objects. It
10866 is defined for any prefix @cite{X} that denotes an object.
10867 The value of this attribute is of the predefined type Boolean.
10868 @cite{X'Valid_Scalars} yields True if and only if evaluation of
10869 @cite{P'Valid} yields True for every scalar part P of X or if X has
10870 no scalar parts. It is not specified in what order the scalar parts
10871 are checked, nor whether any more are checked after any one of them
10872 is determined to be invalid. If the prefix @cite{X} is of a class-wide
10873 type @cite{T'Class} (where @cite{T} is the associated specific type),
10874 or if the prefix @cite{X} is of a specific tagged type @cite{T}, then
10875 only the scalar parts of components of @cite{T} are traversed; in other
10876 words, components of extensions of @cite{T} are not traversed even if
10877 @cite{T'Class (X)'Tag /= T'Tag} . The compiler will issue a warning if it can
10878 be determined at compile time that the prefix of the attribute has no
10879 scalar parts (e.g., if the prefix is of an access type, an interface type,
10880 an undiscriminated task type, or an undiscriminated protected type).
10882 For scalar types, @cite{Valid_Scalars} is equivalent to @cite{Valid}. The use
10883 of this attribute is not permitted for @cite{Unchecked_Union} types for which
10884 in general it is not possible to determine the values of the discriminants.
10886 Note: @cite{Valid_Scalars} can generate a lot of code, especially in the case
10887 of a large variant record. If the attribute is called in many places in the
10888 same program applied to objects of the same type, it can reduce program size
10889 to write a function with a single use of the attribute, and then call that
10890 function from multiple places.
10892 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
10893 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{15d}
10894 @section Attribute VADS_Size
10897 @geindex Size
10898 @geindex VADS compatibility
10900 @geindex VADS_Size
10902 The @cite{'VADS_Size} attribute is intended to make it easier to port
10903 legacy code which relies on the semantics of @cite{'Size} as implemented
10904 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
10905 same semantic interpretation.  In particular, @cite{'VADS_Size} applied
10906 to a predefined or other primitive type with no Size clause yields the
10907 Object_Size (for example, @cite{Natural'Size} is 32 rather than 31 on
10908 typical machines).  In addition @cite{'VADS_Size} applied to an object
10909 gives the result that would be obtained by applying the attribute to
10910 the corresponding type.
10912 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
10913 @anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{15e}
10914 @section Attribute Value_Size
10917 @geindex Size
10918 @geindex setting for not-first subtype
10920 @geindex Value_Size
10922 @code{type'Value_Size} is the number of bits required to represent
10923 a value of the given subtype.  It is the same as @code{type'Size},
10924 but, unlike @cite{Size}, may be set for non-first subtypes.
10926 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
10927 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{15f}
10928 @section Attribute Wchar_T_Size
10931 @geindex Wchar_T_Size
10933 @cite{Standard'Wchar_T_Size} (@cite{Standard} is the only permissible
10934 prefix) provides the size in bits of the C @cite{wchar_t} type
10935 primarily for constructing the definition of this type in
10936 package @cite{Interfaces.C}. The result is a static constant.
10938 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
10939 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{160}
10940 @section Attribute Word_Size
10943 @geindex Word_Size
10945 @cite{Standard'Word_Size} (@cite{Standard} is the only permissible
10946 prefix) provides the value @cite{System.Word_Size}. The result is
10947 a static constant.
10949 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
10950 @anchor{gnat_rm/standard_and_implementation_defined_restrictions standard-and-implementation-defined-restrictions}@anchor{9}@anchor{gnat_rm/standard_and_implementation_defined_restrictions doc}@anchor{161}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{162}
10951 @chapter Standard and Implementation Defined Restrictions
10954 All Ada Reference Manual-defined Restriction identifiers are implemented:
10957 @itemize *
10959 @item 
10960 language-defined restrictions (see 13.12.1)
10962 @item 
10963 tasking restrictions (see D.7)
10965 @item 
10966 high integrity restrictions (see H.4)
10967 @end itemize
10969 GNAT implements additional restriction identifiers. All restrictions, whether
10970 language defined or GNAT-specific, are listed in the following.
10972 @menu
10973 * Partition-Wide Restrictions:: 
10974 * Program Unit Level Restrictions:: 
10976 @end menu
10978 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
10979 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{163}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{164}
10980 @section Partition-Wide Restrictions
10983 There are two separate lists of restriction identifiers. The first
10984 set requires consistency throughout a partition (in other words, if the
10985 restriction identifier is used for any compilation unit in the partition,
10986 then all compilation units in the partition must obey the restriction).
10988 @menu
10989 * Immediate_Reclamation:: 
10990 * Max_Asynchronous_Select_Nesting:: 
10991 * Max_Entry_Queue_Length:: 
10992 * Max_Protected_Entries:: 
10993 * Max_Select_Alternatives:: 
10994 * Max_Storage_At_Blocking:: 
10995 * Max_Task_Entries:: 
10996 * Max_Tasks:: 
10997 * No_Abort_Statements:: 
10998 * No_Access_Parameter_Allocators:: 
10999 * No_Access_Subprograms:: 
11000 * No_Allocators:: 
11001 * No_Anonymous_Allocators:: 
11002 * No_Calendar:: 
11003 * No_Coextensions:: 
11004 * No_Default_Initialization:: 
11005 * No_Delay:: 
11006 * No_Dependence:: 
11007 * No_Direct_Boolean_Operators:: 
11008 * No_Dispatch:: 
11009 * No_Dispatching_Calls:: 
11010 * No_Dynamic_Attachment:: 
11011 * No_Dynamic_Priorities:: 
11012 * No_Entry_Calls_In_Elaboration_Code:: 
11013 * No_Enumeration_Maps:: 
11014 * No_Exception_Handlers:: 
11015 * No_Exception_Propagation:: 
11016 * No_Exception_Registration:: 
11017 * No_Exceptions:: 
11018 * No_Finalization:: 
11019 * No_Fixed_Point:: 
11020 * No_Floating_Point:: 
11021 * No_Implicit_Conditionals:: 
11022 * No_Implicit_Dynamic_Code:: 
11023 * No_Implicit_Heap_Allocations:: 
11024 * No_Implicit_Loops:: 
11025 * No_Initialize_Scalars:: 
11026 * No_IO:: 
11027 * No_Local_Allocators:: 
11028 * No_Local_Protected_Objects:: 
11029 * No_Local_Timing_Events:: 
11030 * No_Long_Long_Integers:: 
11031 * No_Multiple_Elaboration:: 
11032 * No_Nested_Finalization:: 
11033 * No_Protected_Type_Allocators:: 
11034 * No_Protected_Types:: 
11035 * No_Recursion:: 
11036 * No_Reentrancy:: 
11037 * No_Relative_Delay:: 
11038 * No_Requeue_Statements:: 
11039 * No_Secondary_Stack:: 
11040 * No_Select_Statements:: 
11041 * No_Specific_Termination_Handlers:: 
11042 * No_Specification_of_Aspect:: 
11043 * No_Standard_Allocators_After_Elaboration:: 
11044 * No_Standard_Storage_Pools:: 
11045 * No_Stream_Optimizations:: 
11046 * No_Streams:: 
11047 * No_Task_Allocators:: 
11048 * No_Task_Attributes_Package:: 
11049 * No_Task_Hierarchy:: 
11050 * No_Task_Termination:: 
11051 * No_Tasking:: 
11052 * No_Terminate_Alternatives:: 
11053 * No_Unchecked_Access:: 
11054 * No_Use_Of_Entity:: 
11055 * Simple_Barriers:: 
11056 * Static_Priorities:: 
11057 * Static_Storage_Size:: 
11059 @end menu
11061 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
11062 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{165}
11063 @subsection Immediate_Reclamation
11066 @geindex Immediate_Reclamation
11068 [RM H.4] This restriction ensures that, except for storage occupied by
11069 objects created by allocators and not deallocated via unchecked
11070 deallocation, any storage reserved at run time for an object is
11071 immediately reclaimed when the object no longer exists.
11073 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
11074 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{166}
11075 @subsection Max_Asynchronous_Select_Nesting
11078 @geindex Max_Asynchronous_Select_Nesting
11080 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
11081 selects. Violations of this restriction with a value of zero are
11082 detected at compile time. Violations of this restriction with values
11083 other than zero cause Storage_Error to be raised.
11085 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
11086 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{167}
11087 @subsection Max_Entry_Queue_Length
11090 @geindex Max_Entry_Queue_Length
11092 [RM D.7] This restriction is a declaration that any protected entry compiled in
11093 the scope of the restriction has at most the specified number of
11094 tasks waiting on the entry at any one time, and so no queue is required.
11095 Note that this restriction is checked at run time. Violation of this
11096 restriction results in the raising of Program_Error exception at the point of
11097 the call.
11099 @geindex Max_Entry_Queue_Depth
11101 The restriction @cite{Max_Entry_Queue_Depth} is recognized as a
11102 synonym for @cite{Max_Entry_Queue_Length}. This is retained for historical
11103 compatibility purposes (and a warning will be generated for its use if
11104 warnings on obsolescent features are activated).
11106 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
11107 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{168}
11108 @subsection Max_Protected_Entries
11111 @geindex Max_Protected_Entries
11113 [RM D.7] Specifies the maximum number of entries per protected type. The
11114 bounds of every entry family of a protected unit shall be static, or shall be
11115 defined by a discriminant of a subtype whose corresponding bound is static.
11117 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
11118 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{169}
11119 @subsection Max_Select_Alternatives
11122 @geindex Max_Select_Alternatives
11124 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
11126 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
11127 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{16a}
11128 @subsection Max_Storage_At_Blocking
11131 @geindex Max_Storage_At_Blocking
11133 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
11134 Storage_Size that can be retained by a blocked task. A violation of this
11135 restriction causes Storage_Error to be raised.
11137 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
11138 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{16b}
11139 @subsection Max_Task_Entries
11142 @geindex Max_Task_Entries
11144 [RM D.7] Specifies the maximum number of entries
11145 per task.  The bounds of every entry family
11146 of a task unit shall be static, or shall be
11147 defined by a discriminant of a subtype whose
11148 corresponding bound is static.
11150 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
11151 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{16c}
11152 @subsection Max_Tasks
11155 @geindex Max_Tasks
11157 [RM D.7] Specifies the maximum number of task that may be created, not
11158 counting the creation of the environment task.  Violations of this
11159 restriction with a value of zero are detected at compile
11160 time. Violations of this restriction with values other than zero cause
11161 Storage_Error to be raised.
11163 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
11164 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{16d}
11165 @subsection No_Abort_Statements
11168 @geindex No_Abort_Statements
11170 [RM D.7] There are no abort_statements, and there are
11171 no calls to Task_Identification.Abort_Task.
11173 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
11174 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{16e}
11175 @subsection No_Access_Parameter_Allocators
11178 @geindex No_Access_Parameter_Allocators
11180 [RM H.4] This restriction ensures at compile time that there are no
11181 occurrences of an allocator as the actual parameter to an access
11182 parameter.
11184 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
11185 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{16f}
11186 @subsection No_Access_Subprograms
11189 @geindex No_Access_Subprograms
11191 [RM H.4] This restriction ensures at compile time that there are no
11192 declarations of access-to-subprogram types.
11194 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
11195 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{170}
11196 @subsection No_Allocators
11199 @geindex No_Allocators
11201 [RM H.4] This restriction ensures at compile time that there are no
11202 occurrences of an allocator.
11204 @node No_Anonymous_Allocators,No_Calendar,No_Allocators,Partition-Wide Restrictions
11205 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{171}
11206 @subsection No_Anonymous_Allocators
11209 @geindex No_Anonymous_Allocators
11211 [RM H.4] This restriction ensures at compile time that there are no
11212 occurrences of an allocator of anonymous access type.
11214 @node No_Calendar,No_Coextensions,No_Anonymous_Allocators,Partition-Wide Restrictions
11215 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{172}
11216 @subsection No_Calendar
11219 @geindex No_Calendar
11221 [GNAT] This restriction ensures at compile time that there is no implicit or
11222 explicit dependence on the package @cite{Ada.Calendar}.
11224 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
11225 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{173}
11226 @subsection No_Coextensions
11229 @geindex No_Coextensions
11231 [RM H.4] This restriction ensures at compile time that there are no
11232 coextensions. See 3.10.2.
11234 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
11235 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{174}
11236 @subsection No_Default_Initialization
11239 @geindex No_Default_Initialization
11241 [GNAT] This restriction prohibits any instance of default initialization
11242 of variables.  The binder implements a consistency rule which prevents
11243 any unit compiled without the restriction from with'ing a unit with the
11244 restriction (this allows the generation of initialization procedures to
11245 be skipped, since you can be sure that no call is ever generated to an
11246 initialization procedure in a unit with the restriction active). If used
11247 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
11248 is to prohibit all cases of variables declared without a specific
11249 initializer (including the case of OUT scalar parameters).
11251 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
11252 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{175}
11253 @subsection No_Delay
11256 @geindex No_Delay
11258 [RM H.4] This restriction ensures at compile time that there are no
11259 delay statements and no dependences on package Calendar.
11261 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
11262 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{176}
11263 @subsection No_Dependence
11266 @geindex No_Dependence
11268 [RM 13.12.1] This restriction checks at compile time that there are no
11269 dependence on a library unit.
11271 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
11272 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{177}
11273 @subsection No_Direct_Boolean_Operators
11276 @geindex No_Direct_Boolean_Operators
11278 [GNAT] This restriction ensures that no logical operators (and/or/xor)
11279 are used on operands of type Boolean (or any type derived from Boolean).
11280 This is intended for use in safety critical programs where the certification
11281 protocol requires the use of short-circuit (and then, or else) forms for all
11282 composite boolean operations.
11284 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
11285 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{178}
11286 @subsection No_Dispatch
11289 @geindex No_Dispatch
11291 [RM H.4] This restriction ensures at compile time that there are no
11292 occurrences of @cite{T'Class}, for any (tagged) subtype @cite{T}.
11294 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
11295 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{179}
11296 @subsection No_Dispatching_Calls
11299 @geindex No_Dispatching_Calls
11301 [GNAT] This restriction ensures at compile time that the code generated by the
11302 compiler involves no dispatching calls. The use of this restriction allows the
11303 safe use of record extensions, classwide membership tests and other classwide
11304 features not involving implicit dispatching. This restriction ensures that
11305 the code contains no indirect calls through a dispatching mechanism. Note that
11306 this includes internally-generated calls created by the compiler, for example
11307 in the implementation of class-wide objects assignments. The
11308 membership test is allowed in the presence of this restriction, because its
11309 implementation requires no dispatching.
11310 This restriction is comparable to the official Ada restriction
11311 @cite{No_Dispatch} except that it is a bit less restrictive in that it allows
11312 all classwide constructs that do not imply dispatching.
11313 The following example indicates constructs that violate this restriction.
11315 @example
11316 package Pkg is
11317   type T is tagged record
11318     Data : Natural;
11319   end record;
11320   procedure P (X : T);
11322   type DT is new T with record
11323     More_Data : Natural;
11324   end record;
11325   procedure Q (X : DT);
11326 end Pkg;
11328 with Pkg; use Pkg;
11329 procedure Example is
11330   procedure Test (O : T'Class) is
11331     N : Natural  := O'Size;--  Error: Dispatching call
11332     C : T'Class := O;      --  Error: implicit Dispatching Call
11333   begin
11334     if O in DT'Class then  --  OK   : Membership test
11335        Q (DT (O));         --  OK   : Type conversion plus direct call
11336     else
11337        P (O);              --  Error: Dispatching call
11338     end if;
11339   end Test;
11341   Obj : DT;
11342 begin
11343   P (Obj);                 --  OK   : Direct call
11344   P (T (Obj));             --  OK   : Type conversion plus direct call
11345   P (T'Class (Obj));       --  Error: Dispatching call
11347   Test (Obj);              --  OK   : Type conversion
11349   if Obj in T'Class then   --  OK   : Membership test
11350      null;
11351   end if;
11352 end Example;
11353 @end example
11355 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
11356 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{17a}
11357 @subsection No_Dynamic_Attachment
11360 @geindex No_Dynamic_Attachment
11362 [RM D.7] This restriction ensures that there is no call to any of the
11363 operations defined in package Ada.Interrupts
11364 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
11365 Detach_Handler, and Reference).
11367 @geindex No_Dynamic_Interrupts
11369 The restriction @cite{No_Dynamic_Interrupts} is recognized as a
11370 synonym for @cite{No_Dynamic_Attachment}. This is retained for historical
11371 compatibility purposes (and a warning will be generated for its use if
11372 warnings on obsolescent features are activated).
11374 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
11375 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{17b}
11376 @subsection No_Dynamic_Priorities
11379 @geindex No_Dynamic_Priorities
11381 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
11383 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
11384 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{17c}
11385 @subsection No_Entry_Calls_In_Elaboration_Code
11388 @geindex No_Entry_Calls_In_Elaboration_Code
11390 [GNAT] This restriction ensures at compile time that no task or protected entry
11391 calls are made during elaboration code.  As a result of the use of this
11392 restriction, the compiler can assume that no code past an accept statement
11393 in a task can be executed at elaboration time.
11395 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
11396 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{17d}
11397 @subsection No_Enumeration_Maps
11400 @geindex No_Enumeration_Maps
11402 [GNAT] This restriction ensures at compile time that no operations requiring
11403 enumeration maps are used (that is Image and Value attributes applied
11404 to enumeration types).
11406 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
11407 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{17e}
11408 @subsection No_Exception_Handlers
11411 @geindex No_Exception_Handlers
11413 [GNAT] This restriction ensures at compile time that there are no explicit
11414 exception handlers. It also indicates that no exception propagation will
11415 be provided. In this mode, exceptions may be raised but will result in
11416 an immediate call to the last chance handler, a routine that the user
11417 must define with the following profile:
11419 @example
11420 procedure Last_Chance_Handler
11421   (Source_Location : System.Address; Line : Integer);
11422 pragma Export (C, Last_Chance_Handler,
11423                "__gnat_last_chance_handler");
11424 @end example
11426 The parameter is a C null-terminated string representing a message to be
11427 associated with the exception (typically the source location of the raise
11428 statement generated by the compiler). The Line parameter when nonzero
11429 represents the line number in the source program where the raise occurs.
11431 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
11432 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{17f}
11433 @subsection No_Exception_Propagation
11436 @geindex No_Exception_Propagation
11438 [GNAT] This restriction guarantees that exceptions are never propagated
11439 to an outer subprogram scope. The only case in which an exception may
11440 be raised is when the handler is statically in the same subprogram, so
11441 that the effect of a raise is essentially like a goto statement. Any
11442 other raise statement (implicit or explicit) will be considered
11443 unhandled. Exception handlers are allowed, but may not contain an
11444 exception occurrence identifier (exception choice). In addition, use of
11445 the package GNAT.Current_Exception is not permitted, and reraise
11446 statements (raise with no operand) are not permitted.
11448 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
11449 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{180}
11450 @subsection No_Exception_Registration
11453 @geindex No_Exception_Registration
11455 [GNAT] This restriction ensures at compile time that no stream operations for
11456 types Exception_Id or Exception_Occurrence are used. This also makes it
11457 impossible to pass exceptions to or from a partition with this restriction
11458 in a distributed environment. If this restriction is active, the generated
11459 code is simplified by omitting the otherwise-required global registration
11460 of exceptions when they are declared.
11462 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
11463 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{181}
11464 @subsection No_Exceptions
11467 @geindex No_Exceptions
11469 [RM H.4] This restriction ensures at compile time that there are no
11470 raise statements and no exception handlers.
11472 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
11473 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{182}
11474 @subsection No_Finalization
11477 @geindex No_Finalization
11479 [GNAT] This restriction disables the language features described in
11480 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
11481 performed by the compiler to support these features. The following types
11482 are no longer considered controlled when this restriction is in effect:
11485 @itemize *
11487 @item 
11488 @cite{Ada.Finalization.Controlled}
11490 @item 
11491 @cite{Ada.Finalization.Limited_Controlled}
11493 @item 
11494 Derivations from @cite{Controlled} or @cite{Limited_Controlled}
11496 @item 
11497 Class-wide types
11499 @item 
11500 Protected types
11502 @item 
11503 Task types
11505 @item 
11506 Array and record types with controlled components
11507 @end itemize
11509 The compiler no longer generates code to initialize, finalize or adjust an
11510 object or a nested component, either declared on the stack or on the heap. The
11511 deallocation of a controlled object no longer finalizes its contents.
11513 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
11514 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{183}
11515 @subsection No_Fixed_Point
11518 @geindex No_Fixed_Point
11520 [RM H.4] This restriction ensures at compile time that there are no
11521 occurrences of fixed point types and operations.
11523 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
11524 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{184}
11525 @subsection No_Floating_Point
11528 @geindex No_Floating_Point
11530 [RM H.4] This restriction ensures at compile time that there are no
11531 occurrences of floating point types and operations.
11533 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
11534 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{185}
11535 @subsection No_Implicit_Conditionals
11538 @geindex No_Implicit_Conditionals
11540 [GNAT] This restriction ensures that the generated code does not contain any
11541 implicit conditionals, either by modifying the generated code where possible,
11542 or by rejecting any construct that would otherwise generate an implicit
11543 conditional. Note that this check does not include run time constraint
11544 checks, which on some targets may generate implicit conditionals as
11545 well. To control the latter, constraint checks can be suppressed in the
11546 normal manner. Constructs generating implicit conditionals include comparisons
11547 of composite objects and the Max/Min attributes.
11549 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
11550 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{186}
11551 @subsection No_Implicit_Dynamic_Code
11554 @geindex No_Implicit_Dynamic_Code
11556 @geindex trampoline
11558 [GNAT] This restriction prevents the compiler from building 'trampolines'.
11559 This is a structure that is built on the stack and contains dynamic
11560 code to be executed at run time. On some targets, a trampoline is
11561 built for the following features: @cite{Access},
11562 @cite{Unrestricted_Access}, or @cite{Address} of a nested subprogram;
11563 nested task bodies; primitive operations of nested tagged types.
11564 Trampolines do not work on machines that prevent execution of stack
11565 data. For example, on windows systems, enabling DEP (data execution
11566 protection) will cause trampolines to raise an exception.
11567 Trampolines are also quite slow at run time.
11569 On many targets, trampolines have been largely eliminated. Look at the
11570 version of system.ads for your target --- if it has
11571 Always_Compatible_Rep equal to False, then trampolines are largely
11572 eliminated. In particular, a trampoline is built for the following
11573 features: @cite{Address} of a nested subprogram;
11574 @cite{Access} or @cite{Unrestricted_Access} of a nested subprogram,
11575 but only if pragma Favor_Top_Level applies, or the access type has a
11576 foreign-language convention; primitive operations of nested tagged
11577 types.
11579 @node No_Implicit_Heap_Allocations,No_Implicit_Loops,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
11580 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{187}
11581 @subsection No_Implicit_Heap_Allocations
11584 @geindex No_Implicit_Heap_Allocations
11586 [RM D.7] No constructs are allowed to cause implicit heap allocation.
11588 @node No_Implicit_Loops,No_Initialize_Scalars,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
11589 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{188}
11590 @subsection No_Implicit_Loops
11593 @geindex No_Implicit_Loops
11595 [GNAT] This restriction ensures that the generated code does not contain any
11596 implicit @cite{for} loops, either by modifying
11597 the generated code where possible,
11598 or by rejecting any construct that would otherwise generate an implicit
11599 @cite{for} loop. If this restriction is active, it is possible to build
11600 large array aggregates with all static components without generating an
11601 intermediate temporary, and without generating a loop to initialize individual
11602 components. Otherwise, a loop is created for arrays larger than about 5000
11603 scalar components.
11605 @node No_Initialize_Scalars,No_IO,No_Implicit_Loops,Partition-Wide Restrictions
11606 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{189}
11607 @subsection No_Initialize_Scalars
11610 @geindex No_Initialize_Scalars
11612 [GNAT] This restriction ensures that no unit in the partition is compiled with
11613 pragma Initialize_Scalars. This allows the generation of more efficient
11614 code, and in particular eliminates dummy null initialization routines that
11615 are otherwise generated for some record and array types.
11617 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
11618 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{18a}
11619 @subsection No_IO
11622 @geindex No_IO
11624 [RM H.4] This restriction ensures at compile time that there are no
11625 dependences on any of the library units Sequential_IO, Direct_IO,
11626 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
11628 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
11629 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{18b}
11630 @subsection No_Local_Allocators
11633 @geindex No_Local_Allocators
11635 [RM H.4] This restriction ensures at compile time that there are no
11636 occurrences of an allocator in subprograms, generic subprograms, tasks,
11637 and entry bodies.
11639 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
11640 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{18c}
11641 @subsection No_Local_Protected_Objects
11644 @geindex No_Local_Protected_Objects
11646 [RM D.7] This restriction ensures at compile time that protected objects are
11647 only declared at the library level.
11649 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
11650 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{18d}
11651 @subsection No_Local_Timing_Events
11654 @geindex No_Local_Timing_Events
11656 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
11657 declared at the library level.
11659 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
11660 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{18e}
11661 @subsection No_Long_Long_Integers
11664 @geindex No_Long_Long_Integers
11666 [GNAT] This partition-wide restriction forbids any explicit reference to
11667 type Standard.Long_Long_Integer, and also forbids declaring range types whose
11668 implicit base type is Long_Long_Integer, and modular types whose size exceeds
11669 Long_Integer'Size.
11671 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
11672 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{18f}
11673 @subsection No_Multiple_Elaboration
11676 @geindex No_Multiple_Elaboration
11678 [GNAT] Normally each package contains a 16-bit counter used to check for access
11679 before elaboration, and to control multiple elaboration attempts.
11680 This counter is eliminated for units compiled with the static model
11681 of elaboration if restriction @cite{No_Elaboration_Code}
11682 is active but because of
11683 the need to check for multiple elaboration in the general case, these
11684 counters cannot be eliminated if elaboration code may be present. The
11685 restriction @cite{No_Multiple_Elaboration}
11686 allows suppression of these counters
11687 in static elaboration units even if they do have elaboration code. If this
11688 restriction is used, then the situations in which multiple elaboration is
11689 possible, including non-Ada main programs, and Stand Alone libraries, are not
11690 permitted, and will be diagnosed by the binder.
11692 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
11693 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{190}
11694 @subsection No_Nested_Finalization
11697 @geindex No_Nested_Finalization
11699 [RM D.7] All objects requiring finalization are declared at the library level.
11701 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
11702 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{191}
11703 @subsection No_Protected_Type_Allocators
11706 @geindex No_Protected_Type_Allocators
11708 [RM D.7] This restriction ensures at compile time that there are no allocator
11709 expressions that attempt to allocate protected objects.
11711 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
11712 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{192}
11713 @subsection No_Protected_Types
11716 @geindex No_Protected_Types
11718 [RM H.4] This restriction ensures at compile time that there are no
11719 declarations of protected types or protected objects.
11721 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
11722 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{193}
11723 @subsection No_Recursion
11726 @geindex No_Recursion
11728 [RM H.4] A program execution is erroneous if a subprogram is invoked as
11729 part of its execution.
11731 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
11732 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{194}
11733 @subsection No_Reentrancy
11736 @geindex No_Reentrancy
11738 [RM H.4] A program execution is erroneous if a subprogram is executed by
11739 two tasks at the same time.
11741 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
11742 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{195}
11743 @subsection No_Relative_Delay
11746 @geindex No_Relative_Delay
11748 [RM D.7] This restriction ensures at compile time that there are no delay
11749 relative statements and prevents expressions such as @cite{delay 1.23;} from
11750 appearing in source code.
11752 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
11753 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{196}
11754 @subsection No_Requeue_Statements
11757 @geindex No_Requeue_Statements
11759 [RM D.7] This restriction ensures at compile time that no requeue statements
11760 are permitted and prevents keyword @cite{requeue} from being used in source
11761 code.
11763 @geindex No_Requeue
11765 The restriction @cite{No_Requeue} is recognized as a
11766 synonym for @cite{No_Requeue_Statements}. This is retained for historical
11767 compatibility purposes (and a warning will be generated for its use if
11768 warnings on oNobsolescent features are activated).
11770 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
11771 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{197}
11772 @subsection No_Secondary_Stack
11775 @geindex No_Secondary_Stack
11777 [GNAT] This restriction ensures at compile time that the generated code
11778 does not contain any reference to the secondary stack.  The secondary
11779 stack is used to implement functions returning unconstrained objects
11780 (arrays or records) on some targets.
11782 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
11783 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{198}
11784 @subsection No_Select_Statements
11787 @geindex No_Select_Statements
11789 [RM D.7] This restriction ensures at compile time no select statements of any
11790 kind are permitted, that is the keyword @cite{select} may not appear.
11792 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
11793 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{199}
11794 @subsection No_Specific_Termination_Handlers
11797 @geindex No_Specific_Termination_Handlers
11799 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
11800 or to Ada.Task_Termination.Specific_Handler.
11802 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
11803 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{19a}
11804 @subsection No_Specification_of_Aspect
11807 @geindex No_Specification_of_Aspect
11809 [RM 13.12.1] This restriction checks at compile time that no aspect
11810 specification, attribute definition clause, or pragma is given for a
11811 given aspect.
11813 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
11814 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{19b}
11815 @subsection No_Standard_Allocators_After_Elaboration
11818 @geindex No_Standard_Allocators_After_Elaboration
11820 [RM D.7] Specifies that an allocator using a standard storage pool
11821 should never be evaluated at run time after the elaboration of the
11822 library items of the partition has completed. Otherwise, Storage_Error
11823 is raised.
11825 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
11826 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{19c}
11827 @subsection No_Standard_Storage_Pools
11830 @geindex No_Standard_Storage_Pools
11832 [GNAT] This restriction ensures at compile time that no access types
11833 use the standard default storage pool.  Any access type declared must
11834 have an explicit Storage_Pool attribute defined specifying a
11835 user-defined storage pool.
11837 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
11838 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{19d}
11839 @subsection No_Stream_Optimizations
11842 @geindex No_Stream_Optimizations
11844 [GNAT] This restriction affects the performance of stream operations on types
11845 @cite{String}, @cite{Wide_String} and @cite{Wide_Wide_String}. By default, the
11846 compiler uses block reads and writes when manipulating @cite{String} objects
11847 due to their supperior performance. When this restriction is in effect, the
11848 compiler performs all IO operations on a per-character basis.
11850 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
11851 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{19e}
11852 @subsection No_Streams
11855 @geindex No_Streams
11857 [GNAT] This restriction ensures at compile/bind time that there are no
11858 stream objects created and no use of stream attributes.
11859 This restriction does not forbid dependences on the package
11860 @cite{Ada.Streams}. So it is permissible to with
11861 @cite{Ada.Streams} (or another package that does so itself)
11862 as long as no actual stream objects are created and no
11863 stream attributes are used.
11865 Note that the use of restriction allows optimization of tagged types,
11866 since they do not need to worry about dispatching stream operations.
11867 To take maximum advantage of this space-saving optimization, any
11868 unit declaring a tagged type should be compiled with the restriction,
11869 though this is not required.
11871 @node No_Task_Allocators,No_Task_Attributes_Package,No_Streams,Partition-Wide Restrictions
11872 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{19f}
11873 @subsection No_Task_Allocators
11876 @geindex No_Task_Allocators
11878 [RM D.7] There are no allocators for task types
11879 or types containing task subcomponents.
11881 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_Allocators,Partition-Wide Restrictions
11882 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1a0}
11883 @subsection No_Task_Attributes_Package
11886 @geindex No_Task_Attributes_Package
11888 [GNAT] This restriction ensures at compile time that there are no implicit or
11889 explicit dependencies on the package @cite{Ada.Task_Attributes}.
11891 @geindex No_Task_Attributes
11893 The restriction @cite{No_Task_Attributes} is recognized as a synonym
11894 for @cite{No_Task_Attributes_Package}. This is retained for historical
11895 compatibility purposes (and a warning will be generated for its use if
11896 warnings on obsolescent features are activated).
11898 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
11899 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1a1}
11900 @subsection No_Task_Hierarchy
11903 @geindex No_Task_Hierarchy
11905 [RM D.7] All (non-environment) tasks depend
11906 directly on the environment task of the partition.
11908 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
11909 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1a2}
11910 @subsection No_Task_Termination
11913 @geindex No_Task_Termination
11915 [RM D.7] Tasks that terminate are erroneous.
11917 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
11918 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1a3}
11919 @subsection No_Tasking
11922 @geindex No_Tasking
11924 [GNAT] This restriction prevents the declaration of tasks or task types
11925 throughout the partition.  It is similar in effect to the use of
11926 @cite{Max_Tasks => 0} except that violations are caught at compile time
11927 and cause an error message to be output either by the compiler or
11928 binder.
11930 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
11931 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1a4}
11932 @subsection No_Terminate_Alternatives
11935 @geindex No_Terminate_Alternatives
11937 [RM D.7] There are no selective accepts with terminate alternatives.
11939 @node No_Unchecked_Access,No_Use_Of_Entity,No_Terminate_Alternatives,Partition-Wide Restrictions
11940 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1a5}
11941 @subsection No_Unchecked_Access
11944 @geindex No_Unchecked_Access
11946 [RM H.4] This restriction ensures at compile time that there are no
11947 occurrences of the Unchecked_Access attribute.
11949 @node No_Use_Of_Entity,Simple_Barriers,No_Unchecked_Access,Partition-Wide Restrictions
11950 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1a6}
11951 @subsection No_Use_Of_Entity
11954 @geindex No_Use_Of_Entity
11956 [GNAT] This restriction ensures at compile time that there are no references
11957 to the entity given in the form
11959 @example
11960 No_Use_Of_Entity => Name
11961 @end example
11963 where @code{Name} is the fully qualified entity, for example
11965 @example
11966 No_Use_Of_Entity => Ada.Text_IO.Put_Line
11967 @end example
11969 @node Simple_Barriers,Static_Priorities,No_Use_Of_Entity,Partition-Wide Restrictions
11970 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1a7}
11971 @subsection Simple_Barriers
11974 @geindex Simple_Barriers
11976 [RM D.7] This restriction ensures at compile time that barriers in entry
11977 declarations for protected types are restricted to either static boolean
11978 expressions or references to simple boolean variables defined in the private
11979 part of the protected type.  No other form of entry barriers is permitted.
11981 @geindex Boolean_Entry_Barriers
11983 The restriction @cite{Boolean_Entry_Barriers} is recognized as a
11984 synonym for @cite{Simple_Barriers}. This is retained for historical
11985 compatibility purposes (and a warning will be generated for its use if
11986 warnings on obsolescent features are activated).
11988 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
11989 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1a8}
11990 @subsection Static_Priorities
11993 @geindex Static_Priorities
11995 [GNAT] This restriction ensures at compile time that all priority expressions
11996 are static, and that there are no dependences on the package
11997 @cite{Ada.Dynamic_Priorities}.
11999 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
12000 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1a9}
12001 @subsection Static_Storage_Size
12004 @geindex Static_Storage_Size
12006 [GNAT] This restriction ensures at compile time that any expression appearing
12007 in a Storage_Size pragma or attribute definition clause is static.
12009 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
12010 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1aa}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{1ab}
12011 @section Program Unit Level Restrictions
12014 The second set of restriction identifiers
12015 does not require partition-wide consistency.
12016 The restriction may be enforced for a single
12017 compilation unit without any effect on any of the
12018 other compilation units in the partition.
12020 @menu
12021 * No_Elaboration_Code:: 
12022 * No_Entry_Queue:: 
12023 * No_Implementation_Aspect_Specifications:: 
12024 * No_Implementation_Attributes:: 
12025 * No_Implementation_Identifiers:: 
12026 * No_Implementation_Pragmas:: 
12027 * No_Implementation_Restrictions:: 
12028 * No_Implementation_Units:: 
12029 * No_Implicit_Aliasing:: 
12030 * No_Obsolescent_Features:: 
12031 * No_Wide_Characters:: 
12032 * SPARK_05:: 
12034 @end menu
12036 @node No_Elaboration_Code,No_Entry_Queue,,Program Unit Level Restrictions
12037 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{1ac}
12038 @subsection No_Elaboration_Code
12041 @geindex No_Elaboration_Code
12043 [GNAT] This restriction ensures at compile time that no elaboration code is
12044 generated.  Note that this is not the same condition as is enforced
12045 by pragma @cite{Preelaborate}.  There are cases in which pragma
12046 @cite{Preelaborate} still permits code to be generated (e.g., code
12047 to initialize a large array to all zeroes), and there are cases of units
12048 which do not meet the requirements for pragma @cite{Preelaborate},
12049 but for which no elaboration code is generated.  Generally, it is
12050 the case that preelaborable units will meet the restrictions, with
12051 the exception of large aggregates initialized with an others_clause,
12052 and exception declarations (which generate calls to a run-time
12053 registry procedure).  This restriction is enforced on
12054 a unit by unit basis, it need not be obeyed consistently
12055 throughout a partition.
12057 In the case of aggregates with others, if the aggregate has a dynamic
12058 size, there is no way to eliminate the elaboration code (such dynamic
12059 bounds would be incompatible with @cite{Preelaborate} in any case). If
12060 the bounds are static, then use of this restriction actually modifies
12061 the code choice of the compiler to avoid generating a loop, and instead
12062 generate the aggregate statically if possible, no matter how many times
12063 the data for the others clause must be repeatedly generated.
12065 It is not possible to precisely document
12066 the constructs which are compatible with this restriction, since,
12067 unlike most other restrictions, this is not a restriction on the
12068 source code, but a restriction on the generated object code. For
12069 example, if the source contains a declaration:
12071 @example
12072 Val : constant Integer := X;
12073 @end example
12075 where X is not a static constant, it may be possible, depending
12076 on complex optimization circuitry, for the compiler to figure
12077 out the value of X at compile time, in which case this initialization
12078 can be done by the loader, and requires no initialization code. It
12079 is not possible to document the precise conditions under which the
12080 optimizer can figure this out.
12082 Note that this the implementation of this restriction requires full
12083 code generation. If it is used in conjunction with "semantics only"
12084 checking, then some cases of violations may be missed.
12086 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Elaboration_Code,Program Unit Level Restrictions
12087 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{1ad}
12088 @subsection No_Entry_Queue
12091 @geindex No_Entry_Queue
12093 [GNAT] This restriction is a declaration that any protected entry compiled in
12094 the scope of the restriction has at most one task waiting on the entry
12095 at any one time, and so no queue is required.  This restriction is not
12096 checked at compile time.  A program execution is erroneous if an attempt
12097 is made to queue a second task on such an entry.
12099 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
12100 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{1ae}
12101 @subsection No_Implementation_Aspect_Specifications
12104 @geindex No_Implementation_Aspect_Specifications
12106 [RM 13.12.1] This restriction checks at compile time that no
12107 GNAT-defined aspects are present.  With this restriction, the only
12108 aspects that can be used are those defined in the Ada Reference Manual.
12110 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
12111 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{1af}
12112 @subsection No_Implementation_Attributes
12115 @geindex No_Implementation_Attributes
12117 [RM 13.12.1] This restriction checks at compile time that no
12118 GNAT-defined attributes are present.  With this restriction, the only
12119 attributes that can be used are those defined in the Ada Reference
12120 Manual.
12122 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
12123 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{1b0}
12124 @subsection No_Implementation_Identifiers
12127 @geindex No_Implementation_Identifiers
12129 [RM 13.12.1] This restriction checks at compile time that no
12130 implementation-defined identifiers (marked with pragma Implementation_Defined)
12131 occur within language-defined packages.
12133 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
12134 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{1b1}
12135 @subsection No_Implementation_Pragmas
12138 @geindex No_Implementation_Pragmas
12140 [RM 13.12.1] This restriction checks at compile time that no
12141 GNAT-defined pragmas are present.  With this restriction, the only
12142 pragmas that can be used are those defined in the Ada Reference Manual.
12144 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
12145 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{1b2}
12146 @subsection No_Implementation_Restrictions
12149 @geindex No_Implementation_Restrictions
12151 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
12152 identifiers (other than @cite{No_Implementation_Restrictions} itself)
12153 are present.  With this restriction, the only other restriction identifiers
12154 that can be used are those defined in the Ada Reference Manual.
12156 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
12157 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{1b3}
12158 @subsection No_Implementation_Units
12161 @geindex No_Implementation_Units
12163 [RM 13.12.1] This restriction checks at compile time that there is no
12164 mention in the context clause of any implementation-defined descendants
12165 of packages Ada, Interfaces, or System.
12167 @node No_Implicit_Aliasing,No_Obsolescent_Features,No_Implementation_Units,Program Unit Level Restrictions
12168 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{1b4}
12169 @subsection No_Implicit_Aliasing
12172 @geindex No_Implicit_Aliasing
12174 [GNAT] This restriction, which is not required to be partition-wide consistent,
12175 requires an explicit aliased keyword for an object to which 'Access,
12176 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
12177 the 'Unrestricted_Access attribute for objects. Note: the reason that
12178 Unrestricted_Access is forbidden is that it would require the prefix
12179 to be aliased, and in such cases, it can always be replaced by
12180 the standard attribute Unchecked_Access which is preferable.
12182 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Aliasing,Program Unit Level Restrictions
12183 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{1b5}
12184 @subsection No_Obsolescent_Features
12187 @geindex No_Obsolescent_Features
12189 [RM 13.12.1] This restriction checks at compile time that no obsolescent
12190 features are used, as defined in Annex J of the Ada Reference Manual.
12192 @node No_Wide_Characters,SPARK_05,No_Obsolescent_Features,Program Unit Level Restrictions
12193 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{1b6}
12194 @subsection No_Wide_Characters
12197 @geindex No_Wide_Characters
12199 [GNAT] This restriction ensures at compile time that no uses of the types
12200 @cite{Wide_Character} or @cite{Wide_String} or corresponding wide
12201 wide types
12202 appear, and that no wide or wide wide string or character literals
12203 appear in the program (that is literals representing characters not in
12204 type @cite{Character}).
12206 @node SPARK_05,,No_Wide_Characters,Program Unit Level Restrictions
12207 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{1b7}
12208 @subsection SPARK_05
12211 @geindex SPARK_05
12213 [GNAT] This restriction checks at compile time that some constructs
12214 forbidden in SPARK 2005 are not present. Error messages related to
12215 SPARK restriction have the form:
12217 @example
12218 violation of restriction "SPARK_05" at <source-location>
12219  <error message>
12220 @end example
12222 @geindex SPARK
12224 The restriction @cite{SPARK} is recognized as a
12225 synonym for @cite{SPARK_05}. This is retained for historical
12226 compatibility purposes (and an unconditional warning will be generated
12227 for its use, advising replacement by @cite{SPARK}).
12229 This is not a replacement for the semantic checks performed by the
12230 SPARK Examiner tool, as the compiler currently only deals with code,
12231 not SPARK 2005 annotations, and does not guarantee catching all
12232 cases of constructs forbidden by SPARK 2005.
12234 Thus it may well be the case that code which passes the compiler with
12235 the SPARK restriction is rejected by the SPARK Examiner, e.g. due to
12236 the different visibility rules of the Examiner based on SPARK 2005
12237 @cite{inherit} annotations.
12239 This restriction can be useful in providing an initial filter for code
12240 developed using SPARK 2005, or in examining legacy code to see how far
12241 it is from meeting SPARK restrictions.
12243 The list below summarizes the checks that are performed when this
12244 restriction is in force:
12247 @itemize *
12249 @item 
12250 No block statements
12252 @item 
12253 No case statements with only an others clause
12255 @item 
12256 Exit statements in loops must respect the SPARK 2005 language restrictions
12258 @item 
12259 No goto statements
12261 @item 
12262 Return can only appear as last statement in function
12264 @item 
12265 Function must have return statement
12267 @item 
12268 Loop parameter specification must include subtype mark
12270 @item 
12271 Prefix of expanded name cannot be a loop statement
12273 @item 
12274 Abstract subprogram not allowed
12276 @item 
12277 User-defined operators not allowed
12279 @item 
12280 Access type parameters not allowed
12282 @item 
12283 Default expressions for parameters not allowed
12285 @item 
12286 Default expressions for record fields not allowed
12288 @item 
12289 No tasking constructs allowed
12291 @item 
12292 Label needed at end of subprograms and packages
12294 @item 
12295 No mixing of positional and named parameter association
12297 @item 
12298 No access types as result type
12300 @item 
12301 No unconstrained arrays as result types
12303 @item 
12304 No null procedures
12306 @item 
12307 Initial and later declarations must be in correct order (declaration can't come after body)
12309 @item 
12310 No attributes on private types if full declaration not visible
12312 @item 
12313 No package declaration within package specification
12315 @item 
12316 No controlled types
12318 @item 
12319 No discriminant types
12321 @item 
12322 No overloading
12324 @item 
12325 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
12327 @item 
12328 Access attribute not allowed
12330 @item 
12331 Allocator not allowed
12333 @item 
12334 Result of catenation must be String
12336 @item 
12337 Operands of catenation must be string literal, static char or another catenation
12339 @item 
12340 No conditional expressions
12342 @item 
12343 No explicit dereference
12345 @item 
12346 Quantified expression not allowed
12348 @item 
12349 Slicing not allowed
12351 @item 
12352 No exception renaming
12354 @item 
12355 No generic renaming
12357 @item 
12358 No object renaming
12360 @item 
12361 No use clause
12363 @item 
12364 Aggregates must be qualified
12366 @item 
12367 Non-static choice in array aggregates not allowed
12369 @item 
12370 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
12372 @item 
12373 No mixing of positional and named association in aggregate, no multi choice
12375 @item 
12376 AND, OR and XOR for arrays only allowed when operands have same static bounds
12378 @item 
12379 Fixed point operands to * or / must be qualified or converted
12381 @item 
12382 Comparison operators not allowed for Booleans or arrays (except strings)
12384 @item 
12385 Equality not allowed for arrays with non-matching static bounds (except strings)
12387 @item 
12388 Conversion / qualification not allowed for arrays with non-matching static bounds
12390 @item 
12391 Subprogram declaration only allowed in package spec (unless followed by import)
12393 @item 
12394 Access types not allowed
12396 @item 
12397 Incomplete type declaration not allowed
12399 @item 
12400 Object and subtype declarations must respect SPARK restrictions
12402 @item 
12403 Digits or delta constraint not allowed
12405 @item 
12406 Decimal fixed point type not allowed
12408 @item 
12409 Aliasing of objects not allowed
12411 @item 
12412 Modular type modulus must be power of 2
12414 @item 
12415 Base not allowed on subtype mark
12417 @item 
12418 Unary operators not allowed on modular types (except not)
12420 @item 
12421 Untagged record cannot be null
12423 @item 
12424 No class-wide operations
12426 @item 
12427 Initialization expressions must respect SPARK restrictions
12429 @item 
12430 Non-static ranges not allowed except in iteration schemes
12432 @item 
12433 String subtypes must have lower bound of 1
12435 @item 
12436 Subtype of Boolean cannot have constraint
12438 @item 
12439 At most one tagged type or extension per package
12441 @item 
12442 Interface is not allowed
12444 @item 
12445 Character literal cannot be prefixed (selector name cannot be character literal)
12447 @item 
12448 Record aggregate cannot contain 'others'
12450 @item 
12451 Component association in record aggregate must contain a single choice
12453 @item 
12454 Ancestor part cannot be a type mark
12456 @item 
12457 Attributes 'Image, 'Width and 'Value not allowed
12459 @item 
12460 Functions may not update globals
12462 @item 
12463 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
12465 @item 
12466 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
12467 @end itemize
12469 The following restrictions are enforced, but note that they are actually more
12470 strict that the latest SPARK 2005 language definition:
12473 @itemize *
12475 @item 
12476 No derived types other than tagged type extensions
12478 @item 
12479 Subtype of unconstrained array must have constraint
12480 @end itemize
12482 This list summarises the main SPARK 2005 language rules that are not
12483 currently checked by the SPARK_05 restriction:
12486 @itemize *
12488 @item 
12489 SPARK annotations are treated as comments so are not checked at all
12491 @item 
12492 Based real literals not allowed
12494 @item 
12495 Objects cannot be initialized at declaration by calls to user-defined functions
12497 @item 
12498 Objects cannot be initialized at declaration by assignments from variables
12500 @item 
12501 Objects cannot be initialized at declaration by assignments from indexed/selected components
12503 @item 
12504 Ranges shall not be null
12506 @item 
12507 A fixed point delta expression must be a simple expression
12509 @item 
12510 Restrictions on where renaming declarations may be placed
12512 @item 
12513 Externals of mode 'out' cannot be referenced
12515 @item 
12516 Externals of mode 'in' cannot be updated
12518 @item 
12519 Loop with no iteration scheme or exits only allowed as last statement in main program or task
12521 @item 
12522 Subprogram cannot have parent unit name
12524 @item 
12525 SPARK 2005 inherited subprogram must be prefixed with overriding
12527 @item 
12528 External variables (or functions that reference them) may not be passed as actual parameters
12530 @item 
12531 Globals must be explicitly mentioned in contract
12533 @item 
12534 Deferred constants cannot be completed by pragma Import
12536 @item 
12537 Package initialization cannot read/write variables from other packages
12539 @item 
12540 Prefix not allowed for entities that are directly visible
12542 @item 
12543 Identifier declaration can't override inherited package name
12545 @item 
12546 Cannot use Standard or other predefined packages as identifiers
12548 @item 
12549 After renaming, cannot use the original name
12551 @item 
12552 Subprograms can only be renamed to remove package prefix
12554 @item 
12555 Pragma import must be immediately after entity it names
12557 @item 
12558 No mutual recursion between multiple units (this can be checked with gnatcheck)
12559 @end itemize
12561 Note that if a unit is compiled in Ada 95 mode with the SPARK restriction,
12562 violations will be reported for constructs forbidden in SPARK 95,
12563 instead of SPARK 2005.
12565 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
12566 @anchor{gnat_rm/implementation_advice doc}@anchor{1b8}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{1b9}
12567 @chapter Implementation Advice
12570 The main text of the Ada Reference Manual describes the required
12571 behavior of all Ada compilers, and the GNAT compiler conforms to
12572 these requirements.
12574 In addition, there are sections throughout the Ada Reference Manual headed
12575 by the phrase 'Implementation advice'.  These sections are not normative,
12576 i.e., they do not specify requirements that all compilers must
12577 follow.  Rather they provide advice on generally desirable behavior.
12578 They are not requirements, because they describe behavior that cannot
12579 be provided on all systems, or may be undesirable on some systems.
12581 As far as practical, GNAT follows the implementation advice in
12582 the Ada Reference Manual.  Each such RM section corresponds to a section
12583 in this chapter whose title specifies the
12584 RM section number and paragraph number and the subject of
12585 the advice.  The contents of each section consists of the RM text within
12586 quotation marks,
12587 followed by the GNAT interpretation of the advice.  Most often, this simply says
12588 'followed', which means that GNAT follows the advice.  However, in a
12589 number of cases, GNAT deliberately deviates from this advice, in which
12590 case the text describes what GNAT does and why.
12592 @geindex Error detection
12594 @menu
12595 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
12596 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
12597 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
12598 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
12599 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
12600 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
12601 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
12602 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
12603 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
12604 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
12605 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
12606 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
12607 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
12608 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
12609 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
12610 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
12611 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
12612 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
12613 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
12614 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
12615 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
12616 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
12617 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
12618 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
12619 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
12620 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
12621 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
12622 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
12623 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
12624 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
12625 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
12626 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
12627 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
12628 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
12629 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
12630 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
12631 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
12632 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
12633 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
12634 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
12635 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
12636 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
12637 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
12638 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
12639 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
12640 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
12641 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
12642 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
12643 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
12644 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
12645 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
12646 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
12647 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
12648 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
12649 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
12650 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
12651 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
12652 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
12653 * RM G; Numerics: RM G Numerics. 
12654 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
12655 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
12656 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
12657 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
12658 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
12660 @end menu
12662 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
12663 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{1ba}
12664 @section RM 1.1.3(20): Error Detection
12667 @quotation
12669 "If an implementation detects the use of an unsupported Specialized Needs
12670 Annex feature at run time, it should raise @cite{Program_Error} if
12671 feasible."
12672 @end quotation
12674 Not relevant.  All specialized needs annex features are either supported,
12675 or diagnosed at compile time.
12677 @geindex Child Units
12679 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
12680 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{1bb}
12681 @section RM 1.1.3(31): Child Units
12684 @quotation
12686 "If an implementation wishes to provide implementation-defined
12687 extensions to the functionality of a language-defined library unit, it
12688 should normally do so by adding children to the library unit."
12689 @end quotation
12691 Followed.
12693 @geindex Bounded errors
12695 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
12696 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{1bc}
12697 @section RM 1.1.5(12): Bounded Errors
12700 @quotation
12702 "If an implementation detects a bounded error or erroneous
12703 execution, it should raise @cite{Program_Error}."
12704 @end quotation
12706 Followed in all cases in which the implementation detects a bounded
12707 error or erroneous execution.  Not all such situations are detected at
12708 runtime.
12710 @geindex Pragmas
12712 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
12713 @anchor{gnat_rm/implementation_advice id2}@anchor{1bd}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{1be}
12714 @section RM 2.8(16): Pragmas
12717 @quotation
12719 "Normally, implementation-defined pragmas should have no semantic effect
12720 for error-free programs; that is, if the implementation-defined pragmas
12721 are removed from a working program, the program should still be legal,
12722 and should still have the same semantics."
12723 @end quotation
12725 The following implementation defined pragmas are exceptions to this
12726 rule:
12729 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
12730 @headitem
12732 Pragma
12734 @tab
12736 Explanation
12738 @item
12740 @emph{Abort_Defer}
12742 @tab
12744 Affects semantics
12746 @item
12748 @emph{Ada_83}
12750 @tab
12752 Affects legality
12754 @item
12756 @emph{Assert}
12758 @tab
12760 Affects semantics
12762 @item
12764 @emph{CPP_Class}
12766 @tab
12768 Affects semantics
12770 @item
12772 @emph{CPP_Constructor}
12774 @tab
12776 Affects semantics
12778 @item
12780 @emph{Debug}
12782 @tab
12784 Affects semantics
12786 @item
12788 @emph{Interface_Name}
12790 @tab
12792 Affects semantics
12794 @item
12796 @emph{Machine_Attribute}
12798 @tab
12800 Affects semantics
12802 @item
12804 @emph{Unimplemented_Unit}
12806 @tab
12808 Affects legality
12810 @item
12812 @emph{Unchecked_Union}
12814 @tab
12816 Affects semantics
12818 @end multitable
12821 In each of the above cases, it is essential to the purpose of the pragma
12822 that this advice not be followed.  For details see
12823 @ref{7,,Implementation Defined Pragmas}.
12825 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
12826 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{1bf}
12827 @section RM 2.8(17-19): Pragmas
12830 @quotation
12832 "Normally, an implementation should not define pragmas that can
12833 make an illegal program legal, except as follows:
12836 @itemize *
12838 @item 
12839 A pragma used to complete a declaration, such as a pragma @cite{Import};
12841 @item 
12842 A pragma used to configure the environment by adding, removing, or
12843 replacing @cite{library_items}."
12844 @end itemize
12845 @end quotation
12847 See @ref{1be,,RM 2.8(16); Pragmas}.
12849 @geindex Character Sets
12851 @geindex Alternative Character Sets
12853 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
12854 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{1c0}
12855 @section RM 3.5.2(5): Alternative Character Sets
12858 @quotation
12860 "If an implementation supports a mode with alternative interpretations
12861 for @cite{Character} and @cite{Wide_Character}, the set of graphic
12862 characters of @cite{Character} should nevertheless remain a proper
12863 subset of the set of graphic characters of @cite{Wide_Character}.  Any
12864 character set 'localizations' should be reflected in the results of
12865 the subprograms defined in the language-defined package
12866 @cite{Characters.Handling} (see A.3) available in such a mode.  In a mode with
12867 an alternative interpretation of @cite{Character}, the implementation should
12868 also support a corresponding change in what is a legal
12869 @cite{identifier_letter}."
12870 @end quotation
12872 Not all wide character modes follow this advice, in particular the JIS
12873 and IEC modes reflect standard usage in Japan, and in these encoding,
12874 the upper half of the Latin-1 set is not part of the wide-character
12875 subset, since the most significant bit is used for wide character
12876 encoding.  However, this only applies to the external forms.  Internally
12877 there is no such restriction.
12879 @geindex Integer types
12881 @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
12882 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{1c1}
12883 @section RM 3.5.4(28): Integer Types
12886 @quotation
12888 "An implementation should support @cite{Long_Integer} in addition to
12889 @cite{Integer} if the target machine supports 32-bit (or longer)
12890 arithmetic.  No other named integer subtypes are recommended for package
12891 @cite{Standard}.  Instead, appropriate named integer subtypes should be
12892 provided in the library package @cite{Interfaces} (see B.2)."
12893 @end quotation
12895 @cite{Long_Integer} is supported.  Other standard integer types are supported
12896 so this advice is not fully followed.  These types
12897 are supported for convenient interface to C, and so that all hardware
12898 types of the machine are easily available.
12900 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
12901 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{1c2}
12902 @section RM 3.5.4(29): Integer Types
12905 @quotation
12907 "An implementation for a two's complement machine should support
12908 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
12909 implementation should support a non-binary modules up to @cite{Integer'Last}."
12910 @end quotation
12912 Followed.
12914 @geindex Enumeration values
12916 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
12917 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{1c3}
12918 @section RM 3.5.5(8): Enumeration Values
12921 @quotation
12923 "For the evaluation of a call on @code{S'Pos} for an enumeration
12924 subtype, if the value of the operand does not correspond to the internal
12925 code for any enumeration literal of its type (perhaps due to an
12926 un-initialized variable), then the implementation should raise
12927 @cite{Program_Error}.  This is particularly important for enumeration
12928 types with noncontiguous internal codes specified by an
12929 enumeration_representation_clause."
12930 @end quotation
12932 Followed.
12934 @geindex Float types
12936 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
12937 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{1c4}
12938 @section RM 3.5.7(17): Float Types
12941 @quotation
12943 "An implementation should support @cite{Long_Float} in addition to
12944 @cite{Float} if the target machine supports 11 or more digits of
12945 precision.  No other named floating point subtypes are recommended for
12946 package @cite{Standard}.  Instead, appropriate named floating point subtypes
12947 should be provided in the library package @cite{Interfaces} (see B.2)."
12948 @end quotation
12950 @cite{Short_Float} and @cite{Long_Long_Float} are also provided.  The
12951 former provides improved compatibility with other implementations
12952 supporting this type.  The latter corresponds to the highest precision
12953 floating-point type supported by the hardware.  On most machines, this
12954 will be the same as @cite{Long_Float}, but on some machines, it will
12955 correspond to the IEEE extended form.  The notable case is all ia32
12956 (x86) implementations, where @cite{Long_Long_Float} corresponds to
12957 the 80-bit extended precision format supported in hardware on this
12958 processor.  Note that the 128-bit format on SPARC is not supported,
12959 since this is a software rather than a hardware format.
12961 @geindex Multidimensional arrays
12963 @geindex Arrays
12964 @geindex multidimensional
12966 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
12967 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{1c5}
12968 @section RM 3.6.2(11): Multidimensional Arrays
12971 @quotation
12973 "An implementation should normally represent multidimensional arrays in
12974 row-major order, consistent with the notation used for multidimensional
12975 array aggregates (see 4.3.3).  However, if a pragma @cite{Convention}
12976 (@cite{Fortran}, ...) applies to a multidimensional array type, then
12977 column-major order should be used instead (see B.5, @cite{Interfacing with Fortran})."
12978 @end quotation
12980 Followed.
12982 @geindex Duration'Small
12984 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
12985 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{1c6}
12986 @section RM 9.6(30-31): Duration'Small
12989 @quotation
12991 "Whenever possible in an implementation, the value of @cite{Duration'Small}
12992 should be no greater than 100 microseconds."
12993 @end quotation
12995 Followed.  (@cite{Duration'Small} = 10**(-9)).
12997 @quotation
12999 "The time base for @cite{delay_relative_statements} should be monotonic;
13000 it need not be the same time base as used for @cite{Calendar.Clock}."
13001 @end quotation
13003 Followed.
13005 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
13006 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{1c7}
13007 @section RM 10.2.1(12): Consistent Representation
13010 @quotation
13012 "In an implementation, a type declared in a pre-elaborated package should
13013 have the same representation in every elaboration of a given version of
13014 the package, whether the elaborations occur in distinct executions of
13015 the same program, or in executions of distinct programs or partitions
13016 that include the given version."
13017 @end quotation
13019 Followed, except in the case of tagged types.  Tagged types involve
13020 implicit pointers to a local copy of a dispatch table, and these pointers
13021 have representations which thus depend on a particular elaboration of the
13022 package.  It is not easy to see how it would be possible to follow this
13023 advice without severely impacting efficiency of execution.
13025 @geindex Exception information
13027 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
13028 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{1c8}
13029 @section RM 11.4.1(19): Exception Information
13032 @quotation
13034 "@cite{Exception_Message} by default and @cite{Exception_Information}
13035 should produce information useful for
13036 debugging.  @cite{Exception_Message} should be short, about one
13037 line.  @cite{Exception_Information} can be long.  @cite{Exception_Message}
13038 should not include the
13039 @cite{Exception_Name}.  @cite{Exception_Information} should include both
13040 the @cite{Exception_Name} and the @cite{Exception_Message}."
13041 @end quotation
13043 Followed.  For each exception that doesn't have a specified
13044 @cite{Exception_Message}, the compiler generates one containing the location
13045 of the raise statement.  This location has the form 'file_name:line', where
13046 file_name is the short file name (without path information) and line is the line
13047 number in the file.  Note that in the case of the Zero Cost Exception
13048 mechanism, these messages become redundant with the Exception_Information that
13049 contains a full backtrace of the calling sequence, so they are disabled.
13050 To disable explicitly the generation of the source location message, use the
13051 Pragma @cite{Discard_Names}.
13053 @geindex Suppression of checks
13055 @geindex Checks
13056 @geindex suppression of
13058 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
13059 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{1c9}
13060 @section RM 11.5(28): Suppression of Checks
13063 @quotation
13065 "The implementation should minimize the code executed for checks that
13066 have been suppressed."
13067 @end quotation
13069 Followed.
13071 @geindex Representation clauses
13073 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
13074 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{1ca}
13075 @section RM 13.1 (21-24): Representation Clauses
13078 @quotation
13080 "The recommended level of support for all representation items is
13081 qualified as follows:
13083 An implementation need not support representation items containing
13084 non-static expressions, except that an implementation should support a
13085 representation item for a given entity if each non-static expression in
13086 the representation item is a name that statically denotes a constant
13087 declared before the entity."
13088 @end quotation
13090 Followed.  In fact, GNAT goes beyond the recommended level of support
13091 by allowing nonstatic expressions in some representation clauses even
13092 without the need to declare constants initialized with the values of
13093 such expressions.
13094 For example:
13096 @example
13097   X : Integer;
13098   Y : Float;
13099   for Y'Address use X'Address;>>
13102 "An implementation need not support a specification for the `Size`
13103 for a given composite subtype, nor the size or storage place for an
13104 object (including a component) of a given composite subtype, unless the
13105 constraints on the subtype and its composite subcomponents (if any) are
13106 all static constraints."
13107 @end example
13109 Followed.  Size Clauses are not permitted on non-static components, as
13110 described above.
13112 @quotation
13114 "An aliased component, or a component whose type is by-reference, should
13115 always be allocated at an addressable location."
13116 @end quotation
13118 Followed.
13120 @geindex Packed types
13122 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
13123 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{1cb}
13124 @section RM 13.2(6-8): Packed Types
13127 @quotation
13129 "If a type is packed, then the implementation should try to minimize
13130 storage allocated to objects of the type, possibly at the expense of
13131 speed of accessing components, subject to reasonable complexity in
13132 addressing calculations.
13134 The recommended level of support pragma @cite{Pack} is:
13136 For a packed record type, the components should be packed as tightly as
13137 possible subject to the Sizes of the component subtypes, and subject to
13138 any @cite{record_representation_clause} that applies to the type; the
13139 implementation may, but need not, reorder components or cross aligned
13140 word boundaries to improve the packing.  A component whose @cite{Size} is
13141 greater than the word size may be allocated an integral number of words."
13142 @end quotation
13144 Followed.  Tight packing of arrays is supported for all component sizes
13145 up to 64-bits. If the array component size is 1 (that is to say, if
13146 the component is a boolean type or an enumeration type with two values)
13147 then values of the type are implicitly initialized to zero. This
13148 happens both for objects of the packed type, and for objects that have a
13149 subcomponent of the packed type.
13151 @quotation
13153 "An implementation should support Address clauses for imported
13154 subprograms."
13155 @end quotation
13157 Followed.
13159 @geindex Address clauses
13161 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
13162 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{1cc}
13163 @section RM 13.3(14-19): Address Clauses
13166 @quotation
13168 "For an array @cite{X}, @code{X'Address} should point at the first
13169 component of the array, and not at the array bounds."
13170 @end quotation
13172 Followed.
13174 @quotation
13176 "The recommended level of support for the @cite{Address} attribute is:
13178 @code{X'Address} should produce a useful result if @cite{X} is an
13179 object that is aliased or of a by-reference type, or is an entity whose
13180 @cite{Address} has been specified."
13181 @end quotation
13183 Followed.  A valid address will be produced even if none of those
13184 conditions have been met.  If necessary, the object is forced into
13185 memory to ensure the address is valid.
13187 @quotation
13189 "An implementation should support @cite{Address} clauses for imported
13190 subprograms."
13191 @end quotation
13193 Followed.
13195 @quotation
13197 "Objects (including subcomponents) that are aliased or of a by-reference
13198 type should be allocated on storage element boundaries."
13199 @end quotation
13201 Followed.
13203 @quotation
13205 "If the @cite{Address} of an object is specified, or it is imported or exported,
13206 then the implementation should not perform optimizations based on
13207 assumptions of no aliases."
13208 @end quotation
13210 Followed.
13212 @geindex Alignment clauses
13214 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
13215 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{1cd}
13216 @section RM 13.3(29-35): Alignment Clauses
13219 @quotation
13221 "The recommended level of support for the @cite{Alignment} attribute for
13222 subtypes is:
13224 An implementation should support specified Alignments that are factors
13225 and multiples of the number of storage elements per word, subject to the
13226 following:"
13227 @end quotation
13229 Followed.
13231 @quotation
13233 "An implementation need not support specified Alignments for
13234 combinations of Sizes and Alignments that cannot be easily
13235 loaded and stored by available machine instructions."
13236 @end quotation
13238 Followed.
13240 @quotation
13242 "An implementation need not support specified Alignments that are
13243 greater than the maximum @cite{Alignment} the implementation ever returns by
13244 default."
13245 @end quotation
13247 Followed.
13249 @quotation
13251 "The recommended level of support for the @cite{Alignment} attribute for
13252 objects is:
13254 Same as above, for subtypes, but in addition:"
13255 @end quotation
13257 Followed.
13259 @quotation
13261 "For stand-alone library-level objects of statically constrained
13262 subtypes, the implementation should support all alignments
13263 supported by the target linker.  For example, page alignment is likely to
13264 be supported for such objects, but not for subtypes."
13265 @end quotation
13267 Followed.
13269 @geindex Size clauses
13271 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
13272 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{1ce}
13273 @section RM 13.3(42-43): Size Clauses
13276 @quotation
13278 "The recommended level of support for the @cite{Size} attribute of
13279 objects is:
13281 A @cite{Size} clause should be supported for an object if the specified
13282 @cite{Size} is at least as large as its subtype's @cite{Size}, and
13283 corresponds to a size in storage elements that is a multiple of the
13284 object's @cite{Alignment} (if the @cite{Alignment} is nonzero)."
13285 @end quotation
13287 Followed.
13289 @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
13290 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{1cf}
13291 @section RM 13.3(50-56): Size Clauses
13294 @quotation
13296 "If the @cite{Size} of a subtype is specified, and allows for efficient
13297 independent addressability (see 9.10) on the target architecture, then
13298 the @cite{Size} of the following objects of the subtype should equal the
13299 @cite{Size} of the subtype:
13301 Aliased objects (including components)."
13302 @end quotation
13304 Followed.
13306 @quotation
13308 "@cite{Size} clause on a composite subtype should not affect the
13309 internal layout of components."
13310 @end quotation
13312 Followed. But note that this can be overridden by use of the implementation
13313 pragma Implicit_Packing in the case of packed arrays.
13315 @quotation
13317 "The recommended level of support for the @cite{Size} attribute of subtypes is:
13319 The @cite{Size} (if not specified) of a static discrete or fixed point
13320 subtype should be the number of bits needed to represent each value
13321 belonging to the subtype using an unbiased representation, leaving space
13322 for a sign bit only if the subtype contains negative values.  If such a
13323 subtype is a first subtype, then an implementation should support a
13324 specified @cite{Size} for it that reflects this representation."
13325 @end quotation
13327 Followed.
13329 @quotation
13331 "For a subtype implemented with levels of indirection, the @cite{Size}
13332 should include the size of the pointers, but not the size of what they
13333 point at."
13334 @end quotation
13336 Followed.
13338 @geindex Component_Size clauses
13340 @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
13341 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{1d0}
13342 @section RM 13.3(71-73): Component Size Clauses
13345 @quotation
13347 "The recommended level of support for the @cite{Component_Size}
13348 attribute is:
13350 An implementation need not support specified @cite{Component_Sizes} that are
13351 less than the @cite{Size} of the component subtype."
13352 @end quotation
13354 Followed.
13356 @quotation
13358 "An implementation should support specified Component_Sizes that
13359 are factors and multiples of the word size.  For such
13360 Component_Sizes, the array should contain no gaps between
13361 components.  For other Component_Sizes (if supported), the array
13362 should contain no gaps between components when packing is also
13363 specified; the implementation should forbid this combination in cases
13364 where it cannot support a no-gaps representation."
13365 @end quotation
13367 Followed.
13369 @geindex Enumeration representation clauses
13371 @geindex Representation clauses
13372 @geindex enumeration
13374 @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
13375 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{1d1}
13376 @section RM 13.4(9-10): Enumeration Representation Clauses
13379 @quotation
13381 "The recommended level of support for enumeration representation clauses
13384 An implementation need not support enumeration representation clauses
13385 for boolean types, but should at minimum support the internal codes in
13386 the range @cite{System.Min_Int .. System.Max_Int}."
13387 @end quotation
13389 Followed.
13391 @geindex Record representation clauses
13393 @geindex Representation clauses
13394 @geindex records
13396 @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
13397 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{1d2}
13398 @section RM 13.5.1(17-22): Record Representation Clauses
13401 @quotation
13403 "The recommended level of support for
13404 @cite{record_representation_clauses} is:
13406 An implementation should support storage places that can be extracted
13407 with a load, mask, shift sequence of machine code, and set with a load,
13408 shift, mask, store sequence, given the available machine instructions
13409 and run-time model."
13410 @end quotation
13412 Followed.
13414 @quotation
13416 "A storage place should be supported if its size is equal to the
13417 @cite{Size} of the component subtype, and it starts and ends on a
13418 boundary that obeys the @cite{Alignment} of the component subtype."
13419 @end quotation
13421 Followed.
13423 @quotation
13425 "If the default bit ordering applies to the declaration of a given type,
13426 then for a component whose subtype's @cite{Size} is less than the word
13427 size, any storage place that does not cross an aligned word boundary
13428 should be supported."
13429 @end quotation
13431 Followed.
13433 @quotation
13435 "An implementation may reserve a storage place for the tag field of a
13436 tagged type, and disallow other components from overlapping that place."
13437 @end quotation
13439 Followed.  The storage place for the tag field is the beginning of the tagged
13440 record, and its size is Address'Size.  GNAT will reject an explicit component
13441 clause for the tag field.
13443 @quotation
13445 "An implementation need not support a @cite{component_clause} for a
13446 component of an extension part if the storage place is not after the
13447 storage places of all components of the parent type, whether or not
13448 those storage places had been specified."
13449 @end quotation
13451 Followed.  The above advice on record representation clauses is followed,
13452 and all mentioned features are implemented.
13454 @geindex Storage place attributes
13456 @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
13457 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{1d3}
13458 @section RM 13.5.2(5): Storage Place Attributes
13461 @quotation
13463 "If a component is represented using some form of pointer (such as an
13464 offset) to the actual data of the component, and this data is contiguous
13465 with the rest of the object, then the storage place attributes should
13466 reflect the place of the actual data, not the pointer.  If a component is
13467 allocated discontinuously from the rest of the object, then a warning
13468 should be generated upon reference to one of its storage place
13469 attributes."
13470 @end quotation
13472 Followed.  There are no such components in GNAT.
13474 @geindex Bit ordering
13476 @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
13477 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{1d4}
13478 @section RM 13.5.3(7-8): Bit Ordering
13481 @quotation
13483 "The recommended level of support for the non-default bit ordering is:
13485 If @cite{Word_Size} = @cite{Storage_Unit}, then the implementation
13486 should support the non-default bit ordering in addition to the default
13487 bit ordering."
13488 @end quotation
13490 Followed.  Word size does not equal storage size in this implementation.
13491 Thus non-default bit ordering is not supported.
13493 @geindex Address
13494 @geindex as private type
13496 @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
13497 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{1d5}
13498 @section RM 13.7(37): Address as Private
13501 @quotation
13503 "@cite{Address} should be of a private type."
13504 @end quotation
13506 Followed.
13508 @geindex Operations
13509 @geindex on `Address`
13511 @geindex Address
13512 @geindex operations of
13514 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
13515 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{1d6}
13516 @section RM 13.7.1(16): Address Operations
13519 @quotation
13521 "Operations in @cite{System} and its children should reflect the target
13522 environment semantics as closely as is reasonable.  For example, on most
13523 machines, it makes sense for address arithmetic to 'wrap around'.
13524 Operations that do not make sense should raise @cite{Program_Error}."
13525 @end quotation
13527 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
13528 operation raises @cite{Program_Error}, since all operations make sense.
13530 @geindex Unchecked conversion
13532 @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
13533 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{1d7}
13534 @section RM 13.9(14-17): Unchecked Conversion
13537 @quotation
13539 "The @cite{Size} of an array object should not include its bounds; hence,
13540 the bounds should not be part of the converted data."
13541 @end quotation
13543 Followed.
13545 @quotation
13547 "The implementation should not generate unnecessary run-time checks to
13548 ensure that the representation of @cite{S} is a representation of the
13549 target type.  It should take advantage of the permission to return by
13550 reference when possible.  Restrictions on unchecked conversions should be
13551 avoided unless required by the target environment."
13552 @end quotation
13554 Followed.  There are no restrictions on unchecked conversion.  A warning is
13555 generated if the source and target types do not have the same size since
13556 the semantics in this case may be target dependent.
13558 @quotation
13560 "The recommended level of support for unchecked conversions is:
13562 Unchecked conversions should be supported and should be reversible in
13563 the cases where this clause defines the result.  To enable meaningful use
13564 of unchecked conversion, a contiguous representation should be used for
13565 elementary subtypes, for statically constrained array subtypes whose
13566 component subtype is one of the subtypes described in this paragraph,
13567 and for record subtypes without discriminants whose component subtypes
13568 are described in this paragraph."
13569 @end quotation
13571 Followed.
13573 @geindex Heap usage
13574 @geindex implicit
13576 @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
13577 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{1d8}
13578 @section RM 13.11(23-25): Implicit Heap Usage
13581 @quotation
13583 "An implementation should document any cases in which it dynamically
13584 allocates heap storage for a purpose other than the evaluation of an
13585 allocator."
13586 @end quotation
13588 Followed, the only other points at which heap storage is dynamically
13589 allocated are as follows:
13592 @itemize *
13594 @item 
13595 At initial elaboration time, to allocate dynamically sized global
13596 objects.
13598 @item 
13599 To allocate space for a task when a task is created.
13601 @item 
13602 To extend the secondary stack dynamically when needed.  The secondary
13603 stack is used for returning variable length results.
13604 @end itemize
13607 @quotation
13609 "A default (implementation-provided) storage pool for an
13610 access-to-constant type should not have overhead to support deallocation of
13611 individual objects."
13612 @end quotation
13614 Followed.
13616 @quotation
13618 "A storage pool for an anonymous access type should be created at the
13619 point of an allocator for the type, and be reclaimed when the designated
13620 object becomes inaccessible."
13621 @end quotation
13623 Followed.
13625 @geindex Unchecked deallocation
13627 @node RM 13 11 2 17 Unchecked Deallocation,RM 13 13 2 17 Stream Oriented Attributes,RM 13 11 23-25 Implicit Heap Usage,Implementation Advice
13628 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{1d9}
13629 @section RM 13.11.2(17): Unchecked Deallocation
13632 @quotation
13634 "For a standard storage pool, @cite{Free} should actually reclaim the
13635 storage."
13636 @end quotation
13638 Followed.
13640 @geindex Stream oriented attributes
13642 @node RM 13 13 2 17 Stream Oriented Attributes,RM A 1 52 Names of Predefined Numeric Types,RM 13 11 2 17 Unchecked Deallocation,Implementation Advice
13643 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{1da}
13644 @section RM 13.13.2(17): Stream Oriented Attributes
13647 @quotation
13649 "If a stream element is the same size as a storage element, then the
13650 normal in-memory representation should be used by @cite{Read} and
13651 @cite{Write} for scalar objects.  Otherwise, @cite{Read} and @cite{Write}
13652 should use the smallest number of stream elements needed to represent
13653 all values in the base range of the scalar type."
13654 @end quotation
13656 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
13657 which specifies using the size of the first subtype.
13658 However, such an implementation is based on direct binary
13659 representations and is therefore target- and endianness-dependent.
13660 To address this issue, GNAT also supplies an alternate implementation
13661 of the stream attributes @cite{Read} and @cite{Write},
13662 which uses the target-independent XDR standard representation
13663 for scalar types.
13665 @geindex XDR representation
13667 @geindex Read attribute
13669 @geindex Write attribute
13671 @geindex Stream oriented attributes
13673 The XDR implementation is provided as an alternative body of the
13674 @cite{System.Stream_Attributes} package, in the file
13675 @code{s-stratt-xdr.adb} in the GNAT library.
13676 There is no @code{s-stratt-xdr.ads} file.
13677 In order to install the XDR implementation, do the following:
13680 @itemize *
13682 @item 
13683 Replace the default implementation of the
13684 @cite{System.Stream_Attributes} package with the XDR implementation.
13685 For example on a Unix platform issue the commands:
13687 @example
13688 $ mv s-stratt.adb s-stratt-default.adb
13689 $ mv s-stratt-xdr.adb s-stratt.adb
13690 @end example
13692 @item 
13693 Rebuild the GNAT run-time library as documented in
13694 the @cite{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
13695 @end itemize
13697 @node RM A 1 52 Names of Predefined Numeric Types,RM A 3 2 49 Ada Characters Handling,RM 13 13 2 17 Stream Oriented Attributes,Implementation Advice
13698 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{1db}
13699 @section RM A.1(52): Names of Predefined Numeric Types
13702 @quotation
13704 "If an implementation provides additional named predefined integer types,
13705 then the names should end with @code{Integer} as in
13706 @code{Long_Integer}.  If an implementation provides additional named
13707 predefined floating point types, then the names should end with
13708 @code{Float} as in @code{Long_Float}."
13709 @end quotation
13711 Followed.
13713 @geindex Ada.Characters.Handling
13715 @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
13716 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{1dc}
13717 @section RM A.3.2(49): @cite{Ada.Characters.Handling}
13720 @quotation
13722 "If an implementation provides a localized definition of @cite{Character}
13723 or @cite{Wide_Character}, then the effects of the subprograms in
13724 @cite{Characters.Handling} should reflect the localizations.
13725 See also 3.5.2."
13726 @end quotation
13728 Followed.  GNAT provides no such localized definitions.
13730 @geindex Bounded-length strings
13732 @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
13733 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{1dd}
13734 @section RM A.4.4(106): Bounded-Length String Handling
13737 @quotation
13739 "Bounded string objects should not be implemented by implicit pointers
13740 and dynamic allocation."
13741 @end quotation
13743 Followed.  No implicit pointers or dynamic allocation are used.
13745 @geindex Random number generation
13747 @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
13748 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{1de}
13749 @section RM A.5.2(46-47): Random Number Generation
13752 @quotation
13754 "Any storage associated with an object of type @cite{Generator} should be
13755 reclaimed on exit from the scope of the object."
13756 @end quotation
13758 Followed.
13760 @quotation
13762 "If the generator period is sufficiently long in relation to the number
13763 of distinct initiator values, then each possible value of
13764 @cite{Initiator} passed to @cite{Reset} should initiate a sequence of
13765 random numbers that does not, in a practical sense, overlap the sequence
13766 initiated by any other value.  If this is not possible, then the mapping
13767 between initiator values and generator states should be a rapidly
13768 varying function of the initiator value."
13769 @end quotation
13771 Followed.  The generator period is sufficiently long for the first
13772 condition here to hold true.
13774 @geindex Get_Immediate
13776 @node RM A 10 7 23 Get_Immediate,RM B 1 39-41 Pragma Export,RM A 5 2 46-47 Random Number Generation,Implementation Advice
13777 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{1df}
13778 @section RM A.10.7(23): @cite{Get_Immediate}
13781 @quotation
13783 "The @cite{Get_Immediate} procedures should be implemented with
13784 unbuffered input.  For a device such as a keyboard, input should be
13785 available if a key has already been typed, whereas for a disk
13786 file, input should always be available except at end of file.  For a file
13787 associated with a keyboard-like device, any line-editing features of the
13788 underlying operating system should be disabled during the execution of
13789 @cite{Get_Immediate}."
13790 @end quotation
13792 Followed on all targets except VxWorks. For VxWorks, there is no way to
13793 provide this functionality that does not result in the input buffer being
13794 flushed before the @cite{Get_Immediate} call. A special unit
13795 @cite{Interfaces.Vxworks.IO} is provided that contains routines to enable
13796 this functionality.
13798 @geindex Export
13800 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
13801 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{1e0}
13802 @section RM B.1(39-41): Pragma @cite{Export}
13805 @quotation
13807 "If an implementation supports pragma @cite{Export} to a given language,
13808 then it should also allow the main subprogram to be written in that
13809 language.  It should support some mechanism for invoking the elaboration
13810 of the Ada library units included in the system, and for invoking the
13811 finalization of the environment task.  On typical systems, the
13812 recommended mechanism is to provide two subprograms whose link names are
13813 @cite{adainit} and @cite{adafinal}.  @cite{adainit} should contain the
13814 elaboration code for library units.  @cite{adafinal} should contain the
13815 finalization code.  These subprograms should have no effect the second
13816 and subsequent time they are called."
13817 @end quotation
13819 Followed.
13821 @quotation
13823 "Automatic elaboration of pre-elaborated packages should be
13824 provided when pragma @cite{Export} is supported."
13825 @end quotation
13827 Followed when the main program is in Ada.  If the main program is in a
13828 foreign language, then
13829 @cite{adainit} must be called to elaborate pre-elaborated
13830 packages.
13832 @quotation
13834 "For each supported convention @cite{L} other than @cite{Intrinsic}, an
13835 implementation should support @cite{Import} and @cite{Export} pragmas
13836 for objects of @cite{L}-compatible types and for subprograms, and pragma
13837 @cite{Convention} for @cite{L}-eligible types and for subprograms,
13838 presuming the other language has corresponding features.  Pragma
13839 @cite{Convention} need not be supported for scalar types."
13840 @end quotation
13842 Followed.
13844 @geindex Package Interfaces
13846 @geindex Interfaces
13848 @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
13849 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{1e1}
13850 @section RM B.2(12-13): Package @cite{Interfaces}
13853 @quotation
13855 "For each implementation-defined convention identifier, there should be a
13856 child package of package Interfaces with the corresponding name.  This
13857 package should contain any declarations that would be useful for
13858 interfacing to the language (implementation) represented by the
13859 convention.  Any declarations useful for interfacing to any language on
13860 the given hardware architecture should be provided directly in
13861 @cite{Interfaces}."
13862 @end quotation
13864 Followed.
13866 @quotation
13868 "An implementation supporting an interface to C, COBOL, or Fortran should
13869 provide the corresponding package or packages described in the following
13870 clauses."
13871 @end quotation
13873 Followed.  GNAT provides all the packages described in this section.
13875 @geindex C
13876 @geindex interfacing with
13878 @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
13879 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{1e2}
13880 @section RM B.3(63-71): Interfacing with C
13883 @quotation
13885 "An implementation should support the following interface correspondences
13886 between Ada and C."
13887 @end quotation
13889 Followed.
13891 @quotation
13893 "An Ada procedure corresponds to a void-returning C function."
13894 @end quotation
13896 Followed.
13898 @quotation
13900 "An Ada function corresponds to a non-void C function."
13901 @end quotation
13903 Followed.
13905 @quotation
13907 "An Ada @cite{in} scalar parameter is passed as a scalar argument to a C
13908 function."
13909 @end quotation
13911 Followed.
13913 @quotation
13915 "An Ada @cite{in} parameter of an access-to-object type with designated
13916 type @cite{T} is passed as a @code{t*} argument to a C function,
13917 where @code{t} is the C type corresponding to the Ada type @cite{T}."
13918 @end quotation
13920 Followed.
13922 @quotation
13924 "An Ada access @cite{T} parameter, or an Ada @cite{out} or @cite{in out}
13925 parameter of an elementary type @cite{T}, is passed as a @code{t*}
13926 argument to a C function, where @code{t} is the C type corresponding to
13927 the Ada type @cite{T}.  In the case of an elementary @cite{out} or
13928 @cite{in out} parameter, a pointer to a temporary copy is used to
13929 preserve by-copy semantics."
13930 @end quotation
13932 Followed.
13934 @quotation
13936 "An Ada parameter of a record type @cite{T}, of any mode, is passed as a
13937 @code{t*} argument to a C function, where @code{t} is the C
13938 structure corresponding to the Ada type @cite{T}."
13939 @end quotation
13941 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
13942 pragma, or Convention, or by explicitly specifying the mechanism for a given
13943 call using an extended import or export pragma.
13945 @quotation
13947 "An Ada parameter of an array type with component type @cite{T}, of any
13948 mode, is passed as a @code{t*} argument to a C function, where
13949 @code{t} is the C type corresponding to the Ada type @cite{T}."
13950 @end quotation
13952 Followed.
13954 @quotation
13956 "An Ada parameter of an access-to-subprogram type is passed as a pointer
13957 to a C function whose prototype corresponds to the designated
13958 subprogram's specification."
13959 @end quotation
13961 Followed.
13963 @geindex COBOL
13964 @geindex interfacing with
13966 @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
13967 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{1e3}
13968 @section RM B.4(95-98): Interfacing with COBOL
13971 @quotation
13973 "An Ada implementation should support the following interface
13974 correspondences between Ada and COBOL."
13975 @end quotation
13977 Followed.
13979 @quotation
13981 "An Ada access @cite{T} parameter is passed as a @code{BY REFERENCE} data item of
13982 the COBOL type corresponding to @cite{T}."
13983 @end quotation
13985 Followed.
13987 @quotation
13989 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
13990 the corresponding COBOL type."
13991 @end quotation
13993 Followed.
13995 @quotation
13997 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
13998 COBOL type corresponding to the Ada parameter type; for scalars, a local
13999 copy is used if necessary to ensure by-copy semantics."
14000 @end quotation
14002 Followed.
14004 @geindex Fortran
14005 @geindex interfacing with
14007 @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
14008 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{1e4}
14009 @section RM B.5(22-26): Interfacing with Fortran
14012 @quotation
14014 "An Ada implementation should support the following interface
14015 correspondences between Ada and Fortran:"
14016 @end quotation
14018 Followed.
14020 @quotation
14022 "An Ada procedure corresponds to a Fortran subroutine."
14023 @end quotation
14025 Followed.
14027 @quotation
14029 "An Ada function corresponds to a Fortran function."
14030 @end quotation
14032 Followed.
14034 @quotation
14036 "An Ada parameter of an elementary, array, or record type @cite{T} is
14037 passed as a @cite{T} argument to a Fortran procedure, where @cite{T} is
14038 the Fortran type corresponding to the Ada type @cite{T}, and where the
14039 INTENT attribute of the corresponding dummy argument matches the Ada
14040 formal parameter mode; the Fortran implementation's parameter passing
14041 conventions are used.  For elementary types, a local copy is used if
14042 necessary to ensure by-copy semantics."
14043 @end quotation
14045 Followed.
14047 @quotation
14049 "An Ada parameter of an access-to-subprogram type is passed as a
14050 reference to a Fortran procedure whose interface corresponds to the
14051 designated subprogram's specification."
14052 @end quotation
14054 Followed.
14056 @geindex Machine operations
14058 @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
14059 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{1e5}
14060 @section RM C.1(3-5): Access to Machine Operations
14063 @quotation
14065 "The machine code or intrinsic support should allow access to all
14066 operations normally available to assembly language programmers for the
14067 target environment, including privileged instructions, if any."
14068 @end quotation
14070 Followed.
14072 @quotation
14074 "The interfacing pragmas (see Annex B) should support interface to
14075 assembler; the default assembler should be associated with the
14076 convention identifier @cite{Assembler}."
14077 @end quotation
14079 Followed.
14081 @quotation
14083 "If an entity is exported to assembly language, then the implementation
14084 should allocate it at an addressable location, and should ensure that it
14085 is retained by the linking process, even if not otherwise referenced
14086 from the Ada code.  The implementation should assume that any call to a
14087 machine code or assembler subprogram is allowed to read or update every
14088 object that is specified as exported."
14089 @end quotation
14091 Followed.
14093 @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
14094 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{1e6}
14095 @section RM C.1(10-16): Access to Machine Operations
14098 @quotation
14100 "The implementation should ensure that little or no overhead is
14101 associated with calling intrinsic and machine-code subprograms."
14102 @end quotation
14104 Followed for both intrinsics and machine-code subprograms.
14106 @quotation
14108 "It is recommended that intrinsic subprograms be provided for convenient
14109 access to any machine operations that provide special capabilities or
14110 efficiency and that are not otherwise available through the language
14111 constructs."
14112 @end quotation
14114 Followed.  A full set of machine operation intrinsic subprograms is provided.
14116 @quotation
14118 "Atomic read-modify-write operations---e.g., test and set, compare and
14119 swap, decrement and test, enqueue/dequeue."
14120 @end quotation
14122 Followed on any target supporting such operations.
14124 @quotation
14126 "Standard numeric functions---e.g.:, sin, log."
14127 @end quotation
14129 Followed on any target supporting such operations.
14131 @quotation
14133 "String manipulation operations---e.g.:, translate and test."
14134 @end quotation
14136 Followed on any target supporting such operations.
14138 @quotation
14140 "Vector operations---e.g.:, compare vector against thresholds."
14141 @end quotation
14143 Followed on any target supporting such operations.
14145 @quotation
14147 "Direct operations on I/O ports."
14148 @end quotation
14150 Followed on any target supporting such operations.
14152 @geindex Interrupt support
14154 @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
14155 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{1e7}
14156 @section RM C.3(28): Interrupt Support
14159 @quotation
14161 "If the @cite{Ceiling_Locking} policy is not in effect, the
14162 implementation should provide means for the application to specify which
14163 interrupts are to be blocked during protected actions, if the underlying
14164 system allows for a finer-grain control of interrupt blocking."
14165 @end quotation
14167 Followed.  The underlying system does not allow for finer-grain control
14168 of interrupt blocking.
14170 @geindex Protected procedure handlers
14172 @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
14173 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{1e8}
14174 @section RM C.3.1(20-21): Protected Procedure Handlers
14177 @quotation
14179 "Whenever possible, the implementation should allow interrupt handlers to
14180 be called directly by the hardware."
14181 @end quotation
14183 Followed on any target where the underlying operating system permits
14184 such direct calls.
14186 @quotation
14188 "Whenever practical, violations of any
14189 implementation-defined restrictions should be detected before run time."
14190 @end quotation
14192 Followed.  Compile time warnings are given when possible.
14194 @geindex Package `Interrupts`
14196 @geindex Interrupts
14198 @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
14199 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{1e9}
14200 @section RM C.3.2(25): Package @cite{Interrupts}
14203 @quotation
14205 "If implementation-defined forms of interrupt handler procedures are
14206 supported, such as protected procedures with parameters, then for each
14207 such form of a handler, a type analogous to @cite{Parameterless_Handler}
14208 should be specified in a child package of @cite{Interrupts}, with the
14209 same operations as in the predefined package Interrupts."
14210 @end quotation
14212 Followed.
14214 @geindex Pre-elaboration requirements
14216 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
14217 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{1ea}
14218 @section RM C.4(14): Pre-elaboration Requirements
14221 @quotation
14223 "It is recommended that pre-elaborated packages be implemented in such a
14224 way that there should be little or no code executed at run time for the
14225 elaboration of entities not already covered by the Implementation
14226 Requirements."
14227 @end quotation
14229 Followed.  Executable code is generated in some cases, e.g., loops
14230 to initialize large arrays.
14232 @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
14233 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{1eb}
14234 @section RM C.5(8): Pragma @cite{Discard_Names}
14237 @quotation
14239 "If the pragma applies to an entity, then the implementation should
14240 reduce the amount of storage used for storing names associated with that
14241 entity."
14242 @end quotation
14244 Followed.
14246 @geindex Package Task_Attributes
14248 @geindex Task_Attributes
14250 @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
14251 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{1ec}
14252 @section RM C.7.2(30): The Package Task_Attributes
14255 @quotation
14257 "Some implementations are targeted to domains in which memory use at run
14258 time must be completely deterministic.  For such implementations, it is
14259 recommended that the storage for task attributes will be pre-allocated
14260 statically and not from the heap.  This can be accomplished by either
14261 placing restrictions on the number and the size of the task's
14262 attributes, or by using the pre-allocated storage for the first @cite{N}
14263 attribute objects, and the heap for the others.  In the latter case,
14264 @cite{N} should be documented."
14265 @end quotation
14267 Not followed.  This implementation is not targeted to such a domain.
14269 @geindex Locking Policies
14271 @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
14272 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{1ed}
14273 @section RM D.3(17): Locking Policies
14276 @quotation
14278 "The implementation should use names that end with @code{_Locking} for
14279 locking policies defined by the implementation."
14280 @end quotation
14282 Followed.  Two implementation-defined locking policies are defined,
14283 whose names (@cite{Inheritance_Locking} and
14284 @cite{Concurrent_Readers_Locking}) follow this suggestion.
14286 @geindex Entry queuing policies
14288 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
14289 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{1ee}
14290 @section RM D.4(16): Entry Queuing Policies
14293 @quotation
14295 "Names that end with @code{_Queuing} should be used
14296 for all implementation-defined queuing policies."
14297 @end quotation
14299 Followed.  No such implementation-defined queuing policies exist.
14301 @geindex Preemptive abort
14303 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
14304 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{1ef}
14305 @section RM D.6(9-10): Preemptive Abort
14308 @quotation
14310 "Even though the @cite{abort_statement} is included in the list of
14311 potentially blocking operations (see 9.5.1), it is recommended that this
14312 statement be implemented in a way that never requires the task executing
14313 the @cite{abort_statement} to block."
14314 @end quotation
14316 Followed.
14318 @quotation
14320 "On a multi-processor, the delay associated with aborting a task on
14321 another processor should be bounded; the implementation should use
14322 periodic polling, if necessary, to achieve this."
14323 @end quotation
14325 Followed.
14327 @geindex Tasking restrictions
14329 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
14330 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{1f0}
14331 @section RM D.7(21): Tasking Restrictions
14334 @quotation
14336 "When feasible, the implementation should take advantage of the specified
14337 restrictions to produce a more efficient implementation."
14338 @end quotation
14340 GNAT currently takes advantage of these restrictions by providing an optimized
14341 run time when the Ravenscar profile and the GNAT restricted run time set
14342 of restrictions are specified.  See pragma @cite{Profile (Ravenscar)} and
14343 pragma @cite{Profile (Restricted)} for more details.
14345 @geindex Time
14346 @geindex monotonic
14348 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
14349 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{1f1}
14350 @section RM D.8(47-49): Monotonic Time
14353 @quotation
14355 "When appropriate, implementations should provide configuration
14356 mechanisms to change the value of @cite{Tick}."
14357 @end quotation
14359 Such configuration mechanisms are not appropriate to this implementation
14360 and are thus not supported.
14362 @quotation
14364 "It is recommended that @cite{Calendar.Clock} and @cite{Real_Time.Clock}
14365 be implemented as transformations of the same time base."
14366 @end quotation
14368 Followed.
14370 @quotation
14372 "It is recommended that the best time base which exists in
14373 the underlying system be available to the application through
14374 @cite{Clock}.  @cite{Best} may mean highest accuracy or largest range."
14375 @end quotation
14377 Followed.
14379 @geindex Partition communication subsystem
14381 @geindex PCS
14383 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
14384 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{1f2}
14385 @section RM E.5(28-29): Partition Communication Subsystem
14388 @quotation
14390 "Whenever possible, the PCS on the called partition should allow for
14391 multiple tasks to call the RPC-receiver with different messages and
14392 should allow them to block until the corresponding subprogram body
14393 returns."
14394 @end quotation
14396 Followed by GLADE, a separately supplied PCS that can be used with
14397 GNAT.
14399 @quotation
14401 "The @cite{Write} operation on a stream of type @cite{Params_Stream_Type}
14402 should raise @cite{Storage_Error} if it runs out of space trying to
14403 write the @cite{Item} into the stream."
14404 @end quotation
14406 Followed by GLADE, a separately supplied PCS that can be used with
14407 GNAT.
14409 @geindex COBOL support
14411 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
14412 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{1f3}
14413 @section RM F(7): COBOL Support
14416 @quotation
14418 "If COBOL (respectively, C) is widely supported in the target
14419 environment, implementations supporting the Information Systems Annex
14420 should provide the child package @cite{Interfaces.COBOL} (respectively,
14421 @cite{Interfaces.C}) specified in Annex B and should support a
14422 @cite{convention_identifier} of COBOL (respectively, C) in the interfacing
14423 pragmas (see Annex B), thus allowing Ada programs to interface with
14424 programs written in that language."
14425 @end quotation
14427 Followed.
14429 @geindex Decimal radix support
14431 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
14432 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{1f4}
14433 @section RM F.1(2): Decimal Radix Support
14436 @quotation
14438 "Packed decimal should be used as the internal representation for objects
14439 of subtype @cite{S} when @cite{S}'Machine_Radix = 10."
14440 @end quotation
14442 Not followed.  GNAT ignores @cite{S}'Machine_Radix and always uses binary
14443 representations.
14445 @geindex Numerics
14447 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
14448 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{1f5}
14449 @section RM G: Numerics
14452 @quotation
14454 "If Fortran (respectively, C) is widely supported in the target
14455 environment, implementations supporting the Numerics Annex
14456 should provide the child package @cite{Interfaces.Fortran} (respectively,
14457 @cite{Interfaces.C}) specified in Annex B and should support a
14458 @cite{convention_identifier} of Fortran (respectively, C) in the interfacing
14459 pragmas (see Annex B), thus allowing Ada programs to interface with
14460 programs written in that language."
14461 @end quotation
14463 Followed.
14465 @geindex Complex types
14467 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
14468 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{1f6}
14469 @section RM G.1.1(56-58): Complex Types
14472 @quotation
14474 "Because the usual mathematical meaning of multiplication of a complex
14475 operand and a real operand is that of the scaling of both components of
14476 the former by the latter, an implementation should not perform this
14477 operation by first promoting the real operand to complex type and then
14478 performing a full complex multiplication.  In systems that, in the
14479 future, support an Ada binding to IEC 559:1989, the latter technique
14480 will not generate the required result when one of the components of the
14481 complex operand is infinite.  (Explicit multiplication of the infinite
14482 component by the zero component obtained during promotion yields a NaN
14483 that propagates into the final result.) Analogous advice applies in the
14484 case of multiplication of a complex operand and a pure-imaginary
14485 operand, and in the case of division of a complex operand by a real or
14486 pure-imaginary operand."
14487 @end quotation
14489 Not followed.
14491 @quotation
14493 "Similarly, because the usual mathematical meaning of addition of a
14494 complex operand and a real operand is that the imaginary operand remains
14495 unchanged, an implementation should not perform this operation by first
14496 promoting the real operand to complex type and then performing a full
14497 complex addition.  In implementations in which the @cite{Signed_Zeros}
14498 attribute of the component type is @cite{True} (and which therefore
14499 conform to IEC 559:1989 in regard to the handling of the sign of zero in
14500 predefined arithmetic operations), the latter technique will not
14501 generate the required result when the imaginary component of the complex
14502 operand is a negatively signed zero.  (Explicit addition of the negative
14503 zero to the zero obtained during promotion yields a positive zero.)
14504 Analogous advice applies in the case of addition of a complex operand
14505 and a pure-imaginary operand, and in the case of subtraction of a
14506 complex operand and a real or pure-imaginary operand."
14507 @end quotation
14509 Not followed.
14511 @quotation
14513 "Implementations in which @cite{Real'Signed_Zeros} is @cite{True} should
14514 attempt to provide a rational treatment of the signs of zero results and
14515 result components.  As one example, the result of the @cite{Argument}
14516 function should have the sign of the imaginary component of the
14517 parameter @cite{X} when the point represented by that parameter lies on
14518 the positive real axis; as another, the sign of the imaginary component
14519 of the @cite{Compose_From_Polar} function should be the same as
14520 (respectively, the opposite of) that of the @cite{Argument} parameter when that
14521 parameter has a value of zero and the @cite{Modulus} parameter has a
14522 nonnegative (respectively, negative) value."
14523 @end quotation
14525 Followed.
14527 @geindex Complex elementary functions
14529 @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
14530 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{1f7}
14531 @section RM G.1.2(49): Complex Elementary Functions
14534 @quotation
14536 "Implementations in which @cite{Complex_Types.Real'Signed_Zeros} is
14537 @cite{True} should attempt to provide a rational treatment of the signs
14538 of zero results and result components.  For example, many of the complex
14539 elementary functions have components that are odd functions of one of
14540 the parameter components; in these cases, the result component should
14541 have the sign of the parameter component at the origin.  Other complex
14542 elementary functions have zero components whose sign is opposite that of
14543 a parameter component at the origin, or is always positive or always
14544 negative."
14545 @end quotation
14547 Followed.
14549 @geindex Accuracy requirements
14551 @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
14552 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{1f8}
14553 @section RM G.2.4(19): Accuracy Requirements
14556 @quotation
14558 "The versions of the forward trigonometric functions without a
14559 @cite{Cycle} parameter should not be implemented by calling the
14560 corresponding version with a @cite{Cycle} parameter of
14561 @cite{2.0*Numerics.Pi}, since this will not provide the required
14562 accuracy in some portions of the domain.  For the same reason, the
14563 version of @cite{Log} without a @cite{Base} parameter should not be
14564 implemented by calling the corresponding version with a @cite{Base}
14565 parameter of @cite{Numerics.e}."
14566 @end quotation
14568 Followed.
14570 @geindex Complex arithmetic accuracy
14572 @geindex Accuracy
14573 @geindex complex arithmetic
14575 @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
14576 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{1f9}
14577 @section RM G.2.6(15): Complex Arithmetic Accuracy
14580 @quotation
14582 "The version of the @cite{Compose_From_Polar} function without a
14583 @cite{Cycle} parameter should not be implemented by calling the
14584 corresponding version with a @cite{Cycle} parameter of
14585 @cite{2.0*Numerics.Pi}, since this will not provide the required
14586 accuracy in some portions of the domain."
14587 @end quotation
14589 Followed.
14591 @geindex Sequential elaboration policy
14593 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
14594 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{1fa}
14595 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
14598 @quotation
14600 "If the partition elaboration policy is @cite{Sequential} and the
14601 Environment task becomes permanently blocked during elaboration then the
14602 partition is deadlocked and it is recommended that the partition be
14603 immediately terminated."
14604 @end quotation
14606 Not followed.
14608 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
14609 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{1fb}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{1fc}
14610 @chapter Implementation Defined Characteristics
14613 In addition to the implementation dependent pragmas and attributes, and the
14614 implementation advice, there are a number of other Ada features that are
14615 potentially implementation dependent and are designated as
14616 implementation-defined. These are mentioned throughout the Ada Reference
14617 Manual, and are summarized in Annex M.
14619 A requirement for conforming Ada compilers is that they provide
14620 documentation describing how the implementation deals with each of these
14621 issues.  In this chapter you will find each point in Annex M listed,
14622 followed by a description of how GNAT
14623 handles the implementation dependence.
14625 You can use this chapter as a guide to minimizing implementation
14626 dependent features in your programs if portability to other compilers
14627 and other operating systems is an important consideration.  The numbers
14628 in each entry below correspond to the paragraph numbers in the Ada
14629 Reference Manual.
14632 @itemize *
14634 @item 
14635 "Whether or not each recommendation given in Implementation
14636 Advice is followed.  See 1.1.2(37)."
14637 @end itemize
14639 See @ref{a,,Implementation Advice}.
14642 @itemize *
14644 @item 
14645 "Capacity limitations of the implementation.  See 1.1.3(3)."
14646 @end itemize
14648 The complexity of programs that can be processed is limited only by the
14649 total amount of available virtual memory, and disk space for the
14650 generated object files.
14653 @itemize *
14655 @item 
14656 "Variations from the standard that are impractical to avoid
14657 given the implementation's execution environment.  See 1.1.3(6)."
14658 @end itemize
14660 There are no variations from the standard.
14663 @itemize *
14665 @item 
14666 "Which code_statements cause external
14667 interactions.  See 1.1.3(10)."
14668 @end itemize
14670 Any @cite{code_statement} can potentially cause external interactions.
14673 @itemize *
14675 @item 
14676 "The coded representation for the text of an Ada
14677 program.  See 2.1(4)."
14678 @end itemize
14680 See separate section on source representation.
14683 @itemize *
14685 @item 
14686 "The control functions allowed in comments.  See 2.1(14)."
14687 @end itemize
14689 See separate section on source representation.
14692 @itemize *
14694 @item 
14695 "The representation for an end of line.  See 2.2(2)."
14696 @end itemize
14698 See separate section on source representation.
14701 @itemize *
14703 @item 
14704 "Maximum supported line length and lexical element
14705 length.  See 2.2(15)."
14706 @end itemize
14708 The maximum line length is 255 characters and the maximum length of
14709 a lexical element is also 255 characters. This is the default setting
14710 if not overridden by the use of compiler switch @emph{-gnaty} (which
14711 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
14712 line length to be specified to be any value up to 32767. The maximum
14713 length of a lexical element is the same as the maximum line length.
14716 @itemize *
14718 @item 
14719 "Implementation defined pragmas.  See 2.8(14)."
14720 @end itemize
14722 See @ref{7,,Implementation Defined Pragmas}.
14725 @itemize *
14727 @item 
14728 "Effect of pragma @cite{Optimize}.  See 2.8(27)."
14729 @end itemize
14731 Pragma @cite{Optimize}, if given with a @cite{Time} or @cite{Space}
14732 parameter, checks that the optimization flag is set, and aborts if it is
14733 not.
14736 @itemize *
14738 @item 
14739 "The sequence of characters of the value returned by
14740 @code{S'Image} when some of the graphic characters of
14741 @code{S'Wide_Image} are not defined in @cite{Character}.  See
14742 3.5(37)."
14743 @end itemize
14745 The sequence of characters is as defined by the wide character encoding
14746 method used for the source.  See section on source representation for
14747 further details.
14750 @itemize *
14752 @item 
14753 "The predefined integer types declared in
14754 @cite{Standard}.  See 3.5.4(25)."
14755 @end itemize
14758 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
14759 @headitem
14761 Type
14763 @tab
14765 Representation
14767 @item
14769 @emph{Short_Short_Integer}
14771 @tab
14773 8 bit signed
14775 @item
14777 @emph{Short_Integer}
14779 @tab
14781 (Short) 16 bit signed
14783 @item
14785 @emph{Integer}
14787 @tab
14789 32 bit signed
14791 @item
14793 @emph{Long_Integer}
14795 @tab
14797 64 bit signed (on most 64 bit targets,
14798 depending on the C definition of long).
14799 32 bit signed (all other targets)
14801 @item
14803 @emph{Long_Long_Integer}
14805 @tab
14807 64 bit signed
14809 @end multitable
14813 @itemize *
14815 @item 
14816 "Any nonstandard integer types and the operators defined
14817 for them.  See 3.5.4(26)."
14818 @end itemize
14820 There are no nonstandard integer types.
14823 @itemize *
14825 @item 
14826 "Any nonstandard real types and the operators defined for
14827 them.  See 3.5.6(8)."
14828 @end itemize
14830 There are no nonstandard real types.
14833 @itemize *
14835 @item 
14836 "What combinations of requested decimal precision and range
14837 are supported for floating point types.  See 3.5.7(7)."
14838 @end itemize
14840 The precision and range is as defined by the IEEE standard.
14843 @itemize *
14845 @item 
14846 "The predefined floating point types declared in
14847 @cite{Standard}.  See 3.5.7(16)."
14848 @end itemize
14851 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
14852 @headitem
14854 Type
14856 @tab
14858 Representation
14860 @item
14862 @emph{Short_Float}
14864 @tab
14866 32 bit IEEE short
14868 @item
14870 @emph{Float}
14872 @tab
14874 (Short) 32 bit IEEE short
14876 @item
14878 @emph{Long_Float}
14880 @tab
14882 64 bit IEEE long
14884 @item
14886 @emph{Long_Long_Float}
14888 @tab
14890 64 bit IEEE long (80 bit IEEE long on x86 processors)
14892 @end multitable
14896 @itemize *
14898 @item 
14899 "The small of an ordinary fixed point type.  See 3.5.9(8)."
14900 @end itemize
14902 @cite{Fine_Delta} is 2**(-63)
14905 @itemize *
14907 @item 
14908 "What combinations of small, range, and digits are
14909 supported for fixed point types.  See 3.5.9(10)."
14910 @end itemize
14912 Any combinations are permitted that do not result in a small less than
14913 @cite{Fine_Delta} and do not result in a mantissa larger than 63 bits.
14914 If the mantissa is larger than 53 bits on machines where Long_Long_Float
14915 is 64 bits (true of all architectures except ia32), then the output from
14916 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
14917 is because floating-point conversions are used to convert fixed point.
14920 @itemize *
14922 @item 
14923 "The result of @cite{Tags.Expanded_Name} for types declared
14924 within an unnamed @cite{block_statement}.  See 3.9(10)."
14925 @end itemize
14927 Block numbers of the form @cite{B`nnn`}, where @cite{nnn} is a
14928 decimal integer are allocated.
14931 @itemize *
14933 @item 
14934 "Implementation-defined attributes.  See 4.1.4(12)."
14935 @end itemize
14937 See @ref{8,,Implementation Defined Attributes}.
14940 @itemize *
14942 @item 
14943 "Any implementation-defined time types.  See 9.6(6)."
14944 @end itemize
14946 There are no implementation-defined time types.
14949 @itemize *
14951 @item 
14952 "The time base associated with relative delays."
14953 @end itemize
14955 See 9.6(20).  The time base used is that provided by the C library
14956 function @cite{gettimeofday}.
14959 @itemize *
14961 @item 
14962 "The time base of the type @cite{Calendar.Time}.  See
14963 9.6(23)."
14964 @end itemize
14966 The time base used is that provided by the C library function
14967 @cite{gettimeofday}.
14970 @itemize *
14972 @item 
14973 "The time zone used for package @cite{Calendar}
14974 operations.  See 9.6(24)."
14975 @end itemize
14977 The time zone used by package @cite{Calendar} is the current system time zone
14978 setting for local time, as accessed by the C library function
14979 @cite{localtime}.
14982 @itemize *
14984 @item 
14985 "Any limit on @cite{delay_until_statements} of
14986 @cite{select_statements}.  See 9.6(29)."
14987 @end itemize
14989 There are no such limits.
14992 @itemize *
14994 @item 
14995 "Whether or not two non-overlapping parts of a composite
14996 object are independently addressable, in the case where packing, record
14997 layout, or @cite{Component_Size} is specified for the object.  See
14998 9.10(1)."
14999 @end itemize
15001 Separate components are independently addressable if they do not share
15002 overlapping storage units.
15005 @itemize *
15007 @item 
15008 "The representation for a compilation.  See 10.1(2)."
15009 @end itemize
15011 A compilation is represented by a sequence of files presented to the
15012 compiler in a single invocation of the @emph{gcc} command.
15015 @itemize *
15017 @item 
15018 "Any restrictions on compilations that contain multiple
15019 compilation_units.  See 10.1(4)."
15020 @end itemize
15022 No single file can contain more than one compilation unit, but any
15023 sequence of files can be presented to the compiler as a single
15024 compilation.
15027 @itemize *
15029 @item 
15030 "The mechanisms for creating an environment and for adding
15031 and replacing compilation units.  See 10.1.4(3)."
15032 @end itemize
15034 See separate section on compilation model.
15037 @itemize *
15039 @item 
15040 "The manner of explicitly assigning library units to a
15041 partition.  See 10.2(2)."
15042 @end itemize
15044 If a unit contains an Ada main program, then the Ada units for the partition
15045 are determined by recursive application of the rules in the Ada Reference
15046 Manual section 10.2(2-6).  In other words, the Ada units will be those that
15047 are needed by the main program, and then this definition of need is applied
15048 recursively to those units, and the partition contains the transitive
15049 closure determined by this relationship.  In short, all the necessary units
15050 are included, with no need to explicitly specify the list.  If additional
15051 units are required, e.g., by foreign language units, then all units must be
15052 mentioned in the context clause of one of the needed Ada units.
15054 If the partition contains no main program, or if the main program is in
15055 a language other than Ada, then GNAT
15056 provides the binder options @emph{-z} and @emph{-n} respectively, and in
15057 this case a list of units can be explicitly supplied to the binder for
15058 inclusion in the partition (all units needed by these units will also
15059 be included automatically).  For full details on the use of these
15060 options, refer to the @cite{GNAT Make Program gnatmake} in the
15061 @cite{GNAT User's Guide}.
15064 @itemize *
15066 @item 
15067 "The implementation-defined means, if any, of specifying
15068 which compilation units are needed by a given compilation unit.  See
15069 10.2(2)."
15070 @end itemize
15072 The units needed by a given compilation unit are as defined in
15073 the Ada Reference Manual section 10.2(2-6).  There are no
15074 implementation-defined pragmas or other implementation-defined
15075 means for specifying needed units.
15078 @itemize *
15080 @item 
15081 "The manner of designating the main subprogram of a
15082 partition.  See 10.2(7)."
15083 @end itemize
15085 The main program is designated by providing the name of the
15086 corresponding @code{ALI} file as the input parameter to the binder.
15089 @itemize *
15091 @item 
15092 "The order of elaboration of @cite{library_items}.  See
15093 10.2(18)."
15094 @end itemize
15096 The first constraint on ordering is that it meets the requirements of
15097 Chapter 10 of the Ada Reference Manual.  This still leaves some
15098 implementation dependent choices, which are resolved by first
15099 elaborating bodies as early as possible (i.e., in preference to specs
15100 where there is a choice), and second by evaluating the immediate with
15101 clauses of a unit to determine the probably best choice, and
15102 third by elaborating in alphabetical order of unit names
15103 where a choice still remains.
15106 @itemize *
15108 @item 
15109 "Parameter passing and function return for the main
15110 subprogram.  See 10.2(21)."
15111 @end itemize
15113 The main program has no parameters.  It may be a procedure, or a function
15114 returning an integer type.  In the latter case, the returned integer
15115 value is the return code of the program (overriding any value that
15116 may have been set by a call to @cite{Ada.Command_Line.Set_Exit_Status}).
15119 @itemize *
15121 @item 
15122 "The mechanisms for building and running partitions.  See
15123 10.2(24)."
15124 @end itemize
15126 GNAT itself supports programs with only a single partition.  The GNATDIST
15127 tool provided with the GLADE package (which also includes an implementation
15128 of the PCS) provides a completely flexible method for building and running
15129 programs consisting of multiple partitions.  See the separate GLADE manual
15130 for details.
15133 @itemize *
15135 @item 
15136 "The details of program execution, including program
15137 termination.  See 10.2(25)."
15138 @end itemize
15140 See separate section on compilation model.
15143 @itemize *
15145 @item 
15146 "The semantics of any non-active partitions supported by the
15147 implementation.  See 10.2(28)."
15148 @end itemize
15150 Passive partitions are supported on targets where shared memory is
15151 provided by the operating system.  See the GLADE reference manual for
15152 further details.
15155 @itemize *
15157 @item 
15158 "The information returned by @cite{Exception_Message}.  See
15159 11.4.1(10)."
15160 @end itemize
15162 Exception message returns the null string unless a specific message has
15163 been passed by the program.
15166 @itemize *
15168 @item 
15169 "The result of @cite{Exceptions.Exception_Name} for types
15170 declared within an unnamed @cite{block_statement}.  See 11.4.1(12)."
15171 @end itemize
15173 Blocks have implementation defined names of the form @cite{B`nnn`}
15174 where @cite{nnn} is an integer.
15177 @itemize *
15179 @item 
15180 "The information returned by
15181 @cite{Exception_Information}.  See 11.4.1(13)."
15182 @end itemize
15184 @cite{Exception_Information} returns a string in the following format:
15186 @example
15187 *Exception_Name:* nnnnn
15188 *Message:* mmmmm
15189 *PID:* ppp
15190 *Load address:* 0xhhhh
15191 *Call stack traceback locations:*
15192 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
15193 @end example
15195 where
15197 @quotation
15200 @itemize *
15202 @item 
15203 @cite{nnnn} is the fully qualified name of the exception in all upper
15204 case letters. This line is always present.
15206 @item 
15207 @cite{mmmm} is the message (this line present only if message is non-null)
15209 @item 
15210 @cite{ppp} is the Process Id value as a decimal integer (this line is
15211 present only if the Process Id is nonzero). Currently we are
15212 not making use of this field.
15214 @item 
15215 The Load address line, the Call stack traceback locations line and the
15216 following values are present only if at least one traceback location was
15217 recorded. The Load address indicates the address at which the main executable
15218 was loaded; this line may not be present if operating system hasn't relocated
15219 the main executable. The values are given in C style format, with lower case
15220 letters for a-f, and only as many digits present as are necessary.
15221 The line terminator sequence at the end of each line, including
15222 the last line is a single @cite{LF} character (@cite{16#0A#}).
15223 @end itemize
15224 @end quotation
15227 @itemize *
15229 @item 
15230 "Implementation-defined check names.  See 11.5(27)."
15231 @end itemize
15233 The implementation defined check name Alignment_Check controls checking of
15234 address clause values for proper alignment (that is, the address supplied
15235 must be consistent with the alignment of the type).
15237 The implementation defined check name Predicate_Check controls whether
15238 predicate checks are generated.
15240 The implementation defined check name Validity_Check controls whether
15241 validity checks are generated.
15243 In addition, a user program can add implementation-defined check names
15244 by means of the pragma Check_Name.
15247 @itemize *
15249 @item 
15250 "The interpretation of each aspect of representation.  See
15251 13.1(20)."
15252 @end itemize
15254 See separate section on data representations.
15257 @itemize *
15259 @item 
15260 "Any restrictions placed upon representation items.  See
15261 13.1(20)."
15262 @end itemize
15264 See separate section on data representations.
15267 @itemize *
15269 @item 
15270 "The meaning of @cite{Size} for indefinite subtypes.  See
15271 13.3(48)."
15272 @end itemize
15274 Size for an indefinite subtype is the maximum possible size, except that
15275 for the case of a subprogram parameter, the size of the parameter object
15276 is the actual size.
15279 @itemize *
15281 @item 
15282 "The default external representation for a type tag.  See
15283 13.3(75)."
15284 @end itemize
15286 The default external representation for a type tag is the fully expanded
15287 name of the type in upper case letters.
15290 @itemize *
15292 @item 
15293 "What determines whether a compilation unit is the same in
15294 two different partitions.  See 13.3(76)."
15295 @end itemize
15297 A compilation unit is the same in two different partitions if and only
15298 if it derives from the same source file.
15301 @itemize *
15303 @item 
15304 "Implementation-defined components.  See 13.5.1(15)."
15305 @end itemize
15307 The only implementation defined component is the tag for a tagged type,
15308 which contains a pointer to the dispatching table.
15311 @itemize *
15313 @item 
15314 "If @cite{Word_Size} = @cite{Storage_Unit}, the default bit
15315 ordering.  See 13.5.3(5)."
15316 @end itemize
15318 @cite{Word_Size} (32) is not the same as @cite{Storage_Unit} (8) for this
15319 implementation, so no non-default bit ordering is supported.  The default
15320 bit ordering corresponds to the natural endianness of the target architecture.
15323 @itemize *
15325 @item 
15326 "The contents of the visible part of package @cite{System}
15327 and its language-defined children.  See 13.7(2)."
15328 @end itemize
15330 See the definition of these packages in files @code{system.ads} and
15331 @code{s-stoele.ads}. Note that two declarations are added to package
15332 System.
15334 @example
15335 Max_Priority           : constant Positive := Priority'Last;
15336 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
15337 @end example
15340 @itemize *
15342 @item 
15343 "The contents of the visible part of package
15344 @cite{System.Machine_Code}, and the meaning of
15345 @cite{code_statements}.  See 13.8(7)."
15346 @end itemize
15348 See the definition and documentation in file @code{s-maccod.ads}.
15351 @itemize *
15353 @item 
15354 "The effect of unchecked conversion.  See 13.9(11)."
15355 @end itemize
15357 Unchecked conversion between types of the same size
15358 results in an uninterpreted transmission of the bits from one type
15359 to the other.  If the types are of unequal sizes, then in the case of
15360 discrete types, a shorter source is first zero or sign extended as
15361 necessary, and a shorter target is simply truncated on the left.
15362 For all non-discrete types, the source is first copied if necessary
15363 to ensure that the alignment requirements of the target are met, then
15364 a pointer is constructed to the source value, and the result is obtained
15365 by dereferencing this pointer after converting it to be a pointer to the
15366 target type. Unchecked conversions where the target subtype is an
15367 unconstrained array are not permitted. If the target alignment is
15368 greater than the source alignment, then a copy of the result is
15369 made with appropriate alignment
15372 @itemize *
15374 @item 
15375 "The semantics of operations on invalid representations.
15376 See 13.9.2(10-11)."
15377 @end itemize
15379 For assignments and other operations where the use of invalid values cannot
15380 result in erroneous behavior, the compiler ignores the possibility of invalid
15381 values. An exception is raised at the point where an invalid value would
15382 result in erroneous behavior. For example executing:
15384 @example
15385 procedure invalidvals is
15386   X : Integer := -1;
15387   Y : Natural range 1 .. 10;
15388   for Y'Address use X'Address;
15389   Z : Natural range 1 .. 10;
15390   A : array (Natural range 1 .. 10) of Integer;
15391 begin
15392   Z := Y;     -- no exception
15393   A (Z) := 3; -- exception raised;
15394 end;
15395 @end example
15397 As indicated, an exception is raised on the array assignment, but not
15398 on the simple assignment of the invalid negative value from Y to Z.
15401 @itemize *
15403 @item 
15404 "The manner of choosing a storage pool for an access type
15405 when @cite{Storage_Pool} is not specified for the type.  See 13.11(17)."
15406 @end itemize
15408 There are 3 different standard pools used by the compiler when
15409 @cite{Storage_Pool} is not specified depending whether the type is local
15410 to a subprogram or defined at the library level and whether
15411 @cite{Storage_Size`is specified or not. See documentation in the runtime library units `System.Pool_Global}, @cite{System.Pool_Size} and
15412 @cite{System.Pool_Local} in files @code{s-poosiz.ads},
15413 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
15414 default pools used.
15417 @itemize *
15419 @item 
15420 "Whether or not the implementation provides user-accessible
15421 names for the standard pool type(s).  See 13.11(17)."
15422 @end itemize
15424 See documentation in the sources of the run time mentioned in the previous
15425 paragraph.  All these pools are accessible by means of @cite{with}'ing
15426 these units.
15429 @itemize *
15431 @item 
15432 "The meaning of @cite{Storage_Size}.  See 13.11(18)."
15433 @end itemize
15435 @cite{Storage_Size} is measured in storage units, and refers to the
15436 total space available for an access type collection, or to the primary
15437 stack space for a task.
15440 @itemize *
15442 @item 
15443 "Implementation-defined aspects of storage pools.  See
15444 13.11(22)."
15445 @end itemize
15447 See documentation in the sources of the run time mentioned in the
15448 paragraph about standard storage pools above
15449 for details on GNAT-defined aspects of storage pools.
15452 @itemize *
15454 @item 
15455 "The set of restrictions allowed in a pragma
15456 @cite{Restrictions}.  See 13.12(7)."
15457 @end itemize
15459 See @ref{9,,Standard and Implementation Defined Restrictions}.
15462 @itemize *
15464 @item 
15465 "The consequences of violating limitations on
15466 @cite{Restrictions} pragmas.  See 13.12(9)."
15467 @end itemize
15469 Restrictions that can be checked at compile time result in illegalities
15470 if violated.  Currently there are no other consequences of violating
15471 restrictions.
15474 @itemize *
15476 @item 
15477 "The representation used by the @cite{Read} and
15478 @cite{Write} attributes of elementary types in terms of stream
15479 elements.  See 13.13.2(9)."
15480 @end itemize
15482 The representation is the in-memory representation of the base type of
15483 the type, using the number of bits corresponding to the
15484 @code{type'Size} value, and the natural ordering of the machine.
15487 @itemize *
15489 @item 
15490 "The names and characteristics of the numeric subtypes
15491 declared in the visible part of package @cite{Standard}.  See A.1(3)."
15492 @end itemize
15494 See items describing the integer and floating-point types supported.
15497 @itemize *
15499 @item 
15500 "The string returned by @cite{Character_Set_Version}.
15501 See A.3.5(3)."
15502 @end itemize
15504 @cite{Ada.Wide_Characters.Handling.Character_Set_Version} returns
15505 the string "Unicode 4.0", referring to version 4.0 of the
15506 Unicode specification.
15509 @itemize *
15511 @item 
15512 "The accuracy actually achieved by the elementary
15513 functions.  See A.5.1(1)."
15514 @end itemize
15516 The elementary functions correspond to the functions available in the C
15517 library.  Only fast math mode is implemented.
15520 @itemize *
15522 @item 
15523 "The sign of a zero result from some of the operators or
15524 functions in @cite{Numerics.Generic_Elementary_Functions}, when
15525 @cite{Float_Type'Signed_Zeros} is @cite{True}.  See A.5.1(46)."
15526 @end itemize
15528 The sign of zeroes follows the requirements of the IEEE 754 standard on
15529 floating-point.
15532 @itemize *
15534 @item 
15535 "The value of
15536 @cite{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27)."
15537 @end itemize
15539 Maximum image width is 6864, see library file @code{s-rannum.ads}.
15542 @itemize *
15544 @item 
15545 "The value of
15546 @cite{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27)."
15547 @end itemize
15549 Maximum image width is 6864, see library file @code{s-rannum.ads}.
15552 @itemize *
15554 @item 
15555 "The algorithms for random number generation.  See
15556 A.5.2(32)."
15557 @end itemize
15559 The algorithm is the Mersenne Twister, as documented in the source file
15560 @code{s-rannum.adb}. This version of the algorithm has a period of
15561 2**19937-1.
15564 @itemize *
15566 @item 
15567 "The string representation of a random number generator's
15568 state.  See A.5.2(38)."
15569 @end itemize
15571 The value returned by the Image function is the concatenation of
15572 the fixed-width decimal representations of the 624 32-bit integers
15573 of the state vector.
15576 @itemize *
15578 @item 
15579 "The minimum time interval between calls to the
15580 time-dependent Reset procedure that are guaranteed to initiate different
15581 random number sequences.  See A.5.2(45)."
15582 @end itemize
15584 The minimum period between reset calls to guarantee distinct series of
15585 random numbers is one microsecond.
15588 @itemize *
15590 @item 
15591 "The values of the @cite{Model_Mantissa},
15592 @cite{Model_Emin}, @cite{Model_Epsilon}, @cite{Model},
15593 @cite{Safe_First}, and @cite{Safe_Last} attributes, if the Numerics
15594 Annex is not supported.  See A.5.3(72)."
15595 @end itemize
15597 Run the compiler with @emph{-gnatS} to produce a listing of package
15598 @cite{Standard}, has the values of all numeric attributes.
15601 @itemize *
15603 @item 
15604 "Any implementation-defined characteristics of the
15605 input-output packages.  See A.7(14)."
15606 @end itemize
15608 There are no special implementation defined characteristics for these
15609 packages.
15612 @itemize *
15614 @item 
15615 "The value of @cite{Buffer_Size} in @cite{Storage_IO}.  See
15616 A.9(10)."
15617 @end itemize
15619 All type representations are contiguous, and the @cite{Buffer_Size} is
15620 the value of @code{type'Size} rounded up to the next storage unit
15621 boundary.
15624 @itemize *
15626 @item 
15627 "External files for standard input, standard output, and
15628 standard error See A.10(5)."
15629 @end itemize
15631 These files are mapped onto the files provided by the C streams
15632 libraries.  See source file @code{i-cstrea.ads} for further details.
15635 @itemize *
15637 @item 
15638 "The accuracy of the value produced by @cite{Put}.  See
15639 A.10.9(36)."
15640 @end itemize
15642 If more digits are requested in the output than are represented by the
15643 precision of the value, zeroes are output in the corresponding least
15644 significant digit positions.
15647 @itemize *
15649 @item 
15650 "The meaning of @cite{Argument_Count}, @cite{Argument}, and
15651 @cite{Command_Name}.  See A.15(1)."
15652 @end itemize
15654 These are mapped onto the @cite{argv} and @cite{argc} parameters of the
15655 main program in the natural manner.
15658 @itemize *
15660 @item 
15661 "The interpretation of the @cite{Form} parameter in procedure
15662 @cite{Create_Directory}.  See A.16(56)."
15663 @end itemize
15665 The @cite{Form} parameter is not used.
15668 @itemize *
15670 @item 
15671 "The interpretation of the @cite{Form} parameter in procedure
15672 @cite{Create_Path}.  See A.16(60)."
15673 @end itemize
15675 The @cite{Form} parameter is not used.
15678 @itemize *
15680 @item 
15681 "The interpretation of the @cite{Form} parameter in procedure
15682 @cite{Copy_File}.  See A.16(68)."
15683 @end itemize
15685 The @cite{Form} parameter is case-insensitive.
15686 Two fields are recognized in the @cite{Form} parameter:
15688 @example
15689 *preserve=<value>*
15690 *mode=<value>*
15691 @end example
15693 <value> starts immediately after the character '=' and ends with the
15694 character immediately preceding the next comma (',') or with the last
15695 character of the parameter.
15697 The only possible values for preserve= are:
15700 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15701 @headitem
15703 Value
15705 @tab
15707 Meaning
15709 @item
15711 @emph{no_attributes}
15713 @tab
15715 Do not try to preserve any file attributes. This is the
15716 default if no preserve= is found in Form.
15718 @item
15720 @emph{all_attributes}
15722 @tab
15724 Try to preserve all file attributes (timestamps, access rights).
15726 @item
15728 @emph{timestamps}
15730 @tab
15732 Preserve the timestamp of the copied file, but not the other
15733 file attributes.
15735 @end multitable
15738 The only possible values for mode= are:
15741 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15742 @headitem
15744 Value
15746 @tab
15748 Meaning
15750 @item
15752 @emph{copy}
15754 @tab
15756 Only do the copy if the destination file does not already exist.
15757 If it already exists, Copy_File fails.
15759 @item
15761 @emph{overwrite}
15763 @tab
15765 Copy the file in all cases. Overwrite an already existing destination file.
15767 @item
15769 @emph{append}
15771 @tab
15773 Append the original file to the destination file. If the destination file
15774 does not exist, the destination file is a copy of the source file.
15775 When mode=append, the field preserve=, if it exists, is not taken into account.
15777 @end multitable
15780 If the Form parameter includes one or both of the fields and the value or
15781 values are incorrect, Copy_file fails with Use_Error.
15783 Examples of correct Forms:
15785 @example
15786 Form => "preserve=no_attributes,mode=overwrite" (the default)
15787 Form => "mode=append"
15788 Form => "mode=copy, preserve=all_attributes"
15789 @end example
15791 Examples of incorrect Forms:
15793 @example
15794 Form => "preserve=junk"
15795 Form => "mode=internal, preserve=timestamps"
15796 @end example
15799 @itemize *
15801 @item 
15802 "The interpretation of the @cite{Pattern} parameter, when not the null string,
15803 in the @cite{Start_Search} and @cite{Search} procedures.
15804 See A.16(104) and A.16(112)."
15805 @end itemize
15807 When the @cite{Pattern} parameter is not the null string, it is interpreted
15808 according to the syntax of regular expressions as defined in the
15809 @cite{GNAT.Regexp} package.
15811 See @ref{1fd,,GNAT.Regexp (g-regexp.ads)}.
15814 @itemize *
15816 @item 
15817 "Implementation-defined convention names.  See B.1(11)."
15818 @end itemize
15820 The following convention names are supported
15823 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15824 @headitem
15826 Convention Name
15828 @tab
15830 Interpretation
15832 @item
15834 @emph{Ada}
15836 @tab
15840 @item
15842 @emph{Ada_Pass_By_Copy}
15844 @tab
15846 Allowed for any types except by-reference types such as limited
15847 records. Compatible with convention Ada, but causes any parameters
15848 with this convention to be passed by copy.
15850 @item
15852 @emph{Ada_Pass_By_Reference}
15854 @tab
15856 Allowed for any types except by-copy types such as scalars.
15857 Compatible with convention Ada, but causes any parameters
15858 with this convention to be passed by reference.
15860 @item
15862 @emph{Assembler}
15864 @tab
15866 Assembly language
15868 @item
15870 @emph{Asm}
15872 @tab
15874 Synonym for Assembler
15876 @item
15878 @emph{Assembly}
15880 @tab
15882 Synonym for Assembler
15884 @item
15886 @emph{C}
15888 @tab
15892 @item
15894 @emph{C_Pass_By_Copy}
15896 @tab
15898 Allowed only for record types, like C, but also notes that record
15899 is to be passed by copy rather than reference.
15901 @item
15903 @emph{COBOL}
15905 @tab
15907 COBOL
15909 @item
15911 @emph{C_Plus_Plus (or CPP)}
15913 @tab
15917 @item
15919 @emph{Default}
15921 @tab
15923 Treated the same as C
15925 @item
15927 @emph{External}
15929 @tab
15931 Treated the same as C
15933 @item
15935 @emph{Fortran}
15937 @tab
15939 Fortran
15941 @item
15943 @emph{Intrinsic}
15945 @tab
15947 For support of pragma @cite{Import} with convention Intrinsic, see
15948 separate section on Intrinsic Subprograms.
15950 @item
15952 @emph{Stdcall}
15954 @tab
15956 Stdcall (used for Windows implementations only).  This convention correspond
15957 to the WINAPI (previously called Pascal convention) C/C++ convention under
15958 Windows.  A routine with this convention cleans the stack before
15959 exit. This pragma cannot be applied to a dispatching call.
15961 @item
15963 @emph{DLL}
15965 @tab
15967 Synonym for Stdcall
15969 @item
15971 @emph{Win32}
15973 @tab
15975 Synonym for Stdcall
15977 @item
15979 @emph{Stubbed}
15981 @tab
15983 Stubbed is a special convention used to indicate that the body of the
15984 subprogram will be entirely ignored.  Any call to the subprogram
15985 is converted into a raise of the @cite{Program_Error} exception.  If a
15986 pragma @cite{Import} specifies convention @cite{stubbed} then no body need
15987 be present at all.  This convention is useful during development for the
15988 inclusion of subprograms whose body has not yet been written.
15989 In addition, all otherwise unrecognized convention names are also
15990 treated as being synonymous with convention C.  In all implementations
15991 except for VMS, use of such other names results in a warning.  In VMS
15992 implementations, these names are accepted silently.
15994 @end multitable
15998 @itemize *
16000 @item 
16001 "The meaning of link names.  See B.1(36)."
16002 @end itemize
16004 Link names are the actual names used by the linker.
16007 @itemize *
16009 @item 
16010 "The manner of choosing link names when neither the link
16011 name nor the address of an imported or exported entity is specified.  See
16012 B.1(36)."
16013 @end itemize
16015 The default linker name is that which would be assigned by the relevant
16016 external language, interpreting the Ada name as being in all lower case
16017 letters.
16020 @itemize *
16022 @item 
16023 "The effect of pragma @cite{Linker_Options}.  See B.1(37)."
16024 @end itemize
16026 The string passed to @cite{Linker_Options} is presented uninterpreted as
16027 an argument to the link command, unless it contains ASCII.NUL characters.
16028 NUL characters if they appear act as argument separators, so for example
16030 @example
16031 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
16032 @end example
16034 causes two separate arguments @cite{-labc} and @cite{-ldef} to be passed to the
16035 linker. The order of linker options is preserved for a given unit. The final
16036 list of options passed to the linker is in reverse order of the elaboration
16037 order. For example, linker options for a body always appear before the options
16038 from the corresponding package spec.
16041 @itemize *
16043 @item 
16044 "The contents of the visible part of package
16045 @cite{Interfaces} and its language-defined descendants.  See B.2(1)."
16046 @end itemize
16048 See files with prefix @code{i-} in the distributed library.
16051 @itemize *
16053 @item 
16054 "Implementation-defined children of package
16055 @cite{Interfaces}.  The contents of the visible part of package
16056 @cite{Interfaces}.  See B.2(11)."
16057 @end itemize
16059 See files with prefix @code{i-} in the distributed library.
16062 @itemize *
16064 @item 
16065 "The types @cite{Floating}, @cite{Long_Floating},
16066 @cite{Binary}, @cite{Long_Binary}, @cite{Decimal_ Element}, and
16067 @cite{COBOL_Character}; and the initialization of the variables
16068 @cite{Ada_To_COBOL} and @cite{COBOL_To_Ada}, in
16069 @cite{Interfaces.COBOL}.  See B.4(50)."
16070 @end itemize
16073 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16074 @headitem
16076 COBOL
16078 @tab
16082 @item
16084 @emph{Floating}
16086 @tab
16088 Float
16090 @item
16092 @emph{Long_Floating}
16094 @tab
16096 (Floating) Long_Float
16098 @item
16100 @emph{Binary}
16102 @tab
16104 Integer
16106 @item
16108 @emph{Long_Binary}
16110 @tab
16112 Long_Long_Integer
16114 @item
16116 @emph{Decimal_Element}
16118 @tab
16120 Character
16122 @item
16124 @emph{COBOL_Character}
16126 @tab
16128 Character
16130 @end multitable
16133 For initialization, see the file @code{i-cobol.ads} in the distributed library.
16136 @itemize *
16138 @item 
16139 "Support for access to machine instructions.  See C.1(1)."
16140 @end itemize
16142 See documentation in file @code{s-maccod.ads} in the distributed library.
16145 @itemize *
16147 @item 
16148 "Implementation-defined aspects of access to machine
16149 operations.  See C.1(9)."
16150 @end itemize
16152 See documentation in file @code{s-maccod.ads} in the distributed library.
16155 @itemize *
16157 @item 
16158 "Implementation-defined aspects of interrupts.  See C.3(2)."
16159 @end itemize
16161 Interrupts are mapped to signals or conditions as appropriate.  See
16162 definition of unit
16163 @cite{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
16164 on the interrupts supported on a particular target.
16167 @itemize *
16169 @item 
16170 "Implementation-defined aspects of pre-elaboration.  See
16171 C.4(13)."
16172 @end itemize
16174 GNAT does not permit a partition to be restarted without reloading,
16175 except under control of the debugger.
16178 @itemize *
16180 @item 
16181 "The semantics of pragma @cite{Discard_Names}.  See C.5(7)."
16182 @end itemize
16184 Pragma @cite{Discard_Names} causes names of enumeration literals to
16185 be suppressed.  In the presence of this pragma, the Image attribute
16186 provides the image of the Pos of the literal, and Value accepts
16187 Pos values.
16190 @itemize *
16192 @item 
16193 "The result of the @cite{Task_Identification.Image}
16194 attribute.  See C.7.1(7)."
16195 @end itemize
16197 The result of this attribute is a string that identifies
16198 the object or component that denotes a given task. If a variable @cite{Var}
16199 has a task type, the image for this task will have the form @cite{Var_`XXXXXXXX`},
16200 where the suffix
16201 is the hexadecimal representation of the virtual address of the corresponding
16202 task control block. If the variable is an array of tasks, the image of each
16203 task will have the form of an indexed component indicating the position of a
16204 given task in the array, e.g., @cite{Group(5)_`XXXXXXX`}. If the task is a
16205 component of a record, the image of the task will have the form of a selected
16206 component. These rules are fully recursive, so that the image of a task that
16207 is a subcomponent of a composite object corresponds to the expression that
16208 designates this task.
16210 If a task is created by an allocator, its image depends on the context. If the
16211 allocator is part of an object declaration, the rules described above are used
16212 to construct its image, and this image is not affected by subsequent
16213 assignments. If the allocator appears within an expression, the image
16214 includes only the name of the task type.
16216 If the configuration pragma Discard_Names is present, or if the restriction
16217 No_Implicit_Heap_Allocation is in effect,  the image reduces to
16218 the numeric suffix, that is to say the hexadecimal representation of the
16219 virtual address of the control block of the task.
16222 @itemize *
16224 @item 
16225 "The value of @cite{Current_Task} when in a protected entry
16226 or interrupt handler.  See C.7.1(17)."
16227 @end itemize
16229 Protected entries or interrupt handlers can be executed by any
16230 convenient thread, so the value of @cite{Current_Task} is undefined.
16233 @itemize *
16235 @item 
16236 "The effect of calling @cite{Current_Task} from an entry
16237 body or interrupt handler.  See C.7.1(19)."
16238 @end itemize
16240 The effect of calling @cite{Current_Task} from an entry body or
16241 interrupt handler is to return the identification of the task currently
16242 executing the code.
16245 @itemize *
16247 @item 
16248 "Implementation-defined aspects of
16249 @cite{Task_Attributes}.  See C.7.2(19)."
16250 @end itemize
16252 There are no implementation-defined aspects of @cite{Task_Attributes}.
16255 @itemize *
16257 @item 
16258 "Values of all @cite{Metrics}.  See D(2)."
16259 @end itemize
16261 The metrics information for GNAT depends on the performance of the
16262 underlying operating system.  The sources of the run-time for tasking
16263 implementation, together with the output from @emph{-gnatG} can be
16264 used to determine the exact sequence of operating systems calls made
16265 to implement various tasking constructs.  Together with appropriate
16266 information on the performance of the underlying operating system,
16267 on the exact target in use, this information can be used to determine
16268 the required metrics.
16271 @itemize *
16273 @item 
16274 "The declarations of @cite{Any_Priority} and
16275 @cite{Priority}.  See D.1(11)."
16276 @end itemize
16278 See declarations in file @code{system.ads}.
16281 @itemize *
16283 @item 
16284 "Implementation-defined execution resources.  See D.1(15)."
16285 @end itemize
16287 There are no implementation-defined execution resources.
16290 @itemize *
16292 @item 
16293 "Whether, on a multiprocessor, a task that is waiting for
16294 access to a protected object keeps its processor busy.  See D.2.1(3)."
16295 @end itemize
16297 On a multi-processor, a task that is waiting for access to a protected
16298 object does not keep its processor busy.
16301 @itemize *
16303 @item 
16304 "The affect of implementation defined execution resources
16305 on task dispatching.  See D.2.1(9)."
16306 @end itemize
16308 Tasks map to threads in the threads package used by GNAT.  Where possible
16309 and appropriate, these threads correspond to native threads of the
16310 underlying operating system.
16313 @itemize *
16315 @item 
16316 "Implementation-defined @cite{policy_identifiers} allowed
16317 in a pragma @cite{Task_Dispatching_Policy}.  See D.2.2(3)."
16318 @end itemize
16320 There are no implementation-defined policy-identifiers allowed in this
16321 pragma.
16324 @itemize *
16326 @item 
16327 "Implementation-defined aspects of priority inversion.  See
16328 D.2.2(16)."
16329 @end itemize
16331 Execution of a task cannot be preempted by the implementation processing
16332 of delay expirations for lower priority tasks.
16335 @itemize *
16337 @item 
16338 "Implementation-defined task dispatching.  See D.2.2(18)."
16339 @end itemize
16341 The policy is the same as that of the underlying threads implementation.
16344 @itemize *
16346 @item 
16347 "Implementation-defined @cite{policy_identifiers} allowed
16348 in a pragma @cite{Locking_Policy}.  See D.3(4)."
16349 @end itemize
16351 The two implementation defined policies permitted in GNAT are
16352 @cite{Inheritance_Locking} and  @cite{Conccurent_Readers_Locking}.  On
16353 targets that support the @cite{Inheritance_Locking} policy, locking is
16354 implemented by inheritance, i.e., the task owning the lock operates
16355 at a priority equal to the highest priority of any task currently
16356 requesting the lock.  On targets that support the
16357 @cite{Conccurent_Readers_Locking} policy, locking is implemented with a
16358 read/write lock allowing multiple propected object functions to enter
16359 concurrently.
16362 @itemize *
16364 @item 
16365 "Default ceiling priorities.  See D.3(10)."
16366 @end itemize
16368 The ceiling priority of protected objects of the type
16369 @cite{System.Interrupt_Priority'Last} as described in the Ada
16370 Reference Manual D.3(10),
16373 @itemize *
16375 @item 
16376 "The ceiling of any protected object used internally by
16377 the implementation.  See D.3(16)."
16378 @end itemize
16380 The ceiling priority of internal protected objects is
16381 @cite{System.Priority'Last}.
16384 @itemize *
16386 @item 
16387 "Implementation-defined queuing policies.  See D.4(1)."
16388 @end itemize
16390 There are no implementation-defined queuing policies.
16393 @itemize *
16395 @item 
16396 "On a multiprocessor, any conditions that cause the
16397 completion of an aborted construct to be delayed later than what is
16398 specified for a single processor.  See D.6(3)."
16399 @end itemize
16401 The semantics for abort on a multi-processor is the same as on a single
16402 processor, there are no further delays.
16405 @itemize *
16407 @item 
16408 "Any operations that implicitly require heap storage
16409 allocation.  See D.7(8)."
16410 @end itemize
16412 The only operation that implicitly requires heap storage allocation is
16413 task creation.
16416 @itemize *
16418 @item 
16419 "What happens when a task terminates in the presence of
16420 pragma @cite{No_Task_Termination}. See D.7(15)."
16421 @end itemize
16423 Execution is erroneous in that case.
16426 @itemize *
16428 @item 
16429 "Implementation-defined aspects of pragma
16430 @cite{Restrictions}.  See D.7(20)."
16431 @end itemize
16433 There are no such implementation-defined aspects.
16436 @itemize *
16438 @item 
16439 "Implementation-defined aspects of package
16440 @cite{Real_Time}.  See D.8(17)."
16441 @end itemize
16443 There are no implementation defined aspects of package @cite{Real_Time}.
16446 @itemize *
16448 @item 
16449 "Implementation-defined aspects of
16450 @cite{delay_statements}.  See D.9(8)."
16451 @end itemize
16453 Any difference greater than one microsecond will cause the task to be
16454 delayed (see D.9(7)).
16457 @itemize *
16459 @item 
16460 "The upper bound on the duration of interrupt blocking
16461 caused by the implementation.  See D.12(5)."
16462 @end itemize
16464 The upper bound is determined by the underlying operating system.  In
16465 no cases is it more than 10 milliseconds.
16468 @itemize *
16470 @item 
16471 "The means for creating and executing distributed
16472 programs.  See E(5)."
16473 @end itemize
16475 The GLADE package provides a utility GNATDIST for creating and executing
16476 distributed programs.  See the GLADE reference manual for further details.
16479 @itemize *
16481 @item 
16482 "Any events that can result in a partition becoming
16483 inaccessible.  See E.1(7)."
16484 @end itemize
16486 See the GLADE reference manual for full details on such events.
16489 @itemize *
16491 @item 
16492 "The scheduling policies, treatment of priorities, and
16493 management of shared resources between partitions in certain cases.  See
16494 E.1(11)."
16495 @end itemize
16497 See the GLADE reference manual for full details on these aspects of
16498 multi-partition execution.
16501 @itemize *
16503 @item 
16504 "Events that cause the version of a compilation unit to
16505 change.  See E.3(5)."
16506 @end itemize
16508 Editing the source file of a compilation unit, or the source files of
16509 any units on which it is dependent in a significant way cause the version
16510 to change.  No other actions cause the version number to change.  All changes
16511 are significant except those which affect only layout, capitalization or
16512 comments.
16515 @itemize *
16517 @item 
16518 "Whether the execution of the remote subprogram is
16519 immediately aborted as a result of cancellation.  See E.4(13)."
16520 @end itemize
16522 See the GLADE reference manual for details on the effect of abort in
16523 a distributed application.
16526 @itemize *
16528 @item 
16529 "Implementation-defined aspects of the PCS.  See E.5(25)."
16530 @end itemize
16532 See the GLADE reference manual for a full description of all implementation
16533 defined aspects of the PCS.
16536 @itemize *
16538 @item 
16539 "Implementation-defined interfaces in the PCS.  See
16540 E.5(26)."
16541 @end itemize
16543 See the GLADE reference manual for a full description of all
16544 implementation defined interfaces.
16547 @itemize *
16549 @item 
16550 "The values of named numbers in the package
16551 @cite{Decimal}.  See F.2(7)."
16552 @end itemize
16555 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
16556 @headitem
16558 Named Number
16560 @tab
16562 Value
16564 @item
16566 @emph{Max_Scale}
16568 @tab
16572 @item
16574 @emph{Min_Scale}
16576 @tab
16580 @item
16582 @emph{Min_Delta}
16584 @tab
16586 1.0E-18
16588 @item
16590 @emph{Max_Delta}
16592 @tab
16594 1.0E+18
16596 @item
16598 @emph{Max_Decimal_Digits}
16600 @tab
16604 @end multitable
16608 @itemize *
16610 @item 
16611 "The value of @cite{Max_Picture_Length} in the package
16612 @cite{Text_IO.Editing}.  See F.3.3(16)."
16613 @end itemize
16618 @itemize *
16620 @item 
16621 "The value of @cite{Max_Picture_Length} in the package
16622 @cite{Wide_Text_IO.Editing}.  See F.3.4(5)."
16623 @end itemize
16628 @itemize *
16630 @item 
16631 "The accuracy actually achieved by the complex elementary
16632 functions and by other complex arithmetic operations.  See G.1(1)."
16633 @end itemize
16635 Standard library functions are used for the complex arithmetic
16636 operations.  Only fast math mode is currently supported.
16639 @itemize *
16641 @item 
16642 "The sign of a zero result (or a component thereof) from
16643 any operator or function in @cite{Numerics.Generic_Complex_Types}, when
16644 @cite{Real'Signed_Zeros} is True.  See G.1.1(53)."
16645 @end itemize
16647 The signs of zero values are as recommended by the relevant
16648 implementation advice.
16651 @itemize *
16653 @item 
16654 "The sign of a zero result (or a component thereof) from
16655 any operator or function in
16656 @cite{Numerics.Generic_Complex_Elementary_Functions}, when
16657 @cite{Real'Signed_Zeros} is @cite{True}.  See G.1.2(45)."
16658 @end itemize
16660 The signs of zero values are as recommended by the relevant
16661 implementation advice.
16664 @itemize *
16666 @item 
16667 "Whether the strict mode or the relaxed mode is the
16668 default.  See G.2(2)."
16669 @end itemize
16671 The strict mode is the default.  There is no separate relaxed mode.  GNAT
16672 provides a highly efficient implementation of strict mode.
16675 @itemize *
16677 @item 
16678 "The result interval in certain cases of fixed-to-float
16679 conversion.  See G.2.1(10)."
16680 @end itemize
16682 For cases where the result interval is implementation dependent, the
16683 accuracy is that provided by performing all operations in 64-bit IEEE
16684 floating-point format.
16687 @itemize *
16689 @item 
16690 "The result of a floating point arithmetic operation in
16691 overflow situations, when the @cite{Machine_Overflows} attribute of the
16692 result type is @cite{False}.  See G.2.1(13)."
16693 @end itemize
16695 Infinite and NaN values are produced as dictated by the IEEE
16696 floating-point standard.
16697 Note that on machines that are not fully compliant with the IEEE
16698 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
16699 must be used for achieving IEEE conforming behavior (although at the cost
16700 of a significant performance penalty), so infinite and NaN values are
16701 properly generated.
16704 @itemize *
16706 @item 
16707 "The result interval for division (or exponentiation by a
16708 negative exponent), when the floating point hardware implements division
16709 as multiplication by a reciprocal.  See G.2.1(16)."
16710 @end itemize
16712 Not relevant, division is IEEE exact.
16715 @itemize *
16717 @item 
16718 "The definition of close result set, which determines the
16719 accuracy of certain fixed point multiplications and divisions.  See
16720 G.2.3(5)."
16721 @end itemize
16723 Operations in the close result set are performed using IEEE long format
16724 floating-point arithmetic.  The input operands are converted to
16725 floating-point, the operation is done in floating-point, and the result
16726 is converted to the target type.
16729 @itemize *
16731 @item 
16732 "Conditions on a @cite{universal_real} operand of a fixed
16733 point multiplication or division for which the result shall be in the
16734 perfect result set.  See G.2.3(22)."
16735 @end itemize
16737 The result is only defined to be in the perfect result set if the result
16738 can be computed by a single scaling operation involving a scale factor
16739 representable in 64-bits.
16742 @itemize *
16744 @item 
16745 "The result of a fixed point arithmetic operation in
16746 overflow situations, when the @cite{Machine_Overflows} attribute of the
16747 result type is @cite{False}.  See G.2.3(27)."
16748 @end itemize
16750 Not relevant, @cite{Machine_Overflows} is @cite{True} for fixed-point
16751 types.
16754 @itemize *
16756 @item 
16757 "The result of an elementary function reference in
16758 overflow situations, when the @cite{Machine_Overflows} attribute of the
16759 result type is @cite{False}.  See G.2.4(4)."
16760 @end itemize
16762 IEEE infinite and Nan values are produced as appropriate.
16765 @itemize *
16767 @item 
16768 "The value of the angle threshold, within which certain
16769 elementary functions, complex arithmetic operations, and complex
16770 elementary functions yield results conforming to a maximum relative
16771 error bound.  See G.2.4(10)."
16772 @end itemize
16774 Information on this subject is not yet available.
16777 @itemize *
16779 @item 
16780 "The accuracy of certain elementary functions for
16781 parameters beyond the angle threshold.  See G.2.4(10)."
16782 @end itemize
16784 Information on this subject is not yet available.
16787 @itemize *
16789 @item 
16790 "The result of a complex arithmetic operation or complex
16791 elementary function reference in overflow situations, when the
16792 @cite{Machine_Overflows} attribute of the corresponding real type is
16793 @cite{False}.  See G.2.6(5)."
16794 @end itemize
16796 IEEE infinite and Nan values are produced as appropriate.
16799 @itemize *
16801 @item 
16802 "The accuracy of certain complex arithmetic operations and
16803 certain complex elementary functions for parameters (or components
16804 thereof) beyond the angle threshold.  See G.2.6(8)."
16805 @end itemize
16807 Information on those subjects is not yet available.
16810 @itemize *
16812 @item 
16813 "Information regarding bounded errors and erroneous
16814 execution.  See H.2(1)."
16815 @end itemize
16817 Information on this subject is not yet available.
16820 @itemize *
16822 @item 
16823 "Implementation-defined aspects of pragma
16824 @cite{Inspection_Point}.  See H.3.2(8)."
16825 @end itemize
16827 Pragma @cite{Inspection_Point} ensures that the variable is live and can
16828 be examined by the debugger at the inspection point.
16831 @itemize *
16833 @item 
16834 "Implementation-defined aspects of pragma
16835 @cite{Restrictions}.  See H.4(25)."
16836 @end itemize
16838 There are no implementation-defined aspects of pragma @cite{Restrictions}.  The
16839 use of pragma @cite{Restrictions [No_Exceptions]} has no effect on the
16840 generated code.  Checks must suppressed by use of pragma @cite{Suppress}.
16843 @itemize *
16845 @item 
16846 "Any restrictions on pragma @cite{Restrictions}.  See
16847 H.4(27)."
16848 @end itemize
16850 There are no restrictions on pragma @cite{Restrictions}.
16852 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
16853 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{1fe}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{1ff}
16854 @chapter Intrinsic Subprograms
16857 @geindex Intrinsic Subprograms
16859 GNAT allows a user application program to write the declaration:
16861 @example
16862 pragma Import (Intrinsic, name);
16863 @end example
16865 providing that the name corresponds to one of the implemented intrinsic
16866 subprograms in GNAT, and that the parameter profile of the referenced
16867 subprogram meets the requirements.  This chapter describes the set of
16868 implemented intrinsic subprograms, and the requirements on parameter profiles.
16869 Note that no body is supplied; as with other uses of pragma Import, the
16870 body is supplied elsewhere (in this case by the compiler itself).  Note
16871 that any use of this feature is potentially non-portable, since the
16872 Ada standard does not require Ada compilers to implement this feature.
16874 @menu
16875 * Intrinsic Operators:: 
16876 * Compilation_Date:: 
16877 * Compilation_Time:: 
16878 * Enclosing_Entity:: 
16879 * Exception_Information:: 
16880 * Exception_Message:: 
16881 * Exception_Name:: 
16882 * File:: 
16883 * Line:: 
16884 * Shifts and Rotates:: 
16885 * Source_Location:: 
16887 @end menu
16889 @node Intrinsic Operators,Compilation_Date,,Intrinsic Subprograms
16890 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{200}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{201}
16891 @section Intrinsic Operators
16894 @geindex Intrinsic operator
16896 All the predefined numeric operators in package Standard
16897 in @cite{pragma Import (Intrinsic@comma{}..)}
16898 declarations.  In the binary operator case, the operands must have the same
16899 size.  The operand or operands must also be appropriate for
16900 the operator.  For example, for addition, the operands must
16901 both be floating-point or both be fixed-point, and the
16902 right operand for @cite{"**"} must have a root type of
16903 @cite{Standard.Integer'Base}.
16904 You can use an intrinsic operator declaration as in the following example:
16906 @example
16907 type Int1 is new Integer;
16908 type Int2 is new Integer;
16910 function "+" (X1 : Int1; X2 : Int2) return Int1;
16911 function "+" (X1 : Int1; X2 : Int2) return Int2;
16912 pragma Import (Intrinsic, "+");
16913 @end example
16915 This declaration would permit 'mixed mode' arithmetic on items
16916 of the differing types @cite{Int1} and @cite{Int2}.
16917 It is also possible to specify such operators for private types, if the
16918 full views are appropriate arithmetic types.
16920 @node Compilation_Date,Compilation_Time,Intrinsic Operators,Intrinsic Subprograms
16921 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{202}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{203}
16922 @section Compilation_Date
16925 @geindex Compilation_Date
16927 This intrinsic subprogram is used in the implementation of the
16928 library package @cite{GNAT.Source_Info}.  The only useful use of the
16929 intrinsic import in this case is the one in this unit, so an
16930 application program should simply call the function
16931 @cite{GNAT.Source_Info.Compilation_Date} to obtain the date of
16932 the current compilation (in local time format MMM DD YYYY).
16934 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
16935 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{204}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{205}
16936 @section Compilation_Time
16939 @geindex Compilation_Time
16941 This intrinsic subprogram is used in the implementation of the
16942 library package @cite{GNAT.Source_Info}.  The only useful use of the
16943 intrinsic import in this case is the one in this unit, so an
16944 application program should simply call the function
16945 @cite{GNAT.Source_Info.Compilation_Time} to obtain the time of
16946 the current compilation (in local time format HH:MM:SS).
16948 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
16949 @anchor{gnat_rm/intrinsic_subprograms id5}@anchor{206}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{207}
16950 @section Enclosing_Entity
16953 @geindex Enclosing_Entity
16955 This intrinsic subprogram is used in the implementation of the
16956 library package @cite{GNAT.Source_Info}.  The only useful use of the
16957 intrinsic import in this case is the one in this unit, so an
16958 application program should simply call the function
16959 @cite{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
16960 the current subprogram, package, task, entry, or protected subprogram.
16962 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
16963 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{208}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{209}
16964 @section Exception_Information
16967 @geindex Exception_Information'
16969 This intrinsic subprogram is used in the implementation of the
16970 library package @cite{GNAT.Current_Exception}.  The only useful
16971 use of the intrinsic import in this case is the one in this unit,
16972 so an application program should simply call the function
16973 @cite{GNAT.Current_Exception.Exception_Information} to obtain
16974 the exception information associated with the current exception.
16976 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
16977 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{20a}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{20b}
16978 @section Exception_Message
16981 @geindex Exception_Message
16983 This intrinsic subprogram is used in the implementation of the
16984 library package @cite{GNAT.Current_Exception}.  The only useful
16985 use of the intrinsic import in this case is the one in this unit,
16986 so an application program should simply call the function
16987 @cite{GNAT.Current_Exception.Exception_Message} to obtain
16988 the message associated with the current exception.
16990 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
16991 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{20c}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{20d}
16992 @section Exception_Name
16995 @geindex Exception_Name
16997 This intrinsic subprogram is used in the implementation of the
16998 library package @cite{GNAT.Current_Exception}.  The only useful
16999 use of the intrinsic import in this case is the one in this unit,
17000 so an application program should simply call the function
17001 @cite{GNAT.Current_Exception.Exception_Name} to obtain
17002 the name of the current exception.
17004 @node File,Line,Exception_Name,Intrinsic Subprograms
17005 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{20e}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{20f}
17006 @section File
17009 @geindex File
17011 This intrinsic subprogram is used in the implementation of the
17012 library package @cite{GNAT.Source_Info}.  The only useful use of the
17013 intrinsic import in this case is the one in this unit, so an
17014 application program should simply call the function
17015 @cite{GNAT.Source_Info.File} to obtain the name of the current
17016 file.
17018 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
17019 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{210}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{211}
17020 @section Line
17023 @geindex Line
17025 This intrinsic subprogram is used in the implementation of the
17026 library package @cite{GNAT.Source_Info}.  The only useful use of the
17027 intrinsic import in this case is the one in this unit, so an
17028 application program should simply call the function
17029 @cite{GNAT.Source_Info.Line} to obtain the number of the current
17030 source line.
17032 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
17033 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{212}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{213}
17034 @section Shifts and Rotates
17037 @geindex Shift_Left
17039 @geindex Shift_Right
17041 @geindex Shift_Right_Arithmetic
17043 @geindex Rotate_Left
17045 @geindex Rotate_Right
17047 In standard Ada, the shift and rotate functions are available only
17048 for the predefined modular types in package @cite{Interfaces}.  However, in
17049 GNAT it is possible to define these functions for any integer
17050 type (signed or modular), as in this example:
17052 @example
17053 function Shift_Left
17054   (Value  : T;
17055    Amount : Natural) return T;
17056 @end example
17058 The function name must be one of
17059 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
17060 Rotate_Right. T must be an integer type. T'Size must be
17061 8, 16, 32 or 64 bits; if T is modular, the modulus
17062 must be 2**8, 2**16, 2**32 or 2**64.
17063 The result type must be the same as the type of @cite{Value}.
17064 The shift amount must be Natural.
17065 The formal parameter names can be anything.
17067 A more convenient way of providing these shift operators is to use
17068 the Provide_Shift_Operators pragma, which provides the function declarations
17069 and corresponding pragma Import's for all five shift functions.
17071 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
17072 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{214}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{215}
17073 @section Source_Location
17076 @geindex Source_Location
17078 This intrinsic subprogram is used in the implementation of the
17079 library routine @cite{GNAT.Source_Info}.  The only useful use of the
17080 intrinsic import in this case is the one in this unit, so an
17081 application program should simply call the function
17082 @cite{GNAT.Source_Info.Source_Location} to obtain the current
17083 source file location.
17085 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
17086 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{216}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{217}
17087 @chapter Representation Clauses and Pragmas
17090 @geindex Representation Clauses
17092 @geindex Representation Clause
17094 @geindex Representation Pragma
17096 @geindex Pragma
17097 @geindex representation
17099 This section describes the representation clauses accepted by GNAT, and
17100 their effect on the representation of corresponding data objects.
17102 GNAT fully implements Annex C (Systems Programming).  This means that all
17103 the implementation advice sections in chapter 13 are fully implemented.
17104 However, these sections only require a minimal level of support for
17105 representation clauses.  GNAT provides much more extensive capabilities,
17106 and this section describes the additional capabilities provided.
17108 @menu
17109 * Alignment Clauses:: 
17110 * Size Clauses:: 
17111 * Storage_Size Clauses:: 
17112 * Size of Variant Record Objects:: 
17113 * Biased Representation:: 
17114 * Value_Size and Object_Size Clauses:: 
17115 * Component_Size Clauses:: 
17116 * Bit_Order Clauses:: 
17117 * Effect of Bit_Order on Byte Ordering:: 
17118 * Pragma Pack for Arrays:: 
17119 * Pragma Pack for Records:: 
17120 * Record Representation Clauses:: 
17121 * Handling of Records with Holes:: 
17122 * Enumeration Clauses:: 
17123 * Address Clauses:: 
17124 * Use of Address Clauses for Memory-Mapped I/O:: 
17125 * Effect of Convention on Representation:: 
17126 * Conventions and Anonymous Access Types:: 
17127 * Determining the Representations chosen by GNAT:: 
17129 @end menu
17131 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
17132 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{218}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{219}
17133 @section Alignment Clauses
17136 @geindex Alignment Clause
17138 GNAT requires that all alignment clauses specify a power of 2, and all
17139 default alignments are always a power of 2.  The default alignment
17140 values are as follows:
17143 @itemize *
17145 @item 
17146 @emph{Primitive Types}.
17148 For primitive types, the alignment is the minimum of the actual size of
17149 objects of the type divided by @cite{Storage_Unit},
17150 and the maximum alignment supported by the target.
17151 (This maximum alignment is given by the GNAT-specific attribute
17152 @cite{Standard'Maximum_Alignment}; see @ref{13c,,Attribute Maximum_Alignment}.)
17154 @geindex Maximum_Alignment attribute
17156 For example, for type @cite{Long_Float}, the object size is 8 bytes, and the
17157 default alignment will be 8 on any target that supports alignments
17158 this large, but on some targets, the maximum alignment may be smaller
17159 than 8, in which case objects of type @cite{Long_Float} will be maximally
17160 aligned.
17162 @item 
17163 @emph{Arrays}.
17165 For arrays, the alignment is equal to the alignment of the component type
17166 for the normal case where no packing or component size is given.  If the
17167 array is packed, and the packing is effective (see separate section on
17168 packed arrays), then the alignment will be one for long packed arrays,
17169 or arrays whose length is not known at compile time.  For short packed
17170 arrays, which are handled internally as modular types, the alignment
17171 will be as described for primitive types, e.g., a packed array of length
17172 31 bits will have an object size of four bytes, and an alignment of 4.
17174 @item 
17175 @emph{Records}.
17177 For the normal non-packed case, the alignment of a record is equal to
17178 the maximum alignment of any of its components.  For tagged records, this
17179 includes the implicit access type used for the tag.  If a pragma @cite{Pack}
17180 is used and all components are packable (see separate section on pragma
17181 @cite{Pack}), then the resulting alignment is 1, unless the layout of the
17182 record makes it profitable to increase it.
17184 A special case is when:
17187 @itemize *
17189 @item 
17190 the size of the record is given explicitly, or a
17191 full record representation clause is given, and
17193 @item 
17194 the size of the record is 2, 4, or 8 bytes.
17195 @end itemize
17197 In this case, an alignment is chosen to match the
17198 size of the record. For example, if we have:
17200 @example
17201 type Small is record
17202    A, B : Character;
17203 end record;
17204 for Small'Size use 16;
17205 @end example
17207 then the default alignment of the record type @cite{Small} is 2, not 1. This
17208 leads to more efficient code when the record is treated as a unit, and also
17209 allows the type to specified as @cite{Atomic} on architectures requiring
17210 strict alignment.
17211 @end itemize
17213 An alignment clause may specify a larger alignment than the default value
17214 up to some maximum value dependent on the target (obtainable by using the
17215 attribute reference @cite{Standard'Maximum_Alignment}). It may also specify
17216 a smaller alignment than the default value for enumeration, integer and
17217 fixed point types, as well as for record types, for example
17219 @example
17220 type V is record
17221    A : Integer;
17222 end record;
17224 for V'alignment use 1;
17225 @end example
17227 @geindex Alignment
17228 @geindex default
17230 The default alignment for the type @cite{V} is 4, as a result of the
17231 Integer field in the record, but it is permissible, as shown, to
17232 override the default alignment of the record with a smaller value.
17234 @geindex Alignment
17235 @geindex subtypes
17237 Note that according to the Ada standard, an alignment clause applies only
17238 to the first named subtype. If additional subtypes are declared, then the
17239 compiler is allowed to choose any alignment it likes, and there is no way
17240 to control this choice. Consider:
17242 @example
17243 type R is range 1 .. 10_000;
17244 for R'Alignment use 1;
17245 subtype RS is R range 1 .. 1000;
17246 @end example
17248 The alignment clause specifies an alignment of 1 for the first named subtype
17249 @cite{R} but this does not necessarily apply to @cite{RS}. When writing
17250 portable Ada code, you should avoid writing code that explicitly or
17251 implicitly relies on the alignment of such subtypes.
17253 For the GNAT compiler, if an explicit alignment clause is given, this
17254 value is also used for any subsequent subtypes. So for GNAT, in the
17255 above example, you can count on the alignment of @cite{RS} being 1. But this
17256 assumption is non-portable, and other compilers may choose different
17257 alignments for the subtype @cite{RS}.
17259 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
17260 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{21a}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{21b}
17261 @section Size Clauses
17264 @geindex Size Clause
17266 The default size for a type @cite{T} is obtainable through the
17267 language-defined attribute @cite{T'Size} and also through the
17268 equivalent GNAT-defined attribute @cite{T'Value_Size}.
17269 For objects of type @cite{T}, GNAT will generally increase the type size
17270 so that the object size (obtainable through the GNAT-defined attribute
17271 @cite{T'Object_Size})
17272 is a multiple of @cite{T'Alignment * Storage_Unit}.
17274 For example:
17276 @example
17277 type Smallint is range 1 .. 6;
17279 type Rec is record
17280    Y1 : integer;
17281    Y2 : boolean;
17282 end record;
17283 @end example
17285 In this example, @cite{Smallint'Size} = @cite{Smallint'Value_Size} = 3,
17286 as specified by the RM rules,
17287 but objects of this type will have a size of 8
17288 (@cite{Smallint'Object_Size} = 8),
17289 since objects by default occupy an integral number
17290 of storage units.  On some targets, notably older
17291 versions of the Digital Alpha, the size of stand
17292 alone objects of this type may be 32, reflecting
17293 the inability of the hardware to do byte load/stores.
17295 Similarly, the size of type @cite{Rec} is 40 bits
17296 (@cite{Rec'Size} = @cite{Rec'Value_Size} = 40), but
17297 the alignment is 4, so objects of this type will have
17298 their size increased to 64 bits so that it is a multiple
17299 of the alignment (in bits).  This decision is
17300 in accordance with the specific Implementation Advice in RM 13.3(43):
17302 @quotation
17304 "A @cite{Size} clause should be supported for an object if the specified
17305 @cite{Size} is at least as large as its subtype's @cite{Size}, and corresponds
17306 to a size in storage elements that is a multiple of the object's
17307 @cite{Alignment} (if the @cite{Alignment} is nonzero)."
17308 @end quotation
17310 An explicit size clause may be used to override the default size by
17311 increasing it.  For example, if we have:
17313 @example
17314 type My_Boolean is new Boolean;
17315 for My_Boolean'Size use 32;
17316 @end example
17318 then values of this type will always be 32 bits long.  In the case of
17319 discrete types, the size can be increased up to 64 bits, with the effect
17320 that the entire specified field is used to hold the value, sign- or
17321 zero-extended as appropriate.  If more than 64 bits is specified, then
17322 padding space is allocated after the value, and a warning is issued that
17323 there are unused bits.
17325 Similarly the size of records and arrays may be increased, and the effect
17326 is to add padding bits after the value.  This also causes a warning message
17327 to be generated.
17329 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
17330 Size in bits, this corresponds to an object of size 256 megabytes (minus
17331 one).  This limitation is true on all targets.  The reason for this
17332 limitation is that it improves the quality of the code in many cases
17333 if it is known that a Size value can be accommodated in an object of
17334 type Integer.
17336 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
17337 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{21c}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{21d}
17338 @section Storage_Size Clauses
17341 @geindex Storage_Size Clause
17343 For tasks, the @cite{Storage_Size} clause specifies the amount of space
17344 to be allocated for the task stack.  This cannot be extended, and if the
17345 stack is exhausted, then @cite{Storage_Error} will be raised (if stack
17346 checking is enabled).  Use a @cite{Storage_Size} attribute definition clause,
17347 or a @cite{Storage_Size} pragma in the task definition to set the
17348 appropriate required size.  A useful technique is to include in every
17349 task definition a pragma of the form:
17351 @example
17352 pragma Storage_Size (Default_Stack_Size);
17353 @end example
17355 Then @cite{Default_Stack_Size} can be defined in a global package, and
17356 modified as required. Any tasks requiring stack sizes different from the
17357 default can have an appropriate alternative reference in the pragma.
17359 You can also use the @emph{-d} binder switch to modify the default stack
17360 size.
17362 For access types, the @cite{Storage_Size} clause specifies the maximum
17363 space available for allocation of objects of the type.  If this space is
17364 exceeded then @cite{Storage_Error} will be raised by an allocation attempt.
17365 In the case where the access type is declared local to a subprogram, the
17366 use of a @cite{Storage_Size} clause triggers automatic use of a special
17367 predefined storage pool (@cite{System.Pool_Size}) that ensures that all
17368 space for the pool is automatically reclaimed on exit from the scope in
17369 which the type is declared.
17371 A special case recognized by the compiler is the specification of a
17372 @cite{Storage_Size} of zero for an access type.  This means that no
17373 items can be allocated from the pool, and this is recognized at compile
17374 time, and all the overhead normally associated with maintaining a fixed
17375 size storage pool is eliminated.  Consider the following example:
17377 @example
17378 procedure p is
17379    type R is array (Natural) of Character;
17380    type P is access all R;
17381    for P'Storage_Size use 0;
17382    --  Above access type intended only for interfacing purposes
17384    y : P;
17386    procedure g (m : P);
17387    pragma Import (C, g);
17389    --  ...
17391 begin
17392    --  ...
17393    y := new R;
17394 end;
17395 @end example
17397 As indicated in this example, these dummy storage pools are often useful in
17398 connection with interfacing where no object will ever be allocated.  If you
17399 compile the above example, you get the warning:
17401 @example
17402 p.adb:16:09: warning: allocation from empty storage pool
17403 p.adb:16:09: warning: Storage_Error will be raised at run time
17404 @end example
17406 Of course in practice, there will not be any explicit allocators in the
17407 case of such an access declaration.
17409 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
17410 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{21e}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{21f}
17411 @section Size of Variant Record Objects
17414 @geindex Size
17415 @geindex variant record objects
17417 @geindex Variant record objects
17418 @geindex size
17420 In the case of variant record objects, there is a question whether Size gives
17421 information about a particular variant, or the maximum size required
17422 for any variant.  Consider the following program
17424 @example
17425 with Text_IO; use Text_IO;
17426 procedure q is
17427    type R1 (A : Boolean := False) is record
17428      case A is
17429        when True  => X : Character;
17430        when False => null;
17431      end case;
17432    end record;
17434    V1 : R1 (False);
17435    V2 : R1;
17437 begin
17438    Put_Line (Integer'Image (V1'Size));
17439    Put_Line (Integer'Image (V2'Size));
17440 end q;
17441 @end example
17443 Here we are dealing with a variant record, where the True variant
17444 requires 16 bits, and the False variant requires 8 bits.
17445 In the above example, both V1 and V2 contain the False variant,
17446 which is only 8 bits long.  However, the result of running the
17447 program is:
17449 @example
17452 @end example
17454 The reason for the difference here is that the discriminant value of
17455 V1 is fixed, and will always be False.  It is not possible to assign
17456 a True variant value to V1, therefore 8 bits is sufficient.  On the
17457 other hand, in the case of V2, the initial discriminant value is
17458 False (from the default), but it is possible to assign a True
17459 variant value to V2, therefore 16 bits must be allocated for V2
17460 in the general case, even fewer bits may be needed at any particular
17461 point during the program execution.
17463 As can be seen from the output of this program, the @cite{'Size}
17464 attribute applied to such an object in GNAT gives the actual allocated
17465 size of the variable, which is the largest size of any of the variants.
17466 The Ada Reference Manual is not completely clear on what choice should
17467 be made here, but the GNAT behavior seems most consistent with the
17468 language in the RM.
17470 In some cases, it may be desirable to obtain the size of the current
17471 variant, rather than the size of the largest variant.  This can be
17472 achieved in GNAT by making use of the fact that in the case of a
17473 subprogram parameter, GNAT does indeed return the size of the current
17474 variant (because a subprogram has no way of knowing how much space
17475 is actually allocated for the actual).
17477 Consider the following modified version of the above program:
17479 @example
17480 with Text_IO; use Text_IO;
17481 procedure q is
17482    type R1 (A : Boolean := False) is record
17483      case A is
17484        when True  => X : Character;
17485        when False => null;
17486      end case;
17487    end record;
17489    V2 : R1;
17491    function Size (V : R1) return Integer is
17492    begin
17493       return V'Size;
17494    end Size;
17496 begin
17497    Put_Line (Integer'Image (V2'Size));
17498    Put_Line (Integer'IMage (Size (V2)));
17499    V2 := (True, 'x');
17500    Put_Line (Integer'Image (V2'Size));
17501    Put_Line (Integer'IMage (Size (V2)));
17502 end q;
17503 @end example
17505 The output from this program is
17507 @example
17512 @end example
17514 Here we see that while the @cite{'Size} attribute always returns
17515 the maximum size, regardless of the current variant value, the
17516 @cite{Size} function does indeed return the size of the current
17517 variant value.
17519 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
17520 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{220}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{221}
17521 @section Biased Representation
17524 @geindex Size for biased representation
17526 @geindex Biased representation
17528 In the case of scalars with a range starting at other than zero, it is
17529 possible in some cases to specify a size smaller than the default minimum
17530 value, and in such cases, GNAT uses an unsigned biased representation,
17531 in which zero is used to represent the lower bound, and successive values
17532 represent successive values of the type.
17534 For example, suppose we have the declaration:
17536 @example
17537 type Small is range -7 .. -4;
17538 for Small'Size use 2;
17539 @end example
17541 Although the default size of type @cite{Small} is 4, the @cite{Size}
17542 clause is accepted by GNAT and results in the following representation
17543 scheme:
17545 @example
17546 -7 is represented as 2#00#
17547 -6 is represented as 2#01#
17548 -5 is represented as 2#10#
17549 -4 is represented as 2#11#
17550 @end example
17552 Biased representation is only used if the specified @cite{Size} clause
17553 cannot be accepted in any other manner.  These reduced sizes that force
17554 biased representation can be used for all discrete types except for
17555 enumeration types for which a representation clause is given.
17557 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
17558 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{222}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{223}
17559 @section Value_Size and Object_Size Clauses
17562 @geindex Value_Size
17564 @geindex Object_Size
17566 @geindex Size
17567 @geindex of objects
17569 In Ada 95 and Ada 2005, @cite{T'Size} for a type @cite{T} is the minimum
17570 number of bits required to hold values of type @cite{T}.
17571 Although this interpretation was allowed in Ada 83, it was not required,
17572 and this requirement in practice can cause some significant difficulties.
17573 For example, in most Ada 83 compilers, @cite{Natural'Size} was 32.
17574 However, in Ada 95 and Ada 2005,
17575 @cite{Natural'Size} is
17576 typically 31.  This means that code may change in behavior when moving
17577 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
17579 @example
17580 type Rec is record;
17581    A : Natural;
17582    B : Natural;
17583 end record;
17585 for Rec use record
17586    at 0  range 0 .. Natural'Size - 1;
17587    at 0  range Natural'Size .. 2 * Natural'Size - 1;
17588 end record;
17589 @end example
17591 In the above code, since the typical size of @cite{Natural} objects
17592 is 32 bits and @cite{Natural'Size} is 31, the above code can cause
17593 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
17594 there are cases where the fact that the object size can exceed the
17595 size of the type causes surprises.
17597 To help get around this problem GNAT provides two implementation
17598 defined attributes, @cite{Value_Size} and @cite{Object_Size}.  When
17599 applied to a type, these attributes yield the size of the type
17600 (corresponding to the RM defined size attribute), and the size of
17601 objects of the type respectively.
17603 The @cite{Object_Size} is used for determining the default size of
17604 objects and components.  This size value can be referred to using the
17605 @cite{Object_Size} attribute.  The phrase 'is used' here means that it is
17606 the basis of the determination of the size.  The backend is free to
17607 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
17608 character might be stored in 32 bits on a machine with no efficient
17609 byte access instructions such as the Alpha.
17611 The default rules for the value of @cite{Object_Size} for
17612 discrete types are as follows:
17615 @itemize *
17617 @item 
17618 The @cite{Object_Size} for base subtypes reflect the natural hardware
17619 size in bits (run the compiler with @emph{-gnatS} to find those values
17620 for numeric types). Enumeration types and fixed-point base subtypes have
17621 8, 16, 32 or 64 bits for this size, depending on the range of values
17622 to be stored.
17624 @item 
17625 The @cite{Object_Size} of a subtype is the same as the
17626 @cite{Object_Size} of
17627 the type from which it is obtained.
17629 @item 
17630 The @cite{Object_Size} of a derived base type is copied from the parent
17631 base type, and the @cite{Object_Size} of a derived first subtype is copied
17632 from the parent first subtype.
17633 @end itemize
17635 The @cite{Value_Size} attribute
17636 is the (minimum) number of bits required to store a value
17637 of the type.
17638 This value is used to determine how tightly to pack
17639 records or arrays with components of this type, and also affects
17640 the semantics of unchecked conversion (unchecked conversions where
17641 the @cite{Value_Size} values differ generate a warning, and are potentially
17642 target dependent).
17644 The default rules for the value of @cite{Value_Size} are as follows:
17647 @itemize *
17649 @item 
17650 The @cite{Value_Size} for a base subtype is the minimum number of bits
17651 required to store all values of the type (including the sign bit
17652 only if negative values are possible).
17654 @item 
17655 If a subtype statically matches the first subtype of a given type, then it has
17656 by default the same @cite{Value_Size} as the first subtype.  This is a
17657 consequence of RM 13.1(14): "if two subtypes statically match,
17658 then their subtype-specific aspects are the same".)
17660 @item 
17661 All other subtypes have a @cite{Value_Size} corresponding to the minimum
17662 number of bits required to store all values of the subtype.  For
17663 dynamic bounds, it is assumed that the value can range down or up
17664 to the corresponding bound of the ancestor
17665 @end itemize
17667 The RM defined attribute @cite{Size} corresponds to the
17668 @cite{Value_Size} attribute.
17670 The @cite{Size} attribute may be defined for a first-named subtype.  This sets
17671 the @cite{Value_Size} of
17672 the first-named subtype to the given value, and the
17673 @cite{Object_Size} of this first-named subtype to the given value padded up
17674 to an appropriate boundary.  It is a consequence of the default rules
17675 above that this @cite{Object_Size} will apply to all further subtypes.  On the
17676 other hand, @cite{Value_Size} is affected only for the first subtype, any
17677 dynamic subtypes obtained from it directly, and any statically matching
17678 subtypes.  The @cite{Value_Size} of any other static subtypes is not affected.
17680 @cite{Value_Size} and
17681 @cite{Object_Size} may be explicitly set for any subtype using
17682 an attribute definition clause.  Note that the use of these attributes
17683 can cause the RM 13.1(14) rule to be violated.  If two access types
17684 reference aliased objects whose subtypes have differing @cite{Object_Size}
17685 values as a result of explicit attribute definition clauses, then it
17686 is illegal to convert from one access subtype to the other. For a more
17687 complete description of this additional legality rule, see the
17688 description of the @cite{Object_Size} attribute.
17690 At the implementation level, Esize stores the Object_Size and the
17691 RM_Size field stores the @cite{Value_Size} (and hence the value of the
17692 @cite{Size} attribute,
17693 which, as noted above, is equivalent to @cite{Value_Size}).
17695 To get a feel for the difference, consider the following examples (note
17696 that in each case the base is @cite{Short_Short_Integer} with a size of 8):
17699 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
17700 @headitem
17702 Type or subtype declaration
17704 @tab
17706 Object_Size
17708 @tab
17710 Value_Size
17712 @item
17714 @code{type x1 is range 0 .. 5;}
17716 @tab
17720 @tab
17724 @item
17726 @code{type x2 is range 0 .. 5;}
17727 @code{for x2'size use 12;}
17729 @tab
17733 @tab
17737 @item
17739 @code{subtype x3 is x2 range 0 .. 3;}
17741 @tab
17745 @tab
17749 @item
17751 @code{subtype x4 is x2'base range 0 .. 10;}
17753 @tab
17757 @tab
17761 @item
17763 @code{subtype x5 is x2 range 0 .. dynamic;}
17765 @tab
17769 @tab
17773 @item
17775 @code{subtype x6 is x2'base range 0 .. dynamic;}
17777 @tab
17781 @tab
17785 @end multitable
17788 Note: the entries marked '3*' are not actually specified by the Ada
17789 Reference Manual, but it seems in the spirit of the RM rules to allocate
17790 the minimum number of bits (here 3, given the range for @cite{x2})
17791 known to be large enough to hold the given range of values.
17793 So far, so good, but GNAT has to obey the RM rules, so the question is
17794 under what conditions must the RM @cite{Size} be used.
17795 The following is a list
17796 of the occasions on which the RM @cite{Size} must be used:
17799 @itemize *
17801 @item 
17802 Component size for packed arrays or records
17804 @item 
17805 Value of the attribute @cite{Size} for a type
17807 @item 
17808 Warning about sizes not matching for unchecked conversion
17809 @end itemize
17811 For record types, the @cite{Object_Size} is always a multiple of the
17812 alignment of the type (this is true for all types). In some cases the
17813 @cite{Value_Size} can be smaller. Consider:
17815 @example
17816 type R is record
17817   X : Integer;
17818   Y : Character;
17819 end record;
17820 @end example
17822 On a typical 32-bit architecture, the X component will be four bytes, and
17823 require four-byte alignment, and the Y component will be one byte. In this
17824 case @cite{R'Value_Size} will be 40 (bits) since this is the minimum size
17825 required to store a value of this type, and for example, it is permissible
17826 to have a component of type R in an outer array whose component size is
17827 specified to be 48 bits. However, @cite{R'Object_Size} will be 64 (bits),
17828 since it must be rounded up so that this value is a multiple of the
17829 alignment (4 bytes = 32 bits).
17831 For all other types, the @cite{Object_Size}
17832 and Value_Size are the same (and equivalent to the RM attribute @cite{Size}).
17833 Only @cite{Size} may be specified for such types.
17835 Note that @cite{Value_Size} can be used to force biased representation
17836 for a particular subtype. Consider this example:
17838 @example
17839 type R is (A, B, C, D, E, F);
17840 subtype RAB is R range A .. B;
17841 subtype REF is R range E .. F;
17842 @end example
17844 By default, @cite{RAB}
17845 has a size of 1 (sufficient to accommodate the representation
17846 of @cite{A} and @cite{B}, 0 and 1), and @cite{REF}
17847 has a size of 3 (sufficient to accommodate the representation
17848 of @cite{E} and @cite{F}, 4 and 5). But if we add the
17849 following @cite{Value_Size} attribute definition clause:
17851 @example
17852 for REF'Value_Size use 1;
17853 @end example
17855 then biased representation is forced for @cite{REF},
17856 and 0 will represent @cite{E} and 1 will represent @cite{F}.
17857 A warning is issued when a @cite{Value_Size} attribute
17858 definition clause forces biased representation. This
17859 warning can be turned off using @cite{-gnatw.B}.
17861 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
17862 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{224}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{225}
17863 @section Component_Size Clauses
17866 @geindex Component_Size Clause
17868 Normally, the value specified in a component size clause must be consistent
17869 with the subtype of the array component with regard to size and alignment.
17870 In other words, the value specified must be at least equal to the size
17871 of this subtype, and must be a multiple of the alignment value.
17873 In addition, component size clauses are allowed which cause the array
17874 to be packed, by specifying a smaller value.  A first case is for
17875 component size values in the range 1 through 63.  The value specified
17876 must not be smaller than the Size of the subtype.  GNAT will accurately
17877 honor all packing requests in this range.  For example, if we have:
17879 @example
17880 type r is array (1 .. 8) of Natural;
17881 for r'Component_Size use 31;
17882 @end example
17884 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
17885 Of course access to the components of such an array is considerably
17886 less efficient than if the natural component size of 32 is used.
17887 A second case is when the subtype of the component is a record type
17888 padded because of its default alignment.  For example, if we have:
17890 @example
17891 type r is record
17892   i : Integer;
17893   j : Integer;
17894   b : Boolean;
17895 end record;
17897 type a is array (1 .. 8) of r;
17898 for a'Component_Size use 72;
17899 @end example
17901 then the resulting array has a length of 72 bytes, instead of 96 bytes
17902 if the alignment of the record (4) was obeyed.
17904 Note that there is no point in giving both a component size clause
17905 and a pragma Pack for the same array type. if such duplicate
17906 clauses are given, the pragma Pack will be ignored.
17908 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
17909 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{226}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{227}
17910 @section Bit_Order Clauses
17913 @geindex Bit_Order Clause
17915 @geindex bit ordering
17917 @geindex ordering
17918 @geindex of bits
17920 For record subtypes, GNAT permits the specification of the @cite{Bit_Order}
17921 attribute.  The specification may either correspond to the default bit
17922 order for the target, in which case the specification has no effect and
17923 places no additional restrictions, or it may be for the non-standard
17924 setting (that is the opposite of the default).
17926 In the case where the non-standard value is specified, the effect is
17927 to renumber bits within each byte, but the ordering of bytes is not
17928 affected.  There are certain
17929 restrictions placed on component clauses as follows:
17932 @itemize *
17934 @item 
17935 Components fitting within a single storage unit.
17937 These are unrestricted, and the effect is merely to renumber bits.  For
17938 example if we are on a little-endian machine with @cite{Low_Order_First}
17939 being the default, then the following two declarations have exactly
17940 the same effect:
17942 @example
17943 type R1 is record
17944    A : Boolean;
17945    B : Integer range 1 .. 120;
17946 end record;
17948 for R1 use record
17949    A at 0 range 0 .. 0;
17950    B at 0 range 1 .. 7;
17951 end record;
17953 type R2 is record
17954    A : Boolean;
17955    B : Integer range 1 .. 120;
17956 end record;
17958 for R2'Bit_Order use High_Order_First;
17960 for R2 use record
17961    A at 0 range 7 .. 7;
17962    B at 0 range 0 .. 6;
17963 end record;
17964 @end example
17966 The useful application here is to write the second declaration with the
17967 @cite{Bit_Order} attribute definition clause, and know that it will be treated
17968 the same, regardless of whether the target is little-endian or big-endian.
17970 @item 
17971 Components occupying an integral number of bytes.
17973 These are components that exactly fit in two or more bytes.  Such component
17974 declarations are allowed, but have no effect, since it is important to realize
17975 that the @cite{Bit_Order} specification does not affect the ordering of bytes.
17976 In particular, the following attempt at getting an endian-independent integer
17977 does not work:
17979 @example
17980 type R2 is record
17981    A : Integer;
17982 end record;
17984 for R2'Bit_Order use High_Order_First;
17986 for R2 use record
17987    A at 0 range 0 .. 31;
17988 end record;
17989 @end example
17991 This declaration will result in a little-endian integer on a
17992 little-endian machine, and a big-endian integer on a big-endian machine.
17993 If byte flipping is required for interoperability between big- and
17994 little-endian machines, this must be explicitly programmed.  This capability
17995 is not provided by @cite{Bit_Order}.
17997 @item 
17998 Components that are positioned across byte boundaries
18000 but do not occupy an integral number of bytes.  Given that bytes are not
18001 reordered, such fields would occupy a non-contiguous sequence of bits
18002 in memory, requiring non-trivial code to reassemble.  They are for this
18003 reason not permitted, and any component clause specifying such a layout
18004 will be flagged as illegal by GNAT.
18005 @end itemize
18007 Since the misconception that Bit_Order automatically deals with all
18008 endian-related incompatibilities is a common one, the specification of
18009 a component field that is an integral number of bytes will always
18010 generate a warning.  This warning may be suppressed using @cite{pragma Warnings (Off)}
18011 if desired.  The following section contains additional
18012 details regarding the issue of byte ordering.
18014 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
18015 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{228}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{229}
18016 @section Effect of Bit_Order on Byte Ordering
18019 @geindex byte ordering
18021 @geindex ordering
18022 @geindex of bytes
18024 In this section we will review the effect of the @cite{Bit_Order} attribute
18025 definition clause on byte ordering.  Briefly, it has no effect at all, but
18026 a detailed example will be helpful.  Before giving this
18027 example, let us review the precise
18028 definition of the effect of defining @cite{Bit_Order}.  The effect of a
18029 non-standard bit order is described in section 15.5.3 of the Ada
18030 Reference Manual:
18032 @quotation
18034 "2   A bit ordering is a method of interpreting the meaning of
18035 the storage place attributes."
18036 @end quotation
18038 To understand the precise definition of storage place attributes in
18039 this context, we visit section 13.5.1 of the manual:
18041 @quotation
18043 "13   A record_representation_clause (without the mod_clause)
18044 specifies the layout.  The storage place attributes (see 13.5.2)
18045 are taken from the values of the position, first_bit, and last_bit
18046 expressions after normalizing those values so that first_bit is
18047 less than Storage_Unit."
18048 @end quotation
18050 The critical point here is that storage places are taken from
18051 the values after normalization, not before.  So the @cite{Bit_Order}
18052 interpretation applies to normalized values.  The interpretation
18053 is described in the later part of the 15.5.3 paragraph:
18055 @quotation
18057 "2   A bit ordering is a method of interpreting the meaning of
18058 the storage place attributes.  High_Order_First (known in the
18059 vernacular as 'big endian') means that the first bit of a
18060 storage element (bit 0) is the most significant bit (interpreting
18061 the sequence of bits that represent a component as an unsigned
18062 integer value).  Low_Order_First (known in the vernacular as
18063 'little endian') means the opposite: the first bit is the
18064 least significant."
18065 @end quotation
18067 Note that the numbering is with respect to the bits of a storage
18068 unit.  In other words, the specification affects only the numbering
18069 of bits within a single storage unit.
18071 We can make the effect clearer by giving an example.
18073 Suppose that we have an external device which presents two bytes, the first
18074 byte presented, which is the first (low addressed byte) of the two byte
18075 record is called Master, and the second byte is called Slave.
18077 The left most (most significant bit is called Control for each byte, and
18078 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
18079 (least significant) bit.
18081 On a big-endian machine, we can write the following representation clause
18083 @example
18084 type Data is record
18085    Master_Control : Bit;
18086    Master_V1      : Bit;
18087    Master_V2      : Bit;
18088    Master_V3      : Bit;
18089    Master_V4      : Bit;
18090    Master_V5      : Bit;
18091    Master_V6      : Bit;
18092    Master_V7      : Bit;
18093    Slave_Control  : Bit;
18094    Slave_V1       : Bit;
18095    Slave_V2       : Bit;
18096    Slave_V3       : Bit;
18097    Slave_V4       : Bit;
18098    Slave_V5       : Bit;
18099    Slave_V6       : Bit;
18100    Slave_V7       : Bit;
18101 end record;
18103 for Data use record
18104    Master_Control at 0 range 0 .. 0;
18105    Master_V1      at 0 range 1 .. 1;
18106    Master_V2      at 0 range 2 .. 2;
18107    Master_V3      at 0 range 3 .. 3;
18108    Master_V4      at 0 range 4 .. 4;
18109    Master_V5      at 0 range 5 .. 5;
18110    Master_V6      at 0 range 6 .. 6;
18111    Master_V7      at 0 range 7 .. 7;
18112    Slave_Control  at 1 range 0 .. 0;
18113    Slave_V1       at 1 range 1 .. 1;
18114    Slave_V2       at 1 range 2 .. 2;
18115    Slave_V3       at 1 range 3 .. 3;
18116    Slave_V4       at 1 range 4 .. 4;
18117    Slave_V5       at 1 range 5 .. 5;
18118    Slave_V6       at 1 range 6 .. 6;
18119    Slave_V7       at 1 range 7 .. 7;
18120 end record;
18121 @end example
18123 Now if we move this to a little endian machine, then the bit ordering within
18124 the byte is backwards, so we have to rewrite the record rep clause as:
18126 @example
18127 for Data use record
18128    Master_Control at 0 range 7 .. 7;
18129    Master_V1      at 0 range 6 .. 6;
18130    Master_V2      at 0 range 5 .. 5;
18131    Master_V3      at 0 range 4 .. 4;
18132    Master_V4      at 0 range 3 .. 3;
18133    Master_V5      at 0 range 2 .. 2;
18134    Master_V6      at 0 range 1 .. 1;
18135    Master_V7      at 0 range 0 .. 0;
18136    Slave_Control  at 1 range 7 .. 7;
18137    Slave_V1       at 1 range 6 .. 6;
18138    Slave_V2       at 1 range 5 .. 5;
18139    Slave_V3       at 1 range 4 .. 4;
18140    Slave_V4       at 1 range 3 .. 3;
18141    Slave_V5       at 1 range 2 .. 2;
18142    Slave_V6       at 1 range 1 .. 1;
18143    Slave_V7       at 1 range 0 .. 0;
18144 end record;
18145 @end example
18147 It is a nuisance to have to rewrite the clause, especially if
18148 the code has to be maintained on both machines.  However,
18149 this is a case that we can handle with the
18150 @cite{Bit_Order} attribute if it is implemented.
18151 Note that the implementation is not required on byte addressed
18152 machines, but it is indeed implemented in GNAT.
18153 This means that we can simply use the
18154 first record clause, together with the declaration
18156 @example
18157 for Data'Bit_Order use High_Order_First;
18158 @end example
18160 and the effect is what is desired, namely the layout is exactly the same,
18161 independent of whether the code is compiled on a big-endian or little-endian
18162 machine.
18164 The important point to understand is that byte ordering is not affected.
18165 A @cite{Bit_Order} attribute definition never affects which byte a field
18166 ends up in, only where it ends up in that byte.
18167 To make this clear, let us rewrite the record rep clause of the previous
18168 example as:
18170 @example
18171 for Data'Bit_Order use High_Order_First;
18172 for Data use record
18173    Master_Control at 0 range  0 .. 0;
18174    Master_V1      at 0 range  1 .. 1;
18175    Master_V2      at 0 range  2 .. 2;
18176    Master_V3      at 0 range  3 .. 3;
18177    Master_V4      at 0 range  4 .. 4;
18178    Master_V5      at 0 range  5 .. 5;
18179    Master_V6      at 0 range  6 .. 6;
18180    Master_V7      at 0 range  7 .. 7;
18181    Slave_Control  at 0 range  8 .. 8;
18182    Slave_V1       at 0 range  9 .. 9;
18183    Slave_V2       at 0 range 10 .. 10;
18184    Slave_V3       at 0 range 11 .. 11;
18185    Slave_V4       at 0 range 12 .. 12;
18186    Slave_V5       at 0 range 13 .. 13;
18187    Slave_V6       at 0 range 14 .. 14;
18188    Slave_V7       at 0 range 15 .. 15;
18189 end record;
18190 @end example
18192 This is exactly equivalent to saying (a repeat of the first example):
18194 @example
18195 for Data'Bit_Order use High_Order_First;
18196 for Data use record
18197    Master_Control at 0 range 0 .. 0;
18198    Master_V1      at 0 range 1 .. 1;
18199    Master_V2      at 0 range 2 .. 2;
18200    Master_V3      at 0 range 3 .. 3;
18201    Master_V4      at 0 range 4 .. 4;
18202    Master_V5      at 0 range 5 .. 5;
18203    Master_V6      at 0 range 6 .. 6;
18204    Master_V7      at 0 range 7 .. 7;
18205    Slave_Control  at 1 range 0 .. 0;
18206    Slave_V1       at 1 range 1 .. 1;
18207    Slave_V2       at 1 range 2 .. 2;
18208    Slave_V3       at 1 range 3 .. 3;
18209    Slave_V4       at 1 range 4 .. 4;
18210    Slave_V5       at 1 range 5 .. 5;
18211    Slave_V6       at 1 range 6 .. 6;
18212    Slave_V7       at 1 range 7 .. 7;
18213 end record;
18214 @end example
18216 Why are they equivalent? Well take a specific field, the @cite{Slave_V2}
18217 field.  The storage place attributes are obtained by normalizing the
18218 values given so that the @cite{First_Bit} value is less than 8.  After
18219 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
18220 we specified in the other case.
18222 Now one might expect that the @cite{Bit_Order} attribute might affect
18223 bit numbering within the entire record component (two bytes in this
18224 case, thus affecting which byte fields end up in), but that is not
18225 the way this feature is defined, it only affects numbering of bits,
18226 not which byte they end up in.
18228 Consequently it never makes sense to specify a starting bit number
18229 greater than 7 (for a byte addressable field) if an attribute
18230 definition for @cite{Bit_Order} has been given, and indeed it
18231 may be actively confusing to specify such a value, so the compiler
18232 generates a warning for such usage.
18234 If you do need to control byte ordering then appropriate conditional
18235 values must be used.  If in our example, the slave byte came first on
18236 some machines we might write:
18238 @example
18239 Master_Byte_First constant Boolean := ...;
18241 Master_Byte : constant Natural :=
18242                 1 - Boolean'Pos (Master_Byte_First);
18243 Slave_Byte  : constant Natural :=
18244                 Boolean'Pos (Master_Byte_First);
18246 for Data'Bit_Order use High_Order_First;
18247 for Data use record
18248    Master_Control at Master_Byte range 0 .. 0;
18249    Master_V1      at Master_Byte range 1 .. 1;
18250    Master_V2      at Master_Byte range 2 .. 2;
18251    Master_V3      at Master_Byte range 3 .. 3;
18252    Master_V4      at Master_Byte range 4 .. 4;
18253    Master_V5      at Master_Byte range 5 .. 5;
18254    Master_V6      at Master_Byte range 6 .. 6;
18255    Master_V7      at Master_Byte range 7 .. 7;
18256    Slave_Control  at Slave_Byte  range 0 .. 0;
18257    Slave_V1       at Slave_Byte  range 1 .. 1;
18258    Slave_V2       at Slave_Byte  range 2 .. 2;
18259    Slave_V3       at Slave_Byte  range 3 .. 3;
18260    Slave_V4       at Slave_Byte  range 4 .. 4;
18261    Slave_V5       at Slave_Byte  range 5 .. 5;
18262    Slave_V6       at Slave_Byte  range 6 .. 6;
18263    Slave_V7       at Slave_Byte  range 7 .. 7;
18264 end record;
18265 @end example
18267 Now to switch between machines, all that is necessary is
18268 to set the boolean constant @cite{Master_Byte_First} in
18269 an appropriate manner.
18271 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
18272 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{22a}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{22b}
18273 @section Pragma Pack for Arrays
18276 @geindex Pragma Pack (for arrays)
18278 Pragma @cite{Pack} applied to an array has no effect unless the component type
18279 is packable.  For a component type to be packable, it must be one of the
18280 following cases:
18283 @itemize *
18285 @item 
18286 Any scalar type
18288 @item 
18289 Any type whose size is specified with a size clause
18291 @item 
18292 Any packed array type with a static size
18294 @item 
18295 Any record type padded because of its default alignment
18296 @end itemize
18298 For all these cases, if the component subtype size is in the range
18299 1 through 63, then the effect of the pragma @cite{Pack} is exactly as though a
18300 component size were specified giving the component subtype size.
18301 For example if we have:
18303 @example
18304 type r is range 0 .. 17;
18306 type ar is array (1 .. 8) of r;
18307 pragma Pack (ar);
18308 @end example
18310 Then the component size of @cite{ar} will be set to 5 (i.e., to @cite{r'size},
18311 and the size of the array @cite{ar} will be exactly 40 bits.
18313 Note that in some cases this rather fierce approach to packing can produce
18314 unexpected effects.  For example, in Ada 95 and Ada 2005,
18315 subtype @cite{Natural} typically has a size of 31, meaning that if you
18316 pack an array of @cite{Natural}, you get 31-bit
18317 close packing, which saves a few bits, but results in far less efficient
18318 access.  Since many other Ada compilers will ignore such a packing request,
18319 GNAT will generate a warning on some uses of pragma @cite{Pack} that it guesses
18320 might not be what is intended.  You can easily remove this warning by
18321 using an explicit @cite{Component_Size} setting instead, which never generates
18322 a warning, since the intention of the programmer is clear in this case.
18324 GNAT treats packed arrays in one of two ways.  If the size of the array is
18325 known at compile time and is less than 64 bits, then internally the array
18326 is represented as a single modular type, of exactly the appropriate number
18327 of bits.  If the length is greater than 63 bits, or is not known at compile
18328 time, then the packed array is represented as an array of bytes, and the
18329 length is always a multiple of 8 bits.
18331 Note that to represent a packed array as a modular type, the alignment must
18332 be suitable for the modular type involved. For example, on typical machines
18333 a 32-bit packed array will be represented by a 32-bit modular integer with
18334 an alignment of four bytes. If you explicitly override the default alignment
18335 with an alignment clause that is too small, the modular representation
18336 cannot be used. For example, consider the following set of declarations:
18338 @example
18339 type R is range 1 .. 3;
18340 type S is array (1 .. 31) of R;
18341 for S'Component_Size use 2;
18342 for S'Size use 62;
18343 for S'Alignment use 1;
18344 @end example
18346 If the alignment clause were not present, then a 62-bit modular
18347 representation would be chosen (typically with an alignment of 4 or 8
18348 bytes depending on the target). But the default alignment is overridden
18349 with the explicit alignment clause. This means that the modular
18350 representation cannot be used, and instead the array of bytes
18351 representation must be used, meaning that the length must be a multiple
18352 of 8. Thus the above set of declarations will result in a diagnostic
18353 rejecting the size clause and noting that the minimum size allowed is 64.
18355 @geindex Pragma Pack (for type Natural)
18357 @geindex Pragma Pack warning
18359 One special case that is worth noting occurs when the base type of the
18360 component size is 8/16/32 and the subtype is one bit less. Notably this
18361 occurs with subtype @cite{Natural}. Consider:
18363 @example
18364 type Arr is array (1 .. 32) of Natural;
18365 pragma Pack (Arr);
18366 @end example
18368 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
18369 since typically @cite{Natural'Size} is 32 in Ada 83, and in any case most
18370 Ada 83 compilers did not attempt 31 bit packing.
18372 In Ada 95 and Ada 2005, @cite{Natural'Size} is required to be 31. Furthermore,
18373 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
18374 substantial unintended performance penalty when porting legacy Ada 83 code.
18375 To help prevent this, GNAT generates a warning in such cases. If you really
18376 want 31 bit packing in a case like this, you can set the component size
18377 explicitly:
18379 @example
18380 type Arr is array (1 .. 32) of Natural;
18381 for Arr'Component_Size use 31;
18382 @end example
18384 Here 31-bit packing is achieved as required, and no warning is generated,
18385 since in this case the programmer intention is clear.
18387 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
18388 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{22c}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{22d}
18389 @section Pragma Pack for Records
18392 @geindex Pragma Pack (for records)
18394 Pragma @cite{Pack} applied to a record will pack the components to reduce
18395 wasted space from alignment gaps and by reducing the amount of space
18396 taken by components.  We distinguish between @emph{packable} components and
18397 @emph{non-packable} components.
18398 Components of the following types are considered packable:
18401 @itemize *
18403 @item 
18404 Components of a primitive type are packable unless they are aliased
18405 or of an atomic type.
18407 @item 
18408 Small packed arrays, whose size does not exceed 64 bits, and where the
18409 size is statically known at compile time, are represented internally
18410 as modular integers, and so they are also packable.
18411 @end itemize
18413 All packable components occupy the exact number of bits corresponding to
18414 their @cite{Size} value, and are packed with no padding bits, i.e., they
18415 can start on an arbitrary bit boundary.
18417 All other types are non-packable, they occupy an integral number of
18418 storage units, and
18419 are placed at a boundary corresponding to their alignment requirements.
18421 For example, consider the record
18423 @example
18424 type Rb1 is array (1 .. 13) of Boolean;
18425 pragma Pack (Rb1);
18427 type Rb2 is array (1 .. 65) of Boolean;
18428 pragma Pack (Rb2);
18430 type AF is new Float with Atomic;
18432 type X2 is record
18433    L1 : Boolean;
18434    L2 : Duration;
18435    L3 : AF;
18436    L4 : Boolean;
18437    L5 : Rb1;
18438    L6 : Rb2;
18439 end record;
18440 pragma Pack (X2);
18441 @end example
18443 The representation for the record X2 is as follows:
18445 @example
18446 for X2'Size use 224;
18447 for X2 use record
18448    L1 at  0 range  0 .. 0;
18449    L2 at  0 range  1 .. 64;
18450    L3 at 12 range  0 .. 31;
18451    L4 at 16 range  0 .. 0;
18452    L5 at 16 range  1 .. 13;
18453    L6 at 18 range  0 .. 71;
18454 end record;
18455 @end example
18457 Studying this example, we see that the packable fields @cite{L1}
18458 and @cite{L2} are
18459 of length equal to their sizes, and placed at specific bit boundaries (and
18460 not byte boundaries) to
18461 eliminate padding.  But @cite{L3} is of a non-packable float type (because
18462 it is aliased), so it is on the next appropriate alignment boundary.
18464 The next two fields are fully packable, so @cite{L4} and @cite{L5} are
18465 minimally packed with no gaps.  However, type @cite{Rb2} is a packed
18466 array that is longer than 64 bits, so it is itself non-packable.  Thus
18467 the @cite{L6} field is aligned to the next byte boundary, and takes an
18468 integral number of bytes, i.e., 72 bits.
18470 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
18471 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{22e}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{22f}
18472 @section Record Representation Clauses
18475 @geindex Record Representation Clause
18477 Record representation clauses may be given for all record types, including
18478 types obtained by record extension.  Component clauses are allowed for any
18479 static component.  The restrictions on component clauses depend on the type
18480 of the component.
18482 @geindex Component Clause
18484 For all components of an elementary type, the only restriction on component
18485 clauses is that the size must be at least the 'Size value of the type
18486 (actually the Value_Size).  There are no restrictions due to alignment,
18487 and such components may freely cross storage boundaries.
18489 Packed arrays with a size up to and including 64 bits are represented
18490 internally using a modular type with the appropriate number of bits, and
18491 thus the same lack of restriction applies.  For example, if you declare:
18493 @example
18494 type R is array (1 .. 49) of Boolean;
18495 pragma Pack (R);
18496 for R'Size use 49;
18497 @end example
18499 then a component clause for a component of type R may start on any
18500 specified bit boundary, and may specify a value of 49 bits or greater.
18502 For packed bit arrays that are longer than 64 bits, there are two
18503 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
18504 including the important case of single bits or boolean values, then
18505 there are no limitations on placement of such components, and they
18506 may start and end at arbitrary bit boundaries.
18508 If the component size is not a power of 2 (e.g., 3 or 5), then
18509 an array of this type longer than 64 bits must always be placed on
18510 on a storage unit (byte) boundary and occupy an integral number
18511 of storage units (bytes). Any component clause that does not
18512 meet this requirement will be rejected.
18514 Any aliased component, or component of an aliased type, must
18515 have its normal alignment and size. A component clause that
18516 does not meet this requirement will be rejected.
18518 The tag field of a tagged type always occupies an address sized field at
18519 the start of the record.  No component clause may attempt to overlay this
18520 tag. When a tagged type appears as a component, the tag field must have
18521 proper alignment
18523 In the case of a record extension T1, of a type T, no component clause applied
18524 to the type T1 can specify a storage location that would overlap the first
18525 T'Size bytes of the record.
18527 For all other component types, including non-bit-packed arrays,
18528 the component can be placed at an arbitrary bit boundary,
18529 so for example, the following is permitted:
18531 @example
18532 type R is array (1 .. 10) of Boolean;
18533 for R'Size use 80;
18535 type Q is record
18536    G, H : Boolean;
18537    L, M : R;
18538 end record;
18540 for Q use record
18541    G at 0 range  0 ..   0;
18542    H at 0 range  1 ..   1;
18543    L at 0 range  2 ..  81;
18544    R at 0 range 82 .. 161;
18545 end record;
18546 @end example
18548 Note: the above rules apply to recent releases of GNAT 5.
18549 In GNAT 3, there are more severe restrictions on larger components.
18550 For non-primitive types, including packed arrays with a size greater than
18551 64 bits, component clauses must respect the alignment requirement of the
18552 type, in particular, always starting on a byte boundary, and the length
18553 must be a multiple of the storage unit.
18555 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
18556 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{230}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{231}
18557 @section Handling of Records with Holes
18560 @geindex Handling of Records with Holes
18562 As a result of alignment considerations, records may contain "holes"
18563 or gaps
18564 which do not correspond to the data bits of any of the components.
18565 Record representation clauses can also result in holes in records.
18567 GNAT does not attempt to clear these holes, so in record objects,
18568 they should be considered to hold undefined rubbish. The generated
18569 equality routine just tests components so does not access these
18570 undefined bits, and assignment and copy operations may or may not
18571 preserve the contents of these holes (for assignments, the holes
18572 in the target will in practice contain either the bits that are
18573 present in the holes in the source, or the bits that were present
18574 in the target before the assignment).
18576 If it is necessary to ensure that holes in records have all zero
18577 bits, then record objects for which this initialization is desired
18578 should be explicitly set to all zero values using Unchecked_Conversion
18579 or address overlays. For example
18581 @example
18582 type HRec is record
18583    C : Character;
18584    I : Integer;
18585 end record;
18586 @end example
18588 On typical machines, integers need to be aligned on a four-byte
18589 boundary, resulting in three bytes of undefined rubbish following
18590 the 8-bit field for C. To ensure that the hole in a variable of
18591 type HRec is set to all zero bits,
18592 you could for example do:
18594 @example
18595 type Base is record
18596    Dummy1, Dummy2 : Integer := 0;
18597 end record;
18599 BaseVar : Base;
18600 RealVar : Hrec;
18601 for RealVar'Address use BaseVar'Address;
18602 @end example
18604 Now the 8-bytes of the value of RealVar start out containing all zero
18605 bits. A safer approach is to just define dummy fields, avoiding the
18606 holes, as in:
18608 @example
18609 type HRec is record
18610    C      : Character;
18611    Dummy1 : Short_Short_Integer := 0;
18612    Dummy2 : Short_Short_Integer := 0;
18613    Dummy3 : Short_Short_Integer := 0;
18614    I      : Integer;
18615 end record;
18616 @end example
18618 And to make absolutely sure that the intent of this is followed, you
18619 can use representation clauses:
18621 @example
18622 for Hrec use record
18623    C      at 0 range 0 .. 7;
18624    Dummy1 at 1 range 0 .. 7;
18625    Dummy2 at 2 range 0 .. 7;
18626    Dummy3 at 3 range 0 .. 7;
18627    I      at 4 range 0 .. 31;
18628 end record;
18629 for Hrec'Size use 64;
18630 @end example
18632 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
18633 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{232}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{233}
18634 @section Enumeration Clauses
18637 The only restriction on enumeration clauses is that the range of values
18638 must be representable.  For the signed case, if one or more of the
18639 representation values are negative, all values must be in the range:
18641 @example
18642 System.Min_Int .. System.Max_Int
18643 @end example
18645 For the unsigned case, where all values are nonnegative, the values must
18646 be in the range:
18648 @example
18649 0 .. System.Max_Binary_Modulus;
18650 @end example
18652 A @emph{confirming} representation clause is one in which the values range
18653 from 0 in sequence, i.e., a clause that confirms the default representation
18654 for an enumeration type.
18655 Such a confirming representation
18656 is permitted by these rules, and is specially recognized by the compiler so
18657 that no extra overhead results from the use of such a clause.
18659 If an array has an index type which is an enumeration type to which an
18660 enumeration clause has been applied, then the array is stored in a compact
18661 manner.  Consider the declarations:
18663 @example
18664 type r is (A, B, C);
18665 for r use (A => 1, B => 5, C => 10);
18666 type t is array (r) of Character;
18667 @end example
18669 The array type t corresponds to a vector with exactly three elements and
18670 has a default size equal to @cite{3*Character'Size}.  This ensures efficient
18671 use of space, but means that accesses to elements of the array will incur
18672 the overhead of converting representation values to the corresponding
18673 positional values, (i.e., the value delivered by the @cite{Pos} attribute).
18675 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
18676 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{234}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{235}
18677 @section Address Clauses
18680 @geindex Address Clause
18682 The reference manual allows a general restriction on representation clauses,
18683 as found in RM 13.1(22):
18685 @quotation
18687 "An implementation need not support representation
18688 items containing nonstatic expressions, except that
18689 an implementation should support a representation item
18690 for a given entity if each nonstatic expression in the
18691 representation item is a name that statically denotes
18692 a constant declared before the entity."
18693 @end quotation
18695 In practice this is applicable only to address clauses, since this is the
18696 only case in which a non-static expression is permitted by the syntax.  As
18697 the AARM notes in sections 13.1 (22.a-22.h):
18699 @quotation
18701 22.a   Reason: This is to avoid the following sort of thing:
18703 22.b        X : Integer := F(...);
18704 Y : Address := G(...);
18705 for X'Address use Y;
18707 22.c   In the above, we have to evaluate the
18708 initialization expression for X before we
18709 know where to put the result.  This seems
18710 like an unreasonable implementation burden.
18712 22.d   The above code should instead be written
18713 like this:
18715 22.e        Y : constant Address := G(...);
18716 X : Integer := F(...);
18717 for X'Address use Y;
18719 22.f   This allows the expression 'Y' to be safely
18720 evaluated before X is created.
18722 22.g   The constant could be a formal parameter of mode in.
18724 22.h   An implementation can support other nonstatic
18725 expressions if it wants to.  Expressions of type
18726 Address are hardly ever static, but their value
18727 might be known at compile time anyway in many
18728 cases.
18729 @end quotation
18731 GNAT does indeed permit many additional cases of non-static expressions.  In
18732 particular, if the type involved is elementary there are no restrictions
18733 (since in this case, holding a temporary copy of the initialization value,
18734 if one is present, is inexpensive).  In addition, if there is no implicit or
18735 explicit initialization, then there are no restrictions.  GNAT will reject
18736 only the case where all three of these conditions hold:
18739 @itemize *
18741 @item 
18742 The type of the item is non-elementary (e.g., a record or array).
18744 @item 
18745 There is explicit or implicit initialization required for the object.
18746 Note that access values are always implicitly initialized.
18748 @item 
18749 The address value is non-static.  Here GNAT is more permissive than the
18750 RM, and allows the address value to be the address of a previously declared
18751 stand-alone variable, as long as it does not itself have an address clause.
18753 @example
18754 Anchor  : Some_Initialized_Type;
18755 Overlay : Some_Initialized_Type;
18756 for Overlay'Address use Anchor'Address;
18757 @end example
18759 However, the prefix of the address clause cannot be an array component, or
18760 a component of a discriminated record.
18761 @end itemize
18763 As noted above in section 22.h, address values are typically non-static.  In
18764 particular the To_Address function, even if applied to a literal value, is
18765 a non-static function call.  To avoid this minor annoyance, GNAT provides
18766 the implementation defined attribute 'To_Address.  The following two
18767 expressions have identical values:
18769 @geindex Attribute
18771 @geindex To_Address
18773 @example
18774 To_Address (16#1234_0000#)
18775 System'To_Address (16#1234_0000#);
18776 @end example
18778 except that the second form is considered to be a static expression, and
18779 thus when used as an address clause value is always permitted.
18781 Additionally, GNAT treats as static an address clause that is an
18782 unchecked_conversion of a static integer value.  This simplifies the porting
18783 of legacy code, and provides a portable equivalent to the GNAT attribute
18784 @cite{To_Address}.
18786 Another issue with address clauses is the interaction with alignment
18787 requirements.  When an address clause is given for an object, the address
18788 value must be consistent with the alignment of the object (which is usually
18789 the same as the alignment of the type of the object).  If an address clause
18790 is given that specifies an inappropriately aligned address value, then the
18791 program execution is erroneous.
18793 Since this source of erroneous behavior can have unfortunate effects, GNAT
18794 checks (at compile time if possible, generating a warning, or at execution
18795 time with a run-time check) that the alignment is appropriate.  If the
18796 run-time check fails, then @cite{Program_Error} is raised.  This run-time
18797 check is suppressed if range checks are suppressed, or if the special GNAT
18798 check Alignment_Check is suppressed, or if
18799 @cite{pragma Restrictions (No_Elaboration_Code)} is in effect.
18801 Finally, GNAT does not permit overlaying of objects of controlled types or
18802 composite types containing a controlled component. In most cases, the compiler
18803 can detect an attempt at such overlays and will generate a warning at compile
18804 time and a Program_Error exception at run time.
18806 @geindex Export
18808 An address clause cannot be given for an exported object.  More
18809 understandably the real restriction is that objects with an address
18810 clause cannot be exported.  This is because such variables are not
18811 defined by the Ada program, so there is no external object to export.
18813 @geindex Import
18815 It is permissible to give an address clause and a pragma Import for the
18816 same object.  In this case, the variable is not really defined by the
18817 Ada program, so there is no external symbol to be linked.  The link name
18818 and the external name are ignored in this case.  The reason that we allow this
18819 combination is that it provides a useful idiom to avoid unwanted
18820 initializations on objects with address clauses.
18822 When an address clause is given for an object that has implicit or
18823 explicit initialization, then by default initialization takes place.  This
18824 means that the effect of the object declaration is to overwrite the
18825 memory at the specified address.  This is almost always not what the
18826 programmer wants, so GNAT will output a warning:
18828 @example
18829 with System;
18830 package G is
18831    type R is record
18832       M : Integer := 0;
18833    end record;
18835    Ext : R;
18836    for Ext'Address use System'To_Address (16#1234_1234#);
18837        |
18838 >>> warning: implicit initialization of "Ext" may
18839     modify overlaid storage
18840 >>> warning: use pragma Import for "Ext" to suppress
18841     initialization (RM B(24))
18843 end G;
18844 @end example
18846 As indicated by the warning message, the solution is to use a (dummy) pragma
18847 Import to suppress this initialization.  The pragma tell the compiler that the
18848 object is declared and initialized elsewhere.  The following package compiles
18849 without warnings (and the initialization is suppressed):
18851 @example
18852 with System;
18853 package G is
18854    type R is record
18855       M : Integer := 0;
18856    end record;
18858    Ext : R;
18859    for Ext'Address use System'To_Address (16#1234_1234#);
18860    pragma Import (Ada, Ext);
18861 end G;
18862 @end example
18864 A final issue with address clauses involves their use for overlaying
18865 variables, as in the following example:
18867 @geindex Overlaying of objects
18869 @example
18870 A : Integer;
18871 B : Integer;
18872 for B'Address use A'Address;
18873 @end example
18875 or alternatively, using the form recommended by the RM:
18877 @example
18878 A    : Integer;
18879 Addr : constant Address := A'Address;
18880 B    : Integer;
18881 for B'Address use Addr;
18882 @end example
18884 In both of these cases, @cite{A}
18885 and @cite{B} become aliased to one another via the
18886 address clause. This use of address clauses to overlay
18887 variables, achieving an effect similar to unchecked
18888 conversion was erroneous in Ada 83, but in Ada 95 and Ada 2005
18889 the effect is implementation defined. Furthermore, the
18890 Ada RM specifically recommends that in a situation
18891 like this, @cite{B} should be subject to the following
18892 implementation advice (RM 13.3(19)):
18894 @quotation
18896 "19  If the Address of an object is specified, or it is imported
18897 or exported, then the implementation should not perform
18898 optimizations based on assumptions of no aliases."
18899 @end quotation
18901 GNAT follows this recommendation, and goes further by also applying
18902 this recommendation to the overlaid variable (@cite{A}
18903 in the above example) in this case. This means that the overlay
18904 works "as expected", in that a modification to one of the variables
18905 will affect the value of the other.
18907 Note that when address clause overlays are used in this way, there is an
18908 issue of unintentional initialization, as shown by this example:
18910 @example
18911 package Overwrite_Record is
18912    type R is record
18913       A : Character := 'C';
18914       B : Character := 'A';
18915    end record;
18916    X : Short_Integer := 3;
18917    Y : R;
18918    for Y'Address use X'Address;
18919        |
18920 >>> warning: default initialization of "Y" may
18921     modify "X", use pragma Import for "Y" to
18922     suppress initialization (RM B.1(24))
18924 end Overwrite_Record;
18925 @end example
18927 Here the default initialization of @cite{Y} will clobber the value
18928 of @cite{X}, which justifies the warning. The warning notes that
18929 this effect can be eliminated by adding a @cite{pragma Import}
18930 which suppresses the initialization:
18932 @example
18933 package Overwrite_Record is
18934    type R is record
18935       A : Character := 'C';
18936       B : Character := 'A';
18937    end record;
18938    X : Short_Integer := 3;
18939    Y : R;
18940    for Y'Address use X'Address;
18941    pragma Import (Ada, Y);
18942 end Overwrite_Record;
18943 @end example
18945 Note that the use of @cite{pragma Initialize_Scalars} may cause variables to
18946 be initialized when they would not otherwise have been in the absence
18947 of the use of this pragma. This may cause an overlay to have this
18948 unintended clobbering effect. The compiler avoids this for scalar
18949 types, but not for composite objects (where in general the effect
18950 of @cite{Initialize_Scalars} is part of the initialization routine
18951 for the composite object:
18953 @example
18954 pragma Initialize_Scalars;
18955 with Ada.Text_IO;  use Ada.Text_IO;
18956 procedure Overwrite_Array is
18957    type Arr is array (1 .. 5) of Integer;
18958    X : Arr := (others => 1);
18959    A : Arr;
18960    for A'Address use X'Address;
18961        |
18962 >>> warning: default initialization of "A" may
18963     modify "X", use pragma Import for "A" to
18964     suppress initialization (RM B.1(24))
18966 begin
18967    if X /= Arr'(others => 1) then
18968       Put_Line ("X was clobbered");
18969    else
18970       Put_Line ("X was not clobbered");
18971    end if;
18972 end Overwrite_Array;
18973 @end example
18975 The above program generates the warning as shown, and at execution
18976 time, prints @cite{X was clobbered}. If the @cite{pragma Import} is
18977 added as suggested:
18979 @example
18980 pragma Initialize_Scalars;
18981 with Ada.Text_IO;  use Ada.Text_IO;
18982 procedure Overwrite_Array is
18983    type Arr is array (1 .. 5) of Integer;
18984    X : Arr := (others => 1);
18985    A : Arr;
18986    for A'Address use X'Address;
18987    pragma Import (Ada, A);
18988 begin
18989    if X /= Arr'(others => 1) then
18990       Put_Line ("X was clobbered");
18991    else
18992       Put_Line ("X was not clobbered");
18993    end if;
18994 end Overwrite_Array;
18995 @end example
18997 then the program compiles without the warning and when run will generate
18998 the output @cite{X was not clobbered}.
19000 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
19001 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{236}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{237}
19002 @section Use of Address Clauses for Memory-Mapped I/O
19005 @geindex Memory-mapped I/O
19007 A common pattern is to use an address clause to map an atomic variable to
19008 a location in memory that corresponds to a memory-mapped I/O operation or
19009 operations, for example:
19011 @example
19012 type Mem_Word is record
19013    A,B,C,D : Byte;
19014 end record;
19015 pragma Atomic (Mem_Word);
19016 for Mem_Word_Size use 32;
19018 Mem : Mem_Word;
19019 for Mem'Address use some-address;
19021 Temp := Mem;
19022 Temp.A := 32;
19023 Mem := Temp;
19024 @end example
19026 For a full access (reference or modification) of the variable (Mem) in
19027 this case, as in the above examples, GNAT guarantees that the entire atomic
19028 word will be accessed. It is not clear whether the RM requires this. For
19029 example in the above, can the compiler reference only the Mem.A field as
19030 an optimization? Whatever the answer to this question is, GNAT makes the
19031 guarantee that for such a reference, the entire word is read or written.
19033 A problem arises with a component access such as:
19035 @example
19036 Mem.A := 32;
19037 @end example
19039 Note that the component A is not declared as atomic. This means that it is
19040 not clear what this assignment means. It could correspond to full word read
19041 and write as given in the first example, or on architectures that supported
19042 such an operation it might be a single byte store instruction. The RM does
19043 not have anything to say in this situation, and GNAT does not make any
19044 guarantee. The code generated may vary from target to target. GNAT will issue
19045 a warning in such a case:
19047 @example
19048 Mem.A := 32;
19050 >>> warning: access to non-atomic component of atomic array,
19051     may cause unexpected accesses to atomic object
19052 @end example
19054 It is best to be explicit in this situation, by either declaring the
19055 components to be atomic if you want the byte store, or explicitly writing
19056 the full word access sequence if that is what the hardware requires.
19058 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
19059 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{238}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{239}
19060 @section Effect of Convention on Representation
19063 @geindex Convention
19064 @geindex effect on representation
19066 Normally the specification of a foreign language convention for a type or
19067 an object has no effect on the chosen representation.  In particular, the
19068 representation chosen for data in GNAT generally meets the standard system
19069 conventions, and for example records are laid out in a manner that is
19070 consistent with C.  This means that specifying convention C (for example)
19071 has no effect.
19073 There are four exceptions to this general rule:
19076 @itemize *
19078 @item 
19079 @emph{Convention Fortran and array subtypes}.
19081 If pragma Convention Fortran is specified for an array subtype, then in
19082 accordance with the implementation advice in section 3.6.2(11) of the
19083 Ada Reference Manual, the array will be stored in a Fortran-compatible
19084 column-major manner, instead of the normal default row-major order.
19086 @item 
19087 @emph{Convention C and enumeration types}
19089 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
19090 to accommodate all values of the type.  For example, for the enumeration
19091 type declared by:
19093 @example
19094 type Color is (Red, Green, Blue);
19095 @end example
19097 8 bits is sufficient to store all values of the type, so by default, objects
19098 of type @cite{Color} will be represented using 8 bits.  However, normal C
19099 convention is to use 32 bits for all enum values in C, since enum values
19100 are essentially of type int.  If pragma @cite{Convention C} is specified for an
19101 Ada enumeration type, then the size is modified as necessary (usually to
19102 32 bits) to be consistent with the C convention for enum values.
19104 Note that this treatment applies only to types. If Convention C is given for
19105 an enumeration object, where the enumeration type is not Convention C, then
19106 Object_Size bits are allocated. For example, for a normal enumeration type,
19107 with less than 256 elements, only 8 bits will be allocated for the object.
19108 Since this may be a surprise in terms of what C expects, GNAT will issue a
19109 warning in this situation. The warning can be suppressed by giving an explicit
19110 size clause specifying the desired size.
19112 @item 
19113 @emph{Convention C/Fortran and Boolean types}
19115 In C, the usual convention for boolean values, that is values used for
19116 conditions, is that zero represents false, and nonzero values represent
19117 true.  In Ada, the normal convention is that two specific values, typically
19118 0/1, are used to represent false/true respectively.
19120 Fortran has a similar convention for @cite{LOGICAL} values (any nonzero
19121 value represents true).
19123 To accommodate the Fortran and C conventions, if a pragma Convention specifies
19124 C or Fortran convention for a derived Boolean, as in the following example:
19126 @example
19127 type C_Switch is new Boolean;
19128 pragma Convention (C, C_Switch);
19129 @end example
19131 then the GNAT generated code will treat any nonzero value as true.  For truth
19132 values generated by GNAT, the conventional value 1 will be used for True, but
19133 when one of these values is read, any nonzero value is treated as True.
19134 @end itemize
19136 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
19137 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{23a}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{23b}
19138 @section Conventions and Anonymous Access Types
19141 @geindex Anonymous access types
19143 @geindex Convention for anonymous access types
19145 The RM is not entirely clear on convention handling in a number of cases,
19146 and in particular, it is not clear on the convention to be given to
19147 anonymous access types in general, and in particular what is to be
19148 done for the case of anonymous access-to-subprogram.
19150 In GNAT, we decide that if an explicit Convention is applied
19151 to an object or component, and its type is such an anonymous type,
19152 then the convention will apply to this anonymous type as well. This
19153 seems to make sense since it is anomolous in any case to have a
19154 different convention for an object and its type, and there is clearly
19155 no way to explicitly specify a convention for an anonymous type, since
19156 it doesn't have a name to specify!
19158 Furthermore, we decide that if a convention is applied to a record type,
19159 then this convention is inherited by any of its components that are of an
19160 anonymous access type which do not have an explicitly specified convention.
19162 The following program shows these conventions in action:
19164 @example
19165 package ConvComp is
19166    type Foo is range 1 .. 10;
19167    type T1 is record
19168       A : access function (X : Foo) return Integer;
19169       B : Integer;
19170    end record;
19171    pragma Convention (C, T1);
19173    type T2 is record
19174       A : access function (X : Foo) return Integer;
19175       pragma Convention  (C, A);
19176       B : Integer;
19177    end record;
19178    pragma Convention (COBOL, T2);
19180    type T3 is record
19181       A : access function (X : Foo) return Integer;
19182       pragma Convention  (COBOL, A);
19183       B : Integer;
19184    end record;
19185    pragma Convention (C, T3);
19187    type T4 is record
19188       A : access function (X : Foo) return Integer;
19189       B : Integer;
19190    end record;
19191    pragma Convention (COBOL, T4);
19193    function F (X : Foo) return Integer;
19194    pragma Convention (C, F);
19196    function F (X : Foo) return Integer is (13);
19198    TV1 : T1 := (F'Access, 12);  -- OK
19199    TV2 : T2 := (F'Access, 13);  -- OK
19201    TV3 : T3 := (F'Access, 13);  -- ERROR
19202                 |
19203 >>> subprogram "F" has wrong convention
19204 >>> does not match access to subprogram declared at line 17
19205      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
19206                 |
19207 >>> subprogram "F" has wrong convention
19208 >>> does not match access to subprogram declared at line 24
19209      39. end ConvComp;
19210 @end example
19212 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
19213 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{23c}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{23d}
19214 @section Determining the Representations chosen by GNAT
19217 @geindex Representation
19218 @geindex determination of
19220 @geindex -gnatR (gcc)
19222 Although the descriptions in this section are intended to be complete, it is
19223 often easier to simply experiment to see what GNAT accepts and what the
19224 effect is on the layout of types and objects.
19226 As required by the Ada RM, if a representation clause is not accepted, then
19227 it must be rejected as illegal by the compiler.  However, when a
19228 representation clause or pragma is accepted, there can still be questions
19229 of what the compiler actually does.  For example, if a partial record
19230 representation clause specifies the location of some components and not
19231 others, then where are the non-specified components placed? Or if pragma
19232 @cite{Pack} is used on a record, then exactly where are the resulting
19233 fields placed? The section on pragma @cite{Pack} in this chapter can be
19234 used to answer the second question, but it is often easier to just see
19235 what the compiler does.
19237 For this purpose, GNAT provides the option @emph{-gnatR}.  If you compile
19238 with this option, then the compiler will output information on the actual
19239 representations chosen, in a format similar to source representation
19240 clauses.  For example, if we compile the package:
19242 @example
19243 package q is
19244    type r (x : boolean) is tagged record
19245       case x is
19246          when True => S : String (1 .. 100);
19247          when False => null;
19248       end case;
19249    end record;
19251    type r2 is new r (false) with record
19252       y2 : integer;
19253    end record;
19255    for r2 use record
19256       y2 at 16 range 0 .. 31;
19257    end record;
19259    type x is record
19260       y : character;
19261    end record;
19263    type x1 is array (1 .. 10) of x;
19264    for x1'component_size use 11;
19266    type ia is access integer;
19268    type Rb1 is array (1 .. 13) of Boolean;
19269    pragma Pack (rb1);
19271    type Rb2 is array (1 .. 65) of Boolean;
19272    pragma Pack (rb2);
19274    type x2 is record
19275       l1 : Boolean;
19276       l2 : Duration;
19277       l3 : Float;
19278       l4 : Boolean;
19279       l5 : Rb1;
19280       l6 : Rb2;
19281    end record;
19282    pragma Pack (x2);
19283 end q;
19284 @end example
19286 using the switch @emph{-gnatR} we obtain the following output:
19288 @example
19289 Representation information for unit q
19290 -------------------------------------
19292 for r'Size use ??;
19293 for r'Alignment use 4;
19294 for r use record
19295    x    at 4 range  0 .. 7;
19296    _tag at 0 range  0 .. 31;
19297    s    at 5 range  0 .. 799;
19298 end record;
19300 for r2'Size use 160;
19301 for r2'Alignment use 4;
19302 for r2 use record
19303    x       at  4 range  0 .. 7;
19304    _tag    at  0 range  0 .. 31;
19305    _parent at  0 range  0 .. 63;
19306    y2      at 16 range  0 .. 31;
19307 end record;
19309 for x'Size use 8;
19310 for x'Alignment use 1;
19311 for x use record
19312    y at 0 range  0 .. 7;
19313 end record;
19315 for x1'Size use 112;
19316 for x1'Alignment use 1;
19317 for x1'Component_Size use 11;
19319 for rb1'Size use 13;
19320 for rb1'Alignment use 2;
19321 for rb1'Component_Size use 1;
19323 for rb2'Size use 72;
19324 for rb2'Alignment use 1;
19325 for rb2'Component_Size use 1;
19327 for x2'Size use 224;
19328 for x2'Alignment use 4;
19329 for x2 use record
19330    l1 at  0 range  0 .. 0;
19331    l2 at  0 range  1 .. 64;
19332    l3 at 12 range  0 .. 31;
19333    l4 at 16 range  0 .. 0;
19334    l5 at 16 range  1 .. 13;
19335    l6 at 18 range  0 .. 71;
19336 end record;
19337 @end example
19339 The Size values are actually the Object_Size, i.e., the default size that
19340 will be allocated for objects of the type.
19341 The @code{??} size for type r indicates that we have a variant record, and the
19342 actual size of objects will depend on the discriminant value.
19344 The Alignment values show the actual alignment chosen by the compiler
19345 for each record or array type.
19347 The record representation clause for type r shows where all fields
19348 are placed, including the compiler generated tag field (whose location
19349 cannot be controlled by the programmer).
19351 The record representation clause for the type extension r2 shows all the
19352 fields present, including the parent field, which is a copy of the fields
19353 of the parent type of r2, i.e., r1.
19355 The component size and size clauses for types rb1 and rb2 show
19356 the exact effect of pragma @cite{Pack} on these arrays, and the record
19357 representation clause for type x2 shows how pragma @cite{Pack} affects
19358 this record type.
19360 In some cases, it may be useful to cut and paste the representation clauses
19361 generated by the compiler into the original source to fix and guarantee
19362 the actual representation to be used.
19364 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
19365 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{23e}@anchor{gnat_rm/standard_library_routines id1}@anchor{23f}
19366 @chapter Standard Library Routines
19369 The Ada Reference Manual contains in Annex A a full description of an
19370 extensive set of standard library routines that can be used in any Ada
19371 program, and which must be provided by all Ada compilers.  They are
19372 analogous to the standard C library used by C programs.
19374 GNAT implements all of the facilities described in annex A, and for most
19375 purposes the description in the Ada Reference Manual, or appropriate Ada
19376 text book, will be sufficient for making use of these facilities.
19378 In the case of the input-output facilities,
19379 @ref{f,,The Implementation of Standard I/O},
19380 gives details on exactly how GNAT interfaces to the
19381 file system.  For the remaining packages, the Ada Reference Manual
19382 should be sufficient.  The following is a list of the packages included,
19383 together with a brief description of the functionality that is provided.
19385 For completeness, references are included to other predefined library
19386 routines defined in other sections of the Ada Reference Manual (these are
19387 cross-indexed from Annex A). For further details see the relevant
19388 package declarations in the run-time library. In particular, a few units
19389 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
19390 and in this case the package declaration contains comments explaining why
19391 the unit is not implemented.
19394 @table @asis
19396 @item @code{Ada} @emph{(A.2)}
19398 This is a parent package for all the standard library packages.  It is
19399 usually included implicitly in your program, and itself contains no
19400 useful data or routines.
19402 @item @code{Ada.Assertions} @emph{(11.4.2)}
19404 @cite{Assertions} provides the @cite{Assert} subprograms, and also
19405 the declaration of the @cite{Assertion_Error} exception.
19407 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
19409 @cite{Asynchronous_Task_Control} provides low level facilities for task
19410 synchronization. It is typically not implemented. See package spec for details.
19412 @item @code{Ada.Calendar} @emph{(9.6)}
19414 @cite{Calendar} provides time of day access, and routines for
19415 manipulating times and durations.
19417 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
19419 This package provides additional arithmetic
19420 operations for @cite{Calendar}.
19422 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
19424 This package provides formatting operations for @cite{Calendar}.
19426 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
19428 This package provides additional @cite{Calendar} facilities
19429 for handling time zones.
19431 @item @code{Ada.Characters} @emph{(A.3.1)}
19433 This is a dummy parent package that contains no useful entities
19435 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
19437 This package provides character conversion functions.
19439 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
19441 This package provides some basic character handling capabilities,
19442 including classification functions for classes of characters (e.g., test
19443 for letters, or digits).
19445 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
19447 This package includes a complete set of definitions of the characters
19448 that appear in type CHARACTER.  It is useful for writing programs that
19449 will run in international environments.  For example, if you want an
19450 upper case E with an acute accent in a string, it is often better to use
19451 the definition of @cite{UC_E_Acute} in this package.  Then your program
19452 will print in an understandable manner even if your environment does not
19453 support these extended characters.
19455 @item @code{Ada.Command_Line} @emph{(A.15)}
19457 This package provides access to the command line parameters and the name
19458 of the current program (analogous to the use of @cite{argc} and @cite{argv}
19459 in C), and also allows the exit status for the program to be set in a
19460 system-independent manner.
19462 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
19464 This package provides text input and output of complex numbers.
19466 @item @code{Ada.Containers} @emph{(A.18.1)}
19468 A top level package providing a few basic definitions used by all the
19469 following specific child packages that provide specific kinds of
19470 containers.
19471 @end table
19473 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
19475 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
19477 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
19479 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
19481 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
19483 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
19485 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
19487 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
19489 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
19491 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
19493 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
19495 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
19497 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
19499 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
19501 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
19503 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
19505 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
19507 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
19509 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
19511 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
19513 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
19515 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
19517 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
19520 @table @asis
19522 @item @code{Ada.Directories} @emph{(A.16)}
19524 This package provides operations on directories.
19526 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
19528 This package provides additional directory operations handling
19529 hiearchical file names.
19531 @item @code{Ada.Directories.Information} @emph{(A.16)}
19533 This is an implementation defined package for additional directory
19534 operations, which is not implemented in GNAT.
19536 @item @code{Ada.Decimal} @emph{(F.2)}
19538 This package provides constants describing the range of decimal numbers
19539 implemented, and also a decimal divide routine (analogous to the COBOL
19540 verb DIVIDE ... GIVING ... REMAINDER ...)
19542 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
19544 This package provides input-output using a model of a set of records of
19545 fixed-length, containing an arbitrary definite Ada type, indexed by an
19546 integer record number.
19548 @item @code{Ada.Dispatching} @emph{(D.2.1)}
19550 A parent package containing definitions for task dispatching operations.
19552 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
19554 Not implemented in GNAT.
19556 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
19558 Not implemented in GNAT.
19560 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
19562 Not implemented in GNAT.
19564 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
19566 This package allows the priorities of a task to be adjusted dynamically
19567 as the task is running.
19569 @item @code{Ada.Environment_Variables} @emph{(A.17)}
19571 This package provides facilities for accessing environment variables.
19573 @item @code{Ada.Exceptions} @emph{(11.4.1)}
19575 This package provides additional information on exceptions, and also
19576 contains facilities for treating exceptions as data objects, and raising
19577 exceptions with associated messages.
19579 @item @code{Ada.Execution_Time} @emph{(D.14)}
19581 Not implemented in GNAT.
19583 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
19585 Not implemented in GNAT.
19587 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
19589 Not implemented in GNAT.
19591 @item @code{Ada.Finalization} @emph{(7.6)}
19593 This package contains the declarations and subprograms to support the
19594 use of controlled types, providing for automatic initialization and
19595 finalization (analogous to the constructors and destructors of C++).
19597 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
19599 A library level instantiation of Text_IO.Float_IO for type Float.
19601 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
19603 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
19605 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
19607 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
19609 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
19611 A library level instantiation of Text_IO.Integer_IO for type Integer.
19613 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
19615 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
19617 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
19619 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
19621 @item @code{Ada.Interrupts} @emph{(C.3.2)}
19623 This package provides facilities for interfacing to interrupts, which
19624 includes the set of signals or conditions that can be raised and
19625 recognized as interrupts.
19627 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
19629 This package provides the set of interrupt names (actually signal
19630 or condition names) that can be handled by GNAT.
19632 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
19634 This package defines the set of exceptions that can be raised by use of
19635 the standard IO packages.
19637 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
19639 This package provides a generic interface to generalized iterators.
19641 @item @code{Ada.Locales} @emph{(A.19)}
19643 This package provides declarations providing information (Language
19644 and Country) about the current locale.
19646 @item @code{Ada.Numerics}
19648 This package contains some standard constants and exceptions used
19649 throughout the numerics packages.  Note that the constants pi and e are
19650 defined here, and it is better to use these definitions than rolling
19651 your own.
19653 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
19655 Provides operations on arrays of complex numbers.
19657 @item @code{Ada.Numerics.Complex_Elementary_Functions}
19659 Provides the implementation of standard elementary functions (such as
19660 log and trigonometric functions) operating on complex numbers using the
19661 standard @cite{Float} and the @cite{Complex} and @cite{Imaginary} types
19662 created by the package @cite{Numerics.Complex_Types}.
19664 @item @code{Ada.Numerics.Complex_Types}
19666 This is a predefined instantiation of
19667 @cite{Numerics.Generic_Complex_Types} using @cite{Standard.Float} to
19668 build the type @cite{Complex} and @cite{Imaginary}.
19670 @item @code{Ada.Numerics.Discrete_Random}
19672 This generic package provides a random number generator suitable for generating
19673 uniformly distributed values of a specified discrete subtype.
19675 @item @code{Ada.Numerics.Float_Random}
19677 This package provides a random number generator suitable for generating
19678 uniformly distributed floating point values in the unit interval.
19680 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
19682 This is a generic version of the package that provides the
19683 implementation of standard elementary functions (such as log and
19684 trigonometric functions) for an arbitrary complex type.
19686 The following predefined instantiations of this package are provided:
19689 @itemize *
19691 @item 
19692 @code{Short_Float}
19694 @cite{Ada.Numerics.Short_Complex_Elementary_Functions}
19696 @item 
19697 @code{Float}
19699 @cite{Ada.Numerics.Complex_Elementary_Functions}
19701 @item 
19702 @code{Long_Float}
19704 @cite{Ada.Numerics.Long_Complex_Elementary_Functions}
19705 @end itemize
19707 @item @code{Ada.Numerics.Generic_Complex_Types}
19709 This is a generic package that allows the creation of complex types,
19710 with associated complex arithmetic operations.
19712 The following predefined instantiations of this package exist
19715 @itemize *
19717 @item 
19718 @code{Short_Float}
19720 @cite{Ada.Numerics.Short_Complex_Complex_Types}
19722 @item 
19723 @code{Float}
19725 @cite{Ada.Numerics.Complex_Complex_Types}
19727 @item 
19728 @code{Long_Float}
19730 @cite{Ada.Numerics.Long_Complex_Complex_Types}
19731 @end itemize
19733 @item @code{Ada.Numerics.Generic_Elementary_Functions}
19735 This is a generic package that provides the implementation of standard
19736 elementary functions (such as log an trigonometric functions) for an
19737 arbitrary float type.
19739 The following predefined instantiations of this package exist
19742 @itemize *
19744 @item 
19745 @code{Short_Float}
19747 @cite{Ada.Numerics.Short_Elementary_Functions}
19749 @item 
19750 @code{Float}
19752 @cite{Ada.Numerics.Elementary_Functions}
19754 @item 
19755 @code{Long_Float}
19757 @cite{Ada.Numerics.Long_Elementary_Functions}
19758 @end itemize
19760 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
19762 Generic operations on arrays of reals
19764 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
19766 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
19768 @item @code{Ada.Real_Time} @emph{(D.8)}
19770 This package provides facilities similar to those of @cite{Calendar}, but
19771 operating with a finer clock suitable for real time control. Note that
19772 annex D requires that there be no backward clock jumps, and GNAT generally
19773 guarantees this behavior, but of course if the external clock on which
19774 the GNAT runtime depends is deliberately reset by some external event,
19775 then such a backward jump may occur.
19777 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
19779 Not implemented in GNAT.
19781 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
19783 This package provides input-output facilities for sequential files,
19784 which can contain a sequence of values of a single type, which can be
19785 any Ada type, including indefinite (unconstrained) types.
19787 @item @code{Ada.Storage_IO} @emph{(A.9)}
19789 This package provides a facility for mapping arbitrary Ada types to and
19790 from a storage buffer.  It is primarily intended for the creation of new
19791 IO packages.
19793 @item @code{Ada.Streams} @emph{(13.13.1)}
19795 This is a generic package that provides the basic support for the
19796 concept of streams as used by the stream attributes (@cite{Input},
19797 @cite{Output}, @cite{Read} and @cite{Write}).
19799 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
19801 This package is a specialization of the type @cite{Streams} defined in
19802 package @cite{Streams} together with a set of operations providing
19803 Stream_IO capability.  The Stream_IO model permits both random and
19804 sequential access to a file which can contain an arbitrary set of values
19805 of one or more Ada types.
19807 @item @code{Ada.Strings} @emph{(A.4.1)}
19809 This package provides some basic constants used by the string handling
19810 packages.
19812 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
19814 This package provides facilities for handling variable length
19815 strings.  The bounded model requires a maximum length.  It is thus
19816 somewhat more limited than the unbounded model, but avoids the use of
19817 dynamic allocation or finalization.
19819 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
19821 Provides case-insensitive comparisons of bounded strings
19823 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
19825 This package provides a generic hash function for bounded strings
19827 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
19829 This package provides a generic hash function for bounded strings that
19830 converts the string to be hashed to lower case.
19832 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
19834 This package provides a comparison function for bounded strings that works
19835 in a case insensitive manner by converting to lower case before the comparison.
19837 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
19839 This package provides facilities for handling fixed length strings.
19841 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
19843 This package provides an equality function for fixed strings that compares
19844 the strings after converting both to lower case.
19846 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
19848 This package provides a case insensitive hash function for fixed strings that
19849 converts the string to lower case before computing the hash.
19851 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
19853 This package provides a comparison function for fixed strings that works
19854 in a case insensitive manner by converting to lower case before the comparison.
19856 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
19858 This package provides a hash function for strings.
19860 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
19862 This package provides a hash function for strings that is case insensitive.
19863 The string is converted to lower case before computing the hash.
19865 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
19867 This package provides a comparison function for\strings that works
19868 in a case insensitive manner by converting to lower case before the comparison.
19870 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
19872 This package provides facilities for handling character mappings and
19873 arbitrarily defined subsets of characters.  For instance it is useful in
19874 defining specialized translation tables.
19876 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
19878 This package provides a standard set of predefined mappings and
19879 predefined character sets.  For example, the standard upper to lower case
19880 conversion table is found in this package.  Note that upper to lower case
19881 conversion is non-trivial if you want to take the entire set of
19882 characters, including extended characters like E with an acute accent,
19883 into account.  You should use the mappings in this package (rather than
19884 adding 32 yourself) to do case mappings.
19886 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
19888 This package provides facilities for handling variable length
19889 strings.  The unbounded model allows arbitrary length strings, but
19890 requires the use of dynamic allocation and finalization.
19892 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
19894 Provides case-insensitive comparisons of unbounded strings
19896 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
19898 This package provides a generic hash function for unbounded strings
19900 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
19902 This package provides a generic hash function for unbounded strings that
19903 converts the string to be hashed to lower case.
19905 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
19907 This package provides a comparison function for unbounded strings that works
19908 in a case insensitive manner by converting to lower case before the comparison.
19910 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
19912 This package provides basic definitions for dealing with UTF-encoded strings.
19914 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
19916 This package provides conversion functions for UTF-encoded strings.
19917 @end table
19919 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
19921 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
19924 @table @asis
19926 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
19928 These packages provide facilities for handling UTF encodings for
19929 Strings, Wide_Strings and Wide_Wide_Strings.
19930 @end table
19932 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
19934 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
19936 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
19939 @table @asis
19941 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
19943 These packages provide analogous capabilities to the corresponding
19944 packages without @code{Wide_} in the name, but operate with the types
19945 @cite{Wide_String} and @cite{Wide_Character} instead of @cite{String}
19946 and @cite{Character}. Versions of all the child packages are available.
19947 @end table
19949 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
19951 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
19953 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
19956 @table @asis
19958 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
19960 These packages provide analogous capabilities to the corresponding
19961 packages without @code{Wide_} in the name, but operate with the types
19962 @cite{Wide_Wide_String} and @cite{Wide_Wide_Character} instead
19963 of @cite{String} and @cite{Character}.
19965 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
19967 This package provides facilities for synchronizing tasks at a low level
19968 with barriers.
19970 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
19972 This package provides some standard facilities for controlling task
19973 communication in a synchronous manner.
19975 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
19977 Not implemented in GNAT.
19979 @item @code{Ada.Tags}
19981 This package contains definitions for manipulation of the tags of tagged
19982 values.
19984 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
19986 This package provides a way of constructing tagged class-wide values given
19987 only the tag value.
19989 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
19991 This package provides the capability of associating arbitrary
19992 task-specific data with separate tasks.
19994 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
19996 This package provides capabilities for task identification.
19998 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
20000 This package provides control over task termination.
20002 @item @code{Ada.Text_IO}
20004 This package provides basic text input-output capabilities for
20005 character, string and numeric data.  The subpackages of this
20006 package are listed next. Note that although these are defined
20007 as subpackages in the RM, they are actually transparently
20008 implemented as child packages in GNAT, meaning that they
20009 are only loaded if needed.
20011 @item @code{Ada.Text_IO.Decimal_IO}
20013 Provides input-output facilities for decimal fixed-point types
20015 @item @code{Ada.Text_IO.Enumeration_IO}
20017 Provides input-output facilities for enumeration types.
20019 @item @code{Ada.Text_IO.Fixed_IO}
20021 Provides input-output facilities for ordinary fixed-point types.
20023 @item @code{Ada.Text_IO.Float_IO}
20025 Provides input-output facilities for float types.  The following
20026 predefined instantiations of this generic package are available:
20029 @itemize *
20031 @item 
20032 @code{Short_Float}
20034 @cite{Short_Float_Text_IO}
20036 @item 
20037 @code{Float}
20039 @cite{Float_Text_IO}
20041 @item 
20042 @code{Long_Float}
20044 @cite{Long_Float_Text_IO}
20045 @end itemize
20047 @item @code{Ada.Text_IO.Integer_IO}
20049 Provides input-output facilities for integer types.  The following
20050 predefined instantiations of this generic package are available:
20053 @itemize *
20055 @item 
20056 @code{Short_Short_Integer}
20058 @cite{Ada.Short_Short_Integer_Text_IO}
20060 @item 
20061 @code{Short_Integer}
20063 @cite{Ada.Short_Integer_Text_IO}
20065 @item 
20066 @code{Integer}
20068 @cite{Ada.Integer_Text_IO}
20070 @item 
20071 @code{Long_Integer}
20073 @cite{Ada.Long_Integer_Text_IO}
20075 @item 
20076 @code{Long_Long_Integer}
20078 @cite{Ada.Long_Long_Integer_Text_IO}
20079 @end itemize
20081 @item @code{Ada.Text_IO.Modular_IO}
20083 Provides input-output facilities for modular (unsigned) types.
20085 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
20087 Provides input-output facilities for bounded strings.
20089 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
20091 This package provides basic text input-output capabilities for complex
20092 data.
20094 @item @code{Ada.Text_IO.Editing (F.3.3)}
20096 This package contains routines for edited output, analogous to the use
20097 of pictures in COBOL.  The picture formats used by this package are a
20098 close copy of the facility in COBOL.
20100 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
20102 This package provides a facility that allows Text_IO files to be treated
20103 as streams, so that the stream attributes can be used for writing
20104 arbitrary data, including binary data, to Text_IO files.
20106 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
20108 This package provides input-output facilities for unbounded strings.
20110 @item @code{Ada.Unchecked_Conversion (13.9)}
20112 This generic package allows arbitrary conversion from one type to
20113 another of the same size, providing for breaking the type safety in
20114 special circumstances.
20116 If the types have the same Size (more accurately the same Value_Size),
20117 then the effect is simply to transfer the bits from the source to the
20118 target type without any modification.  This usage is well defined, and
20119 for simple types whose representation is typically the same across
20120 all implementations, gives a portable method of performing such
20121 conversions.
20123 If the types do not have the same size, then the result is implementation
20124 defined, and thus may be non-portable.  The following describes how GNAT
20125 handles such unchecked conversion cases.
20127 If the types are of different sizes, and are both discrete types, then
20128 the effect is of a normal type conversion without any constraint checking.
20129 In particular if the result type has a larger size, the result will be
20130 zero or sign extended.  If the result type has a smaller size, the result
20131 will be truncated by ignoring high order bits.
20133 If the types are of different sizes, and are not both discrete types,
20134 then the conversion works as though pointers were created to the source
20135 and target, and the pointer value is converted.  The effect is that bits
20136 are copied from successive low order storage units and bits of the source
20137 up to the length of the target type.
20139 A warning is issued if the lengths differ, since the effect in this
20140 case is implementation dependent, and the above behavior may not match
20141 that of some other compiler.
20143 A pointer to one type may be converted to a pointer to another type using
20144 unchecked conversion.  The only case in which the effect is undefined is
20145 when one or both pointers are pointers to unconstrained array types.  In
20146 this case, the bounds information may get incorrectly transferred, and in
20147 particular, GNAT uses double size pointers for such types, and it is
20148 meaningless to convert between such pointer types.  GNAT will issue a
20149 warning if the alignment of the target designated type is more strict
20150 than the alignment of the source designated type (since the result may
20151 be unaligned in this case).
20153 A pointer other than a pointer to an unconstrained array type may be
20154 converted to and from System.Address.  Such usage is common in Ada 83
20155 programs, but note that Ada.Address_To_Access_Conversions is the
20156 preferred method of performing such conversions in Ada 95 and Ada 2005.
20157 Neither
20158 unchecked conversion nor Ada.Address_To_Access_Conversions should be
20159 used in conjunction with pointers to unconstrained objects, since
20160 the bounds information cannot be handled correctly in this case.
20162 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
20164 This generic package allows explicit freeing of storage previously
20165 allocated by use of an allocator.
20167 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
20169 This package is similar to @cite{Ada.Text_IO}, except that the external
20170 file supports wide character representations, and the internal types are
20171 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20172 and @cite{String}. The corresponding set of nested packages and child
20173 packages are defined.
20175 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
20177 This package is similar to @cite{Ada.Text_IO}, except that the external
20178 file supports wide character representations, and the internal types are
20179 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20180 and @cite{String}. The corresponding set of nested packages and child
20181 packages are defined.
20182 @end table
20184 For packages in Interfaces and System, all the RM defined packages are
20185 available in GNAT, see the Ada 2012 RM for full details.
20187 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
20188 @anchor{gnat_rm/the_implementation_of_standard_i_o the-implementation-of-standard-i-o}@anchor{f}@anchor{gnat_rm/the_implementation_of_standard_i_o doc}@anchor{240}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{241}
20189 @chapter The Implementation of Standard I/O
20192 GNAT implements all the required input-output facilities described in
20193 A.6 through A.14.  These sections of the Ada Reference Manual describe the
20194 required behavior of these packages from the Ada point of view, and if
20195 you are writing a portable Ada program that does not need to know the
20196 exact manner in which Ada maps to the outside world when it comes to
20197 reading or writing external files, then you do not need to read this
20198 chapter.  As long as your files are all regular files (not pipes or
20199 devices), and as long as you write and read the files only from Ada, the
20200 description in the Ada Reference Manual is sufficient.
20202 However, if you want to do input-output to pipes or other devices, such
20203 as the keyboard or screen, or if the files you are dealing with are
20204 either generated by some other language, or to be read by some other
20205 language, then you need to know more about the details of how the GNAT
20206 implementation of these input-output facilities behaves.
20208 In this chapter we give a detailed description of exactly how GNAT
20209 interfaces to the file system.  As always, the sources of the system are
20210 available to you for answering questions at an even more detailed level,
20211 but for most purposes the information in this chapter will suffice.
20213 Another reason that you may need to know more about how input-output is
20214 implemented arises when you have a program written in mixed languages
20215 where, for example, files are shared between the C and Ada sections of
20216 the same program.  GNAT provides some additional facilities, in the form
20217 of additional child library packages, that facilitate this sharing, and
20218 these additional facilities are also described in this chapter.
20220 @menu
20221 * Standard I/O Packages:: 
20222 * FORM Strings:: 
20223 * Direct_IO:: 
20224 * Sequential_IO:: 
20225 * Text_IO:: 
20226 * Wide_Text_IO:: 
20227 * Wide_Wide_Text_IO:: 
20228 * Stream_IO:: 
20229 * Text Translation:: 
20230 * Shared Files:: 
20231 * Filenames encoding:: 
20232 * File content encoding:: 
20233 * Open Modes:: 
20234 * Operations on C Streams:: 
20235 * Interfacing to C Streams:: 
20237 @end menu
20239 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
20240 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{242}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{243}
20241 @section Standard I/O Packages
20244 The Standard I/O packages described in Annex A for
20247 @itemize *
20249 @item 
20250 Ada.Text_IO
20252 @item 
20253 Ada.Text_IO.Complex_IO
20255 @item 
20256 Ada.Text_IO.Text_Streams
20258 @item 
20259 Ada.Wide_Text_IO
20261 @item 
20262 Ada.Wide_Text_IO.Complex_IO
20264 @item 
20265 Ada.Wide_Text_IO.Text_Streams
20267 @item 
20268 Ada.Wide_Wide_Text_IO
20270 @item 
20271 Ada.Wide_Wide_Text_IO.Complex_IO
20273 @item 
20274 Ada.Wide_Wide_Text_IO.Text_Streams
20276 @item 
20277 Ada.Stream_IO
20279 @item 
20280 Ada.Sequential_IO
20282 @item 
20283 Ada.Direct_IO
20284 @end itemize
20286 are implemented using the C
20287 library streams facility; where
20290 @itemize *
20292 @item 
20293 All files are opened using @cite{fopen}.
20295 @item 
20296 All input/output operations use @cite{fread}/@cite{fwrite}.
20297 @end itemize
20299 There is no internal buffering of any kind at the Ada library level. The only
20300 buffering is that provided at the system level in the implementation of the
20301 library routines that support streams. This facilitates shared use of these
20302 streams by mixed language programs. Note though that system level buffering is
20303 explicitly enabled at elaboration of the standard I/O packages and that can
20304 have an impact on mixed language programs, in particular those using I/O before
20305 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
20306 the Ada elaboration routine before performing any I/O or when impractical,
20307 flush the common I/O streams and in particular Standard_Output before
20308 elaborating the Ada code.
20310 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
20311 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{244}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{245}
20312 @section FORM Strings
20315 The format of a FORM string in GNAT is:
20317 @example
20318 "keyword=value,keyword=value,...,keyword=value"
20319 @end example
20321 where letters may be in upper or lower case, and there are no spaces
20322 between values.  The order of the entries is not important.  Currently
20323 the following keywords defined.
20325 @example
20326 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
20327 SHARED=[YES|NO]
20328 WCEM=[n|h|u|s|e|8|b]
20329 ENCODING=[UTF8|8BITS]
20330 @end example
20332 The use of these parameters is described later in this section. If an
20333 unrecognized keyword appears in a form string, it is silently ignored
20334 and not considered invalid.
20336 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
20337 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{246}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{247}
20338 @section Direct_IO
20341 Direct_IO can only be instantiated for definite types.  This is a
20342 restriction of the Ada language, which means that the records are fixed
20343 length (the length being determined by @code{type'Size}, rounded
20344 up to the next storage unit boundary if necessary).
20346 The records of a Direct_IO file are simply written to the file in index
20347 sequence, with the first record starting at offset zero, and subsequent
20348 records following.  There is no control information of any kind.  For
20349 example, if 32-bit integers are being written, each record takes
20350 4-bytes, so the record at index @cite{K} starts at offset
20351 (@cite{K}-1)*4.
20353 There is no limit on the size of Direct_IO files, they are expanded as
20354 necessary to accommodate whatever records are written to the file.
20356 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
20357 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{248}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{249}
20358 @section Sequential_IO
20361 Sequential_IO may be instantiated with either a definite (constrained)
20362 or indefinite (unconstrained) type.
20364 For the definite type case, the elements written to the file are simply
20365 the memory images of the data values with no control information of any
20366 kind.  The resulting file should be read using the same type, no validity
20367 checking is performed on input.
20369 For the indefinite type case, the elements written consist of two
20370 parts.  First is the size of the data item, written as the memory image
20371 of a @cite{Interfaces.C.size_t} value, followed by the memory image of
20372 the data value.  The resulting file can only be read using the same
20373 (unconstrained) type.  Normal assignment checks are performed on these
20374 read operations, and if these checks fail, @cite{Data_Error} is
20375 raised.  In particular, in the array case, the lengths must match, and in
20376 the variant record case, if the variable for a particular read operation
20377 is constrained, the discriminants must match.
20379 Note that it is not possible to use Sequential_IO to write variable
20380 length array items, and then read the data back into different length
20381 arrays.  For example, the following will raise @cite{Data_Error}:
20383 @example
20384 package IO is new Sequential_IO (String);
20385 F : IO.File_Type;
20386 S : String (1..4);
20388 IO.Create (F)
20389 IO.Write (F, "hello!")
20390 IO.Reset (F, Mode=>In_File);
20391 IO.Read (F, S);
20392 Put_Line (S);
20393 @end example
20395 On some Ada implementations, this will print @cite{hell}, but the program is
20396 clearly incorrect, since there is only one element in the file, and that
20397 element is the string @cite{hello!}.
20399 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
20400 using Stream_IO, and this is the preferred mechanism.  In particular, the
20401 above program fragment rewritten to use Stream_IO will work correctly.
20403 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
20404 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{24a}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{24b}
20405 @section Text_IO
20408 Text_IO files consist of a stream of characters containing the following
20409 special control characters:
20411 @example
20412 LF (line feed, 16#0A#) Line Mark
20413 FF (form feed, 16#0C#) Page Mark
20414 @end example
20416 A canonical Text_IO file is defined as one in which the following
20417 conditions are met:
20420 @itemize *
20422 @item 
20423 The character @cite{LF} is used only as a line mark, i.e., to mark the end
20424 of the line.
20426 @item 
20427 The character @cite{FF} is used only as a page mark, i.e., to mark the
20428 end of a page and consequently can appear only immediately following a
20429 @cite{LF} (line mark) character.
20431 @item 
20432 The file ends with either @cite{LF} (line mark) or @cite{LF}-@cite{FF}
20433 (line mark, page mark).  In the former case, the page mark is implicitly
20434 assumed to be present.
20435 @end itemize
20437 A file written using Text_IO will be in canonical form provided that no
20438 explicit @cite{LF} or @cite{FF} characters are written using @cite{Put}
20439 or @cite{Put_Line}.  There will be no @cite{FF} character at the end of
20440 the file unless an explicit @cite{New_Page} operation was performed
20441 before closing the file.
20443 A canonical Text_IO file that is a regular file (i.e., not a device or a
20444 pipe) can be read using any of the routines in Text_IO.  The
20445 semantics in this case will be exactly as defined in the Ada Reference
20446 Manual, and all the routines in Text_IO are fully implemented.
20448 A text file that does not meet the requirements for a canonical Text_IO
20449 file has one of the following:
20452 @itemize *
20454 @item 
20455 The file contains @cite{FF} characters not immediately following a
20456 @cite{LF} character.
20458 @item 
20459 The file contains @cite{LF} or @cite{FF} characters written by
20460 @cite{Put} or @cite{Put_Line}, which are not logically considered to be
20461 line marks or page marks.
20463 @item 
20464 The file ends in a character other than @cite{LF} or @cite{FF},
20465 i.e., there is no explicit line mark or page mark at the end of the file.
20466 @end itemize
20468 Text_IO can be used to read such non-standard text files but subprograms
20469 to do with line or page numbers do not have defined meanings.  In
20470 particular, a @cite{FF} character that does not follow a @cite{LF}
20471 character may or may not be treated as a page mark from the point of
20472 view of page and line numbering.  Every @cite{LF} character is considered
20473 to end a line, and there is an implied @cite{LF} character at the end of
20474 the file.
20476 @menu
20477 * Stream Pointer Positioning:: 
20478 * Reading and Writing Non-Regular Files:: 
20479 * Get_Immediate:: 
20480 * Treating Text_IO Files as Streams:: 
20481 * Text_IO Extensions:: 
20482 * Text_IO Facilities for Unbounded Strings:: 
20484 @end menu
20486 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
20487 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{24c}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{24d}
20488 @subsection Stream Pointer Positioning
20491 @cite{Ada.Text_IO} has a definition of current position for a file that
20492 is being read.  No internal buffering occurs in Text_IO, and usually the
20493 physical position in the stream used to implement the file corresponds
20494 to this logical position defined by Text_IO.  There are two exceptions:
20497 @itemize *
20499 @item 
20500 After a call to @cite{End_Of_Page} that returns @cite{True}, the stream
20501 is positioned past the @cite{LF} (line mark) that precedes the page
20502 mark.  Text_IO maintains an internal flag so that subsequent read
20503 operations properly handle the logical position which is unchanged by
20504 the @cite{End_Of_Page} call.
20506 @item 
20507 After a call to @cite{End_Of_File} that returns @cite{True}, if the
20508 Text_IO file was positioned before the line mark at the end of file
20509 before the call, then the logical position is unchanged, but the stream
20510 is physically positioned right at the end of file (past the line mark,
20511 and past a possible page mark following the line mark.  Again Text_IO
20512 maintains internal flags so that subsequent read operations properly
20513 handle the logical position.
20514 @end itemize
20516 These discrepancies have no effect on the observable behavior of
20517 Text_IO, but if a single Ada stream is shared between a C program and
20518 Ada program, or shared (using @code{shared=yes} in the form string)
20519 between two Ada files, then the difference may be observable in some
20520 situations.
20522 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
20523 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{24e}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{24f}
20524 @subsection Reading and Writing Non-Regular Files
20527 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
20528 can be used for reading and writing.  Writing is not affected and the
20529 sequence of characters output is identical to the normal file case, but
20530 for reading, the behavior of Text_IO is modified to avoid undesirable
20531 look-ahead as follows:
20533 An input file that is not a regular file is considered to have no page
20534 marks.  Any @cite{Ascii.FF} characters (the character normally used for a
20535 page mark) appearing in the file are considered to be data
20536 characters.  In particular:
20539 @itemize *
20541 @item 
20542 @cite{Get_Line} and @cite{Skip_Line} do not test for a page mark
20543 following a line mark.  If a page mark appears, it will be treated as a
20544 data character.
20546 @item 
20547 This avoids the need to wait for an extra character to be typed or
20548 entered from the pipe to complete one of these operations.
20550 @item 
20551 @cite{End_Of_Page} always returns @cite{False}
20553 @item 
20554 @cite{End_Of_File} will return @cite{False} if there is a page mark at
20555 the end of the file.
20556 @end itemize
20558 Output to non-regular files is the same as for regular files.  Page marks
20559 may be written to non-regular files using @cite{New_Page}, but as noted
20560 above they will not be treated as page marks on input if the output is
20561 piped to another Ada program.
20563 Another important discrepancy when reading non-regular files is that the end
20564 of file indication is not 'sticky'.  If an end of file is entered, e.g., by
20565 pressing the @code{EOT} key,
20566 then end of file
20567 is signaled once (i.e., the test @cite{End_Of_File}
20568 will yield @cite{True}, or a read will
20569 raise @cite{End_Error}), but then reading can resume
20570 to read data past that end of
20571 file indication, until another end of file indication is entered.
20573 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
20574 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{250}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{251}
20575 @subsection Get_Immediate
20578 @geindex Get_Immediate
20580 Get_Immediate returns the next character (including control characters)
20581 from the input file.  In particular, Get_Immediate will return LF or FF
20582 characters used as line marks or page marks.  Such operations leave the
20583 file positioned past the control character, and it is thus not treated
20584 as having its normal function.  This means that page, line and column
20585 counts after this kind of Get_Immediate call are set as though the mark
20586 did not occur.  In the case where a Get_Immediate leaves the file
20587 positioned between the line mark and page mark (which is not normally
20588 possible), it is undefined whether the FF character will be treated as a
20589 page mark.
20591 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
20592 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{252}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{253}
20593 @subsection Treating Text_IO Files as Streams
20596 @geindex Stream files
20598 The package @cite{Text_IO.Streams} allows a Text_IO file to be treated
20599 as a stream.  Data written to a Text_IO file in this stream mode is
20600 binary data.  If this binary data contains bytes 16#0A# (@cite{LF}) or
20601 16#0C# (@cite{FF}), the resulting file may have non-standard
20602 format.  Similarly if read operations are used to read from a Text_IO
20603 file treated as a stream, then @cite{LF} and @cite{FF} characters may be
20604 skipped and the effect is similar to that described above for
20605 @cite{Get_Immediate}.
20607 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
20608 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{254}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{255}
20609 @subsection Text_IO Extensions
20612 @geindex Text_IO extensions
20614 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
20615 to the standard @cite{Text_IO} package:
20618 @itemize *
20620 @item 
20621 function File_Exists (Name : String) return Boolean;
20622 Determines if a file of the given name exists.
20624 @item 
20625 function Get_Line return String;
20626 Reads a string from the standard input file.  The value returned is exactly
20627 the length of the line that was read.
20629 @item 
20630 function Get_Line (File : Ada.Text_IO.File_Type) return String;
20631 Similar, except that the parameter File specifies the file from which
20632 the string is to be read.
20633 @end itemize
20635 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
20636 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{256}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{257}
20637 @subsection Text_IO Facilities for Unbounded Strings
20640 @geindex Text_IO for unbounded strings
20642 @geindex Unbounded_String
20643 @geindex Text_IO operations
20645 The package @cite{Ada.Strings.Unbounded.Text_IO}
20646 in library files @cite{a-suteio.ads/adb} contains some GNAT-specific
20647 subprograms useful for Text_IO operations on unbounded strings:
20650 @itemize *
20652 @item 
20653 function Get_Line (File : File_Type) return Unbounded_String;
20654 Reads a line from the specified file
20655 and returns the result as an unbounded string.
20657 @item 
20658 procedure Put (File : File_Type; U : Unbounded_String);
20659 Writes the value of the given unbounded string to the specified file
20660 Similar to the effect of
20661 @cite{Put (To_String (U))} except that an extra copy is avoided.
20663 @item 
20664 procedure Put_Line (File : File_Type; U : Unbounded_String);
20665 Writes the value of the given unbounded string to the specified file,
20666 followed by a @cite{New_Line}.
20667 Similar to the effect of @cite{Put_Line (To_String (U))} except
20668 that an extra copy is avoided.
20669 @end itemize
20671 In the above procedures, @cite{File} is of type @cite{Ada.Text_IO.File_Type}
20672 and is optional.  If the parameter is omitted, then the standard input or
20673 output file is referenced as appropriate.
20675 The package @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
20676 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
20677 @cite{Wide_Text_IO} functionality for unbounded wide strings.
20679 The package @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
20680 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
20681 @cite{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
20683 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
20684 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{258}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{259}
20685 @section Wide_Text_IO
20688 @cite{Wide_Text_IO} is similar in most respects to Text_IO, except that
20689 both input and output files may contain special sequences that represent
20690 wide character values.  The encoding scheme for a given file may be
20691 specified using a FORM parameter:
20693 @example
20694 WCEM=`x`
20695 @end example
20697 as part of the FORM string (WCEM = wide character encoding method),
20698 where @cite{x} is one of the following characters
20701 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
20702 @headitem
20704 Character
20706 @tab
20708 Encoding
20710 @item
20712 @emph{h}
20714 @tab
20716 Hex ESC encoding
20718 @item
20720 @emph{u}
20722 @tab
20724 Upper half encoding
20726 @item
20728 @emph{s}
20730 @tab
20732 Shift-JIS encoding
20734 @item
20736 @emph{e}
20738 @tab
20740 EUC Encoding
20742 @item
20744 @emph{8}
20746 @tab
20748 UTF-8 encoding
20750 @item
20752 @emph{b}
20754 @tab
20756 Brackets encoding
20758 @end multitable
20761 The encoding methods match those that
20762 can be used in a source
20763 program, but there is no requirement that the encoding method used for
20764 the source program be the same as the encoding method used for files,
20765 and different files may use different encoding methods.
20767 The default encoding method for the standard files, and for opened files
20768 for which no WCEM parameter is given in the FORM string matches the
20769 wide character encoding specified for the main program (the default
20770 being brackets encoding if no coding method was specified with -gnatW).
20773 @table @asis
20775 @item @emph{Hex Coding}
20777 In this encoding, a wide character is represented by a five character
20778 sequence:
20779 @end table
20781 @example
20782 ESC a b c d
20783 @end example
20786 @quotation
20788 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
20789 characters (using upper case letters) of the wide character code.  For
20790 example, ESC A345 is used to represent the wide character with code
20791 16#A345#.  This scheme is compatible with use of the full
20792 @cite{Wide_Character} set.
20793 @end quotation
20796 @table @asis
20798 @item @emph{Upper Half Coding}
20800 The wide character with encoding 16#abcd#, where the upper bit is on
20801 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
20802 16#cd#.  The second byte may never be a format control character, but is
20803 not required to be in the upper half.  This method can be also used for
20804 shift-JIS or EUC where the internal coding matches the external coding.
20806 @item @emph{Shift JIS Coding}
20808 A wide character is represented by a two character sequence 16#ab# and
20809 16#cd#, with the restrictions described for upper half encoding as
20810 described above.  The internal character code is the corresponding JIS
20811 character according to the standard algorithm for Shift-JIS
20812 conversion.  Only characters defined in the JIS code set table can be
20813 used with this encoding method.
20815 @item @emph{EUC Coding}
20817 A wide character is represented by a two character sequence 16#ab# and
20818 16#cd#, with both characters being in the upper half.  The internal
20819 character code is the corresponding JIS character according to the EUC
20820 encoding algorithm.  Only characters defined in the JIS code set table
20821 can be used with this encoding method.
20823 @item @emph{UTF-8 Coding}
20825 A wide character is represented using
20826 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
20827 10646-1/Am.2.  Depending on the character value, the representation
20828 is a one, two, or three byte sequence:
20829 @end table
20831 @example
20832 16#0000#-16#007f#: 2#0xxxxxxx#
20833 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
20834 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
20835 @end example
20838 @quotation
20840 where the @cite{xxx} bits correspond to the left-padded bits of the
20841 16-bit character value.  Note that all lower half ASCII characters
20842 are represented as ASCII bytes and all upper half characters and
20843 other wide characters are represented as sequences of upper-half
20844 (The full UTF-8 scheme allows for encoding 31-bit characters as
20845 6-byte sequences, but in this implementation, all UTF-8 sequences
20846 of four or more bytes length will raise a Constraint_Error, as
20847 will all invalid UTF-8 sequences.)
20848 @end quotation
20851 @table @asis
20853 @item @emph{Brackets Coding}
20855 In this encoding, a wide character is represented by the following eight
20856 character sequence:
20857 @end table
20859 @example
20860 [ " a b c d " ]
20861 @end example
20864 @quotation
20866 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
20867 characters (using uppercase letters) of the wide character code.  For
20868 example, @cite{["A345"]} is used to represent the wide character with code
20869 @cite{16#A345#}.
20870 This scheme is compatible with use of the full Wide_Character set.
20871 On input, brackets coding can also be used for upper half characters,
20872 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
20873 is only used for wide characters with a code greater than @cite{16#FF#}.
20875 Note that brackets coding is not normally used in the context of
20876 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
20877 a portable way of encoding source files. In the context of Wide_Text_IO
20878 or Wide_Wide_Text_IO, it can only be used if the file does not contain
20879 any instance of the left bracket character other than to encode wide
20880 character values using the brackets encoding method. In practice it is
20881 expected that some standard wide character encoding method such
20882 as UTF-8 will be used for text input output.
20884 If brackets notation is used, then any occurrence of a left bracket
20885 in the input file which is not the start of a valid wide character
20886 sequence will cause Constraint_Error to be raised. It is possible to
20887 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
20888 input will interpret this as a left bracket.
20890 However, when a left bracket is output, it will be output as a left bracket
20891 and not as ["5B"]. We make this decision because for normal use of
20892 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
20893 brackets. For example, if we write:
20895 @example
20896 Put_Line ("Start of output [first run]");
20897 @end example
20899 we really do not want to have the left bracket in this message clobbered so
20900 that the output reads:
20901 @end quotation
20903 @example
20904 Start of output ["5B"]first run]
20905 @end example
20908 @quotation
20910 In practice brackets encoding is reasonably useful for normal Put_Line use
20911 since we won't get confused between left brackets and wide character
20912 sequences in the output. But for input, or when files are written out
20913 and read back in, it really makes better sense to use one of the standard
20914 encoding methods such as UTF-8.
20915 @end quotation
20917 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
20918 not all wide character
20919 values can be represented.  An attempt to output a character that cannot
20920 be represented using the encoding scheme for the file causes
20921 Constraint_Error to be raised.  An invalid wide character sequence on
20922 input also causes Constraint_Error to be raised.
20924 @menu
20925 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
20926 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
20928 @end menu
20930 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
20931 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{25a}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{25b}
20932 @subsection Stream Pointer Positioning
20935 @cite{Ada.Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
20936 of stream pointer positioning (@ref{24b,,Text_IO}).  There is one additional
20937 case:
20939 If @cite{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
20940 normal lower ASCII set (i.e., a character in the range:
20942 @example
20943 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
20944 @end example
20946 then although the logical position of the file pointer is unchanged by
20947 the @cite{Look_Ahead} call, the stream is physically positioned past the
20948 wide character sequence.  Again this is to avoid the need for buffering
20949 or backup, and all @cite{Wide_Text_IO} routines check the internal
20950 indication that this situation has occurred so that this is not visible
20951 to a normal program using @cite{Wide_Text_IO}.  However, this discrepancy
20952 can be observed if the wide text file shares a stream with another file.
20954 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
20955 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{25c}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{25d}
20956 @subsection Reading and Writing Non-Regular Files
20959 As in the case of Text_IO, when a non-regular file is read, it is
20960 assumed that the file contains no page marks (any form characters are
20961 treated as data characters), and @cite{End_Of_Page} always returns
20962 @cite{False}.  Similarly, the end of file indication is not sticky, so
20963 it is possible to read beyond an end of file.
20965 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
20966 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{25e}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{25f}
20967 @section Wide_Wide_Text_IO
20970 @cite{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
20971 both input and output files may contain special sequences that represent
20972 wide wide character values.  The encoding scheme for a given file may be
20973 specified using a FORM parameter:
20975 @example
20976 WCEM=`x`
20977 @end example
20979 as part of the FORM string (WCEM = wide character encoding method),
20980 where @cite{x} is one of the following characters
20983 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
20984 @headitem
20986 Character
20988 @tab
20990 Encoding
20992 @item
20994 @emph{h}
20996 @tab
20998 Hex ESC encoding
21000 @item
21002 @emph{u}
21004 @tab
21006 Upper half encoding
21008 @item
21010 @emph{s}
21012 @tab
21014 Shift-JIS encoding
21016 @item
21018 @emph{e}
21020 @tab
21022 EUC Encoding
21024 @item
21026 @emph{8}
21028 @tab
21030 UTF-8 encoding
21032 @item
21034 @emph{b}
21036 @tab
21038 Brackets encoding
21040 @end multitable
21043 The encoding methods match those that
21044 can be used in a source
21045 program, but there is no requirement that the encoding method used for
21046 the source program be the same as the encoding method used for files,
21047 and different files may use different encoding methods.
21049 The default encoding method for the standard files, and for opened files
21050 for which no WCEM parameter is given in the FORM string matches the
21051 wide character encoding specified for the main program (the default
21052 being brackets encoding if no coding method was specified with -gnatW).
21055 @table @asis
21057 @item @emph{UTF-8 Coding}
21059 A wide character is represented using
21060 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21061 10646-1/Am.2.  Depending on the character value, the representation
21062 is a one, two, three, or four byte sequence:
21063 @end table
21065 @example
21066 16#000000#-16#00007f#: 2#0xxxxxxx#
21067 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
21068 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21069 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
21070 @end example
21073 @quotation
21075 where the @cite{xxx} bits correspond to the left-padded bits of the
21076 21-bit character value.  Note that all lower half ASCII characters
21077 are represented as ASCII bytes and all upper half characters and
21078 other wide characters are represented as sequences of upper-half
21079 characters.
21080 @end quotation
21083 @table @asis
21085 @item @emph{Brackets Coding}
21087 In this encoding, a wide wide character is represented by the following eight
21088 character sequence if is in wide character range
21089 @end table
21091 @example
21092 [ " a b c d " ]
21093 @end example
21096 @quotation
21098 and by the following ten character sequence if not
21099 @end quotation
21101 @example
21102 [ " a b c d e f " ]
21103 @end example
21106 @quotation
21108 where @cite{a}, @cite{b}, @cite{c}, @cite{d}, @cite{e}, and @cite{f}
21109 are the four or six hexadecimal
21110 characters (using uppercase letters) of the wide wide character code.  For
21111 example, @cite{["01A345"]} is used to represent the wide wide character
21112 with code @cite{16#01A345#}.
21114 This scheme is compatible with use of the full Wide_Wide_Character set.
21115 On input, brackets coding can also be used for upper half characters,
21116 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21117 is only used for wide characters with a code greater than @cite{16#FF#}.
21118 @end quotation
21120 If is also possible to use the other Wide_Character encoding methods,
21121 such as Shift-JIS, but the other schemes cannot support the full range
21122 of wide wide characters.
21123 An attempt to output a character that cannot
21124 be represented using the encoding scheme for the file causes
21125 Constraint_Error to be raised.  An invalid wide character sequence on
21126 input also causes Constraint_Error to be raised.
21128 @menu
21129 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
21130 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
21132 @end menu
21134 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
21135 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{260}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{261}
21136 @subsection Stream Pointer Positioning
21139 @cite{Ada.Wide_Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21140 of stream pointer positioning (@ref{24b,,Text_IO}).  There is one additional
21141 case:
21143 If @cite{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
21144 normal lower ASCII set (i.e., a character in the range:
21146 @example
21147 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
21148 @end example
21150 then although the logical position of the file pointer is unchanged by
21151 the @cite{Look_Ahead} call, the stream is physically positioned past the
21152 wide character sequence.  Again this is to avoid the need for buffering
21153 or backup, and all @cite{Wide_Wide_Text_IO} routines check the internal
21154 indication that this situation has occurred so that this is not visible
21155 to a normal program using @cite{Wide_Wide_Text_IO}.  However, this discrepancy
21156 can be observed if the wide text file shares a stream with another file.
21158 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
21159 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{262}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{263}
21160 @subsection Reading and Writing Non-Regular Files
21163 As in the case of Text_IO, when a non-regular file is read, it is
21164 assumed that the file contains no page marks (any form characters are
21165 treated as data characters), and @cite{End_Of_Page} always returns
21166 @cite{False}.  Similarly, the end of file indication is not sticky, so
21167 it is possible to read beyond an end of file.
21169 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
21170 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{264}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{265}
21171 @section Stream_IO
21174 A stream file is a sequence of bytes, where individual elements are
21175 written to the file as described in the Ada Reference Manual.  The type
21176 @cite{Stream_Element} is simply a byte.  There are two ways to read or
21177 write a stream file.
21180 @itemize *
21182 @item 
21183 The operations @cite{Read} and @cite{Write} directly read or write a
21184 sequence of stream elements with no control information.
21186 @item 
21187 The stream attributes applied to a stream file transfer data in the
21188 manner described for stream attributes.
21189 @end itemize
21191 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
21192 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{266}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{267}
21193 @section Text Translation
21196 @code{Text_Translation=xxx} may be used as the Form parameter
21197 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
21198 has no effect on Unix systems. Possible values are:
21201 @itemize *
21203 @item 
21204 @code{Yes} or @code{Text} is the default, which means to
21205 translate LF to/from CR/LF on Windows systems.
21207 @code{No} disables this translation; i.e. it
21208 uses binary mode. For output files, @code{Text_Translation=No}
21209 may be used to create Unix-style files on
21210 Windows.
21212 @item 
21213 @code{wtext} translation enabled in Unicode mode.
21214 (corresponds to _O_WTEXT).
21216 @item 
21217 @code{u8text} translation enabled in Unicode UTF-8 mode.
21218 (corresponds to O_U8TEXT).
21220 @item 
21221 @code{u16text} translation enabled in Unicode UTF-16
21222 mode. (corresponds to_O_U16TEXT).
21223 @end itemize
21225 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
21226 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{268}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{269}
21227 @section Shared Files
21230 Section A.14 of the Ada Reference Manual allows implementations to
21231 provide a wide variety of behavior if an attempt is made to access the
21232 same external file with two or more internal files.
21234 To provide a full range of functionality, while at the same time
21235 minimizing the problems of portability caused by this implementation
21236 dependence, GNAT handles file sharing as follows:
21239 @itemize *
21241 @item 
21242 In the absence of a @code{shared=xxx} form parameter, an attempt
21243 to open two or more files with the same full name is considered an error
21244 and is not supported.  The exception @cite{Use_Error} will be
21245 raised.  Note that a file that is not explicitly closed by the program
21246 remains open until the program terminates.
21248 @item 
21249 If the form parameter @code{shared=no} appears in the form string, the
21250 file can be opened or created with its own separate stream identifier,
21251 regardless of whether other files sharing the same external file are
21252 opened.  The exact effect depends on how the C stream routines handle
21253 multiple accesses to the same external files using separate streams.
21255 @item 
21256 If the form parameter @code{shared=yes} appears in the form string for
21257 each of two or more files opened using the same full name, the same
21258 stream is shared between these files, and the semantics are as described
21259 in Ada Reference Manual, Section A.14.
21260 @end itemize
21262 When a program that opens multiple files with the same name is ported
21263 from another Ada compiler to GNAT, the effect will be that
21264 @cite{Use_Error} is raised.
21266 The documentation of the original compiler and the documentation of the
21267 program should then be examined to determine if file sharing was
21268 expected, and @code{shared=xxx} parameters added to @cite{Open}
21269 and @cite{Create} calls as required.
21271 When a program is ported from GNAT to some other Ada compiler, no
21272 special attention is required unless the @code{shared=xxx} form
21273 parameter is used in the program.  In this case, you must examine the
21274 documentation of the new compiler to see if it supports the required
21275 file sharing semantics, and form strings modified appropriately.  Of
21276 course it may be the case that the program cannot be ported if the
21277 target compiler does not support the required functionality.  The best
21278 approach in writing portable code is to avoid file sharing (and hence
21279 the use of the @code{shared=xxx} parameter in the form string)
21280 completely.
21282 One common use of file sharing in Ada 83 is the use of instantiations of
21283 Sequential_IO on the same file with different types, to achieve
21284 heterogeneous input-output.  Although this approach will work in GNAT if
21285 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
21286 for this purpose (using the stream attributes)
21288 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
21289 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{26a}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{26b}
21290 @section Filenames encoding
21293 An encoding form parameter can be used to specify the filename
21294 encoding @code{encoding=xxx}.
21297 @itemize *
21299 @item 
21300 If the form parameter @code{encoding=utf8} appears in the form string, the
21301 filename must be encoded in UTF-8.
21303 @item 
21304 If the form parameter @code{encoding=8bits} appears in the form
21305 string, the filename must be a standard 8bits string.
21306 @end itemize
21308 In the absence of a @code{encoding=xxx} form parameter, the
21309 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
21310 variable. And if not set @code{utf8} is assumed.
21313 @table @asis
21315 @item @emph{CP_ACP}
21317 The current system Windows ANSI code page.
21319 @item @emph{CP_UTF8}
21321 UTF-8 encoding
21322 @end table
21324 This encoding form parameter is only supported on the Windows
21325 platform. On the other Operating Systems the run-time is supporting
21326 UTF-8 natively.
21328 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
21329 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{26c}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{26d}
21330 @section File content encoding
21333 For text files it is possible to specify the encoding to use. This is
21334 controlled by the by the @code{GNAT_CCS_ENCODING} environment
21335 variable. And if not set @code{TEXT} is assumed.
21337 The possible values are those supported on Windows:
21340 @table @asis
21342 @item @emph{TEXT}
21344 Translated text mode
21346 @item @emph{WTEXT}
21348 Translated unicode encoding
21350 @item @emph{U16TEXT}
21352 Unicode 16-bit encoding
21354 @item @emph{U8TEXT}
21356 Unicode 8-bit encoding
21357 @end table
21359 This encoding is only supported on the Windows platform.
21361 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
21362 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{26e}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{26f}
21363 @section Open Modes
21366 @cite{Open} and @cite{Create} calls result in a call to @cite{fopen}
21367 using the mode shown in the following table:
21370 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
21371 @headitem
21373 @cite{Open} and @cite{Create} Call Modes
21375 @tab
21377 @tab
21379 @item
21381 @tab
21383 @strong{OPEN}
21385 @tab
21387 @strong{CREATE}
21389 @item
21391 Append_File
21393 @tab
21395 "r+"
21397 @tab
21399 "w+"
21401 @item
21403 In_File
21405 @tab
21409 @tab
21411 "w+"
21413 @item
21415 Out_File (Direct_IO)
21417 @tab
21419 "r+"
21421 @tab
21425 @item
21427 Out_File (all other cases)
21429 @tab
21433 @tab
21437 @item
21439 Inout_File
21441 @tab
21443 "r+"
21445 @tab
21447 "w+"
21449 @end multitable
21452 If text file translation is required, then either @code{b} or @code{t}
21453 is added to the mode, depending on the setting of Text.  Text file
21454 translation refers to the mapping of CR/LF sequences in an external file
21455 to LF characters internally.  This mapping only occurs in DOS and
21456 DOS-like systems, and is not relevant to other systems.
21458 A special case occurs with Stream_IO.  As shown in the above table, the
21459 file is initially opened in @code{r} or @code{w} mode for the
21460 @cite{In_File} and @cite{Out_File} cases.  If a @cite{Set_Mode} operation
21461 subsequently requires switching from reading to writing or vice-versa,
21462 then the file is reopened in @code{r+} mode to permit the required operation.
21464 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
21465 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{270}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{271}
21466 @section Operations on C Streams
21469 The package @cite{Interfaces.C_Streams} provides an Ada program with direct
21470 access to the C library functions for operations on C streams:
21472 @example
21473 package Interfaces.C_Streams is
21474   -- Note: the reason we do not use the types that are in
21475   -- Interfaces.C is that we want to avoid dragging in the
21476   -- code in this unit if possible.
21477   subtype chars is System.Address;
21478   -- Pointer to null-terminated array of characters
21479   subtype FILEs is System.Address;
21480   -- Corresponds to the C type FILE*
21481   subtype voids is System.Address;
21482   -- Corresponds to the C type void*
21483   subtype int is Integer;
21484   subtype long is Long_Integer;
21485   -- Note: the above types are subtypes deliberately, and it
21486   -- is part of this spec that the above correspondences are
21487   -- guaranteed.  This means that it is legitimate to, for
21488   -- example, use Integer instead of int.  We provide these
21489   -- synonyms for clarity, but in some cases it may be
21490   -- convenient to use the underlying types (for example to
21491   -- avoid an unnecessary dependency of a spec on the spec
21492   -- of this unit).
21493   type size_t is mod 2 ** Standard'Address_Size;
21494   NULL_Stream : constant FILEs;
21495   -- Value returned (NULL in C) to indicate an
21496   -- fdopen/fopen/tmpfile error
21497   ----------------------------------
21498   -- Constants Defined in stdio.h --
21499   ----------------------------------
21500   EOF : constant int;
21501   -- Used by a number of routines to indicate error or
21502   -- end of file
21503   IOFBF : constant int;
21504   IOLBF : constant int;
21505   IONBF : constant int;
21506   -- Used to indicate buffering mode for setvbuf call
21507   SEEK_CUR : constant int;
21508   SEEK_END : constant int;
21509   SEEK_SET : constant int;
21510   -- Used to indicate origin for fseek call
21511   function stdin return FILEs;
21512   function stdout return FILEs;
21513   function stderr return FILEs;
21514   -- Streams associated with standard files
21515   --------------------------
21516   -- Standard C functions --
21517   --------------------------
21518   -- The functions selected below are ones that are
21519   -- available in UNIX (but not necessarily in ANSI C).
21520   -- These are very thin interfaces
21521   -- which copy exactly the C headers.  For more
21522   -- documentation on these functions, see the Microsoft C
21523   -- "Run-Time Library Reference" (Microsoft Press, 1990,
21524   -- ISBN 1-55615-225-6), which includes useful information
21525   -- on system compatibility.
21526   procedure clearerr (stream : FILEs);
21527   function fclose (stream : FILEs) return int;
21528   function fdopen (handle : int; mode : chars) return FILEs;
21529   function feof (stream : FILEs) return int;
21530   function ferror (stream : FILEs) return int;
21531   function fflush (stream : FILEs) return int;
21532   function fgetc (stream : FILEs) return int;
21533   function fgets (strng : chars; n : int; stream : FILEs)
21534       return chars;
21535   function fileno (stream : FILEs) return int;
21536   function fopen (filename : chars; Mode : chars)
21537       return FILEs;
21538   -- Note: to maintain target independence, use
21539   -- text_translation_required, a boolean variable defined in
21540   -- a-sysdep.c to deal with the target dependent text
21541   -- translation requirement.  If this variable is set,
21542   -- then  b/t should be appended to the standard mode
21543   -- argument to set the text translation mode off or on
21544   -- as required.
21545   function fputc (C : int; stream : FILEs) return int;
21546   function fputs (Strng : chars; Stream : FILEs) return int;
21547   function fread
21548      (buffer : voids;
21549       size : size_t;
21550       count : size_t;
21551       stream : FILEs)
21552       return size_t;
21553   function freopen
21554      (filename : chars;
21555       mode : chars;
21556       stream : FILEs)
21557       return FILEs;
21558   function fseek
21559      (stream : FILEs;
21560       offset : long;
21561       origin : int)
21562       return int;
21563   function ftell (stream : FILEs) return long;
21564   function fwrite
21565      (buffer : voids;
21566       size : size_t;
21567       count : size_t;
21568       stream : FILEs)
21569       return size_t;
21570   function isatty (handle : int) return int;
21571   procedure mktemp (template : chars);
21572   -- The return value (which is just a pointer to template)
21573   -- is discarded
21574   procedure rewind (stream : FILEs);
21575   function rmtmp return int;
21576   function setvbuf
21577      (stream : FILEs;
21578       buffer : chars;
21579       mode : int;
21580       size : size_t)
21581       return int;
21583   function tmpfile return FILEs;
21584   function ungetc (c : int; stream : FILEs) return int;
21585   function unlink (filename : chars) return int;
21586   ---------------------
21587   -- Extra functions --
21588   ---------------------
21589   -- These functions supply slightly thicker bindings than
21590   -- those above.  They are derived from functions in the
21591   -- C Run-Time Library, but may do a bit more work than
21592   -- just directly calling one of the Library functions.
21593   function is_regular_file (handle : int) return int;
21594   -- Tests if given handle is for a regular file (result 1)
21595   -- or for a non-regular file (pipe or device, result 0).
21596   ---------------------------------
21597   -- Control of Text/Binary Mode --
21598   ---------------------------------
21599   -- If text_translation_required is true, then the following
21600   -- functions may be used to dynamically switch a file from
21601   -- binary to text mode or vice versa.  These functions have
21602   -- no effect if text_translation_required is false (i.e., in
21603   -- normal UNIX mode).  Use fileno to get a stream handle.
21604   procedure set_binary_mode (handle : int);
21605   procedure set_text_mode (handle : int);
21606   ----------------------------
21607   -- Full Path Name support --
21608   ----------------------------
21609   procedure full_name (nam : chars; buffer : chars);
21610   -- Given a NUL terminated string representing a file
21611   -- name, returns in buffer a NUL terminated string
21612   -- representing the full path name for the file name.
21613   -- On systems where it is relevant the   drive is also
21614   -- part of the full path name.  It is the responsibility
21615   -- of the caller to pass an actual parameter for buffer
21616   -- that is big enough for any full path name.  Use
21617   -- max_path_len given below as the size of buffer.
21618   max_path_len : integer;
21619   -- Maximum length of an allowable full path name on the
21620   -- system, including a terminating NUL character.
21621 end Interfaces.C_Streams;
21622 @end example
21624 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
21625 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{272}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{273}
21626 @section Interfacing to C Streams
21629 The packages in this section permit interfacing Ada files to C Stream
21630 operations.
21632 @example
21633 with Interfaces.C_Streams;
21634 package Ada.Sequential_IO.C_Streams is
21635    function C_Stream (F : File_Type)
21636       return Interfaces.C_Streams.FILEs;
21637    procedure Open
21638      (File : in out File_Type;
21639       Mode : in File_Mode;
21640       C_Stream : in Interfaces.C_Streams.FILEs;
21641       Form : in String := "");
21642 end Ada.Sequential_IO.C_Streams;
21644  with Interfaces.C_Streams;
21645  package Ada.Direct_IO.C_Streams is
21646     function C_Stream (F : File_Type)
21647        return Interfaces.C_Streams.FILEs;
21648     procedure Open
21649       (File : in out File_Type;
21650        Mode : in File_Mode;
21651        C_Stream : in Interfaces.C_Streams.FILEs;
21652        Form : in String := "");
21653  end Ada.Direct_IO.C_Streams;
21655  with Interfaces.C_Streams;
21656  package Ada.Text_IO.C_Streams is
21657     function C_Stream (F : File_Type)
21658        return Interfaces.C_Streams.FILEs;
21659     procedure Open
21660       (File : in out File_Type;
21661        Mode : in File_Mode;
21662        C_Stream : in Interfaces.C_Streams.FILEs;
21663        Form : in String := "");
21664  end Ada.Text_IO.C_Streams;
21666  with Interfaces.C_Streams;
21667  package Ada.Wide_Text_IO.C_Streams is
21668     function C_Stream (F : File_Type)
21669        return Interfaces.C_Streams.FILEs;
21670     procedure Open
21671       (File : in out File_Type;
21672        Mode : in File_Mode;
21673        C_Stream : in Interfaces.C_Streams.FILEs;
21674        Form : in String := "");
21675 end Ada.Wide_Text_IO.C_Streams;
21677  with Interfaces.C_Streams;
21678  package Ada.Wide_Wide_Text_IO.C_Streams is
21679     function C_Stream (F : File_Type)
21680        return Interfaces.C_Streams.FILEs;
21681     procedure Open
21682       (File : in out File_Type;
21683        Mode : in File_Mode;
21684        C_Stream : in Interfaces.C_Streams.FILEs;
21685        Form : in String := "");
21686 end Ada.Wide_Wide_Text_IO.C_Streams;
21688 with Interfaces.C_Streams;
21689 package Ada.Stream_IO.C_Streams is
21690    function C_Stream (F : File_Type)
21691       return Interfaces.C_Streams.FILEs;
21692    procedure Open
21693      (File : in out File_Type;
21694       Mode : in File_Mode;
21695       C_Stream : in Interfaces.C_Streams.FILEs;
21696       Form : in String := "");
21697 end Ada.Stream_IO.C_Streams;
21698 @end example
21700 In each of these six packages, the @cite{C_Stream} function obtains the
21701 @cite{FILE} pointer from a currently opened Ada file.  It is then
21702 possible to use the @cite{Interfaces.C_Streams} package to operate on
21703 this stream, or the stream can be passed to a C program which can
21704 operate on it directly.  Of course the program is responsible for
21705 ensuring that only appropriate sequences of operations are executed.
21707 One particular use of relevance to an Ada program is that the
21708 @cite{setvbuf} function can be used to control the buffering of the
21709 stream used by an Ada file.  In the absence of such a call the standard
21710 default buffering is used.
21712 The @cite{Open} procedures in these packages open a file giving an
21713 existing C Stream instead of a file name.  Typically this stream is
21714 imported from a C program, allowing an Ada file to operate on an
21715 existing C file.
21717 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
21718 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{274}@anchor{gnat_rm/the_gnat_library id1}@anchor{275}
21719 @chapter The GNAT Library
21722 The GNAT library contains a number of general and special purpose packages.
21723 It represents functionality that the GNAT developers have found useful, and
21724 which is made available to GNAT users.  The packages described here are fully
21725 supported, and upwards compatibility will be maintained in future releases,
21726 so you can use these facilities with the confidence that the same functionality
21727 will be available in future releases.
21729 The chapter here simply gives a brief summary of the facilities available.
21730 The full documentation is found in the spec file for the package.  The full
21731 sources of these library packages, including both spec and body, are provided
21732 with all GNAT releases.  For example, to find out the full specifications of
21733 the SPITBOL pattern matching capability, including a full tutorial and
21734 extensive examples, look in the @code{g-spipat.ads} file in the library.
21736 For each entry here, the package name (as it would appear in a @cite{with}
21737 clause) is given, followed by the name of the corresponding spec file in
21738 parentheses.  The packages are children in four hierarchies, @cite{Ada},
21739 @cite{Interfaces}, @cite{System}, and @cite{GNAT}, the latter being a
21740 GNAT-specific hierarchy.
21742 Note that an application program should only use packages in one of these
21743 four hierarchies if the package is defined in the Ada Reference Manual,
21744 or is listed in this section of the GNAT Programmers Reference Manual.
21745 All other units should be considered internal implementation units and
21746 should not be directly @cite{with}'ed by application code.  The use of
21747 a @cite{with} statement that references one of these internal implementation
21748 units makes an application potentially dependent on changes in versions
21749 of GNAT, and will generate a warning message.
21751 @menu
21752 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
21753 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
21754 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
21755 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
21756 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
21757 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
21758 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
21759 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
21760 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
21761 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
21762 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
21763 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
21764 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
21765 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
21766 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
21767 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
21768 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
21769 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
21770 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
21771 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
21772 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
21773 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
21774 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
21775 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
21776 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
21777 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
21778 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
21779 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
21780 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
21781 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
21782 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
21783 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
21784 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
21785 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
21786 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
21787 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
21788 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
21789 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
21790 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
21791 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
21792 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
21793 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
21794 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
21795 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
21796 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
21797 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
21798 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
21799 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
21800 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
21801 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
21802 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
21803 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
21804 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
21805 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
21806 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
21807 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
21808 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
21809 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
21810 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
21811 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
21812 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
21813 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
21814 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
21815 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
21816 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
21817 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
21818 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
21819 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
21820 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
21821 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
21822 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
21823 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
21824 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
21825 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
21826 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
21827 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
21828 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
21829 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
21830 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
21831 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
21832 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
21833 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
21834 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
21835 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
21836 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
21837 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
21838 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
21839 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
21840 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
21841 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
21842 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
21843 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
21844 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
21845 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
21846 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
21847 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
21848 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
21849 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
21850 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
21851 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
21852 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
21853 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
21854 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
21855 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
21856 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
21857 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
21858 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
21859 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
21860 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
21861 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
21862 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
21863 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
21864 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
21865 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
21866 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
21867 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
21868 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
21869 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
21870 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
21871 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
21872 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
21873 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
21874 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
21875 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
21876 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
21877 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
21878 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
21879 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
21880 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
21881 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
21882 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
21883 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
21884 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
21885 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
21886 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
21887 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
21888 * System.Memory (s-memory.ads): System Memory s-memory ads. 
21889 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
21890 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
21891 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
21892 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
21893 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
21894 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
21895 * System.Rident (s-rident.ads): System Rident s-rident ads. 
21896 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
21897 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
21898 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
21899 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
21901 @end menu
21903 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
21904 @anchor{gnat_rm/the_gnat_library id2}@anchor{276}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{277}
21905 @section @cite{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
21908 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
21910 @geindex Latin_9 constants for Character
21912 This child of @cite{Ada.Characters}
21913 provides a set of definitions corresponding to those in the
21914 RM-defined package @cite{Ada.Characters.Latin_1} but with the
21915 few modifications required for @cite{Latin-9}
21916 The provision of such a package
21917 is specifically authorized by the Ada Reference Manual
21918 (RM A.3.3(27)).
21920 @node Ada Characters Wide_Latin_1 a-cwila1 ads,Ada Characters Wide_Latin_9 a-cwila1 ads,Ada Characters Latin_9 a-chlat9 ads,The GNAT Library
21921 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{278}@anchor{gnat_rm/the_gnat_library id3}@anchor{279}
21922 @section @cite{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
21925 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
21927 @geindex Latin_1 constants for Wide_Character
21929 This child of @cite{Ada.Characters}
21930 provides a set of definitions corresponding to those in the
21931 RM-defined package @cite{Ada.Characters.Latin_1} but with the
21932 types of the constants being @cite{Wide_Character}
21933 instead of @cite{Character}.  The provision of such a package
21934 is specifically authorized by the Ada Reference Manual
21935 (RM A.3.3(27)).
21937 @node Ada Characters Wide_Latin_9 a-cwila1 ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,The GNAT Library
21938 @anchor{gnat_rm/the_gnat_library id4}@anchor{27a}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{27b}
21939 @section @cite{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
21942 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
21944 @geindex Latin_9 constants for Wide_Character
21946 This child of @cite{Ada.Characters}
21947 provides a set of definitions corresponding to those in the
21948 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
21949 types of the constants being @cite{Wide_Character}
21950 instead of @cite{Character}.  The provision of such a package
21951 is specifically authorized by the Ada Reference Manual
21952 (RM A.3.3(27)).
21954 @node Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Characters Wide_Latin_9 a-cwila1 ads,The GNAT Library
21955 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{27c}@anchor{gnat_rm/the_gnat_library id5}@anchor{27d}
21956 @section @cite{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
21959 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
21961 @geindex Latin_1 constants for Wide_Wide_Character
21963 This child of @cite{Ada.Characters}
21964 provides a set of definitions corresponding to those in the
21965 RM-defined package @cite{Ada.Characters.Latin_1} but with the
21966 types of the constants being @cite{Wide_Wide_Character}
21967 instead of @cite{Character}.  The provision of such a package
21968 is specifically authorized by the Ada Reference Manual
21969 (RM A.3.3(27)).
21971 @node Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,Ada Characters Wide_Wide_Latin_1 a-chzla1 ads,The GNAT Library
21972 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{27e}@anchor{gnat_rm/the_gnat_library id6}@anchor{27f}
21973 @section @cite{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
21976 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
21978 @geindex Latin_9 constants for Wide_Wide_Character
21980 This child of @cite{Ada.Characters}
21981 provides a set of definitions corresponding to those in the
21982 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
21983 types of the constants being @cite{Wide_Wide_Character}
21984 instead of @cite{Character}.  The provision of such a package
21985 is specifically authorized by the Ada Reference Manual
21986 (RM A.3.3(27)).
21988 @node Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,Ada Containers Formal_Hashed_Maps a-cfhama ads,Ada Characters Wide_Wide_Latin_9 a-chzla9 ads,The GNAT Library
21989 @anchor{gnat_rm/the_gnat_library id7}@anchor{280}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{281}
21990 @section @cite{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
21993 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
21995 @geindex Formal container for doubly linked lists
21997 This child of @cite{Ada.Containers} defines a modified version of the
21998 Ada 2005 container for doubly linked lists, meant to facilitate formal
21999 verification of code using such containers. The specification of this
22000 unit is compatible with SPARK 2014.
22002 Note that although this container was designed with formal verification
22003 in mind, it may well be generally useful in that it is a simplified more
22004 efficient version than the one defined in the standard. In particular it
22005 does not have the complex overhead required to detect cursor tampering.
22007 @node Ada Containers Formal_Hashed_Maps a-cfhama ads,Ada Containers Formal_Hashed_Sets a-cfhase ads,Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads,The GNAT Library
22008 @anchor{gnat_rm/the_gnat_library id8}@anchor{282}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{283}
22009 @section @cite{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
22012 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
22014 @geindex Formal container for hashed maps
22016 This child of @cite{Ada.Containers} defines a modified version of the
22017 Ada 2005 container for hashed maps, meant to facilitate formal
22018 verification of code using such containers. The specification of this
22019 unit is compatible with SPARK 2014.
22021 Note that although this container was designed with formal verification
22022 in mind, it may well be generally useful in that it is a simplified more
22023 efficient version than the one defined in the standard. In particular it
22024 does not have the complex overhead required to detect cursor tampering.
22026 @node Ada Containers Formal_Hashed_Sets a-cfhase ads,Ada Containers Formal_Ordered_Maps a-cforma ads,Ada Containers Formal_Hashed_Maps a-cfhama ads,The GNAT Library
22027 @anchor{gnat_rm/the_gnat_library id9}@anchor{284}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{285}
22028 @section @cite{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
22031 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
22033 @geindex Formal container for hashed sets
22035 This child of @cite{Ada.Containers} defines a modified version of the
22036 Ada 2005 container for hashed sets, meant to facilitate formal
22037 verification of code using such containers. The specification of this
22038 unit is compatible with SPARK 2014.
22040 Note that although this container was designed with formal verification
22041 in mind, it may well be generally useful in that it is a simplified more
22042 efficient version than the one defined in the standard. In particular it
22043 does not have the complex overhead required to detect cursor tampering.
22045 @node Ada Containers Formal_Ordered_Maps a-cforma ads,Ada Containers Formal_Ordered_Sets a-cforse ads,Ada Containers Formal_Hashed_Sets a-cfhase ads,The GNAT Library
22046 @anchor{gnat_rm/the_gnat_library id10}@anchor{286}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{287}
22047 @section @cite{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
22050 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
22052 @geindex Formal container for ordered maps
22054 This child of @cite{Ada.Containers} defines a modified version of the
22055 Ada 2005 container for ordered maps, meant to facilitate formal
22056 verification of code using such containers. The specification of this
22057 unit is compatible with SPARK 2014.
22059 Note that although this container was designed with formal verification
22060 in mind, it may well be generally useful in that it is a simplified more
22061 efficient version than the one defined in the standard. In particular it
22062 does not have the complex overhead required to detect cursor tampering.
22064 @node Ada Containers Formal_Ordered_Sets a-cforse ads,Ada Containers Formal_Vectors a-cofove ads,Ada Containers Formal_Ordered_Maps a-cforma ads,The GNAT Library
22065 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{288}@anchor{gnat_rm/the_gnat_library id11}@anchor{289}
22066 @section @cite{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
22069 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
22071 @geindex Formal container for ordered sets
22073 This child of @cite{Ada.Containers} defines a modified version of the
22074 Ada 2005 container for ordered sets, meant to facilitate formal
22075 verification of code using such containers. The specification of this
22076 unit is compatible with SPARK 2014.
22078 Note that although this container was designed with formal verification
22079 in mind, it may well be generally useful in that it is a simplified more
22080 efficient version than the one defined in the standard. In particular it
22081 does not have the complex overhead required to detect cursor tampering.
22083 @node Ada Containers Formal_Vectors a-cofove ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Formal_Ordered_Sets a-cforse ads,The GNAT Library
22084 @anchor{gnat_rm/the_gnat_library id12}@anchor{28a}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{28b}
22085 @section @cite{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
22088 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
22090 @geindex Formal container for vectors
22092 This child of @cite{Ada.Containers} defines a modified version of the
22093 Ada 2005 container for vectors, meant to facilitate formal
22094 verification of code using such containers. The specification of this
22095 unit is compatible with SPARK 2014.
22097 Note that although this container was designed with formal verification
22098 in mind, it may well be generally useful in that it is a simplified more
22099 efficient version than the one defined in the standard. In particular it
22100 does not have the complex overhead required to detect cursor tampering.
22102 @node Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Bounded_Holders a-coboho ads,Ada Containers Formal_Vectors a-cofove ads,The GNAT Library
22103 @anchor{gnat_rm/the_gnat_library id13}@anchor{28c}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{28d}
22104 @section @cite{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
22107 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
22109 @geindex Formal container for vectors
22111 This child of @cite{Ada.Containers} defines a modified version of the
22112 Ada 2005 container for vectors of indefinite elements, meant to
22113 facilitate formal verification of code using such containers. The
22114 specification of this unit is compatible with SPARK 2014.
22116 Note that although this container was designed with formal verification
22117 in mind, it may well be generally useful in that it is a simplified more
22118 efficient version than the one defined in the standard. In particular it
22119 does not have the complex overhead required to detect cursor tampering.
22121 @node Ada Containers Bounded_Holders a-coboho ads,Ada Command_Line Environment a-colien ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,The GNAT Library
22122 @anchor{gnat_rm/the_gnat_library id14}@anchor{28e}@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{28f}
22123 @section @cite{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
22126 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
22128 @geindex Formal container for vectors
22130 This child of @cite{Ada.Containers} defines a modified version of
22131 Indefinite_Holders that avoids heap allocation.
22133 @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
22134 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{290}@anchor{gnat_rm/the_gnat_library id15}@anchor{291}
22135 @section @cite{Ada.Command_Line.Environment} (@code{a-colien.ads})
22138 @geindex Ada.Command_Line.Environment (a-colien.ads)
22140 @geindex Environment entries
22142 This child of @cite{Ada.Command_Line}
22143 provides a mechanism for obtaining environment values on systems
22144 where this concept makes sense.
22146 @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
22147 @anchor{gnat_rm/the_gnat_library id16}@anchor{292}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{293}
22148 @section @cite{Ada.Command_Line.Remove} (@code{a-colire.ads})
22151 @geindex Ada.Command_Line.Remove (a-colire.ads)
22153 @geindex Removing command line arguments
22155 @geindex Command line
22156 @geindex argument removal
22158 This child of @cite{Ada.Command_Line}
22159 provides a mechanism for logically removing
22160 arguments from the argument list.  Once removed, an argument is not visible
22161 to further calls on the subprograms in @cite{Ada.Command_Line} will not
22162 see the removed argument.
22164 @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
22165 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{294}@anchor{gnat_rm/the_gnat_library id17}@anchor{295}
22166 @section @cite{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
22169 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
22171 @geindex Response file for command line
22173 @geindex Command line
22174 @geindex response file
22176 @geindex Command line
22177 @geindex handling long command lines
22179 This child of @cite{Ada.Command_Line} provides a mechanism facilities for
22180 getting command line arguments from a text file, called a "response file".
22181 Using a response file allow passing a set of arguments to an executable longer
22182 than the maximum allowed by the system on the command line.
22184 @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
22185 @anchor{gnat_rm/the_gnat_library id18}@anchor{296}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{297}
22186 @section @cite{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
22189 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
22191 @geindex C Streams
22192 @geindex Interfacing with Direct_IO
22194 This package provides subprograms that allow interfacing between
22195 C streams and @cite{Direct_IO}.  The stream identifier can be
22196 extracted from a file opened on the Ada side, and an Ada file
22197 can be constructed from a stream opened on the C side.
22199 @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
22200 @anchor{gnat_rm/the_gnat_library id19}@anchor{298}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{299}
22201 @section @cite{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
22204 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
22206 @geindex Null_Occurrence
22207 @geindex testing for
22209 This child subprogram provides a way of testing for the null
22210 exception occurrence (@cite{Null_Occurrence}) without raising
22211 an exception.
22213 @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
22214 @anchor{gnat_rm/the_gnat_library id20}@anchor{29a}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{29b}
22215 @section @cite{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
22218 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
22220 @geindex Null_Occurrence
22221 @geindex testing for
22223 This child subprogram is used for handling otherwise unhandled
22224 exceptions (hence the name last chance), and perform clean ups before
22225 terminating the program. Note that this subprogram never returns.
22227 @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
22228 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{29c}@anchor{gnat_rm/the_gnat_library id21}@anchor{29d}
22229 @section @cite{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
22232 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
22234 @geindex Traceback for Exception Occurrence
22236 This child package provides the subprogram (@cite{Tracebacks}) to
22237 give a traceback array of addresses based on an exception
22238 occurrence.
22240 @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
22241 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{29e}@anchor{gnat_rm/the_gnat_library id22}@anchor{29f}
22242 @section @cite{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
22245 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
22247 @geindex C Streams
22248 @geindex Interfacing with Sequential_IO
22250 This package provides subprograms that allow interfacing between
22251 C streams and @cite{Sequential_IO}.  The stream identifier can be
22252 extracted from a file opened on the Ada side, and an Ada file
22253 can be constructed from a stream opened on the C side.
22255 @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
22256 @anchor{gnat_rm/the_gnat_library id23}@anchor{2a0}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2a1}
22257 @section @cite{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
22260 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
22262 @geindex C Streams
22263 @geindex Interfacing with Stream_IO
22265 This package provides subprograms that allow interfacing between
22266 C streams and @cite{Stream_IO}.  The stream identifier can be
22267 extracted from a file opened on the Ada side, and an Ada file
22268 can be constructed from a stream opened on the C side.
22270 @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
22271 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2a2}@anchor{gnat_rm/the_gnat_library id24}@anchor{2a3}
22272 @section @cite{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
22275 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
22277 @geindex Unbounded_String
22278 @geindex IO support
22280 @geindex Text_IO
22281 @geindex extensions for unbounded strings
22283 This package provides subprograms for Text_IO for unbounded
22284 strings, avoiding the necessity for an intermediate operation
22285 with ordinary strings.
22287 @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
22288 @anchor{gnat_rm/the_gnat_library id25}@anchor{2a4}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2a5}
22289 @section @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
22292 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
22294 @geindex Unbounded_Wide_String
22295 @geindex IO support
22297 @geindex Text_IO
22298 @geindex extensions for unbounded wide strings
22300 This package provides subprograms for Text_IO for unbounded
22301 wide strings, avoiding the necessity for an intermediate operation
22302 with ordinary wide strings.
22304 @node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library
22305 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2a6}@anchor{gnat_rm/the_gnat_library id26}@anchor{2a7}
22306 @section @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
22309 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
22311 @geindex Unbounded_Wide_Wide_String
22312 @geindex IO support
22314 @geindex Text_IO
22315 @geindex extensions for unbounded wide wide strings
22317 This package provides subprograms for Text_IO for unbounded
22318 wide wide strings, avoiding the necessity for an intermediate operation
22319 with ordinary wide wide strings.
22321 @node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library
22322 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{2a8}@anchor{gnat_rm/the_gnat_library id27}@anchor{2a9}
22323 @section @cite{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
22326 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
22328 @geindex C Streams
22329 @geindex Interfacing with `Text_IO`
22331 This package provides subprograms that allow interfacing between
22332 C streams and @cite{Text_IO}.  The stream identifier can be
22333 extracted from a file opened on the Ada side, and an Ada file
22334 can be constructed from a stream opened on the C side.
22336 @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
22337 @anchor{gnat_rm/the_gnat_library id28}@anchor{2aa}@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{2ab}
22338 @section @cite{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
22341 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
22343 @geindex Text_IO resetting standard files
22345 This procedure is used to reset the status of the standard files used
22346 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
22347 embedded application) where the status of the files may change during
22348 execution (for example a standard input file may be redefined to be
22349 interactive).
22351 @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
22352 @anchor{gnat_rm/the_gnat_library id29}@anchor{2ac}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{2ad}
22353 @section @cite{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
22356 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
22358 @geindex Unicode categorization
22359 @geindex Wide_Character
22361 This package provides subprograms that allow categorization of
22362 Wide_Character values according to Unicode categories.
22364 @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
22365 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{2ae}@anchor{gnat_rm/the_gnat_library id30}@anchor{2af}
22366 @section @cite{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
22369 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
22371 @geindex C Streams
22372 @geindex Interfacing with `Wide_Text_IO`
22374 This package provides subprograms that allow interfacing between
22375 C streams and @cite{Wide_Text_IO}.  The stream identifier can be
22376 extracted from a file opened on the Ada side, and an Ada file
22377 can be constructed from a stream opened on the C side.
22379 @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
22380 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{2b0}@anchor{gnat_rm/the_gnat_library id31}@anchor{2b1}
22381 @section @cite{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
22384 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
22386 @geindex Wide_Text_IO resetting standard files
22388 This procedure is used to reset the status of the standard files used
22389 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
22390 embedded application) where the status of the files may change during
22391 execution (for example a standard input file may be redefined to be
22392 interactive).
22394 @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
22395 @anchor{gnat_rm/the_gnat_library id32}@anchor{2b2}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{2b3}
22396 @section @cite{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
22399 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
22401 @geindex Unicode categorization
22402 @geindex Wide_Wide_Character
22404 This package provides subprograms that allow categorization of
22405 Wide_Wide_Character values according to Unicode categories.
22407 @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
22408 @anchor{gnat_rm/the_gnat_library id33}@anchor{2b4}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{2b5}
22409 @section @cite{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
22412 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
22414 @geindex C Streams
22415 @geindex Interfacing with `Wide_Wide_Text_IO`
22417 This package provides subprograms that allow interfacing between
22418 C streams and @cite{Wide_Wide_Text_IO}.  The stream identifier can be
22419 extracted from a file opened on the Ada side, and an Ada file
22420 can be constructed from a stream opened on the C side.
22422 @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
22423 @anchor{gnat_rm/the_gnat_library id34}@anchor{2b6}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{2b7}
22424 @section @cite{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
22427 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
22429 @geindex Wide_Wide_Text_IO resetting standard files
22431 This procedure is used to reset the status of the standard files used
22432 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
22433 restart in an embedded application) where the status of the files may
22434 change during execution (for example a standard input file may be
22435 redefined to be interactive).
22437 @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
22438 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{2b8}@anchor{gnat_rm/the_gnat_library id35}@anchor{2b9}
22439 @section @cite{GNAT.Altivec} (@code{g-altive.ads})
22442 @geindex GNAT.Altivec (g-altive.ads)
22444 @geindex AltiVec
22446 This is the root package of the GNAT AltiVec binding. It provides
22447 definitions of constants and types common to all the versions of the
22448 binding.
22450 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
22451 @anchor{gnat_rm/the_gnat_library id36}@anchor{2ba}@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{2bb}
22452 @section @cite{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
22455 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
22457 @geindex AltiVec
22459 This package provides the Vector/View conversion routines.
22461 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
22462 @anchor{gnat_rm/the_gnat_library id37}@anchor{2bc}@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{2bd}
22463 @section @cite{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
22466 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
22468 @geindex AltiVec
22470 This package exposes the Ada interface to the AltiVec operations on
22471 vector objects. A soft emulation is included by default in the GNAT
22472 library. The hard binding is provided as a separate package. This unit
22473 is common to both bindings.
22475 @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
22476 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{2be}@anchor{gnat_rm/the_gnat_library id38}@anchor{2bf}
22477 @section @cite{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
22480 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
22482 @geindex AltiVec
22484 This package exposes the various vector types part of the Ada binding
22485 to AltiVec facilities.
22487 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
22488 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{2c0}@anchor{gnat_rm/the_gnat_library id39}@anchor{2c1}
22489 @section @cite{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
22492 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
22494 @geindex AltiVec
22496 This package provides public 'View' data types from/to which private
22497 vector representations can be converted via
22498 GNAT.Altivec.Conversions. This allows convenient access to individual
22499 vector elements and provides a simple way to initialize vector
22500 objects.
22502 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
22503 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{2c2}@anchor{gnat_rm/the_gnat_library id40}@anchor{2c3}
22504 @section @cite{GNAT.Array_Split} (@code{g-arrspl.ads})
22507 @geindex GNAT.Array_Split (g-arrspl.ads)
22509 @geindex Array splitter
22511 Useful array-manipulation routines: given a set of separators, split
22512 an array wherever the separators appear, and provide direct access
22513 to the resulting slices.
22515 @node GNAT AWK g-awk ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Array_Split g-arrspl ads,The GNAT Library
22516 @anchor{gnat_rm/the_gnat_library id41}@anchor{2c4}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{2c5}
22517 @section @cite{GNAT.AWK} (@code{g-awk.ads})
22520 @geindex GNAT.AWK (g-awk.ads)
22522 @geindex Parsing
22524 @geindex AWK
22526 Provides AWK-like parsing functions, with an easy interface for parsing one
22527 or more files containing formatted data.  The file is viewed as a database
22528 where each record is a line and a field is a data element in this line.
22530 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT AWK g-awk ads,The GNAT Library
22531 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{2c6}@anchor{gnat_rm/the_gnat_library id42}@anchor{2c7}
22532 @section @cite{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
22535 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
22537 @geindex Parsing
22539 @geindex Bounded Buffers
22541 Provides a concurrent generic bounded buffer abstraction.  Instances are
22542 useful directly or as parts of the implementations of other abstractions,
22543 such as mailboxes.
22545 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
22546 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{2c8}@anchor{gnat_rm/the_gnat_library id43}@anchor{2c9}
22547 @section @cite{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
22550 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
22552 @geindex Parsing
22554 @geindex Mailboxes
22556 Provides a thread-safe asynchronous intertask mailbox communication facility.
22558 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
22559 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{2ca}@anchor{gnat_rm/the_gnat_library id44}@anchor{2cb}
22560 @section @cite{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
22563 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
22565 @geindex Sorting
22567 @geindex Bubble sort
22569 Provides a general implementation of bubble sort usable for sorting arbitrary
22570 data items.  Exchange and comparison procedures are provided by passing
22571 access-to-procedure values.
22573 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
22574 @anchor{gnat_rm/the_gnat_library id45}@anchor{2cc}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{2cd}
22575 @section @cite{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
22578 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
22580 @geindex Sorting
22582 @geindex Bubble sort
22584 Provides a general implementation of bubble sort usable for sorting arbitrary
22585 data items.  Move and comparison procedures are provided by passing
22586 access-to-procedure values. This is an older version, retained for
22587 compatibility. Usually @cite{GNAT.Bubble_Sort} will be preferable.
22589 @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
22590 @anchor{gnat_rm/the_gnat_library id46}@anchor{2ce}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{2cf}
22591 @section @cite{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
22594 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
22596 @geindex Sorting
22598 @geindex Bubble sort
22600 Similar to @cite{Bubble_Sort_A} except that the move and sorting procedures
22601 are provided as generic parameters, this improves efficiency, especially
22602 if the procedures can be inlined, at the expense of duplicating code for
22603 multiple instantiations.
22605 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
22606 @anchor{gnat_rm/the_gnat_library id47}@anchor{2d0}@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{2d1}
22607 @section @cite{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
22610 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
22612 @geindex UTF-8 representation
22614 @geindex Wide characte representations
22616 Provides a routine which given a string, reads the start of the string to
22617 see whether it is one of the standard byte order marks (BOM's) which signal
22618 the encoding of the string. The routine includes detection of special XML
22619 sequences for various UCS input formats.
22621 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
22622 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{2d2}@anchor{gnat_rm/the_gnat_library id48}@anchor{2d3}
22623 @section @cite{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
22626 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
22628 @geindex Byte swapping
22630 @geindex Endianness
22632 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
22633 Machine-specific implementations are available in some cases.
22635 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
22636 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{2d4}@anchor{gnat_rm/the_gnat_library id49}@anchor{2d5}
22637 @section @cite{GNAT.Calendar} (@code{g-calend.ads})
22640 @geindex GNAT.Calendar (g-calend.ads)
22642 @geindex Calendar
22644 Extends the facilities provided by @cite{Ada.Calendar} to include handling
22645 of days of the week, an extended @cite{Split} and @cite{Time_Of} capability.
22646 Also provides conversion of @cite{Ada.Calendar.Time} values to and from the
22647 C @cite{timeval} format.
22649 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
22650 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id50}@anchor{2d7}
22651 @section @cite{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
22654 @geindex Calendar
22656 @geindex Time
22658 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
22660 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
22661 @anchor{gnat_rm/the_gnat_library id51}@anchor{2d8}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{2d9}
22662 @section @cite{GNAT.CRC32} (@code{g-crc32.ads})
22665 @geindex GNAT.CRC32 (g-crc32.ads)
22667 @geindex CRC32
22669 @geindex Cyclic Redundancy Check
22671 This package implements the CRC-32 algorithm.  For a full description
22672 of this algorithm see
22673 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
22674 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
22675 Aug. 1988.  Sarwate, D.V.
22677 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
22678 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id52}@anchor{2db}
22679 @section @cite{GNAT.Case_Util} (@code{g-casuti.ads})
22682 @geindex GNAT.Case_Util (g-casuti.ads)
22684 @geindex Casing utilities
22686 @geindex Character handling (`GNAT.Case_Util`)
22688 A set of simple routines for handling upper and lower casing of strings
22689 without the overhead of the full casing tables
22690 in @cite{Ada.Characters.Handling}.
22692 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
22693 @anchor{gnat_rm/the_gnat_library id53}@anchor{2dc}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{2dd}
22694 @section @cite{GNAT.CGI} (@code{g-cgi.ads})
22697 @geindex GNAT.CGI (g-cgi.ads)
22699 @geindex CGI (Common Gateway Interface)
22701 This is a package for interfacing a GNAT program with a Web server via the
22702 Common Gateway Interface (CGI).  Basically this package parses the CGI
22703 parameters, which are a set of key/value pairs sent by the Web server.  It
22704 builds a table whose index is the key and provides some services to deal
22705 with this table.
22707 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
22708 @anchor{gnat_rm/the_gnat_library id54}@anchor{2de}@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{2df}
22709 @section @cite{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
22712 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
22714 @geindex CGI (Common Gateway Interface) cookie support
22716 @geindex Cookie support in CGI
22718 This is a package to interface a GNAT program with a Web server via the
22719 Common Gateway Interface (CGI).  It exports services to deal with Web
22720 cookies (piece of information kept in the Web client software).
22722 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
22723 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{2e0}@anchor{gnat_rm/the_gnat_library id55}@anchor{2e1}
22724 @section @cite{GNAT.CGI.Debug} (@code{g-cgideb.ads})
22727 @geindex GNAT.CGI.Debug (g-cgideb.ads)
22729 @geindex CGI (Common Gateway Interface) debugging
22731 This is a package to help debugging CGI (Common Gateway Interface)
22732 programs written in Ada.
22734 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
22735 @anchor{gnat_rm/the_gnat_library id56}@anchor{2e2}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{2e3}
22736 @section @cite{GNAT.Command_Line} (@code{g-comlin.ads})
22739 @geindex GNAT.Command_Line (g-comlin.ads)
22741 @geindex Command line
22743 Provides a high level interface to @cite{Ada.Command_Line} facilities,
22744 including the ability to scan for named switches with optional parameters
22745 and expand file names using wild card notations.
22747 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
22748 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{2e4}@anchor{gnat_rm/the_gnat_library id57}@anchor{2e5}
22749 @section @cite{GNAT.Compiler_Version} (@code{g-comver.ads})
22752 @geindex GNAT.Compiler_Version (g-comver.ads)
22754 @geindex Compiler Version
22756 @geindex Version
22757 @geindex of compiler
22759 Provides a routine for obtaining the version of the compiler used to
22760 compile the program. More accurately this is the version of the binder
22761 used to bind the program (this will normally be the same as the version
22762 of the compiler if a consistent tool set is used to compile all units
22763 of a partition).
22765 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
22766 @anchor{gnat_rm/the_gnat_library id58}@anchor{2e6}@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{2e7}
22767 @section @cite{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
22770 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
22772 @geindex Interrupt
22774 Provides a simple interface to handle Ctrl-C keyboard events.
22776 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
22777 @anchor{gnat_rm/the_gnat_library id59}@anchor{2e8}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{2e9}
22778 @section @cite{GNAT.Current_Exception} (@code{g-curexc.ads})
22781 @geindex GNAT.Current_Exception (g-curexc.ads)
22783 @geindex Current exception
22785 @geindex Exception retrieval
22787 Provides access to information on the current exception that has been raised
22788 without the need for using the Ada 95 / Ada 2005 exception choice parameter
22789 specification syntax.
22790 This is particularly useful in simulating typical facilities for
22791 obtaining information about exceptions provided by Ada 83 compilers.
22793 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
22794 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{2ea}@anchor{gnat_rm/the_gnat_library id60}@anchor{2eb}
22795 @section @cite{GNAT.Debug_Pools} (@code{g-debpoo.ads})
22798 @geindex GNAT.Debug_Pools (g-debpoo.ads)
22800 @geindex Debugging
22802 @geindex Debug pools
22804 @geindex Memory corruption debugging
22806 Provide a debugging storage pools that helps tracking memory corruption
22807 problems.
22808 See @cite{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
22810 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
22811 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{2ec}@anchor{gnat_rm/the_gnat_library id61}@anchor{2ed}
22812 @section @cite{GNAT.Debug_Utilities} (@code{g-debuti.ads})
22815 @geindex GNAT.Debug_Utilities (g-debuti.ads)
22817 @geindex Debugging
22819 Provides a few useful utilities for debugging purposes, including conversion
22820 to and from string images of address values. Supports both C and Ada formats
22821 for hexadecimal literals.
22823 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
22824 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id62}@anchor{2ef}
22825 @section @cite{GNAT.Decode_String} (@code{g-decstr.ads})
22828 @geindex GNAT.Decode_String (g-decstr.ads)
22830 @geindex Decoding strings
22832 @geindex String decoding
22834 @geindex Wide character encoding
22836 @geindex UTF-8
22838 @geindex Unicode
22840 A generic package providing routines for decoding wide character and wide wide
22841 character strings encoded as sequences of 8-bit characters using a specified
22842 encoding method. Includes validation routines, and also routines for stepping
22843 to next or previous encoded character in an encoded string.
22844 Useful in conjunction with Unicode character coding. Note there is a
22845 preinstantiation for UTF-8. See next entry.
22847 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
22848 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{2f0}@anchor{gnat_rm/the_gnat_library id63}@anchor{2f1}
22849 @section @cite{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
22852 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
22854 @geindex Decoding strings
22856 @geindex Decoding UTF-8 strings
22858 @geindex UTF-8 string decoding
22860 @geindex Wide character decoding
22862 @geindex UTF-8
22864 @geindex Unicode
22866 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
22868 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
22869 @anchor{gnat_rm/the_gnat_library id64}@anchor{2f2}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{2f3}
22870 @section @cite{GNAT.Directory_Operations} (@code{g-dirope.ads})
22873 @geindex GNAT.Directory_Operations (g-dirope.ads)
22875 @geindex Directory operations
22877 Provides a set of routines for manipulating directories, including changing
22878 the current directory, making new directories, and scanning the files in a
22879 directory.
22881 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
22882 @anchor{gnat_rm/the_gnat_library id65}@anchor{2f4}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{2f5}
22883 @section @cite{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
22886 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
22888 @geindex Directory operations iteration
22890 A child unit of GNAT.Directory_Operations providing additional operations
22891 for iterating through directories.
22893 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
22894 @anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{2f6}@anchor{gnat_rm/the_gnat_library id66}@anchor{2f7}
22895 @section @cite{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
22898 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
22900 @geindex Hash tables
22902 A generic implementation of hash tables that can be used to hash arbitrary
22903 data.  Provided in two forms, a simple form with built in hash functions,
22904 and a more complex form in which the hash function is supplied.
22906 This package provides a facility similar to that of @cite{GNAT.HTable},
22907 except that this package declares a type that can be used to define
22908 dynamic instances of the hash table, while an instantiation of
22909 @cite{GNAT.HTable} creates a single instance of the hash table.
22911 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
22912 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{2f8}@anchor{gnat_rm/the_gnat_library id67}@anchor{2f9}
22913 @section @cite{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
22916 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
22918 @geindex Table implementation
22920 @geindex Arrays
22921 @geindex extendable
22923 A generic package providing a single dimension array abstraction where the
22924 length of the array can be dynamically modified.
22926 This package provides a facility similar to that of @cite{GNAT.Table},
22927 except that this package declares a type that can be used to define
22928 dynamic instances of the table, while an instantiation of
22929 @cite{GNAT.Table} creates a single instance of the table type.
22931 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
22932 @anchor{gnat_rm/the_gnat_library id68}@anchor{2fa}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{2fb}
22933 @section @cite{GNAT.Encode_String} (@code{g-encstr.ads})
22936 @geindex GNAT.Encode_String (g-encstr.ads)
22938 @geindex Encoding strings
22940 @geindex String encoding
22942 @geindex Wide character encoding
22944 @geindex UTF-8
22946 @geindex Unicode
22948 A generic package providing routines for encoding wide character and wide
22949 wide character strings as sequences of 8-bit characters using a specified
22950 encoding method. Useful in conjunction with Unicode character coding.
22951 Note there is a preinstantiation for UTF-8. See next entry.
22953 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
22954 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{2fc}@anchor{gnat_rm/the_gnat_library id69}@anchor{2fd}
22955 @section @cite{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
22958 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
22960 @geindex Encoding strings
22962 @geindex Encoding UTF-8 strings
22964 @geindex UTF-8 string encoding
22966 @geindex Wide character encoding
22968 @geindex UTF-8
22970 @geindex Unicode
22972 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
22974 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
22975 @anchor{gnat_rm/the_gnat_library id70}@anchor{2fe}@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{2ff}
22976 @section @cite{GNAT.Exception_Actions} (@code{g-excact.ads})
22979 @geindex GNAT.Exception_Actions (g-excact.ads)
22981 @geindex Exception actions
22983 Provides callbacks when an exception is raised. Callbacks can be registered
22984 for specific exceptions, or when any exception is raised. This
22985 can be used for instance to force a core dump to ease debugging.
22987 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-expect ads,GNAT Exception_Actions g-excact ads,The GNAT Library
22988 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id71}@anchor{301}
22989 @section @cite{GNAT.Exception_Traces} (@code{g-exctra.ads})
22992 @geindex GNAT.Exception_Traces (g-exctra.ads)
22994 @geindex Exception traces
22996 @geindex Debugging
22998 Provides an interface allowing to control automatic output upon exception
22999 occurrences.
23001 @node GNAT Exceptions g-expect ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
23002 @anchor{gnat_rm/the_gnat_library id72}@anchor{302}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-expect-ads}@anchor{303}
23003 @section @cite{GNAT.Exceptions} (@code{g-expect.ads})
23006 @geindex GNAT.Exceptions (g-expect.ads)
23008 @geindex Exceptions
23009 @geindex Pure
23011 @geindex Pure packages
23012 @geindex exceptions
23014 Normally it is not possible to raise an exception with
23015 a message from a subprogram in a pure package, since the
23016 necessary types and subprograms are in @cite{Ada.Exceptions}
23017 which is not a pure unit. @cite{GNAT.Exceptions} provides a
23018 facility for getting around this limitation for a few
23019 predefined exceptions, and for example allow raising
23020 @cite{Constraint_Error} with a message from a pure subprogram.
23022 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-expect ads,The GNAT Library
23023 @anchor{gnat_rm/the_gnat_library id73}@anchor{304}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{305}
23024 @section @cite{GNAT.Expect} (@code{g-expect.ads})
23027 @geindex GNAT.Expect (g-expect.ads)
23029 Provides a set of subprograms similar to what is available
23030 with the standard Tcl Expect tool.
23031 It allows you to easily spawn and communicate with an external process.
23032 You can send commands or inputs to the process, and compare the output
23033 with some expected regular expression. Currently @cite{GNAT.Expect}
23034 is implemented on all native GNAT ports.
23035 It is not implemented for cross ports, and in particular is not
23036 implemented for VxWorks or LynxOS.
23038 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
23039 @anchor{gnat_rm/the_gnat_library id74}@anchor{306}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{307}
23040 @section @cite{GNAT.Expect.TTY} (@code{g-exptty.ads})
23043 @geindex GNAT.Expect.TTY (g-exptty.ads)
23045 As GNAT.Expect but using pseudo-terminal.
23046 Currently @cite{GNAT.Expect.TTY} is implemented on all native GNAT
23047 ports. It is not implemented for cross ports, and
23048 in particular is not implemented for VxWorks or LynxOS.
23050 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
23051 @anchor{gnat_rm/the_gnat_library id75}@anchor{308}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{309}
23052 @section @cite{GNAT.Float_Control} (@code{g-flocon.ads})
23055 @geindex GNAT.Float_Control (g-flocon.ads)
23057 @geindex Floating-Point Processor
23059 Provides an interface for resetting the floating-point processor into the
23060 mode required for correct semantic operation in Ada.  Some third party
23061 library calls may cause this mode to be modified, and the Reset procedure
23062 in this package can be used to reestablish the required mode.
23064 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
23065 @anchor{gnat_rm/the_gnat_library id76}@anchor{30a}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{30b}
23066 @section @cite{GNAT.Formatted_String} (@code{g-forstr.ads})
23069 @geindex GNAT.Formatted_String (g-forstr.ads)
23071 @geindex Formatted String
23073 Provides support for C/C++ printf() formatted strings. The format is
23074 copied from the printf() routine and should therefore gives identical
23075 output. Some generic routines are provided to be able to use types
23076 derived from Integer, Float or enumerations as values for the
23077 formatted string.
23079 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
23080 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id77}@anchor{30d}
23081 @section @cite{GNAT.Heap_Sort} (@code{g-heasor.ads})
23084 @geindex GNAT.Heap_Sort (g-heasor.ads)
23086 @geindex Sorting
23088 Provides a general implementation of heap sort usable for sorting arbitrary
23089 data items. Exchange and comparison procedures are provided by passing
23090 access-to-procedure values.  The algorithm used is a modified heap sort
23091 that performs approximately N*log(N) comparisons in the worst case.
23093 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
23094 @anchor{gnat_rm/the_gnat_library id78}@anchor{30e}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{30f}
23095 @section @cite{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
23098 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
23100 @geindex Sorting
23102 Provides a general implementation of heap sort usable for sorting arbitrary
23103 data items. Move and comparison procedures are provided by passing
23104 access-to-procedure values.  The algorithm used is a modified heap sort
23105 that performs approximately N*log(N) comparisons in the worst case.
23106 This differs from @cite{GNAT.Heap_Sort} in having a less convenient
23107 interface, but may be slightly more efficient.
23109 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
23110 @anchor{gnat_rm/the_gnat_library id79}@anchor{310}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{311}
23111 @section @cite{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
23114 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
23116 @geindex Sorting
23118 Similar to @cite{Heap_Sort_A} except that the move and sorting procedures
23119 are provided as generic parameters, this improves efficiency, especially
23120 if the procedures can be inlined, at the expense of duplicating code for
23121 multiple instantiations.
23123 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
23124 @anchor{gnat_rm/the_gnat_library id80}@anchor{312}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{313}
23125 @section @cite{GNAT.HTable} (@code{g-htable.ads})
23128 @geindex GNAT.HTable (g-htable.ads)
23130 @geindex Hash tables
23132 A generic implementation of hash tables that can be used to hash arbitrary
23133 data.  Provides two approaches, one a simple static approach, and the other
23134 allowing arbitrary dynamic hash tables.
23136 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
23137 @anchor{gnat_rm/the_gnat_library id81}@anchor{314}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{315}
23138 @section @cite{GNAT.IO} (@code{g-io.ads})
23141 @geindex GNAT.IO (g-io.ads)
23143 @geindex Simple I/O
23145 @geindex Input/Output facilities
23147 A simple preelaborable input-output package that provides a subset of
23148 simple Text_IO functions for reading characters and strings from
23149 Standard_Input, and writing characters, strings and integers to either
23150 Standard_Output or Standard_Error.
23152 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
23153 @anchor{gnat_rm/the_gnat_library id82}@anchor{316}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{317}
23154 @section @cite{GNAT.IO_Aux} (@code{g-io_aux.ads})
23157 @geindex GNAT.IO_Aux (g-io_aux.ads)
23159 @geindex Text_IO
23161 @geindex Input/Output facilities
23163 Provides some auxiliary functions for use with Text_IO, including a test
23164 for whether a file exists, and functions for reading a line of text.
23166 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
23167 @anchor{gnat_rm/the_gnat_library id83}@anchor{318}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{319}
23168 @section @cite{GNAT.Lock_Files} (@code{g-locfil.ads})
23171 @geindex GNAT.Lock_Files (g-locfil.ads)
23173 @geindex File locking
23175 @geindex Locking using files
23177 Provides a general interface for using files as locks.  Can be used for
23178 providing program level synchronization.
23180 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
23181 @anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id84}@anchor{31b}
23182 @section @cite{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
23185 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
23187 @geindex Random number generation
23189 The original implementation of @cite{Ada.Numerics.Discrete_Random}.  Uses
23190 a modified version of the Blum-Blum-Shub generator.
23192 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
23193 @anchor{gnat_rm/the_gnat_library id85}@anchor{31c}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{31d}
23194 @section @cite{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
23197 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
23199 @geindex Random number generation
23201 The original implementation of @cite{Ada.Numerics.Float_Random}.  Uses
23202 a modified version of the Blum-Blum-Shub generator.
23204 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
23205 @anchor{gnat_rm/the_gnat_library id86}@anchor{31e}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{31f}
23206 @section @cite{GNAT.MD5} (@code{g-md5.ads})
23209 @geindex GNAT.MD5 (g-md5.ads)
23211 @geindex Message Digest MD5
23213 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
23214 the HMAC-MD5 message authentication function as described in RFC 2104 and
23215 FIPS PUB 198.
23217 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
23218 @anchor{gnat_rm/the_gnat_library id87}@anchor{320}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{321}
23219 @section @cite{GNAT.Memory_Dump} (@code{g-memdum.ads})
23222 @geindex GNAT.Memory_Dump (g-memdum.ads)
23224 @geindex Dump Memory
23226 Provides a convenient routine for dumping raw memory to either the
23227 standard output or standard error files. Uses GNAT.IO for actual
23228 output.
23230 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
23231 @anchor{gnat_rm/the_gnat_library id88}@anchor{322}@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{323}
23232 @section @cite{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
23235 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
23237 @geindex Exception
23238 @geindex obtaining most recent
23240 Provides access to the most recently raised exception.  Can be used for
23241 various logging purposes, including duplicating functionality of some
23242 Ada 83 implementation dependent extensions.
23244 @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
23245 @anchor{gnat_rm/the_gnat_library id89}@anchor{324}@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{325}
23246 @section @cite{GNAT.OS_Lib} (@code{g-os_lib.ads})
23249 @geindex GNAT.OS_Lib (g-os_lib.ads)
23251 @geindex Operating System interface
23253 @geindex Spawn capability
23255 Provides a range of target independent operating system interface functions,
23256 including time/date management, file operations, subprocess management,
23257 including a portable spawn procedure, and access to environment variables
23258 and error return codes.
23260 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
23261 @anchor{gnat_rm/the_gnat_library id90}@anchor{326}@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{327}
23262 @section @cite{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
23265 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
23267 @geindex Hash functions
23269 Provides a generator of static minimal perfect hash functions. No
23270 collisions occur and each item can be retrieved from the table in one
23271 probe (perfect property). The hash table size corresponds to the exact
23272 size of the key set and no larger (minimal property). The key set has to
23273 be know in advance (static property). The hash functions are also order
23274 preserving. If w2 is inserted after w1 in the generator, their
23275 hashcode are in the same order. These hashing functions are very
23276 convenient for use with realtime applications.
23278 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
23279 @anchor{gnat_rm/the_gnat_library id91}@anchor{328}@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{329}
23280 @section @cite{GNAT.Random_Numbers} (@code{g-rannum.ads})
23283 @geindex GNAT.Random_Numbers (g-rannum.ads)
23285 @geindex Random number generation
23287 Provides random number capabilities which extend those available in the
23288 standard Ada library and are more convenient to use.
23290 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
23291 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{1fd}@anchor{gnat_rm/the_gnat_library id92}@anchor{32a}
23292 @section @cite{GNAT.Regexp} (@code{g-regexp.ads})
23295 @geindex GNAT.Regexp (g-regexp.ads)
23297 @geindex Regular expressions
23299 @geindex Pattern matching
23301 A simple implementation of regular expressions, using a subset of regular
23302 expression syntax copied from familiar Unix style utilities.  This is the
23303 simplest of the three pattern matching packages provided, and is particularly
23304 suitable for 'file globbing' applications.
23306 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
23307 @anchor{gnat_rm/the_gnat_library id93}@anchor{32b}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{32c}
23308 @section @cite{GNAT.Registry} (@code{g-regist.ads})
23311 @geindex GNAT.Registry (g-regist.ads)
23313 @geindex Windows Registry
23315 This is a high level binding to the Windows registry.  It is possible to
23316 do simple things like reading a key value, creating a new key.  For full
23317 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
23318 package provided with the Win32Ada binding
23320 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
23321 @anchor{gnat_rm/the_gnat_library id94}@anchor{32d}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{32e}
23322 @section @cite{GNAT.Regpat} (@code{g-regpat.ads})
23325 @geindex GNAT.Regpat (g-regpat.ads)
23327 @geindex Regular expressions
23329 @geindex Pattern matching
23331 A complete implementation of Unix-style regular expression matching, copied
23332 from the original V7 style regular expression library written in C by
23333 Henry Spencer (and binary compatible with this C library).
23335 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
23336 @anchor{gnat_rm/the_gnat_library id95}@anchor{32f}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{330}
23337 @section @cite{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
23340 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
23342 @geindex Rewrite data
23344 A unit to rewrite on-the-fly string occurrences in a stream of
23345 data. The implementation has a very minimal memory footprint as the
23346 full content to be processed is not loaded into memory all at once. This makes
23347 this interface usable for large files or socket streams.
23349 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
23350 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id96}@anchor{332}
23351 @section @cite{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
23354 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
23356 @geindex Secondary Stack Info
23358 Provide the capability to query the high water mark of the current task's
23359 secondary stack.
23361 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
23362 @anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{333}@anchor{gnat_rm/the_gnat_library id97}@anchor{334}
23363 @section @cite{GNAT.Semaphores} (@code{g-semaph.ads})
23366 @geindex GNAT.Semaphores (g-semaph.ads)
23368 @geindex Semaphores
23370 Provides classic counting and binary semaphores using protected types.
23372 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
23373 @anchor{gnat_rm/the_gnat_library id98}@anchor{335}@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{336}
23374 @section @cite{GNAT.Serial_Communications} (@code{g-sercom.ads})
23377 @geindex GNAT.Serial_Communications (g-sercom.ads)
23379 @geindex Serial_Communications
23381 Provides a simple interface to send and receive data over a serial
23382 port. This is only supported on GNU/Linux and Windows.
23384 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
23385 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id99}@anchor{338}
23386 @section @cite{GNAT.SHA1} (@code{g-sha1.ads})
23389 @geindex GNAT.SHA1 (g-sha1.ads)
23391 @geindex Secure Hash Algorithm SHA-1
23393 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
23394 and RFC 3174, and the HMAC-SHA1 message authentication function as described
23395 in RFC 2104 and FIPS PUB 198.
23397 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
23398 @anchor{gnat_rm/the_gnat_library id100}@anchor{339}@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{33a}
23399 @section @cite{GNAT.SHA224} (@code{g-sha224.ads})
23402 @geindex GNAT.SHA224 (g-sha224.ads)
23404 @geindex Secure Hash Algorithm SHA-224
23406 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
23407 and the HMAC-SHA224 message authentication function as described
23408 in RFC 2104 and FIPS PUB 198.
23410 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
23411 @anchor{gnat_rm/the_gnat_library id101}@anchor{33b}@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{33c}
23412 @section @cite{GNAT.SHA256} (@code{g-sha256.ads})
23415 @geindex GNAT.SHA256 (g-sha256.ads)
23417 @geindex Secure Hash Algorithm SHA-256
23419 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
23420 and the HMAC-SHA256 message authentication function as described
23421 in RFC 2104 and FIPS PUB 198.
23423 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
23424 @anchor{gnat_rm/the_gnat_library id102}@anchor{33d}@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{33e}
23425 @section @cite{GNAT.SHA384} (@code{g-sha384.ads})
23428 @geindex GNAT.SHA384 (g-sha384.ads)
23430 @geindex Secure Hash Algorithm SHA-384
23432 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
23433 and the HMAC-SHA384 message authentication function as described
23434 in RFC 2104 and FIPS PUB 198.
23436 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
23437 @anchor{gnat_rm/the_gnat_library id103}@anchor{33f}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{340}
23438 @section @cite{GNAT.SHA512} (@code{g-sha512.ads})
23441 @geindex GNAT.SHA512 (g-sha512.ads)
23443 @geindex Secure Hash Algorithm SHA-512
23445 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
23446 and the HMAC-SHA512 message authentication function as described
23447 in RFC 2104 and FIPS PUB 198.
23449 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
23450 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{341}@anchor{gnat_rm/the_gnat_library id104}@anchor{342}
23451 @section @cite{GNAT.Signals} (@code{g-signal.ads})
23454 @geindex GNAT.Signals (g-signal.ads)
23456 @geindex Signals
23458 Provides the ability to manipulate the blocked status of signals on supported
23459 targets.
23461 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
23462 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{343}@anchor{gnat_rm/the_gnat_library id105}@anchor{344}
23463 @section @cite{GNAT.Sockets} (@code{g-socket.ads})
23466 @geindex GNAT.Sockets (g-socket.ads)
23468 @geindex Sockets
23470 A high level and portable interface to develop sockets based applications.
23471 This package is based on the sockets thin binding found in
23472 @cite{GNAT.Sockets.Thin}. Currently @cite{GNAT.Sockets} is implemented
23473 on all native GNAT ports and on VxWorks cross prots.  It is not implemented for
23474 the LynxOS cross port.
23476 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
23477 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id106}@anchor{346}
23478 @section @cite{GNAT.Source_Info} (@code{g-souinf.ads})
23481 @geindex GNAT.Source_Info (g-souinf.ads)
23483 @geindex Source Information
23485 Provides subprograms that give access to source code information known at
23486 compile time, such as the current file name and line number. Also provides
23487 subprograms yielding the date and time of the current compilation (like the
23488 C macros @cite{__DATE__} and @cite{__TIME__})
23490 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
23491 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id107}@anchor{348}
23492 @section @cite{GNAT.Spelling_Checker} (@code{g-speche.ads})
23495 @geindex GNAT.Spelling_Checker (g-speche.ads)
23497 @geindex Spell checking
23499 Provides a function for determining whether one string is a plausible
23500 near misspelling of another string.
23502 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
23503 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id108}@anchor{34a}
23504 @section @cite{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
23507 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
23509 @geindex Spell checking
23511 Provides a generic function that can be instantiated with a string type for
23512 determining whether one string is a plausible near misspelling of another
23513 string.
23515 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
23516 @anchor{gnat_rm/the_gnat_library id109}@anchor{34b}@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{34c}
23517 @section @cite{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
23520 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
23522 @geindex SPITBOL pattern matching
23524 @geindex Pattern matching
23526 A complete implementation of SNOBOL4 style pattern matching.  This is the
23527 most elaborate of the pattern matching packages provided.  It fully duplicates
23528 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
23529 efficient algorithm developed by Robert Dewar for the SPITBOL system.
23531 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
23532 @anchor{gnat_rm/the_gnat_library id110}@anchor{34d}@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{34e}
23533 @section @cite{GNAT.Spitbol} (@code{g-spitbo.ads})
23536 @geindex GNAT.Spitbol (g-spitbo.ads)
23538 @geindex SPITBOL interface
23540 The top level package of the collection of SPITBOL-style functionality, this
23541 package provides basic SNOBOL4 string manipulation functions, such as
23542 Pad, Reverse, Trim, Substr capability, as well as a generic table function
23543 useful for constructing arbitrary mappings from strings in the style of
23544 the SNOBOL4 TABLE function.
23546 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
23547 @anchor{gnat_rm/the_gnat_library id111}@anchor{34f}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{350}
23548 @section @cite{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
23551 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
23553 @geindex Sets of strings
23555 @geindex SPITBOL Tables
23557 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
23558 for type @cite{Standard.Boolean}, giving an implementation of sets of
23559 string values.
23561 @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
23562 @anchor{gnat_rm/the_gnat_library id112}@anchor{351}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{352}
23563 @section @cite{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
23566 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
23568 @geindex Integer maps
23570 @geindex Maps
23572 @geindex SPITBOL Tables
23574 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
23575 for type @cite{Standard.Integer}, giving an implementation of maps
23576 from string to integer values.
23578 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
23579 @anchor{gnat_rm/the_gnat_library id113}@anchor{353}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{354}
23580 @section @cite{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
23583 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
23585 @geindex String maps
23587 @geindex Maps
23589 @geindex SPITBOL Tables
23591 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table} for
23592 a variable length string type, giving an implementation of general
23593 maps from strings to strings.
23595 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
23596 @anchor{gnat_rm/the_gnat_library id114}@anchor{355}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{356}
23597 @section @cite{GNAT.SSE} (@code{g-sse.ads})
23600 @geindex GNAT.SSE (g-sse.ads)
23602 Root of a set of units aimed at offering Ada bindings to a subset of
23603 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
23604 targets.  It exposes vector component types together with a general
23605 introduction to the binding contents and use.
23607 @node GNAT SSE Vector_Types g-ssvety ads,GNAT Strings g-string ads,GNAT SSE g-sse ads,The GNAT Library
23608 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id115}@anchor{358}
23609 @section @cite{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
23612 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
23614 SSE vector types for use with SSE related intrinsics.
23616 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
23617 @anchor{gnat_rm/the_gnat_library id116}@anchor{359}@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{35a}
23618 @section @cite{GNAT.Strings} (@code{g-string.ads})
23621 @geindex GNAT.Strings (g-string.ads)
23623 Common String access types and related subprograms. Basically it
23624 defines a string access and an array of string access types.
23626 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
23627 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id117}@anchor{35c}
23628 @section @cite{GNAT.String_Split} (@code{g-strspl.ads})
23631 @geindex GNAT.String_Split (g-strspl.ads)
23633 @geindex String splitter
23635 Useful string manipulation routines: given a set of separators, split
23636 a string wherever the separators appear, and provide direct access
23637 to the resulting slices. This package is instantiated from
23638 @cite{GNAT.Array_Split}.
23640 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
23641 @anchor{gnat_rm/the_gnat_library id118}@anchor{35d}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{35e}
23642 @section @cite{GNAT.Table} (@code{g-table.ads})
23645 @geindex GNAT.Table (g-table.ads)
23647 @geindex Table implementation
23649 @geindex Arrays
23650 @geindex extendable
23652 A generic package providing a single dimension array abstraction where the
23653 length of the array can be dynamically modified.
23655 This package provides a facility similar to that of @cite{GNAT.Dynamic_Tables},
23656 except that this package declares a single instance of the table type,
23657 while an instantiation of @cite{GNAT.Dynamic_Tables} creates a type that can be
23658 used to define dynamic instances of the table.
23660 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
23661 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id119}@anchor{360}
23662 @section @cite{GNAT.Task_Lock} (@code{g-tasloc.ads})
23665 @geindex GNAT.Task_Lock (g-tasloc.ads)
23667 @geindex Task synchronization
23669 @geindex Task locking
23671 @geindex Locking
23673 A very simple facility for locking and unlocking sections of code using a
23674 single global task lock.  Appropriate for use in situations where contention
23675 between tasks is very rarely expected.
23677 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
23678 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{361}@anchor{gnat_rm/the_gnat_library id120}@anchor{362}
23679 @section @cite{GNAT.Time_Stamp} (@code{g-timsta.ads})
23682 @geindex GNAT.Time_Stamp (g-timsta.ads)
23684 @geindex Time stamp
23686 @geindex Current time
23688 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
23689 represents the current date and time in ISO 8601 format. This is a very simple
23690 routine with minimal code and there are no dependencies on any other unit.
23692 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
23693 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id121}@anchor{364}
23694 @section @cite{GNAT.Threads} (@code{g-thread.ads})
23697 @geindex GNAT.Threads (g-thread.ads)
23699 @geindex Foreign threads
23701 @geindex Threads
23702 @geindex foreign
23704 Provides facilities for dealing with foreign threads which need to be known
23705 by the GNAT run-time system. Consult the documentation of this package for
23706 further details if your program has threads that are created by a non-Ada
23707 environment which then accesses Ada code.
23709 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
23710 @anchor{gnat_rm/the_gnat_library id122}@anchor{365}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{366}
23711 @section @cite{GNAT.Traceback} (@code{g-traceb.ads})
23714 @geindex GNAT.Traceback (g-traceb.ads)
23716 @geindex Trace back facilities
23718 Provides a facility for obtaining non-symbolic traceback information, useful
23719 in various debugging situations.
23721 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
23722 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id123}@anchor{368}
23723 @section @cite{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
23726 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
23728 @geindex Trace back facilities
23730 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
23731 @anchor{gnat_rm/the_gnat_library id124}@anchor{369}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{36a}
23732 @section @cite{GNAT.UTF_32} (@code{g-table.ads})
23735 @geindex GNAT.UTF_32 (g-table.ads)
23737 @geindex Wide character codes
23739 This is a package intended to be used in conjunction with the
23740 @cite{Wide_Character} type in Ada 95 and the
23741 @cite{Wide_Wide_Character} type in Ada 2005 (available
23742 in @cite{GNAT} in Ada 2005 mode). This package contains
23743 Unicode categorization routines, as well as lexical
23744 categorization routines corresponding to the Ada 2005
23745 lexical rules for identifiers and strings, and also a
23746 lower case to upper case fold routine corresponding to
23747 the Ada 2005 rules for identifier equivalence.
23749 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
23750 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{36b}@anchor{gnat_rm/the_gnat_library id125}@anchor{36c}
23751 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
23754 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
23756 @geindex Spell checking
23758 Provides a function for determining whether one wide wide string is a plausible
23759 near misspelling of another wide wide string, where the strings are represented
23760 using the UTF_32_String type defined in System.Wch_Cnv.
23762 @node GNAT Wide_Spelling_Checker g-wispch ads,GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Spelling_Checker g-u3spch ads,The GNAT Library
23763 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{36d}@anchor{gnat_rm/the_gnat_library id126}@anchor{36e}
23764 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
23767 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
23769 @geindex Spell checking
23771 Provides a function for determining whether one wide string is a plausible
23772 near misspelling of another wide string.
23774 @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
23775 @anchor{gnat_rm/the_gnat_library id127}@anchor{36f}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{370}
23776 @section @cite{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
23779 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
23781 @geindex Wide_String splitter
23783 Useful wide string manipulation routines: given a set of separators, split
23784 a wide string wherever the separators appear, and provide direct access
23785 to the resulting slices. This package is instantiated from
23786 @cite{GNAT.Array_Split}.
23788 @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
23789 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{371}@anchor{gnat_rm/the_gnat_library id128}@anchor{372}
23790 @section @cite{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
23793 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
23795 @geindex Spell checking
23797 Provides a function for determining whether one wide wide string is a plausible
23798 near misspelling of another wide wide string.
23800 @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
23801 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{373}@anchor{gnat_rm/the_gnat_library id129}@anchor{374}
23802 @section @cite{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
23805 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
23807 @geindex Wide_Wide_String splitter
23809 Useful wide wide string manipulation routines: given a set of separators, split
23810 a wide wide string wherever the separators appear, and provide direct access
23811 to the resulting slices. This package is instantiated from
23812 @cite{GNAT.Array_Split}.
23814 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
23815 @anchor{gnat_rm/the_gnat_library id130}@anchor{375}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{376}
23816 @section @cite{Interfaces.C.Extensions} (@code{i-cexten.ads})
23819 @geindex Interfaces.C.Extensions (i-cexten.ads)
23821 This package contains additional C-related definitions, intended
23822 for use with either manually or automatically generated bindings
23823 to C libraries.
23825 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
23826 @anchor{gnat_rm/the_gnat_library id131}@anchor{377}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{378}
23827 @section @cite{Interfaces.C.Streams} (@code{i-cstrea.ads})
23830 @geindex Interfaces.C.Streams (i-cstrea.ads)
23832 @geindex C streams
23833 @geindex interfacing
23835 This package is a binding for the most commonly used operations
23836 on C streams.
23838 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
23839 @anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id132}@anchor{37a}
23840 @section @cite{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
23843 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
23845 @geindex IBM Packed Format
23847 @geindex Packed Decimal
23849 This package provides a set of routines for conversions to and
23850 from a packed decimal format compatible with that used on IBM
23851 mainframes.
23853 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
23854 @anchor{gnat_rm/the_gnat_library id133}@anchor{37b}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{37c}
23855 @section @cite{Interfaces.VxWorks} (@code{i-vxwork.ads})
23858 @geindex Interfaces.VxWorks (i-vxwork.ads)
23860 @geindex Interfacing to VxWorks
23862 @geindex VxWorks
23863 @geindex interfacing
23865 This package provides a limited binding to the VxWorks API.
23866 In particular, it interfaces with the
23867 VxWorks hardware interrupt facilities.
23869 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
23870 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id134}@anchor{37e}
23871 @section @cite{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
23874 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
23876 @geindex Interfacing to VxWorks' I/O
23878 @geindex VxWorks
23879 @geindex I/O interfacing
23881 @geindex VxWorks
23882 @geindex Get_Immediate
23884 @geindex Get_Immediate
23885 @geindex VxWorks
23887 This package provides a binding to the ioctl (IO/Control)
23888 function of VxWorks, defining a set of option values and
23889 function codes. A particular use of this package is
23890 to enable the use of Get_Immediate under VxWorks.
23892 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
23893 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{37f}@anchor{gnat_rm/the_gnat_library id135}@anchor{380}
23894 @section @cite{System.Address_Image} (@code{s-addima.ads})
23897 @geindex System.Address_Image (s-addima.ads)
23899 @geindex Address image
23901 @geindex Image
23902 @geindex of an address
23904 This function provides a useful debugging
23905 function that gives an (implementation dependent)
23906 string which identifies an address.
23908 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
23909 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{381}@anchor{gnat_rm/the_gnat_library id136}@anchor{382}
23910 @section @cite{System.Assertions} (@code{s-assert.ads})
23913 @geindex System.Assertions (s-assert.ads)
23915 @geindex Assertions
23917 @geindex Assert_Failure
23918 @geindex exception
23920 This package provides the declaration of the exception raised
23921 by an run-time assertion failure, as well as the routine that
23922 is used internally to raise this assertion.
23924 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
23925 @anchor{gnat_rm/the_gnat_library id137}@anchor{383}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{384}
23926 @section @cite{System.Atomic_Counters} (@code{s-atocou.ads})
23929 @geindex System.Atomic_Counters (s-atocou.ads)
23931 This package provides the declaration of an atomic counter type,
23932 together with efficient routines (using hardware
23933 synchronization primitives) for incrementing, decrementing,
23934 and testing of these counters. This package is implemented
23935 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
23936 x86, and x86_64 platforms.
23938 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
23939 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{385}@anchor{gnat_rm/the_gnat_library id138}@anchor{386}
23940 @section @cite{System.Memory} (@code{s-memory.ads})
23943 @geindex System.Memory (s-memory.ads)
23945 @geindex Memory allocation
23947 This package provides the interface to the low level routines used
23948 by the generated code for allocation and freeing storage for the
23949 default storage pool (analogous to the C routines malloc and free.
23950 It also provides a reallocation interface analogous to the C routine
23951 realloc. The body of this unit may be modified to provide alternative
23952 allocation mechanisms for the default pool, and in addition, direct
23953 calls to this unit may be made for low level allocation uses (for
23954 example see the body of @cite{GNAT.Tables}).
23956 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
23957 @anchor{gnat_rm/the_gnat_library id139}@anchor{387}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{388}
23958 @section @cite{System.Multiprocessors} (@code{s-multip.ads})
23961 @geindex System.Multiprocessors (s-multip.ads)
23963 @geindex Multiprocessor interface
23965 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
23966 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
23967 technically an implementation-defined addition).
23969 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
23970 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id140}@anchor{38a}
23971 @section @cite{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
23974 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
23976 @geindex Multiprocessor interface
23978 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
23979 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
23980 technically an implementation-defined addition).
23982 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
23983 @anchor{gnat_rm/the_gnat_library id141}@anchor{38b}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{38c}
23984 @section @cite{System.Partition_Interface} (@code{s-parint.ads})
23987 @geindex System.Partition_Interface (s-parint.ads)
23989 @geindex Partition interfacing functions
23991 This package provides facilities for partition interfacing.  It
23992 is used primarily in a distribution context when using Annex E
23993 with @cite{GLADE}.
23995 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
23996 @anchor{gnat_rm/the_gnat_library id142}@anchor{38d}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{38e}
23997 @section @cite{System.Pool_Global} (@code{s-pooglo.ads})
24000 @geindex System.Pool_Global (s-pooglo.ads)
24002 @geindex Storage pool
24003 @geindex global
24005 @geindex Global storage pool
24007 This package provides a storage pool that is equivalent to the default
24008 storage pool used for access types for which no pool is specifically
24009 declared. It uses malloc/free to allocate/free and does not attempt to
24010 do any automatic reclamation.
24012 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
24013 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id143}@anchor{390}
24014 @section @cite{System.Pool_Local} (@code{s-pooloc.ads})
24017 @geindex System.Pool_Local (s-pooloc.ads)
24019 @geindex Storage pool
24020 @geindex local
24022 @geindex Local storage pool
24024 This package provides a storage pool that is intended for use with locally
24025 defined access types. It uses malloc/free for allocate/free, and maintains
24026 a list of allocated blocks, so that all storage allocated for the pool can
24027 be freed automatically when the pool is finalized.
24029 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
24030 @anchor{gnat_rm/the_gnat_library id144}@anchor{391}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{392}
24031 @section @cite{System.Restrictions} (@code{s-restri.ads})
24034 @geindex System.Restrictions (s-restri.ads)
24036 @geindex Run-time restrictions access
24038 This package provides facilities for accessing at run time
24039 the status of restrictions specified at compile time for
24040 the partition. Information is available both with regard
24041 to actual restrictions specified, and with regard to
24042 compiler determined information on which restrictions
24043 are violated by one or more packages in the partition.
24045 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
24046 @anchor{gnat_rm/the_gnat_library id145}@anchor{393}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{394}
24047 @section @cite{System.Rident} (@code{s-rident.ads})
24050 @geindex System.Rident (s-rident.ads)
24052 @geindex Restrictions definitions
24054 This package provides definitions of the restrictions
24055 identifiers supported by GNAT, and also the format of
24056 the restrictions provided in package System.Restrictions.
24057 It is not normally necessary to @cite{with} this generic package
24058 since the necessary instantiation is included in
24059 package System.Restrictions.
24061 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
24062 @anchor{gnat_rm/the_gnat_library id146}@anchor{395}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{396}
24063 @section @cite{System.Strings.Stream_Ops} (@code{s-ststop.ads})
24066 @geindex System.Strings.Stream_Ops (s-ststop.ads)
24068 @geindex Stream operations
24070 @geindex String stream operations
24072 This package provides a set of stream subprograms for standard string types.
24073 It is intended primarily to support implicit use of such subprograms when
24074 stream attributes are applied to string types, but the subprograms in this
24075 package can be used directly by application programs.
24077 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
24078 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{397}@anchor{gnat_rm/the_gnat_library id147}@anchor{398}
24079 @section @cite{System.Unsigned_Types} (@code{s-unstyp.ads})
24082 @geindex System.Unsigned_Types (s-unstyp.ads)
24084 This package contains definitions of standard unsigned types that
24085 correspond in size to the standard signed types declared in Standard,
24086 and (unlike the types in Interfaces) have corresponding names. It
24087 also contains some related definitions for other specialized types
24088 used by the compiler in connection with packed array types.
24090 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
24091 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{399}@anchor{gnat_rm/the_gnat_library id148}@anchor{39a}
24092 @section @cite{System.Wch_Cnv} (@code{s-wchcnv.ads})
24095 @geindex System.Wch_Cnv (s-wchcnv.ads)
24097 @geindex Wide Character
24098 @geindex Representation
24100 @geindex Wide String
24101 @geindex Conversion
24103 @geindex Representation of wide characters
24105 This package provides routines for converting between
24106 wide and wide wide characters and a representation as a value of type
24107 @cite{Standard.String}, using a specified wide character
24108 encoding method.  It uses definitions in
24109 package @cite{System.Wch_Con}.
24111 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
24112 @anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{39b}@anchor{gnat_rm/the_gnat_library id149}@anchor{39c}
24113 @section @cite{System.Wch_Con} (@code{s-wchcon.ads})
24116 @geindex System.Wch_Con (s-wchcon.ads)
24118 This package provides definitions and descriptions of
24119 the various methods used for encoding wide characters
24120 in ordinary strings.  These definitions are used by
24121 the package @cite{System.Wch_Cnv}.
24123 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
24124 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{39d}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{39e}
24125 @chapter Interfacing to Other Languages
24128 The facilities in Annex B of the Ada Reference Manual are fully
24129 implemented in GNAT, and in addition, a full interface to C++ is
24130 provided.
24132 @menu
24133 * Interfacing to C:: 
24134 * Interfacing to C++:: 
24135 * Interfacing to COBOL:: 
24136 * Interfacing to Fortran:: 
24137 * Interfacing to non-GNAT Ada code:: 
24139 @end menu
24141 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
24142 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{39f}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{3a0}
24143 @section Interfacing to C
24146 Interfacing to C with GNAT can use one of two approaches:
24149 @itemize *
24151 @item 
24152 The types in the package @cite{Interfaces.C} may be used.
24154 @item 
24155 Standard Ada types may be used directly.  This may be less portable to
24156 other compilers, but will work on all GNAT compilers, which guarantee
24157 correspondence between the C and Ada types.
24158 @end itemize
24160 Pragma @cite{Convention C} may be applied to Ada types, but mostly has no
24161 effect, since this is the default.  The following table shows the
24162 correspondence between Ada scalar types and the corresponding C types.
24165 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
24166 @headitem
24168 Ada Type
24170 @tab
24172 C Type
24174 @item
24176 @code{Integer}
24178 @tab
24180 @code{int}
24182 @item
24184 @code{Short_Integer}
24186 @tab
24188 @code{short}
24190 @item
24192 @code{Short_Short_Integer}
24194 @tab
24196 @code{signed char}
24198 @item
24200 @code{Long_Integer}
24202 @tab
24204 @code{long}
24206 @item
24208 @code{Long_Long_Integer}
24210 @tab
24212 @code{long long}
24214 @item
24216 @code{Short_Float}
24218 @tab
24220 @code{float}
24222 @item
24224 @code{Float}
24226 @tab
24228 @code{float}
24230 @item
24232 @code{Long_Float}
24234 @tab
24236 @code{double}
24238 @item
24240 @code{Long_Long_Float}
24242 @tab
24244 This is the longest floating-point type supported by the hardware.
24246 @end multitable
24249 Additionally, there are the following general correspondences between Ada
24250 and C types:
24253 @itemize *
24255 @item 
24256 Ada enumeration types map to C enumeration types directly if pragma
24257 @cite{Convention C} is specified, which causes them to have int
24258 length.  Without pragma @cite{Convention C}, Ada enumeration types map to
24259 8, 16, or 32 bits (i.e., C types @cite{signed char}, @cite{short},
24260 @cite{int}, respectively) depending on the number of values passed.
24261 This is the only case in which pragma @cite{Convention C} affects the
24262 representation of an Ada type.
24264 @item 
24265 Ada access types map to C pointers, except for the case of pointers to
24266 unconstrained types in Ada, which have no direct C equivalent.
24268 @item 
24269 Ada arrays map directly to C arrays.
24271 @item 
24272 Ada records map directly to C structures.
24274 @item 
24275 Packed Ada records map to C structures where all members are bit fields
24276 of the length corresponding to the @code{type'Size} value in Ada.
24277 @end itemize
24279 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
24280 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{3a1}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{3f}
24281 @section Interfacing to C++
24284 The interface to C++ makes use of the following pragmas, which are
24285 primarily intended to be constructed automatically using a binding generator
24286 tool, although it is possible to construct them by hand.
24288 Using these pragmas it is possible to achieve complete
24289 inter-operability between Ada tagged types and C++ class definitions.
24290 See @ref{7,,Implementation Defined Pragmas}, for more details.
24293 @table @asis
24295 @item @emph{pragma CPP_Class ([Entity =>] `LOCAL_NAME`)}
24297 The argument denotes an entity in the current declarative region that is
24298 declared as a tagged or untagged record type. It indicates that the type
24299 corresponds to an externally declared C++ class type, and is to be laid
24300 out the same way that C++ would lay out the type.
24302 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
24303 for backward compatibility but its functionality is available
24304 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
24306 @item @emph{pragma CPP_Constructor ([Entity =>] `LOCAL_NAME`)}
24308 This pragma identifies an imported function (imported in the usual way
24309 with pragma @cite{Import}) as corresponding to a C++ constructor.
24310 @end table
24312 A few restrictions are placed on the use of the @cite{Access} attribute
24313 in conjunction with subprograms subject to convention @cite{CPP}: the
24314 attribute may be used neither on primitive operations of a tagged
24315 record type with convention @cite{CPP}, imported or not, nor on
24316 subprograms imported with pragma @cite{CPP_Constructor}.
24318 In addition, C++ exceptions are propagated and can be handled in an
24319 @cite{others} choice of an exception handler. The corresponding Ada
24320 occurrence has no message, and the simple name of the exception identity
24321 contains @code{Foreign_Exception}. Finalization and awaiting dependent
24322 tasks works properly when such foreign exceptions are propagated.
24324 It is also possible to import a C++ exception using the following syntax:
24326 @example
24327 LOCAL_NAME : exception;
24328 pragma Import (Cpp,
24329   [Entity =>] LOCAL_NAME,
24330   [External_Name =>] static_string_EXPRESSION);
24331 @end example
24333 The @cite{External_Name} is the name of the C++ RTTI symbol. You can then
24334 cover a specific C++ exception in an exception handler.
24336 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
24337 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{3a2}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{3a3}
24338 @section Interfacing to COBOL
24341 Interfacing to COBOL is achieved as described in section B.4 of
24342 the Ada Reference Manual.
24344 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
24345 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{3a4}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{3a5}
24346 @section Interfacing to Fortran
24349 Interfacing to Fortran is achieved as described in section B.5 of the
24350 Ada Reference Manual.  The pragma @cite{Convention Fortran}, applied to a
24351 multi-dimensional array causes the array to be stored in column-major
24352 order as required for convenient interface to Fortran.
24354 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
24355 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{3a6}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{3a7}
24356 @section Interfacing to non-GNAT Ada code
24359 It is possible to specify the convention @cite{Ada} in a pragma
24360 @cite{Import} or pragma @cite{Export}.  However this refers to
24361 the calling conventions used by GNAT, which may or may not be
24362 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
24363 compiler to allow interoperation.
24365 If arguments types are kept simple, and if the foreign compiler generally
24366 follows system calling conventions, then it may be possible to integrate
24367 files compiled by other Ada compilers, provided that the elaboration
24368 issues are adequately addressed (for example by eliminating the
24369 need for any load time elaboration).
24371 In particular, GNAT running on VMS is designed to
24372 be highly compatible with the DEC Ada 83 compiler, so this is one
24373 case in which it is possible to import foreign units of this type,
24374 provided that the data items passed are restricted to simple scalar
24375 values or simple record types without variants, or simple array
24376 types with fixed bounds.
24378 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
24379 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{3a8}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{3a9}
24380 @chapter Specialized Needs Annexes
24383 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
24384 required in all implementations.  However, as described in this chapter,
24385 GNAT implements all of these annexes:
24388 @table @asis
24390 @item @emph{Systems Programming (Annex C)}
24392 The Systems Programming Annex is fully implemented.
24394 @item @emph{Real-Time Systems (Annex D)}
24396 The Real-Time Systems Annex is fully implemented.
24398 @item @emph{Distributed Systems (Annex E)}
24400 Stub generation is fully implemented in the GNAT compiler.  In addition,
24401 a complete compatible PCS is available as part of the GLADE system,
24402 a separate product.  When the two
24403 products are used in conjunction, this annex is fully implemented.
24405 @item @emph{Information Systems (Annex F)}
24407 The Information Systems annex is fully implemented.
24409 @item @emph{Numerics (Annex G)}
24411 The Numerics Annex is fully implemented.
24413 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
24415 The Safety and Security Annex (termed the High-Integrity Systems Annex
24416 in Ada 2005) is fully implemented.
24417 @end table
24419 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
24420 @anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{3aa}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{3ab}
24421 @chapter Implementation of Specific Ada Features
24424 This chapter describes the GNAT implementation of several Ada language
24425 facilities.
24427 @menu
24428 * Machine Code Insertions:: 
24429 * GNAT Implementation of Tasking:: 
24430 * GNAT Implementation of Shared Passive Packages:: 
24431 * Code Generation for Array Aggregates:: 
24432 * The Size of Discriminated Records with Default Discriminants:: 
24433 * Strict Conformance to the Ada Reference Manual:: 
24435 @end menu
24437 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
24438 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{119}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{3ac}
24439 @section Machine Code Insertions
24442 @geindex Machine Code insertions
24444 Package @cite{Machine_Code} provides machine code support as described
24445 in the Ada Reference Manual in two separate forms:
24448 @itemize *
24450 @item 
24451 Machine code statements, consisting of qualified expressions that
24452 fit the requirements of RM section 13.8.
24454 @item 
24455 An intrinsic callable procedure, providing an alternative mechanism of
24456 including machine instructions in a subprogram.
24457 @end itemize
24459 The two features are similar, and both are closely related to the mechanism
24460 provided by the asm instruction in the GNU C compiler.  Full understanding
24461 and use of the facilities in this package requires understanding the asm
24462 instruction, see the section on Extended Asm in
24463 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
24465 Calls to the function @cite{Asm} and the procedure @cite{Asm} have identical
24466 semantic restrictions and effects as described below.  Both are provided so
24467 that the procedure call can be used as a statement, and the function call
24468 can be used to form a code_statement.
24470 Consider this C @cite{asm} instruction:
24472 @example
24473 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
24474 @end example
24476 The equivalent can be written for GNAT as:
24478 @example
24479 Asm ("fsinx %1 %0",
24480      My_Float'Asm_Output ("=f", result),
24481      My_Float'Asm_Input  ("f",  angle));
24482 @end example
24484 The first argument to @cite{Asm} is the assembler template, and is
24485 identical to what is used in GNU C.  This string must be a static
24486 expression.  The second argument is the output operand list.  It is
24487 either a single @cite{Asm_Output} attribute reference, or a list of such
24488 references enclosed in parentheses (technically an array aggregate of
24489 such references).
24491 The @cite{Asm_Output} attribute denotes a function that takes two
24492 parameters.  The first is a string, the second is the name of a variable
24493 of the type designated by the attribute prefix.  The first (string)
24494 argument is required to be a static expression and designates the
24495 constraint (see the section on Constraints in
24496 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
24497 for the parameter; e.g., what kind of register is required.  The second
24498 argument is the variable to be written or updated with the
24499 result.  The possible values for constraint are the same as those used in
24500 the RTL, and are dependent on the configuration file used to build the
24501 GCC back end.  If there are no output operands, then this argument may
24502 either be omitted, or explicitly given as @cite{No_Output_Operands}.
24503 No support is provided for GNU C's symbolic names for output parameters.
24505 The second argument of @code{my_float'Asm_Output} functions as
24506 though it were an @cite{out} parameter, which is a little curious, but
24507 all names have the form of expressions, so there is no syntactic
24508 irregularity, even though normally functions would not be permitted
24509 @cite{out} parameters.  The third argument is the list of input
24510 operands.  It is either a single @cite{Asm_Input} attribute reference, or
24511 a list of such references enclosed in parentheses (technically an array
24512 aggregate of such references).
24514 The @cite{Asm_Input} attribute denotes a function that takes two
24515 parameters.  The first is a string, the second is an expression of the
24516 type designated by the prefix.  The first (string) argument is required
24517 to be a static expression, and is the constraint for the parameter,
24518 (e.g., what kind of register is required).  The second argument is the
24519 value to be used as the input argument.  The possible values for the
24520 constraint are the same as those used in the RTL, and are dependent on
24521 the configuration file used to built the GCC back end.
24522 No support is provided for GNU C's symbolic names for input parameters.
24524 If there are no input operands, this argument may either be omitted, or
24525 explicitly given as @cite{No_Input_Operands}.  The fourth argument, not
24526 present in the above example, is a list of register names, called the
24527 @emph{clobber} argument.  This argument, if given, must be a static string
24528 expression, and is a space or comma separated list of names of registers
24529 that must be considered destroyed as a result of the @cite{Asm} call.  If
24530 this argument is the null string (the default value), then the code
24531 generator assumes that no additional registers are destroyed.
24532 In addition to registers, the special clobbers @cite{memory} and
24533 @cite{cc} as described in the GNU C docs are both supported.
24535 The fifth argument, not present in the above example, called the
24536 @emph{volatile} argument, is by default @cite{False}.  It can be set to
24537 the literal value @cite{True} to indicate to the code generator that all
24538 optimizations with respect to the instruction specified should be
24539 suppressed, and in particular an instruction that has outputs
24540 will still be generated, even if none of the outputs are
24541 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
24542 for the full description.
24543 Generally it is strongly advisable to use Volatile for any ASM statement
24544 that is missing either input or output operands or to avoid unwanted
24545 optimizations. A warning is generated if this advice is not followed.
24547 No support is provided for GNU C's @cite{asm goto} feature.
24549 The @cite{Asm} subprograms may be used in two ways.  First the procedure
24550 forms can be used anywhere a procedure call would be valid, and
24551 correspond to what the RM calls 'intrinsic' routines.  Such calls can
24552 be used to intersperse machine instructions with other Ada statements.
24553 Second, the function forms, which return a dummy value of the limited
24554 private type @cite{Asm_Insn}, can be used in code statements, and indeed
24555 this is the only context where such calls are allowed.  Code statements
24556 appear as aggregates of the form:
24558 @example
24559 Asm_Insn'(Asm (...));
24560 Asm_Insn'(Asm_Volatile (...));
24561 @end example
24563 In accordance with RM rules, such code statements are allowed only
24564 within subprograms whose entire body consists of such statements.  It is
24565 not permissible to intermix such statements with other Ada statements.
24567 Typically the form using intrinsic procedure calls is more convenient
24568 and more flexible.  The code statement form is provided to meet the RM
24569 suggestion that such a facility should be made available.  The following
24570 is the exact syntax of the call to @cite{Asm}. As usual, if named notation
24571 is used, the arguments may be given in arbitrary order, following the
24572 normal rules for use of positional and named arguments:
24574 @example
24575 ASM_CALL ::= Asm (
24576                  [Template =>] static_string_EXPRESSION
24577                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
24578                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
24579                [,[Clobber  =>] static_string_EXPRESSION ]
24580                [,[Volatile =>] static_boolean_EXPRESSION] )
24582 OUTPUT_OPERAND_LIST ::=
24583   [PREFIX.]No_Output_Operands
24584 | OUTPUT_OPERAND_ATTRIBUTE
24585 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
24587 OUTPUT_OPERAND_ATTRIBUTE ::=
24588   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
24590 INPUT_OPERAND_LIST ::=
24591   [PREFIX.]No_Input_Operands
24592 | INPUT_OPERAND_ATTRIBUTE
24593 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
24595 INPUT_OPERAND_ATTRIBUTE ::=
24596   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
24597 @end example
24599 The identifiers @cite{No_Input_Operands} and @cite{No_Output_Operands}
24600 are declared in the package @cite{Machine_Code} and must be referenced
24601 according to normal visibility rules. In particular if there is no
24602 @cite{use} clause for this package, then appropriate package name
24603 qualification is required.
24605 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
24606 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{3ad}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{3ae}
24607 @section GNAT Implementation of Tasking
24610 This chapter outlines the basic GNAT approach to tasking (in particular,
24611 a multi-layered library for portability) and discusses issues related
24612 to compliance with the Real-Time Systems Annex.
24614 @menu
24615 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
24616 * Ensuring Compliance with the Real-Time Annex:: 
24618 @end menu
24620 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
24621 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{3af}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{3b0}
24622 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
24625 GNAT's run-time support comprises two layers:
24628 @itemize *
24630 @item 
24631 GNARL (GNAT Run-time Layer)
24633 @item 
24634 GNULL (GNAT Low-level Library)
24635 @end itemize
24637 In GNAT, Ada's tasking services rely on a platform and OS independent
24638 layer known as GNARL.  This code is responsible for implementing the
24639 correct semantics of Ada's task creation, rendezvous, protected
24640 operations etc.
24642 GNARL decomposes Ada's tasking semantics into simpler lower level
24643 operations such as create a thread, set the priority of a thread,
24644 yield, create a lock, lock/unlock, etc.  The spec for these low-level
24645 operations constitutes GNULLI, the GNULL Interface.  This interface is
24646 directly inspired from the POSIX real-time API.
24648 If the underlying executive or OS implements the POSIX standard
24649 faithfully, the GNULL Interface maps as is to the services offered by
24650 the underlying kernel.  Otherwise, some target dependent glue code maps
24651 the services offered by the underlying kernel to the semantics expected
24652 by GNARL.
24654 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
24655 key point is that each Ada task is mapped on a thread in the underlying
24656 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
24658 In addition Ada task priorities map onto the underlying thread priorities.
24659 Mapping Ada tasks onto the underlying kernel threads has several advantages:
24662 @itemize *
24664 @item 
24665 The underlying scheduler is used to schedule the Ada tasks.  This
24666 makes Ada tasks as efficient as kernel threads from a scheduling
24667 standpoint.
24669 @item 
24670 Interaction with code written in C containing threads is eased
24671 since at the lowest level Ada tasks and C threads map onto the same
24672 underlying kernel concept.
24674 @item 
24675 When an Ada task is blocked during I/O the remaining Ada tasks are
24676 able to proceed.
24678 @item 
24679 On multiprocessor systems Ada tasks can execute in parallel.
24680 @end itemize
24682 Some threads libraries offer a mechanism to fork a new process, with the
24683 child process duplicating the threads from the parent.
24684 GNAT does not
24685 support this functionality when the parent contains more than one task.
24686 .. index:: Forking a new process
24688 @node Ensuring Compliance with the Real-Time Annex,,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
24689 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{3b1}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{3b2}
24690 @subsection Ensuring Compliance with the Real-Time Annex
24693 @geindex Real-Time Systems Annex compliance
24695 Although mapping Ada tasks onto
24696 the underlying threads has significant advantages, it does create some
24697 complications when it comes to respecting the scheduling semantics
24698 specified in the real-time annex (Annex D).
24700 For instance the Annex D requirement for the @cite{FIFO_Within_Priorities}
24701 scheduling policy states:
24703 @quotation
24705 @emph{When the active priority of a ready task that is not running
24706 changes, or the setting of its base priority takes effect, the
24707 task is removed from the ready queue for its old active priority
24708 and is added at the tail of the ready queue for its new active
24709 priority, except in the case where the active priority is lowered
24710 due to the loss of inherited priority, in which case the task is
24711 added at the head of the ready queue for its new active priority.}
24712 @end quotation
24714 While most kernels do put tasks at the end of the priority queue when
24715 a task changes its priority, (which respects the main
24716 FIFO_Within_Priorities requirement), almost none keep a thread at the
24717 beginning of its priority queue when its priority drops from the loss
24718 of inherited priority.
24720 As a result most vendors have provided incomplete Annex D implementations.
24722 The GNAT run-time, has a nice cooperative solution to this problem
24723 which ensures that accurate FIFO_Within_Priorities semantics are
24724 respected.
24726 The principle is as follows.  When an Ada task T is about to start
24727 running, it checks whether some other Ada task R with the same
24728 priority as T has been suspended due to the loss of priority
24729 inheritance.  If this is the case, T yields and is placed at the end of
24730 its priority queue.  When R arrives at the front of the queue it
24731 executes.
24733 Note that this simple scheme preserves the relative order of the tasks
24734 that were ready to execute in the priority queue where R has been
24735 placed at the end.
24737 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
24738 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{3b3}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{3b4}
24739 @section GNAT Implementation of Shared Passive Packages
24742 @geindex Shared passive packages
24744 GNAT fully implements the pragma @cite{Shared_Passive} for
24745 .. index:: pragma @cite{Shared_Passive}
24747 the purpose of designating shared passive packages.
24748 This allows the use of passive partitions in the
24749 context described in the Ada Reference Manual; i.e., for communication
24750 between separate partitions of a distributed application using the
24751 features in Annex E.
24752 .. index:: Annex E
24754 @geindex Distribution Systems Annex
24756 However, the implementation approach used by GNAT provides for more
24757 extensive usage as follows:
24760 @table @asis
24762 @item @emph{Communication between separate programs}
24764 This allows separate programs to access the data in passive
24765 partitions, using protected objects for synchronization where
24766 needed. The only requirement is that the two programs have a
24767 common shared file system. It is even possible for programs
24768 running on different machines with different architectures
24769 (e.g., different endianness) to communicate via the data in
24770 a passive partition.
24772 @item @emph{Persistence between program runs}
24774 The data in a passive package can persist from one run of a
24775 program to another, so that a later program sees the final
24776 values stored by a previous run of the same program.
24777 @end table
24779 The implementation approach used is to store the data in files. A
24780 separate stream file is created for each object in the package, and
24781 an access to an object causes the corresponding file to be read or
24782 written.
24784 @geindex SHARED_MEMORY_DIRECTORY environment variable
24786 The environment variable @cite{SHARED_MEMORY_DIRECTORY} should be
24787 set to the directory to be used for these files.
24788 The files in this directory
24789 have names that correspond to their fully qualified names. For
24790 example, if we have the package
24792 @example
24793 package X is
24794   pragma Shared_Passive (X);
24795   Y : Integer;
24796   Z : Float;
24797 end X;
24798 @end example
24800 and the environment variable is set to @cite{/stemp/}, then the files created
24801 will have the names:
24803 @example
24804 /stemp/x.y
24805 /stemp/x.z
24806 @end example
24808 These files are created when a value is initially written to the object, and
24809 the files are retained until manually deleted. This provides the persistence
24810 semantics. If no file exists, it means that no partition has assigned a value
24811 to the variable; in this case the initial value declared in the package
24812 will be used. This model ensures that there are no issues in synchronizing
24813 the elaboration process, since elaboration of passive packages elaborates the
24814 initial values, but does not create the files.
24816 The files are written using normal @cite{Stream_IO} access.
24817 If you want to be able
24818 to communicate between programs or partitions running on different
24819 architectures, then you should use the XDR versions of the stream attribute
24820 routines, since these are architecture independent.
24822 If active synchronization is required for access to the variables in the
24823 shared passive package, then as described in the Ada Reference Manual, the
24824 package may contain protected objects used for this purpose. In this case
24825 a lock file (whose name is @code{___lock} (three underscores)
24826 is created in the shared memory directory.
24828 @geindex ___lock file (for shared passive packages)
24830 This is used to provide the required locking
24831 semantics for proper protected object synchronization.
24833 GNAT supports shared passive packages on all platforms
24834 except for OpenVMS.
24836 @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
24837 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{3b5}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{3b6}
24838 @section Code Generation for Array Aggregates
24841 Aggregates have a rich syntax and allow the user to specify the values of
24842 complex data structures by means of a single construct.  As a result, the
24843 code generated for aggregates can be quite complex and involve loops, case
24844 statements and multiple assignments.  In the simplest cases, however, the
24845 compiler will recognize aggregates whose components and constraints are
24846 fully static, and in those cases the compiler will generate little or no
24847 executable code.  The following is an outline of the code that GNAT generates
24848 for various aggregate constructs.  For further details, you will find it
24849 useful to examine the output produced by the -gnatG flag to see the expanded
24850 source that is input to the code generator.  You may also want to examine
24851 the assembly code generated at various levels of optimization.
24853 The code generated for aggregates depends on the context, the component values,
24854 and the type.  In the context of an object declaration the code generated is
24855 generally simpler than in the case of an assignment.  As a general rule, static
24856 component values and static subtypes also lead to simpler code.
24858 @menu
24859 * Static constant aggregates with static bounds:: 
24860 * Constant aggregates with unconstrained nominal types:: 
24861 * Aggregates with static bounds:: 
24862 * Aggregates with non-static bounds:: 
24863 * Aggregates in assignment statements:: 
24865 @end menu
24867 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
24868 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{3b7}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{3b8}
24869 @subsection Static constant aggregates with static bounds
24872 For the declarations:
24874 @example
24875 type One_Dim is array (1..10) of integer;
24876 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
24877 @end example
24879 GNAT generates no executable code: the constant ar0 is placed in static memory.
24880 The same is true for constant aggregates with named associations:
24882 @example
24883 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
24884 Cr3 : constant One_Dim := (others => 7777);
24885 @end example
24887 The same is true for multidimensional constant arrays such as:
24889 @example
24890 type two_dim is array (1..3, 1..3) of integer;
24891 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
24892 @end example
24894 The same is true for arrays of one-dimensional arrays: the following are
24895 static:
24897 @example
24898 type ar1b  is array (1..3) of boolean;
24899 type ar_ar is array (1..3) of ar1b;
24900 None  : constant ar1b := (others => false);     --  fully static
24901 None2 : constant ar_ar := (1..3 => None);       --  fully static
24902 @end example
24904 However, for multidimensional aggregates with named associations, GNAT will
24905 generate assignments and loops, even if all associations are static.  The
24906 following two declarations generate a loop for the first dimension, and
24907 individual component assignments for the second dimension:
24909 @example
24910 Zero1: constant two_dim := (1..3 => (1..3 => 0));
24911 Zero2: constant two_dim := (others => (others => 0));
24912 @end example
24914 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
24915 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{3b9}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{3ba}
24916 @subsection Constant aggregates with unconstrained nominal types
24919 In such cases the aggregate itself establishes the subtype, so that
24920 associations with @cite{others} cannot be used.  GNAT determines the
24921 bounds for the actual subtype of the aggregate, and allocates the
24922 aggregate statically as well.  No code is generated for the following:
24924 @example
24925 type One_Unc is array (natural range <>) of integer;
24926 Cr_Unc : constant One_Unc := (12,24,36);
24927 @end example
24929 @node Aggregates with static bounds,Aggregates with non-static bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
24930 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{3bb}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{3bc}
24931 @subsection Aggregates with static bounds
24934 In all previous examples the aggregate was the initial (and immutable) value
24935 of a constant.  If the aggregate initializes a variable, then code is generated
24936 for it as a combination of individual assignments and loops over the target
24937 object.  The declarations
24939 @example
24940 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
24941 Cr_Var2 : One_Dim := (others > -1);
24942 @end example
24944 generate the equivalent of
24946 @example
24947 Cr_Var1 (1) := 2;
24948 Cr_Var1 (2) := 3;
24949 Cr_Var1 (3) := 5;
24950 Cr_Var1 (4) := 11;
24952 for I in Cr_Var2'range loop
24953    Cr_Var2 (I) := -1;
24954 end loop;
24955 @end example
24957 @node Aggregates with non-static bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
24958 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-non-static-bounds}@anchor{3bd}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{3be}
24959 @subsection Aggregates with non-static bounds
24962 If the bounds of the aggregate are not statically compatible with the bounds
24963 of the nominal subtype  of the target, then constraint checks have to be
24964 generated on the bounds.  For a multidimensional array, constraint checks may
24965 have to be applied to sub-arrays individually, if they do not have statically
24966 compatible subtypes.
24968 @node Aggregates in assignment statements,,Aggregates with non-static bounds,Code Generation for Array Aggregates
24969 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{3bf}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{3c0}
24970 @subsection Aggregates in assignment statements
24973 In general, aggregate assignment requires the construction of a temporary,
24974 and a copy from the temporary to the target of the assignment.  This is because
24975 it is not always possible to convert the assignment into a series of individual
24976 component assignments.  For example, consider the simple case:
24978 @example
24979 A := (A(2), A(1));
24980 @end example
24982 This cannot be converted into:
24984 @example
24985 A(1) := A(2);
24986 A(2) := A(1);
24987 @end example
24989 So the aggregate has to be built first in a separate location, and then
24990 copied into the target.  GNAT recognizes simple cases where this intermediate
24991 step is not required, and the assignments can be performed in place, directly
24992 into the target.  The following sufficient criteria are applied:
24995 @itemize *
24997 @item 
24998 The bounds of the aggregate are static, and the associations are static.
25000 @item 
25001 The components of the aggregate are static constants, names of
25002 simple variables that are not renamings, or expressions not involving
25003 indexed components whose operands obey these rules.
25004 @end itemize
25006 If any of these conditions are violated, the aggregate will be built in
25007 a temporary (created either by the front-end or the code generator) and then
25008 that temporary will be copied onto the target.
25010 @node The Size of Discriminated Records with Default Discriminants,Strict Conformance to the Ada Reference Manual,Code Generation for Array Aggregates,Implementation of Specific Ada Features
25011 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{3c1}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{3c2}
25012 @section The Size of Discriminated Records with Default Discriminants
25015 If a discriminated type @cite{T} has discriminants with default values, it is
25016 possible to declare an object of this type without providing an explicit
25017 constraint:
25019 @example
25020 type Size is range 1..100;
25022 type Rec (D : Size := 15) is record
25023    Name : String (1..D);
25024 end T;
25026 Word : Rec;
25027 @end example
25029 Such an object is said to be @emph{unconstrained}.
25030 The discriminant of the object
25031 can be modified by a full assignment to the object, as long as it preserves the
25032 relation between the value of the discriminant, and the value of the components
25033 that depend on it:
25035 @example
25036 Word := (3, "yes");
25038 Word := (5, "maybe");
25040 Word := (5, "no"); -- raises Constraint_Error
25041 @end example
25043 In order to support this behavior efficiently, an unconstrained object is
25044 given the maximum size that any value of the type requires. In the case
25045 above, @cite{Word} has storage for the discriminant and for
25046 a @cite{String} of length 100.
25047 It is important to note that unconstrained objects do not require dynamic
25048 allocation. It would be an improper implementation to place on the heap those
25049 components whose size depends on discriminants. (This improper implementation
25050 was used by some Ada83 compilers, where the @cite{Name} component above
25051 would have
25052 been stored as a pointer to a dynamic string). Following the principle that
25053 dynamic storage management should never be introduced implicitly,
25054 an Ada compiler should reserve the full size for an unconstrained declared
25055 object, and place it on the stack.
25057 This maximum size approach
25058 has been a source of surprise to some users, who expect the default
25059 values of the discriminants to determine the size reserved for an
25060 unconstrained object: "If the default is 15, why should the object occupy
25061 a larger size?"
25062 The answer, of course, is that the discriminant may be later modified,
25063 and its full range of values must be taken into account. This is why the
25064 declaration:
25066 @example
25067 type Rec (D : Positive := 15) is record
25068    Name : String (1..D);
25069 end record;
25071 Too_Large : Rec;
25072 @end example
25074 is flagged by the compiler with a warning:
25075 an attempt to create @cite{Too_Large} will raise @cite{Storage_Error},
25076 because the required size includes @cite{Positive'Last}
25077 bytes. As the first example indicates, the proper approach is to declare an
25078 index type of 'reasonable' range so that unconstrained objects are not too
25079 large.
25081 One final wrinkle: if the object is declared to be @cite{aliased}, or if it is
25082 created in the heap by means of an allocator, then it is @emph{not}
25083 unconstrained:
25084 it is constrained by the default values of the discriminants, and those values
25085 cannot be modified by full assignment. This is because in the presence of
25086 aliasing all views of the object (which may be manipulated by different tasks,
25087 say) must be consistent, so it is imperative that the object, once created,
25088 remain invariant.
25090 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
25091 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{3c3}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{3c4}
25092 @section Strict Conformance to the Ada Reference Manual
25095 The dynamic semantics defined by the Ada Reference Manual impose a set of
25096 run-time checks to be generated. By default, the GNAT compiler will insert many
25097 run-time checks into the compiled code, including most of those required by the
25098 Ada Reference Manual. However, there are three checks that are not enabled
25099 in the default mode for efficiency reasons: arithmetic overflow checking for
25100 integer operations (including division by zero), checks for access before
25101 elaboration on subprogram calls, and stack overflow checking (most operating
25102 systems do not perform this check by default).
25104 Strict conformance to the Ada Reference Manual can be achieved by adding
25105 three compiler options for overflow checking for integer operations
25106 (@emph{-gnato}), dynamic checks for access-before-elaboration on subprogram
25107 calls and generic instantiations (@emph{-gnatE}), and stack overflow
25108 checking (@emph{-fstack-check}).
25110 Note that the result of a floating point arithmetic operation in overflow and
25111 invalid situations, when the @cite{Machine_Overflows} attribute of the result
25112 type is @cite{False}, is to generate IEEE NaN and infinite values. This is the
25113 case for machines compliant with the IEEE floating-point standard, but on
25114 machines that are not fully compliant with this standard, such as Alpha, the
25115 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
25116 behavior (although at the cost of a significant performance penalty), so
25117 infinite and NaN values are properly generated.
25119 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
25120 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{3c5}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{3c6}
25121 @chapter Implementation of Ada 2012 Features
25124 @geindex Ada 2012 implementation status
25126 @geindex -gnat12 option (gcc)
25128 @geindex pragma Ada_2012
25130 @geindex configuration pragma Ada_2012
25132 @geindex Ada_2012 configuration pragma
25134 This chapter contains a complete list of Ada 2012 features that have been
25135 implemented as of GNAT version 6.4. Generally, these features are only
25136 available if the @emph{-gnat12} (Ada 2012 features enabled) flag is set
25137 or if the configuration pragma @cite{Ada_2012} is used.
25139 However, new pragmas, attributes, and restrictions are
25140 unconditionally available, since the Ada 95 standard allows the addition of
25141 new pragmas, attributes, and restrictions (there are exceptions, which are
25142 documented in the individual descriptions), and also certain packages
25143 were made available in earlier versions of Ada.
25145 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
25146 This date shows the implementation date of the feature. Any wavefront
25147 subsequent to this date will contain the indicated feature, as will any
25148 subsequent releases. A date of 0000-00-00 means that GNAT has always
25149 implemented the feature, or implemented it as soon as it appeared as a
25150 binding interpretation.
25152 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
25153 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
25154 The features are ordered based on the relevant sections of the Ada
25155 Reference Manual ("RM").  When a given AI relates to multiple points
25156 in the RM, the earliest is used.
25158 A complete description of the AIs may be found in
25159 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
25161 @geindex AI-0176 (Ada 2012 feature)
25164 @itemize *
25166 @item 
25167 @emph{AI-0176 Quantified expressions (2010-09-29)}
25169 Both universally and existentially quantified expressions are implemented.
25170 They use the new syntax for iterators proposed in AI05-139-2, as well as
25171 the standard Ada loop syntax.
25173 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
25174 @end itemize
25176 @geindex AI-0079 (Ada 2012 feature)
25179 @itemize *
25181 @item 
25182 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
25184 Wide characters in the unicode category @emph{other_format} are now allowed in
25185 source programs between tokens, but not within a token such as an identifier.
25187 RM References:  2.01 (4/2)   2.02 (7)
25188 @end itemize
25190 @geindex AI-0091 (Ada 2012 feature)
25193 @itemize *
25195 @item 
25196 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
25198 Wide characters in the unicode category @emph{other_format} are not permitted
25199 within  an identifier, since this can be a security problem. The error
25200 message for this case has been improved to be more specific, but GNAT has
25201 never allowed such characters to appear in identifiers.
25203 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)
25204 @end itemize
25206 @geindex AI-0100 (Ada 2012 feature)
25209 @itemize *
25211 @item 
25212 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
25214 This AI is an earlier version of AI-163. It simplifies the rules
25215 for legal placement of pragmas. In the case of lists that allow pragmas, if
25216 the list may have no elements, then the list may consist solely of pragmas.
25218 RM References:  2.08 (7)
25219 @end itemize
25221 @geindex AI-0163 (Ada 2012 feature)
25224 @itemize *
25226 @item 
25227 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
25229 A statement sequence may be composed entirely of pragmas. It is no longer
25230 necessary to add a dummy @cite{null} statement to make the sequence legal.
25232 RM References:  2.08 (7)   2.08 (16)
25233 @end itemize
25235 @geindex AI-0080 (Ada 2012 feature)
25238 @itemize *
25240 @item 
25241 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
25243 This is an editorial change only, described as non-testable in the AI.
25245 RM References:  3.01 (7)
25246 @end itemize
25248 @geindex AI-0183 (Ada 2012 feature)
25251 @itemize *
25253 @item 
25254 @emph{AI-0183 Aspect specifications (2010-08-16)}
25256 Aspect specifications have been fully implemented except for pre and post-
25257 conditions, and type invariants, which have their own separate AI's. All
25258 forms of declarations listed in the AI are supported. The following is a
25259 list of the aspects supported (with GNAT implementation aspects marked)
25260 @end itemize
25263 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
25264 @headitem
25266 Supported Aspect
25268 @tab
25270 Source
25272 @item
25274 @cite{Ada_2005}
25276 @tab
25278 -- GNAT
25280 @item
25282 @cite{Ada_2012}
25284 @tab
25286 -- GNAT
25288 @item
25290 @cite{Address}
25292 @tab
25294 @item
25296 @cite{Alignment}
25298 @tab
25300 @item
25302 @cite{Atomic}
25304 @tab
25306 @item
25308 @cite{Atomic_Components}
25310 @tab
25312 @item
25314 @cite{Bit_Order}
25316 @tab
25318 @item
25320 @cite{Component_Size}
25322 @tab
25324 @item
25326 @cite{Contract_Cases}
25328 @tab
25330 -- GNAT
25332 @item
25334 @cite{Discard_Names}
25336 @tab
25338 @item
25340 @cite{External_Tag}
25342 @tab
25344 @item
25346 @cite{Favor_Top_Level}
25348 @tab
25350 -- GNAT
25352 @item
25354 @cite{Inline}
25356 @tab
25358 @item
25360 @cite{Inline_Always}
25362 @tab
25364 -- GNAT
25366 @item
25368 @cite{Invariant}
25370 @tab
25372 -- GNAT
25374 @item
25376 @cite{Machine_Radix}
25378 @tab
25380 @item
25382 @cite{No_Return}
25384 @tab
25386 @item
25388 @cite{Object_Size}
25390 @tab
25392 -- GNAT
25394 @item
25396 @cite{Pack}
25398 @tab
25400 @item
25402 @cite{Persistent_BSS}
25404 @tab
25406 -- GNAT
25408 @item
25410 @cite{Post}
25412 @tab
25414 @item
25416 @cite{Pre}
25418 @tab
25420 @item
25422 @cite{Predicate}
25424 @tab
25426 @item
25428 @cite{Preelaborable_Initialization}
25430 @tab
25432 @item
25434 @cite{Pure_Function}
25436 @tab
25438 -- GNAT
25440 @item
25442 @cite{Remote_Access_Type}
25444 @tab
25446 -- GNAT
25448 @item
25450 @cite{Shared}
25452 @tab
25454 -- GNAT
25456 @item
25458 @cite{Size}
25460 @tab
25462 @item
25464 @cite{Storage_Pool}
25466 @tab
25468 @item
25470 @cite{Storage_Size}
25472 @tab
25474 @item
25476 @cite{Stream_Size}
25478 @tab
25480 @item
25482 @cite{Suppress}
25484 @tab
25486 @item
25488 @cite{Suppress_Debug_Info}
25490 @tab
25492 -- GNAT
25494 @item
25496 @cite{Test_Case}
25498 @tab
25500 -- GNAT
25502 @item
25504 @cite{Thread_Local_Storage}
25506 @tab
25508 -- GNAT
25510 @item
25512 @cite{Type_Invariant}
25514 @tab
25516 @item
25518 @cite{Unchecked_Union}
25520 @tab
25522 @item
25524 @cite{Universal_Aliasing}
25526 @tab
25528 -- GNAT
25530 @item
25532 @cite{Unmodified}
25534 @tab
25536 -- GNAT
25538 @item
25540 @cite{Unreferenced}
25542 @tab
25544 -- GNAT
25546 @item
25548 @cite{Unreferenced_Objects}
25550 @tab
25552 -- GNAT
25554 @item
25556 @cite{Unsuppress}
25558 @tab
25560 @item
25562 @cite{Value_Size}
25564 @tab
25566 -- GNAT
25568 @item
25570 @cite{Volatile}
25572 @tab
25574 @item
25576 @cite{Volatile_Components}
25578 @tab
25580 @item
25582 @cite{Warnings}
25584 @tab
25586 -- GNAT
25588 @end multitable
25591 @quotation
25593 Note that for aspects with an expression, e.g. @cite{Size}, the expression is
25594 treated like a default expression (visibility is analyzed at the point of
25595 occurrence of the aspect, but evaluation of the expression occurs at the
25596 freeze point of the entity involved).
25598 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
25599 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
25600 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
25601 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
25602 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
25603 13.03.01 (0)
25604 @end quotation
25606 @geindex AI-0128 (Ada 2012 feature)
25609 @itemize *
25611 @item 
25612 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
25614 If an equality operator ("=") is declared for a type, then the implicitly
25615 declared inequality operator ("/=") is a primitive operation of the type.
25616 This is the only reasonable interpretation, and is the one always implemented
25617 by GNAT, but the RM was not entirely clear in making this point.
25619 RM References:  3.02.03 (6)   6.06 (6)
25620 @end itemize
25622 @geindex AI-0003 (Ada 2012 feature)
25625 @itemize *
25627 @item 
25628 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
25630 In Ada 2012, a qualified expression is considered to be syntactically a name,
25631 meaning that constructs such as @cite{A'(F(X)).B} are now legal. This is
25632 useful in disambiguating some cases of overloading.
25634 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
25635 5.04 (7)
25636 @end itemize
25638 @geindex AI-0120 (Ada 2012 feature)
25641 @itemize *
25643 @item 
25644 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
25646 This is an RM editorial change only. The section that lists objects that are
25647 constant failed to include the current instance of a protected object
25648 within a protected function. This has always been treated as a constant
25649 in GNAT.
25651 RM References:  3.03 (21)
25652 @end itemize
25654 @geindex AI-0008 (Ada 2012 feature)
25657 @itemize *
25659 @item 
25660 @emph{AI-0008 General access to constrained objects (0000-00-00)}
25662 The wording in the RM implied that if you have a general access to a
25663 constrained object, it could be used to modify the discriminants. This was
25664 obviously not intended. @cite{Constraint_Error} should be raised, and GNAT
25665 has always done so in this situation.
25667 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
25668 @end itemize
25670 @geindex AI-0093 (Ada 2012 feature)
25673 @itemize *
25675 @item 
25676 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
25678 This is an editorial change only, to make more widespread use of the Ada 2012
25679 'immutably limited'.
25681 RM References:  3.03 (23.4/3)
25682 @end itemize
25684 @geindex AI-0096 (Ada 2012 feature)
25687 @itemize *
25689 @item 
25690 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
25692 In general it is illegal for a type derived from a formal limited type to be
25693 nonlimited.  This AI makes an exception to this rule: derivation is legal
25694 if it appears in the private part of the generic, and the formal type is not
25695 tagged. If the type is tagged, the legality check must be applied to the
25696 private part of the package.
25698 RM References:  3.04 (5.1/2)   6.02 (7)
25699 @end itemize
25701 @geindex AI-0181 (Ada 2012 feature)
25704 @itemize *
25706 @item 
25707 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
25709 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
25710 means that it has a special name (@cite{SOFT_HYPHEN}) in conjunction with the
25711 @cite{Image} and @cite{Value} attributes for the character types. Strictly
25712 speaking this is an inconsistency with Ada 95, but in practice the use of
25713 these attributes is so obscure that it will not cause problems.
25715 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
25716 @end itemize
25718 @geindex AI-0182 (Ada 2012 feature)
25721 @itemize *
25723 @item 
25724 @emph{AI-0182 Additional forms for `Character'Value} (0000-00-00)`
25726 This AI allows @cite{Character'Value} to accept the string @cite{'?'} where
25727 @cite{?} is any character including non-graphic control characters. GNAT has
25728 always accepted such strings. It also allows strings such as
25729 @cite{HEX_00000041} to be accepted, but GNAT does not take advantage of this
25730 permission and raises @cite{Constraint_Error}, as is certainly still
25731 permitted.
25733 RM References:  3.05 (56/2)
25734 @end itemize
25736 @geindex AI-0214 (Ada 2012 feature)
25739 @itemize *
25741 @item 
25742 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
25744 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
25745 to have default expressions by allowing them when the type is limited. It
25746 is often useful to define a default value for a discriminant even though
25747 it can't be changed by assignment.
25749 RM References:  3.07 (9.1/2)   3.07.02 (3)
25750 @end itemize
25752 @geindex AI-0102 (Ada 2012 feature)
25755 @itemize *
25757 @item 
25758 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
25760 It is illegal to assign an anonymous access constant to an anonymous access
25761 variable. The RM did not have a clear rule to prevent this, but GNAT has
25762 always generated an error for this usage.
25764 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
25765 @end itemize
25767 @geindex AI-0158 (Ada 2012 feature)
25770 @itemize *
25772 @item 
25773 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
25775 This AI extends the syntax of membership tests to simplify complex conditions
25776 that can be expressed as membership in a subset of values of any type. It
25777 introduces syntax for a list of expressions that may be used in loop contexts
25778 as well.
25780 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
25781 @end itemize
25783 @geindex AI-0173 (Ada 2012 feature)
25786 @itemize *
25788 @item 
25789 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
25791 The function @cite{Ada.Tags.Type_Is_Abstract} returns @cite{True} if invoked
25792 with the tag of an abstract type, and @cite{False} otherwise.
25794 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
25795 @end itemize
25797 @geindex AI-0076 (Ada 2012 feature)
25800 @itemize *
25802 @item 
25803 @emph{AI-0076 function with controlling result (0000-00-00)}
25805 This is an editorial change only. The RM defines calls with controlling
25806 results, but uses the term 'function with controlling result' without an
25807 explicit definition.
25809 RM References:  3.09.02 (2/2)
25810 @end itemize
25812 @geindex AI-0126 (Ada 2012 feature)
25815 @itemize *
25817 @item 
25818 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
25820 This AI clarifies dispatching rules, and simply confirms that dispatching
25821 executes the operation of the parent type when there is no explicitly or
25822 implicitly declared operation for the descendant type. This has always been
25823 the case in all versions of GNAT.
25825 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
25826 @end itemize
25828 @geindex AI-0097 (Ada 2012 feature)
25831 @itemize *
25833 @item 
25834 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
25836 The RM as written implied that in some cases it was possible to create an
25837 object of an abstract type, by having an abstract extension inherit a non-
25838 abstract constructor from its parent type. This mistake has been corrected
25839 in GNAT and in the RM, and this construct is now illegal.
25841 RM References:  3.09.03 (4/2)
25842 @end itemize
25844 @geindex AI-0203 (Ada 2012 feature)
25847 @itemize *
25849 @item 
25850 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
25852 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
25853 permitted such usage.
25855 RM References:  3.09.03 (8/3)
25856 @end itemize
25858 @geindex AI-0198 (Ada 2012 feature)
25861 @itemize *
25863 @item 
25864 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
25866 This AI resolves a conflict between two rules involving inherited abstract
25867 operations and predefined operators. If a derived numeric type inherits
25868 an abstract operator, it overrides the predefined one. This interpretation
25869 was always the one implemented in GNAT.
25871 RM References:  3.09.03 (4/3)
25872 @end itemize
25874 @geindex AI-0073 (Ada 2012 feature)
25877 @itemize *
25879 @item 
25880 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
25882 This AI covers a number of issues regarding returning abstract types. In
25883 particular generic functions cannot have abstract result types or access
25884 result types designated an abstract type. There are some other cases which
25885 are detailed in the AI. Note that this binding interpretation has not been
25886 retrofitted to operate before Ada 2012 mode, since it caused a significant
25887 number of regressions.
25889 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
25890 @end itemize
25892 @geindex AI-0070 (Ada 2012 feature)
25895 @itemize *
25897 @item 
25898 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
25900 This is an editorial change only, there are no testable consequences short of
25901 checking for the absence of generated code for an interface declaration.
25903 RM References:  3.09.04 (18/2)
25904 @end itemize
25906 @geindex AI-0208 (Ada 2012 feature)
25909 @itemize *
25911 @item 
25912 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
25914 The wording in the Ada 2005 RM concerning characteristics of incomplete views
25915 was incorrect and implied that some programs intended to be legal were now
25916 illegal. GNAT had never considered such programs illegal, so it has always
25917 implemented the intent of this AI.
25919 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
25920 @end itemize
25922 @geindex AI-0162 (Ada 2012 feature)
25925 @itemize *
25927 @item 
25928 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
25930 Incomplete types are made more useful by allowing them to be completed by
25931 private types and private extensions.
25933 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
25934 @end itemize
25936 @geindex AI-0098 (Ada 2012 feature)
25939 @itemize *
25941 @item 
25942 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
25944 An unintentional omission in the RM implied some inconsistent restrictions on
25945 the use of anonymous access to subprogram values. These restrictions were not
25946 intentional, and have never been enforced by GNAT.
25948 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
25949 @end itemize
25951 @geindex AI-0199 (Ada 2012 feature)
25954 @itemize *
25956 @item 
25957 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
25959 A choice list in a record aggregate can include several components of
25960 (distinct) anonymous access types as long as they have matching designated
25961 subtypes.
25963 RM References:  4.03.01 (16)
25964 @end itemize
25966 @geindex AI-0220 (Ada 2012 feature)
25969 @itemize *
25971 @item 
25972 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
25974 This AI addresses a wording problem in the RM that appears to permit some
25975 complex cases of aggregates with non-static discriminants. GNAT has always
25976 implemented the intended semantics.
25978 RM References:  4.03.01 (17)
25979 @end itemize
25981 @geindex AI-0147 (Ada 2012 feature)
25984 @itemize *
25986 @item 
25987 @emph{AI-0147 Conditional expressions (2009-03-29)}
25989 Conditional expressions are permitted. The form of such an expression is:
25991 @example
25992 (if expr then expr @{elsif expr then expr@} [else expr])
25993 @end example
25995 The parentheses can be omitted in contexts where parentheses are present
25996 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
25997 clause is omitted, @strong{else} @emph{True} is assumed;
25998 thus @code{(if A then B)} is a way to conveniently represent
25999 @emph{(A implies B)} in standard logic.
26001 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
26002 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
26003 @end itemize
26005 @geindex AI-0037 (Ada 2012 feature)
26008 @itemize *
26010 @item 
26011 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
26013 This AI confirms that an association of the form @cite{Indx => <>} in an
26014 array aggregate must raise @cite{Constraint_Error} if @cite{Indx}
26015 is out of range. The RM specified a range check on other associations, but
26016 not when the value of the association was defaulted. GNAT has always inserted
26017 a constraint check on the index value.
26019 RM References:  4.03.03 (29)
26020 @end itemize
26022 @geindex AI-0123 (Ada 2012 feature)
26025 @itemize *
26027 @item 
26028 @emph{AI-0123 Composability of equality (2010-04-13)}
26030 Equality of untagged record composes, so that the predefined equality for a
26031 composite type that includes a component of some untagged record type
26032 @cite{R} uses the equality operation of @cite{R} (which may be user-defined
26033 or predefined). This makes the behavior of untagged records identical to that
26034 of tagged types in this respect.
26036 This change is an incompatibility with previous versions of Ada, but it
26037 corrects a non-uniformity that was often a source of confusion. Analysis of
26038 a large number of industrial programs indicates that in those rare cases
26039 where a composite type had an untagged record component with a user-defined
26040 equality, either there was no use of the composite equality, or else the code
26041 expected the same composability as for tagged types, and thus had a bug that
26042 would be fixed by this change.
26044 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
26045 8.05.04 (8)
26046 @end itemize
26048 @geindex AI-0088 (Ada 2012 feature)
26051 @itemize *
26053 @item 
26054 @emph{AI-0088 The value of exponentiation (0000-00-00)}
26056 This AI clarifies the equivalence rule given for the dynamic semantics of
26057 exponentiation: the value of the operation can be obtained by repeated
26058 multiplication, but the operation can be implemented otherwise (for example
26059 using the familiar divide-by-two-and-square algorithm, even if this is less
26060 accurate), and does not imply repeated reads of a volatile base.
26062 RM References:  4.05.06 (11)
26063 @end itemize
26065 @geindex AI-0188 (Ada 2012 feature)
26068 @itemize *
26070 @item 
26071 @emph{AI-0188 Case expressions (2010-01-09)}
26073 Case expressions are permitted. This allows use of constructs such as:
26075 @example
26076 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
26077 @end example
26079 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
26080 @end itemize
26082 @geindex AI-0104 (Ada 2012 feature)
26085 @itemize *
26087 @item 
26088 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
26090 The assignment @code{Ptr := new not null Some_Ptr;} will raise
26091 @code{Constraint_Error} because the default value of the allocated object is
26092 @strong{null}. This useless construct is illegal in Ada 2012.
26094 RM References:  4.08 (2)
26095 @end itemize
26097 @geindex AI-0157 (Ada 2012 feature)
26100 @itemize *
26102 @item 
26103 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
26105 Allocation and Deallocation from an empty storage pool (i.e. allocation or
26106 deallocation of a pointer for which a static storage size clause of zero
26107 has been given) is now illegal and is detected as such. GNAT
26108 previously gave a warning but not an error.
26110 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
26111 @end itemize
26113 @geindex AI-0179 (Ada 2012 feature)
26116 @itemize *
26118 @item 
26119 @emph{AI-0179 Statement not required after label (2010-04-10)}
26121 It is not necessary to have a statement following a label, so a label
26122 can appear at the end of a statement sequence without the need for putting a
26123 null statement afterwards, but it is not allowable to have only labels and
26124 no real statements in a statement sequence.
26126 RM References:  5.01 (2)
26127 @end itemize
26129 @geindex AI-0139-2 (Ada 2012 feature)
26132 @itemize *
26134 @item 
26135 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
26137 The new syntax for iterating over arrays and containers is now implemented.
26138 Iteration over containers is for now limited to read-only iterators. Only
26139 default iterators are supported, with the syntax:  @cite{for Elem of C}.
26141 RM References:  5.05
26142 @end itemize
26144 @geindex AI-0134 (Ada 2012 feature)
26147 @itemize *
26149 @item 
26150 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
26152 For full conformance, the profiles of anonymous-access-to-subprogram
26153 parameters must match. GNAT has always enforced this rule.
26155 RM References:  6.03.01 (18)
26156 @end itemize
26158 @geindex AI-0207 (Ada 2012 feature)
26161 @itemize *
26163 @item 
26164 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
26166 This AI confirms that access_to_constant indication must match for mode
26167 conformance. This was implemented in GNAT when the qualifier was originally
26168 introduced in Ada 2005.
26170 RM References:  6.03.01 (16/2)
26171 @end itemize
26173 @geindex AI-0046 (Ada 2012 feature)
26176 @itemize *
26178 @item 
26179 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
26181 For full conformance, in the case of access parameters, the null exclusion
26182 must match (either both or neither must have @code{not null}).
26184 RM References:  6.03.02 (18)
26185 @end itemize
26187 @geindex AI-0118 (Ada 2012 feature)
26190 @itemize *
26192 @item 
26193 @emph{AI-0118 The association of parameter associations (0000-00-00)}
26195 This AI clarifies the rules for named associations in subprogram calls and
26196 generic instantiations. The rules have been in place since Ada 83.
26198 RM References:  6.04.01 (2)   12.03 (9)
26199 @end itemize
26201 @geindex AI-0196 (Ada 2012 feature)
26204 @itemize *
26206 @item 
26207 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
26209 Null exclusion checks are not made for @cite{**out**} parameters when
26210 evaluating the actual parameters. GNAT has never generated these checks.
26212 RM References:  6.04.01 (13)
26213 @end itemize
26215 @geindex AI-0015 (Ada 2012 feature)
26218 @itemize *
26220 @item 
26221 @emph{AI-0015 Constant return objects (0000-00-00)}
26223 The return object declared in an @emph{extended_return_statement} may be
26224 declared constant. This was always intended, and GNAT has always allowed it.
26226 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
26227 6.05 (5.7/2)
26228 @end itemize
26230 @geindex AI-0032 (Ada 2012 feature)
26233 @itemize *
26235 @item 
26236 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
26238 If a function returns a class-wide type, the object of an extended return
26239 statement can be declared with a specific type that is covered by the class-
26240 wide type. This has been implemented in GNAT since the introduction of
26241 extended returns. Note AI-0103 complements this AI by imposing matching
26242 rules for constrained return types.
26244 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
26245 6.05 (8/2)
26246 @end itemize
26248 @geindex AI-0103 (Ada 2012 feature)
26251 @itemize *
26253 @item 
26254 @emph{AI-0103 Static matching for extended return (2010-07-23)}
26256 If the return subtype of a function is an elementary type or a constrained
26257 type, the subtype indication in an extended return statement must match
26258 statically this return subtype.
26260 RM References:  6.05 (5.2/2)
26261 @end itemize
26263 @geindex AI-0058 (Ada 2012 feature)
26266 @itemize *
26268 @item 
26269 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
26271 The RM had some incorrect wording implying wrong treatment of abnormal
26272 completion in an extended return. GNAT has always implemented the intended
26273 correct semantics as described by this AI.
26275 RM References:  6.05 (22/2)
26276 @end itemize
26278 @geindex AI-0050 (Ada 2012 feature)
26281 @itemize *
26283 @item 
26284 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
26286 The implementation permissions for raising @cite{Constraint_Error} early on a function call
26287 when it was clear an exception would be raised were over-permissive and allowed
26288 mishandling of discriminants in some cases. GNAT did
26289 not take advantage of these incorrect permissions in any case.
26291 RM References:  6.05 (24/2)
26292 @end itemize
26294 @geindex AI-0125 (Ada 2012 feature)
26297 @itemize *
26299 @item 
26300 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
26302 In Ada 2012, the declaration of a primitive operation of a type extension
26303 or private extension can also override an inherited primitive that is not
26304 visible at the point of this declaration.
26306 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
26307 @end itemize
26309 @geindex AI-0062 (Ada 2012 feature)
26312 @itemize *
26314 @item 
26315 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
26317 A full constant may have a null exclusion even if its associated deferred
26318 constant does not. GNAT has always allowed this.
26320 RM References:  7.04 (6/2)   7.04 (7.1/2)
26321 @end itemize
26323 @geindex AI-0178 (Ada 2012 feature)
26326 @itemize *
26328 @item 
26329 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
26331 This AI clarifies the role of incomplete views and plugs an omission in the
26332 RM. GNAT always correctly restricted the use of incomplete views and types.
26334 RM References:  7.05 (3/2)   7.05 (6/2)
26335 @end itemize
26337 @geindex AI-0087 (Ada 2012 feature)
26340 @itemize *
26342 @item 
26343 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
26345 The actual for a formal nonlimited derived type cannot be limited. In
26346 particular, a formal derived type that extends a limited interface but which
26347 is not explicitly limited cannot be instantiated with a limited type.
26349 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
26350 @end itemize
26352 @geindex AI-0099 (Ada 2012 feature)
26355 @itemize *
26357 @item 
26358 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
26360 This AI clarifies that 'needs finalization' is part of dynamic semantics,
26361 and therefore depends on the run-time characteristics of an object (i.e. its
26362 tag) and not on its nominal type. As the AI indicates: "we do not expect
26363 this to affect any implementation'@w{'}.
26365 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
26366 @end itemize
26368 @geindex AI-0064 (Ada 2012 feature)
26371 @itemize *
26373 @item 
26374 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
26376 This is an editorial change only. The intended behavior is already checked
26377 by an existing ACATS test, which GNAT has always executed correctly.
26379 RM References:  7.06.01 (17.1/1)
26380 @end itemize
26382 @geindex AI-0026 (Ada 2012 feature)
26385 @itemize *
26387 @item 
26388 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
26390 Record representation clauses concerning Unchecked_Union types cannot mention
26391 the discriminant of the type. The type of a component declared in the variant
26392 part of an Unchecked_Union cannot be controlled, have controlled components,
26393 nor have protected or task parts. If an Unchecked_Union type is declared
26394 within the body of a generic unit or its descendants, then the type of a
26395 component declared in the variant part cannot be a formal private type or a
26396 formal private extension declared within the same generic unit.
26398 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
26399 @end itemize
26401 @geindex AI-0205 (Ada 2012 feature)
26404 @itemize *
26406 @item 
26407 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
26409 This AI corrects a simple omission in the RM. Return objects have always
26410 been visible within an extended return statement.
26412 RM References:  8.03 (17)
26413 @end itemize
26415 @geindex AI-0042 (Ada 2012 feature)
26418 @itemize *
26420 @item 
26421 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
26423 This AI fixes a wording gap in the RM. An operation of a synchronized
26424 interface can be implemented by a protected or task entry, but the abstract
26425 operation is not being overridden in the usual sense, and it must be stated
26426 separately that this implementation is legal. This has always been the case
26427 in GNAT.
26429 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
26430 @end itemize
26432 @geindex AI-0030 (Ada 2012 feature)
26435 @itemize *
26437 @item 
26438 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
26440 Requeue is permitted to a protected, synchronized or task interface primitive
26441 providing it is known that the overriding operation is an entry. Otherwise
26442 the requeue statement has the same effect as a procedure call. Use of pragma
26443 @cite{Implemented} provides a way to impose a static requirement on the
26444 overriding operation by adhering to one of the implementation kinds: entry,
26445 protected procedure or any of the above.
26447 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
26448 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
26449 @end itemize
26451 @geindex AI-0201 (Ada 2012 feature)
26454 @itemize *
26456 @item 
26457 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
26459 If an Atomic object has a pragma @cite{Pack} or a @cite{Component_Size}
26460 attribute, then individual components may not be addressable by independent
26461 tasks. However, if the representation clause has no effect (is confirming),
26462 then independence is not compromised. Furthermore, in GNAT, specification of
26463 other appropriately addressable component sizes (e.g. 16 for 8-bit
26464 characters) also preserves independence. GNAT now gives very clear warnings
26465 both for the declaration of such a type, and for any assignment to its components.
26467 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
26468 @end itemize
26470 @geindex AI-0009 (Ada 2012 feature)
26473 @itemize *
26475 @item 
26476 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
26478 This AI introduces the new pragmas @cite{Independent} and
26479 @cite{Independent_Components},
26480 which control guaranteeing independence of access to objects and components.
26481 The AI also requires independence not unaffected by confirming rep clauses.
26483 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
26484 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
26485 @end itemize
26487 @geindex AI-0072 (Ada 2012 feature)
26490 @itemize *
26492 @item 
26493 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
26495 This AI clarifies that task signalling for reading @cite{'Terminated} only
26496 occurs if the result is True. GNAT semantics has always been consistent with
26497 this notion of task signalling.
26499 RM References:  9.10 (6.1/1)
26500 @end itemize
26502 @geindex AI-0108 (Ada 2012 feature)
26505 @itemize *
26507 @item 
26508 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
26510 This AI confirms that an incomplete type from a limited view does not have
26511 discriminants. This has always been the case in GNAT.
26513 RM References:  10.01.01 (12.3/2)
26514 @end itemize
26516 @geindex AI-0129 (Ada 2012 feature)
26519 @itemize *
26521 @item 
26522 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
26524 This AI clarifies the description of limited views: a limited view of a
26525 package includes only one view of a type that has an incomplete declaration
26526 and a full declaration (there is no possible ambiguity in a client package).
26527 This AI also fixes an omission: a nested package in the private part has no
26528 limited view. GNAT always implemented this correctly.
26530 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
26531 @end itemize
26533 @geindex AI-0077 (Ada 2012 feature)
26536 @itemize *
26538 @item 
26539 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
26541 This AI clarifies that a declaration does not include a context clause,
26542 and confirms that it is illegal to have a context in which both a limited
26543 and a nonlimited view of a package are accessible. Such double visibility
26544 was always rejected by GNAT.
26546 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
26547 @end itemize
26549 @geindex AI-0122 (Ada 2012 feature)
26552 @itemize *
26554 @item 
26555 @emph{AI-0122 Private with and children of generics (0000-00-00)}
26557 This AI clarifies the visibility of private children of generic units within
26558 instantiations of a parent. GNAT has always handled this correctly.
26560 RM References:  10.01.02 (12/2)
26561 @end itemize
26563 @geindex AI-0040 (Ada 2012 feature)
26566 @itemize *
26568 @item 
26569 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
26571 This AI confirms that a limited with clause in a child unit cannot name
26572 an ancestor of the unit. This has always been checked in GNAT.
26574 RM References:  10.01.02 (20/2)
26575 @end itemize
26577 @geindex AI-0132 (Ada 2012 feature)
26580 @itemize *
26582 @item 
26583 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
26585 This AI fills a gap in the description of library unit pragmas. The pragma
26586 clearly must apply to a library unit, even if it does not carry the name
26587 of the enclosing unit. GNAT has always enforced the required check.
26589 RM References:  10.01.05 (7)
26590 @end itemize
26592 @geindex AI-0034 (Ada 2012 feature)
26595 @itemize *
26597 @item 
26598 @emph{AI-0034 Categorization of limited views (0000-00-00)}
26600 The RM makes certain limited with clauses illegal because of categorization
26601 considerations, when the corresponding normal with would be legal. This is
26602 not intended, and GNAT has always implemented the recommended behavior.
26604 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
26605 @end itemize
26607 @geindex AI-0035 (Ada 2012 feature)
26610 @itemize *
26612 @item 
26613 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
26615 This AI remedies some inconsistencies in the legality rules for Pure units.
26616 Derived access types are legal in a pure unit (on the assumption that the
26617 rule for a zero storage pool size has been enforced on the ancestor type).
26618 The rules are enforced in generic instances and in subunits. GNAT has always
26619 implemented the recommended behavior.
26621 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)
26622 @end itemize
26624 @geindex AI-0219 (Ada 2012 feature)
26627 @itemize *
26629 @item 
26630 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
26632 This AI refines the rules for the cases with limited parameters which do not
26633 allow the implementations to omit 'redundant'. GNAT now properly conforms
26634 to the requirements of this binding interpretation.
26636 RM References:  10.02.01 (18/2)
26637 @end itemize
26639 @geindex AI-0043 (Ada 2012 feature)
26642 @itemize *
26644 @item 
26645 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
26647 This AI covers various omissions in the RM regarding the raising of
26648 exceptions. GNAT has always implemented the intended semantics.
26650 RM References:  11.04.01 (10.1/2)   11 (2)
26651 @end itemize
26653 @geindex AI-0200 (Ada 2012 feature)
26656 @itemize *
26658 @item 
26659 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
26661 This AI plugs a gap in the RM which appeared to allow some obviously intended
26662 illegal instantiations. GNAT has never allowed these instantiations.
26664 RM References:  12.07 (16)
26665 @end itemize
26667 @geindex AI-0112 (Ada 2012 feature)
26670 @itemize *
26672 @item 
26673 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
26675 This AI concerns giving names to various representation aspects, but the
26676 practical effect is simply to make the use of duplicate
26677 @cite{Atomic[_Components]},
26678 @cite{Volatile[_Components]}, and
26679 @cite{Independent[_Components]} pragmas illegal, and GNAT
26680 now performs this required check.
26682 RM References:  13.01 (8)
26683 @end itemize
26685 @geindex AI-0106 (Ada 2012 feature)
26688 @itemize *
26690 @item 
26691 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
26693 The RM appeared to allow representation pragmas on generic formal parameters,
26694 but this was not intended, and GNAT has never permitted this usage.
26696 RM References:  13.01 (9.1/1)
26697 @end itemize
26699 @geindex AI-0012 (Ada 2012 feature)
26702 @itemize *
26704 @item 
26705 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
26707 It is now illegal to give an inappropriate component size or a pragma
26708 @cite{Pack} that attempts to change the component size in the case of atomic
26709 or aliased components. Previously GNAT ignored such an attempt with a
26710 warning.
26712 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
26713 @end itemize
26715 @geindex AI-0039 (Ada 2012 feature)
26718 @itemize *
26720 @item 
26721 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
26723 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
26724 for stream attributes, but these were never useful and are now illegal. GNAT
26725 has always regarded such expressions as illegal.
26727 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
26728 @end itemize
26730 @geindex AI-0095 (Ada 2012 feature)
26733 @itemize *
26735 @item 
26736 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
26738 The prefix of @cite{'Address} cannot statically denote a subprogram with
26739 convention @cite{Intrinsic}. The use of the @cite{Address} attribute raises
26740 @cite{Program_Error} if the prefix denotes a subprogram with convention
26741 @cite{Intrinsic}.
26743 RM References:  13.03 (11/1)
26744 @end itemize
26746 @geindex AI-0116 (Ada 2012 feature)
26749 @itemize *
26751 @item 
26752 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
26754 This AI requires that the alignment of a class-wide object be no greater
26755 than the alignment of any type in the class. GNAT has always followed this
26756 recommendation.
26758 RM References:  13.03 (29)   13.11 (16)
26759 @end itemize
26761 @geindex AI-0146 (Ada 2012 feature)
26764 @itemize *
26766 @item 
26767 @emph{AI-0146 Type invariants (2009-09-21)}
26769 Type invariants may be specified for private types using the aspect notation.
26770 Aspect @cite{Type_Invariant} may be specified for any private type,
26771 @cite{Type_Invariant'Class} can
26772 only be specified for tagged types, and is inherited by any descendent of the
26773 tagged types. The invariant is a boolean expression that is tested for being
26774 true in the following situations: conversions to the private type, object
26775 declarations for the private type that are default initialized, and
26776 [@strong{in}] @strong{out}
26777 parameters and returned result on return from any primitive operation for
26778 the type that is visible to a client.
26779 GNAT defines the synonyms @cite{Invariant} for @cite{Type_Invariant} and
26780 @cite{Invariant'Class} for @cite{Type_Invariant'Class}.
26782 RM References:  13.03.03 (00)
26783 @end itemize
26785 @geindex AI-0078 (Ada 2012 feature)
26788 @itemize *
26790 @item 
26791 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
26793 In Ada 2012, compilers are required to support unchecked conversion where the
26794 target alignment is a multiple of the source alignment. GNAT always supported
26795 this case (and indeed all cases of differing alignments, doing copies where
26796 required if the alignment was reduced).
26798 RM References:  13.09 (7)
26799 @end itemize
26801 @geindex AI-0195 (Ada 2012 feature)
26804 @itemize *
26806 @item 
26807 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
26809 The handling of invalid values is now designated to be implementation
26810 defined. This is a documentation change only, requiring Annex M in the GNAT
26811 Reference Manual to document this handling.
26812 In GNAT, checks for invalid values are made
26813 only when necessary to avoid erroneous behavior. Operations like assignments
26814 which cannot cause erroneous behavior ignore the possibility of invalid
26815 values and do not do a check. The date given above applies only to the
26816 documentation change, this behavior has always been implemented by GNAT.
26818 RM References:  13.09.01 (10)
26819 @end itemize
26821 @geindex AI-0193 (Ada 2012 feature)
26824 @itemize *
26826 @item 
26827 @emph{AI-0193 Alignment of allocators (2010-09-16)}
26829 This AI introduces a new attribute @cite{Max_Alignment_For_Allocation},
26830 analogous to @cite{Max_Size_In_Storage_Elements}, but for alignment instead
26831 of size.
26833 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
26834 13.11.01 (2)   13.11.01 (3)
26835 @end itemize
26837 @geindex AI-0177 (Ada 2012 feature)
26840 @itemize *
26842 @item 
26843 @emph{AI-0177 Parameterized expressions (2010-07-10)}
26845 The new Ada 2012 notion of parameterized expressions is implemented. The form
26848 @example
26849 function-specification is (expression)
26850 @end example
26852 This is exactly equivalent to the
26853 corresponding function body that returns the expression, but it can appear
26854 in a package spec. Note that the expression must be parenthesized.
26856 RM References:  13.11.01 (3/2)
26857 @end itemize
26859 @geindex AI-0033 (Ada 2012 feature)
26862 @itemize *
26864 @item 
26865 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
26867 Neither of these two pragmas may appear within a generic template, because
26868 the generic might be instantiated at other than the library level.
26870 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
26871 @end itemize
26873 @geindex AI-0161 (Ada 2012 feature)
26876 @itemize *
26878 @item 
26879 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
26881 A new restriction @cite{No_Default_Stream_Attributes} prevents the use of any
26882 of the default stream attributes for elementary types. If this restriction is
26883 in force, then it is necessary to provide explicit subprograms for any
26884 stream attributes used.
26886 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
26887 @end itemize
26889 @geindex AI-0194 (Ada 2012 feature)
26892 @itemize *
26894 @item 
26895 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
26897 The @cite{Stream_Size} attribute returns the default number of bits in the
26898 stream representation of the given type.
26899 This value is not affected by the presence
26900 of stream subprogram attributes for the type. GNAT has always implemented
26901 this interpretation.
26903 RM References:  13.13.02 (1.2/2)
26904 @end itemize
26906 @geindex AI-0109 (Ada 2012 feature)
26909 @itemize *
26911 @item 
26912 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
26914 This AI is an editorial change only. It removes the need for a tag check
26915 that can never fail.
26917 RM References:  13.13.02 (34/2)
26918 @end itemize
26920 @geindex AI-0007 (Ada 2012 feature)
26923 @itemize *
26925 @item 
26926 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
26928 The RM as written appeared to limit the possibilities of declaring read
26929 attribute procedures for private scalar types. This limitation was not
26930 intended, and has never been enforced by GNAT.
26932 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
26933 @end itemize
26935 @geindex AI-0065 (Ada 2012 feature)
26938 @itemize *
26940 @item 
26941 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
26943 This AI clarifies the fact that all remote access types support external
26944 streaming. This fixes an obvious oversight in the definition of the
26945 language, and GNAT always implemented the intended correct rules.
26947 RM References:  13.13.02 (52/2)
26948 @end itemize
26950 @geindex AI-0019 (Ada 2012 feature)
26953 @itemize *
26955 @item 
26956 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
26958 The RM suggests that primitive subprograms of a specific tagged type are
26959 frozen when the tagged type is frozen. This would be an incompatible change
26960 and is not intended. GNAT has never attempted this kind of freezing and its
26961 behavior is consistent with the recommendation of this AI.
26963 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)
26964 @end itemize
26966 @geindex AI-0017 (Ada 2012 feature)
26969 @itemize *
26971 @item 
26972 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
26974 So-called 'Taft-amendment types' (i.e., types that are completed in package
26975 bodies) are not frozen by the occurrence of bodies in the
26976 enclosing declarative part. GNAT always implemented this properly.
26978 RM References:  13.14 (3/1)
26979 @end itemize
26981 @geindex AI-0060 (Ada 2012 feature)
26984 @itemize *
26986 @item 
26987 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
26989 This AI extends the definition of remote access types to include access
26990 to limited, synchronized, protected or task class-wide interface types.
26991 GNAT already implemented this extension.
26993 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
26994 @end itemize
26996 @geindex AI-0114 (Ada 2012 feature)
26999 @itemize *
27001 @item 
27002 @emph{AI-0114 Classification of letters (0000-00-00)}
27004 The code points 170 (@cite{FEMININE ORDINAL INDICATOR}),
27005 181 (@cite{MICRO SIGN}), and
27006 186 (@cite{MASCULINE ORDINAL INDICATOR}) are technically considered
27007 lower case letters by Unicode.
27008 However, they are not allowed in identifiers, and they
27009 return @cite{False} to @cite{Ada.Characters.Handling.Is_Letter/Is_Lower}.
27010 This behavior is consistent with that defined in Ada 95.
27012 RM References:  A.03.02 (59)   A.04.06 (7)
27013 @end itemize
27015 @geindex AI-0185 (Ada 2012 feature)
27018 @itemize *
27020 @item 
27021 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
27023 Two new packages @cite{Ada.Wide_[Wide_]Characters.Handling} provide
27024 classification functions for @cite{Wide_Character} and
27025 @cite{Wide_Wide_Character}, as well as providing
27026 case folding routines for @cite{Wide_[Wide_]Character} and
27027 @cite{Wide_[Wide_]String}.
27029 RM References:  A.03.05 (0)   A.03.06 (0)
27030 @end itemize
27032 @geindex AI-0031 (Ada 2012 feature)
27035 @itemize *
27037 @item 
27038 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
27040 A new version of @cite{Find_Token} is added to all relevant string packages,
27041 with an extra parameter @cite{From}. Instead of starting at the first
27042 character of the string, the search for a matching Token starts at the
27043 character indexed by the value of @cite{From}.
27044 These procedures are available in all versions of Ada
27045 but if used in versions earlier than Ada 2012 they will generate a warning
27046 that an Ada 2012 subprogram is being used.
27048 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
27049 A.04.05 (46)
27050 @end itemize
27052 @geindex AI-0056 (Ada 2012 feature)
27055 @itemize *
27057 @item 
27058 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
27060 The wording in the Ada 2005 RM implied an incompatible handling of the
27061 @cite{Index} functions, resulting in raising an exception instead of
27062 returning zero in some situations.
27063 This was not intended and has been corrected.
27064 GNAT always returned zero, and is thus consistent with this AI.
27066 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
27067 @end itemize
27069 @geindex AI-0137 (Ada 2012 feature)
27072 @itemize *
27074 @item 
27075 @emph{AI-0137 String encoding package (2010-03-25)}
27077 The packages @cite{Ada.Strings.UTF_Encoding}, together with its child
27078 packages, @cite{Conversions}, @cite{Strings}, @cite{Wide_Strings},
27079 and @cite{Wide_Wide_Strings} have been
27080 implemented. These packages (whose documentation can be found in the spec
27081 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
27082 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
27083 @cite{String}, @cite{Wide_String}, and @cite{Wide_Wide_String}
27084 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
27085 UTF-16), as well as conversions between the different UTF encodings. With
27086 the exception of @cite{Wide_Wide_Strings}, these packages are available in
27087 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
27088 The @cite{Wide_Wide_Strings package}
27089 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
27090 mode since it uses @cite{Wide_Wide_Character}).
27092 RM References:  A.04.11
27093 @end itemize
27095 @geindex AI-0038 (Ada 2012 feature)
27098 @itemize *
27100 @item 
27101 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
27103 These are minor errors in the description on three points. The intent on
27104 all these points has always been clear, and GNAT has always implemented the
27105 correct intended semantics.
27107 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)
27108 @end itemize
27110 @geindex AI-0044 (Ada 2012 feature)
27113 @itemize *
27115 @item 
27116 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
27118 This AI places restrictions on allowed instantiations of generic containers.
27119 These restrictions are not checked by the compiler, so there is nothing to
27120 change in the implementation. This affects only the RM documentation.
27122 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)
27123 @end itemize
27125 @geindex AI-0127 (Ada 2012 feature)
27128 @itemize *
27130 @item 
27131 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
27133 This package provides an interface for identifying the current locale.
27135 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
27136 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
27137 @end itemize
27139 @geindex AI-0002 (Ada 2012 feature)
27142 @itemize *
27144 @item 
27145 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
27147 The compiler is not required to support exporting an Ada subprogram with
27148 convention C if there are parameters or a return type of an unconstrained
27149 array type (such as @cite{String}). GNAT allows such declarations but
27150 generates warnings. It is possible, but complicated, to write the
27151 corresponding C code and certainly such code would be specific to GNAT and
27152 non-portable.
27154 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
27155 @end itemize
27157 @geindex AI05-0216 (Ada 2012 feature)
27160 @itemize *
27162 @item 
27163 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
27165 It is clearly the intention that @cite{No_Task_Hierarchy} is intended to
27166 forbid tasks declared locally within subprograms, or functions returning task
27167 objects, and that is the implementation that GNAT has always provided.
27168 However the language in the RM was not sufficiently clear on this point.
27169 Thus this is a documentation change in the RM only.
27171 RM References:  D.07 (3/3)
27172 @end itemize
27174 @geindex AI-0211 (Ada 2012 feature)
27177 @itemize *
27179 @item 
27180 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
27182 The restriction @cite{No_Relative_Delays} forbids any calls to the subprogram
27183 @cite{Ada.Real_Time.Timing_Events.Set_Handler}.
27185 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
27186 @end itemize
27188 @geindex AI-0190 (Ada 2012 feature)
27191 @itemize *
27193 @item 
27194 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
27196 This AI introduces a new pragma @cite{Default_Storage_Pool}, which can be
27197 used to control storage pools globally.
27198 In particular, you can force every access
27199 type that is used for allocation (@strong{new}) to have an explicit storage pool,
27200 or you can declare a pool globally to be used for all access types that lack
27201 an explicit one.
27203 RM References:  D.07 (8)
27204 @end itemize
27206 @geindex AI-0189 (Ada 2012 feature)
27209 @itemize *
27211 @item 
27212 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
27214 This AI introduces a new restriction @cite{No_Allocators_After_Elaboration},
27215 which says that no dynamic allocation will occur once elaboration is
27216 completed.
27217 In general this requires a run-time check, which is not required, and which
27218 GNAT does not attempt. But the static cases of allocators in a task body or
27219 in the body of the main program are detected and flagged at compile or bind
27220 time.
27222 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
27223 @end itemize
27225 @geindex AI-0171 (Ada 2012 feature)
27228 @itemize *
27230 @item 
27231 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
27233 A new package @cite{System.Multiprocessors} is added, together with the
27234 definition of pragma @cite{CPU} for controlling task affinity. A new no
27235 dependence restriction, on @cite{System.Multiprocessors.Dispatching_Domains},
27236 is added to the Ravenscar profile.
27238 RM References:  D.13.01 (4/2)   D.16
27239 @end itemize
27241 @geindex AI-0210 (Ada 2012 feature)
27244 @itemize *
27246 @item 
27247 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
27249 This is a documentation only issue regarding wording of metric requirements,
27250 that does not affect the implementation of the compiler.
27252 RM References:  D.15 (24/2)
27253 @end itemize
27255 @geindex AI-0206 (Ada 2012 feature)
27258 @itemize *
27260 @item 
27261 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
27263 Remote types packages are now allowed to depend on preelaborated packages.
27264 This was formerly considered illegal.
27266 RM References:  E.02.02 (6)
27267 @end itemize
27269 @geindex AI-0152 (Ada 2012 feature)
27272 @itemize *
27274 @item 
27275 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
27277 Restriction @cite{No_Anonymous_Allocators} prevents the use of allocators
27278 where the type of the returned value is an anonymous access type.
27280 RM References:  H.04 (8/1)
27281 @end itemize
27283 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
27284 @anchor{gnat_rm/obsolescent_features id1}@anchor{3c7}@anchor{gnat_rm/obsolescent_features doc}@anchor{3c8}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
27285 @chapter Obsolescent Features
27288 This chapter describes features that are provided by GNAT, but are
27289 considered obsolescent since there are preferred ways of achieving
27290 the same effect. These features are provided solely for historical
27291 compatibility purposes.
27293 @menu
27294 * pragma No_Run_Time:: 
27295 * pragma Ravenscar:: 
27296 * pragma Restricted_Run_Time:: 
27297 * pragma Task_Info:: 
27298 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
27300 @end menu
27302 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
27303 @anchor{gnat_rm/obsolescent_features id2}@anchor{3c9}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{3ca}
27304 @section pragma No_Run_Time
27307 The pragma @cite{No_Run_Time} is used to achieve an affect similar
27308 to the use of the "Zero Foot Print" configurable run time, but without
27309 requiring a specially configured run time. The result of using this
27310 pragma, which must be used for all units in a partition, is to restrict
27311 the use of any language features requiring run-time support code. The
27312 preferred usage is to use an appropriately configured run-time that
27313 includes just those features that are to be made accessible.
27315 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
27316 @anchor{gnat_rm/obsolescent_features id3}@anchor{3cb}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{3cc}
27317 @section pragma Ravenscar
27320 The pragma @cite{Ravenscar} has exactly the same effect as pragma
27321 @cite{Profile (Ravenscar)}. The latter usage is preferred since it
27322 is part of the new Ada 2005 standard.
27324 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
27325 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{3cd}@anchor{gnat_rm/obsolescent_features id4}@anchor{3ce}
27326 @section pragma Restricted_Run_Time
27329 The pragma @cite{Restricted_Run_Time} has exactly the same effect as
27330 pragma @cite{Profile (Restricted)}. The latter usage is
27331 preferred since the Ada 2005 pragma @cite{Profile} is intended for
27332 this kind of implementation dependent addition.
27334 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
27335 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{3cf}@anchor{gnat_rm/obsolescent_features id5}@anchor{3d0}
27336 @section pragma Task_Info
27339 The functionality provided by pragma @cite{Task_Info} is now part of the
27340 Ada language. The @cite{CPU} aspect and the package
27341 @cite{System.Multiprocessors} offer a less system-dependent way to specify
27342 task affinity or to query the number of processsors.
27344 Syntax
27346 @example
27347 pragma Task_Info (EXPRESSION);
27348 @end example
27350 This pragma appears within a task definition (like pragma
27351 @cite{Priority}) and applies to the task in which it appears.  The
27352 argument must be of type @cite{System.Task_Info.Task_Info_Type}.
27353 The @cite{Task_Info} pragma provides system dependent control over
27354 aspects of tasking implementation, for example, the ability to map
27355 tasks to specific processors.  For details on the facilities available
27356 for the version of GNAT that you are using, see the documentation
27357 in the spec of package System.Task_Info in the runtime
27358 library.
27360 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
27361 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{3d1}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{3d2}
27362 @section package System.Task_Info (@code{s-tasinf.ads})
27365 This package provides target dependent functionality that is used
27366 to support the @cite{Task_Info} pragma. The predefined Ada package
27367 @cite{System.Multiprocessors} and the @cite{CPU} aspect now provide a
27368 standard replacement for GNAT's @cite{Task_Info} functionality.
27370 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
27371 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{3d3}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{3d4}
27372 @chapter Compatibility and Porting Guide
27375 This chapter presents some guidelines for developing portable Ada code,
27376 describes the compatibility issues that may arise between
27377 GNAT and other Ada compilation systems (including those for Ada 83),
27378 and shows how GNAT can expedite porting
27379 applications developed in other Ada environments.
27381 @menu
27382 * Writing Portable Fixed-Point Declarations:: 
27383 * Compatibility with Ada 83:: 
27384 * Compatibility between Ada 95 and Ada 2005:: 
27385 * Implementation-dependent characteristics:: 
27386 * Compatibility with Other Ada Systems:: 
27387 * Representation Clauses:: 
27388 * Compatibility with HP Ada 83:: 
27390 @end menu
27392 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
27393 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{3d5}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{3d6}
27394 @section Writing Portable Fixed-Point Declarations
27397 The Ada Reference Manual gives an implementation freedom to choose bounds
27398 that are narrower by @cite{Small} from the given bounds.
27399 For example, if we write
27401 @example
27402 type F1 is delta 1.0 range -128.0 .. +128.0;
27403 @end example
27405 then the implementation is allowed to choose -128.0 .. +127.0 if it
27406 likes, but is not required to do so.
27408 This leads to possible portability problems, so let's have a closer
27409 look at this, and figure out how to avoid these problems.
27411 First, why does this freedom exist, and why would an implementation
27412 take advantage of it? To answer this, take a closer look at the type
27413 declaration for @cite{F1} above. If the compiler uses the given bounds,
27414 it would need 9 bits to hold the largest positive value (and typically
27415 that means 16 bits on all machines). But if the implementation chooses
27416 the +127.0 bound then it can fit values of the type in 8 bits.
27418 Why not make the user write +127.0 if that's what is wanted?
27419 The rationale is that if you are thinking of fixed point
27420 as a kind of 'poor man's floating-point', then you don't want
27421 to be thinking about the scaled integers that are used in its
27422 representation. Let's take another example:
27424 @example
27425 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
27426 @end example
27428 Looking at this declaration, it seems casually as though
27429 it should fit in 16 bits, but again that extra positive value
27430 +1.0 has the scaled integer equivalent of 2**15 which is one too
27431 big for signed 16 bits. The implementation can treat this as:
27433 @example
27434 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
27435 @end example
27437 and the Ada language design team felt that this was too annoying
27438 to require. We don't need to debate this decision at this point,
27439 since it is well established (the rule about narrowing the ranges
27440 dates to Ada 83).
27442 But the important point is that an implementation is not required
27443 to do this narrowing, so we have a potential portability problem.
27444 We could imagine three types of implementation:
27447 @enumerate a
27449 @item 
27450 those that narrow the range automatically if they can figure
27451 out that the narrower range will allow storage in a smaller machine unit,
27453 @item 
27454 those that will narrow only if forced to by a @cite{'Size} clause, and
27456 @item 
27457 those that will never narrow.
27458 @end enumerate
27460 Now if we are language theoreticians, we can imagine a fourth
27461 approach: to narrow all the time, e.g. to treat
27463 @example
27464 type F3 is delta 1.0 range -10.0 .. +23.0;
27465 @end example
27467 as though it had been written:
27469 @example
27470 type F3 is delta 1.0 range -9.0 .. +22.0;
27471 @end example
27473 But although technically allowed, such a behavior would be hostile and silly,
27474 and no real compiler would do this. All real compilers will fall into one of
27475 the categories (a), (b) or (c) above.
27477 So, how do you get the compiler to do what you want? The answer is give the
27478 actual bounds you want, and then use a @cite{'Small} clause and a
27479 @cite{'Size} clause to absolutely pin down what the compiler does.
27480 E.g., for @cite{F2} above, we will write:
27482 @example
27483 My_Small : constant := 2.0**(-15);
27484 My_First : constant := -1.0;
27485 My_Last  : constant := +1.0 - My_Small;
27487 type F2 is delta My_Small range My_First .. My_Last;
27488 @end example
27490 and then add
27492 @example
27493 for F2'Small use my_Small;
27494 for F2'Size  use 16;
27495 @end example
27497 In practice all compilers will do the same thing here and will give you
27498 what you want, so the above declarations are fully portable. If you really
27499 want to play language lawyer and guard against ludicrous behavior by the
27500 compiler you could add
27502 @example
27503 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
27504 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
27505 @end example
27507 One or other or both are allowed to be illegal if the compiler is
27508 behaving in a silly manner, but at least the silly compiler will not
27509 get away with silently messing with your (very clear) intentions.
27511 If you follow this scheme you will be guaranteed that your fixed-point
27512 types will be portable.
27514 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
27515 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{3d7}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{3d8}
27516 @section Compatibility with Ada 83
27519 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
27521 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
27522 are highly upwards compatible with Ada 83.  In
27523 particular, the design intention was that the difficulties associated
27524 with moving from Ada 83 to later versions of the standard should be no greater
27525 than those that occur when moving from one Ada 83 system to another.
27527 However, there are a number of points at which there are minor
27528 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
27529 full details of these issues as they relate to Ada 95,
27530 and should be consulted for a complete treatment.
27531 In practice the
27532 following subsections treat the most likely issues to be encountered.
27534 @menu
27535 * Legal Ada 83 programs that are illegal in Ada 95:: 
27536 * More deterministic semantics:: 
27537 * Changed semantics:: 
27538 * Other language compatibility issues:: 
27540 @end menu
27542 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
27543 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{3d9}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{3da}
27544 @subsection Legal Ada 83 programs that are illegal in Ada 95
27547 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
27548 Ada 95 and later versions of the standard:
27551 @itemize *
27553 @item 
27554 @emph{Character literals}
27556 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
27557 @cite{Wide_Character} as a new predefined character type, some uses of
27558 character literals that were legal in Ada 83 are illegal in Ada 95.
27559 For example:
27561 @example
27562 for Char in 'A' .. 'Z' loop ... end loop;
27563 @end example
27565 The problem is that 'A' and 'Z' could be from either
27566 @cite{Character} or @cite{Wide_Character}.  The simplest correction
27567 is to make the type explicit; e.g.:
27569 @example
27570 for Char in Character range 'A' .. 'Z' loop ... end loop;
27571 @end example
27573 @item 
27574 @emph{New reserved words}
27576 The identifiers @cite{abstract}, @cite{aliased}, @cite{protected},
27577 @cite{requeue}, @cite{tagged}, and @cite{until} are reserved in Ada 95.
27578 Existing Ada 83 code using any of these identifiers must be edited to
27579 use some alternative name.
27581 @item 
27582 @emph{Freezing rules}
27584 The rules in Ada 95 are slightly different with regard to the point at
27585 which entities are frozen, and representation pragmas and clauses are
27586 not permitted past the freeze point.  This shows up most typically in
27587 the form of an error message complaining that a representation item
27588 appears too late, and the appropriate corrective action is to move
27589 the item nearer to the declaration of the entity to which it refers.
27591 A particular case is that representation pragmas
27592 cannot be applied to a subprogram body.  If necessary, a separate subprogram
27593 declaration must be introduced to which the pragma can be applied.
27595 @item 
27596 @emph{Optional bodies for library packages}
27598 In Ada 83, a package that did not require a package body was nevertheless
27599 allowed to have one.  This lead to certain surprises in compiling large
27600 systems (situations in which the body could be unexpectedly ignored by the
27601 binder).  In Ada 95, if a package does not require a body then it is not
27602 permitted to have a body.  To fix this problem, simply remove a redundant
27603 body if it is empty, or, if it is non-empty, introduce a dummy declaration
27604 into the spec that makes the body required.  One approach is to add a private
27605 part to the package declaration (if necessary), and define a parameterless
27606 procedure called @cite{Requires_Body}, which must then be given a dummy
27607 procedure body in the package body, which then becomes required.
27608 Another approach (assuming that this does not introduce elaboration
27609 circularities) is to add an @cite{Elaborate_Body} pragma to the package spec,
27610 since one effect of this pragma is to require the presence of a package body.
27612 @item 
27613 @emph{Numeric_Error is the same exception as Constraint_Error}
27615 In Ada 95, the exception @cite{Numeric_Error} is a renaming of @cite{Constraint_Error}.
27616 This means that it is illegal to have separate exception handlers for
27617 the two exceptions.  The fix is simply to remove the handler for the
27618 @cite{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
27619 @cite{Constraint_Error} in place of @cite{Numeric_Error} in all cases).
27621 @item 
27622 @emph{Indefinite subtypes in generics}
27624 In Ada 83, it was permissible to pass an indefinite type (e.g, @cite{String})
27625 as the actual for a generic formal private type, but then the instantiation
27626 would be illegal if there were any instances of declarations of variables
27627 of this type in the generic body.  In Ada 95, to avoid this clear violation
27628 of the methodological principle known as the 'contract model',
27629 the generic declaration explicitly indicates whether
27630 or not such instantiations are permitted.  If a generic formal parameter
27631 has explicit unknown discriminants, indicated by using @cite{(<>)} after the
27632 subtype name, then it can be instantiated with indefinite types, but no
27633 stand-alone variables can be declared of this type.  Any attempt to declare
27634 such a variable will result in an illegality at the time the generic is
27635 declared.  If the @cite{(<>)} notation is not used, then it is illegal
27636 to instantiate the generic with an indefinite type.
27637 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
27638 It will show up as a compile time error, and
27639 the fix is usually simply to add the @cite{(<>)} to the generic declaration.
27640 @end itemize
27642 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
27643 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{3db}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{3dc}
27644 @subsection More deterministic semantics
27648 @itemize *
27650 @item 
27651 @emph{Conversions}
27653 Conversions from real types to integer types round away from 0.  In Ada 83
27654 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
27655 implementation freedom was intended to support unbiased rounding in
27656 statistical applications, but in practice it interfered with portability.
27657 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
27658 is required.  Numeric code may be affected by this change in semantics.
27659 Note, though, that this issue is no worse than already existed in Ada 83
27660 when porting code from one vendor to another.
27662 @item 
27663 @emph{Tasking}
27665 The Real-Time Annex introduces a set of policies that define the behavior of
27666 features that were implementation dependent in Ada 83, such as the order in
27667 which open select branches are executed.
27668 @end itemize
27670 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
27671 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{3dd}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{3de}
27672 @subsection Changed semantics
27675 The worst kind of incompatibility is one where a program that is legal in
27676 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
27677 possible in Ada 83.  Fortunately this is extremely rare, but the one
27678 situation that you should be alert to is the change in the predefined type
27679 @cite{Character} from 7-bit ASCII to 8-bit Latin-1.
27681 @quotation
27683 @geindex Latin-1
27684 @end quotation
27687 @itemize *
27689 @item 
27690 @emph{Range of type `Character`}
27692 The range of @cite{Standard.Character} is now the full 256 characters
27693 of Latin-1, whereas in most Ada 83 implementations it was restricted
27694 to 128 characters. Although some of the effects of
27695 this change will be manifest in compile-time rejection of legal
27696 Ada 83 programs it is possible for a working Ada 83 program to have
27697 a different effect in Ada 95, one that was not permitted in Ada 83.
27698 As an example, the expression
27699 @cite{Character'Pos(Character'Last)} returned @cite{127} in Ada 83 and now
27700 delivers @cite{255} as its value.
27701 In general, you should look at the logic of any
27702 character-processing Ada 83 program and see whether it needs to be adapted
27703 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
27704 character handling package that may be relevant if code needs to be adapted
27705 to account for the additional Latin-1 elements.
27706 The desirable fix is to
27707 modify the program to accommodate the full character set, but in some cases
27708 it may be convenient to define a subtype or derived type of Character that
27709 covers only the restricted range.
27710 @end itemize
27712 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
27713 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{3df}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{3e0}
27714 @subsection Other language compatibility issues
27718 @itemize *
27720 @item 
27721 @emph{-gnat83} switch
27723 All implementations of GNAT provide a switch that causes GNAT to operate
27724 in Ada 83 mode.  In this mode, some but not all compatibility problems
27725 of the type described above are handled automatically.  For example, the
27726 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
27727 as identifiers as in Ada 83.  However,
27728 in practice, it is usually advisable to make the necessary modifications
27729 to the program to remove the need for using this switch.
27730 See the @cite{Compiling Different Versions of Ada} section in
27731 the @cite{GNAT User's Guide}.
27733 @item 
27734 Support for removed Ada 83 pragmas and attributes
27736 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
27737 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
27738 compilers are allowed, but not required, to implement these missing
27739 elements.  In contrast with some other compilers, GNAT implements all
27740 such pragmas and attributes, eliminating this compatibility concern.  These
27741 include @cite{pragma Interface} and the floating point type attributes
27742 (@cite{Emax}, @cite{Mantissa}, etc.), among other items.
27743 @end itemize
27745 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
27746 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{3e1}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{3e2}
27747 @section Compatibility between Ada 95 and Ada 2005
27750 @geindex Compatibility between Ada 95 and Ada 2005
27752 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
27753 a number of incompatibilities. Several are enumerated below;
27754 for a complete description please see the
27755 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
27756 @cite{Rationale for Ada 2005}.
27759 @itemize *
27761 @item 
27762 @emph{New reserved words.}
27764 The words @cite{interface}, @cite{overriding} and @cite{synchronized} are
27765 reserved in Ada 2005.
27766 A pre-Ada 2005 program that uses any of these as an identifier will be
27767 illegal.
27769 @item 
27770 @emph{New declarations in predefined packages.}
27772 A number of packages in the predefined environment contain new declarations:
27773 @cite{Ada.Exceptions}, @cite{Ada.Real_Time}, @cite{Ada.Strings},
27774 @cite{Ada.Strings.Fixed}, @cite{Ada.Strings.Bounded},
27775 @cite{Ada.Strings.Unbounded}, @cite{Ada.Strings.Wide_Fixed},
27776 @cite{Ada.Strings.Wide_Bounded}, @cite{Ada.Strings.Wide_Unbounded},
27777 @cite{Ada.Tags}, @cite{Ada.Text_IO}, and @cite{Interfaces.C}.
27778 If an Ada 95 program does a @cite{with} and @cite{use} of any of these
27779 packages, the new declarations may cause name clashes.
27781 @item 
27782 @emph{Access parameters.}
27784 A nondispatching subprogram with an access parameter cannot be renamed
27785 as a dispatching operation.  This was permitted in Ada 95.
27787 @item 
27788 @emph{Access types, discriminants, and constraints.}
27790 Rule changes in this area have led to some incompatibilities; for example,
27791 constrained subtypes of some access types are not permitted in Ada 2005.
27793 @item 
27794 @emph{Aggregates for limited types.}
27796 The allowance of aggregates for limited types in Ada 2005 raises the
27797 possibility of ambiguities in legal Ada 95 programs, since additional types
27798 now need to be considered in expression resolution.
27800 @item 
27801 @emph{Fixed-point multiplication and division.}
27803 Certain expressions involving '*' or '/' for a fixed-point type, which
27804 were legal in Ada 95 and invoked the predefined versions of these operations,
27805 are now ambiguous.
27806 The ambiguity may be resolved either by applying a type conversion to the
27807 expression, or by explicitly invoking the operation from package
27808 @cite{Standard}.
27810 @item 
27811 @emph{Return-by-reference types.}
27813 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
27814 can declare a function returning a value from an anonymous access type.
27815 @end itemize
27817 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
27818 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{3e3}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{3e4}
27819 @section Implementation-dependent characteristics
27822 Although the Ada language defines the semantics of each construct as
27823 precisely as practical, in some situations (for example for reasons of
27824 efficiency, or where the effect is heavily dependent on the host or target
27825 platform) the implementation is allowed some freedom.  In porting Ada 83
27826 code to GNAT, you need to be aware of whether / how the existing code
27827 exercised such implementation dependencies.  Such characteristics fall into
27828 several categories, and GNAT offers specific support in assisting the
27829 transition from certain Ada 83 compilers.
27831 @menu
27832 * Implementation-defined pragmas:: 
27833 * Implementation-defined attributes:: 
27834 * Libraries:: 
27835 * Elaboration order:: 
27836 * Target-specific aspects:: 
27838 @end menu
27840 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
27841 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{3e5}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{3e6}
27842 @subsection Implementation-defined pragmas
27845 Ada compilers are allowed to supplement the language-defined pragmas, and
27846 these are a potential source of non-portability.  All GNAT-defined pragmas
27847 are described in the @cite{Implementation Defined Pragmas} chapter of the
27848 @cite{GNAT Reference Manual}, and these include several that are specifically
27849 intended to correspond to other vendors' Ada 83 pragmas.
27850 For migrating from VADS, the pragma @cite{Use_VADS_Size} may be useful.
27851 For compatibility with HP Ada 83, GNAT supplies the pragmas
27852 @cite{Extend_System}, @cite{Ident}, @cite{Inline_Generic},
27853 @cite{Interface_Name}, @cite{Passive}, @cite{Suppress_All},
27854 and @cite{Volatile}.
27855 Other relevant pragmas include @cite{External} and @cite{Link_With}.
27856 Some vendor-specific
27857 Ada 83 pragmas (@cite{Share_Generic}, @cite{Subtitle}, and @cite{Title}) are
27858 recognized, thus
27859 avoiding compiler rejection of units that contain such pragmas; they are not
27860 relevant in a GNAT context and hence are not otherwise implemented.
27862 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
27863 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{3e7}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{3e8}
27864 @subsection Implementation-defined attributes
27867 Analogous to pragmas, the set of attributes may be extended by an
27868 implementation.  All GNAT-defined attributes are described in
27869 @cite{Implementation Defined Attributes} section of the
27870 @cite{GNAT Reference Manual}, and these include several that are specifically intended
27871 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
27872 the attribute @cite{VADS_Size} may be useful.  For compatibility with HP
27873 Ada 83, GNAT supplies the attributes @cite{Bit}, @cite{Machine_Size} and
27874 @cite{Type_Class}.
27876 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
27877 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{3e9}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{3ea}
27878 @subsection Libraries
27881 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
27882 code uses vendor-specific libraries then there are several ways to manage
27883 this in Ada 95 and later versions of the standard:
27886 @itemize *
27888 @item 
27889 If the source code for the libraries (specs and bodies) are
27890 available, then the libraries can be migrated in the same way as the
27891 application.
27893 @item 
27894 If the source code for the specs but not the bodies are
27895 available, then you can reimplement the bodies.
27897 @item 
27898 Some features introduced by Ada 95 obviate the need for library support.  For
27899 example most Ada 83 vendors supplied a package for unsigned integers.  The
27900 Ada 95 modular type feature is the preferred way to handle this need, so
27901 instead of migrating or reimplementing the unsigned integer package it may
27902 be preferable to retrofit the application using modular types.
27903 @end itemize
27905 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
27906 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{3eb}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{3ec}
27907 @subsection Elaboration order
27910 The implementation can choose any elaboration order consistent with the unit
27911 dependency relationship.  This freedom means that some orders can result in
27912 Program_Error being raised due to an 'Access Before Elaboration': an attempt
27913 to invoke a subprogram its body has been elaborated, or to instantiate a
27914 generic before the generic body has been elaborated.  By default GNAT
27915 attempts to choose a safe order (one that will not encounter access before
27916 elaboration problems) by implicitly inserting @cite{Elaborate} or
27917 @cite{Elaborate_All} pragmas where
27918 needed.  However, this can lead to the creation of elaboration circularities
27919 and a resulting rejection of the program by gnatbind.  This issue is
27920 thoroughly described in the @cite{Elaboration Order Handling in GNAT} appendix
27921 in the @cite{GNAT User's Guide}.
27922 In brief, there are several
27923 ways to deal with this situation:
27926 @itemize *
27928 @item 
27929 Modify the program to eliminate the circularities, e.g., by moving
27930 elaboration-time code into explicitly-invoked procedures
27932 @item 
27933 Constrain the elaboration order by including explicit @cite{Elaborate_Body} or
27934 @cite{Elaborate} pragmas, and then inhibit the generation of implicit
27935 @cite{Elaborate_All}
27936 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
27937 (by selectively suppressing elaboration checks via pragma
27938 @cite{Suppress(Elaboration_Check)} when it is safe to do so).
27939 @end itemize
27941 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
27942 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{3ed}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{3ee}
27943 @subsection Target-specific aspects
27946 Low-level applications need to deal with machine addresses, data
27947 representations, interfacing with assembler code, and similar issues.  If
27948 such an Ada 83 application is being ported to different target hardware (for
27949 example where the byte endianness has changed) then you will need to
27950 carefully examine the program logic; the porting effort will heavily depend
27951 on the robustness of the original design.  Moreover, Ada 95 (and thus
27952 Ada 2005 and Ada 2012) are sometimes
27953 incompatible with typical Ada 83 compiler practices regarding implicit
27954 packing, the meaning of the Size attribute, and the size of access values.
27955 GNAT's approach to these issues is described in @ref{3ef,,Representation Clauses}.
27957 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
27958 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{3f0}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{3f1}
27959 @section Compatibility with Other Ada Systems
27962 If programs avoid the use of implementation dependent and
27963 implementation defined features, as documented in the
27964 @cite{Ada Reference Manual}, there should be a high degree of portability between
27965 GNAT and other Ada systems.  The following are specific items which
27966 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
27967 compilers, but do not affect porting code to GNAT.
27968 (As of January 2007, GNAT is the only compiler available for Ada 2005;
27969 the following issues may or may not arise for Ada 2005 programs
27970 when other compilers appear.)
27973 @itemize *
27975 @item 
27976 @emph{Ada 83 Pragmas and Attributes}
27978 Ada 95 compilers are allowed, but not required, to implement the missing
27979 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
27980 GNAT implements all such pragmas and attributes, eliminating this as
27981 a compatibility concern, but some other Ada 95 compilers reject these
27982 pragmas and attributes.
27984 @item 
27985 @emph{Specialized Needs Annexes}
27987 GNAT implements the full set of special needs annexes.  At the
27988 current time, it is the only Ada 95 compiler to do so.  This means that
27989 programs making use of these features may not be portable to other Ada
27990 95 compilation systems.
27992 @item 
27993 @emph{Representation Clauses}
27995 Some other Ada 95 compilers implement only the minimal set of
27996 representation clauses required by the Ada 95 reference manual.  GNAT goes
27997 far beyond this minimal set, as described in the next section.
27998 @end itemize
28000 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
28001 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{3ef}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{3f2}
28002 @section Representation Clauses
28005 The Ada 83 reference manual was quite vague in describing both the minimal
28006 required implementation of representation clauses, and also their precise
28007 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
28008 minimal set of capabilities required is still quite limited.
28010 GNAT implements the full required set of capabilities in
28011 Ada 95 and Ada 2005, but also goes much further, and in particular
28012 an effort has been made to be compatible with existing Ada 83 usage to the
28013 greatest extent possible.
28015 A few cases exist in which Ada 83 compiler behavior is incompatible with
28016 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
28017 intentional or accidental dependence on specific implementation dependent
28018 characteristics of these Ada 83 compilers.  The following is a list of
28019 the cases most likely to arise in existing Ada 83 code.
28022 @itemize *
28024 @item 
28025 @emph{Implicit Packing}
28027 Some Ada 83 compilers allowed a Size specification to cause implicit
28028 packing of an array or record.  This could cause expensive implicit
28029 conversions for change of representation in the presence of derived
28030 types, and the Ada design intends to avoid this possibility.
28031 Subsequent AI's were issued to make it clear that such implicit
28032 change of representation in response to a Size clause is inadvisable,
28033 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
28034 Reference Manuals as implementation advice that is followed by GNAT.
28035 The problem will show up as an error
28036 message rejecting the size clause.  The fix is simply to provide
28037 the explicit pragma @cite{Pack}, or for more fine tuned control, provide
28038 a Component_Size clause.
28040 @item 
28041 @emph{Meaning of Size Attribute}
28043 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
28044 the minimal number of bits required to hold values of the type.  For example,
28045 on a 32-bit machine, the size of @cite{Natural} will typically be 31 and not
28046 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
28047 some 32 in this situation.  This problem will usually show up as a compile
28048 time error, but not always.  It is a good idea to check all uses of the
28049 'Size attribute when porting Ada 83 code.  The GNAT specific attribute
28050 Object_Size can provide a useful way of duplicating the behavior of
28051 some Ada 83 compiler systems.
28053 @item 
28054 @emph{Size of Access Types}
28056 A common assumption in Ada 83 code is that an access type is in fact a pointer,
28057 and that therefore it will be the same size as a System.Address value.  This
28058 assumption is true for GNAT in most cases with one exception.  For the case of
28059 a pointer to an unconstrained array type (where the bounds may vary from one
28060 value of the access type to another), the default is to use a 'fat pointer',
28061 which is represented as two separate pointers, one to the bounds, and one to
28062 the array.  This representation has a number of advantages, including improved
28063 efficiency.  However, it may cause some difficulties in porting existing Ada 83
28064 code which makes the assumption that, for example, pointers fit in 32 bits on
28065 a machine with 32-bit addressing.
28067 To get around this problem, GNAT also permits the use of 'thin pointers' for
28068 access types in this case (where the designated type is an unconstrained array
28069 type).  These thin pointers are indeed the same size as a System.Address value.
28070 To specify a thin pointer, use a size clause for the type, for example:
28072 @example
28073 type X is access all String;
28074 for X'Size use Standard'Address_Size;
28075 @end example
28077 which will cause the type X to be represented using a single pointer.
28078 When using this representation, the bounds are right behind the array.
28079 This representation is slightly less efficient, and does not allow quite
28080 such flexibility in the use of foreign pointers or in using the
28081 Unrestricted_Access attribute to create pointers to non-aliased objects.
28082 But for any standard portable use of the access type it will work in
28083 a functionally correct manner and allow porting of existing code.
28084 Note that another way of forcing a thin pointer representation
28085 is to use a component size clause for the element size in an array,
28086 or a record representation clause for an access field in a record.
28088 See the documentation of Unrestricted_Access in the GNAT RM for a
28089 full discussion of possible problems using this attribute in conjunction
28090 with thin pointers.
28091 @end itemize
28093 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
28094 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{3f3}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{3f4}
28095 @section Compatibility with HP Ada 83
28098 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
28099 of them can sensibly be implemented.  The description of pragmas in
28100 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
28101 applicable to GNAT.
28104 @itemize *
28106 @item 
28107 @emph{Default floating-point representation}
28109 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
28110 it is VMS format.
28112 @item 
28113 @emph{System}
28115 the package System in GNAT exactly corresponds to the definition in the
28116 Ada 95 reference manual, which means that it excludes many of the
28117 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
28118 that contains the additional definitions, and a special pragma,
28119 Extend_System allows this package to be treated transparently as an
28120 extension of package System.
28121 @end itemize
28123 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
28124 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{3f5}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{3f6}
28125 @chapter GNU Free Documentation License
28128 Version 1.3, 3 November 2008
28130 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
28131 @indicateurl{http://fsf.org/}
28133 Everyone is permitted to copy and distribute verbatim copies of this
28134 license document, but changing it is not allowed.
28136 @strong{Preamble}
28138 The purpose of this License is to make a manual, textbook, or other
28139 functional and useful document "free" in the sense of freedom: to
28140 assure everyone the effective freedom to copy and redistribute it,
28141 with or without modifying it, either commercially or noncommercially.
28142 Secondarily, this License preserves for the author and publisher a way
28143 to get credit for their work, while not being considered responsible
28144 for modifications made by others.
28146 This License is a kind of "copyleft", which means that derivative
28147 works of the document must themselves be free in the same sense.  It
28148 complements the GNU General Public License, which is a copyleft
28149 license designed for free software.
28151 We have designed this License in order to use it for manuals for free
28152 software, because free software needs free documentation: a free
28153 program should come with manuals providing the same freedoms that the
28154 software does.  But this License is not limited to software manuals;
28155 it can be used for any textual work, regardless of subject matter or
28156 whether it is published as a printed book.  We recommend this License
28157 principally for works whose purpose is instruction or reference.
28159 @strong{1. APPLICABILITY AND DEFINITIONS}
28161 This License applies to any manual or other work, in any medium, that
28162 contains a notice placed by the copyright holder saying it can be
28163 distributed under the terms of this License.  Such a notice grants a
28164 world-wide, royalty-free license, unlimited in duration, to use that
28165 work under the conditions stated herein.  The @strong{Document}, below,
28166 refers to any such manual or work.  Any member of the public is a
28167 licensee, and is addressed as "@strong{you}".  You accept the license if you
28168 copy, modify or distribute the work in a way requiring permission
28169 under copyright law.
28171 A "@strong{Modified Version}" of the Document means any work containing the
28172 Document or a portion of it, either copied verbatim, or with
28173 modifications and/or translated into another language.
28175 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
28176 the Document that deals exclusively with the relationship of the
28177 publishers or authors of the Document to the Document's overall subject
28178 (or to related matters) and contains nothing that could fall directly
28179 within that overall subject.  (Thus, if the Document is in part a
28180 textbook of mathematics, a Secondary Section may not explain any
28181 mathematics.)  The relationship could be a matter of historical
28182 connection with the subject or with related matters, or of legal,
28183 commercial, philosophical, ethical or political position regarding
28184 them.
28186 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
28187 are designated, as being those of Invariant Sections, in the notice
28188 that says that the Document is released under this License.  If a
28189 section does not fit the above definition of Secondary then it is not
28190 allowed to be designated as Invariant.  The Document may contain zero
28191 Invariant Sections.  If the Document does not identify any Invariant
28192 Sections then there are none.
28194 The "@strong{Cover Texts}" are certain short passages of text that are listed,
28195 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
28196 the Document is released under this License.  A Front-Cover Text may
28197 be at most 5 words, and a Back-Cover Text may be at most 25 words.
28199 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
28200 represented in a format whose specification is available to the
28201 general public, that is suitable for revising the document
28202 straightforwardly with generic text editors or (for images composed of
28203 pixels) generic paint programs or (for drawings) some widely available
28204 drawing editor, and that is suitable for input to text formatters or
28205 for automatic translation to a variety of formats suitable for input
28206 to text formatters.  A copy made in an otherwise Transparent file
28207 format whose markup, or absence of markup, has been arranged to thwart
28208 or discourage subsequent modification by readers is not Transparent.
28209 An image format is not Transparent if used for any substantial amount
28210 of text.  A copy that is not "Transparent" is called @strong{Opaque}.
28212 Examples of suitable formats for Transparent copies include plain
28213 ASCII without markup, Texinfo input format, LaTeX input format, SGML
28214 or XML using a publicly available DTD, and standard-conforming simple
28215 HTML, PostScript or PDF designed for human modification.  Examples of
28216 transparent image formats include PNG, XCF and JPG.  Opaque formats
28217 include proprietary formats that can be read and edited only by
28218 proprietary word processors, SGML or XML for which the DTD and/or
28219 processing tools are not generally available, and the
28220 machine-generated HTML, PostScript or PDF produced by some word
28221 processors for output purposes only.
28223 The "@strong{Title Page}" means, for a printed book, the title page itself,
28224 plus such following pages as are needed to hold, legibly, the material
28225 this License requires to appear in the title page.  For works in
28226 formats which do not have any title page as such, "Title Page" means
28227 the text near the most prominent appearance of the work's title,
28228 preceding the beginning of the body of the text.
28230 The "@strong{publisher}" means any person or entity that distributes
28231 copies of the Document to the public.
28233 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
28234 title either is precisely XYZ or contains XYZ in parentheses following
28235 text that translates XYZ in another language.  (Here XYZ stands for a
28236 specific section name mentioned below, such as "@strong{Acknowledgements}",
28237 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
28238 To "@strong{Preserve the Title}"
28239 of such a section when you modify the Document means that it remains a
28240 section "Entitled XYZ" according to this definition.
28242 The Document may include Warranty Disclaimers next to the notice which
28243 states that this License applies to the Document.  These Warranty
28244 Disclaimers are considered to be included by reference in this
28245 License, but only as regards disclaiming warranties: any other
28246 implication that these Warranty Disclaimers may have is void and has
28247 no effect on the meaning of this License.
28249 @strong{2. VERBATIM COPYING}
28251 You may copy and distribute the Document in any medium, either
28252 commercially or noncommercially, provided that this License, the
28253 copyright notices, and the license notice saying this License applies
28254 to the Document are reproduced in all copies, and that you add no other
28255 conditions whatsoever to those of this License.  You may not use
28256 technical measures to obstruct or control the reading or further
28257 copying of the copies you make or distribute.  However, you may accept
28258 compensation in exchange for copies.  If you distribute a large enough
28259 number of copies you must also follow the conditions in section 3.
28261 You may also lend copies, under the same conditions stated above, and
28262 you may publicly display copies.
28264 @strong{3. COPYING IN QUANTITY}
28266 If you publish printed copies (or copies in media that commonly have
28267 printed covers) of the Document, numbering more than 100, and the
28268 Document's license notice requires Cover Texts, you must enclose the
28269 copies in covers that carry, clearly and legibly, all these Cover
28270 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
28271 the back cover.  Both covers must also clearly and legibly identify
28272 you as the publisher of these copies.  The front cover must present
28273 the full title with all words of the title equally prominent and
28274 visible.  You may add other material on the covers in addition.
28275 Copying with changes limited to the covers, as long as they preserve
28276 the title of the Document and satisfy these conditions, can be treated
28277 as verbatim copying in other respects.
28279 If the required texts for either cover are too voluminous to fit
28280 legibly, you should put the first ones listed (as many as fit
28281 reasonably) on the actual cover, and continue the rest onto adjacent
28282 pages.
28284 If you publish or distribute Opaque copies of the Document numbering
28285 more than 100, you must either include a machine-readable Transparent
28286 copy along with each Opaque copy, or state in or with each Opaque copy
28287 a computer-network location from which the general network-using
28288 public has access to download using public-standard network protocols
28289 a complete Transparent copy of the Document, free of added material.
28290 If you use the latter option, you must take reasonably prudent steps,
28291 when you begin distribution of Opaque copies in quantity, to ensure
28292 that this Transparent copy will remain thus accessible at the stated
28293 location until at least one year after the last time you distribute an
28294 Opaque copy (directly or through your agents or retailers) of that
28295 edition to the public.
28297 It is requested, but not required, that you contact the authors of the
28298 Document well before redistributing any large number of copies, to give
28299 them a chance to provide you with an updated version of the Document.
28301 @strong{4. MODIFICATIONS}
28303 You may copy and distribute a Modified Version of the Document under
28304 the conditions of sections 2 and 3 above, provided that you release
28305 the Modified Version under precisely this License, with the Modified
28306 Version filling the role of the Document, thus licensing distribution
28307 and modification of the Modified Version to whoever possesses a copy
28308 of it.  In addition, you must do these things in the Modified Version:
28311 @enumerate A
28313 @item 
28314 Use in the Title Page (and on the covers, if any) a title distinct
28315 from that of the Document, and from those of previous versions
28316 (which should, if there were any, be listed in the History section
28317 of the Document).  You may use the same title as a previous version
28318 if the original publisher of that version gives permission.
28320 @item 
28321 List on the Title Page, as authors, one or more persons or entities
28322 responsible for authorship of the modifications in the Modified
28323 Version, together with at least five of the principal authors of the
28324 Document (all of its principal authors, if it has fewer than five),
28325 unless they release you from this requirement.
28327 @item 
28328 State on the Title page the name of the publisher of the
28329 Modified Version, as the publisher.
28331 @item 
28332 Preserve all the copyright notices of the Document.
28334 @item 
28335 Add an appropriate copyright notice for your modifications
28336 adjacent to the other copyright notices.
28338 @item 
28339 Include, immediately after the copyright notices, a license notice
28340 giving the public permission to use the Modified Version under the
28341 terms of this License, in the form shown in the Addendum below.
28343 @item 
28344 Preserve in that license notice the full lists of Invariant Sections
28345 and required Cover Texts given in the Document's license notice.
28347 @item 
28348 Include an unaltered copy of this License.
28350 @item 
28351 Preserve the section Entitled "History", Preserve its Title, and add
28352 to it an item stating at least the title, year, new authors, and
28353 publisher of the Modified Version as given on the Title Page.  If
28354 there is no section Entitled "History" in the Document, create one
28355 stating the title, year, authors, and publisher of the Document as
28356 given on its Title Page, then add an item describing the Modified
28357 Version as stated in the previous sentence.
28359 @item 
28360 Preserve the network location, if any, given in the Document for
28361 public access to a Transparent copy of the Document, and likewise
28362 the network locations given in the Document for previous versions
28363 it was based on.  These may be placed in the "History" section.
28364 You may omit a network location for a work that was published at
28365 least four years before the Document itself, or if the original
28366 publisher of the version it refers to gives permission.
28368 @item 
28369 For any section Entitled "Acknowledgements" or "Dedications",
28370 Preserve the Title of the section, and preserve in the section all
28371 the substance and tone of each of the contributor acknowledgements
28372 and/or dedications given therein.
28374 @item 
28375 Preserve all the Invariant Sections of the Document,
28376 unaltered in their text and in their titles.  Section numbers
28377 or the equivalent are not considered part of the section titles.
28379 @item 
28380 Delete any section Entitled "Endorsements".  Such a section
28381 may not be included in the Modified Version.
28383 @item 
28384 Do not retitle any existing section to be Entitled "Endorsements"
28385 or to conflict in title with any Invariant Section.
28387 @item 
28388 Preserve any Warranty Disclaimers.
28389 @end enumerate
28391 If the Modified Version includes new front-matter sections or
28392 appendices that qualify as Secondary Sections and contain no material
28393 copied from the Document, you may at your option designate some or all
28394 of these sections as invariant.  To do this, add their titles to the
28395 list of Invariant Sections in the Modified Version's license notice.
28396 These titles must be distinct from any other section titles.
28398 You may add a section Entitled "Endorsements", provided it contains
28399 nothing but endorsements of your Modified Version by various
28400 parties---for example, statements of peer review or that the text has
28401 been approved by an organization as the authoritative definition of a
28402 standard.
28404 You may add a passage of up to five words as a Front-Cover Text, and a
28405 passage of up to 25 words as a Back-Cover Text, to the end of the list
28406 of Cover Texts in the Modified Version.  Only one passage of
28407 Front-Cover Text and one of Back-Cover Text may be added by (or
28408 through arrangements made by) any one entity.  If the Document already
28409 includes a cover text for the same cover, previously added by you or
28410 by arrangement made by the same entity you are acting on behalf of,
28411 you may not add another; but you may replace the old one, on explicit
28412 permission from the previous publisher that added the old one.
28414 The author(s) and publisher(s) of the Document do not by this License
28415 give permission to use their names for publicity for or to assert or
28416 imply endorsement of any Modified Version.
28418 @strong{5. COMBINING DOCUMENTS}
28420 You may combine the Document with other documents released under this
28421 License, under the terms defined in section 4 above for modified
28422 versions, provided that you include in the combination all of the
28423 Invariant Sections of all of the original documents, unmodified, and
28424 list them all as Invariant Sections of your combined work in its
28425 license notice, and that you preserve all their Warranty Disclaimers.
28427 The combined work need only contain one copy of this License, and
28428 multiple identical Invariant Sections may be replaced with a single
28429 copy.  If there are multiple Invariant Sections with the same name but
28430 different contents, make the title of each such section unique by
28431 adding at the end of it, in parentheses, the name of the original
28432 author or publisher of that section if known, or else a unique number.
28433 Make the same adjustment to the section titles in the list of
28434 Invariant Sections in the license notice of the combined work.
28436 In the combination, you must combine any sections Entitled "History"
28437 in the various original documents, forming one section Entitled
28438 "History"; likewise combine any sections Entitled "Acknowledgements",
28439 and any sections Entitled "Dedications".  You must delete all sections
28440 Entitled "Endorsements".
28442 @strong{6. COLLECTIONS OF DOCUMENTS}
28444 You may make a collection consisting of the Document and other documents
28445 released under this License, and replace the individual copies of this
28446 License in the various documents with a single copy that is included in
28447 the collection, provided that you follow the rules of this License for
28448 verbatim copying of each of the documents in all other respects.
28450 You may extract a single document from such a collection, and distribute
28451 it individually under this License, provided you insert a copy of this
28452 License into the extracted document, and follow this License in all
28453 other respects regarding verbatim copying of that document.
28455 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
28457 A compilation of the Document or its derivatives with other separate
28458 and independent documents or works, in or on a volume of a storage or
28459 distribution medium, is called an "aggregate" if the copyright
28460 resulting from the compilation is not used to limit the legal rights
28461 of the compilation's users beyond what the individual works permit.
28462 When the Document is included in an aggregate, this License does not
28463 apply to the other works in the aggregate which are not themselves
28464 derivative works of the Document.
28466 If the Cover Text requirement of section 3 is applicable to these
28467 copies of the Document, then if the Document is less than one half of
28468 the entire aggregate, the Document's Cover Texts may be placed on
28469 covers that bracket the Document within the aggregate, or the
28470 electronic equivalent of covers if the Document is in electronic form.
28471 Otherwise they must appear on printed covers that bracket the whole
28472 aggregate.
28474 @strong{8. TRANSLATION}
28476 Translation is considered a kind of modification, so you may
28477 distribute translations of the Document under the terms of section 4.
28478 Replacing Invariant Sections with translations requires special
28479 permission from their copyright holders, but you may include
28480 translations of some or all Invariant Sections in addition to the
28481 original versions of these Invariant Sections.  You may include a
28482 translation of this License, and all the license notices in the
28483 Document, and any Warranty Disclaimers, provided that you also include
28484 the original English version of this License and the original versions
28485 of those notices and disclaimers.  In case of a disagreement between
28486 the translation and the original version of this License or a notice
28487 or disclaimer, the original version will prevail.
28489 If a section in the Document is Entitled "Acknowledgements",
28490 "Dedications", or "History", the requirement (section 4) to Preserve
28491 its Title (section 1) will typically require changing the actual
28492 title.
28494 @strong{9. TERMINATION}
28496 You may not copy, modify, sublicense, or distribute the Document
28497 except as expressly provided under this License.  Any attempt
28498 otherwise to copy, modify, sublicense, or distribute it is void, and
28499 will automatically terminate your rights under this License.
28501 However, if you cease all violation of this License, then your license
28502 from a particular copyright holder is reinstated (a) provisionally,
28503 unless and until the copyright holder explicitly and finally
28504 terminates your license, and (b) permanently, if the copyright holder
28505 fails to notify you of the violation by some reasonable means prior to
28506 60 days after the cessation.
28508 Moreover, your license from a particular copyright holder is
28509 reinstated permanently if the copyright holder notifies you of the
28510 violation by some reasonable means, this is the first time you have
28511 received notice of violation of this License (for any work) from that
28512 copyright holder, and you cure the violation prior to 30 days after
28513 your receipt of the notice.
28515 Termination of your rights under this section does not terminate the
28516 licenses of parties who have received copies or rights from you under
28517 this License.  If your rights have been terminated and not permanently
28518 reinstated, receipt of a copy of some or all of the same material does
28519 not give you any rights to use it.
28521 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
28523 The Free Software Foundation may publish new, revised versions
28524 of the GNU Free Documentation License from time to time.  Such new
28525 versions will be similar in spirit to the present version, but may
28526 differ in detail to address new problems or concerns.  See
28527 @indicateurl{http://www.gnu.org/copyleft/}.
28529 Each version of the License is given a distinguishing version number.
28530 If the Document specifies that a particular numbered version of this
28531 License "or any later version" applies to it, you have the option of
28532 following the terms and conditions either of that specified version or
28533 of any later version that has been published (not as a draft) by the
28534 Free Software Foundation.  If the Document does not specify a version
28535 number of this License, you may choose any version ever published (not
28536 as a draft) by the Free Software Foundation.  If the Document
28537 specifies that a proxy can decide which future versions of this
28538 License can be used, that proxy's public statement of acceptance of a
28539 version permanently authorizes you to choose that version for the
28540 Document.
28542 @strong{11. RELICENSING}
28544 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
28545 World Wide Web server that publishes copyrightable works and also
28546 provides prominent facilities for anybody to edit those works.  A
28547 public wiki that anybody can edit is an example of such a server.  A
28548 "Massive Multiauthor Collaboration" (or "MMC") contained in the
28549 site means any set of copyrightable works thus published on the MMC
28550 site.
28552 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
28553 license published by Creative Commons Corporation, a not-for-profit
28554 corporation with a principal place of business in San Francisco,
28555 California, as well as future copyleft versions of that license
28556 published by that same organization.
28558 "Incorporate" means to publish or republish a Document, in whole or
28559 in part, as part of another Document.
28561 An MMC is "eligible for relicensing" if it is licensed under this
28562 License, and if all works that were first published under this License
28563 somewhere other than this MMC, and subsequently incorporated in whole
28564 or in part into the MMC, (1) had no cover texts or invariant sections,
28565 and (2) were thus incorporated prior to November 1, 2008.
28567 The operator of an MMC Site may republish an MMC contained in the site
28568 under CC-BY-SA on the same site at any time before August 1, 2009,
28569 provided the MMC is eligible for relicensing.
28571 @strong{ADDENDUM: How to use this License for your documents}
28573 To use this License in a document you have written, include a copy of
28574 the License in the document and put the following copyright and
28575 license notices just after the title page:
28577 @quotation
28579 Copyright © YEAR  YOUR NAME.
28580 Permission is granted to copy, distribute and/or modify this document
28581 under the terms of the GNU Free Documentation License, Version 1.3
28582 or any later version published by the Free Software Foundation;
28583 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
28584 A copy of the license is included in the section entitled "GNU
28585 Free Documentation License".
28586 @end quotation
28588 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
28589 replace the "with ... Texts." line with this:
28591 @quotation
28593 with the Invariant Sections being LIST THEIR TITLES, with the
28594 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
28595 @end quotation
28597 If you have Invariant Sections without Cover Texts, or some other
28598 combination of the three, merge those two alternatives to suit the
28599 situation.
28601 If your document contains nontrivial examples of program code, we
28602 recommend releasing these examples in parallel under your choice of
28603 free software license, such as the GNU General Public License,
28604 to permit their use in free software.
28606 @node Index,,GNU Free Documentation License,Top
28607 @unnumbered Index
28610 @printindex ge
28613 @c %**end of body
28614 @bye