Daily bump.
[official-gcc.git] / gcc / ada / gnat_rm.texi
blob281cb382bd7c5b1cf4b9c9393a071ed7d07f19db
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.3b2.@*
7 @end ifinfo
8 @settitle GNAT Reference Manual
9 @defindex ge
10 @paragraphindent 0
11 @exampleindent 4
12 @finalout
13 @dircategory GNU Ada Tools 
14 @direntry
15 * gnat_rm: (gnat_rm.info). gnat_rm
16 @end direntry
18 @definfoenclose strong,`,'
19 @definfoenclose emph,`,'
20 @c %**end of header
22 @copying
23 @quotation
24 GNAT Reference Manual , May 12, 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 Ignore_Pragma:: 
167 * Pragma Implementation_Defined:: 
168 * Pragma Implemented:: 
169 * Pragma Implicit_Packing:: 
170 * Pragma Import_Function:: 
171 * Pragma Import_Object:: 
172 * Pragma Import_Procedure:: 
173 * Pragma Import_Valued_Procedure:: 
174 * Pragma Independent:: 
175 * Pragma Independent_Components:: 
176 * Pragma Initial_Condition:: 
177 * Pragma Initialize_Scalars:: 
178 * Pragma Initializes:: 
179 * Pragma Inline_Always:: 
180 * Pragma Inline_Generic:: 
181 * Pragma Interface:: 
182 * Pragma Interface_Name:: 
183 * Pragma Interrupt_Handler:: 
184 * Pragma Interrupt_State:: 
185 * Pragma Invariant:: 
186 * Pragma Java_Constructor:: 
187 * Pragma Java_Interface:: 
188 * Pragma Keep_Names:: 
189 * Pragma License:: 
190 * Pragma Link_With:: 
191 * Pragma Linker_Alias:: 
192 * Pragma Linker_Constructor:: 
193 * Pragma Linker_Destructor:: 
194 * Pragma Linker_Section:: 
195 * Pragma Lock_Free:: 
196 * Pragma Loop_Invariant:: 
197 * Pragma Loop_Optimize:: 
198 * Pragma Loop_Variant:: 
199 * Pragma Machine_Attribute:: 
200 * Pragma Main:: 
201 * Pragma Main_Storage:: 
202 * Pragma No_Body:: 
203 * Pragma No_Elaboration_Code_All:: 
204 * Pragma No_Inline:: 
205 * Pragma No_Return:: 
206 * Pragma No_Run_Time:: 
207 * Pragma No_Strict_Aliasing:: 
208 * Pragma No_Tagged_Streams:: 
209 * Pragma Normalize_Scalars:: 
210 * Pragma Obsolescent:: 
211 * Pragma Optimize_Alignment:: 
212 * Pragma Ordered:: 
213 * Pragma Overflow_Mode:: 
214 * Pragma Overriding_Renamings:: 
215 * Pragma Partition_Elaboration_Policy:: 
216 * Pragma Part_Of:: 
217 * Pragma Passive:: 
218 * Pragma Persistent_BSS:: 
219 * Pragma Polling:: 
220 * Pragma Post:: 
221 * Pragma Postcondition:: 
222 * Pragma Post_Class:: 
223 * Pragma Pre:: 
224 * Pragma Precondition:: 
225 * Pragma Predicate:: 
226 * Pragma Preelaborable_Initialization:: 
227 * Pragma Prefix_Exception_Messages:: 
228 * Pragma Pre_Class:: 
229 * Pragma Priority_Specific_Dispatching:: 
230 * Pragma Profile:: 
231 * Pragma Profile_Warnings:: 
232 * Pragma Propagate_Exceptions:: 
233 * Pragma Provide_Shift_Operators:: 
234 * Pragma Psect_Object:: 
235 * Pragma Pure_Function:: 
236 * Pragma Rational:: 
237 * Pragma Ravenscar:: 
238 * Pragma Refined_Depends:: 
239 * Pragma Refined_Global:: 
240 * Pragma Refined_Post:: 
241 * Pragma Refined_State:: 
242 * Pragma Relative_Deadline:: 
243 * Pragma Remote_Access_Type:: 
244 * Pragma Restricted_Run_Time:: 
245 * Pragma Restriction_Warnings:: 
246 * Pragma Reviewable:: 
247 * Pragma Share_Generic:: 
248 * Pragma Shared:: 
249 * Pragma Short_Circuit_And_Or:: 
250 * Pragma Short_Descriptors:: 
251 * Pragma Simple_Storage_Pool_Type:: 
252 * Pragma Source_File_Name:: 
253 * Pragma Source_File_Name_Project:: 
254 * Pragma Source_Reference:: 
255 * Pragma SPARK_Mode:: 
256 * Pragma Static_Elaboration_Desired:: 
257 * Pragma Stream_Convert:: 
258 * Pragma Style_Checks:: 
259 * Pragma Subtitle:: 
260 * Pragma Suppress:: 
261 * Pragma Suppress_All:: 
262 * Pragma Suppress_Debug_Info:: 
263 * Pragma Suppress_Exception_Locations:: 
264 * Pragma Suppress_Initialization:: 
265 * Pragma Task_Name:: 
266 * Pragma Task_Storage:: 
267 * Pragma Test_Case:: 
268 * Pragma Thread_Local_Storage:: 
269 * Pragma Time_Slice:: 
270 * Pragma Title:: 
271 * Pragma Type_Invariant:: 
272 * Pragma Type_Invariant_Class:: 
273 * Pragma Unchecked_Union:: 
274 * Pragma Unevaluated_Use_Of_Old:: 
275 * Pragma Unimplemented_Unit:: 
276 * Pragma Universal_Aliasing:: 
277 * Pragma Universal_Data:: 
278 * Pragma Unmodified:: 
279 * Pragma Unreferenced:: 
280 * Pragma Unreferenced_Objects:: 
281 * Pragma Unreserve_All_Interrupts:: 
282 * Pragma Unsuppress:: 
283 * Pragma Use_VADS_Size:: 
284 * Pragma Validity_Checks:: 
285 * Pragma Volatile:: 
286 * Pragma Volatile_Full_Access:: 
287 * Pragma Warning_As_Error:: 
288 * Pragma Warnings:: 
289 * Pragma Weak_External:: 
290 * Pragma Wide_Character_Encoding:: 
292 Implementation Defined Aspects
294 * Aspect Abstract_State:: 
295 * Annotate:: 
296 * Aspect Async_Readers:: 
297 * Aspect Async_Writers:: 
298 * Aspect Contract_Cases:: 
299 * Aspect Depends:: 
300 * Aspect Dimension:: 
301 * Aspect Dimension_System:: 
302 * Aspect Disable_Controlled:: 
303 * Aspect Effective_Reads:: 
304 * Aspect Effective_Writes:: 
305 * Aspect Favor_Top_Level:: 
306 * Aspect Global:: 
307 * Aspect Initial_Condition:: 
308 * Aspect Initializes:: 
309 * Aspect Inline_Always:: 
310 * Aspect Invariant:: 
311 * Aspect Invariant'Class:: 
312 * Aspect Iterable:: 
313 * Aspect Linker_Section:: 
314 * Aspect Lock_Free:: 
315 * Aspect No_Elaboration_Code_All:: 
316 * Aspect No_Tagged_Streams:: 
317 * Aspect Object_Size:: 
318 * Aspect Obsolescent:: 
319 * Aspect Part_Of:: 
320 * Aspect Persistent_BSS:: 
321 * Aspect Predicate:: 
322 * Aspect Pure_Function:: 
323 * Aspect Refined_Depends:: 
324 * Aspect Refined_Global:: 
325 * Aspect Refined_Post:: 
326 * Aspect Refined_State:: 
327 * Aspect Remote_Access_Type:: 
328 * Aspect Scalar_Storage_Order:: 
329 * Aspect Shared:: 
330 * Aspect Simple_Storage_Pool:: 
331 * Aspect Simple_Storage_Pool_Type:: 
332 * Aspect SPARK_Mode:: 
333 * Aspect Suppress_Debug_Info:: 
334 * Aspect Suppress_Initialization:: 
335 * Aspect Test_Case:: 
336 * Aspect Thread_Local_Storage:: 
337 * Aspect Universal_Aliasing:: 
338 * Aspect Universal_Data:: 
339 * Aspect Unmodified:: 
340 * Aspect Unreferenced:: 
341 * Aspect Unreferenced_Objects:: 
342 * Aspect Value_Size:: 
343 * Aspect Volatile_Full_Access:: 
344 * Aspect Warnings:: 
346 Implementation Defined Attributes
348 * Attribute Abort_Signal:: 
349 * Attribute Address_Size:: 
350 * Attribute Asm_Input:: 
351 * Attribute Asm_Output:: 
352 * Attribute Atomic_Always_Lock_Free:: 
353 * Attribute Bit:: 
354 * Attribute Bit_Position:: 
355 * Attribute Code_Address:: 
356 * Attribute Compiler_Version:: 
357 * Attribute Constrained:: 
358 * Attribute Default_Bit_Order:: 
359 * Attribute Default_Scalar_Storage_Order:: 
360 * Attribute Deref:: 
361 * Attribute Descriptor_Size:: 
362 * Attribute Elaborated:: 
363 * Attribute Elab_Body:: 
364 * Attribute Elab_Spec:: 
365 * Attribute Elab_Subp_Body:: 
366 * Attribute Emax:: 
367 * Attribute Enabled:: 
368 * Attribute Enum_Rep:: 
369 * Attribute Enum_Val:: 
370 * Attribute Epsilon:: 
371 * Attribute Fast_Math:: 
372 * Attribute Fixed_Value:: 
373 * Attribute From_Any:: 
374 * Attribute Has_Access_Values:: 
375 * Attribute Has_Discriminants:: 
376 * Attribute Img:: 
377 * Attribute Integer_Value:: 
378 * Attribute Invalid_Value:: 
379 * Attribute Iterable:: 
380 * Attribute Large:: 
381 * Attribute Library_Level:: 
382 * Attribute Lock_Free:: 
383 * Attribute Loop_Entry:: 
384 * Attribute Machine_Size:: 
385 * Attribute Mantissa:: 
386 * Attribute Maximum_Alignment:: 
387 * Attribute Mechanism_Code:: 
388 * Attribute Null_Parameter:: 
389 * Attribute Object_Size:: 
390 * Attribute Old:: 
391 * Attribute Passed_By_Reference:: 
392 * Attribute Pool_Address:: 
393 * Attribute Range_Length:: 
394 * Attribute Restriction_Set:: 
395 * Attribute Result:: 
396 * Attribute Safe_Emax:: 
397 * Attribute Safe_Large:: 
398 * Attribute Safe_Small:: 
399 * Attribute Scalar_Storage_Order:: 
400 * Attribute Simple_Storage_Pool:: 
401 * Attribute Small:: 
402 * Attribute Storage_Unit:: 
403 * Attribute Stub_Type:: 
404 * Attribute System_Allocator_Alignment:: 
405 * Attribute Target_Name:: 
406 * Attribute To_Address:: 
407 * Attribute To_Any:: 
408 * Attribute Type_Class:: 
409 * Attribute Type_Key:: 
410 * Attribute TypeCode:: 
411 * Attribute UET_Address:: 
412 * Attribute Unconstrained_Array:: 
413 * Attribute Universal_Literal_String:: 
414 * Attribute Unrestricted_Access:: 
415 * Attribute Update:: 
416 * Attribute Valid_Scalars:: 
417 * Attribute VADS_Size:: 
418 * Attribute Value_Size:: 
419 * Attribute Wchar_T_Size:: 
420 * Attribute Word_Size:: 
422 Standard and Implementation Defined Restrictions
424 * Partition-Wide Restrictions:: 
425 * Program Unit Level Restrictions:: 
427 Partition-Wide Restrictions
429 * Immediate_Reclamation:: 
430 * Max_Asynchronous_Select_Nesting:: 
431 * Max_Entry_Queue_Length:: 
432 * Max_Protected_Entries:: 
433 * Max_Select_Alternatives:: 
434 * Max_Storage_At_Blocking:: 
435 * Max_Task_Entries:: 
436 * Max_Tasks:: 
437 * No_Abort_Statements:: 
438 * No_Access_Parameter_Allocators:: 
439 * No_Access_Subprograms:: 
440 * No_Allocators:: 
441 * No_Anonymous_Allocators:: 
442 * No_Calendar:: 
443 * No_Coextensions:: 
444 * No_Default_Initialization:: 
445 * No_Delay:: 
446 * No_Dependence:: 
447 * No_Direct_Boolean_Operators:: 
448 * No_Dispatch:: 
449 * No_Dispatching_Calls:: 
450 * No_Dynamic_Attachment:: 
451 * No_Dynamic_Priorities:: 
452 * No_Entry_Calls_In_Elaboration_Code:: 
453 * No_Enumeration_Maps:: 
454 * No_Exception_Handlers:: 
455 * No_Exception_Propagation:: 
456 * No_Exception_Registration:: 
457 * No_Exceptions:: 
458 * No_Finalization:: 
459 * No_Fixed_Point:: 
460 * No_Floating_Point:: 
461 * No_Implicit_Conditionals:: 
462 * No_Implicit_Dynamic_Code:: 
463 * No_Implicit_Heap_Allocations:: 
464 * No_Implicit_Loops:: 
465 * No_Initialize_Scalars:: 
466 * No_IO:: 
467 * No_Local_Allocators:: 
468 * No_Local_Protected_Objects:: 
469 * No_Local_Timing_Events:: 
470 * No_Long_Long_Integers:: 
471 * No_Multiple_Elaboration:: 
472 * No_Nested_Finalization:: 
473 * No_Protected_Type_Allocators:: 
474 * No_Protected_Types:: 
475 * No_Recursion:: 
476 * No_Reentrancy:: 
477 * No_Relative_Delay:: 
478 * No_Requeue_Statements:: 
479 * No_Secondary_Stack:: 
480 * No_Select_Statements:: 
481 * No_Specific_Termination_Handlers:: 
482 * No_Specification_of_Aspect:: 
483 * No_Standard_Allocators_After_Elaboration:: 
484 * No_Standard_Storage_Pools:: 
485 * No_Stream_Optimizations:: 
486 * No_Streams:: 
487 * No_Task_Allocators:: 
488 * No_Task_Attributes_Package:: 
489 * No_Task_Hierarchy:: 
490 * No_Task_Termination:: 
491 * No_Tasking:: 
492 * No_Terminate_Alternatives:: 
493 * No_Unchecked_Access:: 
494 * No_Use_Of_Entity:: 
495 * Simple_Barriers:: 
496 * Static_Priorities:: 
497 * Static_Storage_Size:: 
499 Program Unit Level Restrictions
501 * No_Elaboration_Code:: 
502 * No_Entry_Queue:: 
503 * No_Implementation_Aspect_Specifications:: 
504 * No_Implementation_Attributes:: 
505 * No_Implementation_Identifiers:: 
506 * No_Implementation_Pragmas:: 
507 * No_Implementation_Restrictions:: 
508 * No_Implementation_Units:: 
509 * No_Implicit_Aliasing:: 
510 * No_Obsolescent_Features:: 
511 * No_Wide_Characters:: 
512 * SPARK_05:: 
514 Implementation Advice
516 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
517 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
518 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
519 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
520 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
521 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
522 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
523 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
524 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
525 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
526 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
527 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
528 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
529 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
530 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
531 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
532 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
533 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
534 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
535 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
536 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
537 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
538 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
539 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
540 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
541 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
542 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
543 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
544 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
545 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
546 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
547 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
548 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
549 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
550 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
551 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
552 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
553 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
554 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
555 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
556 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
557 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
558 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
559 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
560 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
561 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
562 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
563 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
564 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
565 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
566 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
567 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
568 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
569 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
570 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
571 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
572 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
573 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
574 * RM G; Numerics: RM G Numerics. 
575 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
576 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
577 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
578 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
579 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
581 Intrinsic Subprograms
583 * Intrinsic Operators:: 
584 * Compilation_Date:: 
585 * Compilation_Time:: 
586 * Enclosing_Entity:: 
587 * Exception_Information:: 
588 * Exception_Message:: 
589 * Exception_Name:: 
590 * File:: 
591 * Line:: 
592 * Shifts and Rotates:: 
593 * Source_Location:: 
595 Representation Clauses and Pragmas
597 * Alignment Clauses:: 
598 * Size Clauses:: 
599 * Storage_Size Clauses:: 
600 * Size of Variant Record Objects:: 
601 * Biased Representation:: 
602 * Value_Size and Object_Size Clauses:: 
603 * Component_Size Clauses:: 
604 * Bit_Order Clauses:: 
605 * Effect of Bit_Order on Byte Ordering:: 
606 * Pragma Pack for Arrays:: 
607 * Pragma Pack for Records:: 
608 * Record Representation Clauses:: 
609 * Handling of Records with Holes:: 
610 * Enumeration Clauses:: 
611 * Address Clauses:: 
612 * Use of Address Clauses for Memory-Mapped I/O:: 
613 * Effect of Convention on Representation:: 
614 * Conventions and Anonymous Access Types:: 
615 * Determining the Representations chosen by GNAT:: 
617 The Implementation of Standard I/O
619 * Standard I/O Packages:: 
620 * FORM Strings:: 
621 * Direct_IO:: 
622 * Sequential_IO:: 
623 * Text_IO:: 
624 * Wide_Text_IO:: 
625 * Wide_Wide_Text_IO:: 
626 * Stream_IO:: 
627 * Text Translation:: 
628 * Shared Files:: 
629 * Filenames encoding:: 
630 * File content encoding:: 
631 * Open Modes:: 
632 * Operations on C Streams:: 
633 * Interfacing to C Streams:: 
635 Text_IO
637 * Stream Pointer Positioning:: 
638 * Reading and Writing Non-Regular Files:: 
639 * Get_Immediate:: 
640 * Treating Text_IO Files as Streams:: 
641 * Text_IO Extensions:: 
642 * Text_IO Facilities for Unbounded Strings:: 
644 Wide_Text_IO
646 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
647 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
649 Wide_Wide_Text_IO
651 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
652 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
654 The GNAT Library
656 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
657 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
658 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
659 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
660 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
661 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
662 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
663 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
664 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
665 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
666 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
667 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
668 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
669 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
670 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
671 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
672 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
673 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
674 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
675 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
676 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
677 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
678 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
679 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
680 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
681 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
682 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
683 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
684 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
685 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
686 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
687 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
688 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
689 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
690 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
691 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
692 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
693 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
694 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
695 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
696 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
697 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
698 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
699 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
700 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
701 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
702 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
703 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
704 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
705 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
706 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
707 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
708 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
709 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
710 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
711 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
712 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
713 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
714 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
715 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
716 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
717 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
718 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
719 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
720 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
721 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
722 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
723 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
724 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
725 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
726 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
727 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
728 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
729 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
730 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
731 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
732 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
733 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
734 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
735 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
736 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
737 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
738 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
739 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
740 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
741 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
742 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
743 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
744 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
745 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
746 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
747 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
748 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
749 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
750 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
751 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
752 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
753 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
754 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
755 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
756 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
757 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
758 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
759 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
760 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
761 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
762 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
763 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
764 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
765 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
766 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
767 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
768 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
769 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
770 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
771 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
772 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
773 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
774 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
775 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
776 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
777 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
778 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
779 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
780 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
781 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
782 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
783 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
784 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
785 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
786 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
787 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
788 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
789 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
790 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
791 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
792 * System.Memory (s-memory.ads): System Memory s-memory ads. 
793 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
794 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
795 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
796 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
797 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
798 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
799 * System.Rident (s-rident.ads): System Rident s-rident ads. 
800 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
801 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
802 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
803 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
805 Interfacing to Other Languages
807 * Interfacing to C:: 
808 * Interfacing to C++:: 
809 * Interfacing to COBOL:: 
810 * Interfacing to Fortran:: 
811 * Interfacing to non-GNAT Ada code:: 
813 Implementation of Specific Ada Features
815 * Machine Code Insertions:: 
816 * GNAT Implementation of Tasking:: 
817 * GNAT Implementation of Shared Passive Packages:: 
818 * Code Generation for Array Aggregates:: 
819 * The Size of Discriminated Records with Default Discriminants:: 
820 * Strict Conformance to the Ada Reference Manual:: 
822 GNAT Implementation of Tasking
824 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
825 * Ensuring Compliance with the Real-Time Annex:: 
827 Code Generation for Array Aggregates
829 * Static constant aggregates with static bounds:: 
830 * Constant aggregates with unconstrained nominal types:: 
831 * Aggregates with static bounds:: 
832 * Aggregates with non-static bounds:: 
833 * Aggregates in assignment statements:: 
835 Obsolescent Features
837 * pragma No_Run_Time:: 
838 * pragma Ravenscar:: 
839 * pragma Restricted_Run_Time:: 
840 * pragma Task_Info:: 
841 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
843 Compatibility and Porting Guide
845 * Writing Portable Fixed-Point Declarations:: 
846 * Compatibility with Ada 83:: 
847 * Compatibility between Ada 95 and Ada 2005:: 
848 * Implementation-dependent characteristics:: 
849 * Compatibility with Other Ada Systems:: 
850 * Representation Clauses:: 
851 * Compatibility with HP Ada 83:: 
853 Compatibility with Ada 83
855 * Legal Ada 83 programs that are illegal in Ada 95:: 
856 * More deterministic semantics:: 
857 * Changed semantics:: 
858 * Other language compatibility issues:: 
860 Implementation-dependent characteristics
862 * Implementation-defined pragmas:: 
863 * Implementation-defined attributes:: 
864 * Libraries:: 
865 * Elaboration order:: 
866 * Target-specific aspects:: 
868 @end detailmenu
869 @end menu
871 @node About This Guide,Implementation Defined Pragmas,Top,Top
872 @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}
873 @chapter About This Guide
877 This manual contains useful information in writing programs using the
878 GNAT compiler.  It includes information on implementation dependent
879 characteristics of GNAT, including all the information required by
880 Annex M of the Ada language standard.
882 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
883 invoked in Ada 83 compatibility mode.
884 By default, GNAT assumes Ada 2012,
885 but you can override with a compiler switch
886 to explicitly specify the language version.
887 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
888 Throughout this manual, references to 'Ada' without a year suffix
889 apply to all the Ada versions of the language.
891 Ada is designed to be highly portable.
892 In general, a program will have the same effect even when compiled by
893 different compilers on different platforms.
894 However, since Ada is designed to be used in a
895 wide variety of applications, it also contains a number of system
896 dependent features to be used in interfacing to the external world.
897 .. index:: Implementation-dependent features
899 @geindex Portability
901 Note: Any program that makes use of implementation-dependent features
902 may be non-portable.  You should follow good programming practice and
903 isolate and clearly document any sections of your program that make use
904 of these features in a non-portable manner.
906 @menu
907 * What This Reference Manual Contains:: 
908 * Conventions:: 
909 * Related Information:: 
911 @end menu
913 @node What This Reference Manual Contains,Conventions,,About This Guide
914 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
915 @section What This Reference Manual Contains
918 This reference manual contains the following chapters:
921 @itemize *
923 @item 
924 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
925 pragmas, which can be used to extend and enhance the functionality of the
926 compiler.
928 @item 
929 @ref{8,,Implementation Defined Attributes}, lists GNAT
930 implementation-dependent attributes, which can be used to extend and
931 enhance the functionality of the compiler.
933 @item 
934 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
935 implementation-dependent restrictions, which can be used to extend and
936 enhance the functionality of the compiler.
938 @item 
939 @ref{a,,Implementation Advice}, provides information on generally
940 desirable behavior which are not requirements that all compilers must
941 follow since it cannot be provided on all systems, or which may be
942 undesirable on some systems.
944 @item 
945 @ref{b,,Implementation Defined Characteristics}, provides a guide to
946 minimizing implementation dependent features.
948 @item 
949 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
950 implemented by GNAT, and how they can be imported into user
951 application programs.
953 @item 
954 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
955 way that GNAT represents data, and in particular the exact set
956 of representation clauses and pragmas that is accepted.
958 @item 
959 @ref{e,,Standard Library Routines}, provides a listing of packages and a
960 brief description of the functionality that is provided by Ada's
961 extensive set of standard library routines as implemented by GNAT.
963 @item 
964 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
965 implementation of the input-output facilities.
967 @item 
968 @ref{10,,The GNAT Library}, is a catalog of packages that complement
969 the Ada predefined library.
971 @item 
972 @ref{11,,Interfacing to Other Languages}, describes how programs
973 written in Ada using GNAT can be interfaced to other programming
974 languages.
976 @item 
977 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
978 of the specialized needs annexes.
980 @item 
981 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
982 to GNAT's implementation of machine code insertions, tasking, and several
983 other features.
985 @item 
986 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
987 GNAT implementation of the Ada 2012 language standard.
989 @item 
990 @ref{15,,Obsolescent Features} documents implementation dependent features,
991 including pragmas and attributes, which are considered obsolescent, since
992 there are other preferred ways of achieving the same results. These
993 obsolescent forms are retained for backwards compatibility.
995 @item 
996 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
997 developing portable Ada code, describes the compatibility issues that
998 may arise between GNAT and other Ada compilation systems (including those
999 for Ada 83), and shows how GNAT can expedite porting applications
1000 developed in other Ada environments.
1002 @item 
1003 @ref{1,,GNU Free Documentation License} contains the license for this document.
1004 @end itemize
1006 @geindex Ada 95 Language Reference Manual
1008 @geindex Ada 2005 Language Reference Manual
1010 This reference manual assumes a basic familiarity with the Ada 95 language, as
1011 described in the
1012 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1013 It does not require knowledge of the new features introduced by Ada 2005 or
1014 Ada 2012.
1015 All three reference manuals are included in the GNAT documentation
1016 package.
1018 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1019 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1020 @section Conventions
1023 @geindex Conventions
1024 @geindex typographical
1026 @geindex Typographical conventions
1028 Following are examples of the typographical and graphic conventions used
1029 in this guide:
1032 @itemize *
1034 @item 
1035 @cite{Functions}, @cite{utility program names}, @cite{standard names},
1036 and @cite{classes}.
1038 @item 
1039 @cite{Option flags}
1041 @item 
1042 @code{File names}
1044 @item 
1045 @cite{Variables}
1047 @item 
1048 @emph{Emphasis}
1050 @item 
1051 [optional information or parameters]
1053 @item 
1054 Examples are described by text
1056 @example
1057 and then shown this way.
1058 @end example
1060 @item 
1061 Commands that are entered by the user are shown as preceded by a prompt string
1062 comprising the @code{$} character followed by a space.
1063 @end itemize
1065 @node Related Information,,Conventions,About This Guide
1066 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1067 @section Related Information
1070 See the following documents for further information on GNAT:
1073 @itemize *
1075 @item 
1076 @cite{GNAT User's Guide for Native Platforms},
1077 which provides information on how to use the
1078 GNAT development environment.
1080 @item 
1081 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1083 @item 
1084 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1085 of the Ada 95 standard.  The annotations describe
1086 detailed aspects of the design decision, and in particular contain useful
1087 sections on Ada 83 compatibility.
1089 @item 
1090 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1092 @item 
1093 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1094 of the Ada 2005 standard.  The annotations describe
1095 detailed aspects of the design decision.
1097 @item 
1098 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1100 @item 
1101 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1102 which contains specific information on compatibility between GNAT and
1103 DEC Ada 83 systems.
1105 @item 
1106 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1107 describes in detail the pragmas and attributes provided by the DEC Ada 83
1108 compiler system.
1109 @end itemize
1111 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1112 @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}
1113 @chapter Implementation Defined Pragmas
1116 Ada defines a set of pragmas that can be used to supply additional
1117 information to the compiler.  These language defined pragmas are
1118 implemented in GNAT and work as described in the Ada Reference Manual.
1120 In addition, Ada allows implementations to define additional pragmas
1121 whose meaning is defined by the implementation.  GNAT provides a number
1122 of these implementation-defined pragmas, which can be used to extend
1123 and enhance the functionality of the compiler.  This section of the GNAT
1124 Reference Manual describes these additional pragmas.
1126 Note that any program using these pragmas might not be portable to other
1127 compilers (although GNAT implements this set of pragmas on all
1128 platforms).  Therefore if portability to other compilers is an important
1129 consideration, the use of these pragmas should be minimized.
1131 @menu
1132 * Pragma Abort_Defer:: 
1133 * Pragma Abstract_State:: 
1134 * Pragma Ada_83:: 
1135 * Pragma Ada_95:: 
1136 * Pragma Ada_05:: 
1137 * Pragma Ada_2005:: 
1138 * Pragma Ada_12:: 
1139 * Pragma Ada_2012:: 
1140 * Pragma Allow_Integer_Address:: 
1141 * Pragma Annotate:: 
1142 * Pragma Assert:: 
1143 * Pragma Assert_And_Cut:: 
1144 * Pragma Assertion_Policy:: 
1145 * Pragma Assume:: 
1146 * Pragma Assume_No_Invalid_Values:: 
1147 * Pragma Async_Readers:: 
1148 * Pragma Async_Writers:: 
1149 * Pragma Attribute_Definition:: 
1150 * Pragma C_Pass_By_Copy:: 
1151 * Pragma Check:: 
1152 * Pragma Check_Float_Overflow:: 
1153 * Pragma Check_Name:: 
1154 * Pragma Check_Policy:: 
1155 * Pragma CIL_Constructor:: 
1156 * Pragma Comment:: 
1157 * Pragma Common_Object:: 
1158 * Pragma Compile_Time_Error:: 
1159 * Pragma Compile_Time_Warning:: 
1160 * Pragma Compiler_Unit:: 
1161 * Pragma Compiler_Unit_Warning:: 
1162 * Pragma Complete_Representation:: 
1163 * Pragma Complex_Representation:: 
1164 * Pragma Component_Alignment:: 
1165 * Pragma Contract_Cases:: 
1166 * Pragma Convention_Identifier:: 
1167 * Pragma CPP_Class:: 
1168 * Pragma CPP_Constructor:: 
1169 * Pragma CPP_Virtual:: 
1170 * Pragma CPP_Vtable:: 
1171 * Pragma CPU:: 
1172 * Pragma Debug:: 
1173 * Pragma Debug_Policy:: 
1174 * Pragma Default_Scalar_Storage_Order:: 
1175 * Pragma Default_Storage_Pool:: 
1176 * Pragma Depends:: 
1177 * Pragma Detect_Blocking:: 
1178 * Pragma Disable_Atomic_Synchronization:: 
1179 * Pragma Dispatching_Domain:: 
1180 * Pragma Effective_Reads:: 
1181 * Pragma Effective_Writes:: 
1182 * Pragma Elaboration_Checks:: 
1183 * Pragma Eliminate:: 
1184 * Pragma Enable_Atomic_Synchronization:: 
1185 * Pragma Export_Function:: 
1186 * Pragma Export_Object:: 
1187 * Pragma Export_Procedure:: 
1188 * Pragma Export_Value:: 
1189 * Pragma Export_Valued_Procedure:: 
1190 * Pragma Extend_System:: 
1191 * Pragma Extensions_Allowed:: 
1192 * Pragma External:: 
1193 * Pragma External_Name_Casing:: 
1194 * Pragma Fast_Math:: 
1195 * Pragma Favor_Top_Level:: 
1196 * Pragma Finalize_Storage_Only:: 
1197 * Pragma Float_Representation:: 
1198 * Pragma Global:: 
1199 * Pragma Ident:: 
1200 * Pragma Ignore_Pragma:: 
1201 * Pragma Implementation_Defined:: 
1202 * Pragma Implemented:: 
1203 * Pragma Implicit_Packing:: 
1204 * Pragma Import_Function:: 
1205 * Pragma Import_Object:: 
1206 * Pragma Import_Procedure:: 
1207 * Pragma Import_Valued_Procedure:: 
1208 * Pragma Independent:: 
1209 * Pragma Independent_Components:: 
1210 * Pragma Initial_Condition:: 
1211 * Pragma Initialize_Scalars:: 
1212 * Pragma Initializes:: 
1213 * Pragma Inline_Always:: 
1214 * Pragma Inline_Generic:: 
1215 * Pragma Interface:: 
1216 * Pragma Interface_Name:: 
1217 * Pragma Interrupt_Handler:: 
1218 * Pragma Interrupt_State:: 
1219 * Pragma Invariant:: 
1220 * Pragma Java_Constructor:: 
1221 * Pragma Java_Interface:: 
1222 * Pragma Keep_Names:: 
1223 * Pragma License:: 
1224 * Pragma Link_With:: 
1225 * Pragma Linker_Alias:: 
1226 * Pragma Linker_Constructor:: 
1227 * Pragma Linker_Destructor:: 
1228 * Pragma Linker_Section:: 
1229 * Pragma Lock_Free:: 
1230 * Pragma Loop_Invariant:: 
1231 * Pragma Loop_Optimize:: 
1232 * Pragma Loop_Variant:: 
1233 * Pragma Machine_Attribute:: 
1234 * Pragma Main:: 
1235 * Pragma Main_Storage:: 
1236 * Pragma No_Body:: 
1237 * Pragma No_Elaboration_Code_All:: 
1238 * Pragma No_Inline:: 
1239 * Pragma No_Return:: 
1240 * Pragma No_Run_Time:: 
1241 * Pragma No_Strict_Aliasing:: 
1242 * Pragma No_Tagged_Streams:: 
1243 * Pragma Normalize_Scalars:: 
1244 * Pragma Obsolescent:: 
1245 * Pragma Optimize_Alignment:: 
1246 * Pragma Ordered:: 
1247 * Pragma Overflow_Mode:: 
1248 * Pragma Overriding_Renamings:: 
1249 * Pragma Partition_Elaboration_Policy:: 
1250 * Pragma Part_Of:: 
1251 * Pragma Passive:: 
1252 * Pragma Persistent_BSS:: 
1253 * Pragma Polling:: 
1254 * Pragma Post:: 
1255 * Pragma Postcondition:: 
1256 * Pragma Post_Class:: 
1257 * Pragma Pre:: 
1258 * Pragma Precondition:: 
1259 * Pragma Predicate:: 
1260 * Pragma Preelaborable_Initialization:: 
1261 * Pragma Prefix_Exception_Messages:: 
1262 * Pragma Pre_Class:: 
1263 * Pragma Priority_Specific_Dispatching:: 
1264 * Pragma Profile:: 
1265 * Pragma Profile_Warnings:: 
1266 * Pragma Propagate_Exceptions:: 
1267 * Pragma Provide_Shift_Operators:: 
1268 * Pragma Psect_Object:: 
1269 * Pragma Pure_Function:: 
1270 * Pragma Rational:: 
1271 * Pragma Ravenscar:: 
1272 * Pragma Refined_Depends:: 
1273 * Pragma Refined_Global:: 
1274 * Pragma Refined_Post:: 
1275 * Pragma Refined_State:: 
1276 * Pragma Relative_Deadline:: 
1277 * Pragma Remote_Access_Type:: 
1278 * Pragma Restricted_Run_Time:: 
1279 * Pragma Restriction_Warnings:: 
1280 * Pragma Reviewable:: 
1281 * Pragma Share_Generic:: 
1282 * Pragma Shared:: 
1283 * Pragma Short_Circuit_And_Or:: 
1284 * Pragma Short_Descriptors:: 
1285 * Pragma Simple_Storage_Pool_Type:: 
1286 * Pragma Source_File_Name:: 
1287 * Pragma Source_File_Name_Project:: 
1288 * Pragma Source_Reference:: 
1289 * Pragma SPARK_Mode:: 
1290 * Pragma Static_Elaboration_Desired:: 
1291 * Pragma Stream_Convert:: 
1292 * Pragma Style_Checks:: 
1293 * Pragma Subtitle:: 
1294 * Pragma Suppress:: 
1295 * Pragma Suppress_All:: 
1296 * Pragma Suppress_Debug_Info:: 
1297 * Pragma Suppress_Exception_Locations:: 
1298 * Pragma Suppress_Initialization:: 
1299 * Pragma Task_Name:: 
1300 * Pragma Task_Storage:: 
1301 * Pragma Test_Case:: 
1302 * Pragma Thread_Local_Storage:: 
1303 * Pragma Time_Slice:: 
1304 * Pragma Title:: 
1305 * Pragma Type_Invariant:: 
1306 * Pragma Type_Invariant_Class:: 
1307 * Pragma Unchecked_Union:: 
1308 * Pragma Unevaluated_Use_Of_Old:: 
1309 * Pragma Unimplemented_Unit:: 
1310 * Pragma Universal_Aliasing:: 
1311 * Pragma Universal_Data:: 
1312 * Pragma Unmodified:: 
1313 * Pragma Unreferenced:: 
1314 * Pragma Unreferenced_Objects:: 
1315 * Pragma Unreserve_All_Interrupts:: 
1316 * Pragma Unsuppress:: 
1317 * Pragma Use_VADS_Size:: 
1318 * Pragma Validity_Checks:: 
1319 * Pragma Volatile:: 
1320 * Pragma Volatile_Full_Access:: 
1321 * Pragma Warning_As_Error:: 
1322 * Pragma Warnings:: 
1323 * Pragma Weak_External:: 
1324 * Pragma Wide_Character_Encoding:: 
1326 @end menu
1328 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1329 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1330 @section Pragma Abort_Defer
1333 @geindex Deferring aborts
1335 Syntax:
1337 @example
1338 pragma Abort_Defer;
1339 @end example
1341 This pragma must appear at the start of the statement sequence of a
1342 handled sequence of statements (right after the @cite{begin}).  It has
1343 the effect of deferring aborts for the sequence of statements (but not
1344 for the declarations or handlers, if any, associated with this statement
1345 sequence).
1347 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1348 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}
1349 @section Pragma Abstract_State
1352 For the description of this pragma, see SPARK 2014 Reference Manual,
1353 section 7.1.4.
1355 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1356 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1d}
1357 @section Pragma Ada_83
1360 Syntax:
1362 @example
1363 pragma Ada_83;
1364 @end example
1366 A configuration pragma that establishes Ada 83 mode for the unit to
1367 which it applies, regardless of the mode set by the command line
1368 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1369 the syntax and semantics of Ada 83, as defined in the original Ada
1370 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1371 and Ada 2005 are not recognized, optional package bodies are allowed,
1372 and generics may name types with unknown discriminants without using
1373 the @cite{(<>)} notation.  In addition, some but not all of the additional
1374 restrictions of Ada 83 are enforced.
1376 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1377 Ada 83 code to be compiled and adapted to GNAT with less effort.
1378 Secondly, it aids in keeping code backwards compatible with Ada 83.
1379 However, there is no guarantee that code that is processed correctly
1380 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1381 83 compiler, since GNAT does not enforce all the additional checks
1382 required by Ada 83.
1384 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1385 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{1e}
1386 @section Pragma Ada_95
1389 Syntax:
1391 @example
1392 pragma Ada_95;
1393 @end example
1395 A configuration pragma that establishes Ada 95 mode for the unit to which
1396 it applies, regardless of the mode set by the command line switches.
1397 This mode is set automatically for the @cite{Ada} and @cite{System}
1398 packages and their children, so you need not specify it in these
1399 contexts.  This pragma is useful when writing a reusable component that
1400 itself uses Ada 95 features, but which is intended to be usable from
1401 either Ada 83 or Ada 95 programs.
1403 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1404 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{1f}
1405 @section Pragma Ada_05
1408 Syntax:
1410 @example
1411 pragma Ada_05;
1412 pragma Ada_05 (local_NAME);
1413 @end example
1415 A configuration pragma that establishes Ada 2005 mode for the unit to which
1416 it applies, regardless of the mode set by the command line switches.
1417 This pragma is useful when writing a reusable component that
1418 itself uses Ada 2005 features, but which is intended to be usable from
1419 either Ada 83 or Ada 95 programs.
1421 The one argument form (which is not a configuration pragma)
1422 is used for managing the transition from
1423 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1424 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1425 mode will generate a warning. In addition, in Ada_83 or Ada_95
1426 mode, a preference rule is established which does not choose
1427 such an entity unless it is unambiguously specified. This avoids
1428 extra subprograms marked this way from generating ambiguities in
1429 otherwise legal pre-Ada_2005 programs. The one argument form is
1430 intended for exclusive use in the GNAT run-time library.
1432 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1433 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{20}
1434 @section Pragma Ada_2005
1437 Syntax:
1439 @example
1440 pragma Ada_2005;
1441 @end example
1443 This configuration pragma is a synonym for pragma Ada_05 and has the
1444 same syntax and effect.
1446 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1447 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{21}
1448 @section Pragma Ada_12
1451 Syntax:
1453 @example
1454 pragma Ada_12;
1455 pragma Ada_12 (local_NAME);
1456 @end example
1458 A configuration pragma that establishes Ada 2012 mode for the unit to which
1459 it applies, regardless of the mode set by the command line switches.
1460 This mode is set automatically for the @cite{Ada} and @cite{System}
1461 packages and their children, so you need not specify it in these
1462 contexts.  This pragma is useful when writing a reusable component that
1463 itself uses Ada 2012 features, but which is intended to be usable from
1464 Ada 83, Ada 95, or Ada 2005 programs.
1466 The one argument form, which is not a configuration pragma,
1467 is used for managing the transition from Ada
1468 2005 to Ada 2012 in the run-time library. If an entity is marked
1469 as Ada_201 only, then referencing the entity in any pre-Ada_2012
1470 mode will generate a warning. In addition, in any pre-Ada_2012
1471 mode, a preference rule is established which does not choose
1472 such an entity unless it is unambiguously specified. This avoids
1473 extra subprograms marked this way from generating ambiguities in
1474 otherwise legal pre-Ada_2012 programs. The one argument form is
1475 intended for exclusive use in the GNAT run-time library.
1477 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1478 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{22}
1479 @section Pragma Ada_2012
1482 Syntax:
1484 @example
1485 pragma Ada_2012;
1486 @end example
1488 This configuration pragma is a synonym for pragma Ada_12 and has the
1489 same syntax and effect.
1491 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1492 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{23}
1493 @section Pragma Allow_Integer_Address
1496 Syntax:
1498 @example
1499 pragma Allow_Integer_Address;
1500 @end example
1502 In almost all versions of GNAT, @cite{System.Address} is a private
1503 type in accordance with the implementation advice in the RM. This
1504 means that integer values,
1505 in particular integer literals, are not allowed as address values.
1506 If the configuration pragma
1507 @cite{Allow_Integer_Address} is given, then integer expressions may
1508 be used anywhere a value of type @cite{System.Address} is required.
1509 The effect is to introduce an implicit unchecked conversion from the
1510 integer value to type @cite{System.Address}. The reverse case of using
1511 an address where an integer type is required is handled analogously.
1512 The following example compiles without errors:
1514 @example
1515 pragma Allow_Integer_Address;
1516 with System; use System;
1517 package AddrAsInt is
1518    X : Integer;
1519    Y : Integer;
1520    for X'Address use 16#1240#;
1521    for Y use at 16#3230#;
1522    m : Address := 16#4000#;
1523    n : constant Address := 4000;
1524    p : constant Address := Address (X + Y);
1525    v : Integer := y'Address;
1526    w : constant Integer := Integer (Y'Address);
1527    type R is new integer;
1528    RR : R := 1000;
1529    Z : Integer;
1530    for Z'Address use RR;
1531 end AddrAsInt;
1532 @end example
1534 Note that pragma @cite{Allow_Integer_Address} is ignored if @cite{System.Address}
1535 is not a private type. In implementations of @cite{GNAT} where
1536 System.Address is a visible integer type,
1537 this pragma serves no purpose but is ignored
1538 rather than rejected to allow common sets of sources to be used
1539 in the two situations.
1541 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1542 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{24}
1543 @section Pragma Annotate
1546 Syntax:
1548 @example
1549 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1551 ARG ::= NAME | EXPRESSION
1552 @end example
1554 This pragma is used to annotate programs.  @cite{identifier} identifies
1555 the type of annotation.  GNAT verifies that it is an identifier, but does
1556 not otherwise analyze it. The second optional identifier is also left
1557 unanalyzed, and by convention is used to control the action of the tool to
1558 which the annotation is addressed.  The remaining @cite{arg} arguments
1559 can be either string literals or more generally expressions.
1560 String literals are assumed to be either of type
1561 @cite{Standard.String} or else @cite{Wide_String} or @cite{Wide_Wide_String}
1562 depending on the character literals they contain.
1563 All other kinds of arguments are analyzed as expressions, and must be
1564 unambiguous. The last argument if present must have the identifier
1565 @cite{Entity} and GNAT verifies that a local name is given.
1567 The analyzed pragma is retained in the tree, but not otherwise processed
1568 by any part of the GNAT compiler, except to generate corresponding note
1569 lines in the generated ALI file. For the format of these note lines, see
1570 the compiler source file lib-writ.ads. This pragma is intended for use by
1571 external tools, including ASIS. The use of pragma Annotate does not
1572 affect the compilation process in any way. This pragma may be used as
1573 a configuration pragma.
1575 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1576 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{25}
1577 @section Pragma Assert
1580 Syntax:
1582 @example
1583 pragma Assert (
1584   boolean_EXPRESSION
1585   [, string_EXPRESSION]);
1586 @end example
1588 The effect of this pragma depends on whether the corresponding command
1589 line switch is set to activate assertions.  The pragma expands into code
1590 equivalent to the following:
1592 @example
1593 if assertions-enabled then
1594    if not boolean_EXPRESSION then
1595       System.Assertions.Raise_Assert_Failure
1596         (string_EXPRESSION);
1597    end if;
1598 end if;
1599 @end example
1601 The string argument, if given, is the message that will be associated
1602 with the exception occurrence if the exception is raised.  If no second
1603 argument is given, the default message is @cite{file}:@cite{nnn},
1604 where @cite{file} is the name of the source file containing the assert,
1605 and @cite{nnn} is the line number of the assert.  A pragma is not a
1606 statement, so if a statement sequence contains nothing but a pragma
1607 assert, then a null statement is required in addition, as in:
1609 @example
1611 if J > 3 then
1612    pragma Assert (K > 3, "Bad value for K");
1613    null;
1614 end if;
1615 @end example
1617 Note that, as with the @cite{if} statement to which it is equivalent, the
1618 type of the expression is either @cite{Standard.Boolean}, or any type derived
1619 from this standard type.
1621 Assert checks can be either checked or ignored. By default they are ignored.
1622 They will be checked if either the command line switch @emph{-gnata} is
1623 used, or if an @cite{Assertion_Policy} or @cite{Check_Policy} pragma is used
1624 to enable @cite{Assert_Checks}.
1626 If assertions are ignored, then there
1627 is no run-time effect (and in particular, any side effects from the
1628 expression will not occur at run time).  (The expression is still
1629 analyzed at compile time, and may cause types to be frozen if they are
1630 mentioned here for the first time).
1632 If assertions are checked, then the given expression is tested, and if
1633 it is @cite{False} then @cite{System.Assertions.Raise_Assert_Failure} is called
1634 which results in the raising of @cite{Assert_Failure} with the given message.
1636 You should generally avoid side effects in the expression arguments of
1637 this pragma, because these side effects will turn on and off with the
1638 setting of the assertions mode, resulting in assertions that have an
1639 effect on the program.  However, the expressions are analyzed for
1640 semantic correctness whether or not assertions are enabled, so turning
1641 assertions on and off cannot affect the legality of a program.
1643 Note that the implementation defined policy @cite{DISABLE}, given in a
1644 pragma @cite{Assertion_Policy}, can be used to suppress this semantic analysis.
1646 Note: this is a standard language-defined pragma in versions
1647 of Ada from 2005 on. In GNAT, it is implemented in all versions
1648 of Ada, and the DISABLE policy is an implementation-defined
1649 addition.
1651 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1652 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{26}
1653 @section Pragma Assert_And_Cut
1656 Syntax:
1658 @example
1659 pragma Assert_And_Cut (
1660   boolean_EXPRESSION
1661   [, string_EXPRESSION]);
1662 @end example
1664 The effect of this pragma is identical to that of pragma @cite{Assert},
1665 except that in an @cite{Assertion_Policy} pragma, the identifier
1666 @cite{Assert_And_Cut} is used to control whether it is ignored or checked
1667 (or disabled).
1669 The intention is that this be used within a subprogram when the
1670 given test expresion sums up all the work done so far in the
1671 subprogram, so that the rest of the subprogram can be verified
1672 (informally or formally) using only the entry preconditions,
1673 and the expression in this pragma. This allows dividing up
1674 a subprogram into sections for the purposes of testing or
1675 formal verification. The pragma also serves as useful
1676 documentation.
1678 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1679 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{27}
1680 @section Pragma Assertion_Policy
1683 Syntax:
1685 @example
1686 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1688 pragma Assertion_Policy (
1689     ASSERTION_KIND => POLICY_IDENTIFIER
1690  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1692 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1694 RM_ASSERTION_KIND ::= Assert               |
1695                       Static_Predicate     |
1696                       Dynamic_Predicate    |
1697                       Pre                  |
1698                       Pre'Class            |
1699                       Post                 |
1700                       Post'Class           |
1701                       Type_Invariant       |
1702                       Type_Invariant'Class
1704 ID_ASSERTION_KIND ::= Assertions           |
1705                       Assert_And_Cut       |
1706                       Assume               |
1707                       Contract_Cases       |
1708                       Debug                |
1709                       Invariant            |
1710                       Invariant'Class      |
1711                       Loop_Invariant       |
1712                       Loop_Variant         |
1713                       Postcondition        |
1714                       Precondition         |
1715                       Predicate            |
1716                       Refined_Post         |
1717                       Statement_Assertions
1719 POLICY_IDENTIFIER ::= Check | Disable | Ignore
1720 @end example
1722 This is a standard Ada 2012 pragma that is available as an
1723 implementation-defined pragma in earlier versions of Ada.
1724 The assertion kinds @cite{RM_ASSERTION_KIND} are those defined in
1725 the Ada standard. The assertion kinds @cite{ID_ASSERTION_KIND}
1726 are implementation defined additions recognized by the GNAT compiler.
1728 The pragma applies in both cases to pragmas and aspects with matching
1729 names, e.g. @cite{Pre} applies to the Pre aspect, and @cite{Precondition}
1730 applies to both the @cite{Precondition} pragma
1731 and the aspect @cite{Precondition}. Note that the identifiers for
1732 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1733 Pre_Class and Post_Class), since these pragmas are intended to be
1734 identical to the corresponding aspects).
1736 If the policy is @cite{CHECK}, then assertions are enabled, i.e.
1737 the corresponding pragma or aspect is activated.
1738 If the policy is @cite{IGNORE}, then assertions are ignored, i.e.
1739 the corresponding pragma or aspect is deactivated.
1740 This pragma overrides the effect of the @emph{-gnata} switch on the
1741 command line.
1743 The implementation defined policy @cite{DISABLE} is like
1744 @cite{IGNORE} except that it completely disables semantic
1745 checking of the corresponding pragma or aspect. This is
1746 useful when the pragma or aspect argument references subprograms
1747 in a with'ed package which is replaced by a dummy package
1748 for the final build.
1750 The implementation defined assertion kind @cite{Assertions} applies to all
1751 assertion kinds. The form with no assertion kind given implies this
1752 choice, so it applies to all assertion kinds (RM defined, and
1753 implementation defined).
1755 The implementation defined assertion kind @cite{Statement_Assertions}
1756 applies to @cite{Assert}, @cite{Assert_And_Cut},
1757 @cite{Assume}, @cite{Loop_Invariant}, and @cite{Loop_Variant}.
1759 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1760 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{28}
1761 @section Pragma Assume
1764 Syntax:
1766 @example
1767 pragma Assume (
1768   boolean_EXPRESSION
1769   [, string_EXPRESSION]);
1770 @end example
1772 The effect of this pragma is identical to that of pragma @cite{Assert},
1773 except that in an @cite{Assertion_Policy} pragma, the identifier
1774 @cite{Assume} is used to control whether it is ignored or checked
1775 (or disabled).
1777 The intention is that this be used for assumptions about the
1778 external environment. So you cannot expect to verify formally
1779 or informally that the condition is met, this must be
1780 established by examining things outside the program itself.
1781 For example, we may have code that depends on the size of
1782 @cite{Long_Long_Integer} being at least 64. So we could write:
1784 @example
1785 pragma Assume (Long_Long_Integer'Size >= 64);
1786 @end example
1788 This assumption cannot be proved from the program itself,
1789 but it acts as a useful run-time check that the assumption
1790 is met, and documents the need to ensure that it is met by
1791 reference to information outside the program.
1793 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1794 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{29}
1795 @section Pragma Assume_No_Invalid_Values
1798 @geindex Invalid representations
1800 @geindex Invalid values
1802 Syntax:
1804 @example
1805 pragma Assume_No_Invalid_Values (On | Off);
1806 @end example
1808 This is a configuration pragma that controls the assumptions made by the
1809 compiler about the occurrence of invalid representations (invalid values)
1810 in the code.
1812 The default behavior (corresponding to an Off argument for this pragma), is
1813 to assume that values may in general be invalid unless the compiler can
1814 prove they are valid. Consider the following example:
1816 @example
1817 V1 : Integer range 1 .. 10;
1818 V2 : Integer range 11 .. 20;
1820 for J in V2 .. V1 loop
1821    ...
1822 end loop;
1823 @end example
1825 if V1 and V2 have valid values, then the loop is known at compile
1826 time not to execute since the lower bound must be greater than the
1827 upper bound. However in default mode, no such assumption is made,
1828 and the loop may execute. If @cite{Assume_No_Invalid_Values (On)}
1829 is given, the compiler will assume that any occurrence of a variable
1830 other than in an explicit @cite{'Valid} test always has a valid
1831 value, and the loop above will be optimized away.
1833 The use of @cite{Assume_No_Invalid_Values (On)} is appropriate if
1834 you know your code is free of uninitialized variables and other
1835 possible sources of invalid representations, and may result in
1836 more efficient code. A program that accesses an invalid representation
1837 with this pragma in effect is erroneous, so no guarantees can be made
1838 about its behavior.
1840 It is peculiar though permissible to use this pragma in conjunction
1841 with validity checking (-gnatVa). In such cases, accessing invalid
1842 values will generally give an exception, though formally the program
1843 is erroneous so there are no guarantees that this will always be the
1844 case, and it is recommended that these two options not be used together.
1846 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
1847 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{2a}
1848 @section Pragma Async_Readers
1851 For the description of this pragma, see SPARK 2014 Reference Manual,
1852 section 7.1.2.
1854 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
1855 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{2b}
1856 @section Pragma Async_Writers
1859 For the description of this pragma, see SPARK 2014 Reference Manual,
1860 section 7.1.2.
1862 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
1863 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{2c}
1864 @section Pragma Attribute_Definition
1867 Syntax:
1869 @example
1870 pragma Attribute_Definition
1871   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1872    [Entity     =>] LOCAL_NAME,
1873    [Expression =>] EXPRESSION | NAME);
1874 @end example
1876 If @cite{Attribute} is a known attribute name, this pragma is equivalent to
1877 the attribute definition clause:
1879 @example
1880 for Entity'Attribute use Expression;
1881 @end example
1883 If @cite{Attribute} is not a recognized attribute name, the pragma is
1884 ignored, and a warning is emitted. This allows source
1885 code to be written that takes advantage of some new attribute, while remaining
1886 compilable with earlier compilers.
1888 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
1889 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{2d}
1890 @section Pragma C_Pass_By_Copy
1893 @geindex Passing by copy
1895 Syntax:
1897 @example
1898 pragma C_Pass_By_Copy
1899   ([Max_Size =>] static_integer_EXPRESSION);
1900 @end example
1902 Normally the default mechanism for passing C convention records to C
1903 convention subprograms is to pass them by reference, as suggested by RM
1904 B.3(69).  Use the configuration pragma @cite{C_Pass_By_Copy} to change
1905 this default, by requiring that record formal parameters be passed by
1906 copy if all of the following conditions are met:
1909 @itemize *
1911 @item 
1912 The size of the record type does not exceed the value specified for
1913 @cite{Max_Size}.
1915 @item 
1916 The record type has @cite{Convention C}.
1918 @item 
1919 The formal parameter has this record type, and the subprogram has a
1920 foreign (non-Ada) convention.
1921 @end itemize
1923 If these conditions are met the argument is passed by copy; i.e., in a
1924 manner consistent with what C expects if the corresponding formal in the
1925 C prototype is a struct (rather than a pointer to a struct).
1927 You can also pass records by copy by specifying the convention
1928 @cite{C_Pass_By_Copy} for the record type, or by using the extended
1929 @cite{Import} and @cite{Export} pragmas, which allow specification of
1930 passing mechanisms on a parameter by parameter basis.
1932 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
1933 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{2e}
1934 @section Pragma Check
1937 @geindex Assertions
1939 @geindex Named assertions
1941 Syntax:
1943 @example
1944 pragma Check (
1945      [Name    =>] CHECK_KIND,
1946      [Check   =>] Boolean_EXPRESSION
1947   [, [Message =>] string_EXPRESSION] );
1949 CHECK_KIND ::= IDENTIFIER           |
1950                Pre'Class            |
1951                Post'Class           |
1952                Type_Invariant'Class |
1953                Invariant'Class
1954 @end example
1956 This pragma is similar to the predefined pragma @cite{Assert} except that an
1957 extra identifier argument is present. In conjunction with pragma
1958 @cite{Check_Policy}, this can be used to define groups of assertions that can
1959 be independently controlled. The identifier @cite{Assertion} is special, it
1960 refers to the normal set of pragma @cite{Assert} statements.
1962 Checks introduced by this pragma are normally deactivated by default. They can
1963 be activated either by the command line option @emph{-gnata}, which turns on
1964 all checks, or individually controlled using pragma @cite{Check_Policy}.
1966 The identifiers @cite{Assertions} and @cite{Statement_Assertions} are not
1967 permitted as check kinds, since this would cause confusion with the use
1968 of these identifiers in @cite{Assertion_Policy} and @cite{Check_Policy}
1969 pragmas, where they are used to refer to sets of assertions.
1971 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
1972 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{2f}
1973 @section Pragma Check_Float_Overflow
1976 @geindex Floating-point overflow
1978 Syntax:
1980 @example
1981 pragma Check_Float_Overflow;
1982 @end example
1984 In Ada, the predefined floating-point types (@cite{Short_Float},
1985 @cite{Float}, @cite{Long_Float}, @cite{Long_Long_Float}) are
1986 defined to be @emph{unconstrained}. This means that even though each
1987 has a well-defined base range, an operation that delivers a result
1988 outside this base range is not required to raise an exception.
1989 This implementation permission accommodates the notion
1990 of infinities in IEEE floating-point, and corresponds to the
1991 efficient execution mode on most machines. GNAT will not raise
1992 overflow exceptions on these machines; instead it will generate
1993 infinities and NaN's as defined in the IEEE standard.
1995 Generating infinities, although efficient, is not always desirable.
1996 Often the preferable approach is to check for overflow, even at the
1997 (perhaps considerable) expense of run-time performance.
1998 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
1999 range constraints -- and indeed such a subtype
2000 can have the same base range as its base type. For example:
2002 @example
2003 subtype My_Float is Float range Float'Range;
2004 @end example
2006 Here @cite{My_Float} has the same range as
2007 @cite{Float} but is constrained, so operations on
2008 @cite{My_Float} values will be checked for overflow
2009 against this range.
2011 This style will achieve the desired goal, but
2012 it is often more convenient to be able to simply use
2013 the standard predefined floating-point types as long
2014 as overflow checking could be guaranteed.
2015 The @cite{Check_Float_Overflow}
2016 configuration pragma achieves this effect. If a unit is compiled
2017 subject to this configuration pragma, then all operations
2018 on predefined floating-point types including operations on
2019 base types of these floating-point types will be treated as
2020 though those types were constrained, and overflow checks
2021 will be generated. The @cite{Constraint_Error}
2022 exception is raised if the result is out of range.
2024 This mode can also be set by use of the compiler
2025 switch @emph{-gnateF}.
2027 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2028 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{30}
2029 @section Pragma Check_Name
2032 @geindex Defining check names
2034 @geindex Check names
2035 @geindex defining
2037 Syntax:
2039 @example
2040 pragma Check_Name (check_name_IDENTIFIER);
2041 @end example
2043 This is a configuration pragma that defines a new implementation
2044 defined check name (unless IDENTIFIER matches one of the predefined
2045 check names, in which case the pragma has no effect). Check names
2046 are global to a partition, so if two or more configuration pragmas
2047 are present in a partition mentioning the same name, only one new
2048 check name is introduced.
2050 An implementation defined check name introduced with this pragma may
2051 be used in only three contexts: @cite{pragma Suppress},
2052 @cite{pragma Unsuppress},
2053 and as the prefix of a @cite{Check_Name'Enabled} attribute reference. For
2054 any of these three cases, the check name must be visible. A check
2055 name is visible if it is in the configuration pragmas applying to
2056 the current unit, or if it appears at the start of any unit that
2057 is part of the dependency set of the current unit (e.g., units that
2058 are mentioned in @cite{with} clauses).
2060 Check names introduced by this pragma are subject to control by compiler
2061 switches (in particular -gnatp) in the usual manner.
2063 @node Pragma Check_Policy,Pragma CIL_Constructor,Pragma Check_Name,Implementation Defined Pragmas
2064 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{31}
2065 @section Pragma Check_Policy
2068 @geindex Controlling assertions
2070 @geindex Assertions
2071 @geindex control
2073 @geindex Check pragma control
2075 @geindex Named assertions
2077 Syntax:
2079 @example
2080 pragma Check_Policy
2081  ([Name   =>] CHECK_KIND,
2082   [Policy =>] POLICY_IDENTIFIER);
2084 pragma Check_Policy (
2085     CHECK_KIND => POLICY_IDENTIFIER
2086  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2088 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2090 CHECK_KIND ::= IDENTIFIER           |
2091                Pre'Class            |
2092                Post'Class           |
2093                Type_Invariant'Class |
2094                Invariant'Class
2096 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2097 avoids confusion between the two possible syntax forms for this pragma.
2099 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2100 @end example
2102 This pragma is used to set the checking policy for assertions (specified
2103 by aspects or pragmas), the @cite{Debug} pragma, or additional checks
2104 to be checked using the @cite{Check} pragma. It may appear either as
2105 a configuration pragma, or within a declarative part of package. In the
2106 latter case, it applies from the point where it appears to the end of
2107 the declarative region (like pragma @cite{Suppress}).
2109 The @cite{Check_Policy} pragma is similar to the
2110 predefined @cite{Assertion_Policy} pragma,
2111 and if the check kind corresponds to one of the assertion kinds that
2112 are allowed by @cite{Assertion_Policy}, then the effect is identical.
2114 If the first argument is Debug, then the policy applies to Debug pragmas,
2115 disabling their effect if the policy is @cite{OFF}, @cite{DISABLE}, or
2116 @cite{IGNORE}, and allowing them to execute with normal semantics if
2117 the policy is @cite{ON} or @cite{CHECK}. In addition if the policy is
2118 @cite{DISABLE}, then the procedure call in @cite{Debug} pragmas will
2119 be totally ignored and not analyzed semantically.
2121 Finally the first argument may be some other identifier than the above
2122 possibilities, in which case it controls a set of named assertions
2123 that can be checked using pragma @cite{Check}. For example, if the pragma:
2125 @example
2126 pragma Check_Policy (Critical_Error, OFF);
2127 @end example
2129 is given, then subsequent @cite{Check} pragmas whose first argument is also
2130 @cite{Critical_Error} will be disabled.
2132 The check policy is @cite{OFF} to turn off corresponding checks, and @cite{ON}
2133 to turn on corresponding checks. The default for a set of checks for which no
2134 @cite{Check_Policy} is given is @cite{OFF} unless the compiler switch
2135 @emph{-gnata} is given, which turns on all checks by default.
2137 The check policy settings @cite{CHECK} and @cite{IGNORE} are recognized
2138 as synonyms for @cite{ON} and @cite{OFF}. These synonyms are provided for
2139 compatibility with the standard @cite{Assertion_Policy} pragma. The check
2140 policy setting @cite{DISABLE} causes the second argument of a corresponding
2141 @cite{Check} pragma to be completely ignored and not analyzed.
2143 @node Pragma CIL_Constructor,Pragma Comment,Pragma Check_Policy,Implementation Defined Pragmas
2144 @anchor{gnat_rm/implementation_defined_pragmas pragma-cil-constructor}@anchor{32}
2145 @section Pragma CIL_Constructor
2148 Syntax:
2150 @example
2151 pragma CIL_Constructor ([Entity =>] function_LOCAL_NAME);
2152 @end example
2154 This pragma is used to assert that the specified Ada function should be
2155 mapped to the .NET constructor for some Ada tagged record type.
2157 See section 4.1 of the
2158 @cite{GNAT User's Guide: Supplement for the .NET Platform.}
2159 for related information.
2161 @node Pragma Comment,Pragma Common_Object,Pragma CIL_Constructor,Implementation Defined Pragmas
2162 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{33}
2163 @section Pragma Comment
2166 Syntax:
2168 @example
2169 pragma Comment (static_string_EXPRESSION);
2170 @end example
2172 This is almost identical in effect to pragma @cite{Ident}.  It allows the
2173 placement of a comment into the object file and hence into the
2174 executable file if the operating system permits such usage.  The
2175 difference is that @cite{Comment}, unlike @cite{Ident}, has
2176 no limitations on placement of the pragma (it can be placed
2177 anywhere in the main source unit), and if more than one pragma
2178 is used, all comments are retained.
2180 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2181 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{34}
2182 @section Pragma Common_Object
2185 Syntax:
2187 @example
2188 pragma Common_Object (
2189      [Internal =>] LOCAL_NAME
2190   [, [External =>] EXTERNAL_SYMBOL]
2191   [, [Size     =>] EXTERNAL_SYMBOL] );
2193 EXTERNAL_SYMBOL ::=
2194   IDENTIFIER
2195 | static_string_EXPRESSION
2196 @end example
2198 This pragma enables the shared use of variables stored in overlaid
2199 linker areas corresponding to the use of @cite{COMMON}
2200 in Fortran.  The single
2201 object @cite{LOCAL_NAME} is assigned to the area designated by
2202 the @cite{External} argument.
2203 You may define a record to correspond to a series
2204 of fields.  The @cite{Size} argument
2205 is syntax checked in GNAT, but otherwise ignored.
2207 @cite{Common_Object} is not supported on all platforms.  If no
2208 support is available, then the code generator will issue a message
2209 indicating that the necessary attribute for implementation of this
2210 pragma is not available.
2212 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2213 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{35}
2214 @section Pragma Compile_Time_Error
2217 Syntax:
2219 @example
2220 pragma Compile_Time_Error
2221          (boolean_EXPRESSION, static_string_EXPRESSION);
2222 @end example
2224 This pragma can be used to generate additional compile time
2225 error messages. It
2226 is particularly useful in generics, where errors can be issued for
2227 specific problematic instantiations. The first parameter is a boolean
2228 expression. The pragma is effective only if the value of this expression
2229 is known at compile time, and has the value True. The set of expressions
2230 whose values are known at compile time includes all static boolean
2231 expressions, and also other values which the compiler can determine
2232 at compile time (e.g., the size of a record type set by an explicit
2233 size representation clause, or the value of a variable which was
2234 initialized to a constant and is known not to have been modified).
2235 If these conditions are met, an error message is generated using
2236 the value given as the second argument. This string value may contain
2237 embedded ASCII.LF characters to break the message into multiple lines.
2239 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2240 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{36}
2241 @section Pragma Compile_Time_Warning
2244 Syntax:
2246 @example
2247 pragma Compile_Time_Warning
2248          (boolean_EXPRESSION, static_string_EXPRESSION);
2249 @end example
2251 Same as pragma Compile_Time_Error, except a warning is issued instead
2252 of an error message. Note that if this pragma is used in a package that
2253 is with'ed by a client, the client will get the warning even though it
2254 is issued by a with'ed package (normally warnings in with'ed units are
2255 suppressed, but this is a special exception to that rule).
2257 One typical use is within a generic where compile time known characteristics
2258 of formal parameters are tested, and warnings given appropriately. Another use
2259 with a first parameter of True is to warn a client about use of a package,
2260 for example that it is not fully implemented.
2262 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2263 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{37}
2264 @section Pragma Compiler_Unit
2267 Syntax:
2269 @example
2270 pragma Compiler_Unit;
2271 @end example
2273 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2274 retained so that old versions of the GNAT run-time that use this pragma can
2275 be compiled with newer versions of the compiler.
2277 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2278 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{38}
2279 @section Pragma Compiler_Unit_Warning
2282 Syntax:
2284 @example
2285 pragma Compiler_Unit_Warning;
2286 @end example
2288 This pragma is intended only for internal use in the GNAT run-time library.
2289 It indicates that the unit is used as part of the compiler build. The effect
2290 is to generate warnings for the use of constructs (for example, conditional
2291 expressions) that would cause trouble when bootstrapping using an older
2292 version of GNAT. For the exact list of restrictions, see the compiler sources
2293 and references to Check_Compiler_Unit.
2295 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2296 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{39}
2297 @section Pragma Complete_Representation
2300 Syntax:
2302 @example
2303 pragma Complete_Representation;
2304 @end example
2306 This pragma must appear immediately within a record representation
2307 clause. Typical placements are before the first component clause
2308 or after the last component clause. The effect is to give an error
2309 message if any component is missing a component clause. This pragma
2310 may be used to ensure that a record representation clause is
2311 complete, and that this invariant is maintained if fields are
2312 added to the record in the future.
2314 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2315 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3a}
2316 @section Pragma Complex_Representation
2319 Syntax:
2321 @example
2322 pragma Complex_Representation
2323         ([Entity =>] LOCAL_NAME);
2324 @end example
2326 The @cite{Entity} argument must be the name of a record type which has
2327 two fields of the same floating-point type.  The effect of this pragma is
2328 to force gcc to use the special internal complex representation form for
2329 this record, which may be more efficient.  Note that this may result in
2330 the code for this type not conforming to standard ABI (application
2331 binary interface) requirements for the handling of record types.  For
2332 example, in some environments, there is a requirement for passing
2333 records by pointer, and the use of this pragma may result in passing
2334 this type in floating-point registers.
2336 @node Pragma Component_Alignment,Pragma Contract_Cases,Pragma Complex_Representation,Implementation Defined Pragmas
2337 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{3b}
2338 @section Pragma Component_Alignment
2341 @geindex Alignments of components
2343 @geindex Pragma Component_Alignment
2345 Syntax:
2347 @example
2348 pragma Component_Alignment (
2349      [Form =>] ALIGNMENT_CHOICE
2350   [, [Name =>] type_LOCAL_NAME]);
2352 ALIGNMENT_CHOICE ::=
2353   Component_Size
2354 | Component_Size_4
2355 | Storage_Unit
2356 | Default
2357 @end example
2359 Specifies the alignment of components in array or record types.
2360 The meaning of the @cite{Form} argument is as follows:
2362 @quotation
2364 @geindex Component_Size (in pragma Component_Alignment)
2365 @end quotation
2368 @table @asis
2370 @item @emph{Component_Size}
2372 Aligns scalar components and subcomponents of the array or record type
2373 on boundaries appropriate to their inherent size (naturally
2374 aligned).  For example, 1-byte components are aligned on byte boundaries,
2375 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2376 integer components are aligned on 4-byte boundaries and so on.  These
2377 alignment rules correspond to the normal rules for C compilers on all
2378 machines except the VAX.
2380 @geindex Component_Size_4 (in pragma Component_Alignment)
2382 @item @emph{Component_Size_4}
2384 Naturally aligns components with a size of four or fewer
2385 bytes.  Components that are larger than 4 bytes are placed on the next
2386 4-byte boundary.
2388 @geindex Storage_Unit (in pragma Component_Alignment)
2390 @item @emph{Storage_Unit}
2392 Specifies that array or record components are byte aligned, i.e.,
2393 aligned on boundaries determined by the value of the constant
2394 @cite{System.Storage_Unit}.
2396 @geindex Default (in pragma Component_Alignment)
2398 @item @emph{Default}
2400 Specifies that array or record components are aligned on default
2401 boundaries, appropriate to the underlying hardware or operating system or
2402 both. The @cite{Default} choice is the same as @cite{Component_Size} (natural
2403 alignment).
2404 @end table
2406 If the @cite{Name} parameter is present, @cite{type_LOCAL_NAME} must
2407 refer to a local record or array type, and the specified alignment
2408 choice applies to the specified type.  The use of
2409 @cite{Component_Alignment} together with a pragma @cite{Pack} causes the
2410 @cite{Component_Alignment} pragma to be ignored.  The use of
2411 @cite{Component_Alignment} together with a record representation clause
2412 is only effective for fields not specified by the representation clause.
2414 If the @cite{Name} parameter is absent, the pragma can be used as either
2415 a configuration pragma, in which case it applies to one or more units in
2416 accordance with the normal rules for configuration pragmas, or it can be
2417 used within a declarative part, in which case it applies to types that
2418 are declared within this declarative part, or within any nested scope
2419 within this declarative part.  In either case it specifies the alignment
2420 to be applied to any record or array type which has otherwise standard
2421 representation.
2423 If the alignment for a record or array type is not specified (using
2424 pragma @cite{Pack}, pragma @cite{Component_Alignment}, or a record rep
2425 clause), the GNAT uses the default alignment as described previously.
2427 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Component_Alignment,Implementation Defined Pragmas
2428 @anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{3c}
2429 @section Pragma Contract_Cases
2432 @geindex Contract cases
2434 Syntax:
2436 @example
2437 pragma Contract_Cases (
2438    Condition => Consequence
2439  @{,Condition => Consequence@});
2440 @end example
2442 The @cite{Contract_Cases} pragma allows defining fine-grain specifications
2443 that can complement or replace the contract given by a precondition and a
2444 postcondition. Additionally, the @cite{Contract_Cases} pragma can be used
2445 by testing and formal verification tools. The compiler checks its validity and,
2446 depending on the assertion policy at the point of declaration of the pragma,
2447 it may insert a check in the executable. For code generation, the contract
2448 cases
2450 @example
2451 pragma Contract_Cases (
2452   Cond1 => Pred1,
2453   Cond2 => Pred2);
2454 @end example
2456 are equivalent to
2458 @example
2459 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2460 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2461 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2462 pragma Postcondition (if C1 then Pred1);
2463 pragma Postcondition (if C2 then Pred2);
2464 @end example
2466 The precondition ensures that one and only one of the conditions is
2467 satisfied on entry to the subprogram.
2468 The postcondition ensures that for the condition that was True on entry,
2469 the corrresponding consequence is True on exit. Other consequence expressions
2470 are not evaluated.
2472 A precondition @cite{P} and postcondition @cite{Q} can also be
2473 expressed as contract cases:
2475 @example
2476 pragma Contract_Cases (P => Q);
2477 @end example
2479 The placement and visibility rules for @cite{Contract_Cases} pragmas are
2480 identical to those described for preconditions and postconditions.
2482 The compiler checks that boolean expressions given in conditions and
2483 consequences are valid, where the rules for conditions are the same as
2484 the rule for an expression in @cite{Precondition} and the rules for
2485 consequences are the same as the rule for an expression in
2486 @cite{Postcondition}. In particular, attributes @cite{'Old} and
2487 @cite{'Result} can only be used within consequence expressions.
2488 The condition for the last contract case may be @cite{others}, to denote
2489 any case not captured by the previous cases. The
2490 following is an example of use within a package spec:
2492 @example
2493 package Math_Functions is
2494    ...
2495    function Sqrt (Arg : Float) return Float;
2496    pragma Contract_Cases ((Arg in 0 .. 99) => Sqrt'Result < 10,
2497                           Arg >= 100       => Sqrt'Result >= 10,
2498                           others           => Sqrt'Result = 0);
2499    ...
2500 end Math_Functions;
2501 @end example
2503 The meaning of contract cases is that only one case should apply at each
2504 call, as determined by the corresponding condition evaluating to True,
2505 and that the consequence for this case should hold when the subprogram
2506 returns.
2508 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2509 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{3d}
2510 @section Pragma Convention_Identifier
2513 @geindex Conventions
2514 @geindex synonyms
2516 Syntax:
2518 @example
2519 pragma Convention_Identifier (
2520          [Name =>]       IDENTIFIER,
2521          [Convention =>] convention_IDENTIFIER);
2522 @end example
2524 This pragma provides a mechanism for supplying synonyms for existing
2525 convention identifiers. The @cite{Name} identifier can subsequently
2526 be used as a synonym for the given convention in other pragmas (including
2527 for example pragma @cite{Import} or another @cite{Convention_Identifier}
2528 pragma). As an example of the use of this, suppose you had legacy code
2529 which used Fortran77 as the identifier for Fortran. Then the pragma:
2531 @example
2532 pragma Convention_Identifier (Fortran77, Fortran);
2533 @end example
2535 would allow the use of the convention identifier @cite{Fortran77} in
2536 subsequent code, avoiding the need to modify the sources. As another
2537 example, you could use this to parameterize convention requirements
2538 according to systems. Suppose you needed to use @cite{Stdcall} on
2539 windows systems, and @cite{C} on some other system, then you could
2540 define a convention identifier @cite{Library} and use a single
2541 @cite{Convention_Identifier} pragma to specify which convention
2542 would be used system-wide.
2544 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2545 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{3e}
2546 @section Pragma CPP_Class
2549 @geindex Interfacing with C++
2551 Syntax:
2553 @example
2554 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2555 @end example
2557 The argument denotes an entity in the current declarative region that is
2558 declared as a record type. It indicates that the type corresponds to an
2559 externally declared C++ class type, and is to be laid out the same way
2560 that C++ would lay out the type. If the C++ class has virtual primitives
2561 then the record must be declared as a tagged record type.
2563 Types for which @cite{CPP_Class} is specified do not have assignment or
2564 equality operators defined (such operations can be imported or declared
2565 as subprograms as required). Initialization is allowed only by constructor
2566 functions (see pragma @cite{CPP_Constructor}). Such types are implicitly
2567 limited if not explicitly declared as limited or derived from a limited
2568 type, and an error is issued in that case.
2570 See @ref{3f,,Interfacing to C++} for related information.
2572 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
2573 for backward compatibility but its functionality is available
2574 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
2576 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2577 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{40}
2578 @section Pragma CPP_Constructor
2581 @geindex Interfacing with C++
2583 Syntax:
2585 @example
2586 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2587   [, [External_Name =>] static_string_EXPRESSION ]
2588   [, [Link_Name     =>] static_string_EXPRESSION ]);
2589 @end example
2591 This pragma identifies an imported function (imported in the usual way
2592 with pragma @cite{Import}) as corresponding to a C++ constructor. If
2593 @cite{External_Name} and @cite{Link_Name} are not specified then the
2594 @cite{Entity} argument is a name that must have been previously mentioned
2595 in a pragma @cite{Import} with @cite{Convention} = @cite{CPP}. Such name
2596 must be of one of the following forms:
2599 @itemize *
2601 @item 
2602 @strong{function} @cite{Fname} @strong{return} T`
2604 @item 
2605 @strong{function} @cite{Fname} @strong{return} T'Class
2607 @item 
2608 @strong{function} @cite{Fname} (...) @strong{return} T`
2610 @item 
2611 @strong{function} @cite{Fname} (...) @strong{return} T'Class
2612 @end itemize
2614 where @cite{T} is a limited record type imported from C++ with pragma
2615 @cite{Import} and @cite{Convention} = @cite{CPP}.
2617 The first two forms import the default constructor, used when an object
2618 of type @cite{T} is created on the Ada side with no explicit constructor.
2619 The latter two forms cover all the non-default constructors of the type.
2620 See the GNAT User's Guide for details.
2622 If no constructors are imported, it is impossible to create any objects
2623 on the Ada side and the type is implicitly declared abstract.
2625 Pragma @cite{CPP_Constructor} is intended primarily for automatic generation
2626 using an automatic binding generator tool (such as the @cite{-fdump-ada-spec}
2627 GCC switch).
2628 See @ref{3f,,Interfacing to C++} for more related information.
2630 Note: The use of functions returning class-wide types for constructors is
2631 currently obsolete. They are supported for backward compatibility. The
2632 use of functions returning the type T leave the Ada sources more clear
2633 because the imported C++ constructors always return an object of type T;
2634 that is, they never return an object whose type is a descendant of type T.
2636 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2637 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{41}
2638 @section Pragma CPP_Virtual
2641 @geindex Interfacing to C++
2643 This pragma is now obsolete and, other than generating a warning if warnings
2644 on obsolescent features are enabled, is completely ignored.
2645 It is retained for compatibility
2646 purposes. It used to be required to ensure compoatibility with C++, but
2647 is no longer required for that purpose because GNAT generates
2648 the same object layout as the G++ compiler by default.
2650 See @ref{3f,,Interfacing to C++} for related information.
2652 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2653 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{42}
2654 @section Pragma CPP_Vtable
2657 @geindex Interfacing with C++
2659 This pragma is now obsolete and, other than generating a warning if warnings
2660 on obsolescent features are enabled, is completely ignored.
2661 It used to be required to ensure compatibility with C++, but
2662 is no longer required for that purpose because GNAT generates
2663 the same object layout as the G++ compiler by default.
2665 See @ref{3f,,Interfacing to C++} for related information.
2667 @node Pragma CPU,Pragma Debug,Pragma CPP_Vtable,Implementation Defined Pragmas
2668 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{43}
2669 @section Pragma CPU
2672 Syntax:
2674 @example
2675 pragma CPU (EXPRESSION);
2676 @end example
2678 This pragma is standard in Ada 2012, but is available in all earlier
2679 versions of Ada as an implementation-defined pragma.
2680 See Ada 2012 Reference Manual for details.
2682 @node Pragma Debug,Pragma Debug_Policy,Pragma CPU,Implementation Defined Pragmas
2683 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{44}
2684 @section Pragma Debug
2687 Syntax:
2689 @example
2690 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2692 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2693   PROCEDURE_NAME
2694 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2695 @end example
2697 The procedure call argument has the syntactic form of an expression, meeting
2698 the syntactic requirements for pragmas.
2700 If debug pragmas are not enabled or if the condition is present and evaluates
2701 to False, this pragma has no effect. If debug pragmas are enabled, the
2702 semantics of the pragma is exactly equivalent to the procedure call statement
2703 corresponding to the argument with a terminating semicolon. Pragmas are
2704 permitted in sequences of declarations, so you can use pragma @cite{Debug} to
2705 intersperse calls to debug procedures in the middle of declarations. Debug
2706 pragmas can be enabled either by use of the command line switch @emph{-gnata}
2707 or by use of the pragma @cite{Check_Policy} with a first argument of
2708 @cite{Debug}.
2710 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2711 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{45}
2712 @section Pragma Debug_Policy
2715 Syntax:
2717 @example
2718 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2719 @end example
2721 This pragma is equivalent to a corresponding @cite{Check_Policy} pragma
2722 with a first argument of @cite{Debug}. It is retained for historical
2723 compatibility reasons.
2725 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2726 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{46}
2727 @section Pragma Default_Scalar_Storage_Order
2730 @geindex Default_Scalar_Storage_Order
2732 @geindex Scalar_Storage_Order
2734 Syntax:
2736 @example
2737 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2738 @end example
2740 Normally if no explicit @cite{Scalar_Storage_Order} is given for a record
2741 type or array type, then the scalar storage order defaults to the ordinary
2742 default for the target. But this default may be overridden using this pragma.
2743 The pragma may appear as a configuration pragma, or locally within a package
2744 spec or declarative part. In the latter case, it applies to all subsequent
2745 types declared within that package spec or declarative part.
2747 The following example shows the use of this pragma:
2749 @example
2750 pragma Default_Scalar_Storage_Order (High_Order_First);
2751 with System; use System;
2752 package DSSO1 is
2753    type H1 is record
2754       a : Integer;
2755    end record;
2757    type L2 is record
2758       a : Integer;
2759    end record;
2760    for L2'Scalar_Storage_Order use Low_Order_First;
2762    type L2a is new L2;
2764    package Inner is
2765       type H3 is record
2766          a : Integer;
2767       end record;
2769       pragma Default_Scalar_Storage_Order (Low_Order_First);
2771       type L4 is record
2772          a : Integer;
2773       end record;
2774    end Inner;
2776    type H4a is new Inner.L4;
2778    type H5 is record
2779       a : Integer;
2780    end record;
2781 end DSSO1;
2782 @end example
2784 In this example record types L.. have @cite{Low_Order_First} scalar
2785 storage order, and record types H.. have @cite{High_Order_First}.
2786 Note that in the case of @cite{H4a}, the order is not inherited
2787 from the parent type. Only an explicitly set @cite{Scalar_Storage_Order}
2788 gets inherited on type derivation.
2790 If this pragma is used as a configuration pragma which appears within a
2791 configuration pragma file (as opposed to appearing explicitly at the start
2792 of a single unit), then the binder will require that all units in a partition
2793 be compiled in a similar manner, other than run-time units, which are not
2794 affected by this pragma. Note that the use of this form is discouraged because
2795 it may significantly degrade the run-time performance of the software, instead
2796 the default scalar storage order ought to be changed only on a local basis.
2798 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2799 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{47}
2800 @section Pragma Default_Storage_Pool
2803 @geindex Default_Storage_Pool
2805 Syntax:
2807 @example
2808 pragma Default_Storage_Pool (storage_pool_NAME | null);
2809 @end example
2811 This pragma is standard in Ada 2012, but is available in all earlier
2812 versions of Ada as an implementation-defined pragma.
2813 See Ada 2012 Reference Manual for details.
2815 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
2816 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{48}
2817 @section Pragma Depends
2820 For the description of this pragma, see SPARK 2014 Reference Manual,
2821 section 6.1.5.
2823 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
2824 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{49}
2825 @section Pragma Detect_Blocking
2828 Syntax:
2830 @example
2831 pragma Detect_Blocking;
2832 @end example
2834 This is a standard pragma in Ada 2005, that is available in all earlier
2835 versions of Ada as an implementation-defined pragma.
2837 This is a configuration pragma that forces the detection of potentially
2838 blocking operations within a protected operation, and to raise Program_Error
2839 if that happens.
2841 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
2842 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{4a}
2843 @section Pragma Disable_Atomic_Synchronization
2846 @geindex Atomic Synchronization
2848 Syntax:
2850 @example
2851 pragma Disable_Atomic_Synchronization [(Entity)];
2852 @end example
2854 Ada requires that accesses (reads or writes) of an atomic variable be
2855 regarded as synchronization points in the case of multiple tasks.
2856 Particularly in the case of multi-processors this may require special
2857 handling, e.g. the generation of memory barriers. This capability may
2858 be turned off using this pragma in cases where it is known not to be
2859 required.
2861 The placement and scope rules for this pragma are the same as those
2862 for @cite{pragma Suppress}. In particular it can be used as a
2863 configuration  pragma, or in a declaration sequence where it applies
2864 till the end of the scope. If an @cite{Entity} argument is present,
2865 the action applies only to that entity.
2867 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
2868 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{4b}
2869 @section Pragma Dispatching_Domain
2872 Syntax:
2874 @example
2875 pragma Dispatching_Domain (EXPRESSION);
2876 @end example
2878 This pragma is standard in Ada 2012, but is available in all earlier
2879 versions of Ada as an implementation-defined pragma.
2880 See Ada 2012 Reference Manual for details.
2882 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
2883 @anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{4c}
2884 @section Pragma Effective_Reads
2887 For the description of this pragma, see SPARK 2014 Reference Manual,
2888 section 7.1.2.
2890 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
2891 @anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{4d}
2892 @section Pragma Effective_Writes
2895 For the description of this pragma, see SPARK 2014 Reference Manual,
2896 section 7.1.2.
2898 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
2899 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{4e}
2900 @section Pragma Elaboration_Checks
2903 @geindex Elaboration control
2905 Syntax:
2907 @example
2908 pragma Elaboration_Checks (Dynamic | Static);
2909 @end example
2911 This is a configuration pragma that provides control over the
2912 elaboration model used by the compilation affected by the
2913 pragma.  If the parameter is @cite{Dynamic},
2914 then the dynamic elaboration
2915 model described in the Ada Reference Manual is used, as though
2916 the @emph{-gnatE} switch had been specified on the command
2917 line.  If the parameter is @cite{Static}, then the default GNAT static
2918 model is used.  This configuration pragma overrides the setting
2919 of the command line.  For full details on the elaboration models
2920 used by the GNAT compiler, see the chapter on elaboration order handling
2921 in the @emph{GNAT User's Guide}.
2923 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
2924 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{4f}
2925 @section Pragma Eliminate
2928 @geindex Elimination of unused subprograms
2930 Syntax:
2932 @example
2933 pragma Eliminate ([Entity          =>] DEFINING_DESIGNATOR,
2934                   [Source_Location =>] STRING_LITERAL);
2935 @end example
2937 The string literal given for the source location is a string which
2938 specifies the line number of the occurrence of the entity, using
2939 the syntax for SOURCE_TRACE given below:
2941 @example
2942 SOURCE_TRACE     ::= SOURCE_REFERENCE [LBRACKET SOURCE_TRACE RBRACKET]
2944 LBRACKET         ::= [
2945 RBRACKET         ::= ]
2947 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
2949 LINE_NUMBER      ::= DIGIT @{DIGIT@}
2950 @end example
2952 Spaces around the colon in a @cite{Source_Reference} are optional.
2954 The @cite{DEFINING_DESIGNATOR} matches the defining designator used in an
2955 explicit subprogram declaration, where the @cite{entity} name in this
2956 designator appears on the source line specified by the source location.
2958 The source trace that is given as the @cite{Source_Location} shall obey the
2959 following rules. The @cite{FILE_NAME} is the short name (with no directory
2960 information) of an Ada source file, given using exactly the required syntax
2961 for the underlying file system (e.g. case is important if the underlying
2962 operating system is case sensitive). @cite{LINE_NUMBER} gives the line
2963 number of the occurrence of the @cite{entity}
2964 as a decimal literal without an exponent or point. If an @cite{entity} is not
2965 declared in a generic instantiation (this includes generic subprogram
2966 instances), the source trace includes only one source reference. If an entity
2967 is declared inside a generic instantiation, its source trace (when parsing
2968 from left to right) starts with the source location of the declaration of the
2969 entity in the generic unit and ends with the source location of the
2970 instantiation (it is given in square brackets). This approach is recursively
2971 used in case of nested instantiations: the rightmost (nested most deeply in
2972 square brackets) element of the source trace is the location of the outermost
2973 instantiation, the next to left element is the location of the next (first
2974 nested) instantiation in the code of the corresponding generic unit, and so
2975 on, and the leftmost element (that is out of any square brackets) is the
2976 location of the declaration of the entity to eliminate in a generic unit.
2978 Note that the @cite{Source_Location} argument specifies which of a set of
2979 similarly named entities is being eliminated, dealing both with overloading,
2980 and also appearance of the same entity name in different scopes.
2982 This pragma indicates that the given entity is not used in the program to be
2983 compiled and built. The effect of the pragma is to allow the compiler to
2984 eliminate the code or data associated with the named entity. Any reference to
2985 an eliminated entity causes a compile-time or link-time error.
2987 The intention of pragma @cite{Eliminate} is to allow a program to be compiled
2988 in a system-independent manner, with unused entities eliminated, without
2989 needing to modify the source text. Normally the required set of
2990 @cite{Eliminate} pragmas is constructed automatically using the gnatelim tool.
2992 Any source file change that removes, splits, or
2993 adds lines may make the set of Eliminate pragmas invalid because their
2994 @cite{Source_Location} argument values may get out of date.
2996 Pragma @cite{Eliminate} may be used where the referenced entity is a dispatching
2997 operation. In this case all the subprograms to which the given operation can
2998 dispatch are considered to be unused (are never called as a result of a direct
2999 or a dispatching call).
3001 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3002 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{50}
3003 @section Pragma Enable_Atomic_Synchronization
3006 @geindex Atomic Synchronization
3008 Syntax:
3010 @example
3011 pragma Enable_Atomic_Synchronization [(Entity)];
3012 @end example
3014 Ada requires that accesses (reads or writes) of an atomic variable be
3015 regarded as synchronization points in the case of multiple tasks.
3016 Particularly in the case of multi-processors this may require special
3017 handling, e.g. the generation of memory barriers. This synchronization
3018 is performed by default, but can be turned off using
3019 @cite{pragma Disable_Atomic_Synchronization}. The
3020 @cite{Enable_Atomic_Synchronization} pragma can be used to turn
3021 it back on.
3023 The placement and scope rules for this pragma are the same as those
3024 for @cite{pragma Unsuppress}. In particular it can be used as a
3025 configuration  pragma, or in a declaration sequence where it applies
3026 till the end of the scope. If an @cite{Entity} argument is present,
3027 the action applies only to that entity.
3029 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3030 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{51}
3031 @section Pragma Export_Function
3034 @geindex Argument passing mechanisms
3036 Syntax:
3038 @example
3039 pragma Export_Function (
3040      [Internal         =>] LOCAL_NAME
3041   [, [External         =>] EXTERNAL_SYMBOL]
3042   [, [Parameter_Types  =>] PARAMETER_TYPES]
3043   [, [Result_Type      =>] result_SUBTYPE_MARK]
3044   [, [Mechanism        =>] MECHANISM]
3045   [, [Result_Mechanism =>] MECHANISM_NAME]);
3047 EXTERNAL_SYMBOL ::=
3048   IDENTIFIER
3049 | static_string_EXPRESSION
3050 | ""
3052 PARAMETER_TYPES ::=
3053   null
3054 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3056 TYPE_DESIGNATOR ::=
3057   subtype_NAME
3058 | subtype_Name ' Access
3060 MECHANISM ::=
3061   MECHANISM_NAME
3062 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3064 MECHANISM_ASSOCIATION ::=
3065   [formal_parameter_NAME =>] MECHANISM_NAME
3067 MECHANISM_NAME ::= Value | Reference
3068 @end example
3070 Use this pragma to make a function externally callable and optionally
3071 provide information on mechanisms to be used for passing parameter and
3072 result values.  We recommend, for the purposes of improving portability,
3073 this pragma always be used in conjunction with a separate pragma
3074 @cite{Export}, which must precede the pragma @cite{Export_Function}.
3075 GNAT does not require a separate pragma @cite{Export}, but if none is
3076 present, @cite{Convention Ada} is assumed, which is usually
3077 not what is wanted, so it is usually appropriate to use this
3078 pragma in conjunction with a @cite{Export} or @cite{Convention}
3079 pragma that specifies the desired foreign convention.
3080 Pragma @cite{Export_Function}
3081 (and @cite{Export}, if present) must appear in the same declarative
3082 region as the function to which they apply.
3084 @cite{internal_name} must uniquely designate the function to which the
3085 pragma applies.  If more than one function name exists of this name in
3086 the declarative part you must use the @cite{Parameter_Types} and
3087 @cite{Result_Type} parameters is mandatory to achieve the required
3088 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
3089 anonymous access parameter.
3091 @geindex Suppressing external name
3093 Special treatment is given if the EXTERNAL is an explicit null
3094 string or a static string expressions that evaluates to the null
3095 string. In this case, no external name is generated. This form
3096 still allows the specification of parameter mechanisms.
3098 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3099 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{52}
3100 @section Pragma Export_Object
3103 Syntax:
3105 @example
3106 pragma Export_Object
3107       [Internal =>] LOCAL_NAME
3108    [, [External =>] EXTERNAL_SYMBOL]
3109    [, [Size     =>] EXTERNAL_SYMBOL]
3111 EXTERNAL_SYMBOL ::=
3112   IDENTIFIER
3113 | static_string_EXPRESSION
3114 @end example
3116 This pragma designates an object as exported, and apart from the
3117 extended rules for external symbols, is identical in effect to the use of
3118 the normal @cite{Export} pragma applied to an object.  You may use a
3119 separate Export pragma (and you probably should from the point of view
3120 of portability), but it is not required.  @cite{Size} is syntax checked,
3121 but otherwise ignored by GNAT.
3123 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3124 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{53}
3125 @section Pragma Export_Procedure
3128 Syntax:
3130 @example
3131 pragma Export_Procedure (
3132      [Internal        =>] LOCAL_NAME
3133   [, [External        =>] EXTERNAL_SYMBOL]
3134   [, [Parameter_Types =>] PARAMETER_TYPES]
3135   [, [Mechanism       =>] MECHANISM]);
3137 EXTERNAL_SYMBOL ::=
3138   IDENTIFIER
3139 | static_string_EXPRESSION
3140 | ""
3142 PARAMETER_TYPES ::=
3143   null
3144 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3146 TYPE_DESIGNATOR ::=
3147   subtype_NAME
3148 | subtype_Name ' Access
3150 MECHANISM ::=
3151   MECHANISM_NAME
3152 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3154 MECHANISM_ASSOCIATION ::=
3155   [formal_parameter_NAME =>] MECHANISM_NAME
3157 MECHANISM_NAME ::= Value | Reference
3158 @end example
3160 This pragma is identical to @cite{Export_Function} except that it
3161 applies to a procedure rather than a function and the parameters
3162 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3163 GNAT does not require a separate pragma @cite{Export}, but if none is
3164 present, @cite{Convention Ada} is assumed, which is usually
3165 not what is wanted, so it is usually appropriate to use this
3166 pragma in conjunction with a @cite{Export} or @cite{Convention}
3167 pragma that specifies the desired foreign convention.
3169 @geindex Suppressing external name
3171 Special treatment is given if the EXTERNAL is an explicit null
3172 string or a static string expressions that evaluates to the null
3173 string. In this case, no external name is generated. This form
3174 still allows the specification of parameter mechanisms.
3176 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3177 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{54}
3178 @section Pragma Export_Value
3181 Syntax:
3183 @example
3184 pragma Export_Value (
3185   [Value     =>] static_integer_EXPRESSION,
3186   [Link_Name =>] static_string_EXPRESSION);
3187 @end example
3189 This pragma serves to export a static integer value for external use.
3190 The first argument specifies the value to be exported. The Link_Name
3191 argument specifies the symbolic name to be associated with the integer
3192 value. This pragma is useful for defining a named static value in Ada
3193 that can be referenced in assembly language units to be linked with
3194 the application. This pragma is currently supported only for the
3195 AAMP target and is ignored for other targets.
3197 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3198 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{55}
3199 @section Pragma Export_Valued_Procedure
3202 Syntax:
3204 @example
3205 pragma Export_Valued_Procedure (
3206      [Internal        =>] LOCAL_NAME
3207   [, [External        =>] EXTERNAL_SYMBOL]
3208   [, [Parameter_Types =>] PARAMETER_TYPES]
3209   [, [Mechanism       =>] MECHANISM]);
3211 EXTERNAL_SYMBOL ::=
3212   IDENTIFIER
3213 | static_string_EXPRESSION
3214 | ""
3216 PARAMETER_TYPES ::=
3217   null
3218 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3220 TYPE_DESIGNATOR ::=
3221   subtype_NAME
3222 | subtype_Name ' Access
3224 MECHANISM ::=
3225   MECHANISM_NAME
3226 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3228 MECHANISM_ASSOCIATION ::=
3229   [formal_parameter_NAME =>] MECHANISM_NAME
3231 MECHANISM_NAME ::= Value | Reference
3232 @end example
3234 This pragma is identical to @cite{Export_Procedure} except that the
3235 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3236 mode @cite{OUT}, and externally the subprogram is treated as a function
3237 with this parameter as the result of the function.  GNAT provides for
3238 this capability to allow the use of @cite{OUT} and @cite{IN OUT}
3239 parameters in interfacing to external functions (which are not permitted
3240 in Ada functions).
3241 GNAT does not require a separate pragma @cite{Export}, but if none is
3242 present, @cite{Convention Ada} is assumed, which is almost certainly
3243 not what is wanted since the whole point of this pragma is to interface
3244 with foreign language functions, so it is usually appropriate to use this
3245 pragma in conjunction with a @cite{Export} or @cite{Convention}
3246 pragma that specifies the desired foreign convention.
3248 @geindex Suppressing external name
3250 Special treatment is given if the EXTERNAL is an explicit null
3251 string or a static string expressions that evaluates to the null
3252 string. In this case, no external name is generated. This form
3253 still allows the specification of parameter mechanisms.
3255 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3256 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{56}
3257 @section Pragma Extend_System
3260 @geindex System
3261 @geindex extending
3263 @geindex DEC Ada 83
3265 Syntax:
3267 @example
3268 pragma Extend_System ([Name =>] IDENTIFIER);
3269 @end example
3271 This pragma is used to provide backwards compatibility with other
3272 implementations that extend the facilities of package @cite{System}.  In
3273 GNAT, @cite{System} contains only the definitions that are present in
3274 the Ada RM.  However, other implementations, notably the DEC Ada 83
3275 implementation, provide many extensions to package @cite{System}.
3277 For each such implementation accommodated by this pragma, GNAT provides a
3278 package @cite{Aux_`xxx`}, e.g., @cite{Aux_DEC} for the DEC Ada 83
3279 implementation, which provides the required additional definitions.  You
3280 can use this package in two ways.  You can @cite{with} it in the normal
3281 way and access entities either by selection or using a @cite{use}
3282 clause.  In this case no special processing is required.
3284 However, if existing code contains references such as
3285 @cite{System.`xxx`} where @cite{xxx} is an entity in the extended
3286 definitions provided in package @cite{System}, you may use this pragma
3287 to extend visibility in @cite{System} in a non-standard way that
3288 provides greater compatibility with the existing code.  Pragma
3289 @cite{Extend_System} is a configuration pragma whose single argument is
3290 the name of the package containing the extended definition
3291 (e.g., @cite{Aux_DEC} for the DEC Ada case).  A unit compiled under
3292 control of this pragma will be processed using special visibility
3293 processing that looks in package @cite{System.Aux_`xxx`} where
3294 @cite{Aux_`xxx`} is the pragma argument for any entity referenced in
3295 package @cite{System}, but not found in package @cite{System}.
3297 You can use this pragma either to access a predefined @cite{System}
3298 extension supplied with the compiler, for example @cite{Aux_DEC} or
3299 you can construct your own extension unit following the above
3300 definition.  Note that such a package is a child of @cite{System}
3301 and thus is considered part of the implementation.
3302 To compile it you will have to use the @emph{-gnatg} switch
3303 for compiling System units, as explained in the
3304 GNAT User's Guide.
3306 @node Pragma Extensions_Allowed,Pragma External,Pragma Extend_System,Implementation Defined Pragmas
3307 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{57}
3308 @section Pragma Extensions_Allowed
3311 @geindex Ada Extensions
3313 @geindex GNAT Extensions
3315 Syntax:
3317 @example
3318 pragma Extensions_Allowed (On | Off);
3319 @end example
3321 This configuration pragma enables or disables the implementation
3322 extension mode (the use of Off as a parameter cancels the effect
3323 of the @emph{-gnatX} command switch).
3325 In extension mode, the latest version of the Ada language is
3326 implemented (currently Ada 2012), and in addition a small number
3327 of GNAT specific extensions are recognized as follows:
3330 @table @asis
3332 @item @emph{Constrained attribute for generic objects}
3334 The @cite{Constrained} attribute is permitted for objects of
3335 generic types. The result indicates if the corresponding actual
3336 is constrained.
3337 @end table
3339 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Allowed,Implementation Defined Pragmas
3340 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{58}
3341 @section Pragma External
3344 Syntax:
3346 @example
3347 pragma External (
3348   [   Convention    =>] convention_IDENTIFIER,
3349   [   Entity        =>] LOCAL_NAME
3350   [, [External_Name =>] static_string_EXPRESSION ]
3351   [, [Link_Name     =>] static_string_EXPRESSION ]);
3352 @end example
3354 This pragma is identical in syntax and semantics to pragma
3355 @cite{Export} as defined in the Ada Reference Manual.  It is
3356 provided for compatibility with some Ada 83 compilers that
3357 used this pragma for exactly the same purposes as pragma
3358 @cite{Export} before the latter was standardized.
3360 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3361 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{59}
3362 @section Pragma External_Name_Casing
3365 @geindex Dec Ada 83 casing compatibility
3367 @geindex External Names
3368 @geindex casing
3370 @geindex Casing of External names
3372 Syntax:
3374 @example
3375 pragma External_Name_Casing (
3376   Uppercase | Lowercase
3377   [, Uppercase | Lowercase | As_Is]);
3378 @end example
3380 This pragma provides control over the casing of external names associated
3381 with Import and Export pragmas.  There are two cases to consider:
3384 @itemize *
3386 @item 
3387 Implicit external names
3389 Implicit external names are derived from identifiers.  The most common case
3390 arises when a standard Ada Import or Export pragma is used with only two
3391 arguments, as in:
3393 @example
3394 pragma Import (C, C_Routine);
3395 @end example
3397 Since Ada is a case-insensitive language, the spelling of the identifier in
3398 the Ada source program does not provide any information on the desired
3399 casing of the external name, and so a convention is needed.  In GNAT the
3400 default treatment is that such names are converted to all lower case
3401 letters.  This corresponds to the normal C style in many environments.
3402 The first argument of pragma @cite{External_Name_Casing} can be used to
3403 control this treatment.  If @cite{Uppercase} is specified, then the name
3404 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3405 then the normal default of all lower case letters will be used.
3407 This same implicit treatment is also used in the case of extended DEC Ada 83
3408 compatible Import and Export pragmas where an external name is explicitly
3409 specified using an identifier rather than a string.
3411 @item 
3412 Explicit external names
3414 Explicit external names are given as string literals.  The most common case
3415 arises when a standard Ada Import or Export pragma is used with three
3416 arguments, as in:
3418 @example
3419 pragma Import (C, C_Routine, "C_routine");
3420 @end example
3422 In this case, the string literal normally provides the exact casing required
3423 for the external name.  The second argument of pragma
3424 @cite{External_Name_Casing} may be used to modify this behavior.
3425 If @cite{Uppercase} is specified, then the name
3426 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3427 then the name will be forced to all lowercase letters.  A specification of
3428 @cite{As_Is} provides the normal default behavior in which the casing is
3429 taken from the string provided.
3430 @end itemize
3432 This pragma may appear anywhere that a pragma is valid.  In particular, it
3433 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3434 case it applies to all subsequent compilations, or it can be used as a program
3435 unit pragma, in which case it only applies to the current unit, or it can
3436 be used more locally to control individual Import/Export pragmas.
3438 It was primarily intended for use with OpenVMS systems, where many
3439 compilers convert all symbols to upper case by default.  For interfacing to
3440 such compilers (e.g., the DEC C compiler), it may be convenient to use
3441 the pragma:
3443 @example
3444 pragma External_Name_Casing (Uppercase, Uppercase);
3445 @end example
3447 to enforce the upper casing of all external symbols.
3449 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3450 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{5a}
3451 @section Pragma Fast_Math
3454 Syntax:
3456 @example
3457 pragma Fast_Math;
3458 @end example
3460 This is a configuration pragma which activates a mode in which speed is
3461 considered more important for floating-point operations than absolutely
3462 accurate adherence to the requirements of the standard. Currently the
3463 following operations are affected:
3466 @table @asis
3468 @item @emph{Complex Multiplication}
3470 The normal simple formula for complex multiplication can result in intermediate
3471 overflows for numbers near the end of the range. The Ada standard requires that
3472 this situation be detected and corrected by scaling, but in Fast_Math mode such
3473 cases will simply result in overflow. Note that to take advantage of this you
3474 must instantiate your own version of @cite{Ada.Numerics.Generic_Complex_Types}
3475 under control of the pragma, rather than use the preinstantiated versions.
3476 @end table
3478 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3479 @anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{5b}
3480 @section Pragma Favor_Top_Level
3483 Syntax:
3485 @example
3486 pragma Favor_Top_Level (type_NAME);
3487 @end example
3489 The named type must be an access-to-subprogram type. This pragma is an
3490 efficiency hint to the compiler, regarding the use of 'Access or
3491 'Unrestricted_Access on nested (non-library-level) subprograms. The
3492 pragma means that nested subprograms are not used with this type, or
3493 are rare, so that the generated code should be efficient in the
3494 top-level case. When this pragma is used, dynamically generated
3495 trampolines may be used on some targets for nested subprograms.
3496 See also the No_Implicit_Dynamic_Code restriction.
3498 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3499 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{5c}
3500 @section Pragma Finalize_Storage_Only
3503 Syntax:
3505 @example
3506 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3507 @end example
3509 This pragma allows the compiler not to emit a Finalize call for objects
3510 defined at the library level.  This is mostly useful for types where
3511 finalization is only used to deal with storage reclamation since in most
3512 environments it is not necessary to reclaim memory just before terminating
3513 execution, hence the name.
3515 @node Pragma Float_Representation,Pragma Global,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3516 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{5d}
3517 @section Pragma Float_Representation
3520 Syntax:
3522 @example
3523 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3525 FLOAT_REP ::= VAX_Float | IEEE_Float
3526 @end example
3528 In the one argument form, this pragma is a configuration pragma which
3529 allows control over the internal representation chosen for the predefined
3530 floating point types declared in the packages @cite{Standard} and
3531 @cite{System}. This pragma is only provided for compatibility and has no effect.
3533 The two argument form specifies the representation to be used for
3534 the specified floating-point type. The argument must
3535 be @cite{IEEE_Float} to specify the use of IEEE format, as follows:
3538 @itemize *
3540 @item 
3541 For a digits value of 6, 32-bit IEEE short format will be used.
3543 @item 
3544 For a digits value of 15, 64-bit IEEE long format will be used.
3546 @item 
3547 No other value of digits is permitted.
3548 @end itemize
3550 @node Pragma Global,Pragma Ident,Pragma Float_Representation,Implementation Defined Pragmas
3551 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{5e}
3552 @section Pragma Global
3555 For the description of this pragma, see SPARK 2014 Reference Manual,
3556 section 6.1.4.
3558 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3559 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{5f}
3560 @section Pragma Ident
3563 Syntax:
3565 @example
3566 pragma Ident (static_string_EXPRESSION);
3567 @end example
3569 This pragma is identical in effect to pragma @cite{Comment}. It is provided
3570 for compatibility with other Ada compilers providing this pragma.
3572 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3573 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{60}
3574 @section Pragma Ignore_Pragma
3577 Syntax:
3579 @example
3580 pragma Ignore_Pragma (pragma_IDENTIFIER);
3581 @end example
3583 This is a configuration pragma
3584 that takes a single argument that is a simple identifier. Any subsequent
3585 use of a pragma whose pragma identifier matches this argument will be
3586 silently ignored. This may be useful when legacy code or code intended
3587 for compilation with some other compiler contains pragmas that match the
3588 name, but not the exact implementation, of a @cite{GNAT} pragma. The use of this
3589 pragma allows such pragmas to be ignored, which may be useful in @cite{CodePeer}
3590 mode, or during porting of legacy code.
3592 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
3593 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{61}
3594 @section Pragma Implementation_Defined
3597 Syntax:
3599 @example
3600 pragma Implementation_Defined (local_NAME);
3601 @end example
3603 This pragma marks a previously declared entioty as implementation-defined.
3604 For an overloaded entity, applies to the most recent homonym.
3606 @example
3607 pragma Implementation_Defined;
3608 @end example
3610 The form with no arguments appears anywhere within a scope, most
3611 typically a package spec, and indicates that all entities that are
3612 defined within the package spec are Implementation_Defined.
3614 This pragma is used within the GNAT runtime library to identify
3615 implementation-defined entities introduced in language-defined units,
3616 for the purpose of implementing the No_Implementation_Identifiers
3617 restriction.
3619 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3620 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{62}
3621 @section Pragma Implemented
3624 Syntax:
3626 @example
3627 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3629 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3630 @end example
3632 This is an Ada 2012 representation pragma which applies to protected, task
3633 and synchronized interface primitives. The use of pragma Implemented provides
3634 a way to impose a static requirement on the overriding operation by adhering
3635 to one of the three implementation kinds: entry, protected procedure or any of
3636 the above. This pragma is available in all earlier versions of Ada as an
3637 implementation-defined pragma.
3639 @example
3640 type Synch_Iface is synchronized interface;
3641 procedure Prim_Op (Obj : in out Iface) is abstract;
3642 pragma Implemented (Prim_Op, By_Protected_Procedure);
3644 protected type Prot_1 is new Synch_Iface with
3645    procedure Prim_Op;  --  Legal
3646 end Prot_1;
3648 protected type Prot_2 is new Synch_Iface with
3649    entry Prim_Op;      --  Illegal
3650 end Prot_2;
3652 task type Task_Typ is new Synch_Iface with
3653    entry Prim_Op;      --  Illegal
3654 end Task_Typ;
3655 @end example
3657 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3658 Implemented determines the runtime behavior of the requeue. Implementation kind
3659 By_Entry guarantees that the action of requeueing will proceed from an entry to
3660 another entry. Implementation kind By_Protected_Procedure transforms the
3661 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3662 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3663 the target's overriding subprogram kind.
3665 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
3666 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{63}
3667 @section Pragma Implicit_Packing
3670 @geindex Rational Profile
3672 Syntax:
3674 @example
3675 pragma Implicit_Packing;
3676 @end example
3678 This is a configuration pragma that requests implicit packing for packed
3679 arrays for which a size clause is given but no explicit pragma Pack or
3680 specification of Component_Size is present. It also applies to records
3681 where no record representation clause is present. Consider this example:
3683 @example
3684 type R is array (0 .. 7) of Boolean;
3685 for R'Size use 8;
3686 @end example
3688 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3689 does not change the layout of a composite object. So the Size clause in the
3690 above example is normally rejected, since the default layout of the array uses
3691 8-bit components, and thus the array requires a minimum of 64 bits.
3693 If this declaration is compiled in a region of code covered by an occurrence
3694 of the configuration pragma Implicit_Packing, then the Size clause in this
3695 and similar examples will cause implicit packing and thus be accepted. For
3696 this implicit packing to occur, the type in question must be an array of small
3697 components whose size is known at compile time, and the Size clause must
3698 specify the exact size that corresponds to the number of elements in the array
3699 multiplied by the size in bits of the component type (both single and
3700 multi-dimensioned arrays can be controlled with this pragma).
3702 @geindex Array packing
3704 Similarly, the following example shows the use in the record case
3706 @example
3707 type r is record
3708    a, b, c, d, e, f, g, h : boolean;
3709    chr                    : character;
3710 end record;
3711 for r'size use 16;
3712 @end example
3714 Without a pragma Pack, each Boolean field requires 8 bits, so the
3715 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
3716 sufficient. The use of pragma Implicit_Packing allows this record
3717 declaration to compile without an explicit pragma Pack.
3719 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
3720 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{64}
3721 @section Pragma Import_Function
3724 Syntax:
3726 @example
3727 pragma Import_Function (
3728      [Internal                 =>] LOCAL_NAME,
3729   [, [External                 =>] EXTERNAL_SYMBOL]
3730   [, [Parameter_Types          =>] PARAMETER_TYPES]
3731   [, [Result_Type              =>] SUBTYPE_MARK]
3732   [, [Mechanism                =>] MECHANISM]
3733   [, [Result_Mechanism         =>] MECHANISM_NAME]);
3735 EXTERNAL_SYMBOL ::=
3736   IDENTIFIER
3737 | static_string_EXPRESSION
3739 PARAMETER_TYPES ::=
3740   null
3741 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3743 TYPE_DESIGNATOR ::=
3744   subtype_NAME
3745 | subtype_Name ' Access
3747 MECHANISM ::=
3748   MECHANISM_NAME
3749 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3751 MECHANISM_ASSOCIATION ::=
3752   [formal_parameter_NAME =>] MECHANISM_NAME
3754 MECHANISM_NAME ::=
3755   Value
3756 | Reference
3757 @end example
3759 This pragma is used in conjunction with a pragma @cite{Import} to
3760 specify additional information for an imported function.  The pragma
3761 @cite{Import} (or equivalent pragma @cite{Interface}) must precede the
3762 @cite{Import_Function} pragma and both must appear in the same
3763 declarative part as the function specification.
3765 The @cite{Internal} argument must uniquely designate
3766 the function to which the
3767 pragma applies.  If more than one function name exists of this name in
3768 the declarative part you must use the @cite{Parameter_Types} and
3769 @cite{Result_Type} parameters to achieve the required unique
3770 designation.  Subtype marks in these parameters must exactly match the
3771 subtypes in the corresponding function specification, using positional
3772 notation to match parameters with subtype marks.
3773 The form with an @cite{'Access} attribute can be used to match an
3774 anonymous access parameter.
3776 You may optionally use the @cite{Mechanism} and @cite{Result_Mechanism}
3777 parameters to specify passing mechanisms for the
3778 parameters and result.  If you specify a single mechanism name, it
3779 applies to all parameters.  Otherwise you may specify a mechanism on a
3780 parameter by parameter basis using either positional or named
3781 notation.  If the mechanism is not specified, the default mechanism
3782 is used.
3784 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
3785 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{65}
3786 @section Pragma Import_Object
3789 Syntax:
3791 @example
3792 pragma Import_Object
3793      [Internal =>] LOCAL_NAME
3794   [, [External =>] EXTERNAL_SYMBOL]
3795   [, [Size     =>] EXTERNAL_SYMBOL]);
3797 EXTERNAL_SYMBOL ::=
3798   IDENTIFIER
3799 | static_string_EXPRESSION
3800 @end example
3802 This pragma designates an object as imported, and apart from the
3803 extended rules for external symbols, is identical in effect to the use of
3804 the normal @cite{Import} pragma applied to an object.  Unlike the
3805 subprogram case, you need not use a separate @cite{Import} pragma,
3806 although you may do so (and probably should do so from a portability
3807 point of view).  @cite{size} is syntax checked, but otherwise ignored by
3808 GNAT.
3810 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
3811 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{66}
3812 @section Pragma Import_Procedure
3815 Syntax:
3817 @example
3818 pragma Import_Procedure (
3819      [Internal                 =>] LOCAL_NAME
3820   [, [External                 =>] EXTERNAL_SYMBOL]
3821   [, [Parameter_Types          =>] PARAMETER_TYPES]
3822   [, [Mechanism                =>] MECHANISM]);
3824 EXTERNAL_SYMBOL ::=
3825   IDENTIFIER
3826 | static_string_EXPRESSION
3828 PARAMETER_TYPES ::=
3829   null
3830 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3832 TYPE_DESIGNATOR ::=
3833   subtype_NAME
3834 | subtype_Name ' Access
3836 MECHANISM ::=
3837   MECHANISM_NAME
3838 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3840 MECHANISM_ASSOCIATION ::=
3841   [formal_parameter_NAME =>] MECHANISM_NAME
3843 MECHANISM_NAME ::= Value | Reference
3844 @end example
3846 This pragma is identical to @cite{Import_Function} except that it
3847 applies to a procedure rather than a function and the parameters
3848 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3850 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
3851 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{67}
3852 @section Pragma Import_Valued_Procedure
3855 Syntax:
3857 @example
3858 pragma Import_Valued_Procedure (
3859      [Internal                 =>] LOCAL_NAME
3860   [, [External                 =>] EXTERNAL_SYMBOL]
3861   [, [Parameter_Types          =>] PARAMETER_TYPES]
3862   [, [Mechanism                =>] MECHANISM]);
3864 EXTERNAL_SYMBOL ::=
3865   IDENTIFIER
3866 | static_string_EXPRESSION
3868 PARAMETER_TYPES ::=
3869   null
3870 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3872 TYPE_DESIGNATOR ::=
3873   subtype_NAME
3874 | subtype_Name ' Access
3876 MECHANISM ::=
3877   MECHANISM_NAME
3878 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3880 MECHANISM_ASSOCIATION ::=
3881   [formal_parameter_NAME =>] MECHANISM_NAME
3883 MECHANISM_NAME ::= Value | Reference
3884 @end example
3886 This pragma is identical to @cite{Import_Procedure} except that the
3887 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3888 mode @cite{OUT}, and externally the subprogram is treated as a function
3889 with this parameter as the result of the function.  The purpose of this
3890 capability is to allow the use of @cite{OUT} and @cite{IN OUT}
3891 parameters in interfacing to external functions (which are not permitted
3892 in Ada functions).  You may optionally use the @cite{Mechanism}
3893 parameters to specify passing mechanisms for the parameters.
3894 If you specify a single mechanism name, it applies to all parameters.
3895 Otherwise you may specify a mechanism on a parameter by parameter
3896 basis using either positional or named notation.  If the mechanism is not
3897 specified, the default mechanism is used.
3899 Note that it is important to use this pragma in conjunction with a separate
3900 pragma Import that specifies the desired convention, since otherwise the
3901 default convention is Ada, which is almost certainly not what is required.
3903 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
3904 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{68}
3905 @section Pragma Independent
3908 Syntax:
3910 @example
3911 pragma Independent (Local_NAME);
3912 @end example
3914 This pragma is standard in Ada 2012 mode (which also provides an aspect
3915 of the same name). It is also available as an implementation-defined
3916 pragma in all earlier versions. It specifies that the
3917 designated object or all objects of the designated type must be
3918 independently addressable. This means that separate tasks can safely
3919 manipulate such objects. For example, if two components of a record are
3920 independent, then two separate tasks may access these two components.
3921 This may place
3922 constraints on the representation of the object (for instance prohibiting
3923 tight packing).
3925 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
3926 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{69}
3927 @section Pragma Independent_Components
3930 Syntax:
3932 @example
3933 pragma Independent_Components (Local_NAME);
3934 @end example
3936 This pragma is standard in Ada 2012 mode (which also provides an aspect
3937 of the same name). It is also available as an implementation-defined
3938 pragma in all earlier versions. It specifies that the components of the
3939 designated object, or the components of each object of the designated
3940 type, must be
3941 independently addressable. This means that separate tasks can safely
3942 manipulate separate components in the composite object. This may place
3943 constraints on the representation of the object (for instance prohibiting
3944 tight packing).
3946 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
3947 @anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{6a}
3948 @section Pragma Initial_Condition
3951 For the description of this pragma, see SPARK 2014 Reference Manual,
3952 section 7.1.6.
3954 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
3955 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{6b}
3956 @section Pragma Initialize_Scalars
3959 @geindex debugging with Initialize_Scalars
3961 Syntax:
3963 @example
3964 pragma Initialize_Scalars;
3965 @end example
3967 This pragma is similar to @cite{Normalize_Scalars} conceptually but has
3968 two important differences.  First, there is no requirement for the pragma
3969 to be used uniformly in all units of a partition, in particular, it is fine
3970 to use this just for some or all of the application units of a partition,
3971 without needing to recompile the run-time library.
3973 In the case where some units are compiled with the pragma, and some without,
3974 then a declaration of a variable where the type is defined in package
3975 Standard or is locally declared will always be subject to initialization,
3976 as will any declaration of a scalar variable.  For composite variables,
3977 whether the variable is initialized may also depend on whether the package
3978 in which the type of the variable is declared is compiled with the pragma.
3980 The other important difference is that you can control the value used
3981 for initializing scalar objects.  At bind time, you can select several
3982 options for initialization. You can
3983 initialize with invalid values (similar to Normalize_Scalars, though for
3984 Initialize_Scalars it is not always possible to determine the invalid
3985 values in complex cases like signed component fields with non-standard
3986 sizes). You can also initialize with high or
3987 low values, or with a specified bit pattern.  See the GNAT
3988 User's Guide for binder options for specifying these cases.
3990 This means that you can compile a program, and then without having to
3991 recompile the program, you can run it with different values being used
3992 for initializing otherwise uninitialized values, to test if your program
3993 behavior depends on the choice.  Of course the behavior should not change,
3994 and if it does, then most likely you have an incorrect reference to an
3995 uninitialized value.
3997 It is even possible to change the value at execution time eliminating even
3998 the need to rebind with a different switch using an environment variable.
3999 See the GNAT User's Guide for details.
4001 Note that pragma @cite{Initialize_Scalars} is particularly useful in
4002 conjunction with the enhanced validity checking that is now provided
4003 in GNAT, which checks for invalid values under more conditions.
4004 Using this feature (see description of the @emph{-gnatV} flag in the
4005 GNAT User's Guide) in conjunction with
4006 pragma @cite{Initialize_Scalars}
4007 provides a powerful new tool to assist in the detection of problems
4008 caused by uninitialized variables.
4010 Note: the use of @cite{Initialize_Scalars} has a fairly extensive
4011 effect on the generated code. This may cause your code to be
4012 substantially larger. It may also cause an increase in the amount
4013 of stack required, so it is probably a good idea to turn on stack
4014 checking (see description of stack checking in the GNAT
4015 User's Guide) when using this pragma.
4017 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4018 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{6c}
4019 @section Pragma Initializes
4022 For the description of this pragma, see SPARK 2014 Reference Manual,
4023 section 7.1.5.
4025 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4026 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{6d}
4027 @section Pragma Inline_Always
4030 Syntax:
4032 @example
4033 pragma Inline_Always (NAME [, NAME]);
4034 @end example
4036 Similar to pragma @cite{Inline} except that inlining is not subject to
4037 the use of option @emph{-gnatn} or @emph{-gnatN} and the inlining
4038 happens regardless of whether these options are used.
4040 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4041 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{6e}
4042 @section Pragma Inline_Generic
4045 Syntax:
4047 @example
4048 pragma Inline_Generic (GNAME @{, GNAME@});
4050 GNAME ::= generic_unit_NAME | generic_instance_NAME
4051 @end example
4053 This pragma is provided for compatibility with Dec Ada 83. It has
4054 no effect in @cite{GNAT} (which always inlines generics), other
4055 than to check that the given names are all names of generic units or
4056 generic instances.
4058 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4059 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{6f}
4060 @section Pragma Interface
4063 Syntax:
4065 @example
4066 pragma Interface (
4067      [Convention    =>] convention_identifier,
4068      [Entity        =>] local_NAME
4069   [, [External_Name =>] static_string_expression]
4070   [, [Link_Name     =>] static_string_expression]);
4071 @end example
4073 This pragma is identical in syntax and semantics to
4074 the standard Ada pragma @cite{Import}.  It is provided for compatibility
4075 with Ada 83.  The definition is upwards compatible both with pragma
4076 @cite{Interface} as defined in the Ada 83 Reference Manual, and also
4077 with some extended implementations of this pragma in certain Ada 83
4078 implementations.  The only difference between pragma @cite{Interface}
4079 and pragma @cite{Import} is that there is special circuitry to allow
4080 both pragmas to appear for the same subprogram entity (normally it
4081 is illegal to have multiple @cite{Import} pragmas. This is useful in
4082 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4083 Ada 83 compilers.
4085 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4086 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{70}
4087 @section Pragma Interface_Name
4090 Syntax:
4092 @example
4093 pragma Interface_Name (
4094      [Entity        =>] LOCAL_NAME
4095   [, [External_Name =>] static_string_EXPRESSION]
4096   [, [Link_Name     =>] static_string_EXPRESSION]);
4097 @end example
4099 This pragma provides an alternative way of specifying the interface name
4100 for an interfaced subprogram, and is provided for compatibility with Ada
4101 83 compilers that use the pragma for this purpose.  You must provide at
4102 least one of @cite{External_Name} or @cite{Link_Name}.
4104 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4105 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{71}
4106 @section Pragma Interrupt_Handler
4109 Syntax:
4111 @example
4112 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4113 @end example
4115 This program unit pragma is supported for parameterless protected procedures
4116 as described in Annex C of the Ada Reference Manual. On the AAMP target
4117 the pragma can also be specified for nonprotected parameterless procedures
4118 that are declared at the library level (which includes procedures
4119 declared at the top level of a library package). In the case of AAMP,
4120 when this pragma is applied to a nonprotected procedure, the instruction
4121 @cite{IERET} is generated for returns from the procedure, enabling
4122 maskable interrupts, in place of the normal return instruction.
4124 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4125 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{72}
4126 @section Pragma Interrupt_State
4129 Syntax:
4131 @example
4132 pragma Interrupt_State
4133  ([Name  =>] value,
4134   [State =>] SYSTEM | RUNTIME | USER);
4135 @end example
4137 Normally certain interrupts are reserved to the implementation.  Any attempt
4138 to attach an interrupt causes Program_Error to be raised, as described in
4139 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
4140 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4141 reserved to the implementation, so that @code{Ctrl-C} can be used to
4142 interrupt execution.  Additionally, signals such as @cite{SIGSEGV},
4143 @cite{SIGABRT}, @cite{SIGFPE} and @cite{SIGILL} are often mapped to specific
4144 Ada exceptions, or used to implement run-time functions such as the
4145 @cite{abort} statement and stack overflow checking.
4147 Pragma @cite{Interrupt_State} provides a general mechanism for overriding
4148 such uses of interrupts.  It subsumes the functionality of pragma
4149 @cite{Unreserve_All_Interrupts}.  Pragma @cite{Interrupt_State} is not
4150 available on Windows or VMS.  On all other platforms than VxWorks,
4151 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4152 and may be used to mark interrupts required by the board support package
4153 as reserved.
4155 Interrupts can be in one of three states:
4158 @itemize *
4160 @item 
4161 System
4163 The interrupt is reserved (no Ada handler can be installed), and the
4164 Ada run-time may not install a handler. As a result you are guaranteed
4165 standard system default action if this interrupt is raised.
4167 @item 
4168 Runtime
4170 The interrupt is reserved (no Ada handler can be installed). The run time
4171 is allowed to install a handler for internal control purposes, but is
4172 not required to do so.
4174 @item 
4175 User
4177 The interrupt is unreserved.  The user may install a handler to provide
4178 some other action.
4179 @end itemize
4181 These states are the allowed values of the @cite{State} parameter of the
4182 pragma.  The @cite{Name} parameter is a value of the type
4183 @cite{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4184 @cite{Ada.Interrupts.Names}.
4186 This is a configuration pragma, and the binder will check that there
4187 are no inconsistencies between different units in a partition in how a
4188 given interrupt is specified. It may appear anywhere a pragma is legal.
4190 The effect is to move the interrupt to the specified state.
4192 By declaring interrupts to be SYSTEM, you guarantee the standard system
4193 action, such as a core dump.
4195 By declaring interrupts to be USER, you guarantee that you can install
4196 a handler.
4198 Note that certain signals on many operating systems cannot be caught and
4199 handled by applications.  In such cases, the pragma is ignored.  See the
4200 operating system documentation, or the value of the array @cite{Reserved}
4201 declared in the spec of package @cite{System.OS_Interface}.
4203 Overriding the default state of signals used by the Ada runtime may interfere
4204 with an application's runtime behavior in the cases of the synchronous signals,
4205 and in the case of the signal used to implement the @cite{abort} statement.
4207 @node Pragma Invariant,Pragma Java_Constructor,Pragma Interrupt_State,Implementation Defined Pragmas
4208 @anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{73}
4209 @section Pragma Invariant
4212 Syntax:
4214 @example
4215 pragma Invariant
4216   ([Entity =>]    private_type_LOCAL_NAME,
4217    [Check  =>]    EXPRESSION
4218    [,[Message =>] String_Expression]);
4219 @end example
4221 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4222 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4223 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4224 requires the use of the aspect syntax, which is not available except in 2012
4225 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4226 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4227 note that the aspect Invariant is a synonym in GNAT for the aspect
4228 Type_Invariant, but there is no pragma Type_Invariant.
4230 The pragma must appear within the visible part of the package specification,
4231 after the type to which its Entity argument appears. As with the Invariant
4232 aspect, the Check expression is not analyzed until the end of the visible
4233 part of the package, so it may contain forward references. The Message
4234 argument, if present, provides the exception message used if the invariant
4235 is violated. If no Message parameter is provided, a default message that
4236 identifies the line on which the pragma appears is used.
4238 It is permissible to have multiple Invariants for the same type entity, in
4239 which case they are and'ed together. It is permissible to use this pragma
4240 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4241 invariant pragma for the same entity.
4243 For further details on the use of this pragma, see the Ada 2012 documentation
4244 of the Type_Invariant aspect.
4246 @node Pragma Java_Constructor,Pragma Java_Interface,Pragma Invariant,Implementation Defined Pragmas
4247 @anchor{gnat_rm/implementation_defined_pragmas pragma-java-constructor}@anchor{74}
4248 @section Pragma Java_Constructor
4251 Syntax:
4253 @example
4254 pragma Java_Constructor ([Entity =>] function_LOCAL_NAME);
4255 @end example
4257 This pragma is used to assert that the specified Ada function should be
4258 mapped to the Java constructor for some Ada tagged record type.
4260 See section 7.3.2 of the
4261 @cite{GNAT User's Guide: Supplement for the JVM Platform.}
4262 for related information.
4264 @node Pragma Java_Interface,Pragma Keep_Names,Pragma Java_Constructor,Implementation Defined Pragmas
4265 @anchor{gnat_rm/implementation_defined_pragmas pragma-java-interface}@anchor{75}
4266 @section Pragma Java_Interface
4269 Syntax:
4271 @example
4272 pragma Java_Interface ([Entity =>] abstract_tagged_type_LOCAL_NAME);
4273 @end example
4275 This pragma is used to assert that the specified Ada abstract tagged type
4276 is to be mapped to a Java interface name.
4278 See sections 7.1 and 7.2 of the
4279 @cite{GNAT User's Guide: Supplement for the JVM Platform.}
4280 for related information.
4282 @node Pragma Keep_Names,Pragma License,Pragma Java_Interface,Implementation Defined Pragmas
4283 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{76}
4284 @section Pragma Keep_Names
4287 Syntax:
4289 @example
4290 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4291 @end example
4293 The @cite{LOCAL_NAME} argument
4294 must refer to an enumeration first subtype
4295 in the current declarative part. The effect is to retain the enumeration
4296 literal names for use by @cite{Image} and @cite{Value} even if a global
4297 @cite{Discard_Names} pragma applies. This is useful when you want to
4298 generally suppress enumeration literal names and for example you therefore
4299 use a @cite{Discard_Names} pragma in the @code{gnat.adc} file, but you
4300 want to retain the names for specific enumeration types.
4302 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4303 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{77}
4304 @section Pragma License
4307 @geindex License checking
4309 Syntax:
4311 @example
4312 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4313 @end example
4315 This pragma is provided to allow automated checking for appropriate license
4316 conditions with respect to the standard and modified GPL.  A pragma
4317 @cite{License}, which is a configuration pragma that typically appears at
4318 the start of a source file or in a separate @code{gnat.adc} file, specifies
4319 the licensing conditions of a unit as follows:
4322 @itemize *
4324 @item 
4325 Unrestricted
4326 This is used for a unit that can be freely used with no license restrictions.
4327 Examples of such units are public domain units, and units from the Ada
4328 Reference Manual.
4330 @item 
4332 This is used for a unit that is licensed under the unmodified GPL, and which
4333 therefore cannot be @cite{with}'ed by a restricted unit.
4335 @item 
4336 Modified_GPL
4337 This is used for a unit licensed under the GNAT modified GPL that includes
4338 a special exception paragraph that specifically permits the inclusion of
4339 the unit in programs without requiring the entire program to be released
4340 under the GPL.
4342 @item 
4343 Restricted
4344 This is used for a unit that is restricted in that it is not permitted to
4345 depend on units that are licensed under the GPL.  Typical examples are
4346 proprietary code that is to be released under more restrictive license
4347 conditions.  Note that restricted units are permitted to @cite{with} units
4348 which are licensed under the modified GPL (this is the whole point of the
4349 modified GPL).
4350 @end itemize
4352 Normally a unit with no @cite{License} pragma is considered to have an
4353 unknown license, and no checking is done.  However, standard GNAT headers
4354 are recognized, and license information is derived from them as follows.
4356 A GNAT license header starts with a line containing 78 hyphens.  The following
4357 comment text is searched for the appearance of any of the following strings.
4359 If the string 'GNU General Public License' is found, then the unit is assumed
4360 to have GPL license, unless the string 'As a special exception' follows, in
4361 which case the license is assumed to be modified GPL.
4363 If one of the strings
4364 'This specification is adapted from the Ada Semantic Interface' or
4365 'This specification is derived from the Ada Reference Manual' is found
4366 then the unit is assumed to be unrestricted.
4368 These default actions means that a program with a restricted license pragma
4369 will automatically get warnings if a GPL unit is inappropriately
4370 @cite{with}'ed.  For example, the program:
4372 @example
4373 with Sem_Ch3;
4374 with GNAT.Sockets;
4375 procedure Secret_Stuff is
4376   ...
4377 end Secret_Stuff
4378 @end example
4380 if compiled with pragma @cite{License} (@cite{Restricted}) in a
4381 @code{gnat.adc} file will generate the warning:
4383 @example
4384 1.  with Sem_Ch3;
4385         |
4386    >>> license of withed unit "Sem_Ch3" is incompatible
4388 2.  with GNAT.Sockets;
4389 3.  procedure Secret_Stuff is
4390 @end example
4392 Here we get a warning on @cite{Sem_Ch3} since it is part of the GNAT
4393 compiler and is licensed under the
4394 GPL, but no warning for @cite{GNAT.Sockets} which is part of the GNAT
4395 run time, and is therefore licensed under the modified GPL.
4397 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4398 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{78}
4399 @section Pragma Link_With
4402 Syntax:
4404 @example
4405 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4406 @end example
4408 This pragma is provided for compatibility with certain Ada 83 compilers.
4409 It has exactly the same effect as pragma @cite{Linker_Options} except
4410 that spaces occurring within one of the string expressions are treated
4411 as separators. For example, in the following case:
4413 @example
4414 pragma Link_With ("-labc -ldef");
4415 @end example
4417 results in passing the strings @cite{-labc} and @cite{-ldef} as two
4418 separate arguments to the linker. In addition pragma Link_With allows
4419 multiple arguments, with the same effect as successive pragmas.
4421 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4422 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{79}
4423 @section Pragma Linker_Alias
4426 Syntax:
4428 @example
4429 pragma Linker_Alias (
4430   [Entity =>] LOCAL_NAME,
4431   [Target =>] static_string_EXPRESSION);
4432 @end example
4434 @cite{LOCAL_NAME} must refer to an object that is declared at the library
4435 level. This pragma establishes the given entity as a linker alias for the
4436 given target. It is equivalent to @cite{__attribute__((alias))} in GNU C
4437 and causes @cite{LOCAL_NAME} to be emitted as an alias for the symbol
4438 @cite{static_string_EXPRESSION} in the object file, that is to say no space
4439 is reserved for @cite{LOCAL_NAME} by the assembler and it will be resolved
4440 to the same address as @cite{static_string_EXPRESSION} by the linker.
4442 The actual linker name for the target must be used (e.g., the fully
4443 encoded name with qualification in Ada, or the mangled name in C++),
4444 or it must be declared using the C convention with @cite{pragma Import}
4445 or @cite{pragma Export}.
4447 Not all target machines support this pragma. On some of them it is accepted
4448 only if @cite{pragma Weak_External} has been applied to @cite{LOCAL_NAME}.
4450 @example
4451 --  Example of the use of pragma Linker_Alias
4453 package p is
4454   i : Integer := 1;
4455   pragma Export (C, i);
4457   new_name_for_i : Integer;
4458   pragma Linker_Alias (new_name_for_i, "i");
4459 end p;
4460 @end example
4462 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4463 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{7a}
4464 @section Pragma Linker_Constructor
4467 Syntax:
4469 @example
4470 pragma Linker_Constructor (procedure_LOCAL_NAME);
4471 @end example
4473 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4474 is declared at the library level. A procedure to which this pragma is
4475 applied will be treated as an initialization routine by the linker.
4476 It is equivalent to @cite{__attribute__((constructor))} in GNU C and
4477 causes @cite{procedure_LOCAL_NAME} to be invoked before the entry point
4478 of the executable is called (or immediately after the shared library is
4479 loaded if the procedure is linked in a shared library), in particular
4480 before the Ada run-time environment is set up.
4482 Because of these specific contexts, the set of operations such a procedure
4483 can perform is very limited and the type of objects it can manipulate is
4484 essentially restricted to the elementary types. In particular, it must only
4485 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4487 This pragma is used by GNAT to implement auto-initialization of shared Stand
4488 Alone Libraries, which provides a related capability without the restrictions
4489 listed above. Where possible, the use of Stand Alone Libraries is preferable
4490 to the use of this pragma.
4492 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4493 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{7b}
4494 @section Pragma Linker_Destructor
4497 Syntax:
4499 @example
4500 pragma Linker_Destructor (procedure_LOCAL_NAME);
4501 @end example
4503 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4504 is declared at the library level. A procedure to which this pragma is
4505 applied will be treated as a finalization routine by the linker.
4506 It is equivalent to @cite{__attribute__((destructor))} in GNU C and
4507 causes @cite{procedure_LOCAL_NAME} to be invoked after the entry point
4508 of the executable has exited (or immediately before the shared library
4509 is unloaded if the procedure is linked in a shared library), in particular
4510 after the Ada run-time environment is shut down.
4512 See @cite{pragma Linker_Constructor} for the set of restrictions that apply
4513 because of these specific contexts.
4515 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4516 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{7c}
4517 @section Pragma Linker_Section
4520 Syntax:
4522 @example
4523 pragma Linker_Section (
4524   [Entity  =>] LOCAL_NAME,
4525   [Section =>] static_string_EXPRESSION);
4526 @end example
4528 @cite{LOCAL_NAME} must refer to an object, type, or subprogram that is
4529 declared at the library level. This pragma specifies the name of the
4530 linker section for the given entity. It is equivalent to
4531 @cite{__attribute__((section))} in GNU C and causes @cite{LOCAL_NAME} to
4532 be placed in the @cite{static_string_EXPRESSION} section of the
4533 executable (assuming the linker doesn't rename the section).
4534 GNAT also provides an implementation defined aspect of the same name.
4536 In the case of specifying this aspect for a type, the effect is to
4537 specify the corresponding for all library level objects of the type which
4538 do not have an explicit linker section set. Note that this only applies to
4539 whole objects, not to components of composite objects.
4541 In the case of a subprogram, the linker section applies to all previously
4542 declared matching overloaded subprograms in the current declarative part
4543 which do not already have a linker section assigned. The linker section
4544 aspect is useful in this case for specifying different linker sections
4545 for different elements of such an overloaded set.
4547 Note that an empty string specifies that no linker section is specified.
4548 This is not quite the same as omitting the pragma or aspect, since it
4549 can be used to specify that one element of an overloaded set of subprograms
4550 has the default linker section, or that one object of a type for which a
4551 linker section is specified should has the default linker section.
4553 The compiler normally places library-level entities in standard sections
4554 depending on the class: procedures and functions generally go in the
4555 @cite{.text} section, initialized variables in the @cite{.data} section
4556 and uninitialized variables in the @cite{.bss} section.
4558 Other, special sections may exist on given target machines to map special
4559 hardware, for example I/O ports or flash memory. This pragma is a means to
4560 defer the final layout of the executable to the linker, thus fully working
4561 at the symbolic level with the compiler.
4563 Some file formats do not support arbitrary sections so not all target
4564 machines support this pragma. The use of this pragma may cause a program
4565 execution to be erroneous if it is used to place an entity into an
4566 inappropriate section (e.g., a modified variable into the @cite{.text}
4567 section). See also @cite{pragma Persistent_BSS}.
4569 @example
4570 --  Example of the use of pragma Linker_Section
4572 package IO_Card is
4573   Port_A : Integer;
4574   pragma Volatile (Port_A);
4575   pragma Linker_Section (Port_A, ".bss.port_a");
4577   Port_B : Integer;
4578   pragma Volatile (Port_B);
4579   pragma Linker_Section (Port_B, ".bss.port_b");
4581   type Port_Type is new Integer with Linker_Section => ".bss";
4582   PA : Port_Type with Linker_Section => ".bss.PA";
4583   PB : Port_Type; --  ends up in linker section ".bss"
4585   procedure Q with Linker_Section => "Qsection";
4586 end IO_Card;
4587 @end example
4589 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4590 @anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{7d}
4591 @section Pragma Lock_Free
4594 Syntax:
4595 This pragma may be specified for protected types or objects. It specifies that
4596 the implementation of protected operations must be implemented without locks.
4597 Compilation fails if the compiler cannot generate lock-free code for the
4598 operations.
4600 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
4601 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{7e}
4602 @section Pragma Loop_Invariant
4605 Syntax:
4607 @example
4608 pragma Loop_Invariant ( boolean_EXPRESSION );
4609 @end example
4611 The effect of this pragma is similar to that of pragma @cite{Assert},
4612 except that in an @cite{Assertion_Policy} pragma, the identifier
4613 @cite{Loop_Invariant} is used to control whether it is ignored or checked
4614 (or disabled).
4616 @cite{Loop_Invariant} can only appear as one of the items in the sequence
4617 of statements of a loop body, or nested inside block statements that
4618 appear in the sequence of statements of a loop body.
4619 The intention is that it be used to
4620 represent a "loop invariant" assertion, i.e. something that is true each
4621 time through the loop, and which can be used to show that the loop is
4622 achieving its purpose.
4624 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4625 apply to the same loop should be grouped in the same sequence of
4626 statements.
4628 To aid in writing such invariants, the special attribute @cite{Loop_Entry}
4629 may be used to refer to the value of an expression on entry to the loop. This
4630 attribute can only be used within the expression of a @cite{Loop_Invariant}
4631 pragma. For full details, see documentation of attribute @cite{Loop_Entry}.
4633 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
4634 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{7f}
4635 @section Pragma Loop_Optimize
4638 Syntax:
4640 @example
4641 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4643 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
4644 @end example
4646 This pragma must appear immediately within a loop statement.  It allows the
4647 programmer to specify optimization hints for the enclosing loop.  The hints
4648 are not mutually exclusive and can be freely mixed, but not all combinations
4649 will yield a sensible outcome.
4651 There are five supported optimization hints for a loop:
4654 @itemize *
4656 @item 
4657 Ivdep
4659 The programmer asserts that there are no loop-carried dependencies
4660 which would prevent consecutive iterations of the loop from being
4661 executed simultaneously.
4663 @item 
4664 No_Unroll
4666 The loop must not be unrolled.  This is a strong hint: the compiler will not
4667 unroll a loop marked with this hint.
4669 @item 
4670 Unroll
4672 The loop should be unrolled.  This is a weak hint: the compiler will try to
4673 apply unrolling to this loop preferably to other optimizations, notably
4674 vectorization, but there is no guarantee that the loop will be unrolled.
4676 @item 
4677 No_Vector
4679 The loop must not be vectorized.  This is a strong hint: the compiler will not
4680 vectorize a loop marked with this hint.
4682 @item 
4683 Vector
4685 The loop should be vectorized.  This is a weak hint: the compiler will try to
4686 apply vectorization to this loop preferably to other optimizations, notably
4687 unrolling, but there is no guarantee that the loop will be vectorized.
4688 @end itemize
4690 These hints do not remove the need to pass the appropriate switches to the
4691 compiler in order to enable the relevant optimizations, that is to say
4692 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
4693 vectorization.
4695 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
4696 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{80}
4697 @section Pragma Loop_Variant
4700 Syntax:
4702 @example
4703 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
4704 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
4705 CHANGE_DIRECTION ::= Increases | Decreases
4706 @end example
4708 @cite{Loop_Variant} can only appear as one of the items in the sequence
4709 of statements of a loop body, or nested inside block statements that
4710 appear in the sequence of statements of a loop body.
4711 It allows the specification of quantities which must always
4712 decrease or increase in successive iterations of the loop. In its simplest
4713 form, just one expression is specified, whose value must increase or decrease
4714 on each iteration of the loop.
4716 In a more complex form, multiple arguments can be given which are intepreted
4717 in a nesting lexicographic manner. For example:
4719 @example
4720 pragma Loop_Variant (Increases => X, Decreases => Y);
4721 @end example
4723 specifies that each time through the loop either X increases, or X stays
4724 the same and Y decreases. A @cite{Loop_Variant} pragma ensures that the
4725 loop is making progress. It can be useful in helping to show informally
4726 or prove formally that the loop always terminates.
4728 @cite{Loop_Variant} is an assertion whose effect can be controlled using
4729 an @cite{Assertion_Policy} with a check name of @cite{Loop_Variant}. The
4730 policy can be @cite{Check} to enable the loop variant check, @cite{Ignore}
4731 to ignore the check (in which case the pragma has no effect on the program),
4732 or @cite{Disable} in which case the pragma is not even checked for correct
4733 syntax.
4735 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4736 apply to the same loop should be grouped in the same sequence of
4737 statements.
4739 The @cite{Loop_Entry} attribute may be used within the expressions of the
4740 @cite{Loop_Variant} pragma to refer to values on entry to the loop.
4742 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
4743 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{81}
4744 @section Pragma Machine_Attribute
4747 Syntax:
4749 @example
4750 pragma Machine_Attribute (
4751      [Entity         =>] LOCAL_NAME,
4752      [Attribute_Name =>] static_string_EXPRESSION
4753   [, [Info           =>] static_EXPRESSION] );
4754 @end example
4756 Machine-dependent attributes can be specified for types and/or
4757 declarations.  This pragma is semantically equivalent to
4758 @cite{__attribute__((`attribute_name}))` (if @cite{info} is not
4759 specified) or @cite{__attribute__((`attribute_name`(`info})))
4760 in GNU C, where @code{attribute_name} is recognized by the
4761 compiler middle-end or the @cite{TARGET_ATTRIBUTE_TABLE} machine
4762 specific macro.  A string literal for the optional parameter @cite{info}
4763 is transformed into an identifier, which may make this pragma unusable
4764 for some attributes.
4765 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
4767 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
4768 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{82}
4769 @section Pragma Main
4772 Syntax:
4774 @example
4775 pragma Main
4776  (MAIN_OPTION [, MAIN_OPTION]);
4778 MAIN_OPTION ::=
4779   [Stack_Size              =>] static_integer_EXPRESSION
4780 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
4781 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
4782 @end example
4784 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4785 no effect in GNAT, other than being syntax checked.
4787 @node Pragma Main_Storage,Pragma No_Body,Pragma Main,Implementation Defined Pragmas
4788 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{83}
4789 @section Pragma Main_Storage
4792 Syntax:
4794 @example
4795 pragma Main_Storage
4796   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
4798 MAIN_STORAGE_OPTION ::=
4799   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
4800 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
4801 @end example
4803 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4804 no effect in GNAT, other than being syntax checked.
4806 @node Pragma No_Body,Pragma No_Elaboration_Code_All,Pragma Main_Storage,Implementation Defined Pragmas
4807 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{84}
4808 @section Pragma No_Body
4811 Syntax:
4813 @example
4814 pragma No_Body;
4815 @end example
4817 There are a number of cases in which a package spec does not require a body,
4818 and in fact a body is not permitted. GNAT will not permit the spec to be
4819 compiled if there is a body around. The pragma No_Body allows you to provide
4820 a body file, even in a case where no body is allowed. The body file must
4821 contain only comments and a single No_Body pragma. This is recognized by
4822 the compiler as indicating that no body is logically present.
4824 This is particularly useful during maintenance when a package is modified in
4825 such a way that a body needed before is no longer needed. The provision of a
4826 dummy body with a No_Body pragma ensures that there is no interference from
4827 earlier versions of the package body.
4829 @node Pragma No_Elaboration_Code_All,Pragma No_Inline,Pragma No_Body,Implementation Defined Pragmas
4830 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{85}
4831 @section Pragma No_Elaboration_Code_All
4834 Syntax:
4836 @example
4837 pragma No_Elaboration_Code_All [(program_unit_NAME)];
4838 @end example
4840 This is a program unit pragma (there is also an equivalent aspect of the
4841 same name) that establishes the restriction @cite{No_Elaboration_Code} for
4842 the current unit and any extended main source units (body and subunits.
4843 It also has has the effect of enforcing a transitive application of this
4844 aspect, so that if any unit is implicitly or explicitly WITH'ed by the
4845 current unit, it must also have the No_Elaboration_Code_All aspect set.
4846 It may be applied to package or subprogram specs or their generic versions.
4848 @node Pragma No_Inline,Pragma No_Return,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
4849 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{86}
4850 @section Pragma No_Inline
4853 Syntax:
4855 @example
4856 pragma No_Inline (NAME @{, NAME@});
4857 @end example
4859 This pragma suppresses inlining for the callable entity or the instances of
4860 the generic subprogram designated by @cite{NAME}, including inlining that
4861 results from the use of pragma @cite{Inline}.  This pragma is always active,
4862 in particular it is not subject to the use of option @emph{-gnatn} or
4863 @emph{-gnatN}.  It is illegal to specify both pragma @cite{No_Inline} and
4864 pragma @cite{Inline_Always} for the same @cite{NAME}.
4866 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
4867 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{87}
4868 @section Pragma No_Return
4871 Syntax:
4873 @example
4874 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
4875 @end example
4877 Each @cite{procedure_LOCAL_NAME} argument must refer to one or more procedure
4878 declarations in the current declarative part.  A procedure to which this
4879 pragma is applied may not contain any explicit @cite{return} statements.
4880 In addition, if the procedure contains any implicit returns from falling
4881 off the end of a statement sequence, then execution of that implicit
4882 return will cause Program_Error to be raised.
4884 One use of this pragma is to identify procedures whose only purpose is to raise
4885 an exception. Another use of this pragma is to suppress incorrect warnings
4886 about missing returns in functions, where the last statement of a function
4887 statement sequence is a call to such a procedure.
4889 Note that in Ada 2005 mode, this pragma is part of the language. It is
4890 available in all earlier versions of Ada as an implementation-defined
4891 pragma.
4893 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
4894 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{88}
4895 @section Pragma No_Run_Time
4898 Syntax:
4900 @example
4901 pragma No_Run_Time;
4902 @end example
4904 This is an obsolete configuration pragma that historically was used to
4905 set up a runtime library with no object code. It is now used only for
4906 internal testing. The pragma has been superseded by the reconfigurable
4907 runtime capability of @cite{GNAT}.
4909 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
4910 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{89}
4911 @section Pragma No_Strict_Aliasing
4914 Syntax:
4916 @example
4917 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
4918 @end example
4920 @cite{type_LOCAL_NAME} must refer to an access type
4921 declaration in the current declarative part.  The effect is to inhibit
4922 strict aliasing optimization for the given type.  The form with no
4923 arguments is a configuration pragma which applies to all access types
4924 declared in units to which the pragma applies. For a detailed
4925 description of the strict aliasing optimization, and the situations
4926 in which it must be suppressed, see the section on Optimization and Strict Aliasing
4927 in the @cite{GNAT User's Guide}.
4929 This pragma currently has no effects on access to unconstrained array types.
4931 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
4932 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{8a}
4933 @section Pragma No_Tagged_Streams
4936 Syntax:
4938 @example
4939 pragma No_Tagged_Streams;
4940 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
4941 @end example
4943 Normally when a tagged type is introduced using a full type declaration,
4944 part of the processing includes generating stream access routines to be
4945 used by stream attributes referencing the type (or one of its subtypes
4946 or derived types). This can involve the generation of significant amounts
4947 of code which is wasted space if stream routines are not needed for the
4948 type in question.
4950 The @cite{No_Tagged_Streams} pragma causes the generation of these stream
4951 routines to be skipped, and any attempt to use stream operations on
4952 types subject to this pragma will be statically rejected as illegal.
4954 There are two forms of the pragma. The form with no arguments must appear
4955 in a declarative sequence or in the declarations of a package spec. This
4956 pragma affects all subsequent root tagged types declared in the declaration
4957 sequence, and specifies that no stream routines be generated. The form with
4958 an argument (for which there is also a corresponding aspect) specifies a
4959 single root tagged type for which stream routines are not to be generated.
4961 Once the pragma has been given for a particular root tagged type, all subtypes
4962 and derived types of this type inherit the pragma automatically, so the effect
4963 applies to a complete hierarchy (this is necessary to deal with the class-wide
4964 dispatching versions of the stream routines).
4966 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
4967 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{8b}
4968 @section Pragma Normalize_Scalars
4971 Syntax:
4973 @example
4974 pragma Normalize_Scalars;
4975 @end example
4977 This is a language defined pragma which is fully implemented in GNAT.  The
4978 effect is to cause all scalar objects that are not otherwise initialized
4979 to be initialized.  The initial values are implementation dependent and
4980 are as follows:
4983 @table @asis
4985 @item @emph{Standard.Character}
4987 Objects whose root type is Standard.Character are initialized to
4988 Character'Last unless the subtype range excludes NUL (in which case
4989 NUL is used). This choice will always generate an invalid value if
4990 one exists.
4992 @item @emph{Standard.Wide_Character}
4994 Objects whose root type is Standard.Wide_Character are initialized to
4995 Wide_Character'Last unless the subtype range excludes NUL (in which case
4996 NUL is used). This choice will always generate an invalid value if
4997 one exists.
4999 @item @emph{Standard.Wide_Wide_Character}
5001 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5002 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5003 which case NUL is used). This choice will always generate an invalid value if
5004 one exists.
5006 @item @emph{Integer types}
5008 Objects of an integer type are treated differently depending on whether
5009 negative values are present in the subtype. If no negative values are
5010 present, then all one bits is used as the initial value except in the
5011 special case where zero is excluded from the subtype, in which case
5012 all zero bits are used. This choice will always generate an invalid
5013 value if one exists.
5015 For subtypes with negative values present, the largest negative number
5016 is used, except in the unusual case where this largest negative number
5017 is in the subtype, and the largest positive number is not, in which case
5018 the largest positive value is used. This choice will always generate
5019 an invalid value if one exists.
5021 @item @emph{Floating-Point Types}
5023 Objects of all floating-point types are initialized to all 1-bits. For
5024 standard IEEE format, this corresponds to a NaN (not a number) which is
5025 indeed an invalid value.
5027 @item @emph{Fixed-Point Types}
5029 Objects of all fixed-point types are treated as described above for integers,
5030 with the rules applying to the underlying integer value used to represent
5031 the fixed-point value.
5033 @item @emph{Modular types}
5035 Objects of a modular type are initialized to all one bits, except in
5036 the special case where zero is excluded from the subtype, in which
5037 case all zero bits are used. This choice will always generate an
5038 invalid value if one exists.
5040 @item @emph{Enumeration types}
5042 Objects of an enumeration type are initialized to all one-bits, i.e., to
5043 the value @cite{2 ** typ'Size - 1} unless the subtype excludes the literal
5044 whose Pos value is zero, in which case a code of zero is used. This choice
5045 will always generate an invalid value if one exists.
5046 @end table
5048 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5049 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{8c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{8d}
5050 @section Pragma Obsolescent
5053 Syntax:
5055 @example
5056 pragma Obsolescent;
5058 pragma Obsolescent (
5059   [Message =>] static_string_EXPRESSION
5060 [,[Version =>] Ada_05]]);
5062 pragma Obsolescent (
5063   [Entity  =>] NAME
5064 [,[Message =>] static_string_EXPRESSION
5065 [,[Version =>] Ada_05]] );
5066 @end example
5068 This pragma can occur immediately following a declaration of an entity,
5069 including the case of a record component. If no Entity argument is present,
5070 then this declaration is the one to which the pragma applies. If an Entity
5071 parameter is present, it must either match the name of the entity in this
5072 declaration, or alternatively, the pragma can immediately follow an enumeration
5073 type declaration, where the Entity argument names one of the enumeration
5074 literals.
5076 This pragma is used to indicate that the named entity
5077 is considered obsolescent and should not be used. Typically this is
5078 used when an API must be modified by eventually removing or modifying
5079 existing subprograms or other entities. The pragma can be used at an
5080 intermediate stage when the entity is still present, but will be
5081 removed later.
5083 The effect of this pragma is to output a warning message on a reference to
5084 an entity thus marked that the subprogram is obsolescent if the appropriate
5085 warning option in the compiler is activated. If the Message parameter is
5086 present, then a second warning message is given containing this text. In
5087 addition, a reference to the entity is considered to be a violation of pragma
5088 Restrictions (No_Obsolescent_Features).
5090 This pragma can also be used as a program unit pragma for a package,
5091 in which case the entity name is the name of the package, and the
5092 pragma indicates that the entire package is considered
5093 obsolescent. In this case a client @cite{with}'ing such a package
5094 violates the restriction, and the @cite{with} statement is
5095 flagged with warnings if the warning option is set.
5097 If the Version parameter is present (which must be exactly
5098 the identifier Ada_05, no other argument is allowed), then the
5099 indication of obsolescence applies only when compiling in Ada 2005
5100 mode. This is primarily intended for dealing with the situations
5101 in the predefined library where subprograms or packages
5102 have become defined as obsolescent in Ada 2005
5103 (e.g., in Ada.Characters.Handling), but may be used anywhere.
5105 The following examples show typical uses of this pragma:
5107 @example
5108 package p is
5109    pragma Obsolescent (p, Message => "use pp instead of p");
5110 end p;
5112 package q is
5113    procedure q2;
5114    pragma Obsolescent ("use q2new instead");
5116    type R is new integer;
5117    pragma Obsolescent
5118      (Entity  => R,
5119       Message => "use RR in Ada 2005",
5120       Version => Ada_05);
5122    type M is record
5123       F1 : Integer;
5124       F2 : Integer;
5125       pragma Obsolescent;
5126       F3 : Integer;
5127    end record;
5129    type E is (a, bc, 'd', quack);
5130    pragma Obsolescent (Entity => bc)
5131    pragma Obsolescent (Entity => 'd')
5133    function "+"
5134      (a, b : character) return character;
5135    pragma Obsolescent (Entity => "+");
5136 end;
5137 @end example
5139 Note that, as for all pragmas, if you use a pragma argument identifier,
5140 then all subsequent parameters must also use a pragma argument identifier.
5141 So if you specify "Entity =>" for the Entity argument, and a Message
5142 argument is present, it must be preceded by "Message =>".
5144 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5145 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{8e}
5146 @section Pragma Optimize_Alignment
5149 @geindex Alignment
5150 @geindex default settings
5152 Syntax:
5154 @example
5155 pragma Optimize_Alignment (TIME | SPACE | OFF);
5156 @end example
5158 This is a configuration pragma which affects the choice of default alignments
5159 for types and objects where no alignment is explicitly specified. There is a
5160 time/space trade-off in the selection of these values. Large alignments result
5161 in more efficient code, at the expense of larger data space, since sizes have
5162 to be increased to match these alignments. Smaller alignments save space, but
5163 the access code is slower. The normal choice of default alignments for types
5164 and individual alignment promotions for objects (which is what you get if you
5165 do not use this pragma, or if you use an argument of OFF), tries to balance
5166 these two requirements.
5168 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5169 First any packed record is given an alignment of 1. Second, if a size is given
5170 for the type, then the alignment is chosen to avoid increasing this size. For
5171 example, consider:
5173 @example
5174 type R is record
5175    X : Integer;
5176    Y : Character;
5177 end record;
5179 for R'Size use 5*8;
5180 @end example
5182 In the default mode, this type gets an alignment of 4, so that access to the
5183 Integer field X are efficient. But this means that objects of the type end up
5184 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5185 allowed to be bigger than the size of the type, but it can waste space if for
5186 example fields of type R appear in an enclosing record. If the above type is
5187 compiled in @cite{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5189 However, there is one case in which SPACE is ignored. If a variable length
5190 record (that is a discriminated record with a component which is an array
5191 whose length depends on a discriminant), has a pragma Pack, then it is not
5192 in general possible to set the alignment of such a record to one, so the
5193 pragma is ignored in this case (with a warning).
5195 Specifying SPACE also disables alignment promotions for standalone objects,
5196 which occur when the compiler increases the alignment of a specific object
5197 without changing the alignment of its type.
5199 Specifying TIME causes larger default alignments to be chosen in the case of
5200 small types with sizes that are not a power of 2. For example, consider:
5202 @example
5203 type R is record
5204    A : Character;
5205    B : Character;
5206    C : Boolean;
5207 end record;
5209 pragma Pack (R);
5210 for R'Size use 17;
5211 @end example
5213 The default alignment for this record is normally 1, but if this type is
5214 compiled in @cite{Optimize_Alignment (Time)} mode, then the alignment is set
5215 to 4, which wastes space for objects of the type, since they are now 4 bytes
5216 long, but results in more efficient access when the whole record is referenced.
5218 As noted above, this is a configuration pragma, and there is a requirement
5219 that all units in a partition be compiled with a consistent setting of the
5220 optimization setting. This would normally be achieved by use of a configuration
5221 pragma file containing the appropriate setting. The exception to this rule is
5222 that units with an explicit configuration pragma in the same file as the source
5223 unit are excluded from the consistency check, as are all predefined units. The
5224 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5225 pragma appears at the start of the file.
5227 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5228 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{8f}
5229 @section Pragma Ordered
5232 Syntax:
5234 @example
5235 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5236 @end example
5238 Most enumeration types are from a conceptual point of view unordered.
5239 For example, consider:
5241 @example
5242 type Color is (Red, Blue, Green, Yellow);
5243 @end example
5245 By Ada semantics @cite{Blue > Red} and @cite{Green > Blue},
5246 but really these relations make no sense; the enumeration type merely
5247 specifies a set of possible colors, and the order is unimportant.
5249 For unordered enumeration types, it is generally a good idea if
5250 clients avoid comparisons (other than equality or inequality) and
5251 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5252 other than the unit where the type is declared, its body, and its subunits.)
5253 For example, if code buried in some client says:
5255 @example
5256 if Current_Color < Yellow then ...
5257 if Current_Color in Blue .. Green then ...
5258 @end example
5260 then the client code is relying on the order, which is undesirable.
5261 It makes the code hard to read and creates maintenance difficulties if
5262 entries have to be added to the enumeration type. Instead,
5263 the code in the client should list the possibilities, or an
5264 appropriate subtype should be declared in the unit that declares
5265 the original enumeration type. E.g., the following subtype could
5266 be declared along with the type @cite{Color}:
5268 @example
5269 subtype RBG is Color range Red .. Green;
5270 @end example
5272 and then the client could write:
5274 @example
5275 if Current_Color in RBG then ...
5276 if Current_Color = Blue or Current_Color = Green then ...
5277 @end example
5279 However, some enumeration types are legitimately ordered from a conceptual
5280 point of view. For example, if you declare:
5282 @example
5283 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5284 @end example
5286 then the ordering imposed by the language is reasonable, and
5287 clients can depend on it, writing for example:
5289 @example
5290 if D in Mon .. Fri then ...
5291 if D < Wed then ...
5292 @end example
5294 The pragma @emph{Ordered} is provided to mark enumeration types that
5295 are conceptually ordered, alerting the reader that clients may depend
5296 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5297 rather than one to mark them as unordered, since in our experience,
5298 the great majority of enumeration types are conceptually unordered.
5300 The types @cite{Boolean}, @cite{Character}, @cite{Wide_Character},
5301 and @cite{Wide_Wide_Character}
5302 are considered to be ordered types, so each is declared with a
5303 pragma @cite{Ordered} in package @cite{Standard}.
5305 Normally pragma @cite{Ordered} serves only as documentation and a guide for
5306 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5307 requests warnings for inappropriate uses (comparisons and explicit
5308 subranges) for unordered types. If this switch is used, then any
5309 enumeration type not marked with pragma @cite{Ordered} will be considered
5310 as unordered, and will generate warnings for inappropriate uses.
5312 Note that generic types are not considered ordered or unordered (since the
5313 template can be instantiated for both cases), so we never generate warnings
5314 for the case of generic enumerated types.
5316 For additional information please refer to the description of the
5317 @emph{-gnatw.u} switch in the GNAT User's Guide.
5319 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5320 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{90}
5321 @section Pragma Overflow_Mode
5324 Syntax:
5326 @example
5327 pragma Overflow_Mode
5328  (  [General    =>] MODE
5329   [,[Assertions =>] MODE]);
5331 MODE ::= STRICT | MINIMIZED | ELIMINATED
5332 @end example
5334 This pragma sets the current overflow mode to the given setting. For details
5335 of the meaning of these modes, please refer to the
5336 'Overflow Check Handling in GNAT' appendix in the
5337 GNAT User's Guide. If only the @cite{General} parameter is present,
5338 the given mode applies to all expressions. If both parameters are present,
5339 the @cite{General} mode applies to expressions outside assertions, and
5340 the @cite{Eliminated} mode applies to expressions within assertions.
5342 The case of the @cite{MODE} parameter is ignored,
5343 so @cite{MINIMIZED}, @cite{Minimized} and
5344 @cite{minimized} all have the same effect.
5346 The @cite{Overflow_Mode} pragma has the same scoping and placement
5347 rules as pragma @cite{Suppress}, so it can occur either as a
5348 configuration pragma, specifying a default for the whole
5349 program, or in a declarative scope, where it applies to the
5350 remaining declarations and statements in that scope.
5352 The pragma @cite{Suppress (Overflow_Check)} suppresses
5353 overflow checking, but does not affect the overflow mode.
5355 The pragma @cite{Unsuppress (Overflow_Check)} unsuppresses (enables)
5356 overflow checking, but does not affect the overflow mode.
5358 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5359 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{91}
5360 @section Pragma Overriding_Renamings
5363 @geindex Rational profile
5365 @geindex Rational compatibility
5367 Syntax:
5369 @example
5370 pragma Overriding_Renamings;
5371 @end example
5373 This is a GNAT configuration pragma to simplify porting
5374 legacy code accepted by the Rational
5375 Ada compiler. In the presence of this pragma, a renaming declaration that
5376 renames an inherited operation declared in the same scope is legal if selected
5377 notation is used as in:
5379 @example
5380 pragma Overriding_Renamings;
5382 package R is
5383   function F (..);
5384   ...
5385   function F (..) renames R.F;
5386 end R;
5387 @end example
5389 even though
5390 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5391 declaration of the overriding operation.
5393 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5394 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{92}
5395 @section Pragma Partition_Elaboration_Policy
5398 Syntax:
5400 @example
5401 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5403 POLICY_IDENTIFIER ::= Concurrent | Sequential
5404 @end example
5406 This pragma is standard in Ada 2005, but is available in all earlier
5407 versions of Ada as an implementation-defined pragma.
5408 See Ada 2012 Reference Manual for details.
5410 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5411 @anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{93}
5412 @section Pragma Part_Of
5415 For the description of this pragma, see SPARK 2014 Reference Manual,
5416 section 7.2.6.
5418 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
5419 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{94}
5420 @section Pragma Passive
5423 Syntax:
5425 @example
5426 pragma Passive [(Semaphore | No)];
5427 @end example
5429 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5430 compatibility with DEC Ada 83 implementations, where it is used within a
5431 task definition to request that a task be made passive.  If the argument
5432 @cite{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5433 treats the pragma as an assertion that the containing task is passive
5434 and that optimization of context switch with this task is permitted and
5435 desired.  If the argument @cite{No} is present, the task must not be
5436 optimized.  GNAT does not attempt to optimize any tasks in this manner
5437 (since protected objects are available in place of passive tasks).
5439 For more information on the subject of passive tasks, see the section
5440 'Passive Task Optimization' in the GNAT Users Guide.
5442 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
5443 @anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{95}
5444 @section Pragma Persistent_BSS
5447 Syntax:
5449 @example
5450 pragma Persistent_BSS [(LOCAL_NAME)]
5451 @end example
5453 This pragma allows selected objects to be placed in the @cite{.persistent_bss}
5454 section. On some targets the linker and loader provide for special
5455 treatment of this section, allowing a program to be reloaded without
5456 affecting the contents of this data (hence the name persistent).
5458 There are two forms of usage. If an argument is given, it must be the
5459 local name of a library level object, with no explicit initialization
5460 and whose type is potentially persistent. If no argument is given, then
5461 the pragma is a configuration pragma, and applies to all library level
5462 objects with no explicit initialization of potentially persistent types.
5464 A potentially persistent type is a scalar type, or an untagged,
5465 non-discriminated record, all of whose components have no explicit
5466 initialization and are themselves of a potentially persistent type,
5467 or an array, all of whose constraints are static, and whose component
5468 type is potentially persistent.
5470 If this pragma is used on a target where this feature is not supported,
5471 then the pragma will be ignored. See also @cite{pragma Linker_Section}.
5473 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
5474 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{96}
5475 @section Pragma Polling
5478 Syntax:
5480 @example
5481 pragma Polling (ON | OFF);
5482 @end example
5484 This pragma controls the generation of polling code.  This is normally off.
5485 If @cite{pragma Polling (ON)} is used then periodic calls are generated to
5486 the routine @cite{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5487 runtime library, and can be found in file @code{a-excpol.adb}.
5489 Pragma @cite{Polling} can appear as a configuration pragma (for example it
5490 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
5491 can be used in the statement or declaration sequence to control polling
5492 more locally.
5494 A call to the polling routine is generated at the start of every loop and
5495 at the start of every subprogram call.  This guarantees that the @cite{Poll}
5496 routine is called frequently, and places an upper bound (determined by
5497 the complexity of the code) on the period between two @cite{Poll} calls.
5499 The primary purpose of the polling interface is to enable asynchronous
5500 aborts on targets that cannot otherwise support it (for example Windows
5501 NT), but it may be used for any other purpose requiring periodic polling.
5502 The standard version is null, and can be replaced by a user program.  This
5503 will require re-compilation of the @cite{Ada.Exceptions} package that can
5504 be found in files @code{a-except.ads} and @code{a-except.adb}.
5506 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
5507 distribution) is used to enable the asynchronous abort capability on
5508 targets that do not normally support the capability.  The version of
5509 @cite{Poll} in this file makes a call to the appropriate runtime routine
5510 to test for an abort condition.
5512 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
5513 See the section on switches for gcc in the @cite{GNAT User's Guide}.
5515 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
5516 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{97}
5517 @section Pragma Post
5520 @geindex Post
5522 @geindex Checks
5523 @geindex postconditions
5525 Syntax:
5527 @example
5528 pragma Post (Boolean_Expression);
5529 @end example
5531 The @cite{Post} pragma is intended to be an exact replacement for
5532 the language-defined
5533 @cite{Post} aspect, and shares its restrictions and semantics.
5534 It must appear either immediately following the corresponding
5535 subprogram declaration (only other pragmas may intervene), or
5536 if there is no separate subprogram declaration, then it can
5537 appear at the start of the declarations in a subprogram body
5538 (preceded only by other pragmas).
5540 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
5541 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{98}
5542 @section Pragma Postcondition
5545 @geindex Postcondition
5547 @geindex Checks
5548 @geindex postconditions
5550 Syntax:
5552 @example
5553 pragma Postcondition (
5554    [Check   =>] Boolean_Expression
5555  [,[Message =>] String_Expression]);
5556 @end example
5558 The @cite{Postcondition} pragma allows specification of automatic
5559 postcondition checks for subprograms. These checks are similar to
5560 assertions, but are automatically inserted just prior to the return
5561 statements of the subprogram with which they are associated (including
5562 implicit returns at the end of procedure bodies and associated
5563 exception handlers).
5565 In addition, the boolean expression which is the condition which
5566 must be true may contain references to function'Result in the case
5567 of a function to refer to the returned value.
5569 @cite{Postcondition} pragmas may appear either immediately following the
5570 (separate) declaration of a subprogram, or at the start of the
5571 declarations of a subprogram body. Only other pragmas may intervene
5572 (that is appear between the subprogram declaration and its
5573 postconditions, or appear before the postcondition in the
5574 declaration sequence in a subprogram body). In the case of a
5575 postcondition appearing after a subprogram declaration, the
5576 formal arguments of the subprogram are visible, and can be
5577 referenced in the postcondition expressions.
5579 The postconditions are collected and automatically tested just
5580 before any return (implicit or explicit) in the subprogram body.
5581 A postcondition is only recognized if postconditions are active
5582 at the time the pragma is encountered. The compiler switch @emph{gnata}
5583 turns on all postconditions by default, and pragma @cite{Check_Policy}
5584 with an identifier of @cite{Postcondition} can also be used to
5585 control whether postconditions are active.
5587 The general approach is that postconditions are placed in the spec
5588 if they represent functional aspects which make sense to the client.
5589 For example we might have:
5591 @example
5592 function Direction return Integer;
5593 pragma Postcondition
5594  (Direction'Result = +1
5595     or else
5596   Direction'Result = -1);
5597 @end example
5599 which serves to document that the result must be +1 or -1, and
5600 will test that this is the case at run time if postcondition
5601 checking is active.
5603 Postconditions within the subprogram body can be used to
5604 check that some internal aspect of the implementation,
5605 not visible to the client, is operating as expected.
5606 For instance if a square root routine keeps an internal
5607 counter of the number of times it is called, then we
5608 might have the following postcondition:
5610 @example
5611 Sqrt_Calls : Natural := 0;
5613 function Sqrt (Arg : Float) return Float is
5614   pragma Postcondition
5615     (Sqrt_Calls = Sqrt_Calls'Old + 1);
5616   ...
5617 end Sqrt
5618 @end example
5620 As this example, shows, the use of the @cite{Old} attribute
5621 is often useful in postconditions to refer to the state on
5622 entry to the subprogram.
5624 Note that postconditions are only checked on normal returns
5625 from the subprogram. If an abnormal return results from
5626 raising an exception, then the postconditions are not checked.
5628 If a postcondition fails, then the exception
5629 @cite{System.Assertions.Assert_Failure} is raised. If
5630 a message argument was supplied, then the given string
5631 will be used as the exception message. If no message
5632 argument was supplied, then the default message has
5633 the form "Postcondition failed at file_name:line". The
5634 exception is raised in the context of the subprogram
5635 body, so it is possible to catch postcondition failures
5636 within the subprogram body itself.
5638 Within a package spec, normal visibility rules
5639 in Ada would prevent forward references within a
5640 postcondition pragma to functions defined later in
5641 the same package. This would introduce undesirable
5642 ordering constraints. To avoid this problem, all
5643 postcondition pragmas are analyzed at the end of
5644 the package spec, allowing forward references.
5646 The following example shows that this even allows
5647 mutually recursive postconditions as in:
5649 @example
5650 package Parity_Functions is
5651    function Odd  (X : Natural) return Boolean;
5652    pragma Postcondition
5653      (Odd'Result =
5654         (x = 1
5655           or else
5656         (x /= 0 and then Even (X - 1))));
5658    function Even (X : Natural) return Boolean;
5659    pragma Postcondition
5660      (Even'Result =
5661         (x = 0
5662           or else
5663         (x /= 1 and then Odd (X - 1))));
5665 end Parity_Functions;
5666 @end example
5668 There are no restrictions on the complexity or form of
5669 conditions used within @cite{Postcondition} pragmas.
5670 The following example shows that it is even possible
5671 to verify performance behavior.
5673 @example
5674 package Sort is
5676    Performance : constant Float;
5677    --  Performance constant set by implementation
5678    --  to match target architecture behavior.
5680    procedure Treesort (Arg : String);
5681    --  Sorts characters of argument using N*logN sort
5682    pragma Postcondition
5683      (Float (Clock - Clock'Old) <=
5684         Float (Arg'Length) *
5685         log (Float (Arg'Length)) *
5686         Performance);
5687 end Sort;
5688 @end example
5690 Note: postcondition pragmas associated with subprograms that are
5691 marked as Inline_Always, or those marked as Inline with front-end
5692 inlining (-gnatN option set) are accepted and legality-checked
5693 by the compiler, but are ignored at run-time even if postcondition
5694 checking is enabled.
5696 Note that pragma @cite{Postcondition} differs from the language-defined
5697 @cite{Post} aspect (and corresponding @cite{Post} pragma) in allowing
5698 multiple occurrences, allowing occurences in the body even if there
5699 is a separate spec, and allowing a second string parameter, and the
5700 use of the pragma identifier @cite{Check}. Historically, pragma
5701 @cite{Postcondition} was implemented prior to the development of
5702 Ada 2012, and has been retained in its original form for
5703 compatibility purposes.
5705 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
5706 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{99}
5707 @section Pragma Post_Class
5710 @geindex Post
5712 @geindex Checks
5713 @geindex postconditions
5715 Syntax:
5717 @example
5718 pragma Post_Class (Boolean_Expression);
5719 @end example
5721 The @cite{Post_Class} pragma is intended to be an exact replacement for
5722 the language-defined
5723 @cite{Post'Class} aspect, and shares its restrictions and semantics.
5724 It must appear either immediately following the corresponding
5725 subprogram declaration (only other pragmas may intervene), or
5726 if there is no separate subprogram declaration, then it can
5727 appear at the start of the declarations in a subprogram body
5728 (preceded only by other pragmas).
5730 Note: This pragma is called @cite{Post_Class} rather than
5731 @cite{Post'Class} because the latter would not be strictly
5732 conforming to the allowed syntax for pragmas. The motivation
5733 for provinding pragmas equivalent to the aspects is to allow a program
5734 to be written using the pragmas, and then compiled if necessary
5735 using an Ada compiler that does not recognize the pragmas or
5736 aspects, but is prepared to ignore the pragmas. The assertion
5737 policy that controls this pragma is @cite{Post'Class}, not
5738 @cite{Post_Class}.
5740 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
5741 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{9a}
5742 @section Pragma Pre
5745 @geindex Pre
5747 @geindex Checks
5748 @geindex preconditions
5750 Syntax:
5752 @example
5753 pragma Pre (Boolean_Expression);
5754 @end example
5756 The @cite{Pre} pragma is intended to be an exact replacement for
5757 the language-defined
5758 @cite{Pre} aspect, and shares its restrictions and semantics.
5759 It must appear either immediately following the corresponding
5760 subprogram declaration (only other pragmas may intervene), or
5761 if there is no separate subprogram declaration, then it can
5762 appear at the start of the declarations in a subprogram body
5763 (preceded only by other pragmas).
5765 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
5766 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{9b}
5767 @section Pragma Precondition
5770 @geindex Preconditions
5772 @geindex Checks
5773 @geindex preconditions
5775 Syntax:
5777 @example
5778 pragma Precondition (
5779    [Check   =>] Boolean_Expression
5780  [,[Message =>] String_Expression]);
5781 @end example
5783 The @cite{Precondition} pragma is similar to @cite{Postcondition}
5784 except that the corresponding checks take place immediately upon
5785 entry to the subprogram, and if a precondition fails, the exception
5786 is raised in the context of the caller, and the attribute 'Result
5787 cannot be used within the precondition expression.
5789 Otherwise, the placement and visibility rules are identical to those
5790 described for postconditions. The following is an example of use
5791 within a package spec:
5793 @example
5794 package Math_Functions is
5795    ...
5796    function Sqrt (Arg : Float) return Float;
5797    pragma Precondition (Arg >= 0.0)
5798    ...
5799 end Math_Functions;
5800 @end example
5802 @cite{Precondition} pragmas may appear either immediately following the
5803 (separate) declaration of a subprogram, or at the start of the
5804 declarations of a subprogram body. Only other pragmas may intervene
5805 (that is appear between the subprogram declaration and its
5806 postconditions, or appear before the postcondition in the
5807 declaration sequence in a subprogram body).
5809 Note: precondition pragmas associated with subprograms that are
5810 marked as Inline_Always, or those marked as Inline with front-end
5811 inlining (-gnatN option set) are accepted and legality-checked
5812 by the compiler, but are ignored at run-time even if precondition
5813 checking is enabled.
5815 Note that pragma @cite{Precondition} differs from the language-defined
5816 @cite{Pre} aspect (and corresponding @cite{Pre} pragma) in allowing
5817 multiple occurrences, allowing occurences in the body even if there
5818 is a separate spec, and allowing a second string parameter, and the
5819 use of the pragma identifier @cite{Check}. Historically, pragma
5820 @cite{Precondition} was implemented prior to the development of
5821 Ada 2012, and has been retained in its original form for
5822 compatibility purposes.
5824 @node Pragma Predicate,Pragma Preelaborable_Initialization,Pragma Precondition,Implementation Defined Pragmas
5825 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{9c}
5826 @section Pragma Predicate
5829 Syntax:
5831 @example
5832 pragma Predicate
5833   ([Entity =>] type_LOCAL_NAME,
5834    [Check  =>] EXPRESSION);
5835 @end example
5837 This pragma (available in all versions of Ada in GNAT) encompasses both
5838 the @cite{Static_Predicate} and @cite{Dynamic_Predicate} aspects in
5839 Ada 2012. A predicate is regarded as static if it has an allowed form
5840 for @cite{Static_Predicate} and is otherwise treated as a
5841 @cite{Dynamic_Predicate}. Otherwise, predicates specified by this
5842 pragma behave exactly as described in the Ada 2012 reference manual.
5843 For example, if we have
5845 @example
5846 type R is range 1 .. 10;
5847 subtype S is R;
5848 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
5849 subtype Q is R
5850 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
5851 @end example
5853 the effect is identical to the following Ada 2012 code:
5855 @example
5856 type R is range 1 .. 10;
5857 subtype S is R with
5858   Static_Predicate => S not in 4 .. 6;
5859 subtype Q is R with
5860   Dynamic_Predicate => F(Q) or G(Q);
5861 @end example
5863 Note that there is are no pragmas @cite{Dynamic_Predicate}
5864 or @cite{Static_Predicate}. That is
5865 because these pragmas would affect legality and semantics of
5866 the program and thus do not have a neutral effect if ignored.
5867 The motivation behind providing pragmas equivalent to
5868 corresponding aspects is to allow a program to be written
5869 using the pragmas, and then compiled with a compiler that
5870 will ignore the pragmas. That doesn't work in the case of
5871 static and dynamic predicates, since if the corresponding
5872 pragmas are ignored, then the behavior of the program is
5873 fundamentally changed (for example a membership test
5874 @cite{A in B} would not take into account a predicate
5875 defined for subtype B). When following this approach, the
5876 use of predicates should be avoided.
5878 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate,Implementation Defined Pragmas
5879 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{9d}
5880 @section Pragma Preelaborable_Initialization
5883 Syntax:
5885 @example
5886 pragma Preelaborable_Initialization (DIRECT_NAME);
5887 @end example
5889 This pragma is standard in Ada 2005, but is available in all earlier
5890 versions of Ada as an implementation-defined pragma.
5891 See Ada 2012 Reference Manual for details.
5893 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
5894 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{9e}
5895 @section Pragma Prefix_Exception_Messages
5898 @geindex Prefix_Exception_Messages
5900 @geindex exception
5902 @geindex Exception_Message
5904 Syntax:
5906 @example
5907 pragma Prefix_Exception_Messages;
5908 @end example
5910 This is an implementation-defined configuration pragma that affects the
5911 behavior of raise statements with a message given as a static string
5912 constant (typically a string literal). In such cases, the string will
5913 be automatically prefixed by the name of the enclosing entity (giving
5914 the package and subprogram containing the raise statement). This helps
5915 to identify where messages are coming from, and this mode is automatic
5916 for the run-time library.
5918 The pragma has no effect if the message is computed with an expression other
5919 than a static string constant, since the assumption in this case is that
5920 the program computes exactly the string it wants. If you still want the
5921 prefixing in this case, you can always call
5922 @cite{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
5924 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
5925 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{9f}
5926 @section Pragma Pre_Class
5929 @geindex Pre_Class
5931 @geindex Checks
5932 @geindex preconditions
5934 Syntax:
5936 @example
5937 pragma Pre_Class (Boolean_Expression);
5938 @end example
5940 The @cite{Pre_Class} pragma is intended to be an exact replacement for
5941 the language-defined
5942 @cite{Pre'Class} aspect, and shares its restrictions and semantics.
5943 It must appear either immediately following the corresponding
5944 subprogram declaration (only other pragmas may intervene), or
5945 if there is no separate subprogram declaration, then it can
5946 appear at the start of the declarations in a subprogram body
5947 (preceded only by other pragmas).
5949 Note: This pragma is called @cite{Pre_Class} rather than
5950 @cite{Pre'Class} because the latter would not be strictly
5951 conforming to the allowed syntax for pragmas. The motivation
5952 for providing pragmas equivalent to the aspects is to allow a program
5953 to be written using the pragmas, and then compiled if necessary
5954 using an Ada compiler that does not recognize the pragmas or
5955 aspects, but is prepared to ignore the pragmas. The assertion
5956 policy that controls this pragma is @cite{Pre'Class}, not
5957 @cite{Pre_Class}.
5959 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
5960 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{a0}
5961 @section Pragma Priority_Specific_Dispatching
5964 Syntax:
5966 @example
5967 pragma Priority_Specific_Dispatching (
5968    POLICY_IDENTIFIER,
5969    first_priority_EXPRESSION,
5970    last_priority_EXPRESSION)
5972 POLICY_IDENTIFIER ::=
5973    EDF_Across_Priorities            |
5974    FIFO_Within_Priorities           |
5975    Non_Preemptive_Within_Priorities |
5976    Round_Robin_Within_Priorities
5977 @end example
5979 This pragma is standard in Ada 2005, but is available in all earlier
5980 versions of Ada as an implementation-defined pragma.
5981 See Ada 2012 Reference Manual for details.
5983 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
5984 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{a1}
5985 @section Pragma Profile
5988 Syntax:
5990 @example
5991 pragma Profile (Ravenscar | Restricted | Rational);
5992 @end example
5994 This pragma is standard in Ada 2005, but is available in all earlier
5995 versions of Ada as an implementation-defined pragma. This is a
5996 configuration pragma that establishes a set of configuration pragmas
5997 that depend on the argument. @cite{Ravenscar} is standard in Ada 2005.
5998 The other two possibilities (@cite{Restricted} or @cite{Rational})
5999 are implementation-defined. The set of configuration pragmas
6000 is defined in the following sections.
6003 @itemize *
6005 @item 
6006 Pragma Profile (Ravenscar)
6008 The @cite{Ravenscar} profile is standard in Ada 2005,
6009 but is available in all earlier
6010 versions of Ada as an implementation-defined pragma. This profile
6011 establishes the following set of configuration pragmas:
6014 @itemize *
6016 @item 
6017 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6019 [RM D.2.2] Tasks are dispatched following a preemptive
6020 priority-ordered scheduling policy.
6022 @item 
6023 @code{Locking_Policy (Ceiling_Locking)}
6025 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6026 the ceiling priority of the corresponding protected object.
6028 @item 
6029 @code{Detect_Blocking}
6031 This pragma forces the detection of potentially blocking operations within a
6032 protected operation, and to raise Program_Error if that happens.
6033 @end itemize
6035 plus the following set of restrictions:
6038 @itemize *
6040 @item 
6041 @code{Max_Entry_Queue_Length => 1}
6043 No task can be queued on a protected entry.
6045 @item 
6046 @code{Max_Protected_Entries => 1}
6048 @item 
6049 @code{Max_Task_Entries => 0}
6051 No rendezvous statements are allowed.
6053 @item 
6054 @code{No_Abort_Statements}
6056 @item 
6057 @code{No_Dynamic_Attachment}
6059 @item 
6060 @code{No_Dynamic_Priorities}
6062 @item 
6063 @code{No_Implicit_Heap_Allocations}
6065 @item 
6066 @code{No_Local_Protected_Objects}
6068 @item 
6069 @code{No_Local_Timing_Events}
6071 @item 
6072 @code{No_Protected_Type_Allocators}
6074 @item 
6075 @code{No_Relative_Delay}
6077 @item 
6078 @code{No_Requeue_Statements}
6080 @item 
6081 @code{No_Select_Statements}
6083 @item 
6084 @code{No_Specific_Termination_Handlers}
6086 @item 
6087 @code{No_Task_Allocators}
6089 @item 
6090 @code{No_Task_Hierarchy}
6092 @item 
6093 @code{No_Task_Termination}
6095 @item 
6096 @code{Simple_Barriers}
6097 @end itemize
6099 The Ravenscar profile also includes the following restrictions that specify
6100 that there are no semantic dependences on the corresponding predefined
6101 packages:
6104 @itemize *
6106 @item 
6107 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6109 @item 
6110 @code{No_Dependence => Ada.Calendar}
6112 @item 
6113 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6115 @item 
6116 @code{No_Dependence => Ada.Execution_Time.Timers}
6118 @item 
6119 @code{No_Dependence => Ada.Task_Attributes}
6121 @item 
6122 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6123 @end itemize
6125 This set of configuration pragmas and restrictions correspond to the
6126 definition of the 'Ravenscar Profile' for limited tasking, devised and
6127 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6128 A description is also available at
6129 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6131 The original definition of the profile was revised at subsequent IRTAW
6132 meetings. It has been included in the ISO
6133 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6134 and was made part of the Ada 2005 standard.
6135 The formal definition given by
6136 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6137 AI-305) available at
6138 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6139 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6141 The above set is a superset of the restrictions provided by pragma
6142 @code{Profile (Restricted)}, it includes six additional restrictions
6143 (@code{Simple_Barriers}, @code{No_Select_Statements},
6144 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6145 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6146 that pragma @code{Profile (Ravenscar)}, like the pragma
6147 @code{Profile (Restricted)},
6148 automatically causes the use of a simplified,
6149 more efficient version of the tasking run-time library.
6151 @item 
6152 Pragma Profile (Restricted)
6154 This profile corresponds to the GNAT restricted run time. It
6155 establishes the following set of restrictions:
6158 @itemize *
6160 @item 
6161 @code{No_Abort_Statements}
6163 @item 
6164 @code{No_Entry_Queue}
6166 @item 
6167 @code{No_Task_Hierarchy}
6169 @item 
6170 @code{No_Task_Allocators}
6172 @item 
6173 @code{No_Dynamic_Priorities}
6175 @item 
6176 @code{No_Terminate_Alternatives}
6178 @item 
6179 @code{No_Dynamic_Attachment}
6181 @item 
6182 @code{No_Protected_Type_Allocators}
6184 @item 
6185 @code{No_Local_Protected_Objects}
6187 @item 
6188 @code{No_Requeue_Statements}
6190 @item 
6191 @code{No_Task_Attributes_Package}
6193 @item 
6194 @code{Max_Asynchronous_Select_Nesting =  0}
6196 @item 
6197 @code{Max_Task_Entries =  0}
6199 @item 
6200 @code{Max_Protected_Entries = 1}
6202 @item 
6203 @code{Max_Select_Alternatives = 0}
6204 @end itemize
6206 This set of restrictions causes the automatic selection of a simplified
6207 version of the run time that provides improved performance for the
6208 limited set of tasking functionality permitted by this set of restrictions.
6210 @item 
6211 Pragma Profile (Rational)
6213 The Rational profile is intended to facilitate porting legacy code that
6214 compiles with the Rational APEX compiler, even when the code includes non-
6215 conforming Ada constructs.  The profile enables the following three pragmas:
6218 @itemize *
6220 @item 
6221 @code{pragma Implicit_Packing}
6223 @item 
6224 @code{pragma Overriding_Renamings}
6226 @item 
6227 @code{pragma Use_VADS_Size}
6228 @end itemize
6229 @end itemize
6231 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6232 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{a2}
6233 @section Pragma Profile_Warnings
6236 Syntax:
6238 @example
6239 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6240 @end example
6242 This is an implementation-defined pragma that is similar in
6243 effect to @cite{pragma Profile} except that instead of
6244 generating @cite{Restrictions} pragmas, it generates
6245 @cite{Restriction_Warnings} pragmas. The result is that
6246 violations of the profile generate warning messages instead
6247 of error messages.
6249 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6250 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{a3}
6251 @section Pragma Propagate_Exceptions
6254 @geindex Interfacing to C++
6256 Syntax:
6258 @example
6259 pragma Propagate_Exceptions;
6260 @end example
6262 This pragma is now obsolete and, other than generating a warning if warnings
6263 on obsolescent features are enabled, is ignored.
6264 It is retained for compatibility
6265 purposes. It used to be used in connection with optimization of
6266 a now-obsolete mechanism for implementation of exceptions.
6268 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6269 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{a4}
6270 @section Pragma Provide_Shift_Operators
6273 @geindex Shift operators
6275 Syntax:
6277 @example
6278 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6279 @end example
6281 This pragma can be applied to a first subtype local name that specifies
6282 either an unsigned or signed type. It has the effect of providing the
6283 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6284 Rotate_Left and Rotate_Right) for the given type. It is similar to
6285 including the function declarations for these five operators, together
6286 with the pragma Import (Intrinsic, ...) statements.
6288 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6289 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{a5}
6290 @section Pragma Psect_Object
6293 Syntax:
6295 @example
6296 pragma Psect_Object (
6297      [Internal =>] LOCAL_NAME,
6298   [, [External =>] EXTERNAL_SYMBOL]
6299   [, [Size     =>] EXTERNAL_SYMBOL]);
6301 EXTERNAL_SYMBOL ::=
6302   IDENTIFIER
6303 | static_string_EXPRESSION
6304 @end example
6306 This pragma is identical in effect to pragma @cite{Common_Object}.
6308 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6309 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{a6}
6310 @section Pragma Pure_Function
6313 Syntax:
6315 @example
6316 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6317 @end example
6319 This pragma appears in the same declarative part as a function
6320 declaration (or a set of function declarations if more than one
6321 overloaded declaration exists, in which case the pragma applies
6322 to all entities).  It specifies that the function @cite{Entity} is
6323 to be considered pure for the purposes of code generation.  This means
6324 that the compiler can assume that there are no side effects, and
6325 in particular that two calls with identical arguments produce the
6326 same result.  It also means that the function can be used in an
6327 address clause.
6329 Note that, quite deliberately, there are no static checks to try
6330 to ensure that this promise is met, so @cite{Pure_Function} can be used
6331 with functions that are conceptually pure, even if they do modify
6332 global variables.  For example, a square root function that is
6333 instrumented to count the number of times it is called is still
6334 conceptually pure, and can still be optimized, even though it
6335 modifies a global variable (the count).  Memo functions are another
6336 example (where a table of previous calls is kept and consulted to
6337 avoid re-computation).
6339 Note also that the normal rules excluding optimization of subprograms
6340 in pure units (when parameter types are descended from System.Address,
6341 or when the full view of a parameter type is limited), do not apply
6342 for the Pure_Function case. If you explicitly specify Pure_Function,
6343 the compiler may optimize away calls with identical arguments, and
6344 if that results in unexpected behavior, the proper action is not to
6345 use the pragma for subprograms that are not (conceptually) pure.
6347 Note: Most functions in a @cite{Pure} package are automatically pure, and
6348 there is no need to use pragma @cite{Pure_Function} for such functions.  One
6349 exception is any function that has at least one formal of type
6350 @cite{System.Address} or a type derived from it.  Such functions are not
6351 considered pure by default, since the compiler assumes that the
6352 @cite{Address} parameter may be functioning as a pointer and that the
6353 referenced data may change even if the address value does not.
6354 Similarly, imported functions are not considered to be pure by default,
6355 since there is no way of checking that they are in fact pure.  The use
6356 of pragma @cite{Pure_Function} for such a function will override these default
6357 assumption, and cause the compiler to treat a designated subprogram as pure
6358 in these cases.
6360 Note: If pragma @cite{Pure_Function} is applied to a renamed function, it
6361 applies to the underlying renamed function.  This can be used to
6362 disambiguate cases of overloading where some but not all functions
6363 in a set of overloaded functions are to be designated as pure.
6365 If pragma @cite{Pure_Function} is applied to a library level function, the
6366 function is also considered pure from an optimization point of view, but the
6367 unit is not a Pure unit in the categorization sense. So for example, a function
6368 thus marked is free to @cite{with} non-pure units.
6370 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6371 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{a7}
6372 @section Pragma Rational
6375 Syntax:
6377 @example
6378 pragma Rational;
6379 @end example
6381 This pragma is considered obsolescent, but is retained for
6382 compatibility purposes. It is equivalent to:
6384 @example
6385 pragma Profile (Rational);
6386 @end example
6388 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6389 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{a8}
6390 @section Pragma Ravenscar
6393 Syntax:
6395 @example
6396 pragma Ravenscar;
6397 @end example
6399 This pragma is considered obsolescent, but is retained for
6400 compatibility purposes. It is equivalent to:
6402 @example
6403 pragma Profile (Ravenscar);
6404 @end example
6406 which is the preferred method of setting the @cite{Ravenscar} profile.
6408 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6409 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{a9}
6410 @section Pragma Refined_Depends
6413 For the description of this pragma, see SPARK 2014 Reference Manual,
6414 section 6.1.5.
6416 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6417 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{aa}
6418 @section Pragma Refined_Global
6421 For the description of this pragma, see SPARK 2014 Reference Manual,
6422 section 6.1.4.
6424 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
6425 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{ab}
6426 @section Pragma Refined_Post
6429 For the description of this pragma, see SPARK 2014 Reference Manual,
6430 section 7.2.7.
6432 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
6433 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{ac}
6434 @section Pragma Refined_State
6437 For the description of this pragma, see SPARK 2014 Reference Manual,
6438 section 7.2.2.
6440 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
6441 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{ad}
6442 @section Pragma Relative_Deadline
6445 Syntax:
6447 @example
6448 pragma Relative_Deadline (time_span_EXPRESSION);
6449 @end example
6451 This pragma is standard in Ada 2005, but is available in all earlier
6452 versions of Ada as an implementation-defined pragma.
6453 See Ada 2012 Reference Manual for details.
6455 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
6456 @anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{ae}
6457 @section Pragma Remote_Access_Type
6460 Syntax:
6462 @example
6463 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
6464 @end example
6466 This pragma appears in the formal part of a generic declaration.
6467 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
6468 the use of a remote access to class-wide type as actual for a formal
6469 access type.
6471 When this pragma applies to a formal access type @cite{Entity}, that
6472 type is treated as a remote access to class-wide type in the generic.
6473 It must be a formal general access type, and its designated type must
6474 be the class-wide type of a formal tagged limited private type from the
6475 same generic declaration.
6477 In the generic unit, the formal type is subject to all restrictions
6478 pertaining to remote access to class-wide types. At instantiation, the
6479 actual type must be a remote access to class-wide type.
6481 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
6482 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{af}
6483 @section Pragma Restricted_Run_Time
6486 Syntax:
6488 @example
6489 pragma Restricted_Run_Time;
6490 @end example
6492 This pragma is considered obsolescent, but is retained for
6493 compatibility purposes. It is equivalent to:
6495 @example
6496 pragma Profile (Restricted);
6497 @end example
6499 which is the preferred method of setting the restricted run time
6500 profile.
6502 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
6503 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{b0}
6504 @section Pragma Restriction_Warnings
6507 Syntax:
6509 @example
6510 pragma Restriction_Warnings
6511   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
6512 @end example
6514 This pragma allows a series of restriction identifiers to be
6515 specified (the list of allowed identifiers is the same as for
6516 pragma @cite{Restrictions}). For each of these identifiers
6517 the compiler checks for violations of the restriction, but
6518 generates a warning message rather than an error message
6519 if the restriction is violated.
6521 One use of this is in situations where you want to know
6522 about violations of a restriction, but you want to ignore some of
6523 these violations. Consider this example, where you want to set
6524 Ada_95 mode and enable style checks, but you want to know about
6525 any other use of implementation pragmas:
6527 @example
6528 pragma Restriction_Warnings (No_Implementation_Pragmas);
6529 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
6530 pragma Ada_95;
6531 pragma Style_Checks ("2bfhkM160");
6532 pragma Warnings (On, "violation of No_Implementation_Pragmas");
6533 @end example
6535 By including the above lines in a configuration pragmas file,
6536 the Ada_95 and Style_Checks pragmas are accepted without
6537 generating a warning, but any other use of implementation
6538 defined pragmas will cause a warning to be generated.
6540 @node Pragma Reviewable,Pragma Share_Generic,Pragma Restriction_Warnings,Implementation Defined Pragmas
6541 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{b1}
6542 @section Pragma Reviewable
6545 Syntax:
6547 @example
6548 pragma Reviewable;
6549 @end example
6551 This pragma is an RM-defined standard pragma, but has no effect on the
6552 program being compiled, or on the code generated for the program.
6554 To obtain the required output specified in RM H.3.1, the compiler must be
6555 run with various special switches as follows:
6558 @itemize *
6560 @item 
6561 @emph{Where compiler-generated run-time checks remain}
6563 The switch @emph{-gnatGL}
6564 may be used to list the expanded code in pseudo-Ada form.
6565 Runtime checks show up in the listing either as explicit
6566 checks or operators marked with @{@} to indicate a check is present.
6568 @item 
6569 @emph{An identification of known exceptions at compile time}
6571 If the program is compiled with @emph{-gnatwa},
6572 the compiler warning messages will indicate all cases where the compiler
6573 detects that an exception is certain to occur at run time.
6575 @item 
6576 @emph{Possible reads of uninitialized variables}
6578 The compiler warns of many such cases, but its output is incomplete.
6579 @end itemize
6582 A supplemental static analysis tool
6583 may be used to obtain a comprehensive list of all
6584 possible points at which uninitialized data may be read.
6587 @itemize *
6589 @item 
6590 @emph{Where run-time support routines are implicitly invoked}
6592 In the output from @emph{-gnatGL},
6593 run-time calls are explicitly listed as calls to the relevant
6594 run-time routine.
6596 @item 
6597 @emph{Object code listing}
6599 This may be obtained either by using the @emph{-S} switch,
6600 or the objdump utility.
6602 @item 
6603 @emph{Constructs known to be erroneous at compile time}
6605 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
6607 @item 
6608 @emph{Stack usage information}
6610 Static stack usage data (maximum per-subprogram) can be obtained via the
6611 @emph{-fstack-usage} switch to the compiler.
6612 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
6613 to gnatbind
6614 @end itemize
6618 @itemize *
6620 @item 
6621 @emph{Object code listing of entire partition}
6623 This can be obtained by compiling the partition with @emph{-S},
6624 or by applying objdump
6625 to all the object files that are part of the partition.
6627 @item 
6628 @emph{A description of the run-time model}
6630 The full sources of the run-time are available, and the documentation of
6631 these routines describes how these run-time routines interface to the
6632 underlying operating system facilities.
6634 @item 
6635 @emph{Control and data-flow information}
6636 @end itemize
6639 A supplemental static analysis tool
6640 may be used to obtain complete control and data-flow information, as well as
6641 comprehensive messages identifying possible problems based on this
6642 information.
6644 @node Pragma Share_Generic,Pragma Shared,Pragma Reviewable,Implementation Defined Pragmas
6645 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{b2}
6646 @section Pragma Share_Generic
6649 Syntax:
6651 @example
6652 pragma Share_Generic (GNAME @{, GNAME@});
6654 GNAME ::= generic_unit_NAME | generic_instance_NAME
6655 @end example
6657 This pragma is provided for compatibility with Dec Ada 83. It has
6658 no effect in @cite{GNAT} (which does not implement shared generics), other
6659 than to check that the given names are all names of generic units or
6660 generic instances.
6662 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
6663 @anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{b3}
6664 @section Pragma Shared
6667 This pragma is provided for compatibility with Ada 83. The syntax and
6668 semantics are identical to pragma Atomic.
6670 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
6671 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{b4}
6672 @section Pragma Short_Circuit_And_Or
6675 Syntax:
6677 @example
6678 pragma Short_Circuit_And_Or;
6679 @end example
6681 This configuration pragma causes any occurrence of the AND operator applied to
6682 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
6683 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
6684 may be useful in the context of certification protocols requiring the use of
6685 short-circuited logical operators. If this configuration pragma occurs locally
6686 within the file being compiled, it applies only to the file being compiled.
6687 There is no requirement that all units in a partition use this option.
6689 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
6690 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{b5}
6691 @section Pragma Short_Descriptors
6694 Syntax:
6696 @example
6697 pragma Short_Descriptors
6698 @end example
6700 This pragma is provided for compatibility with other Ada implementations. It
6701 is recognized but ignored by all current versions of GNAT.
6703 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
6704 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{b6}
6705 @section Pragma Simple_Storage_Pool_Type
6708 @geindex Storage pool
6709 @geindex simple
6711 @geindex Simple storage pool
6713 Syntax:
6715 @example
6716 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
6717 @end example
6719 A type can be established as a 'simple storage pool type' by applying
6720 the representation pragma @cite{Simple_Storage_Pool_Type} to the type.
6721 A type named in the pragma must be a library-level immutably limited record
6722 type or limited tagged type declared immediately within a package declaration.
6723 The type can also be a limited private type whose full type is allowed as
6724 a simple storage pool type.
6726 For a simple storage pool type @cite{SSP}, nonabstract primitive subprograms
6727 @cite{Allocate}, @cite{Deallocate}, and @cite{Storage_Size} can be declared that
6728 are subtype conformant with the following subprogram declarations:
6730 @example
6731 procedure Allocate
6732   (Pool                     : in out SSP;
6733    Storage_Address          : out System.Address;
6734    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6735    Alignment                : System.Storage_Elements.Storage_Count);
6737 procedure Deallocate
6738   (Pool : in out SSP;
6739    Storage_Address          : System.Address;
6740    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6741    Alignment                : System.Storage_Elements.Storage_Count);
6743 function Storage_Size (Pool : SSP)
6744   return System.Storage_Elements.Storage_Count;
6745 @end example
6747 Procedure @cite{Allocate} must be declared, whereas @cite{Deallocate} and
6748 @cite{Storage_Size} are optional. If @cite{Deallocate} is not declared, then
6749 applying an unchecked deallocation has no effect other than to set its actual
6750 parameter to null. If @cite{Storage_Size} is not declared, then the
6751 @cite{Storage_Size} attribute applied to an access type associated with
6752 a pool object of type SSP returns zero. Additional operations can be declared
6753 for a simple storage pool type (such as for supporting a mark/release
6754 storage-management discipline).
6756 An object of a simple storage pool type can be associated with an access
6757 type by specifying the attribute
6758 @ref{b7,,Simple_Storage_Pool}. For example:
6760 @example
6761 My_Pool : My_Simple_Storage_Pool_Type;
6763 type Acc is access My_Data_Type;
6765 for Acc'Simple_Storage_Pool use My_Pool;
6766 @end example
6768 See attribute @ref{b7,,Simple_Storage_Pool}
6769 for further details.
6771 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
6772 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{b8}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{b9}
6773 @section Pragma Source_File_Name
6776 Syntax:
6778 @example
6779 pragma Source_File_Name (
6780   [Unit_Name   =>] unit_NAME,
6781   Spec_File_Name =>  STRING_LITERAL,
6782   [Index => INTEGER_LITERAL]);
6784 pragma Source_File_Name (
6785   [Unit_Name   =>] unit_NAME,
6786   Body_File_Name =>  STRING_LITERAL,
6787   [Index => INTEGER_LITERAL]);
6788 @end example
6790 Use this to override the normal naming convention.  It is a configuration
6791 pragma, and so has the usual applicability of configuration pragmas
6792 (i.e., it applies to either an entire partition, or to all units in a
6793 compilation, or to a single unit, depending on how it is used.
6794 @cite{unit_name} is mapped to @cite{file_name_literal}.  The identifier for
6795 the second argument is required, and indicates whether this is the file
6796 name for the spec or for the body.
6798 The optional Index argument should be used when a file contains multiple
6799 units, and when you do not want to use @cite{gnatchop} to separate then
6800 into multiple files (which is the recommended procedure to limit the
6801 number of recompilations that are needed when some sources change).
6802 For instance, if the source file @code{source.ada} contains
6804 @example
6805 package B is
6807 end B;
6809 with B;
6810 procedure A is
6811 begin
6812    ..
6813 end A;
6814 @end example
6816 you could use the following configuration pragmas:
6818 @example
6819 pragma Source_File_Name
6820   (B, Spec_File_Name => "source.ada", Index => 1);
6821 pragma Source_File_Name
6822   (A, Body_File_Name => "source.ada", Index => 2);
6823 @end example
6825 Note that the @cite{gnatname} utility can also be used to generate those
6826 configuration pragmas.
6828 Another form of the @cite{Source_File_Name} pragma allows
6829 the specification of patterns defining alternative file naming schemes
6830 to apply to all files.
6832 @example
6833 pragma Source_File_Name
6834   (  [Spec_File_Name  =>] STRING_LITERAL
6835    [,[Casing          =>] CASING_SPEC]
6836    [,[Dot_Replacement =>] STRING_LITERAL]);
6838 pragma Source_File_Name
6839   (  [Body_File_Name  =>] STRING_LITERAL
6840    [,[Casing          =>] CASING_SPEC]
6841    [,[Dot_Replacement =>] STRING_LITERAL]);
6843 pragma Source_File_Name
6844   (  [Subunit_File_Name =>] STRING_LITERAL
6845    [,[Casing            =>] CASING_SPEC]
6846    [,[Dot_Replacement   =>] STRING_LITERAL]);
6848 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
6849 @end example
6851 The first argument is a pattern that contains a single asterisk indicating
6852 the point at which the unit name is to be inserted in the pattern string
6853 to form the file name.  The second argument is optional.  If present it
6854 specifies the casing of the unit name in the resulting file name string.
6855 The default is lower case.  Finally the third argument allows for systematic
6856 replacement of any dots in the unit name by the specified string literal.
6858 Note that Source_File_Name pragmas should not be used if you are using
6859 project files. The reason for this rule is that the project manager is not
6860 aware of these pragmas, and so other tools that use the projet file would not
6861 be aware of the intended naming conventions. If you are using project files,
6862 file naming is controlled by Source_File_Name_Project pragmas, which are
6863 usually supplied automatically by the project manager. A pragma
6864 Source_File_Name cannot appear after a @ref{ba,,Pragma Source_File_Name_Project}.
6866 For more details on the use of the @cite{Source_File_Name} pragma, see the
6867 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
6869 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
6870 @anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{bb}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{ba}
6871 @section Pragma Source_File_Name_Project
6874 This pragma has the same syntax and semantics as pragma Source_File_Name.
6875 It is only allowed as a stand alone configuration pragma.
6876 It cannot appear after a @ref{b8,,Pragma Source_File_Name}, and
6877 most importantly, once pragma Source_File_Name_Project appears,
6878 no further Source_File_Name pragmas are allowed.
6880 The intention is that Source_File_Name_Project pragmas are always
6881 generated by the Project Manager in a manner consistent with the naming
6882 specified in a project file, and when naming is controlled in this manner,
6883 it is not permissible to attempt to modify this naming scheme using
6884 Source_File_Name or Source_File_Name_Project pragmas (which would not be
6885 known to the project manager).
6887 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
6888 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{bc}
6889 @section Pragma Source_Reference
6892 Syntax:
6894 @example
6895 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
6896 @end example
6898 This pragma must appear as the first line of a source file.
6899 @cite{integer_literal} is the logical line number of the line following
6900 the pragma line (for use in error messages and debugging
6901 information).  @cite{string_literal} is a static string constant that
6902 specifies the file name to be used in error messages and debugging
6903 information.  This is most notably used for the output of @cite{gnatchop}
6904 with the @emph{-r} switch, to make sure that the original unchopped
6905 source file is the one referred to.
6907 The second argument must be a string literal, it cannot be a static
6908 string expression other than a string literal.  This is because its value
6909 is needed for error messages issued by all phases of the compiler.
6911 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
6912 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{bd}
6913 @section Pragma SPARK_Mode
6916 Syntax:
6918 @example
6919 pragma SPARK_Mode [(On | Off)] ;
6920 @end example
6922 In general a program can have some parts that are in SPARK 2014 (and
6923 follow all the rules in the SPARK Reference Manual), and some parts
6924 that are full Ada 2012.
6926 The SPARK_Mode pragma is used to identify which parts are in SPARK
6927 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
6928 be used in the following places:
6931 @itemize *
6933 @item 
6934 As a configuration pragma, in which case it sets the default mode for
6935 all units compiled with this pragma.
6937 @item 
6938 Immediately following a library-level subprogram spec
6940 @item 
6941 Immediately within a library-level package body
6943 @item 
6944 Immediately following the @cite{private} keyword of a library-level
6945 package spec
6947 @item 
6948 Immediately following the @cite{begin} keyword of a library-level
6949 package body
6951 @item 
6952 Immediately within a library-level subprogram body
6953 @end itemize
6955 Normally a subprogram or package spec/body inherits the current mode
6956 that is active at the point it is declared. But this can be overridden
6957 by pragma within the spec or body as above.
6959 The basic consistency rule is that you can't turn SPARK_Mode back
6960 @cite{On}, once you have explicitly (with a pragma) turned if
6961 @cite{Off}. So the following rules apply:
6963 If a subprogram spec has SPARK_Mode @cite{Off}, then the body must
6964 also have SPARK_Mode @cite{Off}.
6966 For a package, we have four parts:
6969 @itemize *
6971 @item 
6972 the package public declarations
6974 @item 
6975 the package private part
6977 @item 
6978 the body of the package
6980 @item 
6981 the elaboration code after @cite{begin}
6982 @end itemize
6984 For a package, the rule is that if you explicitly turn SPARK_Mode
6985 @cite{Off} for any part, then all the following parts must have
6986 SPARK_Mode @cite{Off}. Note that this may require repeating a pragma
6987 SPARK_Mode (@cite{Off}) in the body. For example, if we have a
6988 configuration pragma SPARK_Mode (@cite{On}) that turns the mode on by
6989 default everywhere, and one particular package spec has pragma
6990 SPARK_Mode (@cite{Off}), then that pragma will need to be repeated in
6991 the package body.
6993 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
6994 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{be}
6995 @section Pragma Static_Elaboration_Desired
6998 Syntax:
7000 @example
7001 pragma Static_Elaboration_Desired;
7002 @end example
7004 This pragma is used to indicate that the compiler should attempt to initialize
7005 statically the objects declared in the library unit to which the pragma applies,
7006 when these objects are initialized (explicitly or implicitly) by an aggregate.
7007 In the absence of this pragma, aggregates in object declarations are expanded
7008 into assignments and loops, even when the aggregate components are static
7009 constants. When the aggregate is present the compiler builds a static expression
7010 that requires no run-time code, so that the initialized object can be placed in
7011 read-only data space. If the components are not static, or the aggregate has
7012 more that 100 components, the compiler emits a warning that the pragma cannot
7013 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7014 construction of larger aggregates with static components that include an others
7015 choice.)
7017 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7018 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{bf}
7019 @section Pragma Stream_Convert
7022 Syntax:
7024 @example
7025 pragma Stream_Convert (
7026   [Entity =>] type_LOCAL_NAME,
7027   [Read   =>] function_NAME,
7028   [Write  =>] function_NAME);
7029 @end example
7031 This pragma provides an efficient way of providing user-defined stream
7032 attributes.  Not only is it simpler to use than specifying the attributes
7033 directly, but more importantly, it allows the specification to be made in such
7034 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7035 needed (i.e. unless the stream attributes are actually used); the use of
7036 the Stream_Convert pragma adds no overhead at all, unless the stream
7037 attributes are actually used on the designated type.
7039 The first argument specifies the type for which stream functions are
7040 provided.  The second parameter provides a function used to read values
7041 of this type.  It must name a function whose argument type may be any
7042 subtype, and whose returned type must be the type given as the first
7043 argument to the pragma.
7045 The meaning of the @cite{Read} parameter is that if a stream attribute directly
7046 or indirectly specifies reading of the type given as the first parameter,
7047 then a value of the type given as the argument to the Read function is
7048 read from the stream, and then the Read function is used to convert this
7049 to the required target type.
7051 Similarly the @cite{Write} parameter specifies how to treat write attributes
7052 that directly or indirectly apply to the type given as the first parameter.
7053 It must have an input parameter of the type specified by the first parameter,
7054 and the return type must be the same as the input type of the Read function.
7055 The effect is to first call the Write function to convert to the given stream
7056 type, and then write the result type to the stream.
7058 The Read and Write functions must not be overloaded subprograms.  If necessary
7059 renamings can be supplied to meet this requirement.
7060 The usage of this attribute is best illustrated by a simple example, taken
7061 from the GNAT implementation of package Ada.Strings.Unbounded:
7063 @example
7064 function To_Unbounded (S : String) return Unbounded_String
7065   renames To_Unbounded_String;
7067 pragma Stream_Convert
7068   (Unbounded_String, To_Unbounded, To_String);
7069 @end example
7071 The specifications of the referenced functions, as given in the Ada
7072 Reference Manual are:
7074 @example
7075 function To_Unbounded_String (Source : String)
7076   return Unbounded_String;
7078 function To_String (Source : Unbounded_String)
7079   return String;
7080 @end example
7082 The effect is that if the value of an unbounded string is written to a stream,
7083 then the representation of the item in the stream is in the same format that
7084 would be used for @cite{Standard.String'Output}, and this same representation
7085 is expected when a value of this type is read from the stream. Note that the
7086 value written always includes the bounds, even for Unbounded_String'Write,
7087 since Unbounded_String is not an array type.
7089 Note that the @cite{Stream_Convert} pragma is not effective in the case of
7090 a derived type of a non-limited tagged type. If such a type is specified then
7091 the pragma is silently ignored, and the default implementation of the stream
7092 attributes is used instead.
7094 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7095 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{c0}
7096 @section Pragma Style_Checks
7099 Syntax:
7101 @example
7102 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7103                      On | Off [, LOCAL_NAME]);
7104 @end example
7106 This pragma is used in conjunction with compiler switches to control the
7107 built in style checking provided by GNAT.  The compiler switches, if set,
7108 provide an initial setting for the switches, and this pragma may be used
7109 to modify these settings, or the settings may be provided entirely by
7110 the use of the pragma.  This pragma can be used anywhere that a pragma
7111 is legal, including use as a configuration pragma (including use in
7112 the @code{gnat.adc} file).
7114 The form with a string literal specifies which style options are to be
7115 activated.  These are additive, so they apply in addition to any previously
7116 set style check options.  The codes for the options are the same as those
7117 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7118 For example the following two methods can be used to enable
7119 layout checking:
7122 @itemize *
7124 @item 
7125 @example
7126 pragma Style_Checks ("l");
7127 @end example
7129 @item 
7130 @example
7131 gcc -c -gnatyl ...
7132 @end example
7133 @end itemize
7135 The form ALL_CHECKS activates all standard checks (its use is equivalent
7136 to the use of the @cite{gnaty} switch with no options.
7137 See the @cite{GNAT User's Guide} for details.)
7139 Note: the behavior is slightly different in GNAT mode (@emph{-gnatg} used).
7140 In this case, ALL_CHECKS implies the standard set of GNAT mode style check
7141 options (i.e. equivalent to @emph{-gnatyg}).
7143 The forms with @cite{Off} and @cite{On}
7144 can be used to temporarily disable style checks
7145 as shown in the following example:
7147 @example
7148 pragma Style_Checks ("k"); -- requires keywords in lower case
7149 pragma Style_Checks (Off); -- turn off style checks
7150 NULL;                      -- this will not generate an error message
7151 pragma Style_Checks (On);  -- turn style checks back on
7152 NULL;                      -- this will generate an error message
7153 @end example
7155 Finally the two argument form is allowed only if the first argument is
7156 @cite{On} or @cite{Off}.  The effect is to turn of semantic style checks
7157 for the specified entity, as shown in the following example:
7159 @example
7160 pragma Style_Checks ("r"); -- require consistency of identifier casing
7161 Arg : Integer;
7162 Rf1 : Integer := ARG;      -- incorrect, wrong case
7163 pragma Style_Checks (Off, Arg);
7164 Rf2 : Integer := ARG;      -- OK, no error
7165 @end example
7167 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7168 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{c1}
7169 @section Pragma Subtitle
7172 Syntax:
7174 @example
7175 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7176 @end example
7178 This pragma is recognized for compatibility with other Ada compilers
7179 but is ignored by GNAT.
7181 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7182 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{c2}
7183 @section Pragma Suppress
7186 Syntax:
7188 @example
7189 pragma Suppress (Identifier [, [On =>] Name]);
7190 @end example
7192 This is a standard pragma, and supports all the check names required in
7193 the RM. It is included here because GNAT recognizes some additional check
7194 names that are implementation defined (as permitted by the RM):
7197 @itemize *
7199 @item 
7200 @cite{Alignment_Check} can be used to suppress alignment checks
7201 on addresses used in address clauses. Such checks can also be suppressed
7202 by suppressing range checks, but the specific use of @cite{Alignment_Check}
7203 allows suppression of alignment checks without suppressing other range checks.
7204 Note that @cite{Alignment_Check} is suppressed by default on machines (such as
7205 the x86) with non-strict alignment.
7207 @item 
7208 @cite{Atomic_Synchronization} can be used to suppress the special memory
7209 synchronization instructions that are normally generated for access to
7210 @cite{Atomic} variables to ensure correct synchronization between tasks
7211 that use such variables for synchronization purposes.
7213 @item 
7214 @cite{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7215 for a duplicated tag value when a tagged type is declared.
7217 @item 
7218 @cite{Predicate_Check} can be used to control whether predicate checks are
7219 active. It is applicable only to predicates for which the policy is
7220 @cite{Check}. Unlike @cite{Assertion_Policy}, which determines if a given
7221 predicate is ignored or checked for the whole program, the use of
7222 @cite{Suppress} and @cite{Unsuppress} with this check name allows a given
7223 predicate to be turned on and off at specific points in the program.
7225 @item 
7226 @cite{Validity_Check} can be used specifically to control validity checks.
7227 If @cite{Suppress} is used to suppress validity checks, then no validity
7228 checks are performed, including those specified by the appropriate compiler
7229 switch or the @cite{Validity_Checks} pragma.
7231 @item 
7232 Additional check names previously introduced by use of the @cite{Check_Name}
7233 pragma are also allowed.
7234 @end itemize
7236 Note that pragma Suppress gives the compiler permission to omit
7237 checks, but does not require the compiler to omit checks. The compiler
7238 will generate checks if they are essentially free, even when they are
7239 suppressed. In particular, if the compiler can prove that a certain
7240 check will necessarily fail, it will generate code to do an
7241 unconditional 'raise', even if checks are suppressed. The compiler
7242 warns in this case.
7244 Of course, run-time checks are omitted whenever the compiler can prove
7245 that they will not fail, whether or not checks are suppressed.
7247 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7248 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{c3}
7249 @section Pragma Suppress_All
7252 Syntax:
7254 @example
7255 pragma Suppress_All;
7256 @end example
7258 This pragma can appear anywhere within a unit.
7259 The effect is to apply @cite{Suppress (All_Checks)} to the unit
7260 in which it appears.  This pragma is implemented for compatibility with DEC
7261 Ada 83 usage where it appears at the end of a unit, and for compatibility
7262 with Rational Ada, where it appears as a program unit pragma.
7263 The use of the standard Ada pragma @cite{Suppress (All_Checks)}
7264 as a normal configuration pragma is the preferred usage in GNAT.
7266 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7267 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{c4}
7268 @section Pragma Suppress_Debug_Info
7271 Syntax:
7273 @example
7274 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7275 @end example
7277 This pragma can be used to suppress generation of debug information
7278 for the specified entity. It is intended primarily for use in debugging
7279 the debugger, and navigating around debugger problems.
7281 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7282 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{c5}
7283 @section Pragma Suppress_Exception_Locations
7286 Syntax:
7288 @example
7289 pragma Suppress_Exception_Locations;
7290 @end example
7292 In normal mode, a raise statement for an exception by default generates
7293 an exception message giving the file name and line number for the location
7294 of the raise. This is useful for debugging and logging purposes, but this
7295 entails extra space for the strings for the messages. The configuration
7296 pragma @cite{Suppress_Exception_Locations} can be used to suppress the
7297 generation of these strings, with the result that space is saved, but the
7298 exception message for such raises is null. This configuration pragma may
7299 appear in a global configuration pragma file, or in a specific unit as
7300 usual. It is not required that this pragma be used consistently within
7301 a partition, so it is fine to have some units within a partition compiled
7302 with this pragma and others compiled in normal mode without it.
7304 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7305 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{c6}
7306 @section Pragma Suppress_Initialization
7309 @geindex Suppressing initialization
7311 @geindex Initialization
7312 @geindex suppression of
7314 Syntax:
7316 @example
7317 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
7318 @end example
7320 Here variable_or_subtype_Name is the name introduced by a type declaration
7321 or subtype declaration or the name of a variable introduced by an
7322 object declaration.
7324 In the case of a type or subtype
7325 this pragma suppresses any implicit or explicit initialization
7326 for all variables of the given type or subtype,
7327 including initialization resulting from the use of pragmas
7328 Normalize_Scalars or Initialize_Scalars.
7330 This is considered a representation item, so it cannot be given after
7331 the type is frozen. It applies to all subsequent object declarations,
7332 and also any allocator that creates objects of the type.
7334 If the pragma is given for the first subtype, then it is considered
7335 to apply to the base type and all its subtypes. If the pragma is given
7336 for other than a first subtype, then it applies only to the given subtype.
7337 The pragma may not be given after the type is frozen.
7339 Note that this includes eliminating initialization of discriminants
7340 for discriminated types, and tags for tagged types. In these cases,
7341 you will have to use some non-portable mechanism (e.g. address
7342 overlays or unchecked conversion) to achieve required initialization
7343 of these fields before accessing any object of the corresponding type.
7345 For the variable case, implicit initialization for the named variable
7346 is suppressed, just as though its subtype had been given in a pragma
7347 Suppress_Initialization, as described above.
7349 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
7350 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{c7}
7351 @section Pragma Task_Name
7354 Syntax
7356 @example
7357 pragma Task_Name (string_EXPRESSION);
7358 @end example
7360 This pragma appears within a task definition (like pragma
7361 @cite{Priority}) and applies to the task in which it appears.  The
7362 argument must be of type String, and provides a name to be used for
7363 the task instance when the task is created.  Note that this expression
7364 is not required to be static, and in particular, it can contain
7365 references to task discriminants.  This facility can be used to
7366 provide different names for different tasks as they are created,
7367 as illustrated in the example below.
7369 The task name is recorded internally in the run-time structures
7370 and is accessible to tools like the debugger.  In addition the
7371 routine @cite{Ada.Task_Identification.Image} will return this
7372 string, with a unique task address appended.
7374 @example
7375 --  Example of the use of pragma Task_Name
7377 with Ada.Task_Identification;
7378 use Ada.Task_Identification;
7379 with Text_IO; use Text_IO;
7380 procedure t3 is
7382    type Astring is access String;
7384    task type Task_Typ (Name : access String) is
7385       pragma Task_Name (Name.all);
7386    end Task_Typ;
7388    task body Task_Typ is
7389       Nam : constant String := Image (Current_Task);
7390    begin
7391       Put_Line ("-->" & Nam (1 .. 14) & "<--");
7392    end Task_Typ;
7394    type Ptr_Task is access Task_Typ;
7395    Task_Var : Ptr_Task;
7397 begin
7398    Task_Var :=
7399      new Task_Typ (new String'("This is task 1"));
7400    Task_Var :=
7401      new Task_Typ (new String'("This is task 2"));
7402 end;
7403 @end example
7405 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
7406 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{c8}
7407 @section Pragma Task_Storage
7410 Syntax:
7412 @example
7413 pragma Task_Storage (
7414   [Task_Type =>] LOCAL_NAME,
7415   [Top_Guard =>] static_integer_EXPRESSION);
7416 @end example
7418 This pragma specifies the length of the guard area for tasks.  The guard
7419 area is an additional storage area allocated to a task.  A value of zero
7420 means that either no guard area is created or a minimal guard area is
7421 created, depending on the target.  This pragma can appear anywhere a
7422 @cite{Storage_Size} attribute definition clause is allowed for a task
7423 type.
7425 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
7426 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{c9}
7427 @section Pragma Test_Case
7430 @geindex Test cases
7432 Syntax:
7434 @example
7435 pragma Test_Case (
7436    [Name     =>] static_string_Expression
7437   ,[Mode     =>] (Nominal | Robustness)
7438  [, Requires =>  Boolean_Expression]
7439  [, Ensures  =>  Boolean_Expression]);
7440 @end example
7442 The @cite{Test_Case} pragma allows defining fine-grain specifications
7443 for use by testing tools.
7444 The compiler checks the validity of the @cite{Test_Case} pragma, but its
7445 presence does not lead to any modification of the code generated by the
7446 compiler.
7448 @cite{Test_Case} pragmas may only appear immediately following the
7449 (separate) declaration of a subprogram in a package declaration, inside
7450 a package spec unit. Only other pragmas may intervene (that is appear
7451 between the subprogram declaration and a test case).
7453 The compiler checks that boolean expressions given in @cite{Requires} and
7454 @cite{Ensures} are valid, where the rules for @cite{Requires} are the
7455 same as the rule for an expression in @cite{Precondition} and the rules
7456 for @cite{Ensures} are the same as the rule for an expression in
7457 @cite{Postcondition}. In particular, attributes @cite{'Old} and
7458 @cite{'Result} can only be used within the @cite{Ensures}
7459 expression. The following is an example of use within a package spec:
7461 @example
7462 package Math_Functions is
7463    ...
7464    function Sqrt (Arg : Float) return Float;
7465    pragma Test_Case (Name     => "Test 1",
7466                      Mode     => Nominal,
7467                      Requires => Arg < 10000,
7468                      Ensures  => Sqrt'Result < 10);
7469    ...
7470 end Math_Functions;
7471 @end example
7473 The meaning of a test case is that there is at least one context where
7474 @cite{Requires} holds such that, if the associated subprogram is executed in
7475 that context, then @cite{Ensures} holds when the subprogram returns.
7476 Mode @cite{Nominal} indicates that the input context should also satisfy the
7477 precondition of the subprogram, and the output context should also satisfy its
7478 postcondition. Mode @cite{Robustness} indicates that the precondition and
7479 postcondition of the subprogram should be ignored for this test case.
7481 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
7482 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{ca}
7483 @section Pragma Thread_Local_Storage
7486 @geindex Task specific storage
7488 @geindex TLS (Thread Local Storage)
7490 @geindex Task_Attributes
7492 Syntax:
7494 @example
7495 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
7496 @end example
7498 This pragma specifies that the specified entity, which must be
7499 a variable declared in a library level package, is to be marked as
7500 "Thread Local Storage" (@cite{TLS}). On systems supporting this (which
7501 include Solaris, GNU/Linux and VxWorks 6), this causes each thread
7502 (and hence each Ada task) to see a distinct copy of the variable.
7504 The variable may not have default initialization, and if there is
7505 an explicit initialization, it must be either @cite{null} for an
7506 access variable, or a static expression for a scalar variable.
7507 This provides a low level mechanism similar to that provided by
7508 the @cite{Ada.Task_Attributes} package, but much more efficient
7509 and is also useful in writing interface code that will interact
7510 with foreign threads.
7512 If this pragma is used on a system where @cite{TLS} is not supported,
7513 then an error message will be generated and the program will be rejected.
7515 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
7516 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{cb}
7517 @section Pragma Time_Slice
7520 Syntax:
7522 @example
7523 pragma Time_Slice (static_duration_EXPRESSION);
7524 @end example
7526 For implementations of GNAT on operating systems where it is possible
7527 to supply a time slice value, this pragma may be used for this purpose.
7528 It is ignored if it is used in a system that does not allow this control,
7529 or if it appears in other than the main program unit.
7531 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
7532 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{cc}
7533 @section Pragma Title
7536 Syntax:
7538 @example
7539 pragma Title (TITLING_OPTION [, TITLING OPTION]);
7541 TITLING_OPTION ::=
7542   [Title    =>] STRING_LITERAL,
7543 | [Subtitle =>] STRING_LITERAL
7544 @end example
7546 Syntax checked but otherwise ignored by GNAT.  This is a listing control
7547 pragma used in DEC Ada 83 implementations to provide a title and/or
7548 subtitle for the program listing.  The program listing generated by GNAT
7549 does not have titles or subtitles.
7551 Unlike other pragmas, the full flexibility of named notation is allowed
7552 for this pragma, i.e., the parameters may be given in any order if named
7553 notation is used, and named and positional notation can be mixed
7554 following the normal rules for procedure calls in Ada.
7556 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
7557 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{cd}
7558 @section Pragma Type_Invariant
7561 Syntax:
7563 @example
7564 pragma Type_Invariant
7565   ([Entity =>] type_LOCAL_NAME,
7566    [Check  =>] EXPRESSION);
7567 @end example
7569 The @cite{Type_Invariant} pragma is intended to be an exact
7570 replacement for the language-defined @cite{Type_Invariant}
7571 aspect, and shares its restrictions and semantics. It differs
7572 from the language defined @cite{Invariant} pragma in that it
7573 does not permit a string parameter, and it is
7574 controlled by the assertion identifier @cite{Type_Invariant}
7575 rather than @cite{Invariant}.
7577 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
7578 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{ce}
7579 @section Pragma Type_Invariant_Class
7582 Syntax:
7584 @example
7585 pragma Type_Invariant_Class
7586   ([Entity =>] type_LOCAL_NAME,
7587    [Check  =>] EXPRESSION);
7588 @end example
7590 The @cite{Type_Invariant_Class} pragma is intended to be an exact
7591 replacement for the language-defined @cite{Type_Invariant'Class}
7592 aspect, and shares its restrictions and semantics.
7594 Note: This pragma is called @cite{Type_Invariant_Class} rather than
7595 @cite{Type_Invariant'Class} because the latter would not be strictly
7596 conforming to the allowed syntax for pragmas. The motivation
7597 for providing pragmas equivalent to the aspects is to allow a program
7598 to be written using the pragmas, and then compiled if necessary
7599 using an Ada compiler that does not recognize the pragmas or
7600 aspects, but is prepared to ignore the pragmas. The assertion
7601 policy that controls this pragma is @cite{Type_Invariant'Class},
7602 not @cite{Type_Invariant_Class}.
7604 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
7605 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{cf}
7606 @section Pragma Unchecked_Union
7609 @geindex Unions in C
7611 Syntax:
7613 @example
7614 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
7615 @end example
7617 This pragma is used to specify a representation of a record type that is
7618 equivalent to a C union. It was introduced as a GNAT implementation defined
7619 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
7620 pragma, making it language defined, and GNAT fully implements this extended
7621 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
7622 details, consult the Ada 2012 Reference Manual, section B.3.3.
7624 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
7625 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{d0}
7626 @section Pragma Unevaluated_Use_Of_Old
7629 @geindex Attribute Old
7631 @geindex Attribute Loop_Entry
7633 @geindex Unevaluated_Use_Of_Old
7635 Syntax:
7637 @example
7638 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
7639 @end example
7641 This pragma controls the processing of attributes Old and Loop_Entry.
7642 If either of these attributes is used in a potentially unevaluated
7643 expression  (e.g. the then or else parts of an if expression), then
7644 normally this usage is considered illegal if the prefix of the attribute
7645 is other than an entity name. The language requires this
7646 behavior for Old, and GNAT copies the same rule for Loop_Entry.
7648 The reason for this rule is that otherwise, we can have a situation
7649 where we save the Old value, and this results in an exception, even
7650 though we might not evaluate the attribute. Consider this example:
7652 @example
7653 package UnevalOld is
7654    K : Character;
7655    procedure U (A : String; C : Boolean)  -- ERROR
7656      with Post => (if C then A(1)'Old = K else True);
7657 end;
7658 @end example
7660 If procedure U is called with a string with a lower bound of 2, and
7661 C false, then an exception would be raised trying to evaluate A(1)
7662 on entry even though the value would not be actually used.
7664 Although the rule guarantees against this possibility, it is sometimes
7665 too restrictive. For example if we know that the string has a lower
7666 bound of 1, then we will never raise an exception.
7667 The pragma @cite{Unevaluated_Use_Of_Old} can be
7668 used to modify this behavior. If the argument is @cite{Error} then an
7669 error is given (this is the default RM behavior). If the argument is
7670 @cite{Warn} then the usage is allowed as legal but with a warning
7671 that an exception might be raised. If the argument is @cite{Allow}
7672 then the usage is allowed as legal without generating a warning.
7674 This pragma may appear as a configuration pragma, or in a declarative
7675 part or package specification. In the latter case it applies to
7676 uses up to the end of the corresponding statement sequence or
7677 sequence of package declarations.
7679 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
7680 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{d1}
7681 @section Pragma Unimplemented_Unit
7684 Syntax:
7686 @example
7687 pragma Unimplemented_Unit;
7688 @end example
7690 If this pragma occurs in a unit that is processed by the compiler, GNAT
7691 aborts with the message @code{xxx not implemented}, where
7692 @cite{xxx} is the name of the current compilation unit.  This pragma is
7693 intended to allow the compiler to handle unimplemented library units in
7694 a clean manner.
7696 The abort only happens if code is being generated.  Thus you can use
7697 specs of unimplemented packages in syntax or semantic checking mode.
7699 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
7700 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{d2}
7701 @section Pragma Universal_Aliasing
7704 Syntax:
7706 @example
7707 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
7708 @end example
7710 @cite{type_LOCAL_NAME} must refer to a type declaration in the current
7711 declarative part.  The effect is to inhibit strict type-based aliasing
7712 optimization for the given type.  In other words, the effect is as though
7713 access types designating this type were subject to pragma No_Strict_Aliasing.
7714 For a detailed description of the strict aliasing optimization, and the
7715 situations in which it must be suppressed, see the section on
7716 @cite{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
7718 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
7719 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{d3}
7720 @section Pragma Universal_Data
7723 Syntax:
7725 @example
7726 pragma Universal_Data [(library_unit_Name)];
7727 @end example
7729 This pragma is supported only for the AAMP target and is ignored for
7730 other targets. The pragma specifies that all library-level objects
7731 (Counter 0 data) associated with the library unit are to be accessed
7732 and updated using universal addressing (24-bit addresses for AAMP5)
7733 rather than the default of 16-bit Data Environment (DENV) addressing.
7734 Use of this pragma will generally result in less efficient code for
7735 references to global data associated with the library unit, but
7736 allows such data to be located anywhere in memory. This pragma is
7737 a library unit pragma, but can also be used as a configuration pragma
7738 (including use in the @code{gnat.adc} file). The functionality
7739 of this pragma is also available by applying the -univ switch on the
7740 compilations of units where universal addressing of the data is desired.
7742 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
7743 @anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{d4}
7744 @section Pragma Unmodified
7747 @geindex Warnings
7748 @geindex unmodified
7750 Syntax:
7752 @example
7753 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
7754 @end example
7756 This pragma signals that the assignable entities (variables,
7757 @cite{out} parameters, @cite{in out} parameters) whose names are listed are
7758 deliberately not assigned in the current source unit. This
7759 suppresses warnings about the
7760 entities being referenced but not assigned, and in addition a warning will be
7761 generated if one of these entities is in fact assigned in the
7762 same unit as the pragma (or in the corresponding body, or one
7763 of its subunits).
7765 This is particularly useful for clearly signaling that a particular
7766 parameter is not modified, even though the spec suggests that it might
7769 For the variable case, warnings are never given for unreferenced variables
7770 whose name contains one of the substrings
7771 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
7772 are typically to be used in cases where such warnings are expected.
7773 Thus it is never necessary to use @cite{pragma Unmodified} for such
7774 variables, though it is harmless to do so.
7776 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
7777 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{d5}
7778 @section Pragma Unreferenced
7781 @geindex Warnings
7782 @geindex unreferenced
7784 Syntax:
7786 @example
7787 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
7788 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
7789 @end example
7791 This pragma signals that the entities whose names are listed are
7792 deliberately not referenced in the current source unit after the
7793 occurrence of the pragma. This
7794 suppresses warnings about the
7795 entities being unreferenced, and in addition a warning will be
7796 generated if one of these entities is in fact subsequently referenced in the
7797 same unit as the pragma (or in the corresponding body, or one
7798 of its subunits).
7800 This is particularly useful for clearly signaling that a particular
7801 parameter is not referenced in some particular subprogram implementation
7802 and that this is deliberate. It can also be useful in the case of
7803 objects declared only for their initialization or finalization side
7804 effects.
7806 If @cite{LOCAL_NAME} identifies more than one matching homonym in the
7807 current scope, then the entity most recently declared is the one to which
7808 the pragma applies. Note that in the case of accept formals, the pragma
7809 Unreferenced may appear immediately after the keyword @cite{do} which
7810 allows the indication of whether or not accept formals are referenced
7811 or not to be given individually for each accept statement.
7813 The left hand side of an assignment does not count as a reference for the
7814 purpose of this pragma. Thus it is fine to assign to an entity for which
7815 pragma Unreferenced is given.
7817 Note that if a warning is desired for all calls to a given subprogram,
7818 regardless of whether they occur in the same unit as the subprogram
7819 declaration, then this pragma should not be used (calls from another
7820 unit would not be flagged); pragma Obsolescent can be used instead
7821 for this purpose, see @ref{8c,,Pragma Obsolescent}.
7823 The second form of pragma @cite{Unreferenced} is used within a context
7824 clause. In this case the arguments must be unit names of units previously
7825 mentioned in @cite{with} clauses (similar to the usage of pragma
7826 @cite{Elaborate_All}. The effect is to suppress warnings about unreferenced
7827 units and unreferenced entities within these units.
7829 For the variable case, warnings are never given for unreferenced variables
7830 whose name contains one of the substrings
7831 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
7832 are typically to be used in cases where such warnings are expected.
7833 Thus it is never necessary to use @cite{pragma Unreferenced} for such
7834 variables, though it is harmless to do so.
7836 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
7837 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{d6}
7838 @section Pragma Unreferenced_Objects
7841 @geindex Warnings
7842 @geindex unreferenced
7844 Syntax:
7846 @example
7847 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
7848 @end example
7850 This pragma signals that for the types or subtypes whose names are
7851 listed, objects which are declared with one of these types or subtypes may
7852 not be referenced, and if no references appear, no warnings are given.
7854 This is particularly useful for objects which are declared solely for their
7855 initialization and finalization effect. Such variables are sometimes referred
7856 to as RAII variables (Resource Acquisition Is Initialization). Using this
7857 pragma on the relevant type (most typically a limited controlled type), the
7858 compiler will automatically suppress unwanted warnings about these variables
7859 not being referenced.
7861 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
7862 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{d7}
7863 @section Pragma Unreserve_All_Interrupts
7866 Syntax:
7868 @example
7869 pragma Unreserve_All_Interrupts;
7870 @end example
7872 Normally certain interrupts are reserved to the implementation.  Any attempt
7873 to attach an interrupt causes Program_Error to be raised, as described in
7874 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
7875 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
7876 reserved to the implementation, so that @code{Ctrl-C} can be used to
7877 interrupt execution.
7879 If the pragma @cite{Unreserve_All_Interrupts} appears anywhere in any unit in
7880 a program, then all such interrupts are unreserved.  This allows the
7881 program to handle these interrupts, but disables their standard
7882 functions.  For example, if this pragma is used, then pressing
7883 @code{Ctrl-C} will not automatically interrupt execution.  However,
7884 a program can then handle the @cite{SIGINT} interrupt as it chooses.
7886 For a full list of the interrupts handled in a specific implementation,
7887 see the source code for the spec of @cite{Ada.Interrupts.Names} in
7888 file @code{a-intnam.ads}.  This is a target dependent file that contains the
7889 list of interrupts recognized for a given target.  The documentation in
7890 this file also specifies what interrupts are affected by the use of
7891 the @cite{Unreserve_All_Interrupts} pragma.
7893 For a more general facility for controlling what interrupts can be
7894 handled, see pragma @cite{Interrupt_State}, which subsumes the functionality
7895 of the @cite{Unreserve_All_Interrupts} pragma.
7897 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
7898 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{d8}
7899 @section Pragma Unsuppress
7902 Syntax:
7904 @example
7905 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
7906 @end example
7908 This pragma undoes the effect of a previous pragma @cite{Suppress}.  If
7909 there is no corresponding pragma @cite{Suppress} in effect, it has no
7910 effect.  The range of the effect is the same as for pragma
7911 @cite{Suppress}.  The meaning of the arguments is identical to that used
7912 in pragma @cite{Suppress}.
7914 One important application is to ensure that checks are on in cases where
7915 code depends on the checks for its correct functioning, so that the code
7916 will compile correctly even if the compiler switches are set to suppress
7917 checks. For example, in a program that depends on external names of tagged
7918 types and wants to ensure that the duplicated tag check occurs even if all
7919 run-time checks are suppressed by a compiler switch, the following
7920 configuration pragma will ensure this test is not suppressed:
7922 @example
7923 pragma Unsuppress (Duplicated_Tag_Check);
7924 @end example
7926 This pragma is standard in Ada 2005. It is available in all earlier versions
7927 of Ada as an implementation-defined pragma.
7929 Note that in addition to the checks defined in the Ada RM, GNAT recogizes
7930 a number of implementation-defined check names. See description of pragma
7931 @cite{Suppress} for full details.
7933 @node Pragma Use_VADS_Size,Pragma Validity_Checks,Pragma Unsuppress,Implementation Defined Pragmas
7934 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{d9}
7935 @section Pragma Use_VADS_Size
7938 @geindex Size
7939 @geindex VADS compatibility
7941 @geindex Rational profile
7943 Syntax:
7945 @example
7946 pragma Use_VADS_Size;
7947 @end example
7949 This is a configuration pragma.  In a unit to which it applies, any use
7950 of the 'Size attribute is automatically interpreted as a use of the
7951 'VADS_Size attribute.  Note that this may result in incorrect semantic
7952 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
7953 the handling of existing code which depends on the interpretation of Size
7954 as implemented in the VADS compiler.  See description of the VADS_Size
7955 attribute for further details.
7957 @node Pragma Validity_Checks,Pragma Volatile,Pragma Use_VADS_Size,Implementation Defined Pragmas
7958 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{da}
7959 @section Pragma Validity_Checks
7962 Syntax:
7964 @example
7965 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
7966 @end example
7968 This pragma is used in conjunction with compiler switches to control the
7969 built-in validity checking provided by GNAT.  The compiler switches, if set
7970 provide an initial setting for the switches, and this pragma may be used
7971 to modify these settings, or the settings may be provided entirely by
7972 the use of the pragma.  This pragma can be used anywhere that a pragma
7973 is legal, including use as a configuration pragma (including use in
7974 the @code{gnat.adc} file).
7976 The form with a string literal specifies which validity options are to be
7977 activated.  The validity checks are first set to include only the default
7978 reference manual settings, and then a string of letters in the string
7979 specifies the exact set of options required.  The form of this string
7980 is exactly as described for the @emph{-gnatVx} compiler switch (see the
7981 GNAT User's Guide for details).  For example the following two
7982 methods can be used to enable validity checking for mode @cite{in} and
7983 @cite{in out} subprogram parameters:
7986 @itemize *
7988 @item 
7989 @example
7990 pragma Validity_Checks ("im");
7991 @end example
7993 @item 
7994 @example
7995 $ gcc -c -gnatVim ...
7996 @end example
7997 @end itemize
7999 The form ALL_CHECKS activates all standard checks (its use is equivalent
8000 to the use of the @cite{gnatva} switch.
8002 The forms with @cite{Off} and @cite{On}
8003 can be used to temporarily disable validity checks
8004 as shown in the following example:
8006 @example
8007 pragma Validity_Checks ("c"); -- validity checks for copies
8008 pragma Validity_Checks (Off); -- turn off validity checks
8009 A := B;                       -- B will not be validity checked
8010 pragma Validity_Checks (On);  -- turn validity checks back on
8011 A := C;                       -- C will be validity checked
8012 @end example
8014 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8015 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{db}
8016 @section Pragma Volatile
8019 Syntax:
8021 @example
8022 pragma Volatile (LOCAL_NAME);
8023 @end example
8025 This pragma is defined by the Ada Reference Manual, and the GNAT
8026 implementation is fully conformant with this definition.  The reason it
8027 is mentioned in this section is that a pragma of the same name was supplied
8028 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8029 implementation of pragma Volatile is upwards compatible with the
8030 implementation in DEC Ada 83.
8032 @node Pragma Volatile_Full_Access,Pragma Warning_As_Error,Pragma Volatile,Implementation Defined Pragmas
8033 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{dc}
8034 @section Pragma Volatile_Full_Access
8037 Syntax:
8039 @example
8040 pragma Volatile_Full_Access (LOCAL_NAME);
8041 @end example
8043 This is similar in effect to pragma Volatile, except that any reference to the
8044 object is guaranteed to be done only with instructions that read or write all
8045 the bits of the object. Furthermore, if the object is of a composite type,
8046 then any reference to a component of the object is guaranteed to read and/or
8047 write all the bits of the object.
8049 The intention is that this be suitable for use with memory-mapped I/O devices
8050 on some machines. Note that there are two important respects in which this is
8051 different from @cite{pragma Atomic}. First a reference to a @cite{Volatile_Full_Access}
8052 object is not a sequential action in the RM 9.10 sense and, therefore, does
8053 not create a synchronization point. Second, in the case of @cite{pragma Atomic},
8054 there is no guarantee that all the bits will be accessed if the reference
8055 is not to the whole object; the compiler is allowed (and generally will)
8056 access only part of the object in this case.
8058 It is not permissible to specify @cite{Atomic} and @cite{Volatile_Full_Access} for
8059 the same object.
8061 It is not permissible to specify @cite{Volatile_Full_Access} for a composite
8062 (record or array) type or object that has at least one @cite{Aliased} component.
8064 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8065 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{dd}
8066 @section Pragma Warning_As_Error
8069 Syntax:
8071 @example
8072 pragma Warning_As_Error (static_string_EXPRESSION);
8073 @end example
8075 This configuration pragma allows the programmer to specify a set
8076 of warnings that will be treated as errors. Any warning which
8077 matches the pattern given by the pragma argument will be treated
8078 as an error. This gives much more precise control that -gnatwe
8079 which treats all warnings as errors.
8081 The pattern may contain asterisks, which match zero or more characters in
8082 the message. For example, you can use
8083 @cite{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8084 message @cite{warning: 960 bits of "a" unused} as an error. No other regular
8085 expression notations are permitted. All characters other than asterisk in
8086 these three specific cases are treated as literal characters in the match.
8087 The match is case insensitive, for example XYZ matches xyz.
8089 Note that the pattern matches if it occurs anywhere within the warning
8090 message string (it is not necessary to put an asterisk at the start and
8091 the end of the message, since this is implied).
8093 Another possibility for the static_string_EXPRESSION which works whether
8094 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8095 @emph{-gnatw} tag string, enclosed in brackets,
8096 as shown in the example below, to treat a class of warnings as errors.
8098 The above use of patterns to match the message applies only to warning
8099 messages generated by the front end. This pragma can also be applied to
8100 warnings provided by the back end and mentioned in @ref{de,,Pragma Warnings}.
8101 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8102 can also be treated as errors.
8104 The pragma can appear either in a global configuration pragma file
8105 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8106 configuration pragma file containing:
8108 @example
8109 pragma Warning_As_Error ("[-gnatwj]");
8110 @end example
8112 which will treat all obsolescent feature warnings as errors, the
8113 following program compiles as shown (compile options here are
8114 @emph{-gnatwa.d -gnatl -gnatj55}).
8116 @example
8117     1. pragma Warning_As_Error ("*never assigned*");
8118     2. function Warnerr return String is
8119     3.    X : Integer;
8120           |
8121        >>> error: variable "X" is never read and
8122            never assigned [-gnatwv] [warning-as-error]
8124     4.    Y : Integer;
8125           |
8126        >>> warning: variable "Y" is assigned but
8127            never read [-gnatwu]
8129     5. begin
8130     6.    Y := 0;
8131     7.    return %ABC%;
8132                  |
8133        >>> error: use of "%" is an obsolescent
8134            feature (RM J.2(4)), use """ instead
8135            [-gnatwj] [warning-as-error]
8137     8. end;
8139 8 lines: No errors, 3 warnings (2 treated as errors)
8140 @end example
8142 Note that this pragma does not affect the set of warnings issued in
8143 any way, it merely changes the effect of a matching warning if one
8144 is produced as a result of other warnings options. As shown in this
8145 example, if the pragma results in a warning being treated as an error,
8146 the tag is changed from "warning:" to "error:" and the string
8147 "[warning-as-error]" is appended to the end of the message.
8149 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8150 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{df}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{de}
8151 @section Pragma Warnings
8154 Syntax:
8156 @example
8157 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8159 DETAILS ::= On | Off
8160 DETAILS ::= On | Off, local_NAME
8161 DETAILS ::= static_string_EXPRESSION
8162 DETAILS ::= On | Off, static_string_EXPRESSION
8164 TOOL_NAME ::= GNAT | GNATProve
8166 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8167 @end example
8169 Note: in Ada 83 mode, a string literal may be used in place of a static string
8170 expression (which does not exist in Ada 83).
8172 Note if the second argument of @cite{DETAILS} is a @cite{local_NAME} then the
8173 second form is always understood. If the intention is to use
8174 the fourth form, then you can write @cite{NAME & ""} to force the
8175 intepretation as a @cite{static_string_EXPRESSION}.
8177 Note: if the first argument is a valid @cite{TOOL_NAME}, it will be interpreted
8178 that way. The use of the @cite{TOOL_NAME} argument is relevant only to users
8179 of SPARK and GNATprove, see last part of this section for details.
8181 Normally warnings are enabled, with the output being controlled by
8182 the command line switch.  Warnings (@cite{Off}) turns off generation of
8183 warnings until a Warnings (@cite{On}) is encountered or the end of the
8184 current unit.  If generation of warnings is turned off using this
8185 pragma, then some or all of the warning messages are suppressed,
8186 regardless of the setting of the command line switches.
8188 The @cite{Reason} parameter may optionally appear as the last argument
8189 in any of the forms of this pragma. It is intended purely for the
8190 purposes of documenting the reason for the @cite{Warnings} pragma.
8191 The compiler will check that the argument is a static string but
8192 otherwise ignore this argument. Other tools may provide specialized
8193 processing for this string.
8195 The form with a single argument (or two arguments if Reason present),
8196 where the first argument is @cite{ON} or @cite{OFF}
8197 may be used as a configuration pragma.
8199 If the @cite{LOCAL_NAME} parameter is present, warnings are suppressed for
8200 the specified entity.  This suppression is effective from the point where
8201 it occurs till the end of the extended scope of the variable (similar to
8202 the scope of @cite{Suppress}). This form cannot be used as a configuration
8203 pragma.
8205 In the case where the first argument is other than @cite{ON} or
8206 @cite{OFF},
8207 the third form with a single static_string_EXPRESSION argument (and possible
8208 reason) provides more precise
8209 control over which warnings are active. The string is a list of letters
8210 specifying which warnings are to be activated and which deactivated. The
8211 code for these letters is the same as the string used in the command
8212 line switch controlling warnings. For a brief summary, use the gnatmake
8213 command with no arguments, which will generate usage information containing
8214 the list of warnings switches supported. For
8215 full details see the section on @cite{Warning Message Control} in the
8216 @cite{GNAT User's Guide}.
8217 This form can also be used as a configuration pragma.
8219 The warnings controlled by the @emph{-gnatw} switch are generated by the
8220 front end of the compiler. The GCC back end can provide additional warnings
8221 and they are controlled by the @emph{-W} switch. Such warnings can be
8222 identified by the appearance of a string of the form @cite{[-Wxxx]} in the
8223 message which designates the @emph{-Wxxx} switch that controls the message.
8224 The form with a single static_string_EXPRESSION argument also works for these
8225 warnings, but the string must be a single full @emph{-Wxxx} switch in this
8226 case. The above reference lists a few examples of these additional warnings.
8228 The specified warnings will be in effect until the end of the program
8229 or another pragma Warnings is encountered. The effect of the pragma is
8230 cumulative. Initially the set of warnings is the standard default set
8231 as possibly modified by compiler switches. Then each pragma Warning
8232 modifies this set of warnings as specified. This form of the pragma may
8233 also be used as a configuration pragma.
8235 The fourth form, with an @cite{On|Off} parameter and a string, is used to
8236 control individual messages, based on their text. The string argument
8237 is a pattern that is used to match against the text of individual
8238 warning messages (not including the initial "warning: " tag).
8240 The pattern may contain asterisks, which match zero or more characters in
8241 the message. For example, you can use
8242 @cite{pragma Warnings (Off@comma{} "bits of*unused")} to suppress the warning
8243 message @cite{warning: 960 bits of "a" unused}. No other regular
8244 expression notations are permitted. All characters other than asterisk in
8245 these three specific cases are treated as literal characters in the match.
8246 The match is case insensitive, for example XYZ matches xyz.
8248 Note that the pattern matches if it occurs anywhere within the warning
8249 message string (it is not necessary to put an asterisk at the start and
8250 the end of the message, since this is implied).
8252 The above use of patterns to match the message applies only to warning
8253 messages generated by the front end. This form of the pragma with a string
8254 argument can also be used to control warnings provided by the back end and
8255 mentioned above. By using a single full @emph{-Wxxx} switch in the pragma,
8256 such warnings can be turned on and off.
8258 There are two ways to use the pragma in this form. The OFF form can be used
8259 as a configuration pragma. The effect is to suppress all warnings (if any)
8260 that match the pattern string throughout the compilation (or match the
8261 -W switch in the back end case).
8263 The second usage is to suppress a warning locally, and in this case, two
8264 pragmas must appear in sequence:
8266 @example
8267 pragma Warnings (Off, Pattern);
8268 ... code where given warning is to be suppressed
8269 pragma Warnings (On, Pattern);
8270 @end example
8272 In this usage, the pattern string must match in the Off and On
8273 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
8274 warning must be suppressed.
8276 Note: to write a string that will match any warning, use the string
8277 @cite{"***"}. It will not work to use a single asterisk or two
8278 asterisks since this looks like an operator name. This form with three
8279 asterisks is similar in effect to specifying @cite{pragma Warnings (Off)} except (if @emph{-gnatw.w} is given) that a matching
8280 @cite{pragma Warnings (On@comma{} "***")} will be required. This can be
8281 helpful in avoiding forgetting to turn warnings back on.
8283 Note: the debug flag -gnatd.i (@cite{/NOWARNINGS_PRAGMAS} in VMS) can be
8284 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
8285 be useful in checking whether obsolete pragmas in existing programs are hiding
8286 real problems.
8288 Note: pragma Warnings does not affect the processing of style messages. See
8289 separate entry for pragma Style_Checks for control of style messages.
8291 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
8292 use the version of the pragma with a @cite{TOOL_NAME} parameter.
8294 If present, @cite{TOOL_NAME} is the name of a tool, currently either @cite{GNAT} for the
8295 compiler or @cite{GNATprove} for the formal verification tool. A given tool only
8296 takes into account pragma Warnings that do not specify a tool name, or that
8297 specify the matching tool name. This makes it possible to disable warnings
8298 selectively for each tool, and as a consequence to detect useless pragma
8299 Warnings with switch @cite{-gnatw.w}.
8301 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
8302 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{e0}
8303 @section Pragma Weak_External
8306 Syntax:
8308 @example
8309 pragma Weak_External ([Entity =>] LOCAL_NAME);
8310 @end example
8312 @cite{LOCAL_NAME} must refer to an object that is declared at the library
8313 level. This pragma specifies that the given entity should be marked as a
8314 weak symbol for the linker. It is equivalent to @cite{__attribute__((weak))}
8315 in GNU C and causes @cite{LOCAL_NAME} to be emitted as a weak symbol instead
8316 of a regular symbol, that is to say a symbol that does not have to be
8317 resolved by the linker if used in conjunction with a pragma Import.
8319 When a weak symbol is not resolved by the linker, its address is set to
8320 zero. This is useful in writing interfaces to external modules that may
8321 or may not be linked in the final executable, for example depending on
8322 configuration settings.
8324 If a program references at run time an entity to which this pragma has been
8325 applied, and the corresponding symbol was not resolved at link time, then
8326 the execution of the program is erroneous. It is not erroneous to take the
8327 Address of such an entity, for example to guard potential references,
8328 as shown in the example below.
8330 Some file formats do not support weak symbols so not all target machines
8331 support this pragma.
8333 @example
8334 --  Example of the use of pragma Weak_External
8336 package External_Module is
8337   key : Integer;
8338   pragma Import (C, key);
8339   pragma Weak_External (key);
8340   function Present return boolean;
8341 end External_Module;
8343 with System; use System;
8344 package body External_Module is
8345   function Present return boolean is
8346   begin
8347     return key'Address /= System.Null_Address;
8348   end Present;
8349 end External_Module;
8350 @end example
8352 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
8353 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{e1}
8354 @section Pragma Wide_Character_Encoding
8357 Syntax:
8359 @example
8360 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
8361 @end example
8363 This pragma specifies the wide character encoding to be used in program
8364 source text appearing subsequently. It is a configuration pragma, but may
8365 also be used at any point that a pragma is allowed, and it is permissible
8366 to have more than one such pragma in a file, allowing multiple encodings
8367 to appear within the same file.
8369 The argument can be an identifier or a character literal. In the identifier
8370 case, it is one of @cite{HEX}, @cite{UPPER}, @cite{SHIFT_JIS},
8371 @cite{EUC}, @cite{UTF8}, or @cite{BRACKETS}. In the character literal
8372 case it is correspondingly one of the characters @code{h}, @code{u},
8373 @code{s}, @code{e}, @code{8}, or @code{b}.
8375 Note that when the pragma is used within a file, it affects only the
8376 encoding within that file, and does not affect withed units, specs,
8377 or subunits.
8379 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
8380 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{e2}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{e3}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{e4}
8381 @chapter Implementation Defined Aspects
8384 Ada defines (throughout the Ada 2012 reference manual, summarized
8385 in Annex K) a set of aspects that can be specified for certain entities.
8386 These language defined aspects are implemented in GNAT in Ada 2012 mode
8387 and work as described in the Ada 2012 Reference Manual.
8389 In addition, Ada 2012 allows implementations to define additional aspects
8390 whose meaning is defined by the implementation.  GNAT provides
8391 a number of these implementation-defined aspects which can be used
8392 to extend and enhance the functionality of the compiler.  This section of
8393 the GNAT reference manual describes these additional aspects.
8395 Note that any program using these aspects may not be portable to
8396 other compilers (although GNAT implements this set of aspects on all
8397 platforms).  Therefore if portability to other compilers is an important
8398 consideration, you should minimize the use of these aspects.
8400 Note that for many of these aspects, the effect is essentially similar
8401 to the use of a pragma or attribute specification with the same name
8402 applied to the entity. For example, if we write:
8404 @example
8405 type R is range 1 .. 100
8406   with Value_Size => 10;
8407 @end example
8409 then the effect is the same as:
8411 @example
8412 type R is range 1 .. 100;
8413 for R'Value_Size use 10;
8414 @end example
8416 and if we write:
8418 @example
8419 type R is new Integer
8420   with Shared => True;
8421 @end example
8423 then the effect is the same as:
8425 @example
8426 type R is new Integer;
8427 pragma Shared (R);
8428 @end example
8430 In the documentation below, such cases are simply marked
8431 as being boolean aspects equivalent to the corresponding pragma
8432 or attribute definition clause.
8434 @menu
8435 * Aspect Abstract_State:: 
8436 * Annotate:: 
8437 * Aspect Async_Readers:: 
8438 * Aspect Async_Writers:: 
8439 * Aspect Contract_Cases:: 
8440 * Aspect Depends:: 
8441 * Aspect Dimension:: 
8442 * Aspect Dimension_System:: 
8443 * Aspect Disable_Controlled:: 
8444 * Aspect Effective_Reads:: 
8445 * Aspect Effective_Writes:: 
8446 * Aspect Favor_Top_Level:: 
8447 * Aspect Global:: 
8448 * Aspect Initial_Condition:: 
8449 * Aspect Initializes:: 
8450 * Aspect Inline_Always:: 
8451 * Aspect Invariant:: 
8452 * Aspect Invariant'Class:: 
8453 * Aspect Iterable:: 
8454 * Aspect Linker_Section:: 
8455 * Aspect Lock_Free:: 
8456 * Aspect No_Elaboration_Code_All:: 
8457 * Aspect No_Tagged_Streams:: 
8458 * Aspect Object_Size:: 
8459 * Aspect Obsolescent:: 
8460 * Aspect Part_Of:: 
8461 * Aspect Persistent_BSS:: 
8462 * Aspect Predicate:: 
8463 * Aspect Pure_Function:: 
8464 * Aspect Refined_Depends:: 
8465 * Aspect Refined_Global:: 
8466 * Aspect Refined_Post:: 
8467 * Aspect Refined_State:: 
8468 * Aspect Remote_Access_Type:: 
8469 * Aspect Scalar_Storage_Order:: 
8470 * Aspect Shared:: 
8471 * Aspect Simple_Storage_Pool:: 
8472 * Aspect Simple_Storage_Pool_Type:: 
8473 * Aspect SPARK_Mode:: 
8474 * Aspect Suppress_Debug_Info:: 
8475 * Aspect Suppress_Initialization:: 
8476 * Aspect Test_Case:: 
8477 * Aspect Thread_Local_Storage:: 
8478 * Aspect Universal_Aliasing:: 
8479 * Aspect Universal_Data:: 
8480 * Aspect Unmodified:: 
8481 * Aspect Unreferenced:: 
8482 * Aspect Unreferenced_Objects:: 
8483 * Aspect Value_Size:: 
8484 * Aspect Volatile_Full_Access:: 
8485 * Aspect Warnings:: 
8487 @end menu
8489 @node Aspect Abstract_State,Annotate,,Implementation Defined Aspects
8490 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{e5}
8491 @section Aspect Abstract_State
8494 @geindex Abstract_State
8496 This aspect is equivalent to pragma @cite{Abstract_State}.
8498 @node Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
8499 @anchor{gnat_rm/implementation_defined_aspects annotate}@anchor{e6}
8500 @section Annotate
8503 @geindex Annotate
8505 There are three forms of this aspect (where ID is an identifier,
8506 and ARG is a general expression).
8509 @table @asis
8511 @item @emph{Annotate => ID}
8513 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8515 @item @emph{Annotate => (ID)}
8517 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8519 @item @emph{Annotate => (ID ,ID @{, ARG@})}
8521 Equivalent to @cite{pragma Annotate (ID@comma{} ID @{@comma{} ARG@}@comma{} Entity => Name);}
8522 @end table
8524 @node Aspect Async_Readers,Aspect Async_Writers,Annotate,Implementation Defined Aspects
8525 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{e7}
8526 @section Aspect Async_Readers
8529 @geindex Async_Readers
8531 This boolean aspect is equivalent to pragma @cite{Async_Readers}.
8533 @node Aspect Async_Writers,Aspect Contract_Cases,Aspect Async_Readers,Implementation Defined Aspects
8534 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{e8}
8535 @section Aspect Async_Writers
8538 @geindex Async_Writers
8540 This boolean aspect is equivalent to pragma @cite{Async_Writers}.
8542 @node Aspect Contract_Cases,Aspect Depends,Aspect Async_Writers,Implementation Defined Aspects
8543 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{e9}
8544 @section Aspect Contract_Cases
8547 @geindex Contract_Cases
8549 This aspect is equivalent to pragma @cite{Contract_Cases}, the sequence
8550 of clauses being enclosed in parentheses so that syntactically it is an
8551 aggregate.
8553 @node Aspect Depends,Aspect Dimension,Aspect Contract_Cases,Implementation Defined Aspects
8554 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{ea}
8555 @section Aspect Depends
8558 @geindex Depends
8560 This aspect is equivalent to pragma @cite{Depends}.
8562 @node Aspect Dimension,Aspect Dimension_System,Aspect Depends,Implementation Defined Aspects
8563 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{eb}
8564 @section Aspect Dimension
8567 @geindex Dimension
8569 The @cite{Dimension} aspect is used to specify the dimensions of a given
8570 subtype of a dimensioned numeric type. The aspect also specifies a symbol
8571 used when doing formatted output of dimensioned quantities. The syntax is:
8573 @example
8574 with Dimension =>
8575   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
8577 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
8579 DIMENSION_VALUE ::=
8580   RATIONAL
8581 | others               => RATIONAL
8582 | DISCRETE_CHOICE_LIST => RATIONAL
8584 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
8585 @end example
8587 This aspect can only be applied to a subtype whose parent type has
8588 a @cite{Dimension_Systen} aspect. The aspect must specify values for
8589 all dimensions of the system. The rational values are the powers of the
8590 corresponding dimensions that are used by the compiler to verify that
8591 physical (numeric) computations are dimensionally consistent. For example,
8592 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
8593 For further examples of the usage
8594 of this aspect, see package @cite{System.Dim.Mks}.
8595 Note that when the dimensioned type is an integer type, then any
8596 dimension value must be an integer literal.
8598 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
8599 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{ec}
8600 @section Aspect Dimension_System
8603 @geindex Dimension_System
8605 The @cite{Dimension_System} aspect is used to define a system of
8606 dimensions that will be used in subsequent subtype declarations with
8607 @cite{Dimension} aspects that reference this system. The syntax is:
8609 @example
8610 with Dimension_System => (DIMENSION @{, DIMENSION@});
8612 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
8613                [Unit_Symbol =>] SYMBOL,
8614                [Dim_Symbol  =>] SYMBOL)
8616 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
8617 @end example
8619 This aspect is applied to a type, which must be a numeric derived type
8620 (typically a floating-point type), that
8621 will represent values within the dimension system. Each @cite{DIMENSION}
8622 corresponds to one particular dimension. A maximum of 7 dimensions may
8623 be specified. @cite{Unit_Name} is the name of the dimension (for example
8624 @cite{Meter}). @cite{Unit_Symbol} is the shorthand used for quantities
8625 of this dimension (for example @cite{m} for @cite{Meter}).
8626 @cite{Dim_Symbol} gives
8627 the identification within the dimension system (typically this is a
8628 single letter, e.g. @cite{L} standing for length for unit name @cite{Meter}).
8629 The @cite{Unit_Symbol} is used in formatted output of dimensioned quantities.
8630 The @cite{Dim_Symbol} is used in error messages when numeric operations have
8631 inconsistent dimensions.
8633 GNAT provides the standard definition of the International MKS system in
8634 the run-time package @cite{System.Dim.Mks}. You can easily define
8635 similar packages for cgs units or British units, and define conversion factors
8636 between values in different systems. The MKS system is characterized by the
8637 following aspect:
8639 @example
8640 type Mks_Type is new Long_Long_Float with
8641   Dimension_System => (
8642     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
8643     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
8644     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
8645     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
8646     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
8647     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
8648     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
8649 @end example
8651 Note that in the above type definition, we use the @cite{at} symbol (@code{@@}) to
8652 represent a theta character (avoiding the use of extended Latin-1
8653 characters in this context).
8655 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
8656 Guide for detailed examples of use of the dimension system.
8658 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
8659 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{ed}
8660 @section Aspect Disable_Controlled
8663 @geindex Disable_Controlled
8665 The aspect  @cite{Disable_Controlled} is defined for controlled record types. If
8666 active, this aspect causes suppression of all related calls to @cite{Initialize},
8667 @cite{Adjust}, and @cite{Finalize}. The intended use is for conditional compilation,
8668 where for example you might want a record to be controlled or not depending on
8669 whether some run-time check is enabled or suppressed.
8671 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
8672 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{ee}
8673 @section Aspect Effective_Reads
8676 @geindex Effective_Reads
8678 This aspect is equivalent to pragma @cite{Effective_Reads}.
8680 @node Aspect Effective_Writes,Aspect Favor_Top_Level,Aspect Effective_Reads,Implementation Defined Aspects
8681 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{ef}
8682 @section Aspect Effective_Writes
8685 @geindex Effective_Writes
8687 This aspect is equivalent to pragma @cite{Effective_Writes}.
8689 @node Aspect Favor_Top_Level,Aspect Global,Aspect Effective_Writes,Implementation Defined Aspects
8690 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{f0}
8691 @section Aspect Favor_Top_Level
8694 @geindex Favor_Top_Level
8696 This boolean aspect is equivalent to pragma @cite{Favor_Top_Level}.
8698 @node Aspect Global,Aspect Initial_Condition,Aspect Favor_Top_Level,Implementation Defined Aspects
8699 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{f1}
8700 @section Aspect Global
8703 @geindex Global
8705 This aspect is equivalent to pragma @cite{Global}.
8707 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
8708 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{f2}
8709 @section Aspect Initial_Condition
8712 @geindex Initial_Condition
8714 This aspect is equivalent to pragma @cite{Initial_Condition}.
8716 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
8717 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{f3}
8718 @section Aspect Initializes
8721 @geindex Initializes
8723 This aspect is equivalent to pragma @cite{Initializes}.
8725 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
8726 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{f4}
8727 @section Aspect Inline_Always
8730 @geindex Inline_Always
8732 This boolean aspect is equivalent to pragma @cite{Inline_Always}.
8734 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
8735 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{f5}
8736 @section Aspect Invariant
8739 @geindex Invariant
8741 This aspect is equivalent to pragma @cite{Invariant}. It is a
8742 synonym for the language defined aspect @cite{Type_Invariant} except
8743 that it is separately controllable using pragma @cite{Assertion_Policy}.
8745 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
8746 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{f6}
8747 @section Aspect Invariant'Class
8750 @geindex Invariant'Class
8752 This aspect is equivalent to pragma @cite{Type_Invariant_Class}. It is a
8753 synonym for the language defined aspect @cite{Type_Invariant'Class} except
8754 that it is separately controllable using pragma @cite{Assertion_Policy}.
8756 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
8757 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{f7}
8758 @section Aspect Iterable
8761 @geindex Iterable
8763 This aspect provides a light-weight mechanism for loops and quantified
8764 expressions over container types, without the overhead imposed by the tampering
8765 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
8766 with four named components: @cite{First}, @cite{Next}, @cite{Has_Element}, and @cite{Element} (the
8767 last one being optional). When only 3 components are specified, only the
8768 @cite{for .. in} form of iteration over cursors is available. When all 4 components
8769 are specified, both this form and the @cite{for .. of} form of iteration over
8770 elements are available. The following is a typical example of use:
8772 @example
8773 type List is private with
8774     Iterable => (First        => First_Cursor,
8775                  Next         => Advance,
8776                  Has_Element  => Cursor_Has_Element,
8777                 [Element      => Get_Element]);
8778 @end example
8781 @itemize *
8783 @item 
8784 The value denoted by @cite{First} must denote a primitive operation of the
8785 container type that returns a @cite{Cursor}, which must a be a type declared in
8786 the container package or visible from it. For example:
8787 @end itemize
8789 @example
8790 function First_Cursor (Cont : Container) return Cursor;
8791 @end example
8794 @itemize *
8796 @item 
8797 The value of @cite{Next} is a primitive operation of the container type that takes
8798 both a container and a cursor and yields a cursor. For example:
8799 @end itemize
8801 @example
8802 function Advance (Cont : Container; Position : Cursor) return Cursor;
8803 @end example
8806 @itemize *
8808 @item 
8809 The value of @cite{Has_Element} is a primitive operation of the container type
8810 that takes both a container and a cursor and yields a boolean. For example:
8811 @end itemize
8813 @example
8814 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
8815 @end example
8818 @itemize *
8820 @item 
8821 The value of @cite{Element} is a primitive operation of the container type that
8822 takes both a container and a cursor and yields an @cite{Element_Type}, which must
8823 be a type declared in the container package or visible from it. For example:
8824 @end itemize
8826 @example
8827 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
8828 @end example
8830 This aspect is used in the GNAT-defined formal container packages.
8832 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
8833 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{f8}
8834 @section Aspect Linker_Section
8837 @geindex Linker_Section
8839 This aspect is equivalent to an @cite{Linker_Section} pragma.
8841 @node Aspect Lock_Free,Aspect No_Elaboration_Code_All,Aspect Linker_Section,Implementation Defined Aspects
8842 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{f9}
8843 @section Aspect Lock_Free
8846 @geindex Lock_Free
8848 This boolean aspect is equivalent to pragma @cite{Lock_Free}.
8850 @node Aspect No_Elaboration_Code_All,Aspect No_Tagged_Streams,Aspect Lock_Free,Implementation Defined Aspects
8851 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{fa}
8852 @section Aspect No_Elaboration_Code_All
8855 @geindex No_Elaboration_Code_All
8857 This aspect is equivalent to a @cite{pragma No_Elaboration_Code_All}
8858 statement for a program unit.
8860 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
8861 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{fb}
8862 @section Aspect No_Tagged_Streams
8865 @geindex No_Tagged_Streams
8867 This aspect is equivalent to a @cite{pragma No_Tagged_Streams} with an
8868 argument specifying a root tagged type (thus this aspect can only be
8869 applied to such a type).
8871 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
8872 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{fc}
8873 @section Aspect Object_Size
8876 @geindex Object_Size
8878 This aspect is equivalent to an @cite{Object_Size} attribute definition
8879 clause.
8881 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
8882 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{fd}
8883 @section Aspect Obsolescent
8886 @geindex Obsolsecent
8888 This aspect is equivalent to an @cite{Obsolescent} pragma. Note that the
8889 evaluation of this aspect happens at the point of occurrence, it is not
8890 delayed until the freeze point.
8892 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
8893 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{fe}
8894 @section Aspect Part_Of
8897 @geindex Part_Of
8899 This aspect is equivalent to pragma @cite{Part_Of}.
8901 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
8902 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{ff}
8903 @section Aspect Persistent_BSS
8906 @geindex Persistent_BSS
8908 This boolean aspect is equivalent to pragma @cite{Persistent_BSS}.
8910 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
8911 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{100}
8912 @section Aspect Predicate
8915 @geindex Predicate
8917 This aspect is equivalent to pragma @cite{Predicate}. It is thus
8918 similar to the language defined aspects @cite{Dynamic_Predicate}
8919 and @cite{Static_Predicate} except that whether the resulting
8920 predicate is static or dynamic is controlled by the form of the
8921 expression. It is also separately controllable using pragma
8922 @cite{Assertion_Policy}.
8924 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
8925 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{101}
8926 @section Aspect Pure_Function
8929 @geindex Pure_Function
8931 This boolean aspect is equivalent to pragma @cite{Pure_Function}.
8933 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
8934 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{102}
8935 @section Aspect Refined_Depends
8938 @geindex Refined_Depends
8940 This aspect is equivalent to pragma @cite{Refined_Depends}.
8942 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
8943 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{103}
8944 @section Aspect Refined_Global
8947 @geindex Refined_Global
8949 This aspect is equivalent to pragma @cite{Refined_Global}.
8951 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
8952 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{104}
8953 @section Aspect Refined_Post
8956 @geindex Refined_Post
8958 This aspect is equivalent to pragma @cite{Refined_Post}.
8960 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
8961 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{105}
8962 @section Aspect Refined_State
8965 @geindex Refined_State
8967 This aspect is equivalent to pragma @cite{Refined_State}.
8969 @node Aspect Remote_Access_Type,Aspect Scalar_Storage_Order,Aspect Refined_State,Implementation Defined Aspects
8970 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{106}
8971 @section Aspect Remote_Access_Type
8974 @geindex Remote_Access_Type
8976 This aspect is equivalent to pragma @cite{Remote_Access_Type}.
8978 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Remote_Access_Type,Implementation Defined Aspects
8979 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{107}
8980 @section Aspect Scalar_Storage_Order
8983 @geindex Scalar_Storage_Order
8985 This aspect is equivalent to a @cite{Scalar_Storage_Order}
8986 attribute definition clause.
8988 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
8989 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{108}
8990 @section Aspect Shared
8993 @geindex Shared
8995 This boolean aspect is equivalent to pragma @cite{Shared},
8996 and is thus a synonym for aspect @cite{Atomic}.
8998 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
8999 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{109}
9000 @section Aspect Simple_Storage_Pool
9003 @geindex Simple_Storage_Pool
9005 This aspect is equivalent to a @cite{Simple_Storage_Pool}
9006 attribute definition clause.
9008 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9009 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{10a}
9010 @section Aspect Simple_Storage_Pool_Type
9013 @geindex Simple_Storage_Pool_Type
9015 This boolean aspect is equivalent to pragma @cite{Simple_Storage_Pool_Type}.
9017 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9018 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{10b}
9019 @section Aspect SPARK_Mode
9022 @geindex SPARK_Mode
9024 This aspect is equivalent to pragma @cite{SPARK_Mode} and
9025 may be specified for either or both of the specification and body
9026 of a subprogram or package.
9028 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9029 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{10c}
9030 @section Aspect Suppress_Debug_Info
9033 @geindex Suppress_Debug_Info
9035 This boolean aspect is equivalent to pragma @cite{Suppress_Debug_Info}.
9037 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9038 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{10d}
9039 @section Aspect Suppress_Initialization
9042 @geindex Suppress_Initialization
9044 This boolean aspect is equivalent to pragma @cite{Suppress_Initialization}.
9046 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9047 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{10e}
9048 @section Aspect Test_Case
9051 @geindex Test_Case
9053 This aspect is equivalent to pragma @cite{Test_Case}.
9055 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9056 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{10f}
9057 @section Aspect Thread_Local_Storage
9060 @geindex Thread_Local_Storage
9062 This boolean aspect is equivalent to pragma @cite{Thread_Local_Storage}.
9064 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
9065 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{110}
9066 @section Aspect Universal_Aliasing
9069 @geindex Universal_Aliasing
9071 This boolean aspect is equivalent to pragma @cite{Universal_Aliasing}.
9073 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
9074 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{111}
9075 @section Aspect Universal_Data
9078 @geindex Universal_Data
9080 This aspect is equivalent to pragma @cite{Universal_Data}.
9082 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
9083 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{112}
9084 @section Aspect Unmodified
9087 @geindex Unmodified
9089 This boolean aspect is equivalent to pragma @cite{Unmodified}.
9091 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9092 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{113}
9093 @section Aspect Unreferenced
9096 @geindex Unreferenced
9098 This boolean aspect is equivalent to pragma @cite{Unreferenced}. Note that
9099 in the case of formal parameters, it is not permitted to have aspects for
9100 a formal parameter, so in this case the pragma form must be used.
9102 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9103 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{114}
9104 @section Aspect Unreferenced_Objects
9107 @geindex Unreferenced_Objects
9109 This boolean aspect is equivalent to pragma @cite{Unreferenced_Objects}.
9111 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
9112 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{115}
9113 @section Aspect Value_Size
9116 @geindex Value_Size
9118 This aspect is equivalent to a @cite{Value_Size}
9119 attribute definition clause.
9121 @node Aspect Volatile_Full_Access,Aspect Warnings,Aspect Value_Size,Implementation Defined Aspects
9122 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{116}
9123 @section Aspect Volatile_Full_Access
9126 @geindex Volatile_Full_Access
9128 This boolean aspect is equivalent to pragma @cite{Volatile_Full_Access}.
9130 @node Aspect Warnings,,Aspect Volatile_Full_Access,Implementation Defined Aspects
9131 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{117}
9132 @section Aspect Warnings
9135 @geindex Warnings
9137 This aspect is equivalent to the two argument form of pragma @cite{Warnings},
9138 where the first argument is @cite{ON} or @cite{OFF} and the second argument
9139 is the entity.
9141 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9142 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{118}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{119}
9143 @chapter Implementation Defined Attributes
9146 Ada defines (throughout the Ada reference manual,
9147 summarized in Annex K),
9148 a set of attributes that provide useful additional functionality in all
9149 areas of the language.  These language defined attributes are implemented
9150 in GNAT and work as described in the Ada Reference Manual.
9152 In addition, Ada allows implementations to define additional
9153 attributes whose meaning is defined by the implementation.  GNAT provides
9154 a number of these implementation-dependent attributes which can be used
9155 to extend and enhance the functionality of the compiler.  This section of
9156 the GNAT reference manual describes these additional attributes.  It also
9157 describes additional implementation-dependent features of standard
9158 language-defined attributes.
9160 Note that any program using these attributes may not be portable to
9161 other compilers (although GNAT implements this set of attributes on all
9162 platforms).  Therefore if portability to other compilers is an important
9163 consideration, you should minimize the use of these attributes.
9165 @menu
9166 * Attribute Abort_Signal:: 
9167 * Attribute Address_Size:: 
9168 * Attribute Asm_Input:: 
9169 * Attribute Asm_Output:: 
9170 * Attribute Atomic_Always_Lock_Free:: 
9171 * Attribute Bit:: 
9172 * Attribute Bit_Position:: 
9173 * Attribute Code_Address:: 
9174 * Attribute Compiler_Version:: 
9175 * Attribute Constrained:: 
9176 * Attribute Default_Bit_Order:: 
9177 * Attribute Default_Scalar_Storage_Order:: 
9178 * Attribute Deref:: 
9179 * Attribute Descriptor_Size:: 
9180 * Attribute Elaborated:: 
9181 * Attribute Elab_Body:: 
9182 * Attribute Elab_Spec:: 
9183 * Attribute Elab_Subp_Body:: 
9184 * Attribute Emax:: 
9185 * Attribute Enabled:: 
9186 * Attribute Enum_Rep:: 
9187 * Attribute Enum_Val:: 
9188 * Attribute Epsilon:: 
9189 * Attribute Fast_Math:: 
9190 * Attribute Fixed_Value:: 
9191 * Attribute From_Any:: 
9192 * Attribute Has_Access_Values:: 
9193 * Attribute Has_Discriminants:: 
9194 * Attribute Img:: 
9195 * Attribute Integer_Value:: 
9196 * Attribute Invalid_Value:: 
9197 * Attribute Iterable:: 
9198 * Attribute Large:: 
9199 * Attribute Library_Level:: 
9200 * Attribute Lock_Free:: 
9201 * Attribute Loop_Entry:: 
9202 * Attribute Machine_Size:: 
9203 * Attribute Mantissa:: 
9204 * Attribute Maximum_Alignment:: 
9205 * Attribute Mechanism_Code:: 
9206 * Attribute Null_Parameter:: 
9207 * Attribute Object_Size:: 
9208 * Attribute Old:: 
9209 * Attribute Passed_By_Reference:: 
9210 * Attribute Pool_Address:: 
9211 * Attribute Range_Length:: 
9212 * Attribute Restriction_Set:: 
9213 * Attribute Result:: 
9214 * Attribute Safe_Emax:: 
9215 * Attribute Safe_Large:: 
9216 * Attribute Safe_Small:: 
9217 * Attribute Scalar_Storage_Order:: 
9218 * Attribute Simple_Storage_Pool:: 
9219 * Attribute Small:: 
9220 * Attribute Storage_Unit:: 
9221 * Attribute Stub_Type:: 
9222 * Attribute System_Allocator_Alignment:: 
9223 * Attribute Target_Name:: 
9224 * Attribute To_Address:: 
9225 * Attribute To_Any:: 
9226 * Attribute Type_Class:: 
9227 * Attribute Type_Key:: 
9228 * Attribute TypeCode:: 
9229 * Attribute UET_Address:: 
9230 * Attribute Unconstrained_Array:: 
9231 * Attribute Universal_Literal_String:: 
9232 * Attribute Unrestricted_Access:: 
9233 * Attribute Update:: 
9234 * Attribute Valid_Scalars:: 
9235 * Attribute VADS_Size:: 
9236 * Attribute Value_Size:: 
9237 * Attribute Wchar_T_Size:: 
9238 * Attribute Word_Size:: 
9240 @end menu
9242 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
9243 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{11a}
9244 @section Attribute Abort_Signal
9247 @geindex Abort_Signal
9249 @cite{Standard'Abort_Signal} (@cite{Standard} is the only allowed
9250 prefix) provides the entity for the special exception used to signal
9251 task abort or asynchronous transfer of control.  Normally this attribute
9252 should only be used in the tasking runtime (it is highly peculiar, and
9253 completely outside the normal semantics of Ada, for a user program to
9254 intercept the abort exception).
9256 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
9257 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{11b}
9258 @section Attribute Address_Size
9261 @geindex Size of `Address`
9263 @geindex Address_Size
9265 @cite{Standard'Address_Size} (@cite{Standard} is the only allowed
9266 prefix) is a static constant giving the number of bits in an
9267 @cite{Address}. It is the same value as System.Address'Size,
9268 but has the advantage of being static, while a direct
9269 reference to System.Address'Size is non-static because Address
9270 is a private type.
9272 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
9273 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{11c}
9274 @section Attribute Asm_Input
9277 @geindex Asm_Input
9279 The @cite{Asm_Input} attribute denotes a function that takes two
9280 parameters.  The first is a string, the second is an expression of the
9281 type designated by the prefix.  The first (string) argument is required
9282 to be a static expression, and is the constraint for the parameter,
9283 (e.g., what kind of register is required).  The second argument is the
9284 value to be used as the input argument.  The possible values for the
9285 constant are the same as those used in the RTL, and are dependent on
9286 the configuration file used to built the GCC back end.
9287 @ref{11d,,Machine Code Insertions}
9289 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
9290 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{11e}
9291 @section Attribute Asm_Output
9294 @geindex Asm_Output
9296 The @cite{Asm_Output} attribute denotes a function that takes two
9297 parameters.  The first is a string, the second is the name of a variable
9298 of the type designated by the attribute prefix.  The first (string)
9299 argument is required to be a static expression and designates the
9300 constraint for the parameter (e.g., what kind of register is
9301 required).  The second argument is the variable to be updated with the
9302 result.  The possible values for constraint are the same as those used in
9303 the RTL, and are dependent on the configuration file used to build the
9304 GCC back end.  If there are no output operands, then this argument may
9305 either be omitted, or explicitly given as @cite{No_Output_Operands}.
9306 @ref{11d,,Machine Code Insertions}
9308 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
9309 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{11f}
9310 @section Attribute Atomic_Always_Lock_Free
9313 @geindex Atomic_Always_Lock_Free
9315 The prefix of the @cite{Atomic_Always_Lock_Free} attribute is a type.
9316 The result is a Boolean value which is True if the type has discriminants,
9317 and False otherwise.  The result indicate whether atomic operations are
9318 supported by the target for the given type.
9320 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
9321 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{120}
9322 @section Attribute Bit
9325 @geindex Bit
9327 @code{obj'Bit}, where @cite{obj} is any object, yields the bit
9328 offset within the storage unit (byte) that contains the first bit of
9329 storage allocated for the object.  The value of this attribute is of the
9330 type @cite{Universal_Integer}, and is always a non-negative number not
9331 exceeding the value of @cite{System.Storage_Unit}.
9333 For an object that is a variable or a constant allocated in a register,
9334 the value is zero.  (The use of this attribute does not force the
9335 allocation of a variable to memory).
9337 For an object that is a formal parameter, this attribute applies
9338 to either the matching actual parameter or to a copy of the
9339 matching actual parameter.
9341 For an access object the value is zero.  Note that
9342 @code{obj.all'Bit} is subject to an @cite{Access_Check} for the
9343 designated object.  Similarly for a record component
9344 @code{X.C'Bit} is subject to a discriminant check and
9345 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
9346 are subject to index checks.
9348 This attribute is designed to be compatible with the DEC Ada 83 definition
9349 and implementation of the @cite{Bit} attribute.
9351 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
9352 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{121}
9353 @section Attribute Bit_Position
9356 @geindex Bit_Position
9358 @code{R.C'Bit_Position}, where @cite{R} is a record object and @cite{C} is one
9359 of the fields of the record type, yields the bit
9360 offset within the record contains the first bit of
9361 storage allocated for the object.  The value of this attribute is of the
9362 type @cite{Universal_Integer}.  The value depends only on the field
9363 @cite{C} and is independent of the alignment of
9364 the containing record @cite{R}.
9366 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
9367 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{122}
9368 @section Attribute Code_Address
9371 @geindex Code_Address
9373 @geindex Subprogram address
9375 @geindex Address of subprogram code
9377 The @cite{'Address}
9378 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
9379 intended effect seems to be to provide
9380 an address value which can be used to call the subprogram by means of
9381 an address clause as in the following example:
9383 @example
9384 procedure K is ...
9386 procedure L;
9387 for L'Address use K'Address;
9388 pragma Import (Ada, L);
9389 @end example
9391 A call to @cite{L} is then expected to result in a call to @cite{K}.
9392 In Ada 83, where there were no access-to-subprogram values, this was
9393 a common work-around for getting the effect of an indirect call.
9394 GNAT implements the above use of @cite{Address} and the technique
9395 illustrated by the example code works correctly.
9397 However, for some purposes, it is useful to have the address of the start
9398 of the generated code for the subprogram.  On some architectures, this is
9399 not necessarily the same as the @cite{Address} value described above.
9400 For example, the @cite{Address} value may reference a subprogram
9401 descriptor rather than the subprogram itself.
9403 The @cite{'Code_Address} attribute, which can only be applied to
9404 subprogram entities, always returns the address of the start of the
9405 generated code of the specified subprogram, which may or may not be
9406 the same value as is returned by the corresponding @cite{'Address}
9407 attribute.
9409 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
9410 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{123}
9411 @section Attribute Compiler_Version
9414 @geindex Compiler_Version
9416 @cite{Standard'Compiler_Version} (@cite{Standard} is the only allowed
9417 prefix) yields a static string identifying the version of the compiler
9418 being used to compile the unit containing the attribute reference.
9420 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
9421 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{124}
9422 @section Attribute Constrained
9425 @geindex Constrained
9427 In addition to the usage of this attribute in the Ada RM, @cite{GNAT}
9428 also permits the use of the @cite{'Constrained} attribute
9429 in a generic template
9430 for any type, including types without discriminants. The value of this
9431 attribute in the generic instance when applied to a scalar type or a
9432 record type without discriminants is always @cite{True}. This usage is
9433 compatible with older Ada compilers, including notably DEC Ada.
9435 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
9436 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{125}
9437 @section Attribute Default_Bit_Order
9440 @geindex Big endian
9442 @geindex Little endian
9444 @geindex Default_Bit_Order
9446 @cite{Standard'Default_Bit_Order} (@cite{Standard} is the only
9447 permissible prefix), provides the value @cite{System.Default_Bit_Order}
9448 as a @cite{Pos} value (0 for @cite{High_Order_First}, 1 for
9449 @cite{Low_Order_First}).  This is used to construct the definition of
9450 @cite{Default_Bit_Order} in package @cite{System}.
9452 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
9453 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{126}
9454 @section Attribute Default_Scalar_Storage_Order
9457 @geindex Big endian
9459 @geindex Little endian
9461 @geindex Default_Scalar_Storage_Order
9463 @cite{Standard'Default_Scalar_Storage_Order} (@cite{Standard} is the only
9464 permissible prefix), provides the current value of the default scalar storage
9465 order (as specified using pragma @cite{Default_Scalar_Storage_Order}, or
9466 equal to @cite{Default_Bit_Order} if unspecified) as a
9467 @cite{System.Bit_Order} value. This is a static attribute.
9469 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
9470 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{127}
9471 @section Attribute Deref
9474 @geindex Deref
9476 The attribute @cite{typ'Deref(expr)} where @cite{expr} is of type @cite{System.Address} yields
9477 the variable of type @cite{typ} that is located at the given address. It is similar
9478 to @cite{(totyp (expr).all)}, where @cite{totyp} is an unchecked conversion from address to
9479 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
9480 used on the left side of an assignment.
9482 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
9483 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{128}
9484 @section Attribute Descriptor_Size
9487 @geindex Descriptor
9489 @geindex Dope vector
9491 @geindex Descriptor_Size
9493 Non-static attribute @cite{Descriptor_Size} returns the size in bits of the
9494 descriptor allocated for a type.  The result is non-zero only for unconstrained
9495 array types and the returned value is of type universal integer.  In GNAT, an
9496 array descriptor contains bounds information and is located immediately before
9497 the first element of the array.
9499 @example
9500 type Unconstr_Array is array (Positive range <>) of Boolean;
9501 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
9502 @end example
9504 The attribute takes into account any additional padding due to type alignment.
9505 In the example above, the descriptor contains two values of type
9506 @cite{Positive} representing the low and high bound.  Since @cite{Positive} has
9507 a size of 31 bits and an alignment of 4, the descriptor size is @cite{2 * Positive'Size + 2} or 64 bits.
9509 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
9510 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{129}
9511 @section Attribute Elaborated
9514 @geindex Elaborated
9516 The prefix of the @cite{'Elaborated} attribute must be a unit name.  The
9517 value is a Boolean which indicates whether or not the given unit has been
9518 elaborated.  This attribute is primarily intended for internal use by the
9519 generated code for dynamic elaboration checking, but it can also be used
9520 in user programs.  The value will always be True once elaboration of all
9521 units has been completed.  An exception is for units which need no
9522 elaboration, the value is always False for such units.
9524 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
9525 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{12a}
9526 @section Attribute Elab_Body
9529 @geindex Elab_Body
9531 This attribute can only be applied to a program unit name.  It returns
9532 the entity for the corresponding elaboration procedure for elaborating
9533 the body of the referenced unit.  This is used in the main generated
9534 elaboration procedure by the binder and is not normally used in any
9535 other context.  However, there may be specialized situations in which it
9536 is useful to be able to call this elaboration procedure from Ada code,
9537 e.g., if it is necessary to do selective re-elaboration to fix some
9538 error.
9540 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
9541 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{12b}
9542 @section Attribute Elab_Spec
9545 @geindex Elab_Spec
9547 This attribute can only be applied to a program unit name.  It returns
9548 the entity for the corresponding elaboration procedure for elaborating
9549 the spec of the referenced unit.  This is used in the main
9550 generated elaboration procedure by the binder and is not normally used
9551 in any other context.  However, there may be specialized situations in
9552 which it is useful to be able to call this elaboration procedure from
9553 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
9554 some error.
9556 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
9557 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{12c}
9558 @section Attribute Elab_Subp_Body
9561 @geindex Elab_Subp_Body
9563 This attribute can only be applied to a library level subprogram
9564 name and is only allowed in CodePeer mode. It returns the entity
9565 for the corresponding elaboration procedure for elaborating the body
9566 of the referenced subprogram unit. This is used in the main generated
9567 elaboration procedure by the binder in CodePeer mode only and is unrecognized
9568 otherwise.
9570 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
9571 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{12d}
9572 @section Attribute Emax
9575 @geindex Ada 83 attributes
9577 @geindex Emax
9579 The @cite{Emax} 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 Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
9584 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{12e}
9585 @section Attribute Enabled
9588 @geindex Enabled
9590 The @cite{Enabled} attribute allows an application program to check at compile
9591 time to see if the designated check is currently enabled. The prefix is a
9592 simple identifier, referencing any predefined check name (other than
9593 @cite{All_Checks}) or a check name introduced by pragma Check_Name. If
9594 no argument is given for the attribute, the check is for the general state
9595 of the check, if an argument is given, then it is an entity name, and the
9596 check indicates whether an @cite{Suppress} or @cite{Unsuppress} has been
9597 given naming the entity (if not, then the argument is ignored).
9599 Note that instantiations inherit the check status at the point of the
9600 instantiation, so a useful idiom is to have a library package that
9601 introduces a check name with @cite{pragma Check_Name}, and then contains
9602 generic packages or subprograms which use the @cite{Enabled} attribute
9603 to see if the check is enabled. A user of this package can then issue
9604 a @cite{pragma Suppress} or @cite{pragma Unsuppress} before instantiating
9605 the package or subprogram, controlling whether the check will be present.
9607 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
9608 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{12f}
9609 @section Attribute Enum_Rep
9612 @geindex Representation of enums
9614 @geindex Enum_Rep
9616 For every enumeration subtype @cite{S}, @code{S'Enum_Rep} denotes a
9617 function with the following spec:
9619 @example
9620 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
9621 @end example
9623 It is also allowable to apply @cite{Enum_Rep} directly to an object of an
9624 enumeration type or to a non-overloaded enumeration
9625 literal.  In this case @code{S'Enum_Rep} is equivalent to
9626 @code{typ'Enum_Rep(S)} where @cite{typ} is the type of the
9627 enumeration literal or object.
9629 The function returns the representation value for the given enumeration
9630 value.  This will be equal to value of the @cite{Pos} attribute in the
9631 absence of an enumeration representation clause.  This is a static
9632 attribute (i.e.,:the result is static if the argument is static).
9634 @code{S'Enum_Rep} can also be used with integer types and objects,
9635 in which case it simply returns the integer value.  The reason for this
9636 is to allow it to be used for @cite{(<>)} discrete formal arguments in
9637 a generic unit that can be instantiated with either enumeration types
9638 or integer types.  Note that if @cite{Enum_Rep} is used on a modular
9639 type whose upper bound exceeds the upper bound of the largest signed
9640 integer type, and the argument is a variable, so that the universal
9641 integer calculation is done at run time, then the call to @cite{Enum_Rep}
9642 may raise @cite{Constraint_Error}.
9644 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
9645 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{130}
9646 @section Attribute Enum_Val
9649 @geindex Representation of enums
9651 @geindex Enum_Val
9653 For every enumeration subtype @cite{S}, @code{S'Enum_Val} denotes a
9654 function with the following spec:
9656 @example
9657 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
9658 @end example
9660 The function returns the enumeration value whose representation matches the
9661 argument, or raises Constraint_Error if no enumeration literal of the type
9662 has the matching value.
9663 This will be equal to value of the @cite{Val} attribute in the
9664 absence of an enumeration representation clause.  This is a static
9665 attribute (i.e., the result is static if the argument is static).
9667 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
9668 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{131}
9669 @section Attribute Epsilon
9672 @geindex Ada 83 attributes
9674 @geindex Epsilon
9676 The @cite{Epsilon} attribute is provided for compatibility with Ada 83.  See
9677 the Ada 83 reference manual for an exact description of the semantics of
9678 this attribute.
9680 @node Attribute Fast_Math,Attribute Fixed_Value,Attribute Epsilon,Implementation Defined Attributes
9681 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{132}
9682 @section Attribute Fast_Math
9685 @geindex Fast_Math
9687 @cite{Standard'Fast_Math} (@cite{Standard} is the only allowed
9688 prefix) yields a static Boolean value that is True if pragma
9689 @cite{Fast_Math} is active, and False otherwise.
9691 @node Attribute Fixed_Value,Attribute From_Any,Attribute Fast_Math,Implementation Defined Attributes
9692 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{133}
9693 @section Attribute Fixed_Value
9696 @geindex Fixed_Value
9698 For every fixed-point type @cite{S}, @code{S'Fixed_Value} denotes a
9699 function with the following specification:
9701 @example
9702 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
9703 @end example
9705 The value returned is the fixed-point value @cite{V} such that:
9707 @example
9708 V = Arg * S'Small
9709 @end example
9711 The effect is thus similar to first converting the argument to the
9712 integer type used to represent @cite{S}, and then doing an unchecked
9713 conversion to the fixed-point type.  The difference is
9714 that there are full range checks, to ensure that the result is in range.
9715 This attribute is primarily intended for use in implementation of the
9716 input-output functions for fixed-point values.
9718 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
9719 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{134}
9720 @section Attribute From_Any
9723 @geindex From_Any
9725 This internal attribute is used for the generation of remote subprogram
9726 stubs in the context of the Distributed Systems Annex.
9728 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
9729 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{135}
9730 @section Attribute Has_Access_Values
9733 @geindex Access values
9734 @geindex testing for
9736 @geindex Has_Access_Values
9738 The prefix of the @cite{Has_Access_Values} attribute is a type.  The result
9739 is a Boolean value which is True if the is an access type, or is a composite
9740 type with a component (at any nesting depth) that is an access type, and is
9741 False otherwise.
9742 The intended use of this attribute is in conjunction with generic
9743 definitions.  If the attribute is applied to a generic private type, it
9744 indicates whether or not the corresponding actual type has access values.
9746 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
9747 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{136}
9748 @section Attribute Has_Discriminants
9751 @geindex Discriminants
9752 @geindex testing for
9754 @geindex Has_Discriminants
9756 The prefix of the @cite{Has_Discriminants} attribute is a type.  The result
9757 is a Boolean value which is True if the type has discriminants, and False
9758 otherwise.  The intended use of this attribute is in conjunction with generic
9759 definitions.  If the attribute is applied to a generic private type, it
9760 indicates whether or not the corresponding actual type has discriminants.
9762 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
9763 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{137}
9764 @section Attribute Img
9767 @geindex Img
9769 The @cite{Img} attribute differs from @cite{Image} in that it is applied
9770 directly to an object, and yields the same result as
9771 @cite{Image} for the subtype of the object.  This is convenient for
9772 debugging:
9774 @example
9775 Put_Line ("X = " & X'Img);
9776 @end example
9778 has the same meaning as the more verbose:
9780 @example
9781 Put_Line ("X = " & T'Image (X));
9782 @end example
9784 where @cite{T} is the (sub)type of the object @cite{X}.
9786 Note that technically, in analogy to @cite{Image},
9787 @cite{X'Img} returns a parameterless function
9788 that returns the appropriate string when called. This means that
9789 @cite{X'Img} can be renamed as a function-returning-string, or used
9790 in an instantiation as a function parameter.
9792 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
9793 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{138}
9794 @section Attribute Integer_Value
9797 @geindex Integer_Value
9799 For every integer type @cite{S}, @code{S'Integer_Value} denotes a
9800 function with the following spec:
9802 @example
9803 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
9804 @end example
9806 The value returned is the integer value @cite{V}, such that:
9808 @example
9809 Arg = V * T'Small
9810 @end example
9812 where @cite{T} is the type of @cite{Arg}.
9813 The effect is thus similar to first doing an unchecked conversion from
9814 the fixed-point type to its corresponding implementation type, and then
9815 converting the result to the target integer type.  The difference is
9816 that there are full range checks, to ensure that the result is in range.
9817 This attribute is primarily intended for use in implementation of the
9818 standard input-output functions for fixed-point values.
9820 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
9821 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{139}
9822 @section Attribute Invalid_Value
9825 @geindex Invalid_Value
9827 For every scalar type S, S'Invalid_Value returns an undefined value of the
9828 type. If possible this value is an invalid representation for the type. The
9829 value returned is identical to the value used to initialize an otherwise
9830 uninitialized value of the type if pragma Initialize_Scalars is used,
9831 including the ability to modify the value with the binder -Sxx flag and
9832 relevant environment variables at run time.
9834 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
9835 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{13a}
9836 @section Attribute Iterable
9839 @geindex Iterable
9841 Equivalent to Aspect Iterable.
9843 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
9844 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{13b}
9845 @section Attribute Large
9848 @geindex Ada 83 attributes
9850 @geindex Large
9852 The @cite{Large} attribute is provided for compatibility with Ada 83.  See
9853 the Ada 83 reference manual for an exact description of the semantics of
9854 this attribute.
9856 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
9857 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{13c}
9858 @section Attribute Library_Level
9861 @geindex Library_Level
9863 @cite{P'Library_Level}, where P is an entity name,
9864 returns a Boolean value which is True if the entity is declared
9865 at the library level, and False otherwise. Note that within a
9866 generic instantition, the name of the generic unit denotes the
9867 instance, which means that this attribute can be used to test
9868 if a generic is instantiated at the library level, as shown
9869 in this example:
9871 @example
9872 generic
9873   ...
9874 package Gen is
9875   pragma Compile_Time_Error
9876     (not Gen'Library_Level,
9877      "Gen can only be instantiated at library level");
9878   ...
9879 end Gen;
9880 @end example
9882 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
9883 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{13d}
9884 @section Attribute Lock_Free
9887 @geindex Lock_Free
9889 @cite{P'Lock_Free}, where P is a protected object, returns True if a
9890 pragma @cite{Lock_Free} applies to P.
9892 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
9893 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{13e}
9894 @section Attribute Loop_Entry
9897 @geindex Loop_Entry
9899 Syntax:
9901 @example
9902 X'Loop_Entry [(loop_name)]
9903 @end example
9905 The @cite{Loop_Entry} attribute is used to refer to the value that an
9906 expression had upon entry to a given loop in much the same way that the
9907 @cite{Old} attribute in a subprogram postcondition can be used to refer
9908 to the value an expression had upon entry to the subprogram. The
9909 relevant loop is either identified by the given loop name, or it is the
9910 innermost enclosing loop when no loop name is given.
9912 A @cite{Loop_Entry} attribute can only occur within a
9913 @cite{Loop_Variant} or @cite{Loop_Invariant} pragma. A common use of
9914 @cite{Loop_Entry} is to compare the current value of objects with their
9915 initial value at loop entry, in a @cite{Loop_Invariant} pragma.
9917 The effect of using @cite{X'Loop_Entry} is the same as declaring
9918 a constant initialized with the initial value of @cite{X} at loop
9919 entry. This copy is not performed if the loop is not entered, or if the
9920 corresponding pragmas are ignored or disabled.
9922 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
9923 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{13f}
9924 @section Attribute Machine_Size
9927 @geindex Machine_Size
9929 This attribute is identical to the @cite{Object_Size} attribute.  It is
9930 provided for compatibility with the DEC Ada 83 attribute of this name.
9932 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
9933 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{140}
9934 @section Attribute Mantissa
9937 @geindex Ada 83 attributes
9939 @geindex Mantissa
9941 The @cite{Mantissa} attribute is provided for compatibility with Ada 83.  See
9942 the Ada 83 reference manual for an exact description of the semantics of
9943 this attribute.
9945 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
9946 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{141}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{142}
9947 @section Attribute Maximum_Alignment
9950 @geindex Alignment
9951 @geindex maximum
9953 @geindex Maximum_Alignment
9955 @cite{Standard'Maximum_Alignment} (@cite{Standard} is the only
9956 permissible prefix) provides the maximum useful alignment value for the
9957 target.  This is a static value that can be used to specify the alignment
9958 for an object, guaranteeing that it is properly aligned in all
9959 cases.
9961 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
9962 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{143}
9963 @section Attribute Mechanism_Code
9966 @geindex Return values
9967 @geindex passing mechanism
9969 @geindex Parameters
9970 @geindex passing mechanism
9972 @geindex Mechanism_Code
9974 @code{function'Mechanism_Code} yields an integer code for the
9975 mechanism used for the result of function, and
9976 @code{subprogram'Mechanism_Code (n)} yields the mechanism
9977 used for formal parameter number @cite{n} (a static integer value with 1
9978 meaning the first parameter) of @cite{subprogram}.  The code returned is:
9981 @table @asis
9983 @item @emph{1}
9985 by copy (value)
9987 @item @emph{2}
9989 by reference
9990 @end table
9992 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
9993 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{144}
9994 @section Attribute Null_Parameter
9997 @geindex Zero address
9998 @geindex passing
10000 @geindex Null_Parameter
10002 A reference @code{T'Null_Parameter} denotes an imaginary object of
10003 type or subtype @cite{T} allocated at machine address zero.  The attribute
10004 is allowed only as the default expression of a formal parameter, or as
10005 an actual expression of a subprogram call.  In either case, the
10006 subprogram must be imported.
10008 The identity of the object is represented by the address zero in the
10009 argument list, independent of the passing mechanism (explicit or
10010 default).
10012 This capability is needed to specify that a zero address should be
10013 passed for a record or other composite object passed by reference.
10014 There is no way of indicating this without the @cite{Null_Parameter}
10015 attribute.
10017 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10018 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{145}
10019 @section Attribute Object_Size
10022 @geindex Size
10023 @geindex used for objects
10025 @geindex Object_Size
10027 The size of an object is not necessarily the same as the size of the type
10028 of an object.  This is because by default object sizes are increased to be
10029 a multiple of the alignment of the object.  For example,
10030 @cite{Natural'Size} is
10031 31, but by default objects of type @cite{Natural} will have a size of 32 bits.
10032 Similarly, a record containing an integer and a character:
10034 @example
10035 type Rec is record
10036    I : Integer;
10037    C : Character;
10038 end record;
10039 @end example
10041 will have a size of 40 (that is @cite{Rec'Size} will be 40).  The
10042 alignment will be 4, because of the
10043 integer field, and so the default size of record objects for this type
10044 will be 64 (8 bytes).
10046 If the alignment of the above record is specified to be 1, then the
10047 object size will be 40 (5 bytes). This is true by default, and also
10048 an object size of 40 can be explicitly specified in this case.
10050 A consequence of this capability is that different object sizes can be
10051 given to subtypes that would otherwise be considered in Ada to be
10052 statically matching.  But it makes no sense to consider such subtypes
10053 as statically matching.  Consequently, in @cite{GNAT} we add a rule
10054 to the static matching rules that requires object sizes to match.
10055 Consider this example:
10057 @example
10058  1. procedure BadAVConvert is
10059  2.    type R is new Integer;
10060  3.    subtype R1 is R range 1 .. 10;
10061  4.    subtype R2 is R range 1 .. 10;
10062  5.    for R1'Object_Size use 8;
10063  6.    for R2'Object_Size use 16;
10064  7.    type R1P is access all R1;
10065  8.    type R2P is access all R2;
10066  9.    R1PV : R1P := new R1'(4);
10067 10.    R2PV : R2P;
10068 11. begin
10069 12.    R2PV := R2P (R1PV);
10070                |
10071        >>> target designated subtype not compatible with
10072            type "R1" defined at line 3
10074 13. end;
10075 @end example
10077 In the absence of lines 5 and 6,
10078 types @cite{R1} and @cite{R2} statically match and
10079 hence the conversion on line 12 is legal. But since lines 5 and 6
10080 cause the object sizes to differ, @cite{GNAT} considers that types
10081 @cite{R1} and @cite{R2} are not statically matching, and line 12
10082 generates the diagnostic shown above.
10084 Similar additional checks are performed in other contexts requiring
10085 statically matching subtypes.
10087 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
10088 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{146}
10089 @section Attribute Old
10092 @geindex Old
10094 In addition to the usage of @cite{Old} defined in the Ada 2012 RM (usage
10095 within @cite{Post} aspect), GNAT also permits the use of this attribute
10096 in implementation defined pragmas @cite{Postcondition},
10097 @cite{Contract_Cases} and @cite{Test_Case}. Also usages of
10098 @cite{Old} which would be illegal according to the Ada 2012 RM
10099 definition are allowed under control of
10100 implementation defined pragma @cite{Unevaluated_Use_Of_Old}.
10102 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
10103 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{147}
10104 @section Attribute Passed_By_Reference
10107 @geindex Parameters
10108 @geindex when passed by reference
10110 @geindex Passed_By_Reference
10112 @code{type'Passed_By_Reference} for any subtype @cite{type} returns
10113 a value of type @cite{Boolean} value that is @cite{True} if the type is
10114 normally passed by reference and @cite{False} if the type is normally
10115 passed by copy in calls.  For scalar types, the result is always @cite{False}
10116 and is static.  For non-scalar types, the result is non-static.
10118 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
10119 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{148}
10120 @section Attribute Pool_Address
10123 @geindex Parameters
10124 @geindex when passed by reference
10126 @geindex Pool_Address
10128 @code{X'Pool_Address} for any object @cite{X} returns the address
10129 of X within its storage pool. This is the same as
10130 @code{X'Address}, except that for an unconstrained array whose
10131 bounds are allocated just before the first component,
10132 @code{X'Pool_Address} returns the address of those bounds,
10133 whereas @code{X'Address} returns the address of the first
10134 component.
10136 Here, we are interpreting 'storage pool' broadly to mean
10137 @code{wherever the object is allocated}, which could be a
10138 user-defined storage pool,
10139 the global heap, on the stack, or in a static memory area.
10140 For an object created by @cite{new}, @code{Ptr.all'Pool_Address} is
10141 what is passed to @cite{Allocate} and returned from @cite{Deallocate}.
10143 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
10144 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{149}
10145 @section Attribute Range_Length
10148 @geindex Range_Length
10150 @code{type'Range_Length} for any discrete type @cite{type} yields
10151 the number of values represented by the subtype (zero for a null
10152 range).  The result is static for static subtypes.  @cite{Range_Length}
10153 applied to the index subtype of a one dimensional array always gives the
10154 same result as @cite{Length} applied to the array itself.
10156 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
10157 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{14a}
10158 @section Attribute Restriction_Set
10161 @geindex Restriction_Set
10163 @geindex Restrictions
10165 This attribute allows compile time testing of restrictions that
10166 are currently in effect. It is primarily intended for specializing
10167 code in the run-time based on restrictions that are active (e.g.
10168 don't need to save fpt registers if restriction No_Floating_Point
10169 is known to be in effect), but can be used anywhere.
10171 There are two forms:
10173 @example
10174 System'Restriction_Set (partition_boolean_restriction_NAME)
10175 System'Restriction_Set (No_Dependence => library_unit_NAME);
10176 @end example
10178 In the case of the first form, the only restriction names
10179 allowed are parameterless restrictions that are checked
10180 for consistency at bind time. For a complete list see the
10181 subtype @cite{System.Rident.Partition_Boolean_Restrictions}.
10183 The result returned is True if the restriction is known to
10184 be in effect, and False if the restriction is known not to
10185 be in effect. An important guarantee is that the value of
10186 a Restriction_Set attribute is known to be consistent throughout
10187 all the code of a partition.
10189 This is trivially achieved if the entire partition is compiled
10190 with a consistent set of restriction pragmas. However, the
10191 compilation model does not require this. It is possible to
10192 compile one set of units with one set of pragmas, and another
10193 set of units with another set of pragmas. It is even possible
10194 to compile a spec with one set of pragmas, and then WITH the
10195 same spec with a different set of pragmas. Inconsistencies
10196 in the actual use of the restriction are checked at bind time.
10198 In order to achieve the guarantee of consistency for the
10199 Restriction_Set pragma, we consider that a use of the pragma
10200 that yields False is equivalent to a violation of the
10201 restriction.
10203 So for example if you write
10205 @example
10206 if System'Restriction_Set (No_Floating_Point) then
10207    ...
10208 else
10209    ...
10210 end if;
10211 @end example
10213 And the result is False, so that the else branch is executed,
10214 you can assume that this restriction is not set for any unit
10215 in the partition. This is checked by considering this use of
10216 the restriction pragma to be a violation of the restriction
10217 No_Floating_Point. This means that no other unit can attempt
10218 to set this restriction (if some unit does attempt to set it,
10219 the binder will refuse to bind the partition).
10221 Technical note: The restriction name and the unit name are
10222 intepreted entirely syntactically, as in the corresponding
10223 Restrictions pragma, they are not analyzed semantically,
10224 so they do not have a type.
10226 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
10227 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{14b}
10228 @section Attribute Result
10231 @geindex Result
10233 @code{function'Result} can only be used with in a Postcondition pragma
10234 for a function. The prefix must be the name of the corresponding function. This
10235 is used to refer to the result of the function in the postcondition expression.
10236 For a further discussion of the use of this attribute and examples of its use,
10237 see the description of pragma Postcondition.
10239 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
10240 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{14c}
10241 @section Attribute Safe_Emax
10244 @geindex Ada 83 attributes
10246 @geindex Safe_Emax
10248 The @cite{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
10249 the Ada 83 reference manual for an exact description of the semantics of
10250 this attribute.
10252 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
10253 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{14d}
10254 @section Attribute Safe_Large
10257 @geindex Ada 83 attributes
10259 @geindex Safe_Large
10261 The @cite{Safe_Large} attribute is provided for compatibility with Ada 83.  See
10262 the Ada 83 reference manual for an exact description of the semantics of
10263 this attribute.
10265 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
10266 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{14e}
10267 @section Attribute Safe_Small
10270 @geindex Ada 83 attributes
10272 @geindex Safe_Small
10274 The @cite{Safe_Small} attribute is provided for compatibility with Ada 83.  See
10275 the Ada 83 reference manual for an exact description of the semantics of
10276 this attribute.
10278 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
10279 @anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{14f}
10280 @section Attribute Scalar_Storage_Order
10283 @geindex Endianness
10285 @geindex Scalar storage order
10287 @geindex Scalar_Storage_Order
10289 For every array or record type @cite{S}, the representation attribute
10290 @cite{Scalar_Storage_Order} denotes the order in which storage elements
10291 that make up scalar components are ordered within S. The value given must
10292 be a static expression of type System.Bit_Order. The following is an example
10293 of the use of this feature:
10295 @example
10296 --  Component type definitions
10298 subtype Yr_Type is Natural range 0 .. 127;
10299 subtype Mo_Type is Natural range 1 .. 12;
10300 subtype Da_Type is Natural range 1 .. 31;
10302 --  Record declaration
10304 type Date is record
10305    Years_Since_1980 : Yr_Type;
10306    Month            : Mo_Type;
10307    Day_Of_Month     : Da_Type;
10308 end record;
10310 --  Record representation clause
10312 for Date use record
10313    Years_Since_1980 at 0 range 0  ..  6;
10314    Month            at 0 range 7  .. 10;
10315    Day_Of_Month     at 0 range 11 .. 15;
10316 end record;
10318 --  Attribute definition clauses
10320 for Date'Bit_Order use System.High_Order_First;
10321 for Date'Scalar_Storage_Order use System.High_Order_First;
10322 --  If Scalar_Storage_Order is specified, it must be consistent with
10323 --  Bit_Order, so it's best to always define the latter explicitly if
10324 --  the former is used.
10325 @end example
10327 Other properties are as for standard representation attribute @cite{Bit_Order},
10328 as defined by Ada RM 13.5.3(4). The default is @cite{System.Default_Bit_Order}.
10330 For a record type @cite{T}, if @code{T'Scalar_Storage_Order} is
10331 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
10332 this means that if a @cite{Scalar_Storage_Order} attribute definition
10333 clause is not confirming, then the type's @cite{Bit_Order} shall be
10334 specified explicitly and set to the same value.
10336 Derived types inherit an explicitly set scalar storage order from their parent
10337 types. This may be overridden for the derived type by giving an explicit scalar
10338 storage order for the derived type. For a record extension, the derived type
10339 must have the same scalar storage order as the parent type.
10341 If a component of @cite{T} is of a record or array type, then that type must
10342 also have a @cite{Scalar_Storage_Order} attribute definition clause.
10344 A component of a record or array type that is a packed array, or that
10345 does not start on a byte boundary, must have the same scalar storage order
10346 as the enclosing record or array type.
10348 No component of a type that has an explicit @cite{Scalar_Storage_Order}
10349 attribute definition may be aliased.
10351 A confirming @cite{Scalar_Storage_Order} attribute definition clause (i.e.
10352 with a value equal to @cite{System.Default_Bit_Order}) has no effect.
10354 If the opposite storage order is specified, then whenever the value of
10355 a scalar component of an object of type @cite{S} is read, the storage
10356 elements of the enclosing machine scalar are first reversed (before
10357 retrieving the component value, possibly applying some shift and mask
10358 operatings on the enclosing machine scalar), and the opposite operation
10359 is done for writes.
10361 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
10362 are relaxed. Instead, the following rules apply:
10365 @itemize *
10367 @item 
10368 the underlying storage elements are those at positions
10369 @cite{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
10371 @item 
10372 the sequence of underlying storage elements shall have
10373 a size no greater than the largest machine scalar
10375 @item 
10376 the enclosing machine scalar is defined as the smallest machine
10377 scalar starting at a position no greater than
10378 @cite{position + first_bit / storage_element_size} and covering
10379 storage elements at least up to @cite{position + (last_bit + storage_element_size - 1) / storage_element_size}
10381 @item 
10382 the position of the component is interpreted relative to that machine
10383 scalar.
10384 @end itemize
10386 If no scalar storage order is specified for a type (either directly, or by
10387 inheritance in the case of a derived type), then the default is normally
10388 the native ordering of the target, but this default can be overridden using
10389 pragma @cite{Default_Scalar_Storage_Order}.
10391 Note that the scalar storage order only affects the in-memory data
10392 representation. It has no effect on the representation used by stream
10393 attributes.
10395 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
10396 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{b7}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{150}
10397 @section Attribute Simple_Storage_Pool
10400 @geindex Storage pool
10401 @geindex simple
10403 @geindex Simple storage pool
10405 @geindex Simple_Storage_Pool
10407 For every nonformal, nonderived access-to-object type @cite{Acc}, the
10408 representation attribute @cite{Simple_Storage_Pool} may be specified
10409 via an attribute_definition_clause (or by specifying the equivalent aspect):
10411 @example
10412 My_Pool : My_Simple_Storage_Pool_Type;
10414 type Acc is access My_Data_Type;
10416 for Acc'Simple_Storage_Pool use My_Pool;
10417 @end example
10419 The name given in an attribute_definition_clause for the
10420 @cite{Simple_Storage_Pool} attribute shall denote a variable of
10421 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
10423 The use of this attribute is only allowed for a prefix denoting a type
10424 for which it has been specified. The type of the attribute is the type
10425 of the variable specified as the simple storage pool of the access type,
10426 and the attribute denotes that variable.
10428 It is illegal to specify both @cite{Storage_Pool} and @cite{Simple_Storage_Pool}
10429 for the same access type.
10431 If the @cite{Simple_Storage_Pool} attribute has been specified for an access
10432 type, then applying the @cite{Storage_Pool} attribute to the type is flagged
10433 with a warning and its evaluation raises the exception @cite{Program_Error}.
10435 If the Simple_Storage_Pool attribute has been specified for an access
10436 type @cite{S}, then the evaluation of the attribute @code{S'Storage_Size}
10437 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
10438 which is intended to indicate the number of storage elements reserved for
10439 the simple storage pool. If the Storage_Size function has not been defined
10440 for the simple storage pool type, then this attribute returns zero.
10442 If an access type @cite{S} has a specified simple storage pool of type
10443 @cite{SSP}, then the evaluation of an allocator for that access type calls
10444 the primitive @cite{Allocate} procedure for type @cite{SSP}, passing
10445 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
10446 semantics of such allocators is the same as those defined for allocators
10447 in section 13.11 of the @cite{Ada Reference Manual}, with the term
10448 @cite{simple storage pool} substituted for @cite{storage pool}.
10450 If an access type @cite{S} has a specified simple storage pool of type
10451 @cite{SSP}, then a call to an instance of the @cite{Ada.Unchecked_Deallocation}
10452 for that access type invokes the primitive @cite{Deallocate} procedure
10453 for type @cite{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
10454 parameter. The detailed semantics of such unchecked deallocations is the same
10455 as defined in section 13.11.2 of the Ada Reference Manual, except that the
10456 term 'simple storage pool' is substituted for 'storage pool'.
10458 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
10459 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{151}
10460 @section Attribute Small
10463 @geindex Ada 83 attributes
10465 @geindex Small
10467 The @cite{Small} attribute is defined in Ada 95 (and Ada 2005) only for
10468 fixed-point types.
10469 GNAT also allows this attribute to be applied to floating-point types
10470 for compatibility with Ada 83.  See
10471 the Ada 83 reference manual for an exact description of the semantics of
10472 this attribute when applied to floating-point types.
10474 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
10475 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{152}
10476 @section Attribute Storage_Unit
10479 @geindex Storage_Unit
10481 @cite{Standard'Storage_Unit} (@cite{Standard} is the only permissible
10482 prefix) provides the same value as @cite{System.Storage_Unit}.
10484 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
10485 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{153}
10486 @section Attribute Stub_Type
10489 @geindex Stub_Type
10491 The GNAT implementation of remote access-to-classwide types is
10492 organized as described in AARM section E.4 (20.t): a value of an RACW type
10493 (designating a remote object) is represented as a normal access
10494 value, pointing to a "stub" object which in turn contains the
10495 necessary information to contact the designated remote object. A
10496 call on any dispatching operation of such a stub object does the
10497 remote call, if necessary, using the information in the stub object
10498 to locate the target partition, etc.
10500 For a prefix @cite{T} that denotes a remote access-to-classwide type,
10501 @cite{T'Stub_Type} denotes the type of the corresponding stub objects.
10503 By construction, the layout of @cite{T'Stub_Type} is identical to that of
10504 type @cite{RACW_Stub_Type} declared in the internal implementation-defined
10505 unit @cite{System.Partition_Interface}. Use of this attribute will create
10506 an implicit dependency on this unit.
10508 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
10509 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{154}
10510 @section Attribute System_Allocator_Alignment
10513 @geindex Alignment
10514 @geindex allocator
10516 @geindex System_Allocator_Alignment
10518 @cite{Standard'System_Allocator_Alignment} (@cite{Standard} is the only
10519 permissible prefix) provides the observable guaranted to be honored by
10520 the system allocator (malloc). This is a static value that can be used
10521 in user storage pools based on malloc either to reject allocation
10522 with alignment too large or to enable a realignment circuitry if the
10523 alignment request is larger than this value.
10525 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
10526 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{155}
10527 @section Attribute Target_Name
10530 @geindex Target_Name
10532 @cite{Standard'Target_Name} (@cite{Standard} is the only permissible
10533 prefix) provides a static string value that identifies the target
10534 for the current compilation. For GCC implementations, this is the
10535 standard gcc target name without the terminating slash (for
10536 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
10538 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
10539 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{156}
10540 @section Attribute To_Address
10543 @geindex To_Address
10545 The @cite{System'To_Address}
10546 (@cite{System} is the only permissible prefix)
10547 denotes a function identical to
10548 @cite{System.Storage_Elements.To_Address} except that
10549 it is a static attribute.  This means that if its argument is
10550 a static expression, then the result of the attribute is a
10551 static expression.  This means that such an expression can be
10552 used in contexts (e.g., preelaborable packages) which require a
10553 static expression and where the function call could not be used
10554 (since the function call is always non-static, even if its
10555 argument is static). The argument must be in the range
10556 -(2**(m-1) .. 2**m-1, where m is the memory size
10557 (typically 32 or 64). Negative values are intepreted in a
10558 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
10559 a 32 bits machine).
10561 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
10562 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{157}
10563 @section Attribute To_Any
10566 @geindex To_Any
10568 This internal attribute is used for the generation of remote subprogram
10569 stubs in the context of the Distributed Systems Annex.
10571 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
10572 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{158}
10573 @section Attribute Type_Class
10576 @geindex Type_Class
10578 @code{type'Type_Class} for any type or subtype @cite{type} yields
10579 the value of the type class for the full type of @cite{type}.  If
10580 @cite{type} is a generic formal type, the value is the value for the
10581 corresponding actual subtype.  The value of this attribute is of type
10582 @code{System.Aux_DEC.Type_Class}, which has the following definition:
10584 @example
10585 type Type_Class is
10586   (Type_Class_Enumeration,
10587    Type_Class_Integer,
10588    Type_Class_Fixed_Point,
10589    Type_Class_Floating_Point,
10590    Type_Class_Array,
10591    Type_Class_Record,
10592    Type_Class_Access,
10593    Type_Class_Task,
10594    Type_Class_Address);
10595 @end example
10597 Protected types yield the value @cite{Type_Class_Task}, which thus
10598 applies to all concurrent types.  This attribute is designed to
10599 be compatible with the DEC Ada 83 attribute of the same name.
10601 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
10602 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{159}
10603 @section Attribute Type_Key
10606 @geindex Type_Key
10608 The @cite{Type_Key} attribute is applicable to a type or subtype and
10609 yields a value of type Standard.String containing encoded information
10610 about the type or subtype. This provides improved compatibility with
10611 other implementations that support this attribute.
10613 @node Attribute TypeCode,Attribute UET_Address,Attribute Type_Key,Implementation Defined Attributes
10614 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{15a}
10615 @section Attribute TypeCode
10618 @geindex TypeCode
10620 This internal attribute is used for the generation of remote subprogram
10621 stubs in the context of the Distributed Systems Annex.
10623 @node Attribute UET_Address,Attribute Unconstrained_Array,Attribute TypeCode,Implementation Defined Attributes
10624 @anchor{gnat_rm/implementation_defined_attributes attribute-uet-address}@anchor{15b}
10625 @section Attribute UET_Address
10628 @geindex UET_Address
10630 The @cite{UET_Address} attribute can only be used for a prefix which
10631 denotes a library package.  It yields the address of the unit exception
10632 table when zero cost exception handling is used.  This attribute is
10633 intended only for use within the GNAT implementation.  See the unit
10634 @cite{Ada.Exceptions} in files @code{a-except.ads} and @code{a-except.adb}
10635 for details on how this attribute is used in the implementation.
10637 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute UET_Address,Implementation Defined Attributes
10638 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{15c}
10639 @section Attribute Unconstrained_Array
10642 @geindex Unconstrained_Array
10644 The @cite{Unconstrained_Array} attribute can be used with a prefix that
10645 denotes any type or subtype. It is a static attribute that yields
10646 @cite{True} if the prefix designates an unconstrained array,
10647 and @cite{False} otherwise. In a generic instance, the result is
10648 still static, and yields the result of applying this test to the
10649 generic actual.
10651 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
10652 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{15d}
10653 @section Attribute Universal_Literal_String
10656 @geindex Named numbers
10657 @geindex representation of
10659 @geindex Universal_Literal_String
10661 The prefix of @cite{Universal_Literal_String} must be a named
10662 number.  The static result is the string consisting of the characters of
10663 the number as defined in the original source.  This allows the user
10664 program to access the actual text of named numbers without intermediate
10665 conversions and without the need to enclose the strings in quotes (which
10666 would preclude their use as numbers).
10668 For example, the following program prints the first 50 digits of pi:
10670 @example
10671 with Text_IO; use Text_IO;
10672 with Ada.Numerics;
10673 procedure Pi is
10674 begin
10675    Put (Ada.Numerics.Pi'Universal_Literal_String);
10676 end;
10677 @end example
10679 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
10680 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{15e}
10681 @section Attribute Unrestricted_Access
10684 @geindex Access
10685 @geindex unrestricted
10687 @geindex Unrestricted_Access
10689 The @cite{Unrestricted_Access} attribute is similar to @cite{Access}
10690 except that all accessibility and aliased view checks are omitted.  This
10691 is a user-beware attribute.
10693 For objects, it is similar to @cite{Address}, for which it is a
10694 desirable replacement where the value desired is an access type.
10695 In other words, its effect is similar to first applying the
10696 @cite{Address} attribute and then doing an unchecked conversion to a
10697 desired access type.
10699 For subprograms, @cite{P'Unrestricted_Access} may be used where
10700 @cite{P'Access} would be illegal, to construct a value of a
10701 less-nested named access type that designates a more-nested
10702 subprogram. This value may be used in indirect calls, so long as the
10703 more-nested subprogram still exists; once the subprogram containing it
10704 has returned, such calls are erroneous. For example:
10706 @example
10707 package body P is
10709    type Less_Nested is not null access procedure;
10710    Global : Less_Nested;
10712    procedure P1 is
10713    begin
10714       Global.all;
10715    end P1;
10717    procedure P2 is
10718       Local_Var : Integer;
10720       procedure More_Nested is
10721       begin
10722          ... Local_Var ...
10723       end More_Nested;
10724    begin
10725       Global := More_Nested'Unrestricted_Access;
10726       P1;
10727    end P2;
10729 end P;
10730 @end example
10732 When P1 is called from P2, the call via Global is OK, but if P1 were
10733 called after P2 returns, it would be an erroneous use of a dangling
10734 pointer.
10736 For objects, it is possible to use @cite{Unrestricted_Access} for any
10737 type. However, if the result is of an access-to-unconstrained array
10738 subtype, then the resulting pointer has the same scope as the context
10739 of the attribute, and must not be returned to some enclosing scope.
10740 For instance, if a function uses @cite{Unrestricted_Access} to create
10741 an access-to-unconstrained-array and returns that value to the caller,
10742 the result will involve dangling pointers. In addition, it is only
10743 valid to create pointers to unconstrained arrays using this attribute
10744 if the pointer has the normal default 'fat' representation where a
10745 pointer has two components, one points to the array and one points to
10746 the bounds. If a size clause is used to force 'thin' representation
10747 for a pointer to unconstrained where there is only space for a single
10748 pointer, then the resulting pointer is not usable.
10750 In the simple case where a direct use of Unrestricted_Access attempts
10751 to make a thin pointer for a non-aliased object, the compiler will
10752 reject the use as illegal, as shown in the following example:
10754 @example
10755 with System; use System;
10756 procedure SliceUA2 is
10757    type A is access all String;
10758    for A'Size use Standard'Address_Size;
10760    procedure P (Arg : A) is
10761    begin
10762       null;
10763    end P;
10765    X : String := "hello world!";
10766    X2 : aliased String := "hello world!";
10768    AV : A := X'Unrestricted_Access;    -- ERROR
10769              |
10770 >>> illegal use of Unrestricted_Access attribute
10771 >>> attempt to generate thin pointer to unaliased object
10773 begin
10774    P (X'Unrestricted_Access);          -- ERROR
10775       |
10776 >>> illegal use of Unrestricted_Access attribute
10777 >>> attempt to generate thin pointer to unaliased object
10779    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
10780       |
10781 >>> illegal use of Unrestricted_Access attribute
10782 >>> attempt to generate thin pointer to unaliased object
10784    P (X2'Unrestricted_Access);         -- OK
10785 end;
10786 @end example
10788 but other cases cannot be detected by the compiler, and are
10789 considered to be erroneous. Consider the following example:
10791 @example
10792 with System; use System;
10793 with System; use System;
10794 procedure SliceUA is
10795    type AF is access all String;
10797    type A is access all String;
10798    for A'Size use Standard'Address_Size;
10800    procedure P (Arg : A) is
10801    begin
10802       if Arg'Length /= 6 then
10803          raise Program_Error;
10804       end if;
10805    end P;
10807    X : String := "hello world!";
10808    Y : AF := X (7 .. 12)'Unrestricted_Access;
10810 begin
10811    P (A (Y));
10812 end;
10813 @end example
10815 A normal unconstrained array value
10816 or a constrained array object marked as aliased has the bounds in memory
10817 just before the array, so a thin pointer can retrieve both the data and
10818 the bounds.  But in this case, the non-aliased object @cite{X} does not have the
10819 bounds before the string.  If the size clause for type @cite{A}
10820 were not present, then the pointer
10821 would be a fat pointer, where one component is a pointer to the bounds,
10822 and all would be well.  But with the size clause present, the conversion from
10823 fat pointer to thin pointer in the call loses the bounds, and so this
10824 is erroneous, and the program likely raises a @cite{Program_Error} exception.
10826 In general, it is advisable to completely
10827 avoid mixing the use of thin pointers and the use of
10828 @cite{Unrestricted_Access} where the designated type is an
10829 unconstrained array.  The use of thin pointers should be restricted to
10830 cases of porting legacy code that implicitly assumes the size of pointers,
10831 and such code should not in any case be using this attribute.
10833 Another erroneous situation arises if the attribute is
10834 applied to a constant. The resulting pointer can be used to access the
10835 constant, but the effect of trying to modify a constant in this manner
10836 is not well-defined. Consider this example:
10838 @example
10839 P : constant Integer := 4;
10840 type R is access all Integer;
10841 RV : R := P'Unrestricted_Access;
10843 RV.all := 3;
10844 @end example
10846 Here we attempt to modify the constant P from 4 to 3, but the compiler may
10847 or may not notice this attempt, and subsequent references to P may yield
10848 either the value 3 or the value 4 or the assignment may blow up if the
10849 compiler decides to put P in read-only memory. One particular case where
10850 @cite{Unrestricted_Access} can be used in this way is to modify the
10851 value of an @cite{IN} parameter:
10853 @example
10854 procedure K (S : in String) is
10855    type R is access all Character;
10856    RV : R := S (3)'Unrestricted_Access;
10857 begin
10858    RV.all := 'a';
10859 end;
10860 @end example
10862 In general this is a risky approach. It may appear to "work" but such uses of
10863 @cite{Unrestricted_Access} are potentially non-portable, even from one version
10864 of @cite{GNAT} to another, so are best avoided if possible.
10866 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
10867 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{15f}
10868 @section Attribute Update
10871 @geindex Update
10873 The @cite{Update} attribute creates a copy of an array or record value
10874 with one or more modified components. The syntax is:
10876 @example
10877 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
10878 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
10879 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
10880                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
10882 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
10883 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
10884 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
10885 @end example
10887 where @cite{PREFIX} is the name of an array or record object, the
10888 association list in parentheses does not contain an @cite{others}
10889 choice and the box symbol @cite{<>} may not appear in any
10890 expression. The effect is to yield a copy of the array or record value
10891 which is unchanged apart from the components mentioned in the
10892 association list, which are changed to the indicated value. The
10893 original value of the array or record value is not affected. For
10894 example:
10896 @example
10897 type Arr is Array (1 .. 5) of Integer;
10899 Avar1 : Arr := (1,2,3,4,5);
10900 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
10901 @end example
10903 yields a value for @cite{Avar2} of 1,10,20,20,5 with @cite{Avar1}
10904 begin unmodified. Similarly:
10906 @example
10907 type Rec is A, B, C : Integer;
10909 Rvar1 : Rec := (A => 1, B => 2, C => 3);
10910 Rvar2 : Rec := Rvar1'Update (B => 20);
10911 @end example
10913 yields a value for @cite{Rvar2} of (A => 1, B => 20, C => 3),
10914 with @cite{Rvar1} being unmodifed.
10915 Note that the value of the attribute reference is computed
10916 completely before it is used. This means that if you write:
10918 @example
10919 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
10920 @end example
10922 then the value of @cite{Avar1} is not modified if @cite{Function_Call}
10923 raises an exception, unlike the effect of a series of direct assignments
10924 to elements of @cite{Avar1}. In general this requires that
10925 two extra complete copies of the object are required, which should be
10926 kept in mind when considering efficiency.
10928 The @cite{Update} attribute cannot be applied to prefixes of a limited
10929 type, and cannot reference discriminants in the case of a record type.
10930 The accessibility level of an Update attribute result object is defined
10931 as for an aggregate.
10933 In the record case, no component can be mentioned more than once. In
10934 the array case, two overlapping ranges can appear in the association list,
10935 in which case the modifications are processed left to right.
10937 Multi-dimensional arrays can be modified, as shown by this example:
10939 @example
10940 A : array (1 .. 10, 1 .. 10) of Integer;
10942 A := A'Update ((1, 2) => 20, (3, 4) => 30);
10943 @end example
10945 which changes element (1,2) to 20 and (3,4) to 30.
10947 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
10948 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{160}
10949 @section Attribute Valid_Scalars
10952 @geindex Valid_Scalars
10954 The @cite{'Valid_Scalars} attribute is intended to make it easier to
10955 check the validity of scalar subcomponents of composite objects. It
10956 is defined for any prefix @cite{X} that denotes an object.
10957 The value of this attribute is of the predefined type Boolean.
10958 @cite{X'Valid_Scalars} yields True if and only if evaluation of
10959 @cite{P'Valid} yields True for every scalar part P of X or if X has
10960 no scalar parts. It is not specified in what order the scalar parts
10961 are checked, nor whether any more are checked after any one of them
10962 is determined to be invalid. If the prefix @cite{X} is of a class-wide
10963 type @cite{T'Class} (where @cite{T} is the associated specific type),
10964 or if the prefix @cite{X} is of a specific tagged type @cite{T}, then
10965 only the scalar parts of components of @cite{T} are traversed; in other
10966 words, components of extensions of @cite{T} are not traversed even if
10967 @cite{T'Class (X)'Tag /= T'Tag} . The compiler will issue a warning if it can
10968 be determined at compile time that the prefix of the attribute has no
10969 scalar parts (e.g., if the prefix is of an access type, an interface type,
10970 an undiscriminated task type, or an undiscriminated protected type).
10972 For scalar types, @cite{Valid_Scalars} is equivalent to @cite{Valid}. The use
10973 of this attribute is not permitted for @cite{Unchecked_Union} types for which
10974 in general it is not possible to determine the values of the discriminants.
10976 Note: @cite{Valid_Scalars} can generate a lot of code, especially in the case
10977 of a large variant record. If the attribute is called in many places in the
10978 same program applied to objects of the same type, it can reduce program size
10979 to write a function with a single use of the attribute, and then call that
10980 function from multiple places.
10982 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
10983 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{161}
10984 @section Attribute VADS_Size
10987 @geindex Size
10988 @geindex VADS compatibility
10990 @geindex VADS_Size
10992 The @cite{'VADS_Size} attribute is intended to make it easier to port
10993 legacy code which relies on the semantics of @cite{'Size} as implemented
10994 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
10995 same semantic interpretation.  In particular, @cite{'VADS_Size} applied
10996 to a predefined or other primitive type with no Size clause yields the
10997 Object_Size (for example, @cite{Natural'Size} is 32 rather than 31 on
10998 typical machines).  In addition @cite{'VADS_Size} applied to an object
10999 gives the result that would be obtained by applying the attribute to
11000 the corresponding type.
11002 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11003 @anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{162}
11004 @section Attribute Value_Size
11007 @geindex Size
11008 @geindex setting for not-first subtype
11010 @geindex Value_Size
11012 @code{type'Value_Size} is the number of bits required to represent
11013 a value of the given subtype.  It is the same as @code{type'Size},
11014 but, unlike @cite{Size}, may be set for non-first subtypes.
11016 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11017 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{163}
11018 @section Attribute Wchar_T_Size
11021 @geindex Wchar_T_Size
11023 @cite{Standard'Wchar_T_Size} (@cite{Standard} is the only permissible
11024 prefix) provides the size in bits of the C @cite{wchar_t} type
11025 primarily for constructing the definition of this type in
11026 package @cite{Interfaces.C}. The result is a static constant.
11028 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
11029 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{164}
11030 @section Attribute Word_Size
11033 @geindex Word_Size
11035 @cite{Standard'Word_Size} (@cite{Standard} is the only permissible
11036 prefix) provides the value @cite{System.Word_Size}. The result is
11037 a static constant.
11039 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
11040 @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{165}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{166}
11041 @chapter Standard and Implementation Defined Restrictions
11044 All Ada Reference Manual-defined Restriction identifiers are implemented:
11047 @itemize *
11049 @item 
11050 language-defined restrictions (see 13.12.1)
11052 @item 
11053 tasking restrictions (see D.7)
11055 @item 
11056 high integrity restrictions (see H.4)
11057 @end itemize
11059 GNAT implements additional restriction identifiers. All restrictions, whether
11060 language defined or GNAT-specific, are listed in the following.
11062 @menu
11063 * Partition-Wide Restrictions:: 
11064 * Program Unit Level Restrictions:: 
11066 @end menu
11068 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
11069 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{167}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{168}
11070 @section Partition-Wide Restrictions
11073 There are two separate lists of restriction identifiers. The first
11074 set requires consistency throughout a partition (in other words, if the
11075 restriction identifier is used for any compilation unit in the partition,
11076 then all compilation units in the partition must obey the restriction).
11078 @menu
11079 * Immediate_Reclamation:: 
11080 * Max_Asynchronous_Select_Nesting:: 
11081 * Max_Entry_Queue_Length:: 
11082 * Max_Protected_Entries:: 
11083 * Max_Select_Alternatives:: 
11084 * Max_Storage_At_Blocking:: 
11085 * Max_Task_Entries:: 
11086 * Max_Tasks:: 
11087 * No_Abort_Statements:: 
11088 * No_Access_Parameter_Allocators:: 
11089 * No_Access_Subprograms:: 
11090 * No_Allocators:: 
11091 * No_Anonymous_Allocators:: 
11092 * No_Calendar:: 
11093 * No_Coextensions:: 
11094 * No_Default_Initialization:: 
11095 * No_Delay:: 
11096 * No_Dependence:: 
11097 * No_Direct_Boolean_Operators:: 
11098 * No_Dispatch:: 
11099 * No_Dispatching_Calls:: 
11100 * No_Dynamic_Attachment:: 
11101 * No_Dynamic_Priorities:: 
11102 * No_Entry_Calls_In_Elaboration_Code:: 
11103 * No_Enumeration_Maps:: 
11104 * No_Exception_Handlers:: 
11105 * No_Exception_Propagation:: 
11106 * No_Exception_Registration:: 
11107 * No_Exceptions:: 
11108 * No_Finalization:: 
11109 * No_Fixed_Point:: 
11110 * No_Floating_Point:: 
11111 * No_Implicit_Conditionals:: 
11112 * No_Implicit_Dynamic_Code:: 
11113 * No_Implicit_Heap_Allocations:: 
11114 * No_Implicit_Loops:: 
11115 * No_Initialize_Scalars:: 
11116 * No_IO:: 
11117 * No_Local_Allocators:: 
11118 * No_Local_Protected_Objects:: 
11119 * No_Local_Timing_Events:: 
11120 * No_Long_Long_Integers:: 
11121 * No_Multiple_Elaboration:: 
11122 * No_Nested_Finalization:: 
11123 * No_Protected_Type_Allocators:: 
11124 * No_Protected_Types:: 
11125 * No_Recursion:: 
11126 * No_Reentrancy:: 
11127 * No_Relative_Delay:: 
11128 * No_Requeue_Statements:: 
11129 * No_Secondary_Stack:: 
11130 * No_Select_Statements:: 
11131 * No_Specific_Termination_Handlers:: 
11132 * No_Specification_of_Aspect:: 
11133 * No_Standard_Allocators_After_Elaboration:: 
11134 * No_Standard_Storage_Pools:: 
11135 * No_Stream_Optimizations:: 
11136 * No_Streams:: 
11137 * No_Task_Allocators:: 
11138 * No_Task_Attributes_Package:: 
11139 * No_Task_Hierarchy:: 
11140 * No_Task_Termination:: 
11141 * No_Tasking:: 
11142 * No_Terminate_Alternatives:: 
11143 * No_Unchecked_Access:: 
11144 * No_Use_Of_Entity:: 
11145 * Simple_Barriers:: 
11146 * Static_Priorities:: 
11147 * Static_Storage_Size:: 
11149 @end menu
11151 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
11152 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{169}
11153 @subsection Immediate_Reclamation
11156 @geindex Immediate_Reclamation
11158 [RM H.4] This restriction ensures that, except for storage occupied by
11159 objects created by allocators and not deallocated via unchecked
11160 deallocation, any storage reserved at run time for an object is
11161 immediately reclaimed when the object no longer exists.
11163 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
11164 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{16a}
11165 @subsection Max_Asynchronous_Select_Nesting
11168 @geindex Max_Asynchronous_Select_Nesting
11170 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
11171 selects. Violations of this restriction with a value of zero are
11172 detected at compile time. Violations of this restriction with values
11173 other than zero cause Storage_Error to be raised.
11175 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
11176 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{16b}
11177 @subsection Max_Entry_Queue_Length
11180 @geindex Max_Entry_Queue_Length
11182 [RM D.7] This restriction is a declaration that any protected entry compiled in
11183 the scope of the restriction has at most the specified number of
11184 tasks waiting on the entry at any one time, and so no queue is required.
11185 Note that this restriction is checked at run time. Violation of this
11186 restriction results in the raising of Program_Error exception at the point of
11187 the call.
11189 @geindex Max_Entry_Queue_Depth
11191 The restriction @cite{Max_Entry_Queue_Depth} is recognized as a
11192 synonym for @cite{Max_Entry_Queue_Length}. This is retained for historical
11193 compatibility purposes (and a warning will be generated for its use if
11194 warnings on obsolescent features are activated).
11196 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
11197 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{16c}
11198 @subsection Max_Protected_Entries
11201 @geindex Max_Protected_Entries
11203 [RM D.7] Specifies the maximum number of entries per protected type. The
11204 bounds of every entry family of a protected unit shall be static, or shall be
11205 defined by a discriminant of a subtype whose corresponding bound is static.
11207 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
11208 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{16d}
11209 @subsection Max_Select_Alternatives
11212 @geindex Max_Select_Alternatives
11214 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
11216 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
11217 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{16e}
11218 @subsection Max_Storage_At_Blocking
11221 @geindex Max_Storage_At_Blocking
11223 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
11224 Storage_Size that can be retained by a blocked task. A violation of this
11225 restriction causes Storage_Error to be raised.
11227 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
11228 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{16f}
11229 @subsection Max_Task_Entries
11232 @geindex Max_Task_Entries
11234 [RM D.7] Specifies the maximum number of entries
11235 per task.  The bounds of every entry family
11236 of a task unit shall be static, or shall be
11237 defined by a discriminant of a subtype whose
11238 corresponding bound is static.
11240 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
11241 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{170}
11242 @subsection Max_Tasks
11245 @geindex Max_Tasks
11247 [RM D.7] Specifies the maximum number of task that may be created, not
11248 counting the creation of the environment task.  Violations of this
11249 restriction with a value of zero are detected at compile
11250 time. Violations of this restriction with values other than zero cause
11251 Storage_Error to be raised.
11253 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
11254 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{171}
11255 @subsection No_Abort_Statements
11258 @geindex No_Abort_Statements
11260 [RM D.7] There are no abort_statements, and there are
11261 no calls to Task_Identification.Abort_Task.
11263 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
11264 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{172}
11265 @subsection No_Access_Parameter_Allocators
11268 @geindex No_Access_Parameter_Allocators
11270 [RM H.4] This restriction ensures at compile time that there are no
11271 occurrences of an allocator as the actual parameter to an access
11272 parameter.
11274 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
11275 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{173}
11276 @subsection No_Access_Subprograms
11279 @geindex No_Access_Subprograms
11281 [RM H.4] This restriction ensures at compile time that there are no
11282 declarations of access-to-subprogram types.
11284 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
11285 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{174}
11286 @subsection No_Allocators
11289 @geindex No_Allocators
11291 [RM H.4] This restriction ensures at compile time that there are no
11292 occurrences of an allocator.
11294 @node No_Anonymous_Allocators,No_Calendar,No_Allocators,Partition-Wide Restrictions
11295 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{175}
11296 @subsection No_Anonymous_Allocators
11299 @geindex No_Anonymous_Allocators
11301 [RM H.4] This restriction ensures at compile time that there are no
11302 occurrences of an allocator of anonymous access type.
11304 @node No_Calendar,No_Coextensions,No_Anonymous_Allocators,Partition-Wide Restrictions
11305 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{176}
11306 @subsection No_Calendar
11309 @geindex No_Calendar
11311 [GNAT] This restriction ensures at compile time that there is no implicit or
11312 explicit dependence on the package @cite{Ada.Calendar}.
11314 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
11315 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{177}
11316 @subsection No_Coextensions
11319 @geindex No_Coextensions
11321 [RM H.4] This restriction ensures at compile time that there are no
11322 coextensions. See 3.10.2.
11324 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
11325 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{178}
11326 @subsection No_Default_Initialization
11329 @geindex No_Default_Initialization
11331 [GNAT] This restriction prohibits any instance of default initialization
11332 of variables.  The binder implements a consistency rule which prevents
11333 any unit compiled without the restriction from with'ing a unit with the
11334 restriction (this allows the generation of initialization procedures to
11335 be skipped, since you can be sure that no call is ever generated to an
11336 initialization procedure in a unit with the restriction active). If used
11337 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
11338 is to prohibit all cases of variables declared without a specific
11339 initializer (including the case of OUT scalar parameters).
11341 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
11342 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{179}
11343 @subsection No_Delay
11346 @geindex No_Delay
11348 [RM H.4] This restriction ensures at compile time that there are no
11349 delay statements and no dependences on package Calendar.
11351 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
11352 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{17a}
11353 @subsection No_Dependence
11356 @geindex No_Dependence
11358 [RM 13.12.1] This restriction checks at compile time that there are no
11359 dependence on a library unit.
11361 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
11362 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{17b}
11363 @subsection No_Direct_Boolean_Operators
11366 @geindex No_Direct_Boolean_Operators
11368 [GNAT] This restriction ensures that no logical operators (and/or/xor)
11369 are used on operands of type Boolean (or any type derived from Boolean).
11370 This is intended for use in safety critical programs where the certification
11371 protocol requires the use of short-circuit (and then, or else) forms for all
11372 composite boolean operations.
11374 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
11375 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{17c}
11376 @subsection No_Dispatch
11379 @geindex No_Dispatch
11381 [RM H.4] This restriction ensures at compile time that there are no
11382 occurrences of @cite{T'Class}, for any (tagged) subtype @cite{T}.
11384 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
11385 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{17d}
11386 @subsection No_Dispatching_Calls
11389 @geindex No_Dispatching_Calls
11391 [GNAT] This restriction ensures at compile time that the code generated by the
11392 compiler involves no dispatching calls. The use of this restriction allows the
11393 safe use of record extensions, classwide membership tests and other classwide
11394 features not involving implicit dispatching. This restriction ensures that
11395 the code contains no indirect calls through a dispatching mechanism. Note that
11396 this includes internally-generated calls created by the compiler, for example
11397 in the implementation of class-wide objects assignments. The
11398 membership test is allowed in the presence of this restriction, because its
11399 implementation requires no dispatching.
11400 This restriction is comparable to the official Ada restriction
11401 @cite{No_Dispatch} except that it is a bit less restrictive in that it allows
11402 all classwide constructs that do not imply dispatching.
11403 The following example indicates constructs that violate this restriction.
11405 @example
11406 package Pkg is
11407   type T is tagged record
11408     Data : Natural;
11409   end record;
11410   procedure P (X : T);
11412   type DT is new T with record
11413     More_Data : Natural;
11414   end record;
11415   procedure Q (X : DT);
11416 end Pkg;
11418 with Pkg; use Pkg;
11419 procedure Example is
11420   procedure Test (O : T'Class) is
11421     N : Natural  := O'Size;--  Error: Dispatching call
11422     C : T'Class := O;      --  Error: implicit Dispatching Call
11423   begin
11424     if O in DT'Class then  --  OK   : Membership test
11425        Q (DT (O));         --  OK   : Type conversion plus direct call
11426     else
11427        P (O);              --  Error: Dispatching call
11428     end if;
11429   end Test;
11431   Obj : DT;
11432 begin
11433   P (Obj);                 --  OK   : Direct call
11434   P (T (Obj));             --  OK   : Type conversion plus direct call
11435   P (T'Class (Obj));       --  Error: Dispatching call
11437   Test (Obj);              --  OK   : Type conversion
11439   if Obj in T'Class then   --  OK   : Membership test
11440      null;
11441   end if;
11442 end Example;
11443 @end example
11445 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
11446 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{17e}
11447 @subsection No_Dynamic_Attachment
11450 @geindex No_Dynamic_Attachment
11452 [RM D.7] This restriction ensures that there is no call to any of the
11453 operations defined in package Ada.Interrupts
11454 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
11455 Detach_Handler, and Reference).
11457 @geindex No_Dynamic_Interrupts
11459 The restriction @cite{No_Dynamic_Interrupts} is recognized as a
11460 synonym for @cite{No_Dynamic_Attachment}. This is retained for historical
11461 compatibility purposes (and a warning will be generated for its use if
11462 warnings on obsolescent features are activated).
11464 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
11465 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{17f}
11466 @subsection No_Dynamic_Priorities
11469 @geindex No_Dynamic_Priorities
11471 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
11473 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
11474 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{180}
11475 @subsection No_Entry_Calls_In_Elaboration_Code
11478 @geindex No_Entry_Calls_In_Elaboration_Code
11480 [GNAT] This restriction ensures at compile time that no task or protected entry
11481 calls are made during elaboration code.  As a result of the use of this
11482 restriction, the compiler can assume that no code past an accept statement
11483 in a task can be executed at elaboration time.
11485 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
11486 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{181}
11487 @subsection No_Enumeration_Maps
11490 @geindex No_Enumeration_Maps
11492 [GNAT] This restriction ensures at compile time that no operations requiring
11493 enumeration maps are used (that is Image and Value attributes applied
11494 to enumeration types).
11496 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
11497 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{182}
11498 @subsection No_Exception_Handlers
11501 @geindex No_Exception_Handlers
11503 [GNAT] This restriction ensures at compile time that there are no explicit
11504 exception handlers. It also indicates that no exception propagation will
11505 be provided. In this mode, exceptions may be raised but will result in
11506 an immediate call to the last chance handler, a routine that the user
11507 must define with the following profile:
11509 @example
11510 procedure Last_Chance_Handler
11511   (Source_Location : System.Address; Line : Integer);
11512 pragma Export (C, Last_Chance_Handler,
11513                "__gnat_last_chance_handler");
11514 @end example
11516 The parameter is a C null-terminated string representing a message to be
11517 associated with the exception (typically the source location of the raise
11518 statement generated by the compiler). The Line parameter when nonzero
11519 represents the line number in the source program where the raise occurs.
11521 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
11522 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{183}
11523 @subsection No_Exception_Propagation
11526 @geindex No_Exception_Propagation
11528 [GNAT] This restriction guarantees that exceptions are never propagated
11529 to an outer subprogram scope. The only case in which an exception may
11530 be raised is when the handler is statically in the same subprogram, so
11531 that the effect of a raise is essentially like a goto statement. Any
11532 other raise statement (implicit or explicit) will be considered
11533 unhandled. Exception handlers are allowed, but may not contain an
11534 exception occurrence identifier (exception choice). In addition, use of
11535 the package GNAT.Current_Exception is not permitted, and reraise
11536 statements (raise with no operand) are not permitted.
11538 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
11539 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{184}
11540 @subsection No_Exception_Registration
11543 @geindex No_Exception_Registration
11545 [GNAT] This restriction ensures at compile time that no stream operations for
11546 types Exception_Id or Exception_Occurrence are used. This also makes it
11547 impossible to pass exceptions to or from a partition with this restriction
11548 in a distributed environment. If this restriction is active, the generated
11549 code is simplified by omitting the otherwise-required global registration
11550 of exceptions when they are declared.
11552 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
11553 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{185}
11554 @subsection No_Exceptions
11557 @geindex No_Exceptions
11559 [RM H.4] This restriction ensures at compile time that there are no
11560 raise statements and no exception handlers.
11562 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
11563 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{186}
11564 @subsection No_Finalization
11567 @geindex No_Finalization
11569 [GNAT] This restriction disables the language features described in
11570 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
11571 performed by the compiler to support these features. The following types
11572 are no longer considered controlled when this restriction is in effect:
11575 @itemize *
11577 @item 
11578 @cite{Ada.Finalization.Controlled}
11580 @item 
11581 @cite{Ada.Finalization.Limited_Controlled}
11583 @item 
11584 Derivations from @cite{Controlled} or @cite{Limited_Controlled}
11586 @item 
11587 Class-wide types
11589 @item 
11590 Protected types
11592 @item 
11593 Task types
11595 @item 
11596 Array and record types with controlled components
11597 @end itemize
11599 The compiler no longer generates code to initialize, finalize or adjust an
11600 object or a nested component, either declared on the stack or on the heap. The
11601 deallocation of a controlled object no longer finalizes its contents.
11603 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
11604 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{187}
11605 @subsection No_Fixed_Point
11608 @geindex No_Fixed_Point
11610 [RM H.4] This restriction ensures at compile time that there are no
11611 occurrences of fixed point types and operations.
11613 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
11614 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{188}
11615 @subsection No_Floating_Point
11618 @geindex No_Floating_Point
11620 [RM H.4] This restriction ensures at compile time that there are no
11621 occurrences of floating point types and operations.
11623 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
11624 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{189}
11625 @subsection No_Implicit_Conditionals
11628 @geindex No_Implicit_Conditionals
11630 [GNAT] This restriction ensures that the generated code does not contain any
11631 implicit conditionals, either by modifying the generated code where possible,
11632 or by rejecting any construct that would otherwise generate an implicit
11633 conditional. Note that this check does not include run time constraint
11634 checks, which on some targets may generate implicit conditionals as
11635 well. To control the latter, constraint checks can be suppressed in the
11636 normal manner. Constructs generating implicit conditionals include comparisons
11637 of composite objects and the Max/Min attributes.
11639 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
11640 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{18a}
11641 @subsection No_Implicit_Dynamic_Code
11644 @geindex No_Implicit_Dynamic_Code
11646 @geindex trampoline
11648 [GNAT] This restriction prevents the compiler from building 'trampolines'.
11649 This is a structure that is built on the stack and contains dynamic
11650 code to be executed at run time. On some targets, a trampoline is
11651 built for the following features: @cite{Access},
11652 @cite{Unrestricted_Access}, or @cite{Address} of a nested subprogram;
11653 nested task bodies; primitive operations of nested tagged types.
11654 Trampolines do not work on machines that prevent execution of stack
11655 data. For example, on windows systems, enabling DEP (data execution
11656 protection) will cause trampolines to raise an exception.
11657 Trampolines are also quite slow at run time.
11659 On many targets, trampolines have been largely eliminated. Look at the
11660 version of system.ads for your target --- if it has
11661 Always_Compatible_Rep equal to False, then trampolines are largely
11662 eliminated. In particular, a trampoline is built for the following
11663 features: @cite{Address} of a nested subprogram;
11664 @cite{Access} or @cite{Unrestricted_Access} of a nested subprogram,
11665 but only if pragma Favor_Top_Level applies, or the access type has a
11666 foreign-language convention; primitive operations of nested tagged
11667 types.
11669 @node No_Implicit_Heap_Allocations,No_Implicit_Loops,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
11670 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{18b}
11671 @subsection No_Implicit_Heap_Allocations
11674 @geindex No_Implicit_Heap_Allocations
11676 [RM D.7] No constructs are allowed to cause implicit heap allocation.
11678 @node No_Implicit_Loops,No_Initialize_Scalars,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
11679 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{18c}
11680 @subsection No_Implicit_Loops
11683 @geindex No_Implicit_Loops
11685 [GNAT] This restriction ensures that the generated code does not contain any
11686 implicit @cite{for} loops, either by modifying
11687 the generated code where possible,
11688 or by rejecting any construct that would otherwise generate an implicit
11689 @cite{for} loop. If this restriction is active, it is possible to build
11690 large array aggregates with all static components without generating an
11691 intermediate temporary, and without generating a loop to initialize individual
11692 components. Otherwise, a loop is created for arrays larger than about 5000
11693 scalar components.
11695 @node No_Initialize_Scalars,No_IO,No_Implicit_Loops,Partition-Wide Restrictions
11696 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{18d}
11697 @subsection No_Initialize_Scalars
11700 @geindex No_Initialize_Scalars
11702 [GNAT] This restriction ensures that no unit in the partition is compiled with
11703 pragma Initialize_Scalars. This allows the generation of more efficient
11704 code, and in particular eliminates dummy null initialization routines that
11705 are otherwise generated for some record and array types.
11707 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
11708 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{18e}
11709 @subsection No_IO
11712 @geindex No_IO
11714 [RM H.4] This restriction ensures at compile time that there are no
11715 dependences on any of the library units Sequential_IO, Direct_IO,
11716 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
11718 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
11719 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{18f}
11720 @subsection No_Local_Allocators
11723 @geindex No_Local_Allocators
11725 [RM H.4] This restriction ensures at compile time that there are no
11726 occurrences of an allocator in subprograms, generic subprograms, tasks,
11727 and entry bodies.
11729 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
11730 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{190}
11731 @subsection No_Local_Protected_Objects
11734 @geindex No_Local_Protected_Objects
11736 [RM D.7] This restriction ensures at compile time that protected objects are
11737 only declared at the library level.
11739 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
11740 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{191}
11741 @subsection No_Local_Timing_Events
11744 @geindex No_Local_Timing_Events
11746 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
11747 declared at the library level.
11749 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
11750 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{192}
11751 @subsection No_Long_Long_Integers
11754 @geindex No_Long_Long_Integers
11756 [GNAT] This partition-wide restriction forbids any explicit reference to
11757 type Standard.Long_Long_Integer, and also forbids declaring range types whose
11758 implicit base type is Long_Long_Integer, and modular types whose size exceeds
11759 Long_Integer'Size.
11761 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
11762 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{193}
11763 @subsection No_Multiple_Elaboration
11766 @geindex No_Multiple_Elaboration
11768 [GNAT] Normally each package contains a 16-bit counter used to check for access
11769 before elaboration, and to control multiple elaboration attempts.
11770 This counter is eliminated for units compiled with the static model
11771 of elaboration if restriction @cite{No_Elaboration_Code}
11772 is active but because of
11773 the need to check for multiple elaboration in the general case, these
11774 counters cannot be eliminated if elaboration code may be present. The
11775 restriction @cite{No_Multiple_Elaboration}
11776 allows suppression of these counters
11777 in static elaboration units even if they do have elaboration code. If this
11778 restriction is used, then the situations in which multiple elaboration is
11779 possible, including non-Ada main programs, and Stand Alone libraries, are not
11780 permitted, and will be diagnosed by the binder.
11782 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
11783 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{194}
11784 @subsection No_Nested_Finalization
11787 @geindex No_Nested_Finalization
11789 [RM D.7] All objects requiring finalization are declared at the library level.
11791 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
11792 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{195}
11793 @subsection No_Protected_Type_Allocators
11796 @geindex No_Protected_Type_Allocators
11798 [RM D.7] This restriction ensures at compile time that there are no allocator
11799 expressions that attempt to allocate protected objects.
11801 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
11802 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{196}
11803 @subsection No_Protected_Types
11806 @geindex No_Protected_Types
11808 [RM H.4] This restriction ensures at compile time that there are no
11809 declarations of protected types or protected objects.
11811 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
11812 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{197}
11813 @subsection No_Recursion
11816 @geindex No_Recursion
11818 [RM H.4] A program execution is erroneous if a subprogram is invoked as
11819 part of its execution.
11821 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
11822 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{198}
11823 @subsection No_Reentrancy
11826 @geindex No_Reentrancy
11828 [RM H.4] A program execution is erroneous if a subprogram is executed by
11829 two tasks at the same time.
11831 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
11832 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{199}
11833 @subsection No_Relative_Delay
11836 @geindex No_Relative_Delay
11838 [RM D.7] This restriction ensures at compile time that there are no delay
11839 relative statements and prevents expressions such as @cite{delay 1.23;} from
11840 appearing in source code.
11842 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
11843 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{19a}
11844 @subsection No_Requeue_Statements
11847 @geindex No_Requeue_Statements
11849 [RM D.7] This restriction ensures at compile time that no requeue statements
11850 are permitted and prevents keyword @cite{requeue} from being used in source
11851 code.
11853 @geindex No_Requeue
11855 The restriction @cite{No_Requeue} is recognized as a
11856 synonym for @cite{No_Requeue_Statements}. This is retained for historical
11857 compatibility purposes (and a warning will be generated for its use if
11858 warnings on oNobsolescent features are activated).
11860 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
11861 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{19b}
11862 @subsection No_Secondary_Stack
11865 @geindex No_Secondary_Stack
11867 [GNAT] This restriction ensures at compile time that the generated code
11868 does not contain any reference to the secondary stack.  The secondary
11869 stack is used to implement functions returning unconstrained objects
11870 (arrays or records) on some targets.
11872 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
11873 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{19c}
11874 @subsection No_Select_Statements
11877 @geindex No_Select_Statements
11879 [RM D.7] This restriction ensures at compile time no select statements of any
11880 kind are permitted, that is the keyword @cite{select} may not appear.
11882 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
11883 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{19d}
11884 @subsection No_Specific_Termination_Handlers
11887 @geindex No_Specific_Termination_Handlers
11889 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
11890 or to Ada.Task_Termination.Specific_Handler.
11892 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
11893 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{19e}
11894 @subsection No_Specification_of_Aspect
11897 @geindex No_Specification_of_Aspect
11899 [RM 13.12.1] This restriction checks at compile time that no aspect
11900 specification, attribute definition clause, or pragma is given for a
11901 given aspect.
11903 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
11904 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{19f}
11905 @subsection No_Standard_Allocators_After_Elaboration
11908 @geindex No_Standard_Allocators_After_Elaboration
11910 [RM D.7] Specifies that an allocator using a standard storage pool
11911 should never be evaluated at run time after the elaboration of the
11912 library items of the partition has completed. Otherwise, Storage_Error
11913 is raised.
11915 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
11916 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1a0}
11917 @subsection No_Standard_Storage_Pools
11920 @geindex No_Standard_Storage_Pools
11922 [GNAT] This restriction ensures at compile time that no access types
11923 use the standard default storage pool.  Any access type declared must
11924 have an explicit Storage_Pool attribute defined specifying a
11925 user-defined storage pool.
11927 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
11928 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1a1}
11929 @subsection No_Stream_Optimizations
11932 @geindex No_Stream_Optimizations
11934 [GNAT] This restriction affects the performance of stream operations on types
11935 @cite{String}, @cite{Wide_String} and @cite{Wide_Wide_String}. By default, the
11936 compiler uses block reads and writes when manipulating @cite{String} objects
11937 due to their supperior performance. When this restriction is in effect, the
11938 compiler performs all IO operations on a per-character basis.
11940 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
11941 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1a2}
11942 @subsection No_Streams
11945 @geindex No_Streams
11947 [GNAT] This restriction ensures at compile/bind time that there are no
11948 stream objects created and no use of stream attributes.
11949 This restriction does not forbid dependences on the package
11950 @cite{Ada.Streams}. So it is permissible to with
11951 @cite{Ada.Streams} (or another package that does so itself)
11952 as long as no actual stream objects are created and no
11953 stream attributes are used.
11955 Note that the use of restriction allows optimization of tagged types,
11956 since they do not need to worry about dispatching stream operations.
11957 To take maximum advantage of this space-saving optimization, any
11958 unit declaring a tagged type should be compiled with the restriction,
11959 though this is not required.
11961 @node No_Task_Allocators,No_Task_Attributes_Package,No_Streams,Partition-Wide Restrictions
11962 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1a3}
11963 @subsection No_Task_Allocators
11966 @geindex No_Task_Allocators
11968 [RM D.7] There are no allocators for task types
11969 or types containing task subcomponents.
11971 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_Allocators,Partition-Wide Restrictions
11972 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1a4}
11973 @subsection No_Task_Attributes_Package
11976 @geindex No_Task_Attributes_Package
11978 [GNAT] This restriction ensures at compile time that there are no implicit or
11979 explicit dependencies on the package @cite{Ada.Task_Attributes}.
11981 @geindex No_Task_Attributes
11983 The restriction @cite{No_Task_Attributes} is recognized as a synonym
11984 for @cite{No_Task_Attributes_Package}. 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 No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
11989 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1a5}
11990 @subsection No_Task_Hierarchy
11993 @geindex No_Task_Hierarchy
11995 [RM D.7] All (non-environment) tasks depend
11996 directly on the environment task of the partition.
11998 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
11999 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1a6}
12000 @subsection No_Task_Termination
12003 @geindex No_Task_Termination
12005 [RM D.7] Tasks that terminate are erroneous.
12007 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
12008 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1a7}
12009 @subsection No_Tasking
12012 @geindex No_Tasking
12014 [GNAT] This restriction prevents the declaration of tasks or task types
12015 throughout the partition.  It is similar in effect to the use of
12016 @cite{Max_Tasks => 0} except that violations are caught at compile time
12017 and cause an error message to be output either by the compiler or
12018 binder.
12020 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
12021 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1a8}
12022 @subsection No_Terminate_Alternatives
12025 @geindex No_Terminate_Alternatives
12027 [RM D.7] There are no selective accepts with terminate alternatives.
12029 @node No_Unchecked_Access,No_Use_Of_Entity,No_Terminate_Alternatives,Partition-Wide Restrictions
12030 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1a9}
12031 @subsection No_Unchecked_Access
12034 @geindex No_Unchecked_Access
12036 [RM H.4] This restriction ensures at compile time that there are no
12037 occurrences of the Unchecked_Access attribute.
12039 @node No_Use_Of_Entity,Simple_Barriers,No_Unchecked_Access,Partition-Wide Restrictions
12040 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1aa}
12041 @subsection No_Use_Of_Entity
12044 @geindex No_Use_Of_Entity
12046 [GNAT] This restriction ensures at compile time that there are no references
12047 to the entity given in the form
12049 @example
12050 No_Use_Of_Entity => Name
12051 @end example
12053 where @code{Name} is the fully qualified entity, for example
12055 @example
12056 No_Use_Of_Entity => Ada.Text_IO.Put_Line
12057 @end example
12059 @node Simple_Barriers,Static_Priorities,No_Use_Of_Entity,Partition-Wide Restrictions
12060 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1ab}
12061 @subsection Simple_Barriers
12064 @geindex Simple_Barriers
12066 [RM D.7] This restriction ensures at compile time that barriers in entry
12067 declarations for protected types are restricted to either static boolean
12068 expressions or references to simple boolean variables defined in the private
12069 part of the protected type.  No other form of entry barriers is permitted.
12071 @geindex Boolean_Entry_Barriers
12073 The restriction @cite{Boolean_Entry_Barriers} is recognized as a
12074 synonym for @cite{Simple_Barriers}. This is retained for historical
12075 compatibility purposes (and a warning will be generated for its use if
12076 warnings on obsolescent features are activated).
12078 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
12079 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1ac}
12080 @subsection Static_Priorities
12083 @geindex Static_Priorities
12085 [GNAT] This restriction ensures at compile time that all priority expressions
12086 are static, and that there are no dependences on the package
12087 @cite{Ada.Dynamic_Priorities}.
12089 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
12090 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1ad}
12091 @subsection Static_Storage_Size
12094 @geindex Static_Storage_Size
12096 [GNAT] This restriction ensures at compile time that any expression appearing
12097 in a Storage_Size pragma or attribute definition clause is static.
12099 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
12100 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1ae}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{1af}
12101 @section Program Unit Level Restrictions
12104 The second set of restriction identifiers
12105 does not require partition-wide consistency.
12106 The restriction may be enforced for a single
12107 compilation unit without any effect on any of the
12108 other compilation units in the partition.
12110 @menu
12111 * No_Elaboration_Code:: 
12112 * No_Entry_Queue:: 
12113 * No_Implementation_Aspect_Specifications:: 
12114 * No_Implementation_Attributes:: 
12115 * No_Implementation_Identifiers:: 
12116 * No_Implementation_Pragmas:: 
12117 * No_Implementation_Restrictions:: 
12118 * No_Implementation_Units:: 
12119 * No_Implicit_Aliasing:: 
12120 * No_Obsolescent_Features:: 
12121 * No_Wide_Characters:: 
12122 * SPARK_05:: 
12124 @end menu
12126 @node No_Elaboration_Code,No_Entry_Queue,,Program Unit Level Restrictions
12127 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{1b0}
12128 @subsection No_Elaboration_Code
12131 @geindex No_Elaboration_Code
12133 [GNAT] This restriction ensures at compile time that no elaboration code is
12134 generated.  Note that this is not the same condition as is enforced
12135 by pragma @cite{Preelaborate}.  There are cases in which pragma
12136 @cite{Preelaborate} still permits code to be generated (e.g., code
12137 to initialize a large array to all zeroes), and there are cases of units
12138 which do not meet the requirements for pragma @cite{Preelaborate},
12139 but for which no elaboration code is generated.  Generally, it is
12140 the case that preelaborable units will meet the restrictions, with
12141 the exception of large aggregates initialized with an others_clause,
12142 and exception declarations (which generate calls to a run-time
12143 registry procedure).  This restriction is enforced on
12144 a unit by unit basis, it need not be obeyed consistently
12145 throughout a partition.
12147 In the case of aggregates with others, if the aggregate has a dynamic
12148 size, there is no way to eliminate the elaboration code (such dynamic
12149 bounds would be incompatible with @cite{Preelaborate} in any case). If
12150 the bounds are static, then use of this restriction actually modifies
12151 the code choice of the compiler to avoid generating a loop, and instead
12152 generate the aggregate statically if possible, no matter how many times
12153 the data for the others clause must be repeatedly generated.
12155 It is not possible to precisely document
12156 the constructs which are compatible with this restriction, since,
12157 unlike most other restrictions, this is not a restriction on the
12158 source code, but a restriction on the generated object code. For
12159 example, if the source contains a declaration:
12161 @example
12162 Val : constant Integer := X;
12163 @end example
12165 where X is not a static constant, it may be possible, depending
12166 on complex optimization circuitry, for the compiler to figure
12167 out the value of X at compile time, in which case this initialization
12168 can be done by the loader, and requires no initialization code. It
12169 is not possible to document the precise conditions under which the
12170 optimizer can figure this out.
12172 Note that this the implementation of this restriction requires full
12173 code generation. If it is used in conjunction with "semantics only"
12174 checking, then some cases of violations may be missed.
12176 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Elaboration_Code,Program Unit Level Restrictions
12177 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{1b1}
12178 @subsection No_Entry_Queue
12181 @geindex No_Entry_Queue
12183 [GNAT] This restriction is a declaration that any protected entry compiled in
12184 the scope of the restriction has at most one task waiting on the entry
12185 at any one time, and so no queue is required.  This restriction is not
12186 checked at compile time.  A program execution is erroneous if an attempt
12187 is made to queue a second task on such an entry.
12189 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
12190 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{1b2}
12191 @subsection No_Implementation_Aspect_Specifications
12194 @geindex No_Implementation_Aspect_Specifications
12196 [RM 13.12.1] This restriction checks at compile time that no
12197 GNAT-defined aspects are present.  With this restriction, the only
12198 aspects that can be used are those defined in the Ada Reference Manual.
12200 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
12201 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{1b3}
12202 @subsection No_Implementation_Attributes
12205 @geindex No_Implementation_Attributes
12207 [RM 13.12.1] This restriction checks at compile time that no
12208 GNAT-defined attributes are present.  With this restriction, the only
12209 attributes that can be used are those defined in the Ada Reference
12210 Manual.
12212 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
12213 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{1b4}
12214 @subsection No_Implementation_Identifiers
12217 @geindex No_Implementation_Identifiers
12219 [RM 13.12.1] This restriction checks at compile time that no
12220 implementation-defined identifiers (marked with pragma Implementation_Defined)
12221 occur within language-defined packages.
12223 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
12224 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{1b5}
12225 @subsection No_Implementation_Pragmas
12228 @geindex No_Implementation_Pragmas
12230 [RM 13.12.1] This restriction checks at compile time that no
12231 GNAT-defined pragmas are present.  With this restriction, the only
12232 pragmas that can be used are those defined in the Ada Reference Manual.
12234 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
12235 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{1b6}
12236 @subsection No_Implementation_Restrictions
12239 @geindex No_Implementation_Restrictions
12241 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
12242 identifiers (other than @cite{No_Implementation_Restrictions} itself)
12243 are present.  With this restriction, the only other restriction identifiers
12244 that can be used are those defined in the Ada Reference Manual.
12246 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
12247 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{1b7}
12248 @subsection No_Implementation_Units
12251 @geindex No_Implementation_Units
12253 [RM 13.12.1] This restriction checks at compile time that there is no
12254 mention in the context clause of any implementation-defined descendants
12255 of packages Ada, Interfaces, or System.
12257 @node No_Implicit_Aliasing,No_Obsolescent_Features,No_Implementation_Units,Program Unit Level Restrictions
12258 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{1b8}
12259 @subsection No_Implicit_Aliasing
12262 @geindex No_Implicit_Aliasing
12264 [GNAT] This restriction, which is not required to be partition-wide consistent,
12265 requires an explicit aliased keyword for an object to which 'Access,
12266 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
12267 the 'Unrestricted_Access attribute for objects. Note: the reason that
12268 Unrestricted_Access is forbidden is that it would require the prefix
12269 to be aliased, and in such cases, it can always be replaced by
12270 the standard attribute Unchecked_Access which is preferable.
12272 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Aliasing,Program Unit Level Restrictions
12273 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{1b9}
12274 @subsection No_Obsolescent_Features
12277 @geindex No_Obsolescent_Features
12279 [RM 13.12.1] This restriction checks at compile time that no obsolescent
12280 features are used, as defined in Annex J of the Ada Reference Manual.
12282 @node No_Wide_Characters,SPARK_05,No_Obsolescent_Features,Program Unit Level Restrictions
12283 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{1ba}
12284 @subsection No_Wide_Characters
12287 @geindex No_Wide_Characters
12289 [GNAT] This restriction ensures at compile time that no uses of the types
12290 @cite{Wide_Character} or @cite{Wide_String} or corresponding wide
12291 wide types
12292 appear, and that no wide or wide wide string or character literals
12293 appear in the program (that is literals representing characters not in
12294 type @cite{Character}).
12296 @node SPARK_05,,No_Wide_Characters,Program Unit Level Restrictions
12297 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{1bb}
12298 @subsection SPARK_05
12301 @geindex SPARK_05
12303 [GNAT] This restriction checks at compile time that some constructs
12304 forbidden in SPARK 2005 are not present. Error messages related to
12305 SPARK restriction have the form:
12307 @example
12308 violation of restriction "SPARK_05" at <source-location>
12309  <error message>
12310 @end example
12312 @geindex SPARK
12314 The restriction @cite{SPARK} is recognized as a
12315 synonym for @cite{SPARK_05}. This is retained for historical
12316 compatibility purposes (and an unconditional warning will be generated
12317 for its use, advising replacement by @cite{SPARK}).
12319 This is not a replacement for the semantic checks performed by the
12320 SPARK Examiner tool, as the compiler currently only deals with code,
12321 not SPARK 2005 annotations, and does not guarantee catching all
12322 cases of constructs forbidden by SPARK 2005.
12324 Thus it may well be the case that code which passes the compiler with
12325 the SPARK restriction is rejected by the SPARK Examiner, e.g. due to
12326 the different visibility rules of the Examiner based on SPARK 2005
12327 @cite{inherit} annotations.
12329 This restriction can be useful in providing an initial filter for code
12330 developed using SPARK 2005, or in examining legacy code to see how far
12331 it is from meeting SPARK restrictions.
12333 The list below summarizes the checks that are performed when this
12334 restriction is in force:
12337 @itemize *
12339 @item 
12340 No block statements
12342 @item 
12343 No case statements with only an others clause
12345 @item 
12346 Exit statements in loops must respect the SPARK 2005 language restrictions
12348 @item 
12349 No goto statements
12351 @item 
12352 Return can only appear as last statement in function
12354 @item 
12355 Function must have return statement
12357 @item 
12358 Loop parameter specification must include subtype mark
12360 @item 
12361 Prefix of expanded name cannot be a loop statement
12363 @item 
12364 Abstract subprogram not allowed
12366 @item 
12367 User-defined operators not allowed
12369 @item 
12370 Access type parameters not allowed
12372 @item 
12373 Default expressions for parameters not allowed
12375 @item 
12376 Default expressions for record fields not allowed
12378 @item 
12379 No tasking constructs allowed
12381 @item 
12382 Label needed at end of subprograms and packages
12384 @item 
12385 No mixing of positional and named parameter association
12387 @item 
12388 No access types as result type
12390 @item 
12391 No unconstrained arrays as result types
12393 @item 
12394 No null procedures
12396 @item 
12397 Initial and later declarations must be in correct order (declaration can't come after body)
12399 @item 
12400 No attributes on private types if full declaration not visible
12402 @item 
12403 No package declaration within package specification
12405 @item 
12406 No controlled types
12408 @item 
12409 No discriminant types
12411 @item 
12412 No overloading
12414 @item 
12415 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
12417 @item 
12418 Access attribute not allowed
12420 @item 
12421 Allocator not allowed
12423 @item 
12424 Result of catenation must be String
12426 @item 
12427 Operands of catenation must be string literal, static char or another catenation
12429 @item 
12430 No conditional expressions
12432 @item 
12433 No explicit dereference
12435 @item 
12436 Quantified expression not allowed
12438 @item 
12439 Slicing not allowed
12441 @item 
12442 No exception renaming
12444 @item 
12445 No generic renaming
12447 @item 
12448 No object renaming
12450 @item 
12451 No use clause
12453 @item 
12454 Aggregates must be qualified
12456 @item 
12457 Non-static choice in array aggregates not allowed
12459 @item 
12460 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
12462 @item 
12463 No mixing of positional and named association in aggregate, no multi choice
12465 @item 
12466 AND, OR and XOR for arrays only allowed when operands have same static bounds
12468 @item 
12469 Fixed point operands to * or / must be qualified or converted
12471 @item 
12472 Comparison operators not allowed for Booleans or arrays (except strings)
12474 @item 
12475 Equality not allowed for arrays with non-matching static bounds (except strings)
12477 @item 
12478 Conversion / qualification not allowed for arrays with non-matching static bounds
12480 @item 
12481 Subprogram declaration only allowed in package spec (unless followed by import)
12483 @item 
12484 Access types not allowed
12486 @item 
12487 Incomplete type declaration not allowed
12489 @item 
12490 Object and subtype declarations must respect SPARK restrictions
12492 @item 
12493 Digits or delta constraint not allowed
12495 @item 
12496 Decimal fixed point type not allowed
12498 @item 
12499 Aliasing of objects not allowed
12501 @item 
12502 Modular type modulus must be power of 2
12504 @item 
12505 Base not allowed on subtype mark
12507 @item 
12508 Unary operators not allowed on modular types (except not)
12510 @item 
12511 Untagged record cannot be null
12513 @item 
12514 No class-wide operations
12516 @item 
12517 Initialization expressions must respect SPARK restrictions
12519 @item 
12520 Non-static ranges not allowed except in iteration schemes
12522 @item 
12523 String subtypes must have lower bound of 1
12525 @item 
12526 Subtype of Boolean cannot have constraint
12528 @item 
12529 At most one tagged type or extension per package
12531 @item 
12532 Interface is not allowed
12534 @item 
12535 Character literal cannot be prefixed (selector name cannot be character literal)
12537 @item 
12538 Record aggregate cannot contain 'others'
12540 @item 
12541 Component association in record aggregate must contain a single choice
12543 @item 
12544 Ancestor part cannot be a type mark
12546 @item 
12547 Attributes 'Image, 'Width and 'Value not allowed
12549 @item 
12550 Functions may not update globals
12552 @item 
12553 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
12555 @item 
12556 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
12557 @end itemize
12559 The following restrictions are enforced, but note that they are actually more
12560 strict that the latest SPARK 2005 language definition:
12563 @itemize *
12565 @item 
12566 No derived types other than tagged type extensions
12568 @item 
12569 Subtype of unconstrained array must have constraint
12570 @end itemize
12572 This list summarises the main SPARK 2005 language rules that are not
12573 currently checked by the SPARK_05 restriction:
12576 @itemize *
12578 @item 
12579 SPARK annotations are treated as comments so are not checked at all
12581 @item 
12582 Based real literals not allowed
12584 @item 
12585 Objects cannot be initialized at declaration by calls to user-defined functions
12587 @item 
12588 Objects cannot be initialized at declaration by assignments from variables
12590 @item 
12591 Objects cannot be initialized at declaration by assignments from indexed/selected components
12593 @item 
12594 Ranges shall not be null
12596 @item 
12597 A fixed point delta expression must be a simple expression
12599 @item 
12600 Restrictions on where renaming declarations may be placed
12602 @item 
12603 Externals of mode 'out' cannot be referenced
12605 @item 
12606 Externals of mode 'in' cannot be updated
12608 @item 
12609 Loop with no iteration scheme or exits only allowed as last statement in main program or task
12611 @item 
12612 Subprogram cannot have parent unit name
12614 @item 
12615 SPARK 2005 inherited subprogram must be prefixed with overriding
12617 @item 
12618 External variables (or functions that reference them) may not be passed as actual parameters
12620 @item 
12621 Globals must be explicitly mentioned in contract
12623 @item 
12624 Deferred constants cannot be completed by pragma Import
12626 @item 
12627 Package initialization cannot read/write variables from other packages
12629 @item 
12630 Prefix not allowed for entities that are directly visible
12632 @item 
12633 Identifier declaration can't override inherited package name
12635 @item 
12636 Cannot use Standard or other predefined packages as identifiers
12638 @item 
12639 After renaming, cannot use the original name
12641 @item 
12642 Subprograms can only be renamed to remove package prefix
12644 @item 
12645 Pragma import must be immediately after entity it names
12647 @item 
12648 No mutual recursion between multiple units (this can be checked with gnatcheck)
12649 @end itemize
12651 Note that if a unit is compiled in Ada 95 mode with the SPARK restriction,
12652 violations will be reported for constructs forbidden in SPARK 95,
12653 instead of SPARK 2005.
12655 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
12656 @anchor{gnat_rm/implementation_advice doc}@anchor{1bc}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{1bd}
12657 @chapter Implementation Advice
12660 The main text of the Ada Reference Manual describes the required
12661 behavior of all Ada compilers, and the GNAT compiler conforms to
12662 these requirements.
12664 In addition, there are sections throughout the Ada Reference Manual headed
12665 by the phrase 'Implementation advice'.  These sections are not normative,
12666 i.e., they do not specify requirements that all compilers must
12667 follow.  Rather they provide advice on generally desirable behavior.
12668 They are not requirements, because they describe behavior that cannot
12669 be provided on all systems, or may be undesirable on some systems.
12671 As far as practical, GNAT follows the implementation advice in
12672 the Ada Reference Manual.  Each such RM section corresponds to a section
12673 in this chapter whose title specifies the
12674 RM section number and paragraph number and the subject of
12675 the advice.  The contents of each section consists of the RM text within
12676 quotation marks,
12677 followed by the GNAT interpretation of the advice.  Most often, this simply says
12678 'followed', which means that GNAT follows the advice.  However, in a
12679 number of cases, GNAT deliberately deviates from this advice, in which
12680 case the text describes what GNAT does and why.
12682 @geindex Error detection
12684 @menu
12685 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
12686 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
12687 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
12688 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
12689 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
12690 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
12691 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
12692 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
12693 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
12694 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
12695 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
12696 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
12697 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
12698 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
12699 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
12700 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
12701 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
12702 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
12703 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
12704 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
12705 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
12706 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
12707 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
12708 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
12709 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
12710 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
12711 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
12712 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
12713 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
12714 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
12715 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
12716 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
12717 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
12718 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
12719 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
12720 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
12721 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
12722 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
12723 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
12724 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
12725 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
12726 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
12727 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
12728 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
12729 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
12730 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
12731 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
12732 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
12733 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
12734 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
12735 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
12736 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
12737 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
12738 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
12739 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
12740 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
12741 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
12742 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
12743 * RM G; Numerics: RM G Numerics. 
12744 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
12745 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
12746 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
12747 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
12748 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
12750 @end menu
12752 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
12753 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{1be}
12754 @section RM 1.1.3(20): Error Detection
12757 @quotation
12759 "If an implementation detects the use of an unsupported Specialized Needs
12760 Annex feature at run time, it should raise @cite{Program_Error} if
12761 feasible."
12762 @end quotation
12764 Not relevant.  All specialized needs annex features are either supported,
12765 or diagnosed at compile time.
12767 @geindex Child Units
12769 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
12770 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{1bf}
12771 @section RM 1.1.3(31): Child Units
12774 @quotation
12776 "If an implementation wishes to provide implementation-defined
12777 extensions to the functionality of a language-defined library unit, it
12778 should normally do so by adding children to the library unit."
12779 @end quotation
12781 Followed.
12783 @geindex Bounded errors
12785 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
12786 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{1c0}
12787 @section RM 1.1.5(12): Bounded Errors
12790 @quotation
12792 "If an implementation detects a bounded error or erroneous
12793 execution, it should raise @cite{Program_Error}."
12794 @end quotation
12796 Followed in all cases in which the implementation detects a bounded
12797 error or erroneous execution.  Not all such situations are detected at
12798 runtime.
12800 @geindex Pragmas
12802 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
12803 @anchor{gnat_rm/implementation_advice id2}@anchor{1c1}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{1c2}
12804 @section RM 2.8(16): Pragmas
12807 @quotation
12809 "Normally, implementation-defined pragmas should have no semantic effect
12810 for error-free programs; that is, if the implementation-defined pragmas
12811 are removed from a working program, the program should still be legal,
12812 and should still have the same semantics."
12813 @end quotation
12815 The following implementation defined pragmas are exceptions to this
12816 rule:
12819 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
12820 @headitem
12822 Pragma
12824 @tab
12826 Explanation
12828 @item
12830 @emph{Abort_Defer}
12832 @tab
12834 Affects semantics
12836 @item
12838 @emph{Ada_83}
12840 @tab
12842 Affects legality
12844 @item
12846 @emph{Assert}
12848 @tab
12850 Affects semantics
12852 @item
12854 @emph{CPP_Class}
12856 @tab
12858 Affects semantics
12860 @item
12862 @emph{CPP_Constructor}
12864 @tab
12866 Affects semantics
12868 @item
12870 @emph{Debug}
12872 @tab
12874 Affects semantics
12876 @item
12878 @emph{Interface_Name}
12880 @tab
12882 Affects semantics
12884 @item
12886 @emph{Machine_Attribute}
12888 @tab
12890 Affects semantics
12892 @item
12894 @emph{Unimplemented_Unit}
12896 @tab
12898 Affects legality
12900 @item
12902 @emph{Unchecked_Union}
12904 @tab
12906 Affects semantics
12908 @end multitable
12911 In each of the above cases, it is essential to the purpose of the pragma
12912 that this advice not be followed.  For details see
12913 @ref{7,,Implementation Defined Pragmas}.
12915 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
12916 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{1c3}
12917 @section RM 2.8(17-19): Pragmas
12920 @quotation
12922 "Normally, an implementation should not define pragmas that can
12923 make an illegal program legal, except as follows:
12926 @itemize *
12928 @item 
12929 A pragma used to complete a declaration, such as a pragma @cite{Import};
12931 @item 
12932 A pragma used to configure the environment by adding, removing, or
12933 replacing @cite{library_items}."
12934 @end itemize
12935 @end quotation
12937 See @ref{1c2,,RM 2.8(16); Pragmas}.
12939 @geindex Character Sets
12941 @geindex Alternative Character Sets
12943 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
12944 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{1c4}
12945 @section RM 3.5.2(5): Alternative Character Sets
12948 @quotation
12950 "If an implementation supports a mode with alternative interpretations
12951 for @cite{Character} and @cite{Wide_Character}, the set of graphic
12952 characters of @cite{Character} should nevertheless remain a proper
12953 subset of the set of graphic characters of @cite{Wide_Character}.  Any
12954 character set 'localizations' should be reflected in the results of
12955 the subprograms defined in the language-defined package
12956 @cite{Characters.Handling} (see A.3) available in such a mode.  In a mode with
12957 an alternative interpretation of @cite{Character}, the implementation should
12958 also support a corresponding change in what is a legal
12959 @cite{identifier_letter}."
12960 @end quotation
12962 Not all wide character modes follow this advice, in particular the JIS
12963 and IEC modes reflect standard usage in Japan, and in these encoding,
12964 the upper half of the Latin-1 set is not part of the wide-character
12965 subset, since the most significant bit is used for wide character
12966 encoding.  However, this only applies to the external forms.  Internally
12967 there is no such restriction.
12969 @geindex Integer types
12971 @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
12972 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{1c5}
12973 @section RM 3.5.4(28): Integer Types
12976 @quotation
12978 "An implementation should support @cite{Long_Integer} in addition to
12979 @cite{Integer} if the target machine supports 32-bit (or longer)
12980 arithmetic.  No other named integer subtypes are recommended for package
12981 @cite{Standard}.  Instead, appropriate named integer subtypes should be
12982 provided in the library package @cite{Interfaces} (see B.2)."
12983 @end quotation
12985 @cite{Long_Integer} is supported.  Other standard integer types are supported
12986 so this advice is not fully followed.  These types
12987 are supported for convenient interface to C, and so that all hardware
12988 types of the machine are easily available.
12990 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
12991 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{1c6}
12992 @section RM 3.5.4(29): Integer Types
12995 @quotation
12997 "An implementation for a two's complement machine should support
12998 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
12999 implementation should support a non-binary modules up to @cite{Integer'Last}."
13000 @end quotation
13002 Followed.
13004 @geindex Enumeration values
13006 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
13007 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{1c7}
13008 @section RM 3.5.5(8): Enumeration Values
13011 @quotation
13013 "For the evaluation of a call on @code{S'Pos} for an enumeration
13014 subtype, if the value of the operand does not correspond to the internal
13015 code for any enumeration literal of its type (perhaps due to an
13016 un-initialized variable), then the implementation should raise
13017 @cite{Program_Error}.  This is particularly important for enumeration
13018 types with noncontiguous internal codes specified by an
13019 enumeration_representation_clause."
13020 @end quotation
13022 Followed.
13024 @geindex Float types
13026 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
13027 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{1c8}
13028 @section RM 3.5.7(17): Float Types
13031 @quotation
13033 "An implementation should support @cite{Long_Float} in addition to
13034 @cite{Float} if the target machine supports 11 or more digits of
13035 precision.  No other named floating point subtypes are recommended for
13036 package @cite{Standard}.  Instead, appropriate named floating point subtypes
13037 should be provided in the library package @cite{Interfaces} (see B.2)."
13038 @end quotation
13040 @cite{Short_Float} and @cite{Long_Long_Float} are also provided.  The
13041 former provides improved compatibility with other implementations
13042 supporting this type.  The latter corresponds to the highest precision
13043 floating-point type supported by the hardware.  On most machines, this
13044 will be the same as @cite{Long_Float}, but on some machines, it will
13045 correspond to the IEEE extended form.  The notable case is all ia32
13046 (x86) implementations, where @cite{Long_Long_Float} corresponds to
13047 the 80-bit extended precision format supported in hardware on this
13048 processor.  Note that the 128-bit format on SPARC is not supported,
13049 since this is a software rather than a hardware format.
13051 @geindex Multidimensional arrays
13053 @geindex Arrays
13054 @geindex multidimensional
13056 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
13057 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{1c9}
13058 @section RM 3.6.2(11): Multidimensional Arrays
13061 @quotation
13063 "An implementation should normally represent multidimensional arrays in
13064 row-major order, consistent with the notation used for multidimensional
13065 array aggregates (see 4.3.3).  However, if a pragma @cite{Convention}
13066 (@cite{Fortran}, ...) applies to a multidimensional array type, then
13067 column-major order should be used instead (see B.5, @cite{Interfacing with Fortran})."
13068 @end quotation
13070 Followed.
13072 @geindex Duration'Small
13074 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
13075 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{1ca}
13076 @section RM 9.6(30-31): Duration'Small
13079 @quotation
13081 "Whenever possible in an implementation, the value of @cite{Duration'Small}
13082 should be no greater than 100 microseconds."
13083 @end quotation
13085 Followed.  (@cite{Duration'Small} = 10**(-9)).
13087 @quotation
13089 "The time base for @cite{delay_relative_statements} should be monotonic;
13090 it need not be the same time base as used for @cite{Calendar.Clock}."
13091 @end quotation
13093 Followed.
13095 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
13096 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{1cb}
13097 @section RM 10.2.1(12): Consistent Representation
13100 @quotation
13102 "In an implementation, a type declared in a pre-elaborated package should
13103 have the same representation in every elaboration of a given version of
13104 the package, whether the elaborations occur in distinct executions of
13105 the same program, or in executions of distinct programs or partitions
13106 that include the given version."
13107 @end quotation
13109 Followed, except in the case of tagged types.  Tagged types involve
13110 implicit pointers to a local copy of a dispatch table, and these pointers
13111 have representations which thus depend on a particular elaboration of the
13112 package.  It is not easy to see how it would be possible to follow this
13113 advice without severely impacting efficiency of execution.
13115 @geindex Exception information
13117 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
13118 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{1cc}
13119 @section RM 11.4.1(19): Exception Information
13122 @quotation
13124 "@cite{Exception_Message} by default and @cite{Exception_Information}
13125 should produce information useful for
13126 debugging.  @cite{Exception_Message} should be short, about one
13127 line.  @cite{Exception_Information} can be long.  @cite{Exception_Message}
13128 should not include the
13129 @cite{Exception_Name}.  @cite{Exception_Information} should include both
13130 the @cite{Exception_Name} and the @cite{Exception_Message}."
13131 @end quotation
13133 Followed.  For each exception that doesn't have a specified
13134 @cite{Exception_Message}, the compiler generates one containing the location
13135 of the raise statement.  This location has the form 'file_name:line', where
13136 file_name is the short file name (without path information) and line is the line
13137 number in the file.  Note that in the case of the Zero Cost Exception
13138 mechanism, these messages become redundant with the Exception_Information that
13139 contains a full backtrace of the calling sequence, so they are disabled.
13140 To disable explicitly the generation of the source location message, use the
13141 Pragma @cite{Discard_Names}.
13143 @geindex Suppression of checks
13145 @geindex Checks
13146 @geindex suppression of
13148 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
13149 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{1cd}
13150 @section RM 11.5(28): Suppression of Checks
13153 @quotation
13155 "The implementation should minimize the code executed for checks that
13156 have been suppressed."
13157 @end quotation
13159 Followed.
13161 @geindex Representation clauses
13163 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
13164 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{1ce}
13165 @section RM 13.1 (21-24): Representation Clauses
13168 @quotation
13170 "The recommended level of support for all representation items is
13171 qualified as follows:
13173 An implementation need not support representation items containing
13174 non-static expressions, except that an implementation should support a
13175 representation item for a given entity if each non-static expression in
13176 the representation item is a name that statically denotes a constant
13177 declared before the entity."
13178 @end quotation
13180 Followed.  In fact, GNAT goes beyond the recommended level of support
13181 by allowing nonstatic expressions in some representation clauses even
13182 without the need to declare constants initialized with the values of
13183 such expressions.
13184 For example:
13186 @example
13187   X : Integer;
13188   Y : Float;
13189   for Y'Address use X'Address;>>
13192 "An implementation need not support a specification for the `Size`
13193 for a given composite subtype, nor the size or storage place for an
13194 object (including a component) of a given composite subtype, unless the
13195 constraints on the subtype and its composite subcomponents (if any) are
13196 all static constraints."
13197 @end example
13199 Followed.  Size Clauses are not permitted on non-static components, as
13200 described above.
13202 @quotation
13204 "An aliased component, or a component whose type is by-reference, should
13205 always be allocated at an addressable location."
13206 @end quotation
13208 Followed.
13210 @geindex Packed types
13212 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
13213 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{1cf}
13214 @section RM 13.2(6-8): Packed Types
13217 @quotation
13219 "If a type is packed, then the implementation should try to minimize
13220 storage allocated to objects of the type, possibly at the expense of
13221 speed of accessing components, subject to reasonable complexity in
13222 addressing calculations.
13224 The recommended level of support pragma @cite{Pack} is:
13226 For a packed record type, the components should be packed as tightly as
13227 possible subject to the Sizes of the component subtypes, and subject to
13228 any @cite{record_representation_clause} that applies to the type; the
13229 implementation may, but need not, reorder components or cross aligned
13230 word boundaries to improve the packing.  A component whose @cite{Size} is
13231 greater than the word size may be allocated an integral number of words."
13232 @end quotation
13234 Followed.  Tight packing of arrays is supported for all component sizes
13235 up to 64-bits. If the array component size is 1 (that is to say, if
13236 the component is a boolean type or an enumeration type with two values)
13237 then values of the type are implicitly initialized to zero. This
13238 happens both for objects of the packed type, and for objects that have a
13239 subcomponent of the packed type.
13241 @quotation
13243 "An implementation should support Address clauses for imported
13244 subprograms."
13245 @end quotation
13247 Followed.
13249 @geindex Address clauses
13251 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
13252 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{1d0}
13253 @section RM 13.3(14-19): Address Clauses
13256 @quotation
13258 "For an array @cite{X}, @code{X'Address} should point at the first
13259 component of the array, and not at the array bounds."
13260 @end quotation
13262 Followed.
13264 @quotation
13266 "The recommended level of support for the @cite{Address} attribute is:
13268 @code{X'Address} should produce a useful result if @cite{X} is an
13269 object that is aliased or of a by-reference type, or is an entity whose
13270 @cite{Address} has been specified."
13271 @end quotation
13273 Followed.  A valid address will be produced even if none of those
13274 conditions have been met.  If necessary, the object is forced into
13275 memory to ensure the address is valid.
13277 @quotation
13279 "An implementation should support @cite{Address} clauses for imported
13280 subprograms."
13281 @end quotation
13283 Followed.
13285 @quotation
13287 "Objects (including subcomponents) that are aliased or of a by-reference
13288 type should be allocated on storage element boundaries."
13289 @end quotation
13291 Followed.
13293 @quotation
13295 "If the @cite{Address} of an object is specified, or it is imported or exported,
13296 then the implementation should not perform optimizations based on
13297 assumptions of no aliases."
13298 @end quotation
13300 Followed.
13302 @geindex Alignment clauses
13304 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
13305 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{1d1}
13306 @section RM 13.3(29-35): Alignment Clauses
13309 @quotation
13311 "The recommended level of support for the @cite{Alignment} attribute for
13312 subtypes is:
13314 An implementation should support specified Alignments that are factors
13315 and multiples of the number of storage elements per word, subject to the
13316 following:"
13317 @end quotation
13319 Followed.
13321 @quotation
13323 "An implementation need not support specified Alignments for
13324 combinations of Sizes and Alignments that cannot be easily
13325 loaded and stored by available machine instructions."
13326 @end quotation
13328 Followed.
13330 @quotation
13332 "An implementation need not support specified Alignments that are
13333 greater than the maximum @cite{Alignment} the implementation ever returns by
13334 default."
13335 @end quotation
13337 Followed.
13339 @quotation
13341 "The recommended level of support for the @cite{Alignment} attribute for
13342 objects is:
13344 Same as above, for subtypes, but in addition:"
13345 @end quotation
13347 Followed.
13349 @quotation
13351 "For stand-alone library-level objects of statically constrained
13352 subtypes, the implementation should support all alignments
13353 supported by the target linker.  For example, page alignment is likely to
13354 be supported for such objects, but not for subtypes."
13355 @end quotation
13357 Followed.
13359 @geindex Size clauses
13361 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
13362 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{1d2}
13363 @section RM 13.3(42-43): Size Clauses
13366 @quotation
13368 "The recommended level of support for the @cite{Size} attribute of
13369 objects is:
13371 A @cite{Size} clause should be supported for an object if the specified
13372 @cite{Size} is at least as large as its subtype's @cite{Size}, and
13373 corresponds to a size in storage elements that is a multiple of the
13374 object's @cite{Alignment} (if the @cite{Alignment} is nonzero)."
13375 @end quotation
13377 Followed.
13379 @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
13380 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{1d3}
13381 @section RM 13.3(50-56): Size Clauses
13384 @quotation
13386 "If the @cite{Size} of a subtype is specified, and allows for efficient
13387 independent addressability (see 9.10) on the target architecture, then
13388 the @cite{Size} of the following objects of the subtype should equal the
13389 @cite{Size} of the subtype:
13391 Aliased objects (including components)."
13392 @end quotation
13394 Followed.
13396 @quotation
13398 "@cite{Size} clause on a composite subtype should not affect the
13399 internal layout of components."
13400 @end quotation
13402 Followed. But note that this can be overridden by use of the implementation
13403 pragma Implicit_Packing in the case of packed arrays.
13405 @quotation
13407 "The recommended level of support for the @cite{Size} attribute of subtypes is:
13409 The @cite{Size} (if not specified) of a static discrete or fixed point
13410 subtype should be the number of bits needed to represent each value
13411 belonging to the subtype using an unbiased representation, leaving space
13412 for a sign bit only if the subtype contains negative values.  If such a
13413 subtype is a first subtype, then an implementation should support a
13414 specified @cite{Size} for it that reflects this representation."
13415 @end quotation
13417 Followed.
13419 @quotation
13421 "For a subtype implemented with levels of indirection, the @cite{Size}
13422 should include the size of the pointers, but not the size of what they
13423 point at."
13424 @end quotation
13426 Followed.
13428 @geindex Component_Size clauses
13430 @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
13431 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{1d4}
13432 @section RM 13.3(71-73): Component Size Clauses
13435 @quotation
13437 "The recommended level of support for the @cite{Component_Size}
13438 attribute is:
13440 An implementation need not support specified @cite{Component_Sizes} that are
13441 less than the @cite{Size} of the component subtype."
13442 @end quotation
13444 Followed.
13446 @quotation
13448 "An implementation should support specified Component_Sizes that
13449 are factors and multiples of the word size.  For such
13450 Component_Sizes, the array should contain no gaps between
13451 components.  For other Component_Sizes (if supported), the array
13452 should contain no gaps between components when packing is also
13453 specified; the implementation should forbid this combination in cases
13454 where it cannot support a no-gaps representation."
13455 @end quotation
13457 Followed.
13459 @geindex Enumeration representation clauses
13461 @geindex Representation clauses
13462 @geindex enumeration
13464 @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
13465 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{1d5}
13466 @section RM 13.4(9-10): Enumeration Representation Clauses
13469 @quotation
13471 "The recommended level of support for enumeration representation clauses
13474 An implementation need not support enumeration representation clauses
13475 for boolean types, but should at minimum support the internal codes in
13476 the range @cite{System.Min_Int .. System.Max_Int}."
13477 @end quotation
13479 Followed.
13481 @geindex Record representation clauses
13483 @geindex Representation clauses
13484 @geindex records
13486 @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
13487 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{1d6}
13488 @section RM 13.5.1(17-22): Record Representation Clauses
13491 @quotation
13493 "The recommended level of support for
13494 @cite{record_representation_clauses} is:
13496 An implementation should support storage places that can be extracted
13497 with a load, mask, shift sequence of machine code, and set with a load,
13498 shift, mask, store sequence, given the available machine instructions
13499 and run-time model."
13500 @end quotation
13502 Followed.
13504 @quotation
13506 "A storage place should be supported if its size is equal to the
13507 @cite{Size} of the component subtype, and it starts and ends on a
13508 boundary that obeys the @cite{Alignment} of the component subtype."
13509 @end quotation
13511 Followed.
13513 @quotation
13515 "If the default bit ordering applies to the declaration of a given type,
13516 then for a component whose subtype's @cite{Size} is less than the word
13517 size, any storage place that does not cross an aligned word boundary
13518 should be supported."
13519 @end quotation
13521 Followed.
13523 @quotation
13525 "An implementation may reserve a storage place for the tag field of a
13526 tagged type, and disallow other components from overlapping that place."
13527 @end quotation
13529 Followed.  The storage place for the tag field is the beginning of the tagged
13530 record, and its size is Address'Size.  GNAT will reject an explicit component
13531 clause for the tag field.
13533 @quotation
13535 "An implementation need not support a @cite{component_clause} for a
13536 component of an extension part if the storage place is not after the
13537 storage places of all components of the parent type, whether or not
13538 those storage places had been specified."
13539 @end quotation
13541 Followed.  The above advice on record representation clauses is followed,
13542 and all mentioned features are implemented.
13544 @geindex Storage place attributes
13546 @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
13547 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{1d7}
13548 @section RM 13.5.2(5): Storage Place Attributes
13551 @quotation
13553 "If a component is represented using some form of pointer (such as an
13554 offset) to the actual data of the component, and this data is contiguous
13555 with the rest of the object, then the storage place attributes should
13556 reflect the place of the actual data, not the pointer.  If a component is
13557 allocated discontinuously from the rest of the object, then a warning
13558 should be generated upon reference to one of its storage place
13559 attributes."
13560 @end quotation
13562 Followed.  There are no such components in GNAT.
13564 @geindex Bit ordering
13566 @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
13567 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{1d8}
13568 @section RM 13.5.3(7-8): Bit Ordering
13571 @quotation
13573 "The recommended level of support for the non-default bit ordering is:
13575 If @cite{Word_Size} = @cite{Storage_Unit}, then the implementation
13576 should support the non-default bit ordering in addition to the default
13577 bit ordering."
13578 @end quotation
13580 Followed.  Word size does not equal storage size in this implementation.
13581 Thus non-default bit ordering is not supported.
13583 @geindex Address
13584 @geindex as private type
13586 @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
13587 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{1d9}
13588 @section RM 13.7(37): Address as Private
13591 @quotation
13593 "@cite{Address} should be of a private type."
13594 @end quotation
13596 Followed.
13598 @geindex Operations
13599 @geindex on `Address`
13601 @geindex Address
13602 @geindex operations of
13604 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
13605 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{1da}
13606 @section RM 13.7.1(16): Address Operations
13609 @quotation
13611 "Operations in @cite{System} and its children should reflect the target
13612 environment semantics as closely as is reasonable.  For example, on most
13613 machines, it makes sense for address arithmetic to 'wrap around'.
13614 Operations that do not make sense should raise @cite{Program_Error}."
13615 @end quotation
13617 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
13618 operation raises @cite{Program_Error}, since all operations make sense.
13620 @geindex Unchecked conversion
13622 @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
13623 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{1db}
13624 @section RM 13.9(14-17): Unchecked Conversion
13627 @quotation
13629 "The @cite{Size} of an array object should not include its bounds; hence,
13630 the bounds should not be part of the converted data."
13631 @end quotation
13633 Followed.
13635 @quotation
13637 "The implementation should not generate unnecessary run-time checks to
13638 ensure that the representation of @cite{S} is a representation of the
13639 target type.  It should take advantage of the permission to return by
13640 reference when possible.  Restrictions on unchecked conversions should be
13641 avoided unless required by the target environment."
13642 @end quotation
13644 Followed.  There are no restrictions on unchecked conversion.  A warning is
13645 generated if the source and target types do not have the same size since
13646 the semantics in this case may be target dependent.
13648 @quotation
13650 "The recommended level of support for unchecked conversions is:
13652 Unchecked conversions should be supported and should be reversible in
13653 the cases where this clause defines the result.  To enable meaningful use
13654 of unchecked conversion, a contiguous representation should be used for
13655 elementary subtypes, for statically constrained array subtypes whose
13656 component subtype is one of the subtypes described in this paragraph,
13657 and for record subtypes without discriminants whose component subtypes
13658 are described in this paragraph."
13659 @end quotation
13661 Followed.
13663 @geindex Heap usage
13664 @geindex implicit
13666 @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
13667 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{1dc}
13668 @section RM 13.11(23-25): Implicit Heap Usage
13671 @quotation
13673 "An implementation should document any cases in which it dynamically
13674 allocates heap storage for a purpose other than the evaluation of an
13675 allocator."
13676 @end quotation
13678 Followed, the only other points at which heap storage is dynamically
13679 allocated are as follows:
13682 @itemize *
13684 @item 
13685 At initial elaboration time, to allocate dynamically sized global
13686 objects.
13688 @item 
13689 To allocate space for a task when a task is created.
13691 @item 
13692 To extend the secondary stack dynamically when needed.  The secondary
13693 stack is used for returning variable length results.
13694 @end itemize
13697 @quotation
13699 "A default (implementation-provided) storage pool for an
13700 access-to-constant type should not have overhead to support deallocation of
13701 individual objects."
13702 @end quotation
13704 Followed.
13706 @quotation
13708 "A storage pool for an anonymous access type should be created at the
13709 point of an allocator for the type, and be reclaimed when the designated
13710 object becomes inaccessible."
13711 @end quotation
13713 Followed.
13715 @geindex Unchecked deallocation
13717 @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
13718 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{1dd}
13719 @section RM 13.11.2(17): Unchecked Deallocation
13722 @quotation
13724 "For a standard storage pool, @cite{Free} should actually reclaim the
13725 storage."
13726 @end quotation
13728 Followed.
13730 @geindex Stream oriented attributes
13732 @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
13733 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{1de}
13734 @section RM 13.13.2(17): Stream Oriented Attributes
13737 @quotation
13739 "If a stream element is the same size as a storage element, then the
13740 normal in-memory representation should be used by @cite{Read} and
13741 @cite{Write} for scalar objects.  Otherwise, @cite{Read} and @cite{Write}
13742 should use the smallest number of stream elements needed to represent
13743 all values in the base range of the scalar type."
13744 @end quotation
13746 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
13747 which specifies using the size of the first subtype.
13748 However, such an implementation is based on direct binary
13749 representations and is therefore target- and endianness-dependent.
13750 To address this issue, GNAT also supplies an alternate implementation
13751 of the stream attributes @cite{Read} and @cite{Write},
13752 which uses the target-independent XDR standard representation
13753 for scalar types.
13755 @geindex XDR representation
13757 @geindex Read attribute
13759 @geindex Write attribute
13761 @geindex Stream oriented attributes
13763 The XDR implementation is provided as an alternative body of the
13764 @cite{System.Stream_Attributes} package, in the file
13765 @code{s-stratt-xdr.adb} in the GNAT library.
13766 There is no @code{s-stratt-xdr.ads} file.
13767 In order to install the XDR implementation, do the following:
13770 @itemize *
13772 @item 
13773 Replace the default implementation of the
13774 @cite{System.Stream_Attributes} package with the XDR implementation.
13775 For example on a Unix platform issue the commands:
13777 @example
13778 $ mv s-stratt.adb s-stratt-default.adb
13779 $ mv s-stratt-xdr.adb s-stratt.adb
13780 @end example
13782 @item 
13783 Rebuild the GNAT run-time library as documented in
13784 the @cite{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
13785 @end itemize
13787 @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
13788 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{1df}
13789 @section RM A.1(52): Names of Predefined Numeric Types
13792 @quotation
13794 "If an implementation provides additional named predefined integer types,
13795 then the names should end with @code{Integer} as in
13796 @code{Long_Integer}.  If an implementation provides additional named
13797 predefined floating point types, then the names should end with
13798 @code{Float} as in @code{Long_Float}."
13799 @end quotation
13801 Followed.
13803 @geindex Ada.Characters.Handling
13805 @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
13806 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{1e0}
13807 @section RM A.3.2(49): @cite{Ada.Characters.Handling}
13810 @quotation
13812 "If an implementation provides a localized definition of @cite{Character}
13813 or @cite{Wide_Character}, then the effects of the subprograms in
13814 @cite{Characters.Handling} should reflect the localizations.
13815 See also 3.5.2."
13816 @end quotation
13818 Followed.  GNAT provides no such localized definitions.
13820 @geindex Bounded-length strings
13822 @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
13823 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{1e1}
13824 @section RM A.4.4(106): Bounded-Length String Handling
13827 @quotation
13829 "Bounded string objects should not be implemented by implicit pointers
13830 and dynamic allocation."
13831 @end quotation
13833 Followed.  No implicit pointers or dynamic allocation are used.
13835 @geindex Random number generation
13837 @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
13838 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{1e2}
13839 @section RM A.5.2(46-47): Random Number Generation
13842 @quotation
13844 "Any storage associated with an object of type @cite{Generator} should be
13845 reclaimed on exit from the scope of the object."
13846 @end quotation
13848 Followed.
13850 @quotation
13852 "If the generator period is sufficiently long in relation to the number
13853 of distinct initiator values, then each possible value of
13854 @cite{Initiator} passed to @cite{Reset} should initiate a sequence of
13855 random numbers that does not, in a practical sense, overlap the sequence
13856 initiated by any other value.  If this is not possible, then the mapping
13857 between initiator values and generator states should be a rapidly
13858 varying function of the initiator value."
13859 @end quotation
13861 Followed.  The generator period is sufficiently long for the first
13862 condition here to hold true.
13864 @geindex Get_Immediate
13866 @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
13867 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{1e3}
13868 @section RM A.10.7(23): @cite{Get_Immediate}
13871 @quotation
13873 "The @cite{Get_Immediate} procedures should be implemented with
13874 unbuffered input.  For a device such as a keyboard, input should be
13875 available if a key has already been typed, whereas for a disk
13876 file, input should always be available except at end of file.  For a file
13877 associated with a keyboard-like device, any line-editing features of the
13878 underlying operating system should be disabled during the execution of
13879 @cite{Get_Immediate}."
13880 @end quotation
13882 Followed on all targets except VxWorks. For VxWorks, there is no way to
13883 provide this functionality that does not result in the input buffer being
13884 flushed before the @cite{Get_Immediate} call. A special unit
13885 @cite{Interfaces.Vxworks.IO} is provided that contains routines to enable
13886 this functionality.
13888 @geindex Export
13890 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
13891 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{1e4}
13892 @section RM B.1(39-41): Pragma @cite{Export}
13895 @quotation
13897 "If an implementation supports pragma @cite{Export} to a given language,
13898 then it should also allow the main subprogram to be written in that
13899 language.  It should support some mechanism for invoking the elaboration
13900 of the Ada library units included in the system, and for invoking the
13901 finalization of the environment task.  On typical systems, the
13902 recommended mechanism is to provide two subprograms whose link names are
13903 @cite{adainit} and @cite{adafinal}.  @cite{adainit} should contain the
13904 elaboration code for library units.  @cite{adafinal} should contain the
13905 finalization code.  These subprograms should have no effect the second
13906 and subsequent time they are called."
13907 @end quotation
13909 Followed.
13911 @quotation
13913 "Automatic elaboration of pre-elaborated packages should be
13914 provided when pragma @cite{Export} is supported."
13915 @end quotation
13917 Followed when the main program is in Ada.  If the main program is in a
13918 foreign language, then
13919 @cite{adainit} must be called to elaborate pre-elaborated
13920 packages.
13922 @quotation
13924 "For each supported convention @cite{L} other than @cite{Intrinsic}, an
13925 implementation should support @cite{Import} and @cite{Export} pragmas
13926 for objects of @cite{L}-compatible types and for subprograms, and pragma
13927 @cite{Convention} for @cite{L}-eligible types and for subprograms,
13928 presuming the other language has corresponding features.  Pragma
13929 @cite{Convention} need not be supported for scalar types."
13930 @end quotation
13932 Followed.
13934 @geindex Package Interfaces
13936 @geindex Interfaces
13938 @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
13939 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{1e5}
13940 @section RM B.2(12-13): Package @cite{Interfaces}
13943 @quotation
13945 "For each implementation-defined convention identifier, there should be a
13946 child package of package Interfaces with the corresponding name.  This
13947 package should contain any declarations that would be useful for
13948 interfacing to the language (implementation) represented by the
13949 convention.  Any declarations useful for interfacing to any language on
13950 the given hardware architecture should be provided directly in
13951 @cite{Interfaces}."
13952 @end quotation
13954 Followed.
13956 @quotation
13958 "An implementation supporting an interface to C, COBOL, or Fortran should
13959 provide the corresponding package or packages described in the following
13960 clauses."
13961 @end quotation
13963 Followed.  GNAT provides all the packages described in this section.
13965 @geindex C
13966 @geindex interfacing with
13968 @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
13969 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{1e6}
13970 @section RM B.3(63-71): Interfacing with C
13973 @quotation
13975 "An implementation should support the following interface correspondences
13976 between Ada and C."
13977 @end quotation
13979 Followed.
13981 @quotation
13983 "An Ada procedure corresponds to a void-returning C function."
13984 @end quotation
13986 Followed.
13988 @quotation
13990 "An Ada function corresponds to a non-void C function."
13991 @end quotation
13993 Followed.
13995 @quotation
13997 "An Ada @cite{in} scalar parameter is passed as a scalar argument to a C
13998 function."
13999 @end quotation
14001 Followed.
14003 @quotation
14005 "An Ada @cite{in} parameter of an access-to-object type with designated
14006 type @cite{T} is passed as a @code{t*} argument to a C function,
14007 where @code{t} is the C type corresponding to the Ada type @cite{T}."
14008 @end quotation
14010 Followed.
14012 @quotation
14014 "An Ada access @cite{T} parameter, or an Ada @cite{out} or @cite{in out}
14015 parameter of an elementary type @cite{T}, is passed as a @code{t*}
14016 argument to a C function, where @code{t} is the C type corresponding to
14017 the Ada type @cite{T}.  In the case of an elementary @cite{out} or
14018 @cite{in out} parameter, a pointer to a temporary copy is used to
14019 preserve by-copy semantics."
14020 @end quotation
14022 Followed.
14024 @quotation
14026 "An Ada parameter of a record type @cite{T}, of any mode, is passed as a
14027 @code{t*} argument to a C function, where @code{t} is the C
14028 structure corresponding to the Ada type @cite{T}."
14029 @end quotation
14031 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
14032 pragma, or Convention, or by explicitly specifying the mechanism for a given
14033 call using an extended import or export pragma.
14035 @quotation
14037 "An Ada parameter of an array type with component type @cite{T}, of any
14038 mode, is passed as a @code{t*} argument to a C function, where
14039 @code{t} is the C type corresponding to the Ada type @cite{T}."
14040 @end quotation
14042 Followed.
14044 @quotation
14046 "An Ada parameter of an access-to-subprogram type is passed as a pointer
14047 to a C function whose prototype corresponds to the designated
14048 subprogram's specification."
14049 @end quotation
14051 Followed.
14053 @geindex COBOL
14054 @geindex interfacing with
14056 @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
14057 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{1e7}
14058 @section RM B.4(95-98): Interfacing with COBOL
14061 @quotation
14063 "An Ada implementation should support the following interface
14064 correspondences between Ada and COBOL."
14065 @end quotation
14067 Followed.
14069 @quotation
14071 "An Ada access @cite{T} parameter is passed as a @code{BY REFERENCE} data item of
14072 the COBOL type corresponding to @cite{T}."
14073 @end quotation
14075 Followed.
14077 @quotation
14079 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
14080 the corresponding COBOL type."
14081 @end quotation
14083 Followed.
14085 @quotation
14087 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
14088 COBOL type corresponding to the Ada parameter type; for scalars, a local
14089 copy is used if necessary to ensure by-copy semantics."
14090 @end quotation
14092 Followed.
14094 @geindex Fortran
14095 @geindex interfacing with
14097 @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
14098 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{1e8}
14099 @section RM B.5(22-26): Interfacing with Fortran
14102 @quotation
14104 "An Ada implementation should support the following interface
14105 correspondences between Ada and Fortran:"
14106 @end quotation
14108 Followed.
14110 @quotation
14112 "An Ada procedure corresponds to a Fortran subroutine."
14113 @end quotation
14115 Followed.
14117 @quotation
14119 "An Ada function corresponds to a Fortran function."
14120 @end quotation
14122 Followed.
14124 @quotation
14126 "An Ada parameter of an elementary, array, or record type @cite{T} is
14127 passed as a @cite{T} argument to a Fortran procedure, where @cite{T} is
14128 the Fortran type corresponding to the Ada type @cite{T}, and where the
14129 INTENT attribute of the corresponding dummy argument matches the Ada
14130 formal parameter mode; the Fortran implementation's parameter passing
14131 conventions are used.  For elementary types, a local copy is used if
14132 necessary to ensure by-copy semantics."
14133 @end quotation
14135 Followed.
14137 @quotation
14139 "An Ada parameter of an access-to-subprogram type is passed as a
14140 reference to a Fortran procedure whose interface corresponds to the
14141 designated subprogram's specification."
14142 @end quotation
14144 Followed.
14146 @geindex Machine operations
14148 @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
14149 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{1e9}
14150 @section RM C.1(3-5): Access to Machine Operations
14153 @quotation
14155 "The machine code or intrinsic support should allow access to all
14156 operations normally available to assembly language programmers for the
14157 target environment, including privileged instructions, if any."
14158 @end quotation
14160 Followed.
14162 @quotation
14164 "The interfacing pragmas (see Annex B) should support interface to
14165 assembler; the default assembler should be associated with the
14166 convention identifier @cite{Assembler}."
14167 @end quotation
14169 Followed.
14171 @quotation
14173 "If an entity is exported to assembly language, then the implementation
14174 should allocate it at an addressable location, and should ensure that it
14175 is retained by the linking process, even if not otherwise referenced
14176 from the Ada code.  The implementation should assume that any call to a
14177 machine code or assembler subprogram is allowed to read or update every
14178 object that is specified as exported."
14179 @end quotation
14181 Followed.
14183 @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
14184 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{1ea}
14185 @section RM C.1(10-16): Access to Machine Operations
14188 @quotation
14190 "The implementation should ensure that little or no overhead is
14191 associated with calling intrinsic and machine-code subprograms."
14192 @end quotation
14194 Followed for both intrinsics and machine-code subprograms.
14196 @quotation
14198 "It is recommended that intrinsic subprograms be provided for convenient
14199 access to any machine operations that provide special capabilities or
14200 efficiency and that are not otherwise available through the language
14201 constructs."
14202 @end quotation
14204 Followed.  A full set of machine operation intrinsic subprograms is provided.
14206 @quotation
14208 "Atomic read-modify-write operations---e.g., test and set, compare and
14209 swap, decrement and test, enqueue/dequeue."
14210 @end quotation
14212 Followed on any target supporting such operations.
14214 @quotation
14216 "Standard numeric functions---e.g.:, sin, log."
14217 @end quotation
14219 Followed on any target supporting such operations.
14221 @quotation
14223 "String manipulation operations---e.g.:, translate and test."
14224 @end quotation
14226 Followed on any target supporting such operations.
14228 @quotation
14230 "Vector operations---e.g.:, compare vector against thresholds."
14231 @end quotation
14233 Followed on any target supporting such operations.
14235 @quotation
14237 "Direct operations on I/O ports."
14238 @end quotation
14240 Followed on any target supporting such operations.
14242 @geindex Interrupt support
14244 @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
14245 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{1eb}
14246 @section RM C.3(28): Interrupt Support
14249 @quotation
14251 "If the @cite{Ceiling_Locking} policy is not in effect, the
14252 implementation should provide means for the application to specify which
14253 interrupts are to be blocked during protected actions, if the underlying
14254 system allows for a finer-grain control of interrupt blocking."
14255 @end quotation
14257 Followed.  The underlying system does not allow for finer-grain control
14258 of interrupt blocking.
14260 @geindex Protected procedure handlers
14262 @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
14263 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{1ec}
14264 @section RM C.3.1(20-21): Protected Procedure Handlers
14267 @quotation
14269 "Whenever possible, the implementation should allow interrupt handlers to
14270 be called directly by the hardware."
14271 @end quotation
14273 Followed on any target where the underlying operating system permits
14274 such direct calls.
14276 @quotation
14278 "Whenever practical, violations of any
14279 implementation-defined restrictions should be detected before run time."
14280 @end quotation
14282 Followed.  Compile time warnings are given when possible.
14284 @geindex Package `Interrupts`
14286 @geindex Interrupts
14288 @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
14289 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{1ed}
14290 @section RM C.3.2(25): Package @cite{Interrupts}
14293 @quotation
14295 "If implementation-defined forms of interrupt handler procedures are
14296 supported, such as protected procedures with parameters, then for each
14297 such form of a handler, a type analogous to @cite{Parameterless_Handler}
14298 should be specified in a child package of @cite{Interrupts}, with the
14299 same operations as in the predefined package Interrupts."
14300 @end quotation
14302 Followed.
14304 @geindex Pre-elaboration requirements
14306 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
14307 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{1ee}
14308 @section RM C.4(14): Pre-elaboration Requirements
14311 @quotation
14313 "It is recommended that pre-elaborated packages be implemented in such a
14314 way that there should be little or no code executed at run time for the
14315 elaboration of entities not already covered by the Implementation
14316 Requirements."
14317 @end quotation
14319 Followed.  Executable code is generated in some cases, e.g., loops
14320 to initialize large arrays.
14322 @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
14323 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{1ef}
14324 @section RM C.5(8): Pragma @cite{Discard_Names}
14327 @quotation
14329 "If the pragma applies to an entity, then the implementation should
14330 reduce the amount of storage used for storing names associated with that
14331 entity."
14332 @end quotation
14334 Followed.
14336 @geindex Package Task_Attributes
14338 @geindex Task_Attributes
14340 @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
14341 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{1f0}
14342 @section RM C.7.2(30): The Package Task_Attributes
14345 @quotation
14347 "Some implementations are targeted to domains in which memory use at run
14348 time must be completely deterministic.  For such implementations, it is
14349 recommended that the storage for task attributes will be pre-allocated
14350 statically and not from the heap.  This can be accomplished by either
14351 placing restrictions on the number and the size of the task's
14352 attributes, or by using the pre-allocated storage for the first @cite{N}
14353 attribute objects, and the heap for the others.  In the latter case,
14354 @cite{N} should be documented."
14355 @end quotation
14357 Not followed.  This implementation is not targeted to such a domain.
14359 @geindex Locking Policies
14361 @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
14362 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{1f1}
14363 @section RM D.3(17): Locking Policies
14366 @quotation
14368 "The implementation should use names that end with @code{_Locking} for
14369 locking policies defined by the implementation."
14370 @end quotation
14372 Followed.  Two implementation-defined locking policies are defined,
14373 whose names (@cite{Inheritance_Locking} and
14374 @cite{Concurrent_Readers_Locking}) follow this suggestion.
14376 @geindex Entry queuing policies
14378 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
14379 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{1f2}
14380 @section RM D.4(16): Entry Queuing Policies
14383 @quotation
14385 "Names that end with @code{_Queuing} should be used
14386 for all implementation-defined queuing policies."
14387 @end quotation
14389 Followed.  No such implementation-defined queuing policies exist.
14391 @geindex Preemptive abort
14393 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
14394 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{1f3}
14395 @section RM D.6(9-10): Preemptive Abort
14398 @quotation
14400 "Even though the @cite{abort_statement} is included in the list of
14401 potentially blocking operations (see 9.5.1), it is recommended that this
14402 statement be implemented in a way that never requires the task executing
14403 the @cite{abort_statement} to block."
14404 @end quotation
14406 Followed.
14408 @quotation
14410 "On a multi-processor, the delay associated with aborting a task on
14411 another processor should be bounded; the implementation should use
14412 periodic polling, if necessary, to achieve this."
14413 @end quotation
14415 Followed.
14417 @geindex Tasking restrictions
14419 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
14420 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{1f4}
14421 @section RM D.7(21): Tasking Restrictions
14424 @quotation
14426 "When feasible, the implementation should take advantage of the specified
14427 restrictions to produce a more efficient implementation."
14428 @end quotation
14430 GNAT currently takes advantage of these restrictions by providing an optimized
14431 run time when the Ravenscar profile and the GNAT restricted run time set
14432 of restrictions are specified.  See pragma @cite{Profile (Ravenscar)} and
14433 pragma @cite{Profile (Restricted)} for more details.
14435 @geindex Time
14436 @geindex monotonic
14438 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
14439 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{1f5}
14440 @section RM D.8(47-49): Monotonic Time
14443 @quotation
14445 "When appropriate, implementations should provide configuration
14446 mechanisms to change the value of @cite{Tick}."
14447 @end quotation
14449 Such configuration mechanisms are not appropriate to this implementation
14450 and are thus not supported.
14452 @quotation
14454 "It is recommended that @cite{Calendar.Clock} and @cite{Real_Time.Clock}
14455 be implemented as transformations of the same time base."
14456 @end quotation
14458 Followed.
14460 @quotation
14462 "It is recommended that the best time base which exists in
14463 the underlying system be available to the application through
14464 @cite{Clock}.  @cite{Best} may mean highest accuracy or largest range."
14465 @end quotation
14467 Followed.
14469 @geindex Partition communication subsystem
14471 @geindex PCS
14473 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
14474 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{1f6}
14475 @section RM E.5(28-29): Partition Communication Subsystem
14478 @quotation
14480 "Whenever possible, the PCS on the called partition should allow for
14481 multiple tasks to call the RPC-receiver with different messages and
14482 should allow them to block until the corresponding subprogram body
14483 returns."
14484 @end quotation
14486 Followed by GLADE, a separately supplied PCS that can be used with
14487 GNAT.
14489 @quotation
14491 "The @cite{Write} operation on a stream of type @cite{Params_Stream_Type}
14492 should raise @cite{Storage_Error} if it runs out of space trying to
14493 write the @cite{Item} into the stream."
14494 @end quotation
14496 Followed by GLADE, a separately supplied PCS that can be used with
14497 GNAT.
14499 @geindex COBOL support
14501 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
14502 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{1f7}
14503 @section RM F(7): COBOL Support
14506 @quotation
14508 "If COBOL (respectively, C) is widely supported in the target
14509 environment, implementations supporting the Information Systems Annex
14510 should provide the child package @cite{Interfaces.COBOL} (respectively,
14511 @cite{Interfaces.C}) specified in Annex B and should support a
14512 @cite{convention_identifier} of COBOL (respectively, C) in the interfacing
14513 pragmas (see Annex B), thus allowing Ada programs to interface with
14514 programs written in that language."
14515 @end quotation
14517 Followed.
14519 @geindex Decimal radix support
14521 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
14522 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{1f8}
14523 @section RM F.1(2): Decimal Radix Support
14526 @quotation
14528 "Packed decimal should be used as the internal representation for objects
14529 of subtype @cite{S} when @cite{S}'Machine_Radix = 10."
14530 @end quotation
14532 Not followed.  GNAT ignores @cite{S}'Machine_Radix and always uses binary
14533 representations.
14535 @geindex Numerics
14537 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
14538 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{1f9}
14539 @section RM G: Numerics
14542 @quotation
14544 "If Fortran (respectively, C) is widely supported in the target
14545 environment, implementations supporting the Numerics Annex
14546 should provide the child package @cite{Interfaces.Fortran} (respectively,
14547 @cite{Interfaces.C}) specified in Annex B and should support a
14548 @cite{convention_identifier} of Fortran (respectively, C) in the interfacing
14549 pragmas (see Annex B), thus allowing Ada programs to interface with
14550 programs written in that language."
14551 @end quotation
14553 Followed.
14555 @geindex Complex types
14557 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
14558 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{1fa}
14559 @section RM G.1.1(56-58): Complex Types
14562 @quotation
14564 "Because the usual mathematical meaning of multiplication of a complex
14565 operand and a real operand is that of the scaling of both components of
14566 the former by the latter, an implementation should not perform this
14567 operation by first promoting the real operand to complex type and then
14568 performing a full complex multiplication.  In systems that, in the
14569 future, support an Ada binding to IEC 559:1989, the latter technique
14570 will not generate the required result when one of the components of the
14571 complex operand is infinite.  (Explicit multiplication of the infinite
14572 component by the zero component obtained during promotion yields a NaN
14573 that propagates into the final result.) Analogous advice applies in the
14574 case of multiplication of a complex operand and a pure-imaginary
14575 operand, and in the case of division of a complex operand by a real or
14576 pure-imaginary operand."
14577 @end quotation
14579 Not followed.
14581 @quotation
14583 "Similarly, because the usual mathematical meaning of addition of a
14584 complex operand and a real operand is that the imaginary operand remains
14585 unchanged, an implementation should not perform this operation by first
14586 promoting the real operand to complex type and then performing a full
14587 complex addition.  In implementations in which the @cite{Signed_Zeros}
14588 attribute of the component type is @cite{True} (and which therefore
14589 conform to IEC 559:1989 in regard to the handling of the sign of zero in
14590 predefined arithmetic operations), the latter technique will not
14591 generate the required result when the imaginary component of the complex
14592 operand is a negatively signed zero.  (Explicit addition of the negative
14593 zero to the zero obtained during promotion yields a positive zero.)
14594 Analogous advice applies in the case of addition of a complex operand
14595 and a pure-imaginary operand, and in the case of subtraction of a
14596 complex operand and a real or pure-imaginary operand."
14597 @end quotation
14599 Not followed.
14601 @quotation
14603 "Implementations in which @cite{Real'Signed_Zeros} is @cite{True} should
14604 attempt to provide a rational treatment of the signs of zero results and
14605 result components.  As one example, the result of the @cite{Argument}
14606 function should have the sign of the imaginary component of the
14607 parameter @cite{X} when the point represented by that parameter lies on
14608 the positive real axis; as another, the sign of the imaginary component
14609 of the @cite{Compose_From_Polar} function should be the same as
14610 (respectively, the opposite of) that of the @cite{Argument} parameter when that
14611 parameter has a value of zero and the @cite{Modulus} parameter has a
14612 nonnegative (respectively, negative) value."
14613 @end quotation
14615 Followed.
14617 @geindex Complex elementary functions
14619 @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
14620 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{1fb}
14621 @section RM G.1.2(49): Complex Elementary Functions
14624 @quotation
14626 "Implementations in which @cite{Complex_Types.Real'Signed_Zeros} is
14627 @cite{True} should attempt to provide a rational treatment of the signs
14628 of zero results and result components.  For example, many of the complex
14629 elementary functions have components that are odd functions of one of
14630 the parameter components; in these cases, the result component should
14631 have the sign of the parameter component at the origin.  Other complex
14632 elementary functions have zero components whose sign is opposite that of
14633 a parameter component at the origin, or is always positive or always
14634 negative."
14635 @end quotation
14637 Followed.
14639 @geindex Accuracy requirements
14641 @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
14642 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{1fc}
14643 @section RM G.2.4(19): Accuracy Requirements
14646 @quotation
14648 "The versions of the forward trigonometric functions without a
14649 @cite{Cycle} parameter should not be implemented by calling the
14650 corresponding version with a @cite{Cycle} parameter of
14651 @cite{2.0*Numerics.Pi}, since this will not provide the required
14652 accuracy in some portions of the domain.  For the same reason, the
14653 version of @cite{Log} without a @cite{Base} parameter should not be
14654 implemented by calling the corresponding version with a @cite{Base}
14655 parameter of @cite{Numerics.e}."
14656 @end quotation
14658 Followed.
14660 @geindex Complex arithmetic accuracy
14662 @geindex Accuracy
14663 @geindex complex arithmetic
14665 @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
14666 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{1fd}
14667 @section RM G.2.6(15): Complex Arithmetic Accuracy
14670 @quotation
14672 "The version of the @cite{Compose_From_Polar} function without a
14673 @cite{Cycle} parameter should not be implemented by calling the
14674 corresponding version with a @cite{Cycle} parameter of
14675 @cite{2.0*Numerics.Pi}, since this will not provide the required
14676 accuracy in some portions of the domain."
14677 @end quotation
14679 Followed.
14681 @geindex Sequential elaboration policy
14683 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
14684 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{1fe}
14685 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
14688 @quotation
14690 "If the partition elaboration policy is @cite{Sequential} and the
14691 Environment task becomes permanently blocked during elaboration then the
14692 partition is deadlocked and it is recommended that the partition be
14693 immediately terminated."
14694 @end quotation
14696 Not followed.
14698 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
14699 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{1ff}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{200}
14700 @chapter Implementation Defined Characteristics
14703 In addition to the implementation dependent pragmas and attributes, and the
14704 implementation advice, there are a number of other Ada features that are
14705 potentially implementation dependent and are designated as
14706 implementation-defined. These are mentioned throughout the Ada Reference
14707 Manual, and are summarized in Annex M.
14709 A requirement for conforming Ada compilers is that they provide
14710 documentation describing how the implementation deals with each of these
14711 issues.  In this chapter you will find each point in Annex M listed,
14712 followed by a description of how GNAT
14713 handles the implementation dependence.
14715 You can use this chapter as a guide to minimizing implementation
14716 dependent features in your programs if portability to other compilers
14717 and other operating systems is an important consideration.  The numbers
14718 in each entry below correspond to the paragraph numbers in the Ada
14719 Reference Manual.
14722 @itemize *
14724 @item 
14725 "Whether or not each recommendation given in Implementation
14726 Advice is followed.  See 1.1.2(37)."
14727 @end itemize
14729 See @ref{a,,Implementation Advice}.
14732 @itemize *
14734 @item 
14735 "Capacity limitations of the implementation.  See 1.1.3(3)."
14736 @end itemize
14738 The complexity of programs that can be processed is limited only by the
14739 total amount of available virtual memory, and disk space for the
14740 generated object files.
14743 @itemize *
14745 @item 
14746 "Variations from the standard that are impractical to avoid
14747 given the implementation's execution environment.  See 1.1.3(6)."
14748 @end itemize
14750 There are no variations from the standard.
14753 @itemize *
14755 @item 
14756 "Which code_statements cause external
14757 interactions.  See 1.1.3(10)."
14758 @end itemize
14760 Any @cite{code_statement} can potentially cause external interactions.
14763 @itemize *
14765 @item 
14766 "The coded representation for the text of an Ada
14767 program.  See 2.1(4)."
14768 @end itemize
14770 See separate section on source representation.
14773 @itemize *
14775 @item 
14776 "The control functions allowed in comments.  See 2.1(14)."
14777 @end itemize
14779 See separate section on source representation.
14782 @itemize *
14784 @item 
14785 "The representation for an end of line.  See 2.2(2)."
14786 @end itemize
14788 See separate section on source representation.
14791 @itemize *
14793 @item 
14794 "Maximum supported line length and lexical element
14795 length.  See 2.2(15)."
14796 @end itemize
14798 The maximum line length is 255 characters and the maximum length of
14799 a lexical element is also 255 characters. This is the default setting
14800 if not overridden by the use of compiler switch @emph{-gnaty} (which
14801 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
14802 line length to be specified to be any value up to 32767. The maximum
14803 length of a lexical element is the same as the maximum line length.
14806 @itemize *
14808 @item 
14809 "Implementation defined pragmas.  See 2.8(14)."
14810 @end itemize
14812 See @ref{7,,Implementation Defined Pragmas}.
14815 @itemize *
14817 @item 
14818 "Effect of pragma @cite{Optimize}.  See 2.8(27)."
14819 @end itemize
14821 Pragma @cite{Optimize}, if given with a @cite{Time} or @cite{Space}
14822 parameter, checks that the optimization flag is set, and aborts if it is
14823 not.
14826 @itemize *
14828 @item 
14829 "The sequence of characters of the value returned by
14830 @code{S'Image} when some of the graphic characters of
14831 @code{S'Wide_Image} are not defined in @cite{Character}.  See
14832 3.5(37)."
14833 @end itemize
14835 The sequence of characters is as defined by the wide character encoding
14836 method used for the source.  See section on source representation for
14837 further details.
14840 @itemize *
14842 @item 
14843 "The predefined integer types declared in
14844 @cite{Standard}.  See 3.5.4(25)."
14845 @end itemize
14848 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
14849 @headitem
14851 Type
14853 @tab
14855 Representation
14857 @item
14859 @emph{Short_Short_Integer}
14861 @tab
14863 8 bit signed
14865 @item
14867 @emph{Short_Integer}
14869 @tab
14871 (Short) 16 bit signed
14873 @item
14875 @emph{Integer}
14877 @tab
14879 32 bit signed
14881 @item
14883 @emph{Long_Integer}
14885 @tab
14887 64 bit signed (on most 64 bit targets,
14888 depending on the C definition of long).
14889 32 bit signed (all other targets)
14891 @item
14893 @emph{Long_Long_Integer}
14895 @tab
14897 64 bit signed
14899 @end multitable
14903 @itemize *
14905 @item 
14906 "Any nonstandard integer types and the operators defined
14907 for them.  See 3.5.4(26)."
14908 @end itemize
14910 There are no nonstandard integer types.
14913 @itemize *
14915 @item 
14916 "Any nonstandard real types and the operators defined for
14917 them.  See 3.5.6(8)."
14918 @end itemize
14920 There are no nonstandard real types.
14923 @itemize *
14925 @item 
14926 "What combinations of requested decimal precision and range
14927 are supported for floating point types.  See 3.5.7(7)."
14928 @end itemize
14930 The precision and range is as defined by the IEEE standard.
14933 @itemize *
14935 @item 
14936 "The predefined floating point types declared in
14937 @cite{Standard}.  See 3.5.7(16)."
14938 @end itemize
14941 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
14942 @headitem
14944 Type
14946 @tab
14948 Representation
14950 @item
14952 @emph{Short_Float}
14954 @tab
14956 32 bit IEEE short
14958 @item
14960 @emph{Float}
14962 @tab
14964 (Short) 32 bit IEEE short
14966 @item
14968 @emph{Long_Float}
14970 @tab
14972 64 bit IEEE long
14974 @item
14976 @emph{Long_Long_Float}
14978 @tab
14980 64 bit IEEE long (80 bit IEEE long on x86 processors)
14982 @end multitable
14986 @itemize *
14988 @item 
14989 "The small of an ordinary fixed point type.  See 3.5.9(8)."
14990 @end itemize
14992 @cite{Fine_Delta} is 2**(-63)
14995 @itemize *
14997 @item 
14998 "What combinations of small, range, and digits are
14999 supported for fixed point types.  See 3.5.9(10)."
15000 @end itemize
15002 Any combinations are permitted that do not result in a small less than
15003 @cite{Fine_Delta} and do not result in a mantissa larger than 63 bits.
15004 If the mantissa is larger than 53 bits on machines where Long_Long_Float
15005 is 64 bits (true of all architectures except ia32), then the output from
15006 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
15007 is because floating-point conversions are used to convert fixed point.
15010 @itemize *
15012 @item 
15013 "The result of @cite{Tags.Expanded_Name} for types declared
15014 within an unnamed @cite{block_statement}.  See 3.9(10)."
15015 @end itemize
15017 Block numbers of the form @cite{B`nnn`}, where @cite{nnn} is a
15018 decimal integer are allocated.
15021 @itemize *
15023 @item 
15024 "Implementation-defined attributes.  See 4.1.4(12)."
15025 @end itemize
15027 See @ref{8,,Implementation Defined Attributes}.
15030 @itemize *
15032 @item 
15033 "Any implementation-defined time types.  See 9.6(6)."
15034 @end itemize
15036 There are no implementation-defined time types.
15039 @itemize *
15041 @item 
15042 "The time base associated with relative delays."
15043 @end itemize
15045 See 9.6(20).  The time base used is that provided by the C library
15046 function @cite{gettimeofday}.
15049 @itemize *
15051 @item 
15052 "The time base of the type @cite{Calendar.Time}.  See
15053 9.6(23)."
15054 @end itemize
15056 The time base used is that provided by the C library function
15057 @cite{gettimeofday}.
15060 @itemize *
15062 @item 
15063 "The time zone used for package @cite{Calendar}
15064 operations.  See 9.6(24)."
15065 @end itemize
15067 The time zone used by package @cite{Calendar} is the current system time zone
15068 setting for local time, as accessed by the C library function
15069 @cite{localtime}.
15072 @itemize *
15074 @item 
15075 "Any limit on @cite{delay_until_statements} of
15076 @cite{select_statements}.  See 9.6(29)."
15077 @end itemize
15079 There are no such limits.
15082 @itemize *
15084 @item 
15085 "Whether or not two non-overlapping parts of a composite
15086 object are independently addressable, in the case where packing, record
15087 layout, or @cite{Component_Size} is specified for the object.  See
15088 9.10(1)."
15089 @end itemize
15091 Separate components are independently addressable if they do not share
15092 overlapping storage units.
15095 @itemize *
15097 @item 
15098 "The representation for a compilation.  See 10.1(2)."
15099 @end itemize
15101 A compilation is represented by a sequence of files presented to the
15102 compiler in a single invocation of the @emph{gcc} command.
15105 @itemize *
15107 @item 
15108 "Any restrictions on compilations that contain multiple
15109 compilation_units.  See 10.1(4)."
15110 @end itemize
15112 No single file can contain more than one compilation unit, but any
15113 sequence of files can be presented to the compiler as a single
15114 compilation.
15117 @itemize *
15119 @item 
15120 "The mechanisms for creating an environment and for adding
15121 and replacing compilation units.  See 10.1.4(3)."
15122 @end itemize
15124 See separate section on compilation model.
15127 @itemize *
15129 @item 
15130 "The manner of explicitly assigning library units to a
15131 partition.  See 10.2(2)."
15132 @end itemize
15134 If a unit contains an Ada main program, then the Ada units for the partition
15135 are determined by recursive application of the rules in the Ada Reference
15136 Manual section 10.2(2-6).  In other words, the Ada units will be those that
15137 are needed by the main program, and then this definition of need is applied
15138 recursively to those units, and the partition contains the transitive
15139 closure determined by this relationship.  In short, all the necessary units
15140 are included, with no need to explicitly specify the list.  If additional
15141 units are required, e.g., by foreign language units, then all units must be
15142 mentioned in the context clause of one of the needed Ada units.
15144 If the partition contains no main program, or if the main program is in
15145 a language other than Ada, then GNAT
15146 provides the binder options @emph{-z} and @emph{-n} respectively, and in
15147 this case a list of units can be explicitly supplied to the binder for
15148 inclusion in the partition (all units needed by these units will also
15149 be included automatically).  For full details on the use of these
15150 options, refer to the @cite{GNAT Make Program gnatmake} in the
15151 @cite{GNAT User's Guide}.
15154 @itemize *
15156 @item 
15157 "The implementation-defined means, if any, of specifying
15158 which compilation units are needed by a given compilation unit.  See
15159 10.2(2)."
15160 @end itemize
15162 The units needed by a given compilation unit are as defined in
15163 the Ada Reference Manual section 10.2(2-6).  There are no
15164 implementation-defined pragmas or other implementation-defined
15165 means for specifying needed units.
15168 @itemize *
15170 @item 
15171 "The manner of designating the main subprogram of a
15172 partition.  See 10.2(7)."
15173 @end itemize
15175 The main program is designated by providing the name of the
15176 corresponding @code{ALI} file as the input parameter to the binder.
15179 @itemize *
15181 @item 
15182 "The order of elaboration of @cite{library_items}.  See
15183 10.2(18)."
15184 @end itemize
15186 The first constraint on ordering is that it meets the requirements of
15187 Chapter 10 of the Ada Reference Manual.  This still leaves some
15188 implementation dependent choices, which are resolved by first
15189 elaborating bodies as early as possible (i.e., in preference to specs
15190 where there is a choice), and second by evaluating the immediate with
15191 clauses of a unit to determine the probably best choice, and
15192 third by elaborating in alphabetical order of unit names
15193 where a choice still remains.
15196 @itemize *
15198 @item 
15199 "Parameter passing and function return for the main
15200 subprogram.  See 10.2(21)."
15201 @end itemize
15203 The main program has no parameters.  It may be a procedure, or a function
15204 returning an integer type.  In the latter case, the returned integer
15205 value is the return code of the program (overriding any value that
15206 may have been set by a call to @cite{Ada.Command_Line.Set_Exit_Status}).
15209 @itemize *
15211 @item 
15212 "The mechanisms for building and running partitions.  See
15213 10.2(24)."
15214 @end itemize
15216 GNAT itself supports programs with only a single partition.  The GNATDIST
15217 tool provided with the GLADE package (which also includes an implementation
15218 of the PCS) provides a completely flexible method for building and running
15219 programs consisting of multiple partitions.  See the separate GLADE manual
15220 for details.
15223 @itemize *
15225 @item 
15226 "The details of program execution, including program
15227 termination.  See 10.2(25)."
15228 @end itemize
15230 See separate section on compilation model.
15233 @itemize *
15235 @item 
15236 "The semantics of any non-active partitions supported by the
15237 implementation.  See 10.2(28)."
15238 @end itemize
15240 Passive partitions are supported on targets where shared memory is
15241 provided by the operating system.  See the GLADE reference manual for
15242 further details.
15245 @itemize *
15247 @item 
15248 "The information returned by @cite{Exception_Message}.  See
15249 11.4.1(10)."
15250 @end itemize
15252 Exception message returns the null string unless a specific message has
15253 been passed by the program.
15256 @itemize *
15258 @item 
15259 "The result of @cite{Exceptions.Exception_Name} for types
15260 declared within an unnamed @cite{block_statement}.  See 11.4.1(12)."
15261 @end itemize
15263 Blocks have implementation defined names of the form @cite{B`nnn`}
15264 where @cite{nnn} is an integer.
15267 @itemize *
15269 @item 
15270 "The information returned by
15271 @cite{Exception_Information}.  See 11.4.1(13)."
15272 @end itemize
15274 @cite{Exception_Information} returns a string in the following format:
15276 @example
15277 *Exception_Name:* nnnnn
15278 *Message:* mmmmm
15279 *PID:* ppp
15280 *Load address:* 0xhhhh
15281 *Call stack traceback locations:*
15282 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
15283 @end example
15285 where
15287 @quotation
15290 @itemize *
15292 @item 
15293 @cite{nnnn} is the fully qualified name of the exception in all upper
15294 case letters. This line is always present.
15296 @item 
15297 @cite{mmmm} is the message (this line present only if message is non-null)
15299 @item 
15300 @cite{ppp} is the Process Id value as a decimal integer (this line is
15301 present only if the Process Id is nonzero). Currently we are
15302 not making use of this field.
15304 @item 
15305 The Load address line, the Call stack traceback locations line and the
15306 following values are present only if at least one traceback location was
15307 recorded. The Load address indicates the address at which the main executable
15308 was loaded; this line may not be present if operating system hasn't relocated
15309 the main executable. The values are given in C style format, with lower case
15310 letters for a-f, and only as many digits present as are necessary.
15311 The line terminator sequence at the end of each line, including
15312 the last line is a single @cite{LF} character (@cite{16#0A#}).
15313 @end itemize
15314 @end quotation
15317 @itemize *
15319 @item 
15320 "Implementation-defined check names.  See 11.5(27)."
15321 @end itemize
15323 The implementation defined check name Alignment_Check controls checking of
15324 address clause values for proper alignment (that is, the address supplied
15325 must be consistent with the alignment of the type).
15327 The implementation defined check name Predicate_Check controls whether
15328 predicate checks are generated.
15330 The implementation defined check name Validity_Check controls whether
15331 validity checks are generated.
15333 In addition, a user program can add implementation-defined check names
15334 by means of the pragma Check_Name.
15337 @itemize *
15339 @item 
15340 "The interpretation of each aspect of representation.  See
15341 13.1(20)."
15342 @end itemize
15344 See separate section on data representations.
15347 @itemize *
15349 @item 
15350 "Any restrictions placed upon representation items.  See
15351 13.1(20)."
15352 @end itemize
15354 See separate section on data representations.
15357 @itemize *
15359 @item 
15360 "The meaning of @cite{Size} for indefinite subtypes.  See
15361 13.3(48)."
15362 @end itemize
15364 Size for an indefinite subtype is the maximum possible size, except that
15365 for the case of a subprogram parameter, the size of the parameter object
15366 is the actual size.
15369 @itemize *
15371 @item 
15372 "The default external representation for a type tag.  See
15373 13.3(75)."
15374 @end itemize
15376 The default external representation for a type tag is the fully expanded
15377 name of the type in upper case letters.
15380 @itemize *
15382 @item 
15383 "What determines whether a compilation unit is the same in
15384 two different partitions.  See 13.3(76)."
15385 @end itemize
15387 A compilation unit is the same in two different partitions if and only
15388 if it derives from the same source file.
15391 @itemize *
15393 @item 
15394 "Implementation-defined components.  See 13.5.1(15)."
15395 @end itemize
15397 The only implementation defined component is the tag for a tagged type,
15398 which contains a pointer to the dispatching table.
15401 @itemize *
15403 @item 
15404 "If @cite{Word_Size} = @cite{Storage_Unit}, the default bit
15405 ordering.  See 13.5.3(5)."
15406 @end itemize
15408 @cite{Word_Size} (32) is not the same as @cite{Storage_Unit} (8) for this
15409 implementation, so no non-default bit ordering is supported.  The default
15410 bit ordering corresponds to the natural endianness of the target architecture.
15413 @itemize *
15415 @item 
15416 "The contents of the visible part of package @cite{System}
15417 and its language-defined children.  See 13.7(2)."
15418 @end itemize
15420 See the definition of these packages in files @code{system.ads} and
15421 @code{s-stoele.ads}. Note that two declarations are added to package
15422 System.
15424 @example
15425 Max_Priority           : constant Positive := Priority'Last;
15426 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
15427 @end example
15430 @itemize *
15432 @item 
15433 "The contents of the visible part of package
15434 @cite{System.Machine_Code}, and the meaning of
15435 @cite{code_statements}.  See 13.8(7)."
15436 @end itemize
15438 See the definition and documentation in file @code{s-maccod.ads}.
15441 @itemize *
15443 @item 
15444 "The effect of unchecked conversion.  See 13.9(11)."
15445 @end itemize
15447 Unchecked conversion between types of the same size
15448 results in an uninterpreted transmission of the bits from one type
15449 to the other.  If the types are of unequal sizes, then in the case of
15450 discrete types, a shorter source is first zero or sign extended as
15451 necessary, and a shorter target is simply truncated on the left.
15452 For all non-discrete types, the source is first copied if necessary
15453 to ensure that the alignment requirements of the target are met, then
15454 a pointer is constructed to the source value, and the result is obtained
15455 by dereferencing this pointer after converting it to be a pointer to the
15456 target type. Unchecked conversions where the target subtype is an
15457 unconstrained array are not permitted. If the target alignment is
15458 greater than the source alignment, then a copy of the result is
15459 made with appropriate alignment
15462 @itemize *
15464 @item 
15465 "The semantics of operations on invalid representations.
15466 See 13.9.2(10-11)."
15467 @end itemize
15469 For assignments and other operations where the use of invalid values cannot
15470 result in erroneous behavior, the compiler ignores the possibility of invalid
15471 values. An exception is raised at the point where an invalid value would
15472 result in erroneous behavior. For example executing:
15474 @example
15475 procedure invalidvals is
15476   X : Integer := -1;
15477   Y : Natural range 1 .. 10;
15478   for Y'Address use X'Address;
15479   Z : Natural range 1 .. 10;
15480   A : array (Natural range 1 .. 10) of Integer;
15481 begin
15482   Z := Y;     -- no exception
15483   A (Z) := 3; -- exception raised;
15484 end;
15485 @end example
15487 As indicated, an exception is raised on the array assignment, but not
15488 on the simple assignment of the invalid negative value from Y to Z.
15491 @itemize *
15493 @item 
15494 "The manner of choosing a storage pool for an access type
15495 when @cite{Storage_Pool} is not specified for the type.  See 13.11(17)."
15496 @end itemize
15498 There are 3 different standard pools used by the compiler when
15499 @cite{Storage_Pool} is not specified depending whether the type is local
15500 to a subprogram or defined at the library level and whether
15501 @cite{Storage_Size`is specified or not. See documentation in the runtime library units `System.Pool_Global}, @cite{System.Pool_Size} and
15502 @cite{System.Pool_Local} in files @code{s-poosiz.ads},
15503 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
15504 default pools used.
15507 @itemize *
15509 @item 
15510 "Whether or not the implementation provides user-accessible
15511 names for the standard pool type(s).  See 13.11(17)."
15512 @end itemize
15514 See documentation in the sources of the run time mentioned in the previous
15515 paragraph.  All these pools are accessible by means of @cite{with}'ing
15516 these units.
15519 @itemize *
15521 @item 
15522 "The meaning of @cite{Storage_Size}.  See 13.11(18)."
15523 @end itemize
15525 @cite{Storage_Size} is measured in storage units, and refers to the
15526 total space available for an access type collection, or to the primary
15527 stack space for a task.
15530 @itemize *
15532 @item 
15533 "Implementation-defined aspects of storage pools.  See
15534 13.11(22)."
15535 @end itemize
15537 See documentation in the sources of the run time mentioned in the
15538 paragraph about standard storage pools above
15539 for details on GNAT-defined aspects of storage pools.
15542 @itemize *
15544 @item 
15545 "The set of restrictions allowed in a pragma
15546 @cite{Restrictions}.  See 13.12(7)."
15547 @end itemize
15549 See @ref{9,,Standard and Implementation Defined Restrictions}.
15552 @itemize *
15554 @item 
15555 "The consequences of violating limitations on
15556 @cite{Restrictions} pragmas.  See 13.12(9)."
15557 @end itemize
15559 Restrictions that can be checked at compile time result in illegalities
15560 if violated.  Currently there are no other consequences of violating
15561 restrictions.
15564 @itemize *
15566 @item 
15567 "The representation used by the @cite{Read} and
15568 @cite{Write} attributes of elementary types in terms of stream
15569 elements.  See 13.13.2(9)."
15570 @end itemize
15572 The representation is the in-memory representation of the base type of
15573 the type, using the number of bits corresponding to the
15574 @code{type'Size} value, and the natural ordering of the machine.
15577 @itemize *
15579 @item 
15580 "The names and characteristics of the numeric subtypes
15581 declared in the visible part of package @cite{Standard}.  See A.1(3)."
15582 @end itemize
15584 See items describing the integer and floating-point types supported.
15587 @itemize *
15589 @item 
15590 "The string returned by @cite{Character_Set_Version}.
15591 See A.3.5(3)."
15592 @end itemize
15594 @cite{Ada.Wide_Characters.Handling.Character_Set_Version} returns
15595 the string "Unicode 4.0", referring to version 4.0 of the
15596 Unicode specification.
15599 @itemize *
15601 @item 
15602 "The accuracy actually achieved by the elementary
15603 functions.  See A.5.1(1)."
15604 @end itemize
15606 The elementary functions correspond to the functions available in the C
15607 library.  Only fast math mode is implemented.
15610 @itemize *
15612 @item 
15613 "The sign of a zero result from some of the operators or
15614 functions in @cite{Numerics.Generic_Elementary_Functions}, when
15615 @cite{Float_Type'Signed_Zeros} is @cite{True}.  See A.5.1(46)."
15616 @end itemize
15618 The sign of zeroes follows the requirements of the IEEE 754 standard on
15619 floating-point.
15622 @itemize *
15624 @item 
15625 "The value of
15626 @cite{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27)."
15627 @end itemize
15629 Maximum image width is 6864, see library file @code{s-rannum.ads}.
15632 @itemize *
15634 @item 
15635 "The value of
15636 @cite{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27)."
15637 @end itemize
15639 Maximum image width is 6864, see library file @code{s-rannum.ads}.
15642 @itemize *
15644 @item 
15645 "The algorithms for random number generation.  See
15646 A.5.2(32)."
15647 @end itemize
15649 The algorithm is the Mersenne Twister, as documented in the source file
15650 @code{s-rannum.adb}. This version of the algorithm has a period of
15651 2**19937-1.
15654 @itemize *
15656 @item 
15657 "The string representation of a random number generator's
15658 state.  See A.5.2(38)."
15659 @end itemize
15661 The value returned by the Image function is the concatenation of
15662 the fixed-width decimal representations of the 624 32-bit integers
15663 of the state vector.
15666 @itemize *
15668 @item 
15669 "The minimum time interval between calls to the
15670 time-dependent Reset procedure that are guaranteed to initiate different
15671 random number sequences.  See A.5.2(45)."
15672 @end itemize
15674 The minimum period between reset calls to guarantee distinct series of
15675 random numbers is one microsecond.
15678 @itemize *
15680 @item 
15681 "The values of the @cite{Model_Mantissa},
15682 @cite{Model_Emin}, @cite{Model_Epsilon}, @cite{Model},
15683 @cite{Safe_First}, and @cite{Safe_Last} attributes, if the Numerics
15684 Annex is not supported.  See A.5.3(72)."
15685 @end itemize
15687 Run the compiler with @emph{-gnatS} to produce a listing of package
15688 @cite{Standard}, has the values of all numeric attributes.
15691 @itemize *
15693 @item 
15694 "Any implementation-defined characteristics of the
15695 input-output packages.  See A.7(14)."
15696 @end itemize
15698 There are no special implementation defined characteristics for these
15699 packages.
15702 @itemize *
15704 @item 
15705 "The value of @cite{Buffer_Size} in @cite{Storage_IO}.  See
15706 A.9(10)."
15707 @end itemize
15709 All type representations are contiguous, and the @cite{Buffer_Size} is
15710 the value of @code{type'Size} rounded up to the next storage unit
15711 boundary.
15714 @itemize *
15716 @item 
15717 "External files for standard input, standard output, and
15718 standard error See A.10(5)."
15719 @end itemize
15721 These files are mapped onto the files provided by the C streams
15722 libraries.  See source file @code{i-cstrea.ads} for further details.
15725 @itemize *
15727 @item 
15728 "The accuracy of the value produced by @cite{Put}.  See
15729 A.10.9(36)."
15730 @end itemize
15732 If more digits are requested in the output than are represented by the
15733 precision of the value, zeroes are output in the corresponding least
15734 significant digit positions.
15737 @itemize *
15739 @item 
15740 "The meaning of @cite{Argument_Count}, @cite{Argument}, and
15741 @cite{Command_Name}.  See A.15(1)."
15742 @end itemize
15744 These are mapped onto the @cite{argv} and @cite{argc} parameters of the
15745 main program in the natural manner.
15748 @itemize *
15750 @item 
15751 "The interpretation of the @cite{Form} parameter in procedure
15752 @cite{Create_Directory}.  See A.16(56)."
15753 @end itemize
15755 The @cite{Form} parameter is not used.
15758 @itemize *
15760 @item 
15761 "The interpretation of the @cite{Form} parameter in procedure
15762 @cite{Create_Path}.  See A.16(60)."
15763 @end itemize
15765 The @cite{Form} parameter is not used.
15768 @itemize *
15770 @item 
15771 "The interpretation of the @cite{Form} parameter in procedure
15772 @cite{Copy_File}.  See A.16(68)."
15773 @end itemize
15775 The @cite{Form} parameter is case-insensitive.
15776 Two fields are recognized in the @cite{Form} parameter:
15778 @example
15779 *preserve=<value>*
15780 *mode=<value>*
15781 @end example
15783 <value> starts immediately after the character '=' and ends with the
15784 character immediately preceding the next comma (',') or with the last
15785 character of the parameter.
15787 The only possible values for preserve= are:
15790 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15791 @headitem
15793 Value
15795 @tab
15797 Meaning
15799 @item
15801 @emph{no_attributes}
15803 @tab
15805 Do not try to preserve any file attributes. This is the
15806 default if no preserve= is found in Form.
15808 @item
15810 @emph{all_attributes}
15812 @tab
15814 Try to preserve all file attributes (timestamps, access rights).
15816 @item
15818 @emph{timestamps}
15820 @tab
15822 Preserve the timestamp of the copied file, but not the other
15823 file attributes.
15825 @end multitable
15828 The only possible values for mode= are:
15831 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15832 @headitem
15834 Value
15836 @tab
15838 Meaning
15840 @item
15842 @emph{copy}
15844 @tab
15846 Only do the copy if the destination file does not already exist.
15847 If it already exists, Copy_File fails.
15849 @item
15851 @emph{overwrite}
15853 @tab
15855 Copy the file in all cases. Overwrite an already existing destination file.
15857 @item
15859 @emph{append}
15861 @tab
15863 Append the original file to the destination file. If the destination file
15864 does not exist, the destination file is a copy of the source file.
15865 When mode=append, the field preserve=, if it exists, is not taken into account.
15867 @end multitable
15870 If the Form parameter includes one or both of the fields and the value or
15871 values are incorrect, Copy_file fails with Use_Error.
15873 Examples of correct Forms:
15875 @example
15876 Form => "preserve=no_attributes,mode=overwrite" (the default)
15877 Form => "mode=append"
15878 Form => "mode=copy, preserve=all_attributes"
15879 @end example
15881 Examples of incorrect Forms:
15883 @example
15884 Form => "preserve=junk"
15885 Form => "mode=internal, preserve=timestamps"
15886 @end example
15889 @itemize *
15891 @item 
15892 "The interpretation of the @cite{Pattern} parameter, when not the null string,
15893 in the @cite{Start_Search} and @cite{Search} procedures.
15894 See A.16(104) and A.16(112)."
15895 @end itemize
15897 When the @cite{Pattern} parameter is not the null string, it is interpreted
15898 according to the syntax of regular expressions as defined in the
15899 @cite{GNAT.Regexp} package.
15901 See @ref{201,,GNAT.Regexp (g-regexp.ads)}.
15904 @itemize *
15906 @item 
15907 "Implementation-defined convention names.  See B.1(11)."
15908 @end itemize
15910 The following convention names are supported
15913 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15914 @headitem
15916 Convention Name
15918 @tab
15920 Interpretation
15922 @item
15924 @emph{Ada}
15926 @tab
15930 @item
15932 @emph{Ada_Pass_By_Copy}
15934 @tab
15936 Allowed for any types except by-reference types such as limited
15937 records. Compatible with convention Ada, but causes any parameters
15938 with this convention to be passed by copy.
15940 @item
15942 @emph{Ada_Pass_By_Reference}
15944 @tab
15946 Allowed for any types except by-copy types such as scalars.
15947 Compatible with convention Ada, but causes any parameters
15948 with this convention to be passed by reference.
15950 @item
15952 @emph{Assembler}
15954 @tab
15956 Assembly language
15958 @item
15960 @emph{Asm}
15962 @tab
15964 Synonym for Assembler
15966 @item
15968 @emph{Assembly}
15970 @tab
15972 Synonym for Assembler
15974 @item
15976 @emph{C}
15978 @tab
15982 @item
15984 @emph{C_Pass_By_Copy}
15986 @tab
15988 Allowed only for record types, like C, but also notes that record
15989 is to be passed by copy rather than reference.
15991 @item
15993 @emph{COBOL}
15995 @tab
15997 COBOL
15999 @item
16001 @emph{C_Plus_Plus (or CPP)}
16003 @tab
16007 @item
16009 @emph{Default}
16011 @tab
16013 Treated the same as C
16015 @item
16017 @emph{External}
16019 @tab
16021 Treated the same as C
16023 @item
16025 @emph{Fortran}
16027 @tab
16029 Fortran
16031 @item
16033 @emph{Intrinsic}
16035 @tab
16037 For support of pragma @cite{Import} with convention Intrinsic, see
16038 separate section on Intrinsic Subprograms.
16040 @item
16042 @emph{Stdcall}
16044 @tab
16046 Stdcall (used for Windows implementations only).  This convention correspond
16047 to the WINAPI (previously called Pascal convention) C/C++ convention under
16048 Windows.  A routine with this convention cleans the stack before
16049 exit. This pragma cannot be applied to a dispatching call.
16051 @item
16053 @emph{DLL}
16055 @tab
16057 Synonym for Stdcall
16059 @item
16061 @emph{Win32}
16063 @tab
16065 Synonym for Stdcall
16067 @item
16069 @emph{Stubbed}
16071 @tab
16073 Stubbed is a special convention used to indicate that the body of the
16074 subprogram will be entirely ignored.  Any call to the subprogram
16075 is converted into a raise of the @cite{Program_Error} exception.  If a
16076 pragma @cite{Import} specifies convention @cite{stubbed} then no body need
16077 be present at all.  This convention is useful during development for the
16078 inclusion of subprograms whose body has not yet been written.
16079 In addition, all otherwise unrecognized convention names are also
16080 treated as being synonymous with convention C.  In all implementations
16081 except for VMS, use of such other names results in a warning.  In VMS
16082 implementations, these names are accepted silently.
16084 @end multitable
16088 @itemize *
16090 @item 
16091 "The meaning of link names.  See B.1(36)."
16092 @end itemize
16094 Link names are the actual names used by the linker.
16097 @itemize *
16099 @item 
16100 "The manner of choosing link names when neither the link
16101 name nor the address of an imported or exported entity is specified.  See
16102 B.1(36)."
16103 @end itemize
16105 The default linker name is that which would be assigned by the relevant
16106 external language, interpreting the Ada name as being in all lower case
16107 letters.
16110 @itemize *
16112 @item 
16113 "The effect of pragma @cite{Linker_Options}.  See B.1(37)."
16114 @end itemize
16116 The string passed to @cite{Linker_Options} is presented uninterpreted as
16117 an argument to the link command, unless it contains ASCII.NUL characters.
16118 NUL characters if they appear act as argument separators, so for example
16120 @example
16121 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
16122 @end example
16124 causes two separate arguments @cite{-labc} and @cite{-ldef} to be passed to the
16125 linker. The order of linker options is preserved for a given unit. The final
16126 list of options passed to the linker is in reverse order of the elaboration
16127 order. For example, linker options for a body always appear before the options
16128 from the corresponding package spec.
16131 @itemize *
16133 @item 
16134 "The contents of the visible part of package
16135 @cite{Interfaces} and its language-defined descendants.  See B.2(1)."
16136 @end itemize
16138 See files with prefix @code{i-} in the distributed library.
16141 @itemize *
16143 @item 
16144 "Implementation-defined children of package
16145 @cite{Interfaces}.  The contents of the visible part of package
16146 @cite{Interfaces}.  See B.2(11)."
16147 @end itemize
16149 See files with prefix @code{i-} in the distributed library.
16152 @itemize *
16154 @item 
16155 "The types @cite{Floating}, @cite{Long_Floating},
16156 @cite{Binary}, @cite{Long_Binary}, @cite{Decimal_ Element}, and
16157 @cite{COBOL_Character}; and the initialization of the variables
16158 @cite{Ada_To_COBOL} and @cite{COBOL_To_Ada}, in
16159 @cite{Interfaces.COBOL}.  See B.4(50)."
16160 @end itemize
16163 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16164 @headitem
16166 COBOL
16168 @tab
16172 @item
16174 @emph{Floating}
16176 @tab
16178 Float
16180 @item
16182 @emph{Long_Floating}
16184 @tab
16186 (Floating) Long_Float
16188 @item
16190 @emph{Binary}
16192 @tab
16194 Integer
16196 @item
16198 @emph{Long_Binary}
16200 @tab
16202 Long_Long_Integer
16204 @item
16206 @emph{Decimal_Element}
16208 @tab
16210 Character
16212 @item
16214 @emph{COBOL_Character}
16216 @tab
16218 Character
16220 @end multitable
16223 For initialization, see the file @code{i-cobol.ads} in the distributed library.
16226 @itemize *
16228 @item 
16229 "Support for access to machine instructions.  See C.1(1)."
16230 @end itemize
16232 See documentation in file @code{s-maccod.ads} in the distributed library.
16235 @itemize *
16237 @item 
16238 "Implementation-defined aspects of access to machine
16239 operations.  See C.1(9)."
16240 @end itemize
16242 See documentation in file @code{s-maccod.ads} in the distributed library.
16245 @itemize *
16247 @item 
16248 "Implementation-defined aspects of interrupts.  See C.3(2)."
16249 @end itemize
16251 Interrupts are mapped to signals or conditions as appropriate.  See
16252 definition of unit
16253 @cite{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
16254 on the interrupts supported on a particular target.
16257 @itemize *
16259 @item 
16260 "Implementation-defined aspects of pre-elaboration.  See
16261 C.4(13)."
16262 @end itemize
16264 GNAT does not permit a partition to be restarted without reloading,
16265 except under control of the debugger.
16268 @itemize *
16270 @item 
16271 "The semantics of pragma @cite{Discard_Names}.  See C.5(7)."
16272 @end itemize
16274 Pragma @cite{Discard_Names} causes names of enumeration literals to
16275 be suppressed.  In the presence of this pragma, the Image attribute
16276 provides the image of the Pos of the literal, and Value accepts
16277 Pos values.
16280 @itemize *
16282 @item 
16283 "The result of the @cite{Task_Identification.Image}
16284 attribute.  See C.7.1(7)."
16285 @end itemize
16287 The result of this attribute is a string that identifies
16288 the object or component that denotes a given task. If a variable @cite{Var}
16289 has a task type, the image for this task will have the form @cite{Var_`XXXXXXXX`},
16290 where the suffix
16291 is the hexadecimal representation of the virtual address of the corresponding
16292 task control block. If the variable is an array of tasks, the image of each
16293 task will have the form of an indexed component indicating the position of a
16294 given task in the array, e.g., @cite{Group(5)_`XXXXXXX`}. If the task is a
16295 component of a record, the image of the task will have the form of a selected
16296 component. These rules are fully recursive, so that the image of a task that
16297 is a subcomponent of a composite object corresponds to the expression that
16298 designates this task.
16300 If a task is created by an allocator, its image depends on the context. If the
16301 allocator is part of an object declaration, the rules described above are used
16302 to construct its image, and this image is not affected by subsequent
16303 assignments. If the allocator appears within an expression, the image
16304 includes only the name of the task type.
16306 If the configuration pragma Discard_Names is present, or if the restriction
16307 No_Implicit_Heap_Allocation is in effect,  the image reduces to
16308 the numeric suffix, that is to say the hexadecimal representation of the
16309 virtual address of the control block of the task.
16312 @itemize *
16314 @item 
16315 "The value of @cite{Current_Task} when in a protected entry
16316 or interrupt handler.  See C.7.1(17)."
16317 @end itemize
16319 Protected entries or interrupt handlers can be executed by any
16320 convenient thread, so the value of @cite{Current_Task} is undefined.
16323 @itemize *
16325 @item 
16326 "The effect of calling @cite{Current_Task} from an entry
16327 body or interrupt handler.  See C.7.1(19)."
16328 @end itemize
16330 The effect of calling @cite{Current_Task} from an entry body or
16331 interrupt handler is to return the identification of the task currently
16332 executing the code.
16335 @itemize *
16337 @item 
16338 "Implementation-defined aspects of
16339 @cite{Task_Attributes}.  See C.7.2(19)."
16340 @end itemize
16342 There are no implementation-defined aspects of @cite{Task_Attributes}.
16345 @itemize *
16347 @item 
16348 "Values of all @cite{Metrics}.  See D(2)."
16349 @end itemize
16351 The metrics information for GNAT depends on the performance of the
16352 underlying operating system.  The sources of the run-time for tasking
16353 implementation, together with the output from @emph{-gnatG} can be
16354 used to determine the exact sequence of operating systems calls made
16355 to implement various tasking constructs.  Together with appropriate
16356 information on the performance of the underlying operating system,
16357 on the exact target in use, this information can be used to determine
16358 the required metrics.
16361 @itemize *
16363 @item 
16364 "The declarations of @cite{Any_Priority} and
16365 @cite{Priority}.  See D.1(11)."
16366 @end itemize
16368 See declarations in file @code{system.ads}.
16371 @itemize *
16373 @item 
16374 "Implementation-defined execution resources.  See D.1(15)."
16375 @end itemize
16377 There are no implementation-defined execution resources.
16380 @itemize *
16382 @item 
16383 "Whether, on a multiprocessor, a task that is waiting for
16384 access to a protected object keeps its processor busy.  See D.2.1(3)."
16385 @end itemize
16387 On a multi-processor, a task that is waiting for access to a protected
16388 object does not keep its processor busy.
16391 @itemize *
16393 @item 
16394 "The affect of implementation defined execution resources
16395 on task dispatching.  See D.2.1(9)."
16396 @end itemize
16398 Tasks map to threads in the threads package used by GNAT.  Where possible
16399 and appropriate, these threads correspond to native threads of the
16400 underlying operating system.
16403 @itemize *
16405 @item 
16406 "Implementation-defined @cite{policy_identifiers} allowed
16407 in a pragma @cite{Task_Dispatching_Policy}.  See D.2.2(3)."
16408 @end itemize
16410 There are no implementation-defined policy-identifiers allowed in this
16411 pragma.
16414 @itemize *
16416 @item 
16417 "Implementation-defined aspects of priority inversion.  See
16418 D.2.2(16)."
16419 @end itemize
16421 Execution of a task cannot be preempted by the implementation processing
16422 of delay expirations for lower priority tasks.
16425 @itemize *
16427 @item 
16428 "Implementation-defined task dispatching.  See D.2.2(18)."
16429 @end itemize
16431 The policy is the same as that of the underlying threads implementation.
16434 @itemize *
16436 @item 
16437 "Implementation-defined @cite{policy_identifiers} allowed
16438 in a pragma @cite{Locking_Policy}.  See D.3(4)."
16439 @end itemize
16441 The two implementation defined policies permitted in GNAT are
16442 @cite{Inheritance_Locking} and  @cite{Conccurent_Readers_Locking}.  On
16443 targets that support the @cite{Inheritance_Locking} policy, locking is
16444 implemented by inheritance, i.e., the task owning the lock operates
16445 at a priority equal to the highest priority of any task currently
16446 requesting the lock.  On targets that support the
16447 @cite{Conccurent_Readers_Locking} policy, locking is implemented with a
16448 read/write lock allowing multiple propected object functions to enter
16449 concurrently.
16452 @itemize *
16454 @item 
16455 "Default ceiling priorities.  See D.3(10)."
16456 @end itemize
16458 The ceiling priority of protected objects of the type
16459 @cite{System.Interrupt_Priority'Last} as described in the Ada
16460 Reference Manual D.3(10),
16463 @itemize *
16465 @item 
16466 "The ceiling of any protected object used internally by
16467 the implementation.  See D.3(16)."
16468 @end itemize
16470 The ceiling priority of internal protected objects is
16471 @cite{System.Priority'Last}.
16474 @itemize *
16476 @item 
16477 "Implementation-defined queuing policies.  See D.4(1)."
16478 @end itemize
16480 There are no implementation-defined queuing policies.
16483 @itemize *
16485 @item 
16486 "On a multiprocessor, any conditions that cause the
16487 completion of an aborted construct to be delayed later than what is
16488 specified for a single processor.  See D.6(3)."
16489 @end itemize
16491 The semantics for abort on a multi-processor is the same as on a single
16492 processor, there are no further delays.
16495 @itemize *
16497 @item 
16498 "Any operations that implicitly require heap storage
16499 allocation.  See D.7(8)."
16500 @end itemize
16502 The only operation that implicitly requires heap storage allocation is
16503 task creation.
16506 @itemize *
16508 @item 
16509 "What happens when a task terminates in the presence of
16510 pragma @cite{No_Task_Termination}. See D.7(15)."
16511 @end itemize
16513 Execution is erroneous in that case.
16516 @itemize *
16518 @item 
16519 "Implementation-defined aspects of pragma
16520 @cite{Restrictions}.  See D.7(20)."
16521 @end itemize
16523 There are no such implementation-defined aspects.
16526 @itemize *
16528 @item 
16529 "Implementation-defined aspects of package
16530 @cite{Real_Time}.  See D.8(17)."
16531 @end itemize
16533 There are no implementation defined aspects of package @cite{Real_Time}.
16536 @itemize *
16538 @item 
16539 "Implementation-defined aspects of
16540 @cite{delay_statements}.  See D.9(8)."
16541 @end itemize
16543 Any difference greater than one microsecond will cause the task to be
16544 delayed (see D.9(7)).
16547 @itemize *
16549 @item 
16550 "The upper bound on the duration of interrupt blocking
16551 caused by the implementation.  See D.12(5)."
16552 @end itemize
16554 The upper bound is determined by the underlying operating system.  In
16555 no cases is it more than 10 milliseconds.
16558 @itemize *
16560 @item 
16561 "The means for creating and executing distributed
16562 programs.  See E(5)."
16563 @end itemize
16565 The GLADE package provides a utility GNATDIST for creating and executing
16566 distributed programs.  See the GLADE reference manual for further details.
16569 @itemize *
16571 @item 
16572 "Any events that can result in a partition becoming
16573 inaccessible.  See E.1(7)."
16574 @end itemize
16576 See the GLADE reference manual for full details on such events.
16579 @itemize *
16581 @item 
16582 "The scheduling policies, treatment of priorities, and
16583 management of shared resources between partitions in certain cases.  See
16584 E.1(11)."
16585 @end itemize
16587 See the GLADE reference manual for full details on these aspects of
16588 multi-partition execution.
16591 @itemize *
16593 @item 
16594 "Events that cause the version of a compilation unit to
16595 change.  See E.3(5)."
16596 @end itemize
16598 Editing the source file of a compilation unit, or the source files of
16599 any units on which it is dependent in a significant way cause the version
16600 to change.  No other actions cause the version number to change.  All changes
16601 are significant except those which affect only layout, capitalization or
16602 comments.
16605 @itemize *
16607 @item 
16608 "Whether the execution of the remote subprogram is
16609 immediately aborted as a result of cancellation.  See E.4(13)."
16610 @end itemize
16612 See the GLADE reference manual for details on the effect of abort in
16613 a distributed application.
16616 @itemize *
16618 @item 
16619 "Implementation-defined aspects of the PCS.  See E.5(25)."
16620 @end itemize
16622 See the GLADE reference manual for a full description of all implementation
16623 defined aspects of the PCS.
16626 @itemize *
16628 @item 
16629 "Implementation-defined interfaces in the PCS.  See
16630 E.5(26)."
16631 @end itemize
16633 See the GLADE reference manual for a full description of all
16634 implementation defined interfaces.
16637 @itemize *
16639 @item 
16640 "The values of named numbers in the package
16641 @cite{Decimal}.  See F.2(7)."
16642 @end itemize
16645 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
16646 @headitem
16648 Named Number
16650 @tab
16652 Value
16654 @item
16656 @emph{Max_Scale}
16658 @tab
16662 @item
16664 @emph{Min_Scale}
16666 @tab
16670 @item
16672 @emph{Min_Delta}
16674 @tab
16676 1.0E-18
16678 @item
16680 @emph{Max_Delta}
16682 @tab
16684 1.0E+18
16686 @item
16688 @emph{Max_Decimal_Digits}
16690 @tab
16694 @end multitable
16698 @itemize *
16700 @item 
16701 "The value of @cite{Max_Picture_Length} in the package
16702 @cite{Text_IO.Editing}.  See F.3.3(16)."
16703 @end itemize
16708 @itemize *
16710 @item 
16711 "The value of @cite{Max_Picture_Length} in the package
16712 @cite{Wide_Text_IO.Editing}.  See F.3.4(5)."
16713 @end itemize
16718 @itemize *
16720 @item 
16721 "The accuracy actually achieved by the complex elementary
16722 functions and by other complex arithmetic operations.  See G.1(1)."
16723 @end itemize
16725 Standard library functions are used for the complex arithmetic
16726 operations.  Only fast math mode is currently supported.
16729 @itemize *
16731 @item 
16732 "The sign of a zero result (or a component thereof) from
16733 any operator or function in @cite{Numerics.Generic_Complex_Types}, when
16734 @cite{Real'Signed_Zeros} is True.  See G.1.1(53)."
16735 @end itemize
16737 The signs of zero values are as recommended by the relevant
16738 implementation advice.
16741 @itemize *
16743 @item 
16744 "The sign of a zero result (or a component thereof) from
16745 any operator or function in
16746 @cite{Numerics.Generic_Complex_Elementary_Functions}, when
16747 @cite{Real'Signed_Zeros} is @cite{True}.  See G.1.2(45)."
16748 @end itemize
16750 The signs of zero values are as recommended by the relevant
16751 implementation advice.
16754 @itemize *
16756 @item 
16757 "Whether the strict mode or the relaxed mode is the
16758 default.  See G.2(2)."
16759 @end itemize
16761 The strict mode is the default.  There is no separate relaxed mode.  GNAT
16762 provides a highly efficient implementation of strict mode.
16765 @itemize *
16767 @item 
16768 "The result interval in certain cases of fixed-to-float
16769 conversion.  See G.2.1(10)."
16770 @end itemize
16772 For cases where the result interval is implementation dependent, the
16773 accuracy is that provided by performing all operations in 64-bit IEEE
16774 floating-point format.
16777 @itemize *
16779 @item 
16780 "The result of a floating point arithmetic operation in
16781 overflow situations, when the @cite{Machine_Overflows} attribute of the
16782 result type is @cite{False}.  See G.2.1(13)."
16783 @end itemize
16785 Infinite and NaN values are produced as dictated by the IEEE
16786 floating-point standard.
16787 Note that on machines that are not fully compliant with the IEEE
16788 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
16789 must be used for achieving IEEE conforming behavior (although at the cost
16790 of a significant performance penalty), so infinite and NaN values are
16791 properly generated.
16794 @itemize *
16796 @item 
16797 "The result interval for division (or exponentiation by a
16798 negative exponent), when the floating point hardware implements division
16799 as multiplication by a reciprocal.  See G.2.1(16)."
16800 @end itemize
16802 Not relevant, division is IEEE exact.
16805 @itemize *
16807 @item 
16808 "The definition of close result set, which determines the
16809 accuracy of certain fixed point multiplications and divisions.  See
16810 G.2.3(5)."
16811 @end itemize
16813 Operations in the close result set are performed using IEEE long format
16814 floating-point arithmetic.  The input operands are converted to
16815 floating-point, the operation is done in floating-point, and the result
16816 is converted to the target type.
16819 @itemize *
16821 @item 
16822 "Conditions on a @cite{universal_real} operand of a fixed
16823 point multiplication or division for which the result shall be in the
16824 perfect result set.  See G.2.3(22)."
16825 @end itemize
16827 The result is only defined to be in the perfect result set if the result
16828 can be computed by a single scaling operation involving a scale factor
16829 representable in 64-bits.
16832 @itemize *
16834 @item 
16835 "The result of a fixed point arithmetic operation in
16836 overflow situations, when the @cite{Machine_Overflows} attribute of the
16837 result type is @cite{False}.  See G.2.3(27)."
16838 @end itemize
16840 Not relevant, @cite{Machine_Overflows} is @cite{True} for fixed-point
16841 types.
16844 @itemize *
16846 @item 
16847 "The result of an elementary function reference in
16848 overflow situations, when the @cite{Machine_Overflows} attribute of the
16849 result type is @cite{False}.  See G.2.4(4)."
16850 @end itemize
16852 IEEE infinite and Nan values are produced as appropriate.
16855 @itemize *
16857 @item 
16858 "The value of the angle threshold, within which certain
16859 elementary functions, complex arithmetic operations, and complex
16860 elementary functions yield results conforming to a maximum relative
16861 error bound.  See G.2.4(10)."
16862 @end itemize
16864 Information on this subject is not yet available.
16867 @itemize *
16869 @item 
16870 "The accuracy of certain elementary functions for
16871 parameters beyond the angle threshold.  See G.2.4(10)."
16872 @end itemize
16874 Information on this subject is not yet available.
16877 @itemize *
16879 @item 
16880 "The result of a complex arithmetic operation or complex
16881 elementary function reference in overflow situations, when the
16882 @cite{Machine_Overflows} attribute of the corresponding real type is
16883 @cite{False}.  See G.2.6(5)."
16884 @end itemize
16886 IEEE infinite and Nan values are produced as appropriate.
16889 @itemize *
16891 @item 
16892 "The accuracy of certain complex arithmetic operations and
16893 certain complex elementary functions for parameters (or components
16894 thereof) beyond the angle threshold.  See G.2.6(8)."
16895 @end itemize
16897 Information on those subjects is not yet available.
16900 @itemize *
16902 @item 
16903 "Information regarding bounded errors and erroneous
16904 execution.  See H.2(1)."
16905 @end itemize
16907 Information on this subject is not yet available.
16910 @itemize *
16912 @item 
16913 "Implementation-defined aspects of pragma
16914 @cite{Inspection_Point}.  See H.3.2(8)."
16915 @end itemize
16917 Pragma @cite{Inspection_Point} ensures that the variable is live and can
16918 be examined by the debugger at the inspection point.
16921 @itemize *
16923 @item 
16924 "Implementation-defined aspects of pragma
16925 @cite{Restrictions}.  See H.4(25)."
16926 @end itemize
16928 There are no implementation-defined aspects of pragma @cite{Restrictions}.  The
16929 use of pragma @cite{Restrictions [No_Exceptions]} has no effect on the
16930 generated code.  Checks must suppressed by use of pragma @cite{Suppress}.
16933 @itemize *
16935 @item 
16936 "Any restrictions on pragma @cite{Restrictions}.  See
16937 H.4(27)."
16938 @end itemize
16940 There are no restrictions on pragma @cite{Restrictions}.
16942 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
16943 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{202}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{203}
16944 @chapter Intrinsic Subprograms
16947 @geindex Intrinsic Subprograms
16949 GNAT allows a user application program to write the declaration:
16951 @example
16952 pragma Import (Intrinsic, name);
16953 @end example
16955 providing that the name corresponds to one of the implemented intrinsic
16956 subprograms in GNAT, and that the parameter profile of the referenced
16957 subprogram meets the requirements.  This chapter describes the set of
16958 implemented intrinsic subprograms, and the requirements on parameter profiles.
16959 Note that no body is supplied; as with other uses of pragma Import, the
16960 body is supplied elsewhere (in this case by the compiler itself).  Note
16961 that any use of this feature is potentially non-portable, since the
16962 Ada standard does not require Ada compilers to implement this feature.
16964 @menu
16965 * Intrinsic Operators:: 
16966 * Compilation_Date:: 
16967 * Compilation_Time:: 
16968 * Enclosing_Entity:: 
16969 * Exception_Information:: 
16970 * Exception_Message:: 
16971 * Exception_Name:: 
16972 * File:: 
16973 * Line:: 
16974 * Shifts and Rotates:: 
16975 * Source_Location:: 
16977 @end menu
16979 @node Intrinsic Operators,Compilation_Date,,Intrinsic Subprograms
16980 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{204}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{205}
16981 @section Intrinsic Operators
16984 @geindex Intrinsic operator
16986 All the predefined numeric operators in package Standard
16987 in @cite{pragma Import (Intrinsic@comma{}..)}
16988 declarations.  In the binary operator case, the operands must have the same
16989 size.  The operand or operands must also be appropriate for
16990 the operator.  For example, for addition, the operands must
16991 both be floating-point or both be fixed-point, and the
16992 right operand for @cite{"**"} must have a root type of
16993 @cite{Standard.Integer'Base}.
16994 You can use an intrinsic operator declaration as in the following example:
16996 @example
16997 type Int1 is new Integer;
16998 type Int2 is new Integer;
17000 function "+" (X1 : Int1; X2 : Int2) return Int1;
17001 function "+" (X1 : Int1; X2 : Int2) return Int2;
17002 pragma Import (Intrinsic, "+");
17003 @end example
17005 This declaration would permit 'mixed mode' arithmetic on items
17006 of the differing types @cite{Int1} and @cite{Int2}.
17007 It is also possible to specify such operators for private types, if the
17008 full views are appropriate arithmetic types.
17010 @node Compilation_Date,Compilation_Time,Intrinsic Operators,Intrinsic Subprograms
17011 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{206}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{207}
17012 @section Compilation_Date
17015 @geindex Compilation_Date
17017 This intrinsic subprogram is used in the implementation of the
17018 library package @cite{GNAT.Source_Info}.  The only useful use of the
17019 intrinsic import in this case is the one in this unit, so an
17020 application program should simply call the function
17021 @cite{GNAT.Source_Info.Compilation_Date} to obtain the date of
17022 the current compilation (in local time format MMM DD YYYY).
17024 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
17025 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{208}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{209}
17026 @section Compilation_Time
17029 @geindex Compilation_Time
17031 This intrinsic subprogram is used in the implementation of the
17032 library package @cite{GNAT.Source_Info}.  The only useful use of the
17033 intrinsic import in this case is the one in this unit, so an
17034 application program should simply call the function
17035 @cite{GNAT.Source_Info.Compilation_Time} to obtain the time of
17036 the current compilation (in local time format HH:MM:SS).
17038 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
17039 @anchor{gnat_rm/intrinsic_subprograms id5}@anchor{20a}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{20b}
17040 @section Enclosing_Entity
17043 @geindex Enclosing_Entity
17045 This intrinsic subprogram is used in the implementation of the
17046 library package @cite{GNAT.Source_Info}.  The only useful use of the
17047 intrinsic import in this case is the one in this unit, so an
17048 application program should simply call the function
17049 @cite{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
17050 the current subprogram, package, task, entry, or protected subprogram.
17052 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
17053 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{20c}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{20d}
17054 @section Exception_Information
17057 @geindex Exception_Information'
17059 This intrinsic subprogram is used in the implementation of the
17060 library package @cite{GNAT.Current_Exception}.  The only useful
17061 use of the intrinsic import in this case is the one in this unit,
17062 so an application program should simply call the function
17063 @cite{GNAT.Current_Exception.Exception_Information} to obtain
17064 the exception information associated with the current exception.
17066 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
17067 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{20e}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{20f}
17068 @section Exception_Message
17071 @geindex Exception_Message
17073 This intrinsic subprogram is used in the implementation of the
17074 library package @cite{GNAT.Current_Exception}.  The only useful
17075 use of the intrinsic import in this case is the one in this unit,
17076 so an application program should simply call the function
17077 @cite{GNAT.Current_Exception.Exception_Message} to obtain
17078 the message associated with the current exception.
17080 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
17081 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{210}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{211}
17082 @section Exception_Name
17085 @geindex Exception_Name
17087 This intrinsic subprogram is used in the implementation of the
17088 library package @cite{GNAT.Current_Exception}.  The only useful
17089 use of the intrinsic import in this case is the one in this unit,
17090 so an application program should simply call the function
17091 @cite{GNAT.Current_Exception.Exception_Name} to obtain
17092 the name of the current exception.
17094 @node File,Line,Exception_Name,Intrinsic Subprograms
17095 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{212}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{213}
17096 @section File
17099 @geindex File
17101 This intrinsic subprogram is used in the implementation of the
17102 library package @cite{GNAT.Source_Info}.  The only useful use of the
17103 intrinsic import in this case is the one in this unit, so an
17104 application program should simply call the function
17105 @cite{GNAT.Source_Info.File} to obtain the name of the current
17106 file.
17108 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
17109 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{214}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{215}
17110 @section Line
17113 @geindex Line
17115 This intrinsic subprogram is used in the implementation of the
17116 library package @cite{GNAT.Source_Info}.  The only useful use of the
17117 intrinsic import in this case is the one in this unit, so an
17118 application program should simply call the function
17119 @cite{GNAT.Source_Info.Line} to obtain the number of the current
17120 source line.
17122 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
17123 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{216}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{217}
17124 @section Shifts and Rotates
17127 @geindex Shift_Left
17129 @geindex Shift_Right
17131 @geindex Shift_Right_Arithmetic
17133 @geindex Rotate_Left
17135 @geindex Rotate_Right
17137 In standard Ada, the shift and rotate functions are available only
17138 for the predefined modular types in package @cite{Interfaces}.  However, in
17139 GNAT it is possible to define these functions for any integer
17140 type (signed or modular), as in this example:
17142 @example
17143 function Shift_Left
17144   (Value  : T;
17145    Amount : Natural) return T;
17146 @end example
17148 The function name must be one of
17149 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
17150 Rotate_Right. T must be an integer type. T'Size must be
17151 8, 16, 32 or 64 bits; if T is modular, the modulus
17152 must be 2**8, 2**16, 2**32 or 2**64.
17153 The result type must be the same as the type of @cite{Value}.
17154 The shift amount must be Natural.
17155 The formal parameter names can be anything.
17157 A more convenient way of providing these shift operators is to use
17158 the Provide_Shift_Operators pragma, which provides the function declarations
17159 and corresponding pragma Import's for all five shift functions.
17161 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
17162 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{218}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{219}
17163 @section Source_Location
17166 @geindex Source_Location
17168 This intrinsic subprogram is used in the implementation of the
17169 library routine @cite{GNAT.Source_Info}.  The only useful use of the
17170 intrinsic import in this case is the one in this unit, so an
17171 application program should simply call the function
17172 @cite{GNAT.Source_Info.Source_Location} to obtain the current
17173 source file location.
17175 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
17176 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{21a}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{21b}
17177 @chapter Representation Clauses and Pragmas
17180 @geindex Representation Clauses
17182 @geindex Representation Clause
17184 @geindex Representation Pragma
17186 @geindex Pragma
17187 @geindex representation
17189 This section describes the representation clauses accepted by GNAT, and
17190 their effect on the representation of corresponding data objects.
17192 GNAT fully implements Annex C (Systems Programming).  This means that all
17193 the implementation advice sections in chapter 13 are fully implemented.
17194 However, these sections only require a minimal level of support for
17195 representation clauses.  GNAT provides much more extensive capabilities,
17196 and this section describes the additional capabilities provided.
17198 @menu
17199 * Alignment Clauses:: 
17200 * Size Clauses:: 
17201 * Storage_Size Clauses:: 
17202 * Size of Variant Record Objects:: 
17203 * Biased Representation:: 
17204 * Value_Size and Object_Size Clauses:: 
17205 * Component_Size Clauses:: 
17206 * Bit_Order Clauses:: 
17207 * Effect of Bit_Order on Byte Ordering:: 
17208 * Pragma Pack for Arrays:: 
17209 * Pragma Pack for Records:: 
17210 * Record Representation Clauses:: 
17211 * Handling of Records with Holes:: 
17212 * Enumeration Clauses:: 
17213 * Address Clauses:: 
17214 * Use of Address Clauses for Memory-Mapped I/O:: 
17215 * Effect of Convention on Representation:: 
17216 * Conventions and Anonymous Access Types:: 
17217 * Determining the Representations chosen by GNAT:: 
17219 @end menu
17221 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
17222 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{21c}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{21d}
17223 @section Alignment Clauses
17226 @geindex Alignment Clause
17228 GNAT requires that all alignment clauses specify a power of 2, and all
17229 default alignments are always a power of 2.  The default alignment
17230 values are as follows:
17233 @itemize *
17235 @item 
17236 @emph{Primitive Types}.
17238 For primitive types, the alignment is the minimum of the actual size of
17239 objects of the type divided by @cite{Storage_Unit},
17240 and the maximum alignment supported by the target.
17241 (This maximum alignment is given by the GNAT-specific attribute
17242 @cite{Standard'Maximum_Alignment}; see @ref{141,,Attribute Maximum_Alignment}.)
17244 @geindex Maximum_Alignment attribute
17246 For example, for type @cite{Long_Float}, the object size is 8 bytes, and the
17247 default alignment will be 8 on any target that supports alignments
17248 this large, but on some targets, the maximum alignment may be smaller
17249 than 8, in which case objects of type @cite{Long_Float} will be maximally
17250 aligned.
17252 @item 
17253 @emph{Arrays}.
17255 For arrays, the alignment is equal to the alignment of the component type
17256 for the normal case where no packing or component size is given.  If the
17257 array is packed, and the packing is effective (see separate section on
17258 packed arrays), then the alignment will be one for long packed arrays,
17259 or arrays whose length is not known at compile time.  For short packed
17260 arrays, which are handled internally as modular types, the alignment
17261 will be as described for primitive types, e.g., a packed array of length
17262 31 bits will have an object size of four bytes, and an alignment of 4.
17264 @item 
17265 @emph{Records}.
17267 For the normal non-packed case, the alignment of a record is equal to
17268 the maximum alignment of any of its components.  For tagged records, this
17269 includes the implicit access type used for the tag.  If a pragma @cite{Pack}
17270 is used and all components are packable (see separate section on pragma
17271 @cite{Pack}), then the resulting alignment is 1, unless the layout of the
17272 record makes it profitable to increase it.
17274 A special case is when:
17277 @itemize *
17279 @item 
17280 the size of the record is given explicitly, or a
17281 full record representation clause is given, and
17283 @item 
17284 the size of the record is 2, 4, or 8 bytes.
17285 @end itemize
17287 In this case, an alignment is chosen to match the
17288 size of the record. For example, if we have:
17290 @example
17291 type Small is record
17292    A, B : Character;
17293 end record;
17294 for Small'Size use 16;
17295 @end example
17297 then the default alignment of the record type @cite{Small} is 2, not 1. This
17298 leads to more efficient code when the record is treated as a unit, and also
17299 allows the type to specified as @cite{Atomic} on architectures requiring
17300 strict alignment.
17301 @end itemize
17303 An alignment clause may specify a larger alignment than the default value
17304 up to some maximum value dependent on the target (obtainable by using the
17305 attribute reference @cite{Standard'Maximum_Alignment}). It may also specify
17306 a smaller alignment than the default value for enumeration, integer and
17307 fixed point types, as well as for record types, for example
17309 @example
17310 type V is record
17311    A : Integer;
17312 end record;
17314 for V'alignment use 1;
17315 @end example
17317 @geindex Alignment
17318 @geindex default
17320 The default alignment for the type @cite{V} is 4, as a result of the
17321 Integer field in the record, but it is permissible, as shown, to
17322 override the default alignment of the record with a smaller value.
17324 @geindex Alignment
17325 @geindex subtypes
17327 Note that according to the Ada standard, an alignment clause applies only
17328 to the first named subtype. If additional subtypes are declared, then the
17329 compiler is allowed to choose any alignment it likes, and there is no way
17330 to control this choice. Consider:
17332 @example
17333 type R is range 1 .. 10_000;
17334 for R'Alignment use 1;
17335 subtype RS is R range 1 .. 1000;
17336 @end example
17338 The alignment clause specifies an alignment of 1 for the first named subtype
17339 @cite{R} but this does not necessarily apply to @cite{RS}. When writing
17340 portable Ada code, you should avoid writing code that explicitly or
17341 implicitly relies on the alignment of such subtypes.
17343 For the GNAT compiler, if an explicit alignment clause is given, this
17344 value is also used for any subsequent subtypes. So for GNAT, in the
17345 above example, you can count on the alignment of @cite{RS} being 1. But this
17346 assumption is non-portable, and other compilers may choose different
17347 alignments for the subtype @cite{RS}.
17349 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
17350 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{21e}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{21f}
17351 @section Size Clauses
17354 @geindex Size Clause
17356 The default size for a type @cite{T} is obtainable through the
17357 language-defined attribute @cite{T'Size} and also through the
17358 equivalent GNAT-defined attribute @cite{T'Value_Size}.
17359 For objects of type @cite{T}, GNAT will generally increase the type size
17360 so that the object size (obtainable through the GNAT-defined attribute
17361 @cite{T'Object_Size})
17362 is a multiple of @cite{T'Alignment * Storage_Unit}.
17364 For example:
17366 @example
17367 type Smallint is range 1 .. 6;
17369 type Rec is record
17370    Y1 : integer;
17371    Y2 : boolean;
17372 end record;
17373 @end example
17375 In this example, @cite{Smallint'Size} = @cite{Smallint'Value_Size} = 3,
17376 as specified by the RM rules,
17377 but objects of this type will have a size of 8
17378 (@cite{Smallint'Object_Size} = 8),
17379 since objects by default occupy an integral number
17380 of storage units.  On some targets, notably older
17381 versions of the Digital Alpha, the size of stand
17382 alone objects of this type may be 32, reflecting
17383 the inability of the hardware to do byte load/stores.
17385 Similarly, the size of type @cite{Rec} is 40 bits
17386 (@cite{Rec'Size} = @cite{Rec'Value_Size} = 40), but
17387 the alignment is 4, so objects of this type will have
17388 their size increased to 64 bits so that it is a multiple
17389 of the alignment (in bits).  This decision is
17390 in accordance with the specific Implementation Advice in RM 13.3(43):
17392 @quotation
17394 "A @cite{Size} clause should be supported for an object if the specified
17395 @cite{Size} is at least as large as its subtype's @cite{Size}, and corresponds
17396 to a size in storage elements that is a multiple of the object's
17397 @cite{Alignment} (if the @cite{Alignment} is nonzero)."
17398 @end quotation
17400 An explicit size clause may be used to override the default size by
17401 increasing it.  For example, if we have:
17403 @example
17404 type My_Boolean is new Boolean;
17405 for My_Boolean'Size use 32;
17406 @end example
17408 then values of this type will always be 32 bits long.  In the case of
17409 discrete types, the size can be increased up to 64 bits, with the effect
17410 that the entire specified field is used to hold the value, sign- or
17411 zero-extended as appropriate.  If more than 64 bits is specified, then
17412 padding space is allocated after the value, and a warning is issued that
17413 there are unused bits.
17415 Similarly the size of records and arrays may be increased, and the effect
17416 is to add padding bits after the value.  This also causes a warning message
17417 to be generated.
17419 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
17420 Size in bits, this corresponds to an object of size 256 megabytes (minus
17421 one).  This limitation is true on all targets.  The reason for this
17422 limitation is that it improves the quality of the code in many cases
17423 if it is known that a Size value can be accommodated in an object of
17424 type Integer.
17426 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
17427 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{220}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{221}
17428 @section Storage_Size Clauses
17431 @geindex Storage_Size Clause
17433 For tasks, the @cite{Storage_Size} clause specifies the amount of space
17434 to be allocated for the task stack.  This cannot be extended, and if the
17435 stack is exhausted, then @cite{Storage_Error} will be raised (if stack
17436 checking is enabled).  Use a @cite{Storage_Size} attribute definition clause,
17437 or a @cite{Storage_Size} pragma in the task definition to set the
17438 appropriate required size.  A useful technique is to include in every
17439 task definition a pragma of the form:
17441 @example
17442 pragma Storage_Size (Default_Stack_Size);
17443 @end example
17445 Then @cite{Default_Stack_Size} can be defined in a global package, and
17446 modified as required. Any tasks requiring stack sizes different from the
17447 default can have an appropriate alternative reference in the pragma.
17449 You can also use the @emph{-d} binder switch to modify the default stack
17450 size.
17452 For access types, the @cite{Storage_Size} clause specifies the maximum
17453 space available for allocation of objects of the type.  If this space is
17454 exceeded then @cite{Storage_Error} will be raised by an allocation attempt.
17455 In the case where the access type is declared local to a subprogram, the
17456 use of a @cite{Storage_Size} clause triggers automatic use of a special
17457 predefined storage pool (@cite{System.Pool_Size}) that ensures that all
17458 space for the pool is automatically reclaimed on exit from the scope in
17459 which the type is declared.
17461 A special case recognized by the compiler is the specification of a
17462 @cite{Storage_Size} of zero for an access type.  This means that no
17463 items can be allocated from the pool, and this is recognized at compile
17464 time, and all the overhead normally associated with maintaining a fixed
17465 size storage pool is eliminated.  Consider the following example:
17467 @example
17468 procedure p is
17469    type R is array (Natural) of Character;
17470    type P is access all R;
17471    for P'Storage_Size use 0;
17472    --  Above access type intended only for interfacing purposes
17474    y : P;
17476    procedure g (m : P);
17477    pragma Import (C, g);
17479    --  ...
17481 begin
17482    --  ...
17483    y := new R;
17484 end;
17485 @end example
17487 As indicated in this example, these dummy storage pools are often useful in
17488 connection with interfacing where no object will ever be allocated.  If you
17489 compile the above example, you get the warning:
17491 @example
17492 p.adb:16:09: warning: allocation from empty storage pool
17493 p.adb:16:09: warning: Storage_Error will be raised at run time
17494 @end example
17496 Of course in practice, there will not be any explicit allocators in the
17497 case of such an access declaration.
17499 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
17500 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{222}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{223}
17501 @section Size of Variant Record Objects
17504 @geindex Size
17505 @geindex variant record objects
17507 @geindex Variant record objects
17508 @geindex size
17510 In the case of variant record objects, there is a question whether Size gives
17511 information about a particular variant, or the maximum size required
17512 for any variant.  Consider the following program
17514 @example
17515 with Text_IO; use Text_IO;
17516 procedure q is
17517    type R1 (A : Boolean := False) is record
17518      case A is
17519        when True  => X : Character;
17520        when False => null;
17521      end case;
17522    end record;
17524    V1 : R1 (False);
17525    V2 : R1;
17527 begin
17528    Put_Line (Integer'Image (V1'Size));
17529    Put_Line (Integer'Image (V2'Size));
17530 end q;
17531 @end example
17533 Here we are dealing with a variant record, where the True variant
17534 requires 16 bits, and the False variant requires 8 bits.
17535 In the above example, both V1 and V2 contain the False variant,
17536 which is only 8 bits long.  However, the result of running the
17537 program is:
17539 @example
17542 @end example
17544 The reason for the difference here is that the discriminant value of
17545 V1 is fixed, and will always be False.  It is not possible to assign
17546 a True variant value to V1, therefore 8 bits is sufficient.  On the
17547 other hand, in the case of V2, the initial discriminant value is
17548 False (from the default), but it is possible to assign a True
17549 variant value to V2, therefore 16 bits must be allocated for V2
17550 in the general case, even fewer bits may be needed at any particular
17551 point during the program execution.
17553 As can be seen from the output of this program, the @cite{'Size}
17554 attribute applied to such an object in GNAT gives the actual allocated
17555 size of the variable, which is the largest size of any of the variants.
17556 The Ada Reference Manual is not completely clear on what choice should
17557 be made here, but the GNAT behavior seems most consistent with the
17558 language in the RM.
17560 In some cases, it may be desirable to obtain the size of the current
17561 variant, rather than the size of the largest variant.  This can be
17562 achieved in GNAT by making use of the fact that in the case of a
17563 subprogram parameter, GNAT does indeed return the size of the current
17564 variant (because a subprogram has no way of knowing how much space
17565 is actually allocated for the actual).
17567 Consider the following modified version of the above program:
17569 @example
17570 with Text_IO; use Text_IO;
17571 procedure q is
17572    type R1 (A : Boolean := False) is record
17573      case A is
17574        when True  => X : Character;
17575        when False => null;
17576      end case;
17577    end record;
17579    V2 : R1;
17581    function Size (V : R1) return Integer is
17582    begin
17583       return V'Size;
17584    end Size;
17586 begin
17587    Put_Line (Integer'Image (V2'Size));
17588    Put_Line (Integer'Image (Size (V2)));
17589    V2 := (True, 'x');
17590    Put_Line (Integer'Image (V2'Size));
17591    Put_Line (Integer'Image (Size (V2)));
17592 end q;
17593 @end example
17595 The output from this program is
17597 @example
17602 @end example
17604 Here we see that while the @cite{'Size} attribute always returns
17605 the maximum size, regardless of the current variant value, the
17606 @cite{Size} function does indeed return the size of the current
17607 variant value.
17609 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
17610 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{224}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{225}
17611 @section Biased Representation
17614 @geindex Size for biased representation
17616 @geindex Biased representation
17618 In the case of scalars with a range starting at other than zero, it is
17619 possible in some cases to specify a size smaller than the default minimum
17620 value, and in such cases, GNAT uses an unsigned biased representation,
17621 in which zero is used to represent the lower bound, and successive values
17622 represent successive values of the type.
17624 For example, suppose we have the declaration:
17626 @example
17627 type Small is range -7 .. -4;
17628 for Small'Size use 2;
17629 @end example
17631 Although the default size of type @cite{Small} is 4, the @cite{Size}
17632 clause is accepted by GNAT and results in the following representation
17633 scheme:
17635 @example
17636 -7 is represented as 2#00#
17637 -6 is represented as 2#01#
17638 -5 is represented as 2#10#
17639 -4 is represented as 2#11#
17640 @end example
17642 Biased representation is only used if the specified @cite{Size} clause
17643 cannot be accepted in any other manner.  These reduced sizes that force
17644 biased representation can be used for all discrete types except for
17645 enumeration types for which a representation clause is given.
17647 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
17648 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{226}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{227}
17649 @section Value_Size and Object_Size Clauses
17652 @geindex Value_Size
17654 @geindex Object_Size
17656 @geindex Size
17657 @geindex of objects
17659 In Ada 95 and Ada 2005, @cite{T'Size} for a type @cite{T} is the minimum
17660 number of bits required to hold values of type @cite{T}.
17661 Although this interpretation was allowed in Ada 83, it was not required,
17662 and this requirement in practice can cause some significant difficulties.
17663 For example, in most Ada 83 compilers, @cite{Natural'Size} was 32.
17664 However, in Ada 95 and Ada 2005,
17665 @cite{Natural'Size} is
17666 typically 31.  This means that code may change in behavior when moving
17667 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
17669 @example
17670 type Rec is record;
17671    A : Natural;
17672    B : Natural;
17673 end record;
17675 for Rec use record
17676    at 0  range 0 .. Natural'Size - 1;
17677    at 0  range Natural'Size .. 2 * Natural'Size - 1;
17678 end record;
17679 @end example
17681 In the above code, since the typical size of @cite{Natural} objects
17682 is 32 bits and @cite{Natural'Size} is 31, the above code can cause
17683 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
17684 there are cases where the fact that the object size can exceed the
17685 size of the type causes surprises.
17687 To help get around this problem GNAT provides two implementation
17688 defined attributes, @cite{Value_Size} and @cite{Object_Size}.  When
17689 applied to a type, these attributes yield the size of the type
17690 (corresponding to the RM defined size attribute), and the size of
17691 objects of the type respectively.
17693 The @cite{Object_Size} is used for determining the default size of
17694 objects and components.  This size value can be referred to using the
17695 @cite{Object_Size} attribute.  The phrase 'is used' here means that it is
17696 the basis of the determination of the size.  The backend is free to
17697 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
17698 character might be stored in 32 bits on a machine with no efficient
17699 byte access instructions such as the Alpha.
17701 The default rules for the value of @cite{Object_Size} for
17702 discrete types are as follows:
17705 @itemize *
17707 @item 
17708 The @cite{Object_Size} for base subtypes reflect the natural hardware
17709 size in bits (run the compiler with @emph{-gnatS} to find those values
17710 for numeric types). Enumeration types and fixed-point base subtypes have
17711 8, 16, 32 or 64 bits for this size, depending on the range of values
17712 to be stored.
17714 @item 
17715 The @cite{Object_Size} of a subtype is the same as the
17716 @cite{Object_Size} of
17717 the type from which it is obtained.
17719 @item 
17720 The @cite{Object_Size} of a derived base type is copied from the parent
17721 base type, and the @cite{Object_Size} of a derived first subtype is copied
17722 from the parent first subtype.
17723 @end itemize
17725 The @cite{Value_Size} attribute
17726 is the (minimum) number of bits required to store a value
17727 of the type.
17728 This value is used to determine how tightly to pack
17729 records or arrays with components of this type, and also affects
17730 the semantics of unchecked conversion (unchecked conversions where
17731 the @cite{Value_Size} values differ generate a warning, and are potentially
17732 target dependent).
17734 The default rules for the value of @cite{Value_Size} are as follows:
17737 @itemize *
17739 @item 
17740 The @cite{Value_Size} for a base subtype is the minimum number of bits
17741 required to store all values of the type (including the sign bit
17742 only if negative values are possible).
17744 @item 
17745 If a subtype statically matches the first subtype of a given type, then it has
17746 by default the same @cite{Value_Size} as the first subtype.  This is a
17747 consequence of RM 13.1(14): "if two subtypes statically match,
17748 then their subtype-specific aspects are the same".)
17750 @item 
17751 All other subtypes have a @cite{Value_Size} corresponding to the minimum
17752 number of bits required to store all values of the subtype.  For
17753 dynamic bounds, it is assumed that the value can range down or up
17754 to the corresponding bound of the ancestor
17755 @end itemize
17757 The RM defined attribute @cite{Size} corresponds to the
17758 @cite{Value_Size} attribute.
17760 The @cite{Size} attribute may be defined for a first-named subtype.  This sets
17761 the @cite{Value_Size} of
17762 the first-named subtype to the given value, and the
17763 @cite{Object_Size} of this first-named subtype to the given value padded up
17764 to an appropriate boundary.  It is a consequence of the default rules
17765 above that this @cite{Object_Size} will apply to all further subtypes.  On the
17766 other hand, @cite{Value_Size} is affected only for the first subtype, any
17767 dynamic subtypes obtained from it directly, and any statically matching
17768 subtypes.  The @cite{Value_Size} of any other static subtypes is not affected.
17770 @cite{Value_Size} and
17771 @cite{Object_Size} may be explicitly set for any subtype using
17772 an attribute definition clause.  Note that the use of these attributes
17773 can cause the RM 13.1(14) rule to be violated.  If two access types
17774 reference aliased objects whose subtypes have differing @cite{Object_Size}
17775 values as a result of explicit attribute definition clauses, then it
17776 is illegal to convert from one access subtype to the other. For a more
17777 complete description of this additional legality rule, see the
17778 description of the @cite{Object_Size} attribute.
17780 To get a feel for the difference, consider the following examples (note
17781 that in each case the base is @cite{Short_Short_Integer} with a size of 8):
17784 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
17785 @headitem
17787 Type or subtype declaration
17789 @tab
17791 Object_Size
17793 @tab
17795 Value_Size
17797 @item
17799 @code{type x1 is range 0 .. 5;}
17801 @tab
17805 @tab
17809 @item
17811 @code{type x2 is range 0 .. 5;}
17812 @code{for x2'size use 12;}
17814 @tab
17818 @tab
17822 @item
17824 @code{subtype x3 is x2 range 0 .. 3;}
17826 @tab
17830 @tab
17834 @item
17836 @code{subtype x4 is x2'base range 0 .. 10;}
17838 @tab
17842 @tab
17846 @item
17848 @code{dynamic : x2'Base range -64 .. +63;}
17850 @tab
17852 @tab
17854 @item
17856 @code{subtype x5 is x2 range 0 .. dynamic;}
17858 @tab
17862 @tab
17866 @item
17868 @code{subtype x6 is x2'base range 0 .. dynamic;}
17870 @tab
17874 @tab
17878 @end multitable
17881 Note: the entries marked '*' are not actually specified by the Ada
17882 Reference Manual, which has nothing to say about size in the dynamic
17883 case. What GNAT does is to allocate sufficient bits to accomodate any
17884 possible dynamic values for the bounds at run-time.
17886 So far, so good, but GNAT has to obey the RM rules, so the question is
17887 under what conditions must the RM @cite{Size} be used.
17888 The following is a list
17889 of the occasions on which the RM @cite{Size} must be used:
17892 @itemize *
17894 @item 
17895 Component size for packed arrays or records
17897 @item 
17898 Value of the attribute @cite{Size} for a type
17900 @item 
17901 Warning about sizes not matching for unchecked conversion
17902 @end itemize
17904 For record types, the @cite{Object_Size} is always a multiple of the
17905 alignment of the type (this is true for all types). In some cases the
17906 @cite{Value_Size} can be smaller. Consider:
17908 @example
17909 type R is record
17910   X : Integer;
17911   Y : Character;
17912 end record;
17913 @end example
17915 On a typical 32-bit architecture, the X component will be four bytes, and
17916 require four-byte alignment, and the Y component will be one byte. In this
17917 case @cite{R'Value_Size} will be 40 (bits) since this is the minimum size
17918 required to store a value of this type, and for example, it is permissible
17919 to have a component of type R in an outer array whose component size is
17920 specified to be 48 bits. However, @cite{R'Object_Size} will be 64 (bits),
17921 since it must be rounded up so that this value is a multiple of the
17922 alignment (4 bytes = 32 bits).
17924 For all other types, the @cite{Object_Size}
17925 and @cite{Value_Size} are the same (and equivalent to the RM attribute @cite{Size}).
17926 Only @cite{Size} may be specified for such types.
17928 Note that @cite{Value_Size} can be used to force biased representation
17929 for a particular subtype. Consider this example:
17931 @example
17932 type R is (A, B, C, D, E, F);
17933 subtype RAB is R range A .. B;
17934 subtype REF is R range E .. F;
17935 @end example
17937 By default, @cite{RAB}
17938 has a size of 1 (sufficient to accommodate the representation
17939 of @cite{A} and @cite{B}, 0 and 1), and @cite{REF}
17940 has a size of 3 (sufficient to accommodate the representation
17941 of @cite{E} and @cite{F}, 4 and 5). But if we add the
17942 following @cite{Value_Size} attribute definition clause:
17944 @example
17945 for REF'Value_Size use 1;
17946 @end example
17948 then biased representation is forced for @cite{REF},
17949 and 0 will represent @cite{E} and 1 will represent @cite{F}.
17950 A warning is issued when a @cite{Value_Size} attribute
17951 definition clause forces biased representation. This
17952 warning can be turned off using @cite{-gnatw.B}.
17954 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
17955 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{228}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{229}
17956 @section Component_Size Clauses
17959 @geindex Component_Size Clause
17961 Normally, the value specified in a component size clause must be consistent
17962 with the subtype of the array component with regard to size and alignment.
17963 In other words, the value specified must be at least equal to the size
17964 of this subtype, and must be a multiple of the alignment value.
17966 In addition, component size clauses are allowed which cause the array
17967 to be packed, by specifying a smaller value.  A first case is for
17968 component size values in the range 1 through 63.  The value specified
17969 must not be smaller than the Size of the subtype.  GNAT will accurately
17970 honor all packing requests in this range.  For example, if we have:
17972 @example
17973 type r is array (1 .. 8) of Natural;
17974 for r'Component_Size use 31;
17975 @end example
17977 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
17978 Of course access to the components of such an array is considerably
17979 less efficient than if the natural component size of 32 is used.
17980 A second case is when the subtype of the component is a record type
17981 padded because of its default alignment.  For example, if we have:
17983 @example
17984 type r is record
17985   i : Integer;
17986   j : Integer;
17987   b : Boolean;
17988 end record;
17990 type a is array (1 .. 8) of r;
17991 for a'Component_Size use 72;
17992 @end example
17994 then the resulting array has a length of 72 bytes, instead of 96 bytes
17995 if the alignment of the record (4) was obeyed.
17997 Note that there is no point in giving both a component size clause
17998 and a pragma Pack for the same array type. if such duplicate
17999 clauses are given, the pragma Pack will be ignored.
18001 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
18002 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{22a}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{22b}
18003 @section Bit_Order Clauses
18006 @geindex Bit_Order Clause
18008 @geindex bit ordering
18010 @geindex ordering
18011 @geindex of bits
18013 For record subtypes, GNAT permits the specification of the @cite{Bit_Order}
18014 attribute.  The specification may either correspond to the default bit
18015 order for the target, in which case the specification has no effect and
18016 places no additional restrictions, or it may be for the non-standard
18017 setting (that is the opposite of the default).
18019 In the case where the non-standard value is specified, the effect is
18020 to renumber bits within each byte, but the ordering of bytes is not
18021 affected.  There are certain
18022 restrictions placed on component clauses as follows:
18025 @itemize *
18027 @item 
18028 Components fitting within a single storage unit.
18030 These are unrestricted, and the effect is merely to renumber bits.  For
18031 example if we are on a little-endian machine with @cite{Low_Order_First}
18032 being the default, then the following two declarations have exactly
18033 the same effect:
18035 @example
18036 type R1 is record
18037    A : Boolean;
18038    B : Integer range 1 .. 120;
18039 end record;
18041 for R1 use record
18042    A at 0 range 0 .. 0;
18043    B at 0 range 1 .. 7;
18044 end record;
18046 type R2 is record
18047    A : Boolean;
18048    B : Integer range 1 .. 120;
18049 end record;
18051 for R2'Bit_Order use High_Order_First;
18053 for R2 use record
18054    A at 0 range 7 .. 7;
18055    B at 0 range 0 .. 6;
18056 end record;
18057 @end example
18059 The useful application here is to write the second declaration with the
18060 @cite{Bit_Order} attribute definition clause, and know that it will be treated
18061 the same, regardless of whether the target is little-endian or big-endian.
18063 @item 
18064 Components occupying an integral number of bytes.
18066 These are components that exactly fit in two or more bytes.  Such component
18067 declarations are allowed, but have no effect, since it is important to realize
18068 that the @cite{Bit_Order} specification does not affect the ordering of bytes.
18069 In particular, the following attempt at getting an endian-independent integer
18070 does not work:
18072 @example
18073 type R2 is record
18074    A : Integer;
18075 end record;
18077 for R2'Bit_Order use High_Order_First;
18079 for R2 use record
18080    A at 0 range 0 .. 31;
18081 end record;
18082 @end example
18084 This declaration will result in a little-endian integer on a
18085 little-endian machine, and a big-endian integer on a big-endian machine.
18086 If byte flipping is required for interoperability between big- and
18087 little-endian machines, this must be explicitly programmed.  This capability
18088 is not provided by @cite{Bit_Order}.
18090 @item 
18091 Components that are positioned across byte boundaries
18093 but do not occupy an integral number of bytes.  Given that bytes are not
18094 reordered, such fields would occupy a non-contiguous sequence of bits
18095 in memory, requiring non-trivial code to reassemble.  They are for this
18096 reason not permitted, and any component clause specifying such a layout
18097 will be flagged as illegal by GNAT.
18098 @end itemize
18100 Since the misconception that Bit_Order automatically deals with all
18101 endian-related incompatibilities is a common one, the specification of
18102 a component field that is an integral number of bytes will always
18103 generate a warning.  This warning may be suppressed using @cite{pragma Warnings (Off)}
18104 if desired.  The following section contains additional
18105 details regarding the issue of byte ordering.
18107 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
18108 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{22c}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{22d}
18109 @section Effect of Bit_Order on Byte Ordering
18112 @geindex byte ordering
18114 @geindex ordering
18115 @geindex of bytes
18117 In this section we will review the effect of the @cite{Bit_Order} attribute
18118 definition clause on byte ordering.  Briefly, it has no effect at all, but
18119 a detailed example will be helpful.  Before giving this
18120 example, let us review the precise
18121 definition of the effect of defining @cite{Bit_Order}.  The effect of a
18122 non-standard bit order is described in section 13.5.3 of the Ada
18123 Reference Manual:
18125 @quotation
18127 "2   A bit ordering is a method of interpreting the meaning of
18128 the storage place attributes."
18129 @end quotation
18131 To understand the precise definition of storage place attributes in
18132 this context, we visit section 13.5.1 of the manual:
18134 @quotation
18136 "13   A record_representation_clause (without the mod_clause)
18137 specifies the layout.  The storage place attributes (see 13.5.2)
18138 are taken from the values of the position, first_bit, and last_bit
18139 expressions after normalizing those values so that first_bit is
18140 less than Storage_Unit."
18141 @end quotation
18143 The critical point here is that storage places are taken from
18144 the values after normalization, not before.  So the @cite{Bit_Order}
18145 interpretation applies to normalized values.  The interpretation
18146 is described in the later part of the 13.5.3 paragraph:
18148 @quotation
18150 "2   A bit ordering is a method of interpreting the meaning of
18151 the storage place attributes.  High_Order_First (known in the
18152 vernacular as 'big endian') means that the first bit of a
18153 storage element (bit 0) is the most significant bit (interpreting
18154 the sequence of bits that represent a component as an unsigned
18155 integer value).  Low_Order_First (known in the vernacular as
18156 'little endian') means the opposite: the first bit is the
18157 least significant."
18158 @end quotation
18160 Note that the numbering is with respect to the bits of a storage
18161 unit.  In other words, the specification affects only the numbering
18162 of bits within a single storage unit.
18164 We can make the effect clearer by giving an example.
18166 Suppose that we have an external device which presents two bytes, the first
18167 byte presented, which is the first (low addressed byte) of the two byte
18168 record is called Master, and the second byte is called Slave.
18170 The left most (most significant bit is called Control for each byte, and
18171 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
18172 (least significant) bit.
18174 On a big-endian machine, we can write the following representation clause
18176 @example
18177 type Data is record
18178    Master_Control : Bit;
18179    Master_V1      : Bit;
18180    Master_V2      : Bit;
18181    Master_V3      : Bit;
18182    Master_V4      : Bit;
18183    Master_V5      : Bit;
18184    Master_V6      : Bit;
18185    Master_V7      : Bit;
18186    Slave_Control  : Bit;
18187    Slave_V1       : Bit;
18188    Slave_V2       : Bit;
18189    Slave_V3       : Bit;
18190    Slave_V4       : Bit;
18191    Slave_V5       : Bit;
18192    Slave_V6       : Bit;
18193    Slave_V7       : Bit;
18194 end record;
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 Now if we move this to a little endian machine, then the bit ordering within
18217 the byte is backwards, so we have to rewrite the record rep clause as:
18219 @example
18220 for Data use record
18221    Master_Control at 0 range 7 .. 7;
18222    Master_V1      at 0 range 6 .. 6;
18223    Master_V2      at 0 range 5 .. 5;
18224    Master_V3      at 0 range 4 .. 4;
18225    Master_V4      at 0 range 3 .. 3;
18226    Master_V5      at 0 range 2 .. 2;
18227    Master_V6      at 0 range 1 .. 1;
18228    Master_V7      at 0 range 0 .. 0;
18229    Slave_Control  at 1 range 7 .. 7;
18230    Slave_V1       at 1 range 6 .. 6;
18231    Slave_V2       at 1 range 5 .. 5;
18232    Slave_V3       at 1 range 4 .. 4;
18233    Slave_V4       at 1 range 3 .. 3;
18234    Slave_V5       at 1 range 2 .. 2;
18235    Slave_V6       at 1 range 1 .. 1;
18236    Slave_V7       at 1 range 0 .. 0;
18237 end record;
18238 @end example
18240 It is a nuisance to have to rewrite the clause, especially if
18241 the code has to be maintained on both machines.  However,
18242 this is a case that we can handle with the
18243 @cite{Bit_Order} attribute if it is implemented.
18244 Note that the implementation is not required on byte addressed
18245 machines, but it is indeed implemented in GNAT.
18246 This means that we can simply use the
18247 first record clause, together with the declaration
18249 @example
18250 for Data'Bit_Order use High_Order_First;
18251 @end example
18253 and the effect is what is desired, namely the layout is exactly the same,
18254 independent of whether the code is compiled on a big-endian or little-endian
18255 machine.
18257 The important point to understand is that byte ordering is not affected.
18258 A @cite{Bit_Order} attribute definition never affects which byte a field
18259 ends up in, only where it ends up in that byte.
18260 To make this clear, let us rewrite the record rep clause of the previous
18261 example as:
18263 @example
18264 for Data'Bit_Order use High_Order_First;
18265 for Data use record
18266    Master_Control at 0 range  0 .. 0;
18267    Master_V1      at 0 range  1 .. 1;
18268    Master_V2      at 0 range  2 .. 2;
18269    Master_V3      at 0 range  3 .. 3;
18270    Master_V4      at 0 range  4 .. 4;
18271    Master_V5      at 0 range  5 .. 5;
18272    Master_V6      at 0 range  6 .. 6;
18273    Master_V7      at 0 range  7 .. 7;
18274    Slave_Control  at 0 range  8 .. 8;
18275    Slave_V1       at 0 range  9 .. 9;
18276    Slave_V2       at 0 range 10 .. 10;
18277    Slave_V3       at 0 range 11 .. 11;
18278    Slave_V4       at 0 range 12 .. 12;
18279    Slave_V5       at 0 range 13 .. 13;
18280    Slave_V6       at 0 range 14 .. 14;
18281    Slave_V7       at 0 range 15 .. 15;
18282 end record;
18283 @end example
18285 This is exactly equivalent to saying (a repeat of the first example):
18287 @example
18288 for Data'Bit_Order use High_Order_First;
18289 for Data use record
18290    Master_Control at 0 range 0 .. 0;
18291    Master_V1      at 0 range 1 .. 1;
18292    Master_V2      at 0 range 2 .. 2;
18293    Master_V3      at 0 range 3 .. 3;
18294    Master_V4      at 0 range 4 .. 4;
18295    Master_V5      at 0 range 5 .. 5;
18296    Master_V6      at 0 range 6 .. 6;
18297    Master_V7      at 0 range 7 .. 7;
18298    Slave_Control  at 1 range 0 .. 0;
18299    Slave_V1       at 1 range 1 .. 1;
18300    Slave_V2       at 1 range 2 .. 2;
18301    Slave_V3       at 1 range 3 .. 3;
18302    Slave_V4       at 1 range 4 .. 4;
18303    Slave_V5       at 1 range 5 .. 5;
18304    Slave_V6       at 1 range 6 .. 6;
18305    Slave_V7       at 1 range 7 .. 7;
18306 end record;
18307 @end example
18309 Why are they equivalent? Well take a specific field, the @cite{Slave_V2}
18310 field.  The storage place attributes are obtained by normalizing the
18311 values given so that the @cite{First_Bit} value is less than 8.  After
18312 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
18313 we specified in the other case.
18315 Now one might expect that the @cite{Bit_Order} attribute might affect
18316 bit numbering within the entire record component (two bytes in this
18317 case, thus affecting which byte fields end up in), but that is not
18318 the way this feature is defined, it only affects numbering of bits,
18319 not which byte they end up in.
18321 Consequently it never makes sense to specify a starting bit number
18322 greater than 7 (for a byte addressable field) if an attribute
18323 definition for @cite{Bit_Order} has been given, and indeed it
18324 may be actively confusing to specify such a value, so the compiler
18325 generates a warning for such usage.
18327 If you do need to control byte ordering then appropriate conditional
18328 values must be used.  If in our example, the slave byte came first on
18329 some machines we might write:
18331 @example
18332 Master_Byte_First constant Boolean := ...;
18334 Master_Byte : constant Natural :=
18335                 1 - Boolean'Pos (Master_Byte_First);
18336 Slave_Byte  : constant Natural :=
18337                 Boolean'Pos (Master_Byte_First);
18339 for Data'Bit_Order use High_Order_First;
18340 for Data use record
18341    Master_Control at Master_Byte range 0 .. 0;
18342    Master_V1      at Master_Byte range 1 .. 1;
18343    Master_V2      at Master_Byte range 2 .. 2;
18344    Master_V3      at Master_Byte range 3 .. 3;
18345    Master_V4      at Master_Byte range 4 .. 4;
18346    Master_V5      at Master_Byte range 5 .. 5;
18347    Master_V6      at Master_Byte range 6 .. 6;
18348    Master_V7      at Master_Byte range 7 .. 7;
18349    Slave_Control  at Slave_Byte  range 0 .. 0;
18350    Slave_V1       at Slave_Byte  range 1 .. 1;
18351    Slave_V2       at Slave_Byte  range 2 .. 2;
18352    Slave_V3       at Slave_Byte  range 3 .. 3;
18353    Slave_V4       at Slave_Byte  range 4 .. 4;
18354    Slave_V5       at Slave_Byte  range 5 .. 5;
18355    Slave_V6       at Slave_Byte  range 6 .. 6;
18356    Slave_V7       at Slave_Byte  range 7 .. 7;
18357 end record;
18358 @end example
18360 Now to switch between machines, all that is necessary is
18361 to set the boolean constant @cite{Master_Byte_First} in
18362 an appropriate manner.
18364 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
18365 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{22e}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{22f}
18366 @section Pragma Pack for Arrays
18369 @geindex Pragma Pack (for arrays)
18371 Pragma @cite{Pack} applied to an array has no effect unless the component type
18372 is packable.  For a component type to be packable, it must be one of the
18373 following cases:
18376 @itemize *
18378 @item 
18379 Any scalar type
18381 @item 
18382 Any type whose size is specified with a size clause
18384 @item 
18385 Any packed array type with a static size
18387 @item 
18388 Any record type padded because of its default alignment
18389 @end itemize
18391 For all these cases, if the component subtype size is in the range
18392 1 through 63, then the effect of the pragma @cite{Pack} is exactly as though a
18393 component size were specified giving the component subtype size.
18394 For example if we have:
18396 @example
18397 type r is range 0 .. 17;
18399 type ar is array (1 .. 8) of r;
18400 pragma Pack (ar);
18401 @end example
18403 Then the component size of @cite{ar} will be set to 5 (i.e., to @cite{r'size},
18404 and the size of the array @cite{ar} will be exactly 40 bits.
18406 Note that in some cases this rather fierce approach to packing can produce
18407 unexpected effects.  For example, in Ada 95 and Ada 2005,
18408 subtype @cite{Natural} typically has a size of 31, meaning that if you
18409 pack an array of @cite{Natural}, you get 31-bit
18410 close packing, which saves a few bits, but results in far less efficient
18411 access.  Since many other Ada compilers will ignore such a packing request,
18412 GNAT will generate a warning on some uses of pragma @cite{Pack} that it guesses
18413 might not be what is intended.  You can easily remove this warning by
18414 using an explicit @cite{Component_Size} setting instead, which never generates
18415 a warning, since the intention of the programmer is clear in this case.
18417 GNAT treats packed arrays in one of two ways.  If the size of the array is
18418 known at compile time and is less than 64 bits, then internally the array
18419 is represented as a single modular type, of exactly the appropriate number
18420 of bits.  If the length is greater than 63 bits, or is not known at compile
18421 time, then the packed array is represented as an array of bytes, and the
18422 length is always a multiple of 8 bits.
18424 Note that to represent a packed array as a modular type, the alignment must
18425 be suitable for the modular type involved. For example, on typical machines
18426 a 32-bit packed array will be represented by a 32-bit modular integer with
18427 an alignment of four bytes. If you explicitly override the default alignment
18428 with an alignment clause that is too small, the modular representation
18429 cannot be used. For example, consider the following set of declarations:
18431 @example
18432 type R is range 1 .. 3;
18433 type S is array (1 .. 31) of R;
18434 for S'Component_Size use 2;
18435 for S'Size use 62;
18436 for S'Alignment use 1;
18437 @end example
18439 If the alignment clause were not present, then a 62-bit modular
18440 representation would be chosen (typically with an alignment of 4 or 8
18441 bytes depending on the target). But the default alignment is overridden
18442 with the explicit alignment clause. This means that the modular
18443 representation cannot be used, and instead the array of bytes
18444 representation must be used, meaning that the length must be a multiple
18445 of 8. Thus the above set of declarations will result in a diagnostic
18446 rejecting the size clause and noting that the minimum size allowed is 64.
18448 @geindex Pragma Pack (for type Natural)
18450 @geindex Pragma Pack warning
18452 One special case that is worth noting occurs when the base type of the
18453 component size is 8/16/32 and the subtype is one bit less. Notably this
18454 occurs with subtype @cite{Natural}. Consider:
18456 @example
18457 type Arr is array (1 .. 32) of Natural;
18458 pragma Pack (Arr);
18459 @end example
18461 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
18462 since typically @cite{Natural'Size} is 32 in Ada 83, and in any case most
18463 Ada 83 compilers did not attempt 31 bit packing.
18465 In Ada 95 and Ada 2005, @cite{Natural'Size} is required to be 31. Furthermore,
18466 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
18467 substantial unintended performance penalty when porting legacy Ada 83 code.
18468 To help prevent this, GNAT generates a warning in such cases. If you really
18469 want 31 bit packing in a case like this, you can set the component size
18470 explicitly:
18472 @example
18473 type Arr is array (1 .. 32) of Natural;
18474 for Arr'Component_Size use 31;
18475 @end example
18477 Here 31-bit packing is achieved as required, and no warning is generated,
18478 since in this case the programmer intention is clear.
18480 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
18481 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{230}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{231}
18482 @section Pragma Pack for Records
18485 @geindex Pragma Pack (for records)
18487 Pragma @cite{Pack} applied to a record will pack the components to reduce
18488 wasted space from alignment gaps and by reducing the amount of space
18489 taken by components.  We distinguish between @emph{packable} components and
18490 @emph{non-packable} components.
18491 Components of the following types are considered packable:
18494 @itemize *
18496 @item 
18497 Components of a primitive type are packable unless they are aliased
18498 or of an atomic type.
18500 @item 
18501 Small packed arrays, whose size does not exceed 64 bits, and where the
18502 size is statically known at compile time, are represented internally
18503 as modular integers, and so they are also packable.
18504 @end itemize
18506 All packable components occupy the exact number of bits corresponding to
18507 their @cite{Size} value, and are packed with no padding bits, i.e., they
18508 can start on an arbitrary bit boundary.
18510 All other types are non-packable, they occupy an integral number of
18511 storage units, and
18512 are placed at a boundary corresponding to their alignment requirements.
18514 For example, consider the record
18516 @example
18517 type Rb1 is array (1 .. 13) of Boolean;
18518 pragma Pack (Rb1);
18520 type Rb2 is array (1 .. 65) of Boolean;
18521 pragma Pack (Rb2);
18523 type AF is new Float with Atomic;
18525 type X2 is record
18526    L1 : Boolean;
18527    L2 : Duration;
18528    L3 : AF;
18529    L4 : Boolean;
18530    L5 : Rb1;
18531    L6 : Rb2;
18532 end record;
18533 pragma Pack (X2);
18534 @end example
18536 The representation for the record X2 is as follows:
18538 @example
18539 for X2'Size use 224;
18540 for X2 use record
18541    L1 at  0 range  0 .. 0;
18542    L2 at  0 range  1 .. 64;
18543    L3 at 12 range  0 .. 31;
18544    L4 at 16 range  0 .. 0;
18545    L5 at 16 range  1 .. 13;
18546    L6 at 18 range  0 .. 71;
18547 end record;
18548 @end example
18550 Studying this example, we see that the packable fields @cite{L1}
18551 and @cite{L2} are
18552 of length equal to their sizes, and placed at specific bit boundaries (and
18553 not byte boundaries) to
18554 eliminate padding.  But @cite{L3} is of a non-packable float type (because
18555 it is aliased), so it is on the next appropriate alignment boundary.
18557 The next two fields are fully packable, so @cite{L4} and @cite{L5} are
18558 minimally packed with no gaps.  However, type @cite{Rb2} is a packed
18559 array that is longer than 64 bits, so it is itself non-packable.  Thus
18560 the @cite{L6} field is aligned to the next byte boundary, and takes an
18561 integral number of bytes, i.e., 72 bits.
18563 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
18564 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{232}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{233}
18565 @section Record Representation Clauses
18568 @geindex Record Representation Clause
18570 Record representation clauses may be given for all record types, including
18571 types obtained by record extension.  Component clauses are allowed for any
18572 static component.  The restrictions on component clauses depend on the type
18573 of the component.
18575 @geindex Component Clause
18577 For all components of an elementary type, the only restriction on component
18578 clauses is that the size must be at least the 'Size value of the type
18579 (actually the Value_Size).  There are no restrictions due to alignment,
18580 and such components may freely cross storage boundaries.
18582 Packed arrays with a size up to and including 64 bits are represented
18583 internally using a modular type with the appropriate number of bits, and
18584 thus the same lack of restriction applies.  For example, if you declare:
18586 @example
18587 type R is array (1 .. 49) of Boolean;
18588 pragma Pack (R);
18589 for R'Size use 49;
18590 @end example
18592 then a component clause for a component of type R may start on any
18593 specified bit boundary, and may specify a value of 49 bits or greater.
18595 For packed bit arrays that are longer than 64 bits, there are two
18596 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
18597 including the important case of single bits or boolean values, then
18598 there are no limitations on placement of such components, and they
18599 may start and end at arbitrary bit boundaries.
18601 If the component size is not a power of 2 (e.g., 3 or 5), then
18602 an array of this type longer than 64 bits must always be placed on
18603 on a storage unit (byte) boundary and occupy an integral number
18604 of storage units (bytes). Any component clause that does not
18605 meet this requirement will be rejected.
18607 Any aliased component, or component of an aliased type, must
18608 have its normal alignment and size. A component clause that
18609 does not meet this requirement will be rejected.
18611 The tag field of a tagged type always occupies an address sized field at
18612 the start of the record.  No component clause may attempt to overlay this
18613 tag. When a tagged type appears as a component, the tag field must have
18614 proper alignment
18616 In the case of a record extension T1, of a type T, no component clause applied
18617 to the type T1 can specify a storage location that would overlap the first
18618 T'Size bytes of the record.
18620 For all other component types, including non-bit-packed arrays,
18621 the component can be placed at an arbitrary bit boundary,
18622 so for example, the following is permitted:
18624 @example
18625 type R is array (1 .. 10) of Boolean;
18626 for R'Size use 80;
18628 type Q is record
18629    G, H : Boolean;
18630    L, M : R;
18631 end record;
18633 for Q use record
18634    G at 0 range  0 ..   0;
18635    H at 0 range  1 ..   1;
18636    L at 0 range  2 ..  81;
18637    R at 0 range 82 .. 161;
18638 end record;
18639 @end example
18641 Note: the above rules apply to recent releases of GNAT 5.
18642 In GNAT 3, there are more severe restrictions on larger components.
18643 For non-primitive types, including packed arrays with a size greater than
18644 64 bits, component clauses must respect the alignment requirement of the
18645 type, in particular, always starting on a byte boundary, and the length
18646 must be a multiple of the storage unit.
18648 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
18649 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{234}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{235}
18650 @section Handling of Records with Holes
18653 @geindex Handling of Records with Holes
18655 As a result of alignment considerations, records may contain "holes"
18656 or gaps
18657 which do not correspond to the data bits of any of the components.
18658 Record representation clauses can also result in holes in records.
18660 GNAT does not attempt to clear these holes, so in record objects,
18661 they should be considered to hold undefined rubbish. The generated
18662 equality routine just tests components so does not access these
18663 undefined bits, and assignment and copy operations may or may not
18664 preserve the contents of these holes (for assignments, the holes
18665 in the target will in practice contain either the bits that are
18666 present in the holes in the source, or the bits that were present
18667 in the target before the assignment).
18669 If it is necessary to ensure that holes in records have all zero
18670 bits, then record objects for which this initialization is desired
18671 should be explicitly set to all zero values using Unchecked_Conversion
18672 or address overlays. For example
18674 @example
18675 type HRec is record
18676    C : Character;
18677    I : Integer;
18678 end record;
18679 @end example
18681 On typical machines, integers need to be aligned on a four-byte
18682 boundary, resulting in three bytes of undefined rubbish following
18683 the 8-bit field for C. To ensure that the hole in a variable of
18684 type HRec is set to all zero bits,
18685 you could for example do:
18687 @example
18688 type Base is record
18689    Dummy1, Dummy2 : Integer := 0;
18690 end record;
18692 BaseVar : Base;
18693 RealVar : Hrec;
18694 for RealVar'Address use BaseVar'Address;
18695 @end example
18697 Now the 8-bytes of the value of RealVar start out containing all zero
18698 bits. A safer approach is to just define dummy fields, avoiding the
18699 holes, as in:
18701 @example
18702 type HRec is record
18703    C      : Character;
18704    Dummy1 : Short_Short_Integer := 0;
18705    Dummy2 : Short_Short_Integer := 0;
18706    Dummy3 : Short_Short_Integer := 0;
18707    I      : Integer;
18708 end record;
18709 @end example
18711 And to make absolutely sure that the intent of this is followed, you
18712 can use representation clauses:
18714 @example
18715 for Hrec use record
18716    C      at 0 range 0 .. 7;
18717    Dummy1 at 1 range 0 .. 7;
18718    Dummy2 at 2 range 0 .. 7;
18719    Dummy3 at 3 range 0 .. 7;
18720    I      at 4 range 0 .. 31;
18721 end record;
18722 for Hrec'Size use 64;
18723 @end example
18725 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
18726 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{236}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{237}
18727 @section Enumeration Clauses
18730 The only restriction on enumeration clauses is that the range of values
18731 must be representable.  For the signed case, if one or more of the
18732 representation values are negative, all values must be in the range:
18734 @example
18735 System.Min_Int .. System.Max_Int
18736 @end example
18738 For the unsigned case, where all values are nonnegative, the values must
18739 be in the range:
18741 @example
18742 0 .. System.Max_Binary_Modulus;
18743 @end example
18745 A @emph{confirming} representation clause is one in which the values range
18746 from 0 in sequence, i.e., a clause that confirms the default representation
18747 for an enumeration type.
18748 Such a confirming representation
18749 is permitted by these rules, and is specially recognized by the compiler so
18750 that no extra overhead results from the use of such a clause.
18752 If an array has an index type which is an enumeration type to which an
18753 enumeration clause has been applied, then the array is stored in a compact
18754 manner.  Consider the declarations:
18756 @example
18757 type r is (A, B, C);
18758 for r use (A => 1, B => 5, C => 10);
18759 type t is array (r) of Character;
18760 @end example
18762 The array type t corresponds to a vector with exactly three elements and
18763 has a default size equal to @cite{3*Character'Size}.  This ensures efficient
18764 use of space, but means that accesses to elements of the array will incur
18765 the overhead of converting representation values to the corresponding
18766 positional values, (i.e., the value delivered by the @cite{Pos} attribute).
18768 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
18769 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{238}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{239}
18770 @section Address Clauses
18773 @geindex Address Clause
18775 The reference manual allows a general restriction on representation clauses,
18776 as found in RM 13.1(22):
18778 @quotation
18780 "An implementation need not support representation
18781 items containing nonstatic expressions, except that
18782 an implementation should support a representation item
18783 for a given entity if each nonstatic expression in the
18784 representation item is a name that statically denotes
18785 a constant declared before the entity."
18786 @end quotation
18788 In practice this is applicable only to address clauses, since this is the
18789 only case in which a non-static expression is permitted by the syntax.  As
18790 the AARM notes in sections 13.1 (22.a-22.h):
18792 @quotation
18794 22.a   Reason: This is to avoid the following sort of thing:
18796 22.b        X : Integer := F(...);
18797 Y : Address := G(...);
18798 for X'Address use Y;
18800 22.c   In the above, we have to evaluate the
18801 initialization expression for X before we
18802 know where to put the result.  This seems
18803 like an unreasonable implementation burden.
18805 22.d   The above code should instead be written
18806 like this:
18808 22.e        Y : constant Address := G(...);
18809 X : Integer := F(...);
18810 for X'Address use Y;
18812 22.f   This allows the expression 'Y' to be safely
18813 evaluated before X is created.
18815 22.g   The constant could be a formal parameter of mode in.
18817 22.h   An implementation can support other nonstatic
18818 expressions if it wants to.  Expressions of type
18819 Address are hardly ever static, but their value
18820 might be known at compile time anyway in many
18821 cases.
18822 @end quotation
18824 GNAT does indeed permit many additional cases of non-static expressions.  In
18825 particular, if the type involved is elementary there are no restrictions
18826 (since in this case, holding a temporary copy of the initialization value,
18827 if one is present, is inexpensive).  In addition, if there is no implicit or
18828 explicit initialization, then there are no restrictions.  GNAT will reject
18829 only the case where all three of these conditions hold:
18832 @itemize *
18834 @item 
18835 The type of the item is non-elementary (e.g., a record or array).
18837 @item 
18838 There is explicit or implicit initialization required for the object.
18839 Note that access values are always implicitly initialized.
18841 @item 
18842 The address value is non-static.  Here GNAT is more permissive than the
18843 RM, and allows the address value to be the address of a previously declared
18844 stand-alone variable, as long as it does not itself have an address clause.
18846 @example
18847 Anchor  : Some_Initialized_Type;
18848 Overlay : Some_Initialized_Type;
18849 for Overlay'Address use Anchor'Address;
18850 @end example
18852 However, the prefix of the address clause cannot be an array component, or
18853 a component of a discriminated record.
18854 @end itemize
18856 As noted above in section 22.h, address values are typically non-static.  In
18857 particular the To_Address function, even if applied to a literal value, is
18858 a non-static function call.  To avoid this minor annoyance, GNAT provides
18859 the implementation defined attribute 'To_Address.  The following two
18860 expressions have identical values:
18862 @geindex Attribute
18864 @geindex To_Address
18866 @example
18867 To_Address (16#1234_0000#)
18868 System'To_Address (16#1234_0000#);
18869 @end example
18871 except that the second form is considered to be a static expression, and
18872 thus when used as an address clause value is always permitted.
18874 Additionally, GNAT treats as static an address clause that is an
18875 unchecked_conversion of a static integer value.  This simplifies the porting
18876 of legacy code, and provides a portable equivalent to the GNAT attribute
18877 @cite{To_Address}.
18879 Another issue with address clauses is the interaction with alignment
18880 requirements.  When an address clause is given for an object, the address
18881 value must be consistent with the alignment of the object (which is usually
18882 the same as the alignment of the type of the object).  If an address clause
18883 is given that specifies an inappropriately aligned address value, then the
18884 program execution is erroneous.
18886 Since this source of erroneous behavior can have unfortunate effects on
18887 machines with strict alignment requirements, GNAT
18888 checks (at compile time if possible, generating a warning, or at execution
18889 time with a run-time check) that the alignment is appropriate.  If the
18890 run-time check fails, then @cite{Program_Error} is raised.  This run-time
18891 check is suppressed if range checks are suppressed, or if the special GNAT
18892 check Alignment_Check is suppressed, or if
18893 @cite{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
18894 suppressed by default on non-strict alignment machines (such as the x86).
18896 Finally, GNAT does not permit overlaying of objects of controlled types or
18897 composite types containing a controlled component. In most cases, the compiler
18898 can detect an attempt at such overlays and will generate a warning at compile
18899 time and a Program_Error exception at run time.
18901 @geindex Export
18903 An address clause cannot be given for an exported object.  More
18904 understandably the real restriction is that objects with an address
18905 clause cannot be exported.  This is because such variables are not
18906 defined by the Ada program, so there is no external object to export.
18908 @geindex Import
18910 It is permissible to give an address clause and a pragma Import for the
18911 same object.  In this case, the variable is not really defined by the
18912 Ada program, so there is no external symbol to be linked.  The link name
18913 and the external name are ignored in this case.  The reason that we allow this
18914 combination is that it provides a useful idiom to avoid unwanted
18915 initializations on objects with address clauses.
18917 When an address clause is given for an object that has implicit or
18918 explicit initialization, then by default initialization takes place.  This
18919 means that the effect of the object declaration is to overwrite the
18920 memory at the specified address.  This is almost always not what the
18921 programmer wants, so GNAT will output a warning:
18923 @example
18924 with System;
18925 package G is
18926    type R is record
18927       M : Integer := 0;
18928    end record;
18930    Ext : R;
18931    for Ext'Address use System'To_Address (16#1234_1234#);
18932        |
18933 >>> warning: implicit initialization of "Ext" may
18934     modify overlaid storage
18935 >>> warning: use pragma Import for "Ext" to suppress
18936     initialization (RM B(24))
18938 end G;
18939 @end example
18941 As indicated by the warning message, the solution is to use a (dummy) pragma
18942 Import to suppress this initialization.  The pragma tell the compiler that the
18943 object is declared and initialized elsewhere.  The following package compiles
18944 without warnings (and the initialization is suppressed):
18946 @example
18947 with System;
18948 package G is
18949    type R is record
18950       M : Integer := 0;
18951    end record;
18953    Ext : R;
18954    for Ext'Address use System'To_Address (16#1234_1234#);
18955    pragma Import (Ada, Ext);
18956 end G;
18957 @end example
18959 A final issue with address clauses involves their use for overlaying
18960 variables, as in the following example:
18962 @geindex Overlaying of objects
18964 @example
18965 A : Integer;
18966 B : Integer;
18967 for B'Address use A'Address;
18968 @end example
18970 or alternatively, using the form recommended by the RM:
18972 @example
18973 A    : Integer;
18974 Addr : constant Address := A'Address;
18975 B    : Integer;
18976 for B'Address use Addr;
18977 @end example
18979 In both of these cases, @cite{A}
18980 and @cite{B} become aliased to one another via the
18981 address clause. This use of address clauses to overlay
18982 variables, achieving an effect similar to unchecked
18983 conversion was erroneous in Ada 83, but in Ada 95 and Ada 2005
18984 the effect is implementation defined. Furthermore, the
18985 Ada RM specifically recommends that in a situation
18986 like this, @cite{B} should be subject to the following
18987 implementation advice (RM 13.3(19)):
18989 @quotation
18991 "19  If the Address of an object is specified, or it is imported
18992 or exported, then the implementation should not perform
18993 optimizations based on assumptions of no aliases."
18994 @end quotation
18996 GNAT follows this recommendation, and goes further by also applying
18997 this recommendation to the overlaid variable (@cite{A}
18998 in the above example) in this case. This means that the overlay
18999 works "as expected", in that a modification to one of the variables
19000 will affect the value of the other.
19002 Note that when address clause overlays are used in this way, there is an
19003 issue of unintentional initialization, as shown by this example:
19005 @example
19006 package Overwrite_Record is
19007    type R is record
19008       A : Character := 'C';
19009       B : Character := 'A';
19010    end record;
19011    X : Short_Integer := 3;
19012    Y : R;
19013    for Y'Address use X'Address;
19014        |
19015 >>> warning: default initialization of "Y" may
19016     modify "X", use pragma Import for "Y" to
19017     suppress initialization (RM B.1(24))
19019 end Overwrite_Record;
19020 @end example
19022 Here the default initialization of @cite{Y} will clobber the value
19023 of @cite{X}, which justifies the warning. The warning notes that
19024 this effect can be eliminated by adding a @cite{pragma Import}
19025 which suppresses the initialization:
19027 @example
19028 package Overwrite_Record is
19029    type R is record
19030       A : Character := 'C';
19031       B : Character := 'A';
19032    end record;
19033    X : Short_Integer := 3;
19034    Y : R;
19035    for Y'Address use X'Address;
19036    pragma Import (Ada, Y);
19037 end Overwrite_Record;
19038 @end example
19040 Note that the use of @cite{pragma Initialize_Scalars} may cause variables to
19041 be initialized when they would not otherwise have been in the absence
19042 of the use of this pragma. This may cause an overlay to have this
19043 unintended clobbering effect. The compiler avoids this for scalar
19044 types, but not for composite objects (where in general the effect
19045 of @cite{Initialize_Scalars} is part of the initialization routine
19046 for the composite object:
19048 @example
19049 pragma Initialize_Scalars;
19050 with Ada.Text_IO;  use Ada.Text_IO;
19051 procedure Overwrite_Array is
19052    type Arr is array (1 .. 5) of Integer;
19053    X : Arr := (others => 1);
19054    A : Arr;
19055    for A'Address use X'Address;
19056        |
19057 >>> warning: default initialization of "A" may
19058     modify "X", use pragma Import for "A" to
19059     suppress initialization (RM B.1(24))
19061 begin
19062    if X /= Arr'(others => 1) then
19063       Put_Line ("X was clobbered");
19064    else
19065       Put_Line ("X was not clobbered");
19066    end if;
19067 end Overwrite_Array;
19068 @end example
19070 The above program generates the warning as shown, and at execution
19071 time, prints @cite{X was clobbered}. If the @cite{pragma Import} is
19072 added as suggested:
19074 @example
19075 pragma Initialize_Scalars;
19076 with Ada.Text_IO;  use Ada.Text_IO;
19077 procedure Overwrite_Array is
19078    type Arr is array (1 .. 5) of Integer;
19079    X : Arr := (others => 1);
19080    A : Arr;
19081    for A'Address use X'Address;
19082    pragma Import (Ada, A);
19083 begin
19084    if X /= Arr'(others => 1) then
19085       Put_Line ("X was clobbered");
19086    else
19087       Put_Line ("X was not clobbered");
19088    end if;
19089 end Overwrite_Array;
19090 @end example
19092 then the program compiles without the warning and when run will generate
19093 the output @cite{X was not clobbered}.
19095 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
19096 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{23a}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{23b}
19097 @section Use of Address Clauses for Memory-Mapped I/O
19100 @geindex Memory-mapped I/O
19102 A common pattern is to use an address clause to map an atomic variable to
19103 a location in memory that corresponds to a memory-mapped I/O operation or
19104 operations, for example:
19106 @example
19107 type Mem_Word is record
19108    A,B,C,D : Byte;
19109 end record;
19110 pragma Atomic (Mem_Word);
19111 for Mem_Word_Size use 32;
19113 Mem : Mem_Word;
19114 for Mem'Address use some-address;
19116 Temp := Mem;
19117 Temp.A := 32;
19118 Mem := Temp;
19119 @end example
19121 For a full access (reference or modification) of the variable (Mem) in
19122 this case, as in the above examples, GNAT guarantees that the entire atomic
19123 word will be accessed. It is not clear whether the RM requires this. For
19124 example in the above, can the compiler reference only the Mem.A field as
19125 an optimization? Whatever the answer to this question is, GNAT makes the
19126 guarantee that for such a reference, the entire word is read or written.
19128 A problem arises with a component access such as:
19130 @example
19131 Mem.A := 32;
19132 @end example
19134 Note that the component A is not declared as atomic. This means that it is
19135 not clear what this assignment means. It could correspond to full word read
19136 and write as given in the first example, or on architectures that supported
19137 such an operation it might be a single byte store instruction. The RM does
19138 not have anything to say in this situation, and GNAT does not make any
19139 guarantee. The code generated may vary from target to target. GNAT will issue
19140 a warning in such a case:
19142 @example
19143 Mem.A := 32;
19145 >>> warning: access to non-atomic component of atomic array,
19146     may cause unexpected accesses to atomic object
19147 @end example
19149 It is best to be explicit in this situation, by either declaring the
19150 components to be atomic if you want the byte store, or explicitly writing
19151 the full word access sequence if that is what the hardware requires.
19153 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
19154 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{23c}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{23d}
19155 @section Effect of Convention on Representation
19158 @geindex Convention
19159 @geindex effect on representation
19161 Normally the specification of a foreign language convention for a type or
19162 an object has no effect on the chosen representation.  In particular, the
19163 representation chosen for data in GNAT generally meets the standard system
19164 conventions, and for example records are laid out in a manner that is
19165 consistent with C.  This means that specifying convention C (for example)
19166 has no effect.
19168 There are four exceptions to this general rule:
19171 @itemize *
19173 @item 
19174 @emph{Convention Fortran and array subtypes}.
19176 If pragma Convention Fortran is specified for an array subtype, then in
19177 accordance with the implementation advice in section 3.6.2(11) of the
19178 Ada Reference Manual, the array will be stored in a Fortran-compatible
19179 column-major manner, instead of the normal default row-major order.
19181 @item 
19182 @emph{Convention C and enumeration types}
19184 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
19185 to accommodate all values of the type.  For example, for the enumeration
19186 type declared by:
19188 @example
19189 type Color is (Red, Green, Blue);
19190 @end example
19192 8 bits is sufficient to store all values of the type, so by default, objects
19193 of type @cite{Color} will be represented using 8 bits.  However, normal C
19194 convention is to use 32 bits for all enum values in C, since enum values
19195 are essentially of type int.  If pragma @cite{Convention C} is specified for an
19196 Ada enumeration type, then the size is modified as necessary (usually to
19197 32 bits) to be consistent with the C convention for enum values.
19199 Note that this treatment applies only to types. If Convention C is given for
19200 an enumeration object, where the enumeration type is not Convention C, then
19201 Object_Size bits are allocated. For example, for a normal enumeration type,
19202 with less than 256 elements, only 8 bits will be allocated for the object.
19203 Since this may be a surprise in terms of what C expects, GNAT will issue a
19204 warning in this situation. The warning can be suppressed by giving an explicit
19205 size clause specifying the desired size.
19207 @item 
19208 @emph{Convention C/Fortran and Boolean types}
19210 In C, the usual convention for boolean values, that is values used for
19211 conditions, is that zero represents false, and nonzero values represent
19212 true.  In Ada, the normal convention is that two specific values, typically
19213 0/1, are used to represent false/true respectively.
19215 Fortran has a similar convention for @cite{LOGICAL} values (any nonzero
19216 value represents true).
19218 To accommodate the Fortran and C conventions, if a pragma Convention specifies
19219 C or Fortran convention for a derived Boolean, as in the following example:
19221 @example
19222 type C_Switch is new Boolean;
19223 pragma Convention (C, C_Switch);
19224 @end example
19226 then the GNAT generated code will treat any nonzero value as true.  For truth
19227 values generated by GNAT, the conventional value 1 will be used for True, but
19228 when one of these values is read, any nonzero value is treated as True.
19229 @end itemize
19231 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
19232 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{23e}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{23f}
19233 @section Conventions and Anonymous Access Types
19236 @geindex Anonymous access types
19238 @geindex Convention for anonymous access types
19240 The RM is not entirely clear on convention handling in a number of cases,
19241 and in particular, it is not clear on the convention to be given to
19242 anonymous access types in general, and in particular what is to be
19243 done for the case of anonymous access-to-subprogram.
19245 In GNAT, we decide that if an explicit Convention is applied
19246 to an object or component, and its type is such an anonymous type,
19247 then the convention will apply to this anonymous type as well. This
19248 seems to make sense since it is anomolous in any case to have a
19249 different convention for an object and its type, and there is clearly
19250 no way to explicitly specify a convention for an anonymous type, since
19251 it doesn't have a name to specify!
19253 Furthermore, we decide that if a convention is applied to a record type,
19254 then this convention is inherited by any of its components that are of an
19255 anonymous access type which do not have an explicitly specified convention.
19257 The following program shows these conventions in action:
19259 @example
19260 package ConvComp is
19261    type Foo is range 1 .. 10;
19262    type T1 is record
19263       A : access function (X : Foo) return Integer;
19264       B : Integer;
19265    end record;
19266    pragma Convention (C, T1);
19268    type T2 is record
19269       A : access function (X : Foo) return Integer;
19270       pragma Convention  (C, A);
19271       B : Integer;
19272    end record;
19273    pragma Convention (COBOL, T2);
19275    type T3 is record
19276       A : access function (X : Foo) return Integer;
19277       pragma Convention  (COBOL, A);
19278       B : Integer;
19279    end record;
19280    pragma Convention (C, T3);
19282    type T4 is record
19283       A : access function (X : Foo) return Integer;
19284       B : Integer;
19285    end record;
19286    pragma Convention (COBOL, T4);
19288    function F (X : Foo) return Integer;
19289    pragma Convention (C, F);
19291    function F (X : Foo) return Integer is (13);
19293    TV1 : T1 := (F'Access, 12);  -- OK
19294    TV2 : T2 := (F'Access, 13);  -- OK
19296    TV3 : T3 := (F'Access, 13);  -- ERROR
19297                 |
19298 >>> subprogram "F" has wrong convention
19299 >>> does not match access to subprogram declared at line 17
19300      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
19301                 |
19302 >>> subprogram "F" has wrong convention
19303 >>> does not match access to subprogram declared at line 24
19304      39. end ConvComp;
19305 @end example
19307 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
19308 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{240}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{241}
19309 @section Determining the Representations chosen by GNAT
19312 @geindex Representation
19313 @geindex determination of
19315 @geindex -gnatR (gcc)
19317 Although the descriptions in this section are intended to be complete, it is
19318 often easier to simply experiment to see what GNAT accepts and what the
19319 effect is on the layout of types and objects.
19321 As required by the Ada RM, if a representation clause is not accepted, then
19322 it must be rejected as illegal by the compiler.  However, when a
19323 representation clause or pragma is accepted, there can still be questions
19324 of what the compiler actually does.  For example, if a partial record
19325 representation clause specifies the location of some components and not
19326 others, then where are the non-specified components placed? Or if pragma
19327 @cite{Pack} is used on a record, then exactly where are the resulting
19328 fields placed? The section on pragma @cite{Pack} in this chapter can be
19329 used to answer the second question, but it is often easier to just see
19330 what the compiler does.
19332 For this purpose, GNAT provides the option @emph{-gnatR}.  If you compile
19333 with this option, then the compiler will output information on the actual
19334 representations chosen, in a format similar to source representation
19335 clauses.  For example, if we compile the package:
19337 @example
19338 package q is
19339    type r (x : boolean) is tagged record
19340       case x is
19341          when True => S : String (1 .. 100);
19342          when False => null;
19343       end case;
19344    end record;
19346    type r2 is new r (false) with record
19347       y2 : integer;
19348    end record;
19350    for r2 use record
19351       y2 at 16 range 0 .. 31;
19352    end record;
19354    type x is record
19355       y : character;
19356    end record;
19358    type x1 is array (1 .. 10) of x;
19359    for x1'component_size use 11;
19361    type ia is access integer;
19363    type Rb1 is array (1 .. 13) of Boolean;
19364    pragma Pack (rb1);
19366    type Rb2 is array (1 .. 65) of Boolean;
19367    pragma Pack (rb2);
19369    type x2 is record
19370       l1 : Boolean;
19371       l2 : Duration;
19372       l3 : Float;
19373       l4 : Boolean;
19374       l5 : Rb1;
19375       l6 : Rb2;
19376    end record;
19377    pragma Pack (x2);
19378 end q;
19379 @end example
19381 using the switch @emph{-gnatR} we obtain the following output:
19383 @example
19384 Representation information for unit q
19385 -------------------------------------
19387 for r'Size use ??;
19388 for r'Alignment use 4;
19389 for r use record
19390    x    at 4 range  0 .. 7;
19391    _tag at 0 range  0 .. 31;
19392    s    at 5 range  0 .. 799;
19393 end record;
19395 for r2'Size use 160;
19396 for r2'Alignment use 4;
19397 for r2 use record
19398    x       at  4 range  0 .. 7;
19399    _tag    at  0 range  0 .. 31;
19400    _parent at  0 range  0 .. 63;
19401    y2      at 16 range  0 .. 31;
19402 end record;
19404 for x'Size use 8;
19405 for x'Alignment use 1;
19406 for x use record
19407    y at 0 range  0 .. 7;
19408 end record;
19410 for x1'Size use 112;
19411 for x1'Alignment use 1;
19412 for x1'Component_Size use 11;
19414 for rb1'Size use 13;
19415 for rb1'Alignment use 2;
19416 for rb1'Component_Size use 1;
19418 for rb2'Size use 72;
19419 for rb2'Alignment use 1;
19420 for rb2'Component_Size use 1;
19422 for x2'Size use 224;
19423 for x2'Alignment use 4;
19424 for x2 use record
19425    l1 at  0 range  0 .. 0;
19426    l2 at  0 range  1 .. 64;
19427    l3 at 12 range  0 .. 31;
19428    l4 at 16 range  0 .. 0;
19429    l5 at 16 range  1 .. 13;
19430    l6 at 18 range  0 .. 71;
19431 end record;
19432 @end example
19434 The Size values are actually the Object_Size, i.e., the default size that
19435 will be allocated for objects of the type.
19436 The @code{??} size for type r indicates that we have a variant record, and the
19437 actual size of objects will depend on the discriminant value.
19439 The Alignment values show the actual alignment chosen by the compiler
19440 for each record or array type.
19442 The record representation clause for type r shows where all fields
19443 are placed, including the compiler generated tag field (whose location
19444 cannot be controlled by the programmer).
19446 The record representation clause for the type extension r2 shows all the
19447 fields present, including the parent field, which is a copy of the fields
19448 of the parent type of r2, i.e., r1.
19450 The component size and size clauses for types rb1 and rb2 show
19451 the exact effect of pragma @cite{Pack} on these arrays, and the record
19452 representation clause for type x2 shows how pragma @cite{Pack} affects
19453 this record type.
19455 In some cases, it may be useful to cut and paste the representation clauses
19456 generated by the compiler into the original source to fix and guarantee
19457 the actual representation to be used.
19459 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
19460 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{242}@anchor{gnat_rm/standard_library_routines id1}@anchor{243}
19461 @chapter Standard Library Routines
19464 The Ada Reference Manual contains in Annex A a full description of an
19465 extensive set of standard library routines that can be used in any Ada
19466 program, and which must be provided by all Ada compilers.  They are
19467 analogous to the standard C library used by C programs.
19469 GNAT implements all of the facilities described in annex A, and for most
19470 purposes the description in the Ada Reference Manual, or appropriate Ada
19471 text book, will be sufficient for making use of these facilities.
19473 In the case of the input-output facilities,
19474 @ref{f,,The Implementation of Standard I/O},
19475 gives details on exactly how GNAT interfaces to the
19476 file system.  For the remaining packages, the Ada Reference Manual
19477 should be sufficient.  The following is a list of the packages included,
19478 together with a brief description of the functionality that is provided.
19480 For completeness, references are included to other predefined library
19481 routines defined in other sections of the Ada Reference Manual (these are
19482 cross-indexed from Annex A). For further details see the relevant
19483 package declarations in the run-time library. In particular, a few units
19484 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
19485 and in this case the package declaration contains comments explaining why
19486 the unit is not implemented.
19489 @table @asis
19491 @item @code{Ada} @emph{(A.2)}
19493 This is a parent package for all the standard library packages.  It is
19494 usually included implicitly in your program, and itself contains no
19495 useful data or routines.
19497 @item @code{Ada.Assertions} @emph{(11.4.2)}
19499 @cite{Assertions} provides the @cite{Assert} subprograms, and also
19500 the declaration of the @cite{Assertion_Error} exception.
19502 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
19504 @cite{Asynchronous_Task_Control} provides low level facilities for task
19505 synchronization. It is typically not implemented. See package spec for details.
19507 @item @code{Ada.Calendar} @emph{(9.6)}
19509 @cite{Calendar} provides time of day access, and routines for
19510 manipulating times and durations.
19512 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
19514 This package provides additional arithmetic
19515 operations for @cite{Calendar}.
19517 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
19519 This package provides formatting operations for @cite{Calendar}.
19521 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
19523 This package provides additional @cite{Calendar} facilities
19524 for handling time zones.
19526 @item @code{Ada.Characters} @emph{(A.3.1)}
19528 This is a dummy parent package that contains no useful entities
19530 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
19532 This package provides character conversion functions.
19534 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
19536 This package provides some basic character handling capabilities,
19537 including classification functions for classes of characters (e.g., test
19538 for letters, or digits).
19540 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
19542 This package includes a complete set of definitions of the characters
19543 that appear in type CHARACTER.  It is useful for writing programs that
19544 will run in international environments.  For example, if you want an
19545 upper case E with an acute accent in a string, it is often better to use
19546 the definition of @cite{UC_E_Acute} in this package.  Then your program
19547 will print in an understandable manner even if your environment does not
19548 support these extended characters.
19550 @item @code{Ada.Command_Line} @emph{(A.15)}
19552 This package provides access to the command line parameters and the name
19553 of the current program (analogous to the use of @cite{argc} and @cite{argv}
19554 in C), and also allows the exit status for the program to be set in a
19555 system-independent manner.
19557 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
19559 This package provides text input and output of complex numbers.
19561 @item @code{Ada.Containers} @emph{(A.18.1)}
19563 A top level package providing a few basic definitions used by all the
19564 following specific child packages that provide specific kinds of
19565 containers.
19566 @end table
19568 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
19570 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
19572 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
19574 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
19576 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
19578 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
19580 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
19582 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
19584 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
19586 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
19588 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
19590 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
19592 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
19594 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
19596 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
19598 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
19600 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
19602 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
19604 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
19606 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
19608 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
19610 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
19612 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
19615 @table @asis
19617 @item @code{Ada.Directories} @emph{(A.16)}
19619 This package provides operations on directories.
19621 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
19623 This package provides additional directory operations handling
19624 hiearchical file names.
19626 @item @code{Ada.Directories.Information} @emph{(A.16)}
19628 This is an implementation defined package for additional directory
19629 operations, which is not implemented in GNAT.
19631 @item @code{Ada.Decimal} @emph{(F.2)}
19633 This package provides constants describing the range of decimal numbers
19634 implemented, and also a decimal divide routine (analogous to the COBOL
19635 verb DIVIDE ... GIVING ... REMAINDER ...)
19637 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
19639 This package provides input-output using a model of a set of records of
19640 fixed-length, containing an arbitrary definite Ada type, indexed by an
19641 integer record number.
19643 @item @code{Ada.Dispatching} @emph{(D.2.1)}
19645 A parent package containing definitions for task dispatching operations.
19647 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
19649 Not implemented in GNAT.
19651 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
19653 Not implemented in GNAT.
19655 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
19657 Not implemented in GNAT.
19659 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
19661 This package allows the priorities of a task to be adjusted dynamically
19662 as the task is running.
19664 @item @code{Ada.Environment_Variables} @emph{(A.17)}
19666 This package provides facilities for accessing environment variables.
19668 @item @code{Ada.Exceptions} @emph{(11.4.1)}
19670 This package provides additional information on exceptions, and also
19671 contains facilities for treating exceptions as data objects, and raising
19672 exceptions with associated messages.
19674 @item @code{Ada.Execution_Time} @emph{(D.14)}
19676 Not implemented in GNAT.
19678 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
19680 Not implemented in GNAT.
19682 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
19684 Not implemented in GNAT.
19686 @item @code{Ada.Finalization} @emph{(7.6)}
19688 This package contains the declarations and subprograms to support the
19689 use of controlled types, providing for automatic initialization and
19690 finalization (analogous to the constructors and destructors of C++).
19692 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
19694 A library level instantiation of Text_IO.Float_IO for type Float.
19696 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
19698 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
19700 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
19702 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
19704 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
19706 A library level instantiation of Text_IO.Integer_IO for type Integer.
19708 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
19710 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
19712 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
19714 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
19716 @item @code{Ada.Interrupts} @emph{(C.3.2)}
19718 This package provides facilities for interfacing to interrupts, which
19719 includes the set of signals or conditions that can be raised and
19720 recognized as interrupts.
19722 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
19724 This package provides the set of interrupt names (actually signal
19725 or condition names) that can be handled by GNAT.
19727 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
19729 This package defines the set of exceptions that can be raised by use of
19730 the standard IO packages.
19732 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
19734 This package provides a generic interface to generalized iterators.
19736 @item @code{Ada.Locales} @emph{(A.19)}
19738 This package provides declarations providing information (Language
19739 and Country) about the current locale.
19741 @item @code{Ada.Numerics}
19743 This package contains some standard constants and exceptions used
19744 throughout the numerics packages.  Note that the constants pi and e are
19745 defined here, and it is better to use these definitions than rolling
19746 your own.
19748 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
19750 Provides operations on arrays of complex numbers.
19752 @item @code{Ada.Numerics.Complex_Elementary_Functions}
19754 Provides the implementation of standard elementary functions (such as
19755 log and trigonometric functions) operating on complex numbers using the
19756 standard @cite{Float} and the @cite{Complex} and @cite{Imaginary} types
19757 created by the package @cite{Numerics.Complex_Types}.
19759 @item @code{Ada.Numerics.Complex_Types}
19761 This is a predefined instantiation of
19762 @cite{Numerics.Generic_Complex_Types} using @cite{Standard.Float} to
19763 build the type @cite{Complex} and @cite{Imaginary}.
19765 @item @code{Ada.Numerics.Discrete_Random}
19767 This generic package provides a random number generator suitable for generating
19768 uniformly distributed values of a specified discrete subtype.
19770 @item @code{Ada.Numerics.Float_Random}
19772 This package provides a random number generator suitable for generating
19773 uniformly distributed floating point values in the unit interval.
19775 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
19777 This is a generic version of the package that provides the
19778 implementation of standard elementary functions (such as log and
19779 trigonometric functions) for an arbitrary complex type.
19781 The following predefined instantiations of this package are provided:
19784 @itemize *
19786 @item 
19787 @code{Short_Float}
19789 @cite{Ada.Numerics.Short_Complex_Elementary_Functions}
19791 @item 
19792 @code{Float}
19794 @cite{Ada.Numerics.Complex_Elementary_Functions}
19796 @item 
19797 @code{Long_Float}
19799 @cite{Ada.Numerics.Long_Complex_Elementary_Functions}
19800 @end itemize
19802 @item @code{Ada.Numerics.Generic_Complex_Types}
19804 This is a generic package that allows the creation of complex types,
19805 with associated complex arithmetic operations.
19807 The following predefined instantiations of this package exist
19810 @itemize *
19812 @item 
19813 @code{Short_Float}
19815 @cite{Ada.Numerics.Short_Complex_Complex_Types}
19817 @item 
19818 @code{Float}
19820 @cite{Ada.Numerics.Complex_Complex_Types}
19822 @item 
19823 @code{Long_Float}
19825 @cite{Ada.Numerics.Long_Complex_Complex_Types}
19826 @end itemize
19828 @item @code{Ada.Numerics.Generic_Elementary_Functions}
19830 This is a generic package that provides the implementation of standard
19831 elementary functions (such as log an trigonometric functions) for an
19832 arbitrary float type.
19834 The following predefined instantiations of this package exist
19837 @itemize *
19839 @item 
19840 @code{Short_Float}
19842 @cite{Ada.Numerics.Short_Elementary_Functions}
19844 @item 
19845 @code{Float}
19847 @cite{Ada.Numerics.Elementary_Functions}
19849 @item 
19850 @code{Long_Float}
19852 @cite{Ada.Numerics.Long_Elementary_Functions}
19853 @end itemize
19855 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
19857 Generic operations on arrays of reals
19859 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
19861 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
19863 @item @code{Ada.Real_Time} @emph{(D.8)}
19865 This package provides facilities similar to those of @cite{Calendar}, but
19866 operating with a finer clock suitable for real time control. Note that
19867 annex D requires that there be no backward clock jumps, and GNAT generally
19868 guarantees this behavior, but of course if the external clock on which
19869 the GNAT runtime depends is deliberately reset by some external event,
19870 then such a backward jump may occur.
19872 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
19874 Not implemented in GNAT.
19876 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
19878 This package provides input-output facilities for sequential files,
19879 which can contain a sequence of values of a single type, which can be
19880 any Ada type, including indefinite (unconstrained) types.
19882 @item @code{Ada.Storage_IO} @emph{(A.9)}
19884 This package provides a facility for mapping arbitrary Ada types to and
19885 from a storage buffer.  It is primarily intended for the creation of new
19886 IO packages.
19888 @item @code{Ada.Streams} @emph{(13.13.1)}
19890 This is a generic package that provides the basic support for the
19891 concept of streams as used by the stream attributes (@cite{Input},
19892 @cite{Output}, @cite{Read} and @cite{Write}).
19894 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
19896 This package is a specialization of the type @cite{Streams} defined in
19897 package @cite{Streams} together with a set of operations providing
19898 Stream_IO capability.  The Stream_IO model permits both random and
19899 sequential access to a file which can contain an arbitrary set of values
19900 of one or more Ada types.
19902 @item @code{Ada.Strings} @emph{(A.4.1)}
19904 This package provides some basic constants used by the string handling
19905 packages.
19907 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
19909 This package provides facilities for handling variable length
19910 strings.  The bounded model requires a maximum length.  It is thus
19911 somewhat more limited than the unbounded model, but avoids the use of
19912 dynamic allocation or finalization.
19914 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
19916 Provides case-insensitive comparisons of bounded strings
19918 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
19920 This package provides a generic hash function for bounded strings
19922 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
19924 This package provides a generic hash function for bounded strings that
19925 converts the string to be hashed to lower case.
19927 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
19929 This package provides a comparison function for bounded strings that works
19930 in a case insensitive manner by converting to lower case before the comparison.
19932 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
19934 This package provides facilities for handling fixed length strings.
19936 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
19938 This package provides an equality function for fixed strings that compares
19939 the strings after converting both to lower case.
19941 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
19943 This package provides a case insensitive hash function for fixed strings that
19944 converts the string to lower case before computing the hash.
19946 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
19948 This package provides a comparison function for fixed strings that works
19949 in a case insensitive manner by converting to lower case before the comparison.
19951 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
19953 This package provides a hash function for strings.
19955 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
19957 This package provides a hash function for strings that is case insensitive.
19958 The string is converted to lower case before computing the hash.
19960 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
19962 This package provides a comparison function for\strings that works
19963 in a case insensitive manner by converting to lower case before the comparison.
19965 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
19967 This package provides facilities for handling character mappings and
19968 arbitrarily defined subsets of characters.  For instance it is useful in
19969 defining specialized translation tables.
19971 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
19973 This package provides a standard set of predefined mappings and
19974 predefined character sets.  For example, the standard upper to lower case
19975 conversion table is found in this package.  Note that upper to lower case
19976 conversion is non-trivial if you want to take the entire set of
19977 characters, including extended characters like E with an acute accent,
19978 into account.  You should use the mappings in this package (rather than
19979 adding 32 yourself) to do case mappings.
19981 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
19983 This package provides facilities for handling variable length
19984 strings.  The unbounded model allows arbitrary length strings, but
19985 requires the use of dynamic allocation and finalization.
19987 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
19989 Provides case-insensitive comparisons of unbounded strings
19991 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
19993 This package provides a generic hash function for unbounded strings
19995 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
19997 This package provides a generic hash function for unbounded strings that
19998 converts the string to be hashed to lower case.
20000 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
20002 This package provides a comparison function for unbounded strings that works
20003 in a case insensitive manner by converting to lower case before the comparison.
20005 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
20007 This package provides basic definitions for dealing with UTF-encoded strings.
20009 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
20011 This package provides conversion functions for UTF-encoded strings.
20012 @end table
20014 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
20016 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
20019 @table @asis
20021 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
20023 These packages provide facilities for handling UTF encodings for
20024 Strings, Wide_Strings and Wide_Wide_Strings.
20025 @end table
20027 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
20029 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
20031 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
20034 @table @asis
20036 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
20038 These packages provide analogous capabilities to the corresponding
20039 packages without @code{Wide_} in the name, but operate with the types
20040 @cite{Wide_String} and @cite{Wide_Character} instead of @cite{String}
20041 and @cite{Character}. Versions of all the child packages are available.
20042 @end table
20044 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
20046 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
20048 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
20051 @table @asis
20053 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
20055 These packages provide analogous capabilities to the corresponding
20056 packages without @code{Wide_} in the name, but operate with the types
20057 @cite{Wide_Wide_String} and @cite{Wide_Wide_Character} instead
20058 of @cite{String} and @cite{Character}.
20060 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
20062 This package provides facilities for synchronizing tasks at a low level
20063 with barriers.
20065 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
20067 This package provides some standard facilities for controlling task
20068 communication in a synchronous manner.
20070 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
20072 Not implemented in GNAT.
20074 @item @code{Ada.Tags}
20076 This package contains definitions for manipulation of the tags of tagged
20077 values.
20079 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
20081 This package provides a way of constructing tagged class-wide values given
20082 only the tag value.
20084 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
20086 This package provides the capability of associating arbitrary
20087 task-specific data with separate tasks.
20089 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
20091 This package provides capabilities for task identification.
20093 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
20095 This package provides control over task termination.
20097 @item @code{Ada.Text_IO}
20099 This package provides basic text input-output capabilities for
20100 character, string and numeric data.  The subpackages of this
20101 package are listed next. Note that although these are defined
20102 as subpackages in the RM, they are actually transparently
20103 implemented as child packages in GNAT, meaning that they
20104 are only loaded if needed.
20106 @item @code{Ada.Text_IO.Decimal_IO}
20108 Provides input-output facilities for decimal fixed-point types
20110 @item @code{Ada.Text_IO.Enumeration_IO}
20112 Provides input-output facilities for enumeration types.
20114 @item @code{Ada.Text_IO.Fixed_IO}
20116 Provides input-output facilities for ordinary fixed-point types.
20118 @item @code{Ada.Text_IO.Float_IO}
20120 Provides input-output facilities for float types.  The following
20121 predefined instantiations of this generic package are available:
20124 @itemize *
20126 @item 
20127 @code{Short_Float}
20129 @cite{Short_Float_Text_IO}
20131 @item 
20132 @code{Float}
20134 @cite{Float_Text_IO}
20136 @item 
20137 @code{Long_Float}
20139 @cite{Long_Float_Text_IO}
20140 @end itemize
20142 @item @code{Ada.Text_IO.Integer_IO}
20144 Provides input-output facilities for integer types.  The following
20145 predefined instantiations of this generic package are available:
20148 @itemize *
20150 @item 
20151 @code{Short_Short_Integer}
20153 @cite{Ada.Short_Short_Integer_Text_IO}
20155 @item 
20156 @code{Short_Integer}
20158 @cite{Ada.Short_Integer_Text_IO}
20160 @item 
20161 @code{Integer}
20163 @cite{Ada.Integer_Text_IO}
20165 @item 
20166 @code{Long_Integer}
20168 @cite{Ada.Long_Integer_Text_IO}
20170 @item 
20171 @code{Long_Long_Integer}
20173 @cite{Ada.Long_Long_Integer_Text_IO}
20174 @end itemize
20176 @item @code{Ada.Text_IO.Modular_IO}
20178 Provides input-output facilities for modular (unsigned) types.
20180 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
20182 Provides input-output facilities for bounded strings.
20184 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
20186 This package provides basic text input-output capabilities for complex
20187 data.
20189 @item @code{Ada.Text_IO.Editing (F.3.3)}
20191 This package contains routines for edited output, analogous to the use
20192 of pictures in COBOL.  The picture formats used by this package are a
20193 close copy of the facility in COBOL.
20195 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
20197 This package provides a facility that allows Text_IO files to be treated
20198 as streams, so that the stream attributes can be used for writing
20199 arbitrary data, including binary data, to Text_IO files.
20201 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
20203 This package provides input-output facilities for unbounded strings.
20205 @item @code{Ada.Unchecked_Conversion (13.9)}
20207 This generic package allows arbitrary conversion from one type to
20208 another of the same size, providing for breaking the type safety in
20209 special circumstances.
20211 If the types have the same Size (more accurately the same Value_Size),
20212 then the effect is simply to transfer the bits from the source to the
20213 target type without any modification.  This usage is well defined, and
20214 for simple types whose representation is typically the same across
20215 all implementations, gives a portable method of performing such
20216 conversions.
20218 If the types do not have the same size, then the result is implementation
20219 defined, and thus may be non-portable.  The following describes how GNAT
20220 handles such unchecked conversion cases.
20222 If the types are of different sizes, and are both discrete types, then
20223 the effect is of a normal type conversion without any constraint checking.
20224 In particular if the result type has a larger size, the result will be
20225 zero or sign extended.  If the result type has a smaller size, the result
20226 will be truncated by ignoring high order bits.
20228 If the types are of different sizes, and are not both discrete types,
20229 then the conversion works as though pointers were created to the source
20230 and target, and the pointer value is converted.  The effect is that bits
20231 are copied from successive low order storage units and bits of the source
20232 up to the length of the target type.
20234 A warning is issued if the lengths differ, since the effect in this
20235 case is implementation dependent, and the above behavior may not match
20236 that of some other compiler.
20238 A pointer to one type may be converted to a pointer to another type using
20239 unchecked conversion.  The only case in which the effect is undefined is
20240 when one or both pointers are pointers to unconstrained array types.  In
20241 this case, the bounds information may get incorrectly transferred, and in
20242 particular, GNAT uses double size pointers for such types, and it is
20243 meaningless to convert between such pointer types.  GNAT will issue a
20244 warning if the alignment of the target designated type is more strict
20245 than the alignment of the source designated type (since the result may
20246 be unaligned in this case).
20248 A pointer other than a pointer to an unconstrained array type may be
20249 converted to and from System.Address.  Such usage is common in Ada 83
20250 programs, but note that Ada.Address_To_Access_Conversions is the
20251 preferred method of performing such conversions in Ada 95 and Ada 2005.
20252 Neither
20253 unchecked conversion nor Ada.Address_To_Access_Conversions should be
20254 used in conjunction with pointers to unconstrained objects, since
20255 the bounds information cannot be handled correctly in this case.
20257 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
20259 This generic package allows explicit freeing of storage previously
20260 allocated by use of an allocator.
20262 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
20264 This package is similar to @cite{Ada.Text_IO}, except that the external
20265 file supports wide character representations, and the internal types are
20266 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20267 and @cite{String}. The corresponding set of nested packages and child
20268 packages are defined.
20270 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
20272 This package is similar to @cite{Ada.Text_IO}, except that the external
20273 file supports wide character representations, and the internal types are
20274 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20275 and @cite{String}. The corresponding set of nested packages and child
20276 packages are defined.
20277 @end table
20279 For packages in Interfaces and System, all the RM defined packages are
20280 available in GNAT, see the Ada 2012 RM for full details.
20282 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
20283 @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{244}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{245}
20284 @chapter The Implementation of Standard I/O
20287 GNAT implements all the required input-output facilities described in
20288 A.6 through A.14.  These sections of the Ada Reference Manual describe the
20289 required behavior of these packages from the Ada point of view, and if
20290 you are writing a portable Ada program that does not need to know the
20291 exact manner in which Ada maps to the outside world when it comes to
20292 reading or writing external files, then you do not need to read this
20293 chapter.  As long as your files are all regular files (not pipes or
20294 devices), and as long as you write and read the files only from Ada, the
20295 description in the Ada Reference Manual is sufficient.
20297 However, if you want to do input-output to pipes or other devices, such
20298 as the keyboard or screen, or if the files you are dealing with are
20299 either generated by some other language, or to be read by some other
20300 language, then you need to know more about the details of how the GNAT
20301 implementation of these input-output facilities behaves.
20303 In this chapter we give a detailed description of exactly how GNAT
20304 interfaces to the file system.  As always, the sources of the system are
20305 available to you for answering questions at an even more detailed level,
20306 but for most purposes the information in this chapter will suffice.
20308 Another reason that you may need to know more about how input-output is
20309 implemented arises when you have a program written in mixed languages
20310 where, for example, files are shared between the C and Ada sections of
20311 the same program.  GNAT provides some additional facilities, in the form
20312 of additional child library packages, that facilitate this sharing, and
20313 these additional facilities are also described in this chapter.
20315 @menu
20316 * Standard I/O Packages:: 
20317 * FORM Strings:: 
20318 * Direct_IO:: 
20319 * Sequential_IO:: 
20320 * Text_IO:: 
20321 * Wide_Text_IO:: 
20322 * Wide_Wide_Text_IO:: 
20323 * Stream_IO:: 
20324 * Text Translation:: 
20325 * Shared Files:: 
20326 * Filenames encoding:: 
20327 * File content encoding:: 
20328 * Open Modes:: 
20329 * Operations on C Streams:: 
20330 * Interfacing to C Streams:: 
20332 @end menu
20334 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
20335 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{246}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{247}
20336 @section Standard I/O Packages
20339 The Standard I/O packages described in Annex A for
20342 @itemize *
20344 @item 
20345 Ada.Text_IO
20347 @item 
20348 Ada.Text_IO.Complex_IO
20350 @item 
20351 Ada.Text_IO.Text_Streams
20353 @item 
20354 Ada.Wide_Text_IO
20356 @item 
20357 Ada.Wide_Text_IO.Complex_IO
20359 @item 
20360 Ada.Wide_Text_IO.Text_Streams
20362 @item 
20363 Ada.Wide_Wide_Text_IO
20365 @item 
20366 Ada.Wide_Wide_Text_IO.Complex_IO
20368 @item 
20369 Ada.Wide_Wide_Text_IO.Text_Streams
20371 @item 
20372 Ada.Stream_IO
20374 @item 
20375 Ada.Sequential_IO
20377 @item 
20378 Ada.Direct_IO
20379 @end itemize
20381 are implemented using the C
20382 library streams facility; where
20385 @itemize *
20387 @item 
20388 All files are opened using @cite{fopen}.
20390 @item 
20391 All input/output operations use @cite{fread}/@cite{fwrite}.
20392 @end itemize
20394 There is no internal buffering of any kind at the Ada library level. The only
20395 buffering is that provided at the system level in the implementation of the
20396 library routines that support streams. This facilitates shared use of these
20397 streams by mixed language programs. Note though that system level buffering is
20398 explicitly enabled at elaboration of the standard I/O packages and that can
20399 have an impact on mixed language programs, in particular those using I/O before
20400 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
20401 the Ada elaboration routine before performing any I/O or when impractical,
20402 flush the common I/O streams and in particular Standard_Output before
20403 elaborating the Ada code.
20405 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
20406 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{248}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{249}
20407 @section FORM Strings
20410 The format of a FORM string in GNAT is:
20412 @example
20413 "keyword=value,keyword=value,...,keyword=value"
20414 @end example
20416 where letters may be in upper or lower case, and there are no spaces
20417 between values.  The order of the entries is not important.  Currently
20418 the following keywords defined.
20420 @example
20421 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
20422 SHARED=[YES|NO]
20423 WCEM=[n|h|u|s|e|8|b]
20424 ENCODING=[UTF8|8BITS]
20425 @end example
20427 The use of these parameters is described later in this section. If an
20428 unrecognized keyword appears in a form string, it is silently ignored
20429 and not considered invalid.
20431 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
20432 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{24a}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{24b}
20433 @section Direct_IO
20436 Direct_IO can only be instantiated for definite types.  This is a
20437 restriction of the Ada language, which means that the records are fixed
20438 length (the length being determined by @code{type'Size}, rounded
20439 up to the next storage unit boundary if necessary).
20441 The records of a Direct_IO file are simply written to the file in index
20442 sequence, with the first record starting at offset zero, and subsequent
20443 records following.  There is no control information of any kind.  For
20444 example, if 32-bit integers are being written, each record takes
20445 4-bytes, so the record at index @cite{K} starts at offset
20446 (@cite{K}-1)*4.
20448 There is no limit on the size of Direct_IO files, they are expanded as
20449 necessary to accommodate whatever records are written to the file.
20451 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
20452 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{24c}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{24d}
20453 @section Sequential_IO
20456 Sequential_IO may be instantiated with either a definite (constrained)
20457 or indefinite (unconstrained) type.
20459 For the definite type case, the elements written to the file are simply
20460 the memory images of the data values with no control information of any
20461 kind.  The resulting file should be read using the same type, no validity
20462 checking is performed on input.
20464 For the indefinite type case, the elements written consist of two
20465 parts.  First is the size of the data item, written as the memory image
20466 of a @cite{Interfaces.C.size_t} value, followed by the memory image of
20467 the data value.  The resulting file can only be read using the same
20468 (unconstrained) type.  Normal assignment checks are performed on these
20469 read operations, and if these checks fail, @cite{Data_Error} is
20470 raised.  In particular, in the array case, the lengths must match, and in
20471 the variant record case, if the variable for a particular read operation
20472 is constrained, the discriminants must match.
20474 Note that it is not possible to use Sequential_IO to write variable
20475 length array items, and then read the data back into different length
20476 arrays.  For example, the following will raise @cite{Data_Error}:
20478 @example
20479 package IO is new Sequential_IO (String);
20480 F : IO.File_Type;
20481 S : String (1..4);
20483 IO.Create (F)
20484 IO.Write (F, "hello!")
20485 IO.Reset (F, Mode=>In_File);
20486 IO.Read (F, S);
20487 Put_Line (S);
20488 @end example
20490 On some Ada implementations, this will print @cite{hell}, but the program is
20491 clearly incorrect, since there is only one element in the file, and that
20492 element is the string @cite{hello!}.
20494 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
20495 using Stream_IO, and this is the preferred mechanism.  In particular, the
20496 above program fragment rewritten to use Stream_IO will work correctly.
20498 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
20499 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{24e}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{24f}
20500 @section Text_IO
20503 Text_IO files consist of a stream of characters containing the following
20504 special control characters:
20506 @example
20507 LF (line feed, 16#0A#) Line Mark
20508 FF (form feed, 16#0C#) Page Mark
20509 @end example
20511 A canonical Text_IO file is defined as one in which the following
20512 conditions are met:
20515 @itemize *
20517 @item 
20518 The character @cite{LF} is used only as a line mark, i.e., to mark the end
20519 of the line.
20521 @item 
20522 The character @cite{FF} is used only as a page mark, i.e., to mark the
20523 end of a page and consequently can appear only immediately following a
20524 @cite{LF} (line mark) character.
20526 @item 
20527 The file ends with either @cite{LF} (line mark) or @cite{LF}-@cite{FF}
20528 (line mark, page mark).  In the former case, the page mark is implicitly
20529 assumed to be present.
20530 @end itemize
20532 A file written using Text_IO will be in canonical form provided that no
20533 explicit @cite{LF} or @cite{FF} characters are written using @cite{Put}
20534 or @cite{Put_Line}.  There will be no @cite{FF} character at the end of
20535 the file unless an explicit @cite{New_Page} operation was performed
20536 before closing the file.
20538 A canonical Text_IO file that is a regular file (i.e., not a device or a
20539 pipe) can be read using any of the routines in Text_IO.  The
20540 semantics in this case will be exactly as defined in the Ada Reference
20541 Manual, and all the routines in Text_IO are fully implemented.
20543 A text file that does not meet the requirements for a canonical Text_IO
20544 file has one of the following:
20547 @itemize *
20549 @item 
20550 The file contains @cite{FF} characters not immediately following a
20551 @cite{LF} character.
20553 @item 
20554 The file contains @cite{LF} or @cite{FF} characters written by
20555 @cite{Put} or @cite{Put_Line}, which are not logically considered to be
20556 line marks or page marks.
20558 @item 
20559 The file ends in a character other than @cite{LF} or @cite{FF},
20560 i.e., there is no explicit line mark or page mark at the end of the file.
20561 @end itemize
20563 Text_IO can be used to read such non-standard text files but subprograms
20564 to do with line or page numbers do not have defined meanings.  In
20565 particular, a @cite{FF} character that does not follow a @cite{LF}
20566 character may or may not be treated as a page mark from the point of
20567 view of page and line numbering.  Every @cite{LF} character is considered
20568 to end a line, and there is an implied @cite{LF} character at the end of
20569 the file.
20571 @menu
20572 * Stream Pointer Positioning:: 
20573 * Reading and Writing Non-Regular Files:: 
20574 * Get_Immediate:: 
20575 * Treating Text_IO Files as Streams:: 
20576 * Text_IO Extensions:: 
20577 * Text_IO Facilities for Unbounded Strings:: 
20579 @end menu
20581 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
20582 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{250}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{251}
20583 @subsection Stream Pointer Positioning
20586 @cite{Ada.Text_IO} has a definition of current position for a file that
20587 is being read.  No internal buffering occurs in Text_IO, and usually the
20588 physical position in the stream used to implement the file corresponds
20589 to this logical position defined by Text_IO.  There are two exceptions:
20592 @itemize *
20594 @item 
20595 After a call to @cite{End_Of_Page} that returns @cite{True}, the stream
20596 is positioned past the @cite{LF} (line mark) that precedes the page
20597 mark.  Text_IO maintains an internal flag so that subsequent read
20598 operations properly handle the logical position which is unchanged by
20599 the @cite{End_Of_Page} call.
20601 @item 
20602 After a call to @cite{End_Of_File} that returns @cite{True}, if the
20603 Text_IO file was positioned before the line mark at the end of file
20604 before the call, then the logical position is unchanged, but the stream
20605 is physically positioned right at the end of file (past the line mark,
20606 and past a possible page mark following the line mark.  Again Text_IO
20607 maintains internal flags so that subsequent read operations properly
20608 handle the logical position.
20609 @end itemize
20611 These discrepancies have no effect on the observable behavior of
20612 Text_IO, but if a single Ada stream is shared between a C program and
20613 Ada program, or shared (using @code{shared=yes} in the form string)
20614 between two Ada files, then the difference may be observable in some
20615 situations.
20617 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
20618 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{252}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{253}
20619 @subsection Reading and Writing Non-Regular Files
20622 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
20623 can be used for reading and writing.  Writing is not affected and the
20624 sequence of characters output is identical to the normal file case, but
20625 for reading, the behavior of Text_IO is modified to avoid undesirable
20626 look-ahead as follows:
20628 An input file that is not a regular file is considered to have no page
20629 marks.  Any @cite{Ascii.FF} characters (the character normally used for a
20630 page mark) appearing in the file are considered to be data
20631 characters.  In particular:
20634 @itemize *
20636 @item 
20637 @cite{Get_Line} and @cite{Skip_Line} do not test for a page mark
20638 following a line mark.  If a page mark appears, it will be treated as a
20639 data character.
20641 @item 
20642 This avoids the need to wait for an extra character to be typed or
20643 entered from the pipe to complete one of these operations.
20645 @item 
20646 @cite{End_Of_Page} always returns @cite{False}
20648 @item 
20649 @cite{End_Of_File} will return @cite{False} if there is a page mark at
20650 the end of the file.
20651 @end itemize
20653 Output to non-regular files is the same as for regular files.  Page marks
20654 may be written to non-regular files using @cite{New_Page}, but as noted
20655 above they will not be treated as page marks on input if the output is
20656 piped to another Ada program.
20658 Another important discrepancy when reading non-regular files is that the end
20659 of file indication is not 'sticky'.  If an end of file is entered, e.g., by
20660 pressing the @code{EOT} key,
20661 then end of file
20662 is signaled once (i.e., the test @cite{End_Of_File}
20663 will yield @cite{True}, or a read will
20664 raise @cite{End_Error}), but then reading can resume
20665 to read data past that end of
20666 file indication, until another end of file indication is entered.
20668 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
20669 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{254}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{255}
20670 @subsection Get_Immediate
20673 @geindex Get_Immediate
20675 Get_Immediate returns the next character (including control characters)
20676 from the input file.  In particular, Get_Immediate will return LF or FF
20677 characters used as line marks or page marks.  Such operations leave the
20678 file positioned past the control character, and it is thus not treated
20679 as having its normal function.  This means that page, line and column
20680 counts after this kind of Get_Immediate call are set as though the mark
20681 did not occur.  In the case where a Get_Immediate leaves the file
20682 positioned between the line mark and page mark (which is not normally
20683 possible), it is undefined whether the FF character will be treated as a
20684 page mark.
20686 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
20687 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{256}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{257}
20688 @subsection Treating Text_IO Files as Streams
20691 @geindex Stream files
20693 The package @cite{Text_IO.Streams} allows a Text_IO file to be treated
20694 as a stream.  Data written to a Text_IO file in this stream mode is
20695 binary data.  If this binary data contains bytes 16#0A# (@cite{LF}) or
20696 16#0C# (@cite{FF}), the resulting file may have non-standard
20697 format.  Similarly if read operations are used to read from a Text_IO
20698 file treated as a stream, then @cite{LF} and @cite{FF} characters may be
20699 skipped and the effect is similar to that described above for
20700 @cite{Get_Immediate}.
20702 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
20703 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{258}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{259}
20704 @subsection Text_IO Extensions
20707 @geindex Text_IO extensions
20709 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
20710 to the standard @cite{Text_IO} package:
20713 @itemize *
20715 @item 
20716 function File_Exists (Name : String) return Boolean;
20717 Determines if a file of the given name exists.
20719 @item 
20720 function Get_Line return String;
20721 Reads a string from the standard input file.  The value returned is exactly
20722 the length of the line that was read.
20724 @item 
20725 function Get_Line (File : Ada.Text_IO.File_Type) return String;
20726 Similar, except that the parameter File specifies the file from which
20727 the string is to be read.
20728 @end itemize
20730 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
20731 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{25a}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{25b}
20732 @subsection Text_IO Facilities for Unbounded Strings
20735 @geindex Text_IO for unbounded strings
20737 @geindex Unbounded_String
20738 @geindex Text_IO operations
20740 The package @cite{Ada.Strings.Unbounded.Text_IO}
20741 in library files @cite{a-suteio.ads/adb} contains some GNAT-specific
20742 subprograms useful for Text_IO operations on unbounded strings:
20745 @itemize *
20747 @item 
20748 function Get_Line (File : File_Type) return Unbounded_String;
20749 Reads a line from the specified file
20750 and returns the result as an unbounded string.
20752 @item 
20753 procedure Put (File : File_Type; U : Unbounded_String);
20754 Writes the value of the given unbounded string to the specified file
20755 Similar to the effect of
20756 @cite{Put (To_String (U))} except that an extra copy is avoided.
20758 @item 
20759 procedure Put_Line (File : File_Type; U : Unbounded_String);
20760 Writes the value of the given unbounded string to the specified file,
20761 followed by a @cite{New_Line}.
20762 Similar to the effect of @cite{Put_Line (To_String (U))} except
20763 that an extra copy is avoided.
20764 @end itemize
20766 In the above procedures, @cite{File} is of type @cite{Ada.Text_IO.File_Type}
20767 and is optional.  If the parameter is omitted, then the standard input or
20768 output file is referenced as appropriate.
20770 The package @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
20771 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
20772 @cite{Wide_Text_IO} functionality for unbounded wide strings.
20774 The package @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
20775 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
20776 @cite{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
20778 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
20779 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{25c}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{25d}
20780 @section Wide_Text_IO
20783 @cite{Wide_Text_IO} is similar in most respects to Text_IO, except that
20784 both input and output files may contain special sequences that represent
20785 wide character values.  The encoding scheme for a given file may be
20786 specified using a FORM parameter:
20788 @example
20789 WCEM=`x`
20790 @end example
20792 as part of the FORM string (WCEM = wide character encoding method),
20793 where @cite{x} is one of the following characters
20796 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
20797 @headitem
20799 Character
20801 @tab
20803 Encoding
20805 @item
20807 @emph{h}
20809 @tab
20811 Hex ESC encoding
20813 @item
20815 @emph{u}
20817 @tab
20819 Upper half encoding
20821 @item
20823 @emph{s}
20825 @tab
20827 Shift-JIS encoding
20829 @item
20831 @emph{e}
20833 @tab
20835 EUC Encoding
20837 @item
20839 @emph{8}
20841 @tab
20843 UTF-8 encoding
20845 @item
20847 @emph{b}
20849 @tab
20851 Brackets encoding
20853 @end multitable
20856 The encoding methods match those that
20857 can be used in a source
20858 program, but there is no requirement that the encoding method used for
20859 the source program be the same as the encoding method used for files,
20860 and different files may use different encoding methods.
20862 The default encoding method for the standard files, and for opened files
20863 for which no WCEM parameter is given in the FORM string matches the
20864 wide character encoding specified for the main program (the default
20865 being brackets encoding if no coding method was specified with -gnatW).
20868 @table @asis
20870 @item @emph{Hex Coding}
20872 In this encoding, a wide character is represented by a five character
20873 sequence:
20874 @end table
20876 @example
20877 ESC a b c d
20878 @end example
20881 @quotation
20883 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
20884 characters (using upper case letters) of the wide character code.  For
20885 example, ESC A345 is used to represent the wide character with code
20886 16#A345#.  This scheme is compatible with use of the full
20887 @cite{Wide_Character} set.
20888 @end quotation
20891 @table @asis
20893 @item @emph{Upper Half Coding}
20895 The wide character with encoding 16#abcd#, where the upper bit is on
20896 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
20897 16#cd#.  The second byte may never be a format control character, but is
20898 not required to be in the upper half.  This method can be also used for
20899 shift-JIS or EUC where the internal coding matches the external coding.
20901 @item @emph{Shift JIS Coding}
20903 A wide character is represented by a two character sequence 16#ab# and
20904 16#cd#, with the restrictions described for upper half encoding as
20905 described above.  The internal character code is the corresponding JIS
20906 character according to the standard algorithm for Shift-JIS
20907 conversion.  Only characters defined in the JIS code set table can be
20908 used with this encoding method.
20910 @item @emph{EUC Coding}
20912 A wide character is represented by a two character sequence 16#ab# and
20913 16#cd#, with both characters being in the upper half.  The internal
20914 character code is the corresponding JIS character according to the EUC
20915 encoding algorithm.  Only characters defined in the JIS code set table
20916 can be used with this encoding method.
20918 @item @emph{UTF-8 Coding}
20920 A wide character is represented using
20921 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
20922 10646-1/Am.2.  Depending on the character value, the representation
20923 is a one, two, or three byte sequence:
20924 @end table
20926 @example
20927 16#0000#-16#007f#: 2#0xxxxxxx#
20928 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
20929 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
20930 @end example
20933 @quotation
20935 where the @cite{xxx} bits correspond to the left-padded bits of the
20936 16-bit character value.  Note that all lower half ASCII characters
20937 are represented as ASCII bytes and all upper half characters and
20938 other wide characters are represented as sequences of upper-half
20939 (The full UTF-8 scheme allows for encoding 31-bit characters as
20940 6-byte sequences, but in this implementation, all UTF-8 sequences
20941 of four or more bytes length will raise a Constraint_Error, as
20942 will all invalid UTF-8 sequences.)
20943 @end quotation
20946 @table @asis
20948 @item @emph{Brackets Coding}
20950 In this encoding, a wide character is represented by the following eight
20951 character sequence:
20952 @end table
20954 @example
20955 [ " a b c d " ]
20956 @end example
20959 @quotation
20961 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
20962 characters (using uppercase letters) of the wide character code.  For
20963 example, @cite{["A345"]} is used to represent the wide character with code
20964 @cite{16#A345#}.
20965 This scheme is compatible with use of the full Wide_Character set.
20966 On input, brackets coding can also be used for upper half characters,
20967 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
20968 is only used for wide characters with a code greater than @cite{16#FF#}.
20970 Note that brackets coding is not normally used in the context of
20971 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
20972 a portable way of encoding source files. In the context of Wide_Text_IO
20973 or Wide_Wide_Text_IO, it can only be used if the file does not contain
20974 any instance of the left bracket character other than to encode wide
20975 character values using the brackets encoding method. In practice it is
20976 expected that some standard wide character encoding method such
20977 as UTF-8 will be used for text input output.
20979 If brackets notation is used, then any occurrence of a left bracket
20980 in the input file which is not the start of a valid wide character
20981 sequence will cause Constraint_Error to be raised. It is possible to
20982 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
20983 input will interpret this as a left bracket.
20985 However, when a left bracket is output, it will be output as a left bracket
20986 and not as ["5B"]. We make this decision because for normal use of
20987 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
20988 brackets. For example, if we write:
20990 @example
20991 Put_Line ("Start of output [first run]");
20992 @end example
20994 we really do not want to have the left bracket in this message clobbered so
20995 that the output reads:
20996 @end quotation
20998 @example
20999 Start of output ["5B"]first run]
21000 @end example
21003 @quotation
21005 In practice brackets encoding is reasonably useful for normal Put_Line use
21006 since we won't get confused between left brackets and wide character
21007 sequences in the output. But for input, or when files are written out
21008 and read back in, it really makes better sense to use one of the standard
21009 encoding methods such as UTF-8.
21010 @end quotation
21012 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
21013 not all wide character
21014 values can be represented.  An attempt to output a character that cannot
21015 be represented using the encoding scheme for the file causes
21016 Constraint_Error to be raised.  An invalid wide character sequence on
21017 input also causes Constraint_Error to be raised.
21019 @menu
21020 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
21021 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
21023 @end menu
21025 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
21026 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{25e}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{25f}
21027 @subsection Stream Pointer Positioning
21030 @cite{Ada.Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21031 of stream pointer positioning (@ref{24f,,Text_IO}).  There is one additional
21032 case:
21034 If @cite{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
21035 normal lower ASCII set (i.e., a character in the range:
21037 @example
21038 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
21039 @end example
21041 then although the logical position of the file pointer is unchanged by
21042 the @cite{Look_Ahead} call, the stream is physically positioned past the
21043 wide character sequence.  Again this is to avoid the need for buffering
21044 or backup, and all @cite{Wide_Text_IO} routines check the internal
21045 indication that this situation has occurred so that this is not visible
21046 to a normal program using @cite{Wide_Text_IO}.  However, this discrepancy
21047 can be observed if the wide text file shares a stream with another file.
21049 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
21050 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{260}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{261}
21051 @subsection Reading and Writing Non-Regular Files
21054 As in the case of Text_IO, when a non-regular file is read, it is
21055 assumed that the file contains no page marks (any form characters are
21056 treated as data characters), and @cite{End_Of_Page} always returns
21057 @cite{False}.  Similarly, the end of file indication is not sticky, so
21058 it is possible to read beyond an end of file.
21060 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
21061 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{262}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{263}
21062 @section Wide_Wide_Text_IO
21065 @cite{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
21066 both input and output files may contain special sequences that represent
21067 wide wide character values.  The encoding scheme for a given file may be
21068 specified using a FORM parameter:
21070 @example
21071 WCEM=`x`
21072 @end example
21074 as part of the FORM string (WCEM = wide character encoding method),
21075 where @cite{x} is one of the following characters
21078 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21079 @headitem
21081 Character
21083 @tab
21085 Encoding
21087 @item
21089 @emph{h}
21091 @tab
21093 Hex ESC encoding
21095 @item
21097 @emph{u}
21099 @tab
21101 Upper half encoding
21103 @item
21105 @emph{s}
21107 @tab
21109 Shift-JIS encoding
21111 @item
21113 @emph{e}
21115 @tab
21117 EUC Encoding
21119 @item
21121 @emph{8}
21123 @tab
21125 UTF-8 encoding
21127 @item
21129 @emph{b}
21131 @tab
21133 Brackets encoding
21135 @end multitable
21138 The encoding methods match those that
21139 can be used in a source
21140 program, but there is no requirement that the encoding method used for
21141 the source program be the same as the encoding method used for files,
21142 and different files may use different encoding methods.
21144 The default encoding method for the standard files, and for opened files
21145 for which no WCEM parameter is given in the FORM string matches the
21146 wide character encoding specified for the main program (the default
21147 being brackets encoding if no coding method was specified with -gnatW).
21150 @table @asis
21152 @item @emph{UTF-8 Coding}
21154 A wide character is represented using
21155 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21156 10646-1/Am.2.  Depending on the character value, the representation
21157 is a one, two, three, or four byte sequence:
21158 @end table
21160 @example
21161 16#000000#-16#00007f#: 2#0xxxxxxx#
21162 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
21163 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21164 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
21165 @end example
21168 @quotation
21170 where the @cite{xxx} bits correspond to the left-padded bits of the
21171 21-bit character value.  Note that all lower half ASCII characters
21172 are represented as ASCII bytes and all upper half characters and
21173 other wide characters are represented as sequences of upper-half
21174 characters.
21175 @end quotation
21178 @table @asis
21180 @item @emph{Brackets Coding}
21182 In this encoding, a wide wide character is represented by the following eight
21183 character sequence if is in wide character range
21184 @end table
21186 @example
21187 [ " a b c d " ]
21188 @end example
21191 @quotation
21193 and by the following ten character sequence if not
21194 @end quotation
21196 @example
21197 [ " a b c d e f " ]
21198 @end example
21201 @quotation
21203 where @cite{a}, @cite{b}, @cite{c}, @cite{d}, @cite{e}, and @cite{f}
21204 are the four or six hexadecimal
21205 characters (using uppercase letters) of the wide wide character code.  For
21206 example, @cite{["01A345"]} is used to represent the wide wide character
21207 with code @cite{16#01A345#}.
21209 This scheme is compatible with use of the full Wide_Wide_Character set.
21210 On input, brackets coding can also be used for upper half characters,
21211 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21212 is only used for wide characters with a code greater than @cite{16#FF#}.
21213 @end quotation
21215 If is also possible to use the other Wide_Character encoding methods,
21216 such as Shift-JIS, but the other schemes cannot support the full range
21217 of wide wide characters.
21218 An attempt to output a character that cannot
21219 be represented using the encoding scheme for the file causes
21220 Constraint_Error to be raised.  An invalid wide character sequence on
21221 input also causes Constraint_Error to be raised.
21223 @menu
21224 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
21225 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
21227 @end menu
21229 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
21230 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{264}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{265}
21231 @subsection Stream Pointer Positioning
21234 @cite{Ada.Wide_Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21235 of stream pointer positioning (@ref{24f,,Text_IO}).  There is one additional
21236 case:
21238 If @cite{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
21239 normal lower ASCII set (i.e., a character in the range:
21241 @example
21242 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
21243 @end example
21245 then although the logical position of the file pointer is unchanged by
21246 the @cite{Look_Ahead} call, the stream is physically positioned past the
21247 wide character sequence.  Again this is to avoid the need for buffering
21248 or backup, and all @cite{Wide_Wide_Text_IO} routines check the internal
21249 indication that this situation has occurred so that this is not visible
21250 to a normal program using @cite{Wide_Wide_Text_IO}.  However, this discrepancy
21251 can be observed if the wide text file shares a stream with another file.
21253 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
21254 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{266}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{267}
21255 @subsection Reading and Writing Non-Regular Files
21258 As in the case of Text_IO, when a non-regular file is read, it is
21259 assumed that the file contains no page marks (any form characters are
21260 treated as data characters), and @cite{End_Of_Page} always returns
21261 @cite{False}.  Similarly, the end of file indication is not sticky, so
21262 it is possible to read beyond an end of file.
21264 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
21265 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{268}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{269}
21266 @section Stream_IO
21269 A stream file is a sequence of bytes, where individual elements are
21270 written to the file as described in the Ada Reference Manual.  The type
21271 @cite{Stream_Element} is simply a byte.  There are two ways to read or
21272 write a stream file.
21275 @itemize *
21277 @item 
21278 The operations @cite{Read} and @cite{Write} directly read or write a
21279 sequence of stream elements with no control information.
21281 @item 
21282 The stream attributes applied to a stream file transfer data in the
21283 manner described for stream attributes.
21284 @end itemize
21286 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
21287 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{26a}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{26b}
21288 @section Text Translation
21291 @code{Text_Translation=xxx} may be used as the Form parameter
21292 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
21293 has no effect on Unix systems. Possible values are:
21296 @itemize *
21298 @item 
21299 @code{Yes} or @code{Text} is the default, which means to
21300 translate LF to/from CR/LF on Windows systems.
21302 @code{No} disables this translation; i.e. it
21303 uses binary mode. For output files, @code{Text_Translation=No}
21304 may be used to create Unix-style files on
21305 Windows.
21307 @item 
21308 @code{wtext} translation enabled in Unicode mode.
21309 (corresponds to _O_WTEXT).
21311 @item 
21312 @code{u8text} translation enabled in Unicode UTF-8 mode.
21313 (corresponds to O_U8TEXT).
21315 @item 
21316 @code{u16text} translation enabled in Unicode UTF-16
21317 mode. (corresponds to_O_U16TEXT).
21318 @end itemize
21320 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
21321 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{26c}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{26d}
21322 @section Shared Files
21325 Section A.14 of the Ada Reference Manual allows implementations to
21326 provide a wide variety of behavior if an attempt is made to access the
21327 same external file with two or more internal files.
21329 To provide a full range of functionality, while at the same time
21330 minimizing the problems of portability caused by this implementation
21331 dependence, GNAT handles file sharing as follows:
21334 @itemize *
21336 @item 
21337 In the absence of a @code{shared=xxx} form parameter, an attempt
21338 to open two or more files with the same full name is considered an error
21339 and is not supported.  The exception @cite{Use_Error} will be
21340 raised.  Note that a file that is not explicitly closed by the program
21341 remains open until the program terminates.
21343 @item 
21344 If the form parameter @code{shared=no} appears in the form string, the
21345 file can be opened or created with its own separate stream identifier,
21346 regardless of whether other files sharing the same external file are
21347 opened.  The exact effect depends on how the C stream routines handle
21348 multiple accesses to the same external files using separate streams.
21350 @item 
21351 If the form parameter @code{shared=yes} appears in the form string for
21352 each of two or more files opened using the same full name, the same
21353 stream is shared between these files, and the semantics are as described
21354 in Ada Reference Manual, Section A.14.
21355 @end itemize
21357 When a program that opens multiple files with the same name is ported
21358 from another Ada compiler to GNAT, the effect will be that
21359 @cite{Use_Error} is raised.
21361 The documentation of the original compiler and the documentation of the
21362 program should then be examined to determine if file sharing was
21363 expected, and @code{shared=xxx} parameters added to @cite{Open}
21364 and @cite{Create} calls as required.
21366 When a program is ported from GNAT to some other Ada compiler, no
21367 special attention is required unless the @code{shared=xxx} form
21368 parameter is used in the program.  In this case, you must examine the
21369 documentation of the new compiler to see if it supports the required
21370 file sharing semantics, and form strings modified appropriately.  Of
21371 course it may be the case that the program cannot be ported if the
21372 target compiler does not support the required functionality.  The best
21373 approach in writing portable code is to avoid file sharing (and hence
21374 the use of the @code{shared=xxx} parameter in the form string)
21375 completely.
21377 One common use of file sharing in Ada 83 is the use of instantiations of
21378 Sequential_IO on the same file with different types, to achieve
21379 heterogeneous input-output.  Although this approach will work in GNAT if
21380 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
21381 for this purpose (using the stream attributes)
21383 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
21384 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{26e}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{26f}
21385 @section Filenames encoding
21388 An encoding form parameter can be used to specify the filename
21389 encoding @code{encoding=xxx}.
21392 @itemize *
21394 @item 
21395 If the form parameter @code{encoding=utf8} appears in the form string, the
21396 filename must be encoded in UTF-8.
21398 @item 
21399 If the form parameter @code{encoding=8bits} appears in the form
21400 string, the filename must be a standard 8bits string.
21401 @end itemize
21403 In the absence of a @code{encoding=xxx} form parameter, the
21404 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
21405 variable. And if not set @code{utf8} is assumed.
21408 @table @asis
21410 @item @emph{CP_ACP}
21412 The current system Windows ANSI code page.
21414 @item @emph{CP_UTF8}
21416 UTF-8 encoding
21417 @end table
21419 This encoding form parameter is only supported on the Windows
21420 platform. On the other Operating Systems the run-time is supporting
21421 UTF-8 natively.
21423 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
21424 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{270}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{271}
21425 @section File content encoding
21428 For text files it is possible to specify the encoding to use. This is
21429 controlled by the by the @code{GNAT_CCS_ENCODING} environment
21430 variable. And if not set @code{TEXT} is assumed.
21432 The possible values are those supported on Windows:
21435 @table @asis
21437 @item @emph{TEXT}
21439 Translated text mode
21441 @item @emph{WTEXT}
21443 Translated unicode encoding
21445 @item @emph{U16TEXT}
21447 Unicode 16-bit encoding
21449 @item @emph{U8TEXT}
21451 Unicode 8-bit encoding
21452 @end table
21454 This encoding is only supported on the Windows platform.
21456 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
21457 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{272}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{273}
21458 @section Open Modes
21461 @cite{Open} and @cite{Create} calls result in a call to @cite{fopen}
21462 using the mode shown in the following table:
21465 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
21466 @headitem
21468 @cite{Open} and @cite{Create} Call Modes
21470 @tab
21472 @tab
21474 @item
21476 @tab
21478 @strong{OPEN}
21480 @tab
21482 @strong{CREATE}
21484 @item
21486 Append_File
21488 @tab
21490 "r+"
21492 @tab
21494 "w+"
21496 @item
21498 In_File
21500 @tab
21504 @tab
21506 "w+"
21508 @item
21510 Out_File (Direct_IO)
21512 @tab
21514 "r+"
21516 @tab
21520 @item
21522 Out_File (all other cases)
21524 @tab
21528 @tab
21532 @item
21534 Inout_File
21536 @tab
21538 "r+"
21540 @tab
21542 "w+"
21544 @end multitable
21547 If text file translation is required, then either @code{b} or @code{t}
21548 is added to the mode, depending on the setting of Text.  Text file
21549 translation refers to the mapping of CR/LF sequences in an external file
21550 to LF characters internally.  This mapping only occurs in DOS and
21551 DOS-like systems, and is not relevant to other systems.
21553 A special case occurs with Stream_IO.  As shown in the above table, the
21554 file is initially opened in @code{r} or @code{w} mode for the
21555 @cite{In_File} and @cite{Out_File} cases.  If a @cite{Set_Mode} operation
21556 subsequently requires switching from reading to writing or vice-versa,
21557 then the file is reopened in @code{r+} mode to permit the required operation.
21559 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
21560 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{274}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{275}
21561 @section Operations on C Streams
21564 The package @cite{Interfaces.C_Streams} provides an Ada program with direct
21565 access to the C library functions for operations on C streams:
21567 @example
21568 package Interfaces.C_Streams is
21569   -- Note: the reason we do not use the types that are in
21570   -- Interfaces.C is that we want to avoid dragging in the
21571   -- code in this unit if possible.
21572   subtype chars is System.Address;
21573   -- Pointer to null-terminated array of characters
21574   subtype FILEs is System.Address;
21575   -- Corresponds to the C type FILE*
21576   subtype voids is System.Address;
21577   -- Corresponds to the C type void*
21578   subtype int is Integer;
21579   subtype long is Long_Integer;
21580   -- Note: the above types are subtypes deliberately, and it
21581   -- is part of this spec that the above correspondences are
21582   -- guaranteed.  This means that it is legitimate to, for
21583   -- example, use Integer instead of int.  We provide these
21584   -- synonyms for clarity, but in some cases it may be
21585   -- convenient to use the underlying types (for example to
21586   -- avoid an unnecessary dependency of a spec on the spec
21587   -- of this unit).
21588   type size_t is mod 2 ** Standard'Address_Size;
21589   NULL_Stream : constant FILEs;
21590   -- Value returned (NULL in C) to indicate an
21591   -- fdopen/fopen/tmpfile error
21592   ----------------------------------
21593   -- Constants Defined in stdio.h --
21594   ----------------------------------
21595   EOF : constant int;
21596   -- Used by a number of routines to indicate error or
21597   -- end of file
21598   IOFBF : constant int;
21599   IOLBF : constant int;
21600   IONBF : constant int;
21601   -- Used to indicate buffering mode for setvbuf call
21602   SEEK_CUR : constant int;
21603   SEEK_END : constant int;
21604   SEEK_SET : constant int;
21605   -- Used to indicate origin for fseek call
21606   function stdin return FILEs;
21607   function stdout return FILEs;
21608   function stderr return FILEs;
21609   -- Streams associated with standard files
21610   --------------------------
21611   -- Standard C functions --
21612   --------------------------
21613   -- The functions selected below are ones that are
21614   -- available in UNIX (but not necessarily in ANSI C).
21615   -- These are very thin interfaces
21616   -- which copy exactly the C headers.  For more
21617   -- documentation on these functions, see the Microsoft C
21618   -- "Run-Time Library Reference" (Microsoft Press, 1990,
21619   -- ISBN 1-55615-225-6), which includes useful information
21620   -- on system compatibility.
21621   procedure clearerr (stream : FILEs);
21622   function fclose (stream : FILEs) return int;
21623   function fdopen (handle : int; mode : chars) return FILEs;
21624   function feof (stream : FILEs) return int;
21625   function ferror (stream : FILEs) return int;
21626   function fflush (stream : FILEs) return int;
21627   function fgetc (stream : FILEs) return int;
21628   function fgets (strng : chars; n : int; stream : FILEs)
21629       return chars;
21630   function fileno (stream : FILEs) return int;
21631   function fopen (filename : chars; Mode : chars)
21632       return FILEs;
21633   -- Note: to maintain target independence, use
21634   -- text_translation_required, a boolean variable defined in
21635   -- a-sysdep.c to deal with the target dependent text
21636   -- translation requirement.  If this variable is set,
21637   -- then  b/t should be appended to the standard mode
21638   -- argument to set the text translation mode off or on
21639   -- as required.
21640   function fputc (C : int; stream : FILEs) return int;
21641   function fputs (Strng : chars; Stream : FILEs) return int;
21642   function fread
21643      (buffer : voids;
21644       size : size_t;
21645       count : size_t;
21646       stream : FILEs)
21647       return size_t;
21648   function freopen
21649      (filename : chars;
21650       mode : chars;
21651       stream : FILEs)
21652       return FILEs;
21653   function fseek
21654      (stream : FILEs;
21655       offset : long;
21656       origin : int)
21657       return int;
21658   function ftell (stream : FILEs) return long;
21659   function fwrite
21660      (buffer : voids;
21661       size : size_t;
21662       count : size_t;
21663       stream : FILEs)
21664       return size_t;
21665   function isatty (handle : int) return int;
21666   procedure mktemp (template : chars);
21667   -- The return value (which is just a pointer to template)
21668   -- is discarded
21669   procedure rewind (stream : FILEs);
21670   function rmtmp return int;
21671   function setvbuf
21672      (stream : FILEs;
21673       buffer : chars;
21674       mode : int;
21675       size : size_t)
21676       return int;
21678   function tmpfile return FILEs;
21679   function ungetc (c : int; stream : FILEs) return int;
21680   function unlink (filename : chars) return int;
21681   ---------------------
21682   -- Extra functions --
21683   ---------------------
21684   -- These functions supply slightly thicker bindings than
21685   -- those above.  They are derived from functions in the
21686   -- C Run-Time Library, but may do a bit more work than
21687   -- just directly calling one of the Library functions.
21688   function is_regular_file (handle : int) return int;
21689   -- Tests if given handle is for a regular file (result 1)
21690   -- or for a non-regular file (pipe or device, result 0).
21691   ---------------------------------
21692   -- Control of Text/Binary Mode --
21693   ---------------------------------
21694   -- If text_translation_required is true, then the following
21695   -- functions may be used to dynamically switch a file from
21696   -- binary to text mode or vice versa.  These functions have
21697   -- no effect if text_translation_required is false (i.e., in
21698   -- normal UNIX mode).  Use fileno to get a stream handle.
21699   procedure set_binary_mode (handle : int);
21700   procedure set_text_mode (handle : int);
21701   ----------------------------
21702   -- Full Path Name support --
21703   ----------------------------
21704   procedure full_name (nam : chars; buffer : chars);
21705   -- Given a NUL terminated string representing a file
21706   -- name, returns in buffer a NUL terminated string
21707   -- representing the full path name for the file name.
21708   -- On systems where it is relevant the   drive is also
21709   -- part of the full path name.  It is the responsibility
21710   -- of the caller to pass an actual parameter for buffer
21711   -- that is big enough for any full path name.  Use
21712   -- max_path_len given below as the size of buffer.
21713   max_path_len : integer;
21714   -- Maximum length of an allowable full path name on the
21715   -- system, including a terminating NUL character.
21716 end Interfaces.C_Streams;
21717 @end example
21719 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
21720 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{276}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{277}
21721 @section Interfacing to C Streams
21724 The packages in this section permit interfacing Ada files to C Stream
21725 operations.
21727 @example
21728 with Interfaces.C_Streams;
21729 package Ada.Sequential_IO.C_Streams is
21730    function C_Stream (F : File_Type)
21731       return Interfaces.C_Streams.FILEs;
21732    procedure Open
21733      (File : in out File_Type;
21734       Mode : in File_Mode;
21735       C_Stream : in Interfaces.C_Streams.FILEs;
21736       Form : in String := "");
21737 end Ada.Sequential_IO.C_Streams;
21739  with Interfaces.C_Streams;
21740  package Ada.Direct_IO.C_Streams is
21741     function C_Stream (F : File_Type)
21742        return Interfaces.C_Streams.FILEs;
21743     procedure Open
21744       (File : in out File_Type;
21745        Mode : in File_Mode;
21746        C_Stream : in Interfaces.C_Streams.FILEs;
21747        Form : in String := "");
21748  end Ada.Direct_IO.C_Streams;
21750  with Interfaces.C_Streams;
21751  package Ada.Text_IO.C_Streams is
21752     function C_Stream (F : File_Type)
21753        return Interfaces.C_Streams.FILEs;
21754     procedure Open
21755       (File : in out File_Type;
21756        Mode : in File_Mode;
21757        C_Stream : in Interfaces.C_Streams.FILEs;
21758        Form : in String := "");
21759  end Ada.Text_IO.C_Streams;
21761  with Interfaces.C_Streams;
21762  package Ada.Wide_Text_IO.C_Streams is
21763     function C_Stream (F : File_Type)
21764        return Interfaces.C_Streams.FILEs;
21765     procedure Open
21766       (File : in out File_Type;
21767        Mode : in File_Mode;
21768        C_Stream : in Interfaces.C_Streams.FILEs;
21769        Form : in String := "");
21770 end Ada.Wide_Text_IO.C_Streams;
21772  with Interfaces.C_Streams;
21773  package Ada.Wide_Wide_Text_IO.C_Streams is
21774     function C_Stream (F : File_Type)
21775        return Interfaces.C_Streams.FILEs;
21776     procedure Open
21777       (File : in out File_Type;
21778        Mode : in File_Mode;
21779        C_Stream : in Interfaces.C_Streams.FILEs;
21780        Form : in String := "");
21781 end Ada.Wide_Wide_Text_IO.C_Streams;
21783 with Interfaces.C_Streams;
21784 package Ada.Stream_IO.C_Streams is
21785    function C_Stream (F : File_Type)
21786       return Interfaces.C_Streams.FILEs;
21787    procedure Open
21788      (File : in out File_Type;
21789       Mode : in File_Mode;
21790       C_Stream : in Interfaces.C_Streams.FILEs;
21791       Form : in String := "");
21792 end Ada.Stream_IO.C_Streams;
21793 @end example
21795 In each of these six packages, the @cite{C_Stream} function obtains the
21796 @cite{FILE} pointer from a currently opened Ada file.  It is then
21797 possible to use the @cite{Interfaces.C_Streams} package to operate on
21798 this stream, or the stream can be passed to a C program which can
21799 operate on it directly.  Of course the program is responsible for
21800 ensuring that only appropriate sequences of operations are executed.
21802 One particular use of relevance to an Ada program is that the
21803 @cite{setvbuf} function can be used to control the buffering of the
21804 stream used by an Ada file.  In the absence of such a call the standard
21805 default buffering is used.
21807 The @cite{Open} procedures in these packages open a file giving an
21808 existing C Stream instead of a file name.  Typically this stream is
21809 imported from a C program, allowing an Ada file to operate on an
21810 existing C file.
21812 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
21813 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{278}@anchor{gnat_rm/the_gnat_library id1}@anchor{279}
21814 @chapter The GNAT Library
21817 The GNAT library contains a number of general and special purpose packages.
21818 It represents functionality that the GNAT developers have found useful, and
21819 which is made available to GNAT users.  The packages described here are fully
21820 supported, and upwards compatibility will be maintained in future releases,
21821 so you can use these facilities with the confidence that the same functionality
21822 will be available in future releases.
21824 The chapter here simply gives a brief summary of the facilities available.
21825 The full documentation is found in the spec file for the package.  The full
21826 sources of these library packages, including both spec and body, are provided
21827 with all GNAT releases.  For example, to find out the full specifications of
21828 the SPITBOL pattern matching capability, including a full tutorial and
21829 extensive examples, look in the @code{g-spipat.ads} file in the library.
21831 For each entry here, the package name (as it would appear in a @cite{with}
21832 clause) is given, followed by the name of the corresponding spec file in
21833 parentheses.  The packages are children in four hierarchies, @cite{Ada},
21834 @cite{Interfaces}, @cite{System}, and @cite{GNAT}, the latter being a
21835 GNAT-specific hierarchy.
21837 Note that an application program should only use packages in one of these
21838 four hierarchies if the package is defined in the Ada Reference Manual,
21839 or is listed in this section of the GNAT Programmers Reference Manual.
21840 All other units should be considered internal implementation units and
21841 should not be directly @cite{with}'ed by application code.  The use of
21842 a @cite{with} statement that references one of these internal implementation
21843 units makes an application potentially dependent on changes in versions
21844 of GNAT, and will generate a warning message.
21846 @menu
21847 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
21848 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
21849 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
21850 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
21851 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
21852 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
21853 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
21854 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
21855 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
21856 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
21857 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
21858 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
21859 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
21860 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
21861 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
21862 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
21863 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
21864 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
21865 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
21866 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
21867 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
21868 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
21869 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
21870 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
21871 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
21872 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
21873 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
21874 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
21875 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
21876 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
21877 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
21878 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
21879 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
21880 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
21881 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
21882 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
21883 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
21884 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
21885 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
21886 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
21887 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
21888 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
21889 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
21890 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
21891 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
21892 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
21893 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
21894 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
21895 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
21896 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
21897 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
21898 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
21899 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
21900 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
21901 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
21902 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
21903 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
21904 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
21905 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
21906 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
21907 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
21908 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
21909 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
21910 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
21911 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
21912 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
21913 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
21914 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
21915 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
21916 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
21917 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
21918 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
21919 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
21920 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
21921 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
21922 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
21923 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
21924 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
21925 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
21926 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
21927 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
21928 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
21929 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
21930 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
21931 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
21932 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
21933 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
21934 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
21935 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
21936 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
21937 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
21938 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
21939 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
21940 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
21941 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
21942 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
21943 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
21944 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
21945 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
21946 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
21947 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
21948 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
21949 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
21950 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
21951 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
21952 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
21953 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
21954 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
21955 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
21956 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
21957 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
21958 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
21959 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
21960 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
21961 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
21962 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
21963 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
21964 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
21965 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
21966 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
21967 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
21968 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
21969 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
21970 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
21971 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
21972 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
21973 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
21974 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
21975 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
21976 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
21977 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
21978 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
21979 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
21980 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
21981 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
21982 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
21983 * System.Memory (s-memory.ads): System Memory s-memory ads. 
21984 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
21985 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
21986 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
21987 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
21988 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
21989 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
21990 * System.Rident (s-rident.ads): System Rident s-rident ads. 
21991 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
21992 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
21993 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
21994 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
21996 @end menu
21998 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
21999 @anchor{gnat_rm/the_gnat_library id2}@anchor{27a}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{27b}
22000 @section @cite{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
22003 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
22005 @geindex Latin_9 constants for Character
22007 This child of @cite{Ada.Characters}
22008 provides a set of definitions corresponding to those in the
22009 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22010 few modifications required for @cite{Latin-9}
22011 The provision of such a package
22012 is specifically authorized by the Ada Reference Manual
22013 (RM A.3.3(27)).
22015 @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
22016 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{27c}@anchor{gnat_rm/the_gnat_library id3}@anchor{27d}
22017 @section @cite{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
22020 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
22022 @geindex Latin_1 constants for Wide_Character
22024 This child of @cite{Ada.Characters}
22025 provides a set of definitions corresponding to those in the
22026 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22027 types of the constants being @cite{Wide_Character}
22028 instead of @cite{Character}.  The provision of such a package
22029 is specifically authorized by the Ada Reference Manual
22030 (RM A.3.3(27)).
22032 @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
22033 @anchor{gnat_rm/the_gnat_library id4}@anchor{27e}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{27f}
22034 @section @cite{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
22037 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
22039 @geindex Latin_9 constants for Wide_Character
22041 This child of @cite{Ada.Characters}
22042 provides a set of definitions corresponding to those in the
22043 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22044 types of the constants being @cite{Wide_Character}
22045 instead of @cite{Character}.  The provision of such a package
22046 is specifically authorized by the Ada Reference Manual
22047 (RM A.3.3(27)).
22049 @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
22050 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{280}@anchor{gnat_rm/the_gnat_library id5}@anchor{281}
22051 @section @cite{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
22054 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
22056 @geindex Latin_1 constants for Wide_Wide_Character
22058 This child of @cite{Ada.Characters}
22059 provides a set of definitions corresponding to those in the
22060 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22061 types of the constants being @cite{Wide_Wide_Character}
22062 instead of @cite{Character}.  The provision of such a package
22063 is specifically authorized by the Ada Reference Manual
22064 (RM A.3.3(27)).
22066 @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
22067 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{282}@anchor{gnat_rm/the_gnat_library id6}@anchor{283}
22068 @section @cite{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
22071 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
22073 @geindex Latin_9 constants for Wide_Wide_Character
22075 This child of @cite{Ada.Characters}
22076 provides a set of definitions corresponding to those in the
22077 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22078 types of the constants being @cite{Wide_Wide_Character}
22079 instead of @cite{Character}.  The provision of such a package
22080 is specifically authorized by the Ada Reference Manual
22081 (RM A.3.3(27)).
22083 @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
22084 @anchor{gnat_rm/the_gnat_library id7}@anchor{284}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{285}
22085 @section @cite{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
22088 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
22090 @geindex Formal container for doubly linked lists
22092 This child of @cite{Ada.Containers} defines a modified version of the
22093 Ada 2005 container for doubly linked lists, 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_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
22103 @anchor{gnat_rm/the_gnat_library id8}@anchor{286}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{287}
22104 @section @cite{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
22107 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
22109 @geindex Formal container for hashed maps
22111 This child of @cite{Ada.Containers} defines a modified version of the
22112 Ada 2005 container for hashed maps, meant to facilitate formal
22113 verification of code using such containers. The specification of this
22114 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 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
22122 @anchor{gnat_rm/the_gnat_library id9}@anchor{288}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{289}
22123 @section @cite{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
22126 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
22128 @geindex Formal container for hashed sets
22130 This child of @cite{Ada.Containers} defines a modified version of the
22131 Ada 2005 container for hashed sets, meant to facilitate formal
22132 verification of code using such containers. The specification of this
22133 unit is compatible with SPARK 2014.
22135 Note that although this container was designed with formal verification
22136 in mind, it may well be generally useful in that it is a simplified more
22137 efficient version than the one defined in the standard. In particular it
22138 does not have the complex overhead required to detect cursor tampering.
22140 @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
22141 @anchor{gnat_rm/the_gnat_library id10}@anchor{28a}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{28b}
22142 @section @cite{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
22145 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
22147 @geindex Formal container for ordered maps
22149 This child of @cite{Ada.Containers} defines a modified version of the
22150 Ada 2005 container for ordered maps, meant to facilitate formal
22151 verification of code using such containers. The specification of this
22152 unit is compatible with SPARK 2014.
22154 Note that although this container was designed with formal verification
22155 in mind, it may well be generally useful in that it is a simplified more
22156 efficient version than the one defined in the standard. In particular it
22157 does not have the complex overhead required to detect cursor tampering.
22159 @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
22160 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{28c}@anchor{gnat_rm/the_gnat_library id11}@anchor{28d}
22161 @section @cite{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
22164 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
22166 @geindex Formal container for ordered sets
22168 This child of @cite{Ada.Containers} defines a modified version of the
22169 Ada 2005 container for ordered sets, meant to facilitate formal
22170 verification of code using such containers. The specification of this
22171 unit is compatible with SPARK 2014.
22173 Note that although this container was designed with formal verification
22174 in mind, it may well be generally useful in that it is a simplified more
22175 efficient version than the one defined in the standard. In particular it
22176 does not have the complex overhead required to detect cursor tampering.
22178 @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
22179 @anchor{gnat_rm/the_gnat_library id12}@anchor{28e}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{28f}
22180 @section @cite{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
22183 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
22185 @geindex Formal container for vectors
22187 This child of @cite{Ada.Containers} defines a modified version of the
22188 Ada 2005 container for vectors, meant to facilitate formal
22189 verification of code using such containers. The specification of this
22190 unit is compatible with SPARK 2014.
22192 Note that although this container was designed with formal verification
22193 in mind, it may well be generally useful in that it is a simplified more
22194 efficient version than the one defined in the standard. In particular it
22195 does not have the complex overhead required to detect cursor tampering.
22197 @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
22198 @anchor{gnat_rm/the_gnat_library id13}@anchor{290}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{291}
22199 @section @cite{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
22202 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
22204 @geindex Formal container for vectors
22206 This child of @cite{Ada.Containers} defines a modified version of the
22207 Ada 2005 container for vectors of indefinite elements, meant to
22208 facilitate formal verification of code using such containers. The
22209 specification of this unit is compatible with SPARK 2014.
22211 Note that although this container was designed with formal verification
22212 in mind, it may well be generally useful in that it is a simplified more
22213 efficient version than the one defined in the standard. In particular it
22214 does not have the complex overhead required to detect cursor tampering.
22216 @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
22217 @anchor{gnat_rm/the_gnat_library id14}@anchor{292}@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{293}
22218 @section @cite{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
22221 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
22223 @geindex Formal container for vectors
22225 This child of @cite{Ada.Containers} defines a modified version of
22226 Indefinite_Holders that avoids heap allocation.
22228 @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
22229 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{294}@anchor{gnat_rm/the_gnat_library id15}@anchor{295}
22230 @section @cite{Ada.Command_Line.Environment} (@code{a-colien.ads})
22233 @geindex Ada.Command_Line.Environment (a-colien.ads)
22235 @geindex Environment entries
22237 This child of @cite{Ada.Command_Line}
22238 provides a mechanism for obtaining environment values on systems
22239 where this concept makes sense.
22241 @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
22242 @anchor{gnat_rm/the_gnat_library id16}@anchor{296}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{297}
22243 @section @cite{Ada.Command_Line.Remove} (@code{a-colire.ads})
22246 @geindex Ada.Command_Line.Remove (a-colire.ads)
22248 @geindex Removing command line arguments
22250 @geindex Command line
22251 @geindex argument removal
22253 This child of @cite{Ada.Command_Line}
22254 provides a mechanism for logically removing
22255 arguments from the argument list.  Once removed, an argument is not visible
22256 to further calls on the subprograms in @cite{Ada.Command_Line} will not
22257 see the removed argument.
22259 @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
22260 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{298}@anchor{gnat_rm/the_gnat_library id17}@anchor{299}
22261 @section @cite{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
22264 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
22266 @geindex Response file for command line
22268 @geindex Command line
22269 @geindex response file
22271 @geindex Command line
22272 @geindex handling long command lines
22274 This child of @cite{Ada.Command_Line} provides a mechanism facilities for
22275 getting command line arguments from a text file, called a "response file".
22276 Using a response file allow passing a set of arguments to an executable longer
22277 than the maximum allowed by the system on the command line.
22279 @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
22280 @anchor{gnat_rm/the_gnat_library id18}@anchor{29a}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{29b}
22281 @section @cite{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
22284 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
22286 @geindex C Streams
22287 @geindex Interfacing with Direct_IO
22289 This package provides subprograms that allow interfacing between
22290 C streams and @cite{Direct_IO}.  The stream identifier can be
22291 extracted from a file opened on the Ada side, and an Ada file
22292 can be constructed from a stream opened on the C side.
22294 @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
22295 @anchor{gnat_rm/the_gnat_library id19}@anchor{29c}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{29d}
22296 @section @cite{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
22299 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
22301 @geindex Null_Occurrence
22302 @geindex testing for
22304 This child subprogram provides a way of testing for the null
22305 exception occurrence (@cite{Null_Occurrence}) without raising
22306 an exception.
22308 @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
22309 @anchor{gnat_rm/the_gnat_library id20}@anchor{29e}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{29f}
22310 @section @cite{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
22313 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
22315 @geindex Null_Occurrence
22316 @geindex testing for
22318 This child subprogram is used for handling otherwise unhandled
22319 exceptions (hence the name last chance), and perform clean ups before
22320 terminating the program. Note that this subprogram never returns.
22322 @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
22323 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2a0}@anchor{gnat_rm/the_gnat_library id21}@anchor{2a1}
22324 @section @cite{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
22327 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
22329 @geindex Traceback for Exception Occurrence
22331 This child package provides the subprogram (@cite{Tracebacks}) to
22332 give a traceback array of addresses based on an exception
22333 occurrence.
22335 @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
22336 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2a2}@anchor{gnat_rm/the_gnat_library id22}@anchor{2a3}
22337 @section @cite{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
22340 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
22342 @geindex C Streams
22343 @geindex Interfacing with Sequential_IO
22345 This package provides subprograms that allow interfacing between
22346 C streams and @cite{Sequential_IO}.  The stream identifier can be
22347 extracted from a file opened on the Ada side, and an Ada file
22348 can be constructed from a stream opened on the C side.
22350 @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
22351 @anchor{gnat_rm/the_gnat_library id23}@anchor{2a4}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2a5}
22352 @section @cite{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
22355 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
22357 @geindex C Streams
22358 @geindex Interfacing with Stream_IO
22360 This package provides subprograms that allow interfacing between
22361 C streams and @cite{Stream_IO}.  The stream identifier can be
22362 extracted from a file opened on the Ada side, and an Ada file
22363 can be constructed from a stream opened on the C side.
22365 @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
22366 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2a6}@anchor{gnat_rm/the_gnat_library id24}@anchor{2a7}
22367 @section @cite{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
22370 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
22372 @geindex Unbounded_String
22373 @geindex IO support
22375 @geindex Text_IO
22376 @geindex extensions for unbounded strings
22378 This package provides subprograms for Text_IO for unbounded
22379 strings, avoiding the necessity for an intermediate operation
22380 with ordinary strings.
22382 @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
22383 @anchor{gnat_rm/the_gnat_library id25}@anchor{2a8}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2a9}
22384 @section @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
22387 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
22389 @geindex Unbounded_Wide_String
22390 @geindex IO support
22392 @geindex Text_IO
22393 @geindex extensions for unbounded wide strings
22395 This package provides subprograms for Text_IO for unbounded
22396 wide strings, avoiding the necessity for an intermediate operation
22397 with ordinary wide strings.
22399 @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
22400 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2aa}@anchor{gnat_rm/the_gnat_library id26}@anchor{2ab}
22401 @section @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
22404 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
22406 @geindex Unbounded_Wide_Wide_String
22407 @geindex IO support
22409 @geindex Text_IO
22410 @geindex extensions for unbounded wide wide strings
22412 This package provides subprograms for Text_IO for unbounded
22413 wide wide strings, avoiding the necessity for an intermediate operation
22414 with ordinary wide wide strings.
22416 @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
22417 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{2ac}@anchor{gnat_rm/the_gnat_library id27}@anchor{2ad}
22418 @section @cite{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
22421 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
22423 @geindex C Streams
22424 @geindex Interfacing with `Text_IO`
22426 This package provides subprograms that allow interfacing between
22427 C streams and @cite{Text_IO}.  The stream identifier can be
22428 extracted from a file opened on the Ada side, and an Ada file
22429 can be constructed from a stream opened on the C side.
22431 @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
22432 @anchor{gnat_rm/the_gnat_library id28}@anchor{2ae}@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{2af}
22433 @section @cite{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
22436 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
22438 @geindex Text_IO resetting standard files
22440 This procedure is used to reset the status of the standard files used
22441 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
22442 embedded application) where the status of the files may change during
22443 execution (for example a standard input file may be redefined to be
22444 interactive).
22446 @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
22447 @anchor{gnat_rm/the_gnat_library id29}@anchor{2b0}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{2b1}
22448 @section @cite{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
22451 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
22453 @geindex Unicode categorization
22454 @geindex Wide_Character
22456 This package provides subprograms that allow categorization of
22457 Wide_Character values according to Unicode categories.
22459 @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
22460 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{2b2}@anchor{gnat_rm/the_gnat_library id30}@anchor{2b3}
22461 @section @cite{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
22464 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
22466 @geindex C Streams
22467 @geindex Interfacing with `Wide_Text_IO`
22469 This package provides subprograms that allow interfacing between
22470 C streams and @cite{Wide_Text_IO}.  The stream identifier can be
22471 extracted from a file opened on the Ada side, and an Ada file
22472 can be constructed from a stream opened on the C side.
22474 @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
22475 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{2b4}@anchor{gnat_rm/the_gnat_library id31}@anchor{2b5}
22476 @section @cite{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
22479 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
22481 @geindex Wide_Text_IO resetting standard files
22483 This procedure is used to reset the status of the standard files used
22484 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
22485 embedded application) where the status of the files may change during
22486 execution (for example a standard input file may be redefined to be
22487 interactive).
22489 @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
22490 @anchor{gnat_rm/the_gnat_library id32}@anchor{2b6}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{2b7}
22491 @section @cite{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
22494 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
22496 @geindex Unicode categorization
22497 @geindex Wide_Wide_Character
22499 This package provides subprograms that allow categorization of
22500 Wide_Wide_Character values according to Unicode categories.
22502 @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
22503 @anchor{gnat_rm/the_gnat_library id33}@anchor{2b8}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{2b9}
22504 @section @cite{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
22507 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
22509 @geindex C Streams
22510 @geindex Interfacing with `Wide_Wide_Text_IO`
22512 This package provides subprograms that allow interfacing between
22513 C streams and @cite{Wide_Wide_Text_IO}.  The stream identifier can be
22514 extracted from a file opened on the Ada side, and an Ada file
22515 can be constructed from a stream opened on the C side.
22517 @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
22518 @anchor{gnat_rm/the_gnat_library id34}@anchor{2ba}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{2bb}
22519 @section @cite{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
22522 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
22524 @geindex Wide_Wide_Text_IO resetting standard files
22526 This procedure is used to reset the status of the standard files used
22527 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
22528 restart in an embedded application) where the status of the files may
22529 change during execution (for example a standard input file may be
22530 redefined to be interactive).
22532 @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
22533 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{2bc}@anchor{gnat_rm/the_gnat_library id35}@anchor{2bd}
22534 @section @cite{GNAT.Altivec} (@code{g-altive.ads})
22537 @geindex GNAT.Altivec (g-altive.ads)
22539 @geindex AltiVec
22541 This is the root package of the GNAT AltiVec binding. It provides
22542 definitions of constants and types common to all the versions of the
22543 binding.
22545 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
22546 @anchor{gnat_rm/the_gnat_library id36}@anchor{2be}@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{2bf}
22547 @section @cite{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
22550 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
22552 @geindex AltiVec
22554 This package provides the Vector/View conversion routines.
22556 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
22557 @anchor{gnat_rm/the_gnat_library id37}@anchor{2c0}@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{2c1}
22558 @section @cite{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
22561 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
22563 @geindex AltiVec
22565 This package exposes the Ada interface to the AltiVec operations on
22566 vector objects. A soft emulation is included by default in the GNAT
22567 library. The hard binding is provided as a separate package. This unit
22568 is common to both bindings.
22570 @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
22571 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{2c2}@anchor{gnat_rm/the_gnat_library id38}@anchor{2c3}
22572 @section @cite{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
22575 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
22577 @geindex AltiVec
22579 This package exposes the various vector types part of the Ada binding
22580 to AltiVec facilities.
22582 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
22583 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{2c4}@anchor{gnat_rm/the_gnat_library id39}@anchor{2c5}
22584 @section @cite{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
22587 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
22589 @geindex AltiVec
22591 This package provides public 'View' data types from/to which private
22592 vector representations can be converted via
22593 GNAT.Altivec.Conversions. This allows convenient access to individual
22594 vector elements and provides a simple way to initialize vector
22595 objects.
22597 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
22598 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{2c6}@anchor{gnat_rm/the_gnat_library id40}@anchor{2c7}
22599 @section @cite{GNAT.Array_Split} (@code{g-arrspl.ads})
22602 @geindex GNAT.Array_Split (g-arrspl.ads)
22604 @geindex Array splitter
22606 Useful array-manipulation routines: given a set of separators, split
22607 an array wherever the separators appear, and provide direct access
22608 to the resulting slices.
22610 @node GNAT AWK g-awk ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Array_Split g-arrspl ads,The GNAT Library
22611 @anchor{gnat_rm/the_gnat_library id41}@anchor{2c8}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{2c9}
22612 @section @cite{GNAT.AWK} (@code{g-awk.ads})
22615 @geindex GNAT.AWK (g-awk.ads)
22617 @geindex Parsing
22619 @geindex AWK
22621 Provides AWK-like parsing functions, with an easy interface for parsing one
22622 or more files containing formatted data.  The file is viewed as a database
22623 where each record is a line and a field is a data element in this line.
22625 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT AWK g-awk ads,The GNAT Library
22626 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{2ca}@anchor{gnat_rm/the_gnat_library id42}@anchor{2cb}
22627 @section @cite{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
22630 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
22632 @geindex Parsing
22634 @geindex Bounded Buffers
22636 Provides a concurrent generic bounded buffer abstraction.  Instances are
22637 useful directly or as parts of the implementations of other abstractions,
22638 such as mailboxes.
22640 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
22641 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{2cc}@anchor{gnat_rm/the_gnat_library id43}@anchor{2cd}
22642 @section @cite{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
22645 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
22647 @geindex Parsing
22649 @geindex Mailboxes
22651 Provides a thread-safe asynchronous intertask mailbox communication facility.
22653 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
22654 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{2ce}@anchor{gnat_rm/the_gnat_library id44}@anchor{2cf}
22655 @section @cite{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
22658 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
22660 @geindex Sorting
22662 @geindex Bubble sort
22664 Provides a general implementation of bubble sort usable for sorting arbitrary
22665 data items.  Exchange and comparison procedures are provided by passing
22666 access-to-procedure values.
22668 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
22669 @anchor{gnat_rm/the_gnat_library id45}@anchor{2d0}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{2d1}
22670 @section @cite{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
22673 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
22675 @geindex Sorting
22677 @geindex Bubble sort
22679 Provides a general implementation of bubble sort usable for sorting arbitrary
22680 data items.  Move and comparison procedures are provided by passing
22681 access-to-procedure values. This is an older version, retained for
22682 compatibility. Usually @cite{GNAT.Bubble_Sort} will be preferable.
22684 @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
22685 @anchor{gnat_rm/the_gnat_library id46}@anchor{2d2}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{2d3}
22686 @section @cite{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
22689 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
22691 @geindex Sorting
22693 @geindex Bubble sort
22695 Similar to @cite{Bubble_Sort_A} except that the move and sorting procedures
22696 are provided as generic parameters, this improves efficiency, especially
22697 if the procedures can be inlined, at the expense of duplicating code for
22698 multiple instantiations.
22700 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
22701 @anchor{gnat_rm/the_gnat_library id47}@anchor{2d4}@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{2d5}
22702 @section @cite{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
22705 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
22707 @geindex UTF-8 representation
22709 @geindex Wide characte representations
22711 Provides a routine which given a string, reads the start of the string to
22712 see whether it is one of the standard byte order marks (BOM's) which signal
22713 the encoding of the string. The routine includes detection of special XML
22714 sequences for various UCS input formats.
22716 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
22717 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id48}@anchor{2d7}
22718 @section @cite{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
22721 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
22723 @geindex Byte swapping
22725 @geindex Endianness
22727 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
22728 Machine-specific implementations are available in some cases.
22730 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
22731 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{2d8}@anchor{gnat_rm/the_gnat_library id49}@anchor{2d9}
22732 @section @cite{GNAT.Calendar} (@code{g-calend.ads})
22735 @geindex GNAT.Calendar (g-calend.ads)
22737 @geindex Calendar
22739 Extends the facilities provided by @cite{Ada.Calendar} to include handling
22740 of days of the week, an extended @cite{Split} and @cite{Time_Of} capability.
22741 Also provides conversion of @cite{Ada.Calendar.Time} values to and from the
22742 C @cite{timeval} format.
22744 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
22745 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id50}@anchor{2db}
22746 @section @cite{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
22749 @geindex Calendar
22751 @geindex Time
22753 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
22755 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
22756 @anchor{gnat_rm/the_gnat_library id51}@anchor{2dc}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{2dd}
22757 @section @cite{GNAT.CRC32} (@code{g-crc32.ads})
22760 @geindex GNAT.CRC32 (g-crc32.ads)
22762 @geindex CRC32
22764 @geindex Cyclic Redundancy Check
22766 This package implements the CRC-32 algorithm.  For a full description
22767 of this algorithm see
22768 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
22769 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
22770 Aug. 1988.  Sarwate, D.V.
22772 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
22773 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{2de}@anchor{gnat_rm/the_gnat_library id52}@anchor{2df}
22774 @section @cite{GNAT.Case_Util} (@code{g-casuti.ads})
22777 @geindex GNAT.Case_Util (g-casuti.ads)
22779 @geindex Casing utilities
22781 @geindex Character handling (`GNAT.Case_Util`)
22783 A set of simple routines for handling upper and lower casing of strings
22784 without the overhead of the full casing tables
22785 in @cite{Ada.Characters.Handling}.
22787 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
22788 @anchor{gnat_rm/the_gnat_library id53}@anchor{2e0}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{2e1}
22789 @section @cite{GNAT.CGI} (@code{g-cgi.ads})
22792 @geindex GNAT.CGI (g-cgi.ads)
22794 @geindex CGI (Common Gateway Interface)
22796 This is a package for interfacing a GNAT program with a Web server via the
22797 Common Gateway Interface (CGI).  Basically this package parses the CGI
22798 parameters, which are a set of key/value pairs sent by the Web server.  It
22799 builds a table whose index is the key and provides some services to deal
22800 with this table.
22802 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
22803 @anchor{gnat_rm/the_gnat_library id54}@anchor{2e2}@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{2e3}
22804 @section @cite{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
22807 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
22809 @geindex CGI (Common Gateway Interface) cookie support
22811 @geindex Cookie support in CGI
22813 This is a package to interface a GNAT program with a Web server via the
22814 Common Gateway Interface (CGI).  It exports services to deal with Web
22815 cookies (piece of information kept in the Web client software).
22817 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
22818 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{2e4}@anchor{gnat_rm/the_gnat_library id55}@anchor{2e5}
22819 @section @cite{GNAT.CGI.Debug} (@code{g-cgideb.ads})
22822 @geindex GNAT.CGI.Debug (g-cgideb.ads)
22824 @geindex CGI (Common Gateway Interface) debugging
22826 This is a package to help debugging CGI (Common Gateway Interface)
22827 programs written in Ada.
22829 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
22830 @anchor{gnat_rm/the_gnat_library id56}@anchor{2e6}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{2e7}
22831 @section @cite{GNAT.Command_Line} (@code{g-comlin.ads})
22834 @geindex GNAT.Command_Line (g-comlin.ads)
22836 @geindex Command line
22838 Provides a high level interface to @cite{Ada.Command_Line} facilities,
22839 including the ability to scan for named switches with optional parameters
22840 and expand file names using wild card notations.
22842 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
22843 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{2e8}@anchor{gnat_rm/the_gnat_library id57}@anchor{2e9}
22844 @section @cite{GNAT.Compiler_Version} (@code{g-comver.ads})
22847 @geindex GNAT.Compiler_Version (g-comver.ads)
22849 @geindex Compiler Version
22851 @geindex Version
22852 @geindex of compiler
22854 Provides a routine for obtaining the version of the compiler used to
22855 compile the program. More accurately this is the version of the binder
22856 used to bind the program (this will normally be the same as the version
22857 of the compiler if a consistent tool set is used to compile all units
22858 of a partition).
22860 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
22861 @anchor{gnat_rm/the_gnat_library id58}@anchor{2ea}@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{2eb}
22862 @section @cite{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
22865 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
22867 @geindex Interrupt
22869 Provides a simple interface to handle Ctrl-C keyboard events.
22871 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
22872 @anchor{gnat_rm/the_gnat_library id59}@anchor{2ec}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{2ed}
22873 @section @cite{GNAT.Current_Exception} (@code{g-curexc.ads})
22876 @geindex GNAT.Current_Exception (g-curexc.ads)
22878 @geindex Current exception
22880 @geindex Exception retrieval
22882 Provides access to information on the current exception that has been raised
22883 without the need for using the Ada 95 / Ada 2005 exception choice parameter
22884 specification syntax.
22885 This is particularly useful in simulating typical facilities for
22886 obtaining information about exceptions provided by Ada 83 compilers.
22888 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
22889 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id60}@anchor{2ef}
22890 @section @cite{GNAT.Debug_Pools} (@code{g-debpoo.ads})
22893 @geindex GNAT.Debug_Pools (g-debpoo.ads)
22895 @geindex Debugging
22897 @geindex Debug pools
22899 @geindex Memory corruption debugging
22901 Provide a debugging storage pools that helps tracking memory corruption
22902 problems.
22903 See @cite{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
22905 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
22906 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{2f0}@anchor{gnat_rm/the_gnat_library id61}@anchor{2f1}
22907 @section @cite{GNAT.Debug_Utilities} (@code{g-debuti.ads})
22910 @geindex GNAT.Debug_Utilities (g-debuti.ads)
22912 @geindex Debugging
22914 Provides a few useful utilities for debugging purposes, including conversion
22915 to and from string images of address values. Supports both C and Ada formats
22916 for hexadecimal literals.
22918 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
22919 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{2f2}@anchor{gnat_rm/the_gnat_library id62}@anchor{2f3}
22920 @section @cite{GNAT.Decode_String} (@code{g-decstr.ads})
22923 @geindex GNAT.Decode_String (g-decstr.ads)
22925 @geindex Decoding strings
22927 @geindex String decoding
22929 @geindex Wide character encoding
22931 @geindex UTF-8
22933 @geindex Unicode
22935 A generic package providing routines for decoding wide character and wide wide
22936 character strings encoded as sequences of 8-bit characters using a specified
22937 encoding method. Includes validation routines, and also routines for stepping
22938 to next or previous encoded character in an encoded string.
22939 Useful in conjunction with Unicode character coding. Note there is a
22940 preinstantiation for UTF-8. See next entry.
22942 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
22943 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id63}@anchor{2f5}
22944 @section @cite{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
22947 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
22949 @geindex Decoding strings
22951 @geindex Decoding UTF-8 strings
22953 @geindex UTF-8 string decoding
22955 @geindex Wide character decoding
22957 @geindex UTF-8
22959 @geindex Unicode
22961 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
22963 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
22964 @anchor{gnat_rm/the_gnat_library id64}@anchor{2f6}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{2f7}
22965 @section @cite{GNAT.Directory_Operations} (@code{g-dirope.ads})
22968 @geindex GNAT.Directory_Operations (g-dirope.ads)
22970 @geindex Directory operations
22972 Provides a set of routines for manipulating directories, including changing
22973 the current directory, making new directories, and scanning the files in a
22974 directory.
22976 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
22977 @anchor{gnat_rm/the_gnat_library id65}@anchor{2f8}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{2f9}
22978 @section @cite{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
22981 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
22983 @geindex Directory operations iteration
22985 A child unit of GNAT.Directory_Operations providing additional operations
22986 for iterating through directories.
22988 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
22989 @anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{2fa}@anchor{gnat_rm/the_gnat_library id66}@anchor{2fb}
22990 @section @cite{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
22993 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
22995 @geindex Hash tables
22997 A generic implementation of hash tables that can be used to hash arbitrary
22998 data.  Provided in two forms, a simple form with built in hash functions,
22999 and a more complex form in which the hash function is supplied.
23001 This package provides a facility similar to that of @cite{GNAT.HTable},
23002 except that this package declares a type that can be used to define
23003 dynamic instances of the hash table, while an instantiation of
23004 @cite{GNAT.HTable} creates a single instance of the hash table.
23006 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
23007 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{2fc}@anchor{gnat_rm/the_gnat_library id67}@anchor{2fd}
23008 @section @cite{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
23011 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
23013 @geindex Table implementation
23015 @geindex Arrays
23016 @geindex extendable
23018 A generic package providing a single dimension array abstraction where the
23019 length of the array can be dynamically modified.
23021 This package provides a facility similar to that of @cite{GNAT.Table},
23022 except that this package declares a type that can be used to define
23023 dynamic instances of the table, while an instantiation of
23024 @cite{GNAT.Table} creates a single instance of the table type.
23026 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
23027 @anchor{gnat_rm/the_gnat_library id68}@anchor{2fe}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{2ff}
23028 @section @cite{GNAT.Encode_String} (@code{g-encstr.ads})
23031 @geindex GNAT.Encode_String (g-encstr.ads)
23033 @geindex Encoding strings
23035 @geindex String encoding
23037 @geindex Wide character encoding
23039 @geindex UTF-8
23041 @geindex Unicode
23043 A generic package providing routines for encoding wide character and wide
23044 wide character strings as sequences of 8-bit characters using a specified
23045 encoding method. Useful in conjunction with Unicode character coding.
23046 Note there is a preinstantiation for UTF-8. See next entry.
23048 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
23049 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{300}@anchor{gnat_rm/the_gnat_library id69}@anchor{301}
23050 @section @cite{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
23053 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
23055 @geindex Encoding strings
23057 @geindex Encoding UTF-8 strings
23059 @geindex UTF-8 string encoding
23061 @geindex Wide character encoding
23063 @geindex UTF-8
23065 @geindex Unicode
23067 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
23069 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
23070 @anchor{gnat_rm/the_gnat_library id70}@anchor{302}@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{303}
23071 @section @cite{GNAT.Exception_Actions} (@code{g-excact.ads})
23074 @geindex GNAT.Exception_Actions (g-excact.ads)
23076 @geindex Exception actions
23078 Provides callbacks when an exception is raised. Callbacks can be registered
23079 for specific exceptions, or when any exception is raised. This
23080 can be used for instance to force a core dump to ease debugging.
23082 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-expect ads,GNAT Exception_Actions g-excact ads,The GNAT Library
23083 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{304}@anchor{gnat_rm/the_gnat_library id71}@anchor{305}
23084 @section @cite{GNAT.Exception_Traces} (@code{g-exctra.ads})
23087 @geindex GNAT.Exception_Traces (g-exctra.ads)
23089 @geindex Exception traces
23091 @geindex Debugging
23093 Provides an interface allowing to control automatic output upon exception
23094 occurrences.
23096 @node GNAT Exceptions g-expect ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
23097 @anchor{gnat_rm/the_gnat_library id72}@anchor{306}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-expect-ads}@anchor{307}
23098 @section @cite{GNAT.Exceptions} (@code{g-expect.ads})
23101 @geindex GNAT.Exceptions (g-expect.ads)
23103 @geindex Exceptions
23104 @geindex Pure
23106 @geindex Pure packages
23107 @geindex exceptions
23109 Normally it is not possible to raise an exception with
23110 a message from a subprogram in a pure package, since the
23111 necessary types and subprograms are in @cite{Ada.Exceptions}
23112 which is not a pure unit. @cite{GNAT.Exceptions} provides a
23113 facility for getting around this limitation for a few
23114 predefined exceptions, and for example allow raising
23115 @cite{Constraint_Error} with a message from a pure subprogram.
23117 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-expect ads,The GNAT Library
23118 @anchor{gnat_rm/the_gnat_library id73}@anchor{308}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{309}
23119 @section @cite{GNAT.Expect} (@code{g-expect.ads})
23122 @geindex GNAT.Expect (g-expect.ads)
23124 Provides a set of subprograms similar to what is available
23125 with the standard Tcl Expect tool.
23126 It allows you to easily spawn and communicate with an external process.
23127 You can send commands or inputs to the process, and compare the output
23128 with some expected regular expression. Currently @cite{GNAT.Expect}
23129 is implemented on all native GNAT ports.
23130 It is not implemented for cross ports, and in particular is not
23131 implemented for VxWorks or LynxOS.
23133 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
23134 @anchor{gnat_rm/the_gnat_library id74}@anchor{30a}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{30b}
23135 @section @cite{GNAT.Expect.TTY} (@code{g-exptty.ads})
23138 @geindex GNAT.Expect.TTY (g-exptty.ads)
23140 As GNAT.Expect but using pseudo-terminal.
23141 Currently @cite{GNAT.Expect.TTY} is implemented on all native GNAT
23142 ports. It is not implemented for cross ports, and
23143 in particular is not implemented for VxWorks or LynxOS.
23145 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
23146 @anchor{gnat_rm/the_gnat_library id75}@anchor{30c}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{30d}
23147 @section @cite{GNAT.Float_Control} (@code{g-flocon.ads})
23150 @geindex GNAT.Float_Control (g-flocon.ads)
23152 @geindex Floating-Point Processor
23154 Provides an interface for resetting the floating-point processor into the
23155 mode required for correct semantic operation in Ada.  Some third party
23156 library calls may cause this mode to be modified, and the Reset procedure
23157 in this package can be used to reestablish the required mode.
23159 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
23160 @anchor{gnat_rm/the_gnat_library id76}@anchor{30e}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{30f}
23161 @section @cite{GNAT.Formatted_String} (@code{g-forstr.ads})
23164 @geindex GNAT.Formatted_String (g-forstr.ads)
23166 @geindex Formatted String
23168 Provides support for C/C++ printf() formatted strings. The format is
23169 copied from the printf() routine and should therefore gives identical
23170 output. Some generic routines are provided to be able to use types
23171 derived from Integer, Float or enumerations as values for the
23172 formatted string.
23174 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
23175 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{310}@anchor{gnat_rm/the_gnat_library id77}@anchor{311}
23176 @section @cite{GNAT.Heap_Sort} (@code{g-heasor.ads})
23179 @geindex GNAT.Heap_Sort (g-heasor.ads)
23181 @geindex Sorting
23183 Provides a general implementation of heap sort usable for sorting arbitrary
23184 data items. Exchange and comparison procedures are provided by passing
23185 access-to-procedure values.  The algorithm used is a modified heap sort
23186 that performs approximately N*log(N) comparisons in the worst case.
23188 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
23189 @anchor{gnat_rm/the_gnat_library id78}@anchor{312}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{313}
23190 @section @cite{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
23193 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
23195 @geindex Sorting
23197 Provides a general implementation of heap sort usable for sorting arbitrary
23198 data items. Move and comparison procedures are provided by passing
23199 access-to-procedure values.  The algorithm used is a modified heap sort
23200 that performs approximately N*log(N) comparisons in the worst case.
23201 This differs from @cite{GNAT.Heap_Sort} in having a less convenient
23202 interface, but may be slightly more efficient.
23204 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
23205 @anchor{gnat_rm/the_gnat_library id79}@anchor{314}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{315}
23206 @section @cite{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
23209 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
23211 @geindex Sorting
23213 Similar to @cite{Heap_Sort_A} except that the move and sorting procedures
23214 are provided as generic parameters, this improves efficiency, especially
23215 if the procedures can be inlined, at the expense of duplicating code for
23216 multiple instantiations.
23218 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
23219 @anchor{gnat_rm/the_gnat_library id80}@anchor{316}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{317}
23220 @section @cite{GNAT.HTable} (@code{g-htable.ads})
23223 @geindex GNAT.HTable (g-htable.ads)
23225 @geindex Hash tables
23227 A generic implementation of hash tables that can be used to hash arbitrary
23228 data.  Provides two approaches, one a simple static approach, and the other
23229 allowing arbitrary dynamic hash tables.
23231 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
23232 @anchor{gnat_rm/the_gnat_library id81}@anchor{318}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{319}
23233 @section @cite{GNAT.IO} (@code{g-io.ads})
23236 @geindex GNAT.IO (g-io.ads)
23238 @geindex Simple I/O
23240 @geindex Input/Output facilities
23242 A simple preelaborable input-output package that provides a subset of
23243 simple Text_IO functions for reading characters and strings from
23244 Standard_Input, and writing characters, strings and integers to either
23245 Standard_Output or Standard_Error.
23247 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
23248 @anchor{gnat_rm/the_gnat_library id82}@anchor{31a}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{31b}
23249 @section @cite{GNAT.IO_Aux} (@code{g-io_aux.ads})
23252 @geindex GNAT.IO_Aux (g-io_aux.ads)
23254 @geindex Text_IO
23256 @geindex Input/Output facilities
23258 Provides some auxiliary functions for use with Text_IO, including a test
23259 for whether a file exists, and functions for reading a line of text.
23261 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
23262 @anchor{gnat_rm/the_gnat_library id83}@anchor{31c}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{31d}
23263 @section @cite{GNAT.Lock_Files} (@code{g-locfil.ads})
23266 @geindex GNAT.Lock_Files (g-locfil.ads)
23268 @geindex File locking
23270 @geindex Locking using files
23272 Provides a general interface for using files as locks.  Can be used for
23273 providing program level synchronization.
23275 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
23276 @anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id84}@anchor{31f}
23277 @section @cite{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
23280 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
23282 @geindex Random number generation
23284 The original implementation of @cite{Ada.Numerics.Discrete_Random}.  Uses
23285 a modified version of the Blum-Blum-Shub generator.
23287 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
23288 @anchor{gnat_rm/the_gnat_library id85}@anchor{320}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{321}
23289 @section @cite{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
23292 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
23294 @geindex Random number generation
23296 The original implementation of @cite{Ada.Numerics.Float_Random}.  Uses
23297 a modified version of the Blum-Blum-Shub generator.
23299 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
23300 @anchor{gnat_rm/the_gnat_library id86}@anchor{322}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{323}
23301 @section @cite{GNAT.MD5} (@code{g-md5.ads})
23304 @geindex GNAT.MD5 (g-md5.ads)
23306 @geindex Message Digest MD5
23308 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
23309 the HMAC-MD5 message authentication function as described in RFC 2104 and
23310 FIPS PUB 198.
23312 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
23313 @anchor{gnat_rm/the_gnat_library id87}@anchor{324}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{325}
23314 @section @cite{GNAT.Memory_Dump} (@code{g-memdum.ads})
23317 @geindex GNAT.Memory_Dump (g-memdum.ads)
23319 @geindex Dump Memory
23321 Provides a convenient routine for dumping raw memory to either the
23322 standard output or standard error files. Uses GNAT.IO for actual
23323 output.
23325 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
23326 @anchor{gnat_rm/the_gnat_library id88}@anchor{326}@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{327}
23327 @section @cite{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
23330 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
23332 @geindex Exception
23333 @geindex obtaining most recent
23335 Provides access to the most recently raised exception.  Can be used for
23336 various logging purposes, including duplicating functionality of some
23337 Ada 83 implementation dependent extensions.
23339 @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
23340 @anchor{gnat_rm/the_gnat_library id89}@anchor{328}@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{329}
23341 @section @cite{GNAT.OS_Lib} (@code{g-os_lib.ads})
23344 @geindex GNAT.OS_Lib (g-os_lib.ads)
23346 @geindex Operating System interface
23348 @geindex Spawn capability
23350 Provides a range of target independent operating system interface functions,
23351 including time/date management, file operations, subprocess management,
23352 including a portable spawn procedure, and access to environment variables
23353 and error return codes.
23355 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
23356 @anchor{gnat_rm/the_gnat_library id90}@anchor{32a}@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{32b}
23357 @section @cite{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
23360 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
23362 @geindex Hash functions
23364 Provides a generator of static minimal perfect hash functions. No
23365 collisions occur and each item can be retrieved from the table in one
23366 probe (perfect property). The hash table size corresponds to the exact
23367 size of the key set and no larger (minimal property). The key set has to
23368 be know in advance (static property). The hash functions are also order
23369 preserving. If w2 is inserted after w1 in the generator, their
23370 hashcode are in the same order. These hashing functions are very
23371 convenient for use with realtime applications.
23373 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
23374 @anchor{gnat_rm/the_gnat_library id91}@anchor{32c}@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{32d}
23375 @section @cite{GNAT.Random_Numbers} (@code{g-rannum.ads})
23378 @geindex GNAT.Random_Numbers (g-rannum.ads)
23380 @geindex Random number generation
23382 Provides random number capabilities which extend those available in the
23383 standard Ada library and are more convenient to use.
23385 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
23386 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{201}@anchor{gnat_rm/the_gnat_library id92}@anchor{32e}
23387 @section @cite{GNAT.Regexp} (@code{g-regexp.ads})
23390 @geindex GNAT.Regexp (g-regexp.ads)
23392 @geindex Regular expressions
23394 @geindex Pattern matching
23396 A simple implementation of regular expressions, using a subset of regular
23397 expression syntax copied from familiar Unix style utilities.  This is the
23398 simplest of the three pattern matching packages provided, and is particularly
23399 suitable for 'file globbing' applications.
23401 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
23402 @anchor{gnat_rm/the_gnat_library id93}@anchor{32f}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{330}
23403 @section @cite{GNAT.Registry} (@code{g-regist.ads})
23406 @geindex GNAT.Registry (g-regist.ads)
23408 @geindex Windows Registry
23410 This is a high level binding to the Windows registry.  It is possible to
23411 do simple things like reading a key value, creating a new key.  For full
23412 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
23413 package provided with the Win32Ada binding
23415 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
23416 @anchor{gnat_rm/the_gnat_library id94}@anchor{331}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{332}
23417 @section @cite{GNAT.Regpat} (@code{g-regpat.ads})
23420 @geindex GNAT.Regpat (g-regpat.ads)
23422 @geindex Regular expressions
23424 @geindex Pattern matching
23426 A complete implementation of Unix-style regular expression matching, copied
23427 from the original V7 style regular expression library written in C by
23428 Henry Spencer (and binary compatible with this C library).
23430 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
23431 @anchor{gnat_rm/the_gnat_library id95}@anchor{333}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{334}
23432 @section @cite{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
23435 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
23437 @geindex Rewrite data
23439 A unit to rewrite on-the-fly string occurrences in a stream of
23440 data. The implementation has a very minimal memory footprint as the
23441 full content to be processed is not loaded into memory all at once. This makes
23442 this interface usable for large files or socket streams.
23444 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
23445 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id96}@anchor{336}
23446 @section @cite{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
23449 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
23451 @geindex Secondary Stack Info
23453 Provide the capability to query the high water mark of the current task's
23454 secondary stack.
23456 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
23457 @anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id97}@anchor{338}
23458 @section @cite{GNAT.Semaphores} (@code{g-semaph.ads})
23461 @geindex GNAT.Semaphores (g-semaph.ads)
23463 @geindex Semaphores
23465 Provides classic counting and binary semaphores using protected types.
23467 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
23468 @anchor{gnat_rm/the_gnat_library id98}@anchor{339}@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{33a}
23469 @section @cite{GNAT.Serial_Communications} (@code{g-sercom.ads})
23472 @geindex GNAT.Serial_Communications (g-sercom.ads)
23474 @geindex Serial_Communications
23476 Provides a simple interface to send and receive data over a serial
23477 port. This is only supported on GNU/Linux and Windows.
23479 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
23480 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id99}@anchor{33c}
23481 @section @cite{GNAT.SHA1} (@code{g-sha1.ads})
23484 @geindex GNAT.SHA1 (g-sha1.ads)
23486 @geindex Secure Hash Algorithm SHA-1
23488 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
23489 and RFC 3174, and the HMAC-SHA1 message authentication function as described
23490 in RFC 2104 and FIPS PUB 198.
23492 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
23493 @anchor{gnat_rm/the_gnat_library id100}@anchor{33d}@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{33e}
23494 @section @cite{GNAT.SHA224} (@code{g-sha224.ads})
23497 @geindex GNAT.SHA224 (g-sha224.ads)
23499 @geindex Secure Hash Algorithm SHA-224
23501 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
23502 and the HMAC-SHA224 message authentication function as described
23503 in RFC 2104 and FIPS PUB 198.
23505 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
23506 @anchor{gnat_rm/the_gnat_library id101}@anchor{33f}@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{340}
23507 @section @cite{GNAT.SHA256} (@code{g-sha256.ads})
23510 @geindex GNAT.SHA256 (g-sha256.ads)
23512 @geindex Secure Hash Algorithm SHA-256
23514 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
23515 and the HMAC-SHA256 message authentication function as described
23516 in RFC 2104 and FIPS PUB 198.
23518 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
23519 @anchor{gnat_rm/the_gnat_library id102}@anchor{341}@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{342}
23520 @section @cite{GNAT.SHA384} (@code{g-sha384.ads})
23523 @geindex GNAT.SHA384 (g-sha384.ads)
23525 @geindex Secure Hash Algorithm SHA-384
23527 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
23528 and the HMAC-SHA384 message authentication function as described
23529 in RFC 2104 and FIPS PUB 198.
23531 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
23532 @anchor{gnat_rm/the_gnat_library id103}@anchor{343}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{344}
23533 @section @cite{GNAT.SHA512} (@code{g-sha512.ads})
23536 @geindex GNAT.SHA512 (g-sha512.ads)
23538 @geindex Secure Hash Algorithm SHA-512
23540 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
23541 and the HMAC-SHA512 message authentication function as described
23542 in RFC 2104 and FIPS PUB 198.
23544 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
23545 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id104}@anchor{346}
23546 @section @cite{GNAT.Signals} (@code{g-signal.ads})
23549 @geindex GNAT.Signals (g-signal.ads)
23551 @geindex Signals
23553 Provides the ability to manipulate the blocked status of signals on supported
23554 targets.
23556 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
23557 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id105}@anchor{348}
23558 @section @cite{GNAT.Sockets} (@code{g-socket.ads})
23561 @geindex GNAT.Sockets (g-socket.ads)
23563 @geindex Sockets
23565 A high level and portable interface to develop sockets based applications.
23566 This package is based on the sockets thin binding found in
23567 @cite{GNAT.Sockets.Thin}. Currently @cite{GNAT.Sockets} is implemented
23568 on all native GNAT ports and on VxWorks cross prots.  It is not implemented for
23569 the LynxOS cross port.
23571 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
23572 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id106}@anchor{34a}
23573 @section @cite{GNAT.Source_Info} (@code{g-souinf.ads})
23576 @geindex GNAT.Source_Info (g-souinf.ads)
23578 @geindex Source Information
23580 Provides subprograms that give access to source code information known at
23581 compile time, such as the current file name and line number. Also provides
23582 subprograms yielding the date and time of the current compilation (like the
23583 C macros @cite{__DATE__} and @cite{__TIME__})
23585 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
23586 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{34b}@anchor{gnat_rm/the_gnat_library id107}@anchor{34c}
23587 @section @cite{GNAT.Spelling_Checker} (@code{g-speche.ads})
23590 @geindex GNAT.Spelling_Checker (g-speche.ads)
23592 @geindex Spell checking
23594 Provides a function for determining whether one string is a plausible
23595 near misspelling of another string.
23597 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
23598 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id108}@anchor{34e}
23599 @section @cite{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
23602 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
23604 @geindex Spell checking
23606 Provides a generic function that can be instantiated with a string type for
23607 determining whether one string is a plausible near misspelling of another
23608 string.
23610 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
23611 @anchor{gnat_rm/the_gnat_library id109}@anchor{34f}@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{350}
23612 @section @cite{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
23615 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
23617 @geindex SPITBOL pattern matching
23619 @geindex Pattern matching
23621 A complete implementation of SNOBOL4 style pattern matching.  This is the
23622 most elaborate of the pattern matching packages provided.  It fully duplicates
23623 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
23624 efficient algorithm developed by Robert Dewar for the SPITBOL system.
23626 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
23627 @anchor{gnat_rm/the_gnat_library id110}@anchor{351}@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{352}
23628 @section @cite{GNAT.Spitbol} (@code{g-spitbo.ads})
23631 @geindex GNAT.Spitbol (g-spitbo.ads)
23633 @geindex SPITBOL interface
23635 The top level package of the collection of SPITBOL-style functionality, this
23636 package provides basic SNOBOL4 string manipulation functions, such as
23637 Pad, Reverse, Trim, Substr capability, as well as a generic table function
23638 useful for constructing arbitrary mappings from strings in the style of
23639 the SNOBOL4 TABLE function.
23641 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
23642 @anchor{gnat_rm/the_gnat_library id111}@anchor{353}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{354}
23643 @section @cite{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
23646 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
23648 @geindex Sets of strings
23650 @geindex SPITBOL Tables
23652 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
23653 for type @cite{Standard.Boolean}, giving an implementation of sets of
23654 string values.
23656 @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
23657 @anchor{gnat_rm/the_gnat_library id112}@anchor{355}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{356}
23658 @section @cite{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
23661 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
23663 @geindex Integer maps
23665 @geindex Maps
23667 @geindex SPITBOL Tables
23669 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
23670 for type @cite{Standard.Integer}, giving an implementation of maps
23671 from string to integer values.
23673 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
23674 @anchor{gnat_rm/the_gnat_library id113}@anchor{357}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{358}
23675 @section @cite{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
23678 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
23680 @geindex String maps
23682 @geindex Maps
23684 @geindex SPITBOL Tables
23686 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table} for
23687 a variable length string type, giving an implementation of general
23688 maps from strings to strings.
23690 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
23691 @anchor{gnat_rm/the_gnat_library id114}@anchor{359}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{35a}
23692 @section @cite{GNAT.SSE} (@code{g-sse.ads})
23695 @geindex GNAT.SSE (g-sse.ads)
23697 Root of a set of units aimed at offering Ada bindings to a subset of
23698 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
23699 targets.  It exposes vector component types together with a general
23700 introduction to the binding contents and use.
23702 @node GNAT SSE Vector_Types g-ssvety ads,GNAT Strings g-string ads,GNAT SSE g-sse ads,The GNAT Library
23703 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id115}@anchor{35c}
23704 @section @cite{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
23707 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
23709 SSE vector types for use with SSE related intrinsics.
23711 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
23712 @anchor{gnat_rm/the_gnat_library id116}@anchor{35d}@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{35e}
23713 @section @cite{GNAT.Strings} (@code{g-string.ads})
23716 @geindex GNAT.Strings (g-string.ads)
23718 Common String access types and related subprograms. Basically it
23719 defines a string access and an array of string access types.
23721 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
23722 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id117}@anchor{360}
23723 @section @cite{GNAT.String_Split} (@code{g-strspl.ads})
23726 @geindex GNAT.String_Split (g-strspl.ads)
23728 @geindex String splitter
23730 Useful string manipulation routines: given a set of separators, split
23731 a string wherever the separators appear, and provide direct access
23732 to the resulting slices. This package is instantiated from
23733 @cite{GNAT.Array_Split}.
23735 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
23736 @anchor{gnat_rm/the_gnat_library id118}@anchor{361}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{362}
23737 @section @cite{GNAT.Table} (@code{g-table.ads})
23740 @geindex GNAT.Table (g-table.ads)
23742 @geindex Table implementation
23744 @geindex Arrays
23745 @geindex extendable
23747 A generic package providing a single dimension array abstraction where the
23748 length of the array can be dynamically modified.
23750 This package provides a facility similar to that of @cite{GNAT.Dynamic_Tables},
23751 except that this package declares a single instance of the table type,
23752 while an instantiation of @cite{GNAT.Dynamic_Tables} creates a type that can be
23753 used to define dynamic instances of the table.
23755 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
23756 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id119}@anchor{364}
23757 @section @cite{GNAT.Task_Lock} (@code{g-tasloc.ads})
23760 @geindex GNAT.Task_Lock (g-tasloc.ads)
23762 @geindex Task synchronization
23764 @geindex Task locking
23766 @geindex Locking
23768 A very simple facility for locking and unlocking sections of code using a
23769 single global task lock.  Appropriate for use in situations where contention
23770 between tasks is very rarely expected.
23772 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
23773 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id120}@anchor{366}
23774 @section @cite{GNAT.Time_Stamp} (@code{g-timsta.ads})
23777 @geindex GNAT.Time_Stamp (g-timsta.ads)
23779 @geindex Time stamp
23781 @geindex Current time
23783 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
23784 represents the current date and time in ISO 8601 format. This is a very simple
23785 routine with minimal code and there are no dependencies on any other unit.
23787 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
23788 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id121}@anchor{368}
23789 @section @cite{GNAT.Threads} (@code{g-thread.ads})
23792 @geindex GNAT.Threads (g-thread.ads)
23794 @geindex Foreign threads
23796 @geindex Threads
23797 @geindex foreign
23799 Provides facilities for dealing with foreign threads which need to be known
23800 by the GNAT run-time system. Consult the documentation of this package for
23801 further details if your program has threads that are created by a non-Ada
23802 environment which then accesses Ada code.
23804 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
23805 @anchor{gnat_rm/the_gnat_library id122}@anchor{369}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{36a}
23806 @section @cite{GNAT.Traceback} (@code{g-traceb.ads})
23809 @geindex GNAT.Traceback (g-traceb.ads)
23811 @geindex Trace back facilities
23813 Provides a facility for obtaining non-symbolic traceback information, useful
23814 in various debugging situations.
23816 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
23817 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{36b}@anchor{gnat_rm/the_gnat_library id123}@anchor{36c}
23818 @section @cite{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
23821 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
23823 @geindex Trace back facilities
23825 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
23826 @anchor{gnat_rm/the_gnat_library id124}@anchor{36d}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{36e}
23827 @section @cite{GNAT.UTF_32} (@code{g-table.ads})
23830 @geindex GNAT.UTF_32 (g-table.ads)
23832 @geindex Wide character codes
23834 This is a package intended to be used in conjunction with the
23835 @cite{Wide_Character} type in Ada 95 and the
23836 @cite{Wide_Wide_Character} type in Ada 2005 (available
23837 in @cite{GNAT} in Ada 2005 mode). This package contains
23838 Unicode categorization routines, as well as lexical
23839 categorization routines corresponding to the Ada 2005
23840 lexical rules for identifiers and strings, and also a
23841 lower case to upper case fold routine corresponding to
23842 the Ada 2005 rules for identifier equivalence.
23844 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
23845 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{36f}@anchor{gnat_rm/the_gnat_library id125}@anchor{370}
23846 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
23849 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
23851 @geindex Spell checking
23853 Provides a function for determining whether one wide wide string is a plausible
23854 near misspelling of another wide wide string, where the strings are represented
23855 using the UTF_32_String type defined in System.Wch_Cnv.
23857 @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
23858 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{371}@anchor{gnat_rm/the_gnat_library id126}@anchor{372}
23859 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
23862 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
23864 @geindex Spell checking
23866 Provides a function for determining whether one wide string is a plausible
23867 near misspelling of another wide string.
23869 @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
23870 @anchor{gnat_rm/the_gnat_library id127}@anchor{373}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{374}
23871 @section @cite{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
23874 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
23876 @geindex Wide_String splitter
23878 Useful wide string manipulation routines: given a set of separators, split
23879 a wide string wherever the separators appear, and provide direct access
23880 to the resulting slices. This package is instantiated from
23881 @cite{GNAT.Array_Split}.
23883 @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
23884 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{375}@anchor{gnat_rm/the_gnat_library id128}@anchor{376}
23885 @section @cite{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
23888 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
23890 @geindex Spell checking
23892 Provides a function for determining whether one wide wide string is a plausible
23893 near misspelling of another wide wide string.
23895 @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
23896 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id129}@anchor{378}
23897 @section @cite{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
23900 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
23902 @geindex Wide_Wide_String splitter
23904 Useful wide wide string manipulation routines: given a set of separators, split
23905 a wide wide string wherever the separators appear, and provide direct access
23906 to the resulting slices. This package is instantiated from
23907 @cite{GNAT.Array_Split}.
23909 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
23910 @anchor{gnat_rm/the_gnat_library id130}@anchor{379}@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{37a}
23911 @section @cite{Interfaces.C.Extensions} (@code{i-cexten.ads})
23914 @geindex Interfaces.C.Extensions (i-cexten.ads)
23916 This package contains additional C-related definitions, intended
23917 for use with either manually or automatically generated bindings
23918 to C libraries.
23920 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
23921 @anchor{gnat_rm/the_gnat_library id131}@anchor{37b}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{37c}
23922 @section @cite{Interfaces.C.Streams} (@code{i-cstrea.ads})
23925 @geindex Interfaces.C.Streams (i-cstrea.ads)
23927 @geindex C streams
23928 @geindex interfacing
23930 This package is a binding for the most commonly used operations
23931 on C streams.
23933 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
23934 @anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id132}@anchor{37e}
23935 @section @cite{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
23938 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
23940 @geindex IBM Packed Format
23942 @geindex Packed Decimal
23944 This package provides a set of routines for conversions to and
23945 from a packed decimal format compatible with that used on IBM
23946 mainframes.
23948 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
23949 @anchor{gnat_rm/the_gnat_library id133}@anchor{37f}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{380}
23950 @section @cite{Interfaces.VxWorks} (@code{i-vxwork.ads})
23953 @geindex Interfaces.VxWorks (i-vxwork.ads)
23955 @geindex Interfacing to VxWorks
23957 @geindex VxWorks
23958 @geindex interfacing
23960 This package provides a limited binding to the VxWorks API.
23961 In particular, it interfaces with the
23962 VxWorks hardware interrupt facilities.
23964 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
23965 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{381}@anchor{gnat_rm/the_gnat_library id134}@anchor{382}
23966 @section @cite{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
23969 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
23971 @geindex Interfacing to VxWorks' I/O
23973 @geindex VxWorks
23974 @geindex I/O interfacing
23976 @geindex VxWorks
23977 @geindex Get_Immediate
23979 @geindex Get_Immediate
23980 @geindex VxWorks
23982 This package provides a binding to the ioctl (IO/Control)
23983 function of VxWorks, defining a set of option values and
23984 function codes. A particular use of this package is
23985 to enable the use of Get_Immediate under VxWorks.
23987 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
23988 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{383}@anchor{gnat_rm/the_gnat_library id135}@anchor{384}
23989 @section @cite{System.Address_Image} (@code{s-addima.ads})
23992 @geindex System.Address_Image (s-addima.ads)
23994 @geindex Address image
23996 @geindex Image
23997 @geindex of an address
23999 This function provides a useful debugging
24000 function that gives an (implementation dependent)
24001 string which identifies an address.
24003 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
24004 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{385}@anchor{gnat_rm/the_gnat_library id136}@anchor{386}
24005 @section @cite{System.Assertions} (@code{s-assert.ads})
24008 @geindex System.Assertions (s-assert.ads)
24010 @geindex Assertions
24012 @geindex Assert_Failure
24013 @geindex exception
24015 This package provides the declaration of the exception raised
24016 by an run-time assertion failure, as well as the routine that
24017 is used internally to raise this assertion.
24019 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
24020 @anchor{gnat_rm/the_gnat_library id137}@anchor{387}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{388}
24021 @section @cite{System.Atomic_Counters} (@code{s-atocou.ads})
24024 @geindex System.Atomic_Counters (s-atocou.ads)
24026 This package provides the declaration of an atomic counter type,
24027 together with efficient routines (using hardware
24028 synchronization primitives) for incrementing, decrementing,
24029 and testing of these counters. This package is implemented
24030 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
24031 x86, and x86_64 platforms.
24033 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
24034 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id138}@anchor{38a}
24035 @section @cite{System.Memory} (@code{s-memory.ads})
24038 @geindex System.Memory (s-memory.ads)
24040 @geindex Memory allocation
24042 This package provides the interface to the low level routines used
24043 by the generated code for allocation and freeing storage for the
24044 default storage pool (analogous to the C routines malloc and free.
24045 It also provides a reallocation interface analogous to the C routine
24046 realloc. The body of this unit may be modified to provide alternative
24047 allocation mechanisms for the default pool, and in addition, direct
24048 calls to this unit may be made for low level allocation uses (for
24049 example see the body of @cite{GNAT.Tables}).
24051 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
24052 @anchor{gnat_rm/the_gnat_library id139}@anchor{38b}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{38c}
24053 @section @cite{System.Multiprocessors} (@code{s-multip.ads})
24056 @geindex System.Multiprocessors (s-multip.ads)
24058 @geindex Multiprocessor interface
24060 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24061 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24062 technically an implementation-defined addition).
24064 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
24065 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id140}@anchor{38e}
24066 @section @cite{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
24069 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
24071 @geindex Multiprocessor interface
24073 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24074 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24075 technically an implementation-defined addition).
24077 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
24078 @anchor{gnat_rm/the_gnat_library id141}@anchor{38f}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{390}
24079 @section @cite{System.Partition_Interface} (@code{s-parint.ads})
24082 @geindex System.Partition_Interface (s-parint.ads)
24084 @geindex Partition interfacing functions
24086 This package provides facilities for partition interfacing.  It
24087 is used primarily in a distribution context when using Annex E
24088 with @cite{GLADE}.
24090 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
24091 @anchor{gnat_rm/the_gnat_library id142}@anchor{391}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{392}
24092 @section @cite{System.Pool_Global} (@code{s-pooglo.ads})
24095 @geindex System.Pool_Global (s-pooglo.ads)
24097 @geindex Storage pool
24098 @geindex global
24100 @geindex Global storage pool
24102 This package provides a storage pool that is equivalent to the default
24103 storage pool used for access types for which no pool is specifically
24104 declared. It uses malloc/free to allocate/free and does not attempt to
24105 do any automatic reclamation.
24107 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
24108 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{393}@anchor{gnat_rm/the_gnat_library id143}@anchor{394}
24109 @section @cite{System.Pool_Local} (@code{s-pooloc.ads})
24112 @geindex System.Pool_Local (s-pooloc.ads)
24114 @geindex Storage pool
24115 @geindex local
24117 @geindex Local storage pool
24119 This package provides a storage pool that is intended for use with locally
24120 defined access types. It uses malloc/free for allocate/free, and maintains
24121 a list of allocated blocks, so that all storage allocated for the pool can
24122 be freed automatically when the pool is finalized.
24124 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
24125 @anchor{gnat_rm/the_gnat_library id144}@anchor{395}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{396}
24126 @section @cite{System.Restrictions} (@code{s-restri.ads})
24129 @geindex System.Restrictions (s-restri.ads)
24131 @geindex Run-time restrictions access
24133 This package provides facilities for accessing at run time
24134 the status of restrictions specified at compile time for
24135 the partition. Information is available both with regard
24136 to actual restrictions specified, and with regard to
24137 compiler determined information on which restrictions
24138 are violated by one or more packages in the partition.
24140 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
24141 @anchor{gnat_rm/the_gnat_library id145}@anchor{397}@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{398}
24142 @section @cite{System.Rident} (@code{s-rident.ads})
24145 @geindex System.Rident (s-rident.ads)
24147 @geindex Restrictions definitions
24149 This package provides definitions of the restrictions
24150 identifiers supported by GNAT, and also the format of
24151 the restrictions provided in package System.Restrictions.
24152 It is not normally necessary to @cite{with} this generic package
24153 since the necessary instantiation is included in
24154 package System.Restrictions.
24156 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
24157 @anchor{gnat_rm/the_gnat_library id146}@anchor{399}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{39a}
24158 @section @cite{System.Strings.Stream_Ops} (@code{s-ststop.ads})
24161 @geindex System.Strings.Stream_Ops (s-ststop.ads)
24163 @geindex Stream operations
24165 @geindex String stream operations
24167 This package provides a set of stream subprograms for standard string types.
24168 It is intended primarily to support implicit use of such subprograms when
24169 stream attributes are applied to string types, but the subprograms in this
24170 package can be used directly by application programs.
24172 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
24173 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{39b}@anchor{gnat_rm/the_gnat_library id147}@anchor{39c}
24174 @section @cite{System.Unsigned_Types} (@code{s-unstyp.ads})
24177 @geindex System.Unsigned_Types (s-unstyp.ads)
24179 This package contains definitions of standard unsigned types that
24180 correspond in size to the standard signed types declared in Standard,
24181 and (unlike the types in Interfaces) have corresponding names. It
24182 also contains some related definitions for other specialized types
24183 used by the compiler in connection with packed array types.
24185 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
24186 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id148}@anchor{39e}
24187 @section @cite{System.Wch_Cnv} (@code{s-wchcnv.ads})
24190 @geindex System.Wch_Cnv (s-wchcnv.ads)
24192 @geindex Wide Character
24193 @geindex Representation
24195 @geindex Wide String
24196 @geindex Conversion
24198 @geindex Representation of wide characters
24200 This package provides routines for converting between
24201 wide and wide wide characters and a representation as a value of type
24202 @cite{Standard.String}, using a specified wide character
24203 encoding method.  It uses definitions in
24204 package @cite{System.Wch_Con}.
24206 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
24207 @anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id149}@anchor{3a0}
24208 @section @cite{System.Wch_Con} (@code{s-wchcon.ads})
24211 @geindex System.Wch_Con (s-wchcon.ads)
24213 This package provides definitions and descriptions of
24214 the various methods used for encoding wide characters
24215 in ordinary strings.  These definitions are used by
24216 the package @cite{System.Wch_Cnv}.
24218 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
24219 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{3a1}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{3a2}
24220 @chapter Interfacing to Other Languages
24223 The facilities in Annex B of the Ada Reference Manual are fully
24224 implemented in GNAT, and in addition, a full interface to C++ is
24225 provided.
24227 @menu
24228 * Interfacing to C:: 
24229 * Interfacing to C++:: 
24230 * Interfacing to COBOL:: 
24231 * Interfacing to Fortran:: 
24232 * Interfacing to non-GNAT Ada code:: 
24234 @end menu
24236 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
24237 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{3a3}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{3a4}
24238 @section Interfacing to C
24241 Interfacing to C with GNAT can use one of two approaches:
24244 @itemize *
24246 @item 
24247 The types in the package @cite{Interfaces.C} may be used.
24249 @item 
24250 Standard Ada types may be used directly.  This may be less portable to
24251 other compilers, but will work on all GNAT compilers, which guarantee
24252 correspondence between the C and Ada types.
24253 @end itemize
24255 Pragma @cite{Convention C} may be applied to Ada types, but mostly has no
24256 effect, since this is the default.  The following table shows the
24257 correspondence between Ada scalar types and the corresponding C types.
24260 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
24261 @headitem
24263 Ada Type
24265 @tab
24267 C Type
24269 @item
24271 @code{Integer}
24273 @tab
24275 @code{int}
24277 @item
24279 @code{Short_Integer}
24281 @tab
24283 @code{short}
24285 @item
24287 @code{Short_Short_Integer}
24289 @tab
24291 @code{signed char}
24293 @item
24295 @code{Long_Integer}
24297 @tab
24299 @code{long}
24301 @item
24303 @code{Long_Long_Integer}
24305 @tab
24307 @code{long long}
24309 @item
24311 @code{Short_Float}
24313 @tab
24315 @code{float}
24317 @item
24319 @code{Float}
24321 @tab
24323 @code{float}
24325 @item
24327 @code{Long_Float}
24329 @tab
24331 @code{double}
24333 @item
24335 @code{Long_Long_Float}
24337 @tab
24339 This is the longest floating-point type supported by the hardware.
24341 @end multitable
24344 Additionally, there are the following general correspondences between Ada
24345 and C types:
24348 @itemize *
24350 @item 
24351 Ada enumeration types map to C enumeration types directly if pragma
24352 @cite{Convention C} is specified, which causes them to have int
24353 length.  Without pragma @cite{Convention C}, Ada enumeration types map to
24354 8, 16, or 32 bits (i.e., C types @cite{signed char}, @cite{short},
24355 @cite{int}, respectively) depending on the number of values passed.
24356 This is the only case in which pragma @cite{Convention C} affects the
24357 representation of an Ada type.
24359 @item 
24360 Ada access types map to C pointers, except for the case of pointers to
24361 unconstrained types in Ada, which have no direct C equivalent.
24363 @item 
24364 Ada arrays map directly to C arrays.
24366 @item 
24367 Ada records map directly to C structures.
24369 @item 
24370 Packed Ada records map to C structures where all members are bit fields
24371 of the length corresponding to the @code{type'Size} value in Ada.
24372 @end itemize
24374 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
24375 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{3a5}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{3f}
24376 @section Interfacing to C++
24379 The interface to C++ makes use of the following pragmas, which are
24380 primarily intended to be constructed automatically using a binding generator
24381 tool, although it is possible to construct them by hand.
24383 Using these pragmas it is possible to achieve complete
24384 inter-operability between Ada tagged types and C++ class definitions.
24385 See @ref{7,,Implementation Defined Pragmas}, for more details.
24388 @table @asis
24390 @item @emph{pragma CPP_Class ([Entity =>] `LOCAL_NAME`)}
24392 The argument denotes an entity in the current declarative region that is
24393 declared as a tagged or untagged record type. It indicates that the type
24394 corresponds to an externally declared C++ class type, and is to be laid
24395 out the same way that C++ would lay out the type.
24397 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
24398 for backward compatibility but its functionality is available
24399 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
24401 @item @emph{pragma CPP_Constructor ([Entity =>] `LOCAL_NAME`)}
24403 This pragma identifies an imported function (imported in the usual way
24404 with pragma @cite{Import}) as corresponding to a C++ constructor.
24405 @end table
24407 A few restrictions are placed on the use of the @cite{Access} attribute
24408 in conjunction with subprograms subject to convention @cite{CPP}: the
24409 attribute may be used neither on primitive operations of a tagged
24410 record type with convention @cite{CPP}, imported or not, nor on
24411 subprograms imported with pragma @cite{CPP_Constructor}.
24413 In addition, C++ exceptions are propagated and can be handled in an
24414 @cite{others} choice of an exception handler. The corresponding Ada
24415 occurrence has no message, and the simple name of the exception identity
24416 contains @code{Foreign_Exception}. Finalization and awaiting dependent
24417 tasks works properly when such foreign exceptions are propagated.
24419 It is also possible to import a C++ exception using the following syntax:
24421 @example
24422 LOCAL_NAME : exception;
24423 pragma Import (Cpp,
24424   [Entity =>] LOCAL_NAME,
24425   [External_Name =>] static_string_EXPRESSION);
24426 @end example
24428 The @cite{External_Name} is the name of the C++ RTTI symbol. You can then
24429 cover a specific C++ exception in an exception handler.
24431 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
24432 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{3a6}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{3a7}
24433 @section Interfacing to COBOL
24436 Interfacing to COBOL is achieved as described in section B.4 of
24437 the Ada Reference Manual.
24439 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
24440 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{3a8}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{3a9}
24441 @section Interfacing to Fortran
24444 Interfacing to Fortran is achieved as described in section B.5 of the
24445 Ada Reference Manual.  The pragma @cite{Convention Fortran}, applied to a
24446 multi-dimensional array causes the array to be stored in column-major
24447 order as required for convenient interface to Fortran.
24449 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
24450 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{3aa}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{3ab}
24451 @section Interfacing to non-GNAT Ada code
24454 It is possible to specify the convention @cite{Ada} in a pragma
24455 @cite{Import} or pragma @cite{Export}.  However this refers to
24456 the calling conventions used by GNAT, which may or may not be
24457 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
24458 compiler to allow interoperation.
24460 If arguments types are kept simple, and if the foreign compiler generally
24461 follows system calling conventions, then it may be possible to integrate
24462 files compiled by other Ada compilers, provided that the elaboration
24463 issues are adequately addressed (for example by eliminating the
24464 need for any load time elaboration).
24466 In particular, GNAT running on VMS is designed to
24467 be highly compatible with the DEC Ada 83 compiler, so this is one
24468 case in which it is possible to import foreign units of this type,
24469 provided that the data items passed are restricted to simple scalar
24470 values or simple record types without variants, or simple array
24471 types with fixed bounds.
24473 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
24474 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{3ac}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{3ad}
24475 @chapter Specialized Needs Annexes
24478 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
24479 required in all implementations.  However, as described in this chapter,
24480 GNAT implements all of these annexes:
24483 @table @asis
24485 @item @emph{Systems Programming (Annex C)}
24487 The Systems Programming Annex is fully implemented.
24489 @item @emph{Real-Time Systems (Annex D)}
24491 The Real-Time Systems Annex is fully implemented.
24493 @item @emph{Distributed Systems (Annex E)}
24495 Stub generation is fully implemented in the GNAT compiler.  In addition,
24496 a complete compatible PCS is available as part of the GLADE system,
24497 a separate product.  When the two
24498 products are used in conjunction, this annex is fully implemented.
24500 @item @emph{Information Systems (Annex F)}
24502 The Information Systems annex is fully implemented.
24504 @item @emph{Numerics (Annex G)}
24506 The Numerics Annex is fully implemented.
24508 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
24510 The Safety and Security Annex (termed the High-Integrity Systems Annex
24511 in Ada 2005) is fully implemented.
24512 @end table
24514 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
24515 @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{3ae}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{3af}
24516 @chapter Implementation of Specific Ada Features
24519 This chapter describes the GNAT implementation of several Ada language
24520 facilities.
24522 @menu
24523 * Machine Code Insertions:: 
24524 * GNAT Implementation of Tasking:: 
24525 * GNAT Implementation of Shared Passive Packages:: 
24526 * Code Generation for Array Aggregates:: 
24527 * The Size of Discriminated Records with Default Discriminants:: 
24528 * Strict Conformance to the Ada Reference Manual:: 
24530 @end menu
24532 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
24533 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{11d}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{3b0}
24534 @section Machine Code Insertions
24537 @geindex Machine Code insertions
24539 Package @cite{Machine_Code} provides machine code support as described
24540 in the Ada Reference Manual in two separate forms:
24543 @itemize *
24545 @item 
24546 Machine code statements, consisting of qualified expressions that
24547 fit the requirements of RM section 13.8.
24549 @item 
24550 An intrinsic callable procedure, providing an alternative mechanism of
24551 including machine instructions in a subprogram.
24552 @end itemize
24554 The two features are similar, and both are closely related to the mechanism
24555 provided by the asm instruction in the GNU C compiler.  Full understanding
24556 and use of the facilities in this package requires understanding the asm
24557 instruction, see the section on Extended Asm in
24558 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
24560 Calls to the function @cite{Asm} and the procedure @cite{Asm} have identical
24561 semantic restrictions and effects as described below.  Both are provided so
24562 that the procedure call can be used as a statement, and the function call
24563 can be used to form a code_statement.
24565 Consider this C @cite{asm} instruction:
24567 @example
24568 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
24569 @end example
24571 The equivalent can be written for GNAT as:
24573 @example
24574 Asm ("fsinx %1 %0",
24575      My_Float'Asm_Output ("=f", result),
24576      My_Float'Asm_Input  ("f",  angle));
24577 @end example
24579 The first argument to @cite{Asm} is the assembler template, and is
24580 identical to what is used in GNU C.  This string must be a static
24581 expression.  The second argument is the output operand list.  It is
24582 either a single @cite{Asm_Output} attribute reference, or a list of such
24583 references enclosed in parentheses (technically an array aggregate of
24584 such references).
24586 The @cite{Asm_Output} attribute denotes a function that takes two
24587 parameters.  The first is a string, the second is the name of a variable
24588 of the type designated by the attribute prefix.  The first (string)
24589 argument is required to be a static expression and designates the
24590 constraint (see the section on Constraints in
24591 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
24592 for the parameter; e.g., what kind of register is required.  The second
24593 argument is the variable to be written or updated with the
24594 result.  The possible values for constraint are the same as those used in
24595 the RTL, and are dependent on the configuration file used to build the
24596 GCC back end.  If there are no output operands, then this argument may
24597 either be omitted, or explicitly given as @cite{No_Output_Operands}.
24598 No support is provided for GNU C's symbolic names for output parameters.
24600 The second argument of @code{my_float'Asm_Output} functions as
24601 though it were an @cite{out} parameter, which is a little curious, but
24602 all names have the form of expressions, so there is no syntactic
24603 irregularity, even though normally functions would not be permitted
24604 @cite{out} parameters.  The third argument is the list of input
24605 operands.  It is either a single @cite{Asm_Input} attribute reference, or
24606 a list of such references enclosed in parentheses (technically an array
24607 aggregate of such references).
24609 The @cite{Asm_Input} attribute denotes a function that takes two
24610 parameters.  The first is a string, the second is an expression of the
24611 type designated by the prefix.  The first (string) argument is required
24612 to be a static expression, and is the constraint for the parameter,
24613 (e.g., what kind of register is required).  The second argument is the
24614 value to be used as the input argument.  The possible values for the
24615 constraint are the same as those used in the RTL, and are dependent on
24616 the configuration file used to built the GCC back end.
24617 No support is provided for GNU C's symbolic names for input parameters.
24619 If there are no input operands, this argument may either be omitted, or
24620 explicitly given as @cite{No_Input_Operands}.  The fourth argument, not
24621 present in the above example, is a list of register names, called the
24622 @emph{clobber} argument.  This argument, if given, must be a static string
24623 expression, and is a space or comma separated list of names of registers
24624 that must be considered destroyed as a result of the @cite{Asm} call.  If
24625 this argument is the null string (the default value), then the code
24626 generator assumes that no additional registers are destroyed.
24627 In addition to registers, the special clobbers @cite{memory} and
24628 @cite{cc} as described in the GNU C docs are both supported.
24630 The fifth argument, not present in the above example, called the
24631 @emph{volatile} argument, is by default @cite{False}.  It can be set to
24632 the literal value @cite{True} to indicate to the code generator that all
24633 optimizations with respect to the instruction specified should be
24634 suppressed, and in particular an instruction that has outputs
24635 will still be generated, even if none of the outputs are
24636 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
24637 for the full description.
24638 Generally it is strongly advisable to use Volatile for any ASM statement
24639 that is missing either input or output operands or to avoid unwanted
24640 optimizations. A warning is generated if this advice is not followed.
24642 No support is provided for GNU C's @cite{asm goto} feature.
24644 The @cite{Asm} subprograms may be used in two ways.  First the procedure
24645 forms can be used anywhere a procedure call would be valid, and
24646 correspond to what the RM calls 'intrinsic' routines.  Such calls can
24647 be used to intersperse machine instructions with other Ada statements.
24648 Second, the function forms, which return a dummy value of the limited
24649 private type @cite{Asm_Insn}, can be used in code statements, and indeed
24650 this is the only context where such calls are allowed.  Code statements
24651 appear as aggregates of the form:
24653 @example
24654 Asm_Insn'(Asm (...));
24655 Asm_Insn'(Asm_Volatile (...));
24656 @end example
24658 In accordance with RM rules, such code statements are allowed only
24659 within subprograms whose entire body consists of such statements.  It is
24660 not permissible to intermix such statements with other Ada statements.
24662 Typically the form using intrinsic procedure calls is more convenient
24663 and more flexible.  The code statement form is provided to meet the RM
24664 suggestion that such a facility should be made available.  The following
24665 is the exact syntax of the call to @cite{Asm}. As usual, if named notation
24666 is used, the arguments may be given in arbitrary order, following the
24667 normal rules for use of positional and named arguments:
24669 @example
24670 ASM_CALL ::= Asm (
24671                  [Template =>] static_string_EXPRESSION
24672                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
24673                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
24674                [,[Clobber  =>] static_string_EXPRESSION ]
24675                [,[Volatile =>] static_boolean_EXPRESSION] )
24677 OUTPUT_OPERAND_LIST ::=
24678   [PREFIX.]No_Output_Operands
24679 | OUTPUT_OPERAND_ATTRIBUTE
24680 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
24682 OUTPUT_OPERAND_ATTRIBUTE ::=
24683   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
24685 INPUT_OPERAND_LIST ::=
24686   [PREFIX.]No_Input_Operands
24687 | INPUT_OPERAND_ATTRIBUTE
24688 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
24690 INPUT_OPERAND_ATTRIBUTE ::=
24691   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
24692 @end example
24694 The identifiers @cite{No_Input_Operands} and @cite{No_Output_Operands}
24695 are declared in the package @cite{Machine_Code} and must be referenced
24696 according to normal visibility rules. In particular if there is no
24697 @cite{use} clause for this package, then appropriate package name
24698 qualification is required.
24700 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
24701 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{3b1}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{3b2}
24702 @section GNAT Implementation of Tasking
24705 This chapter outlines the basic GNAT approach to tasking (in particular,
24706 a multi-layered library for portability) and discusses issues related
24707 to compliance with the Real-Time Systems Annex.
24709 @menu
24710 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
24711 * Ensuring Compliance with the Real-Time Annex:: 
24713 @end menu
24715 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
24716 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{3b3}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{3b4}
24717 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
24720 GNAT's run-time support comprises two layers:
24723 @itemize *
24725 @item 
24726 GNARL (GNAT Run-time Layer)
24728 @item 
24729 GNULL (GNAT Low-level Library)
24730 @end itemize
24732 In GNAT, Ada's tasking services rely on a platform and OS independent
24733 layer known as GNARL.  This code is responsible for implementing the
24734 correct semantics of Ada's task creation, rendezvous, protected
24735 operations etc.
24737 GNARL decomposes Ada's tasking semantics into simpler lower level
24738 operations such as create a thread, set the priority of a thread,
24739 yield, create a lock, lock/unlock, etc.  The spec for these low-level
24740 operations constitutes GNULLI, the GNULL Interface.  This interface is
24741 directly inspired from the POSIX real-time API.
24743 If the underlying executive or OS implements the POSIX standard
24744 faithfully, the GNULL Interface maps as is to the services offered by
24745 the underlying kernel.  Otherwise, some target dependent glue code maps
24746 the services offered by the underlying kernel to the semantics expected
24747 by GNARL.
24749 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
24750 key point is that each Ada task is mapped on a thread in the underlying
24751 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
24753 In addition Ada task priorities map onto the underlying thread priorities.
24754 Mapping Ada tasks onto the underlying kernel threads has several advantages:
24757 @itemize *
24759 @item 
24760 The underlying scheduler is used to schedule the Ada tasks.  This
24761 makes Ada tasks as efficient as kernel threads from a scheduling
24762 standpoint.
24764 @item 
24765 Interaction with code written in C containing threads is eased
24766 since at the lowest level Ada tasks and C threads map onto the same
24767 underlying kernel concept.
24769 @item 
24770 When an Ada task is blocked during I/O the remaining Ada tasks are
24771 able to proceed.
24773 @item 
24774 On multiprocessor systems Ada tasks can execute in parallel.
24775 @end itemize
24777 Some threads libraries offer a mechanism to fork a new process, with the
24778 child process duplicating the threads from the parent.
24779 GNAT does not
24780 support this functionality when the parent contains more than one task.
24781 .. index:: Forking a new process
24783 @node Ensuring Compliance with the Real-Time Annex,,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
24784 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{3b5}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{3b6}
24785 @subsection Ensuring Compliance with the Real-Time Annex
24788 @geindex Real-Time Systems Annex compliance
24790 Although mapping Ada tasks onto
24791 the underlying threads has significant advantages, it does create some
24792 complications when it comes to respecting the scheduling semantics
24793 specified in the real-time annex (Annex D).
24795 For instance the Annex D requirement for the @cite{FIFO_Within_Priorities}
24796 scheduling policy states:
24798 @quotation
24800 @emph{When the active priority of a ready task that is not running
24801 changes, or the setting of its base priority takes effect, the
24802 task is removed from the ready queue for its old active priority
24803 and is added at the tail of the ready queue for its new active
24804 priority, except in the case where the active priority is lowered
24805 due to the loss of inherited priority, in which case the task is
24806 added at the head of the ready queue for its new active priority.}
24807 @end quotation
24809 While most kernels do put tasks at the end of the priority queue when
24810 a task changes its priority, (which respects the main
24811 FIFO_Within_Priorities requirement), almost none keep a thread at the
24812 beginning of its priority queue when its priority drops from the loss
24813 of inherited priority.
24815 As a result most vendors have provided incomplete Annex D implementations.
24817 The GNAT run-time, has a nice cooperative solution to this problem
24818 which ensures that accurate FIFO_Within_Priorities semantics are
24819 respected.
24821 The principle is as follows.  When an Ada task T is about to start
24822 running, it checks whether some other Ada task R with the same
24823 priority as T has been suspended due to the loss of priority
24824 inheritance.  If this is the case, T yields and is placed at the end of
24825 its priority queue.  When R arrives at the front of the queue it
24826 executes.
24828 Note that this simple scheme preserves the relative order of the tasks
24829 that were ready to execute in the priority queue where R has been
24830 placed at the end.
24832 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
24833 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{3b7}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{3b8}
24834 @section GNAT Implementation of Shared Passive Packages
24837 @geindex Shared passive packages
24839 GNAT fully implements the pragma @cite{Shared_Passive} for
24840 .. index:: pragma @cite{Shared_Passive}
24842 the purpose of designating shared passive packages.
24843 This allows the use of passive partitions in the
24844 context described in the Ada Reference Manual; i.e., for communication
24845 between separate partitions of a distributed application using the
24846 features in Annex E.
24847 .. index:: Annex E
24849 @geindex Distribution Systems Annex
24851 However, the implementation approach used by GNAT provides for more
24852 extensive usage as follows:
24855 @table @asis
24857 @item @emph{Communication between separate programs}
24859 This allows separate programs to access the data in passive
24860 partitions, using protected objects for synchronization where
24861 needed. The only requirement is that the two programs have a
24862 common shared file system. It is even possible for programs
24863 running on different machines with different architectures
24864 (e.g., different endianness) to communicate via the data in
24865 a passive partition.
24867 @item @emph{Persistence between program runs}
24869 The data in a passive package can persist from one run of a
24870 program to another, so that a later program sees the final
24871 values stored by a previous run of the same program.
24872 @end table
24874 The implementation approach used is to store the data in files. A
24875 separate stream file is created for each object in the package, and
24876 an access to an object causes the corresponding file to be read or
24877 written.
24879 @geindex SHARED_MEMORY_DIRECTORY environment variable
24881 The environment variable @cite{SHARED_MEMORY_DIRECTORY} should be
24882 set to the directory to be used for these files.
24883 The files in this directory
24884 have names that correspond to their fully qualified names. For
24885 example, if we have the package
24887 @example
24888 package X is
24889   pragma Shared_Passive (X);
24890   Y : Integer;
24891   Z : Float;
24892 end X;
24893 @end example
24895 and the environment variable is set to @cite{/stemp/}, then the files created
24896 will have the names:
24898 @example
24899 /stemp/x.y
24900 /stemp/x.z
24901 @end example
24903 These files are created when a value is initially written to the object, and
24904 the files are retained until manually deleted. This provides the persistence
24905 semantics. If no file exists, it means that no partition has assigned a value
24906 to the variable; in this case the initial value declared in the package
24907 will be used. This model ensures that there are no issues in synchronizing
24908 the elaboration process, since elaboration of passive packages elaborates the
24909 initial values, but does not create the files.
24911 The files are written using normal @cite{Stream_IO} access.
24912 If you want to be able
24913 to communicate between programs or partitions running on different
24914 architectures, then you should use the XDR versions of the stream attribute
24915 routines, since these are architecture independent.
24917 If active synchronization is required for access to the variables in the
24918 shared passive package, then as described in the Ada Reference Manual, the
24919 package may contain protected objects used for this purpose. In this case
24920 a lock file (whose name is @code{___lock} (three underscores)
24921 is created in the shared memory directory.
24923 @geindex ___lock file (for shared passive packages)
24925 This is used to provide the required locking
24926 semantics for proper protected object synchronization.
24928 GNAT supports shared passive packages on all platforms
24929 except for OpenVMS.
24931 @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
24932 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{3b9}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{3ba}
24933 @section Code Generation for Array Aggregates
24936 Aggregates have a rich syntax and allow the user to specify the values of
24937 complex data structures by means of a single construct.  As a result, the
24938 code generated for aggregates can be quite complex and involve loops, case
24939 statements and multiple assignments.  In the simplest cases, however, the
24940 compiler will recognize aggregates whose components and constraints are
24941 fully static, and in those cases the compiler will generate little or no
24942 executable code.  The following is an outline of the code that GNAT generates
24943 for various aggregate constructs.  For further details, you will find it
24944 useful to examine the output produced by the -gnatG flag to see the expanded
24945 source that is input to the code generator.  You may also want to examine
24946 the assembly code generated at various levels of optimization.
24948 The code generated for aggregates depends on the context, the component values,
24949 and the type.  In the context of an object declaration the code generated is
24950 generally simpler than in the case of an assignment.  As a general rule, static
24951 component values and static subtypes also lead to simpler code.
24953 @menu
24954 * Static constant aggregates with static bounds:: 
24955 * Constant aggregates with unconstrained nominal types:: 
24956 * Aggregates with static bounds:: 
24957 * Aggregates with non-static bounds:: 
24958 * Aggregates in assignment statements:: 
24960 @end menu
24962 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
24963 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{3bb}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{3bc}
24964 @subsection Static constant aggregates with static bounds
24967 For the declarations:
24969 @example
24970 type One_Dim is array (1..10) of integer;
24971 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
24972 @end example
24974 GNAT generates no executable code: the constant ar0 is placed in static memory.
24975 The same is true for constant aggregates with named associations:
24977 @example
24978 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
24979 Cr3 : constant One_Dim := (others => 7777);
24980 @end example
24982 The same is true for multidimensional constant arrays such as:
24984 @example
24985 type two_dim is array (1..3, 1..3) of integer;
24986 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
24987 @end example
24989 The same is true for arrays of one-dimensional arrays: the following are
24990 static:
24992 @example
24993 type ar1b  is array (1..3) of boolean;
24994 type ar_ar is array (1..3) of ar1b;
24995 None  : constant ar1b := (others => false);     --  fully static
24996 None2 : constant ar_ar := (1..3 => None);       --  fully static
24997 @end example
24999 However, for multidimensional aggregates with named associations, GNAT will
25000 generate assignments and loops, even if all associations are static.  The
25001 following two declarations generate a loop for the first dimension, and
25002 individual component assignments for the second dimension:
25004 @example
25005 Zero1: constant two_dim := (1..3 => (1..3 => 0));
25006 Zero2: constant two_dim := (others => (others => 0));
25007 @end example
25009 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
25010 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{3bd}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{3be}
25011 @subsection Constant aggregates with unconstrained nominal types
25014 In such cases the aggregate itself establishes the subtype, so that
25015 associations with @cite{others} cannot be used.  GNAT determines the
25016 bounds for the actual subtype of the aggregate, and allocates the
25017 aggregate statically as well.  No code is generated for the following:
25019 @example
25020 type One_Unc is array (natural range <>) of integer;
25021 Cr_Unc : constant One_Unc := (12,24,36);
25022 @end example
25024 @node Aggregates with static bounds,Aggregates with non-static bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
25025 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{3bf}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{3c0}
25026 @subsection Aggregates with static bounds
25029 In all previous examples the aggregate was the initial (and immutable) value
25030 of a constant.  If the aggregate initializes a variable, then code is generated
25031 for it as a combination of individual assignments and loops over the target
25032 object.  The declarations
25034 @example
25035 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
25036 Cr_Var2 : One_Dim := (others > -1);
25037 @end example
25039 generate the equivalent of
25041 @example
25042 Cr_Var1 (1) := 2;
25043 Cr_Var1 (2) := 3;
25044 Cr_Var1 (3) := 5;
25045 Cr_Var1 (4) := 11;
25047 for I in Cr_Var2'range loop
25048    Cr_Var2 (I) := -1;
25049 end loop;
25050 @end example
25052 @node Aggregates with non-static bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
25053 @anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-non-static-bounds}@anchor{3c1}@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{3c2}
25054 @subsection Aggregates with non-static bounds
25057 If the bounds of the aggregate are not statically compatible with the bounds
25058 of the nominal subtype  of the target, then constraint checks have to be
25059 generated on the bounds.  For a multidimensional array, constraint checks may
25060 have to be applied to sub-arrays individually, if they do not have statically
25061 compatible subtypes.
25063 @node Aggregates in assignment statements,,Aggregates with non-static bounds,Code Generation for Array Aggregates
25064 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{3c3}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{3c4}
25065 @subsection Aggregates in assignment statements
25068 In general, aggregate assignment requires the construction of a temporary,
25069 and a copy from the temporary to the target of the assignment.  This is because
25070 it is not always possible to convert the assignment into a series of individual
25071 component assignments.  For example, consider the simple case:
25073 @example
25074 A := (A(2), A(1));
25075 @end example
25077 This cannot be converted into:
25079 @example
25080 A(1) := A(2);
25081 A(2) := A(1);
25082 @end example
25084 So the aggregate has to be built first in a separate location, and then
25085 copied into the target.  GNAT recognizes simple cases where this intermediate
25086 step is not required, and the assignments can be performed in place, directly
25087 into the target.  The following sufficient criteria are applied:
25090 @itemize *
25092 @item 
25093 The bounds of the aggregate are static, and the associations are static.
25095 @item 
25096 The components of the aggregate are static constants, names of
25097 simple variables that are not renamings, or expressions not involving
25098 indexed components whose operands obey these rules.
25099 @end itemize
25101 If any of these conditions are violated, the aggregate will be built in
25102 a temporary (created either by the front-end or the code generator) and then
25103 that temporary will be copied onto the target.
25105 @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
25106 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{3c5}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{3c6}
25107 @section The Size of Discriminated Records with Default Discriminants
25110 If a discriminated type @cite{T} has discriminants with default values, it is
25111 possible to declare an object of this type without providing an explicit
25112 constraint:
25114 @example
25115 type Size is range 1..100;
25117 type Rec (D : Size := 15) is record
25118    Name : String (1..D);
25119 end T;
25121 Word : Rec;
25122 @end example
25124 Such an object is said to be @emph{unconstrained}.
25125 The discriminant of the object
25126 can be modified by a full assignment to the object, as long as it preserves the
25127 relation between the value of the discriminant, and the value of the components
25128 that depend on it:
25130 @example
25131 Word := (3, "yes");
25133 Word := (5, "maybe");
25135 Word := (5, "no"); -- raises Constraint_Error
25136 @end example
25138 In order to support this behavior efficiently, an unconstrained object is
25139 given the maximum size that any value of the type requires. In the case
25140 above, @cite{Word} has storage for the discriminant and for
25141 a @cite{String} of length 100.
25142 It is important to note that unconstrained objects do not require dynamic
25143 allocation. It would be an improper implementation to place on the heap those
25144 components whose size depends on discriminants. (This improper implementation
25145 was used by some Ada83 compilers, where the @cite{Name} component above
25146 would have
25147 been stored as a pointer to a dynamic string). Following the principle that
25148 dynamic storage management should never be introduced implicitly,
25149 an Ada compiler should reserve the full size for an unconstrained declared
25150 object, and place it on the stack.
25152 This maximum size approach
25153 has been a source of surprise to some users, who expect the default
25154 values of the discriminants to determine the size reserved for an
25155 unconstrained object: "If the default is 15, why should the object occupy
25156 a larger size?"
25157 The answer, of course, is that the discriminant may be later modified,
25158 and its full range of values must be taken into account. This is why the
25159 declaration:
25161 @example
25162 type Rec (D : Positive := 15) is record
25163    Name : String (1..D);
25164 end record;
25166 Too_Large : Rec;
25167 @end example
25169 is flagged by the compiler with a warning:
25170 an attempt to create @cite{Too_Large} will raise @cite{Storage_Error},
25171 because the required size includes @cite{Positive'Last}
25172 bytes. As the first example indicates, the proper approach is to declare an
25173 index type of 'reasonable' range so that unconstrained objects are not too
25174 large.
25176 One final wrinkle: if the object is declared to be @cite{aliased}, or if it is
25177 created in the heap by means of an allocator, then it is @emph{not}
25178 unconstrained:
25179 it is constrained by the default values of the discriminants, and those values
25180 cannot be modified by full assignment. This is because in the presence of
25181 aliasing all views of the object (which may be manipulated by different tasks,
25182 say) must be consistent, so it is imperative that the object, once created,
25183 remain invariant.
25185 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
25186 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{3c7}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{3c8}
25187 @section Strict Conformance to the Ada Reference Manual
25190 The dynamic semantics defined by the Ada Reference Manual impose a set of
25191 run-time checks to be generated. By default, the GNAT compiler will insert many
25192 run-time checks into the compiled code, including most of those required by the
25193 Ada Reference Manual. However, there are three checks that are not enabled
25194 in the default mode for efficiency reasons: arithmetic overflow checking for
25195 integer operations (including division by zero), checks for access before
25196 elaboration on subprogram calls, and stack overflow checking (most operating
25197 systems do not perform this check by default).
25199 Strict conformance to the Ada Reference Manual can be achieved by adding
25200 three compiler options for overflow checking for integer operations
25201 (@emph{-gnato}), dynamic checks for access-before-elaboration on subprogram
25202 calls and generic instantiations (@emph{-gnatE}), and stack overflow
25203 checking (@emph{-fstack-check}).
25205 Note that the result of a floating point arithmetic operation in overflow and
25206 invalid situations, when the @cite{Machine_Overflows} attribute of the result
25207 type is @cite{False}, is to generate IEEE NaN and infinite values. This is the
25208 case for machines compliant with the IEEE floating-point standard, but on
25209 machines that are not fully compliant with this standard, such as Alpha, the
25210 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
25211 behavior (although at the cost of a significant performance penalty), so
25212 infinite and NaN values are properly generated.
25214 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
25215 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{3c9}@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{3ca}
25216 @chapter Implementation of Ada 2012 Features
25219 @geindex Ada 2012 implementation status
25221 @geindex -gnat12 option (gcc)
25223 @geindex pragma Ada_2012
25225 @geindex configuration pragma Ada_2012
25227 @geindex Ada_2012 configuration pragma
25229 This chapter contains a complete list of Ada 2012 features that have been
25230 implemented.
25231 Generally, these features are only
25232 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
25233 which is the default behavior,
25234 or if the configuration pragma @cite{Ada_2012} is used.
25236 However, new pragmas, attributes, and restrictions are
25237 unconditionally available, since the Ada 95 standard allows the addition of
25238 new pragmas, attributes, and restrictions (there are exceptions, which are
25239 documented in the individual descriptions), and also certain packages
25240 were made available in earlier versions of Ada.
25242 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
25243 This date shows the implementation date of the feature. Any wavefront
25244 subsequent to this date will contain the indicated feature, as will any
25245 subsequent releases. A date of 0000-00-00 means that GNAT has always
25246 implemented the feature, or implemented it as soon as it appeared as a
25247 binding interpretation.
25249 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
25250 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
25251 The features are ordered based on the relevant sections of the Ada
25252 Reference Manual ("RM").  When a given AI relates to multiple points
25253 in the RM, the earliest is used.
25255 A complete description of the AIs may be found in
25256 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
25258 @geindex AI-0176 (Ada 2012 feature)
25261 @itemize *
25263 @item 
25264 @emph{AI-0176 Quantified expressions (2010-09-29)}
25266 Both universally and existentially quantified expressions are implemented.
25267 They use the new syntax for iterators proposed in AI05-139-2, as well as
25268 the standard Ada loop syntax.
25270 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
25271 @end itemize
25273 @geindex AI-0079 (Ada 2012 feature)
25276 @itemize *
25278 @item 
25279 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
25281 Wide characters in the unicode category @emph{other_format} are now allowed in
25282 source programs between tokens, but not within a token such as an identifier.
25284 RM References:  2.01 (4/2)   2.02 (7)
25285 @end itemize
25287 @geindex AI-0091 (Ada 2012 feature)
25290 @itemize *
25292 @item 
25293 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
25295 Wide characters in the unicode category @emph{other_format} are not permitted
25296 within  an identifier, since this can be a security problem. The error
25297 message for this case has been improved to be more specific, but GNAT has
25298 never allowed such characters to appear in identifiers.
25300 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)
25301 @end itemize
25303 @geindex AI-0100 (Ada 2012 feature)
25306 @itemize *
25308 @item 
25309 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
25311 This AI is an earlier version of AI-163. It simplifies the rules
25312 for legal placement of pragmas. In the case of lists that allow pragmas, if
25313 the list may have no elements, then the list may consist solely of pragmas.
25315 RM References:  2.08 (7)
25316 @end itemize
25318 @geindex AI-0163 (Ada 2012 feature)
25321 @itemize *
25323 @item 
25324 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
25326 A statement sequence may be composed entirely of pragmas. It is no longer
25327 necessary to add a dummy @cite{null} statement to make the sequence legal.
25329 RM References:  2.08 (7)   2.08 (16)
25330 @end itemize
25332 @geindex AI-0080 (Ada 2012 feature)
25335 @itemize *
25337 @item 
25338 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
25340 This is an editorial change only, described as non-testable in the AI.
25342 RM References:  3.01 (7)
25343 @end itemize
25345 @geindex AI-0183 (Ada 2012 feature)
25348 @itemize *
25350 @item 
25351 @emph{AI-0183 Aspect specifications (2010-08-16)}
25353 Aspect specifications have been fully implemented except for pre and post-
25354 conditions, and type invariants, which have their own separate AI's. All
25355 forms of declarations listed in the AI are supported. The following is a
25356 list of the aspects supported (with GNAT implementation aspects marked)
25357 @end itemize
25360 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
25361 @headitem
25363 Supported Aspect
25365 @tab
25367 Source
25369 @item
25371 @cite{Ada_2005}
25373 @tab
25375 -- GNAT
25377 @item
25379 @cite{Ada_2012}
25381 @tab
25383 -- GNAT
25385 @item
25387 @cite{Address}
25389 @tab
25391 @item
25393 @cite{Alignment}
25395 @tab
25397 @item
25399 @cite{Atomic}
25401 @tab
25403 @item
25405 @cite{Atomic_Components}
25407 @tab
25409 @item
25411 @cite{Bit_Order}
25413 @tab
25415 @item
25417 @cite{Component_Size}
25419 @tab
25421 @item
25423 @cite{Contract_Cases}
25425 @tab
25427 -- GNAT
25429 @item
25431 @cite{Discard_Names}
25433 @tab
25435 @item
25437 @cite{External_Tag}
25439 @tab
25441 @item
25443 @cite{Favor_Top_Level}
25445 @tab
25447 -- GNAT
25449 @item
25451 @cite{Inline}
25453 @tab
25455 @item
25457 @cite{Inline_Always}
25459 @tab
25461 -- GNAT
25463 @item
25465 @cite{Invariant}
25467 @tab
25469 -- GNAT
25471 @item
25473 @cite{Machine_Radix}
25475 @tab
25477 @item
25479 @cite{No_Return}
25481 @tab
25483 @item
25485 @cite{Object_Size}
25487 @tab
25489 -- GNAT
25491 @item
25493 @cite{Pack}
25495 @tab
25497 @item
25499 @cite{Persistent_BSS}
25501 @tab
25503 -- GNAT
25505 @item
25507 @cite{Post}
25509 @tab
25511 @item
25513 @cite{Pre}
25515 @tab
25517 @item
25519 @cite{Predicate}
25521 @tab
25523 @item
25525 @cite{Preelaborable_Initialization}
25527 @tab
25529 @item
25531 @cite{Pure_Function}
25533 @tab
25535 -- GNAT
25537 @item
25539 @cite{Remote_Access_Type}
25541 @tab
25543 -- GNAT
25545 @item
25547 @cite{Shared}
25549 @tab
25551 -- GNAT
25553 @item
25555 @cite{Size}
25557 @tab
25559 @item
25561 @cite{Storage_Pool}
25563 @tab
25565 @item
25567 @cite{Storage_Size}
25569 @tab
25571 @item
25573 @cite{Stream_Size}
25575 @tab
25577 @item
25579 @cite{Suppress}
25581 @tab
25583 @item
25585 @cite{Suppress_Debug_Info}
25587 @tab
25589 -- GNAT
25591 @item
25593 @cite{Test_Case}
25595 @tab
25597 -- GNAT
25599 @item
25601 @cite{Thread_Local_Storage}
25603 @tab
25605 -- GNAT
25607 @item
25609 @cite{Type_Invariant}
25611 @tab
25613 @item
25615 @cite{Unchecked_Union}
25617 @tab
25619 @item
25621 @cite{Universal_Aliasing}
25623 @tab
25625 -- GNAT
25627 @item
25629 @cite{Unmodified}
25631 @tab
25633 -- GNAT
25635 @item
25637 @cite{Unreferenced}
25639 @tab
25641 -- GNAT
25643 @item
25645 @cite{Unreferenced_Objects}
25647 @tab
25649 -- GNAT
25651 @item
25653 @cite{Unsuppress}
25655 @tab
25657 @item
25659 @cite{Value_Size}
25661 @tab
25663 -- GNAT
25665 @item
25667 @cite{Volatile}
25669 @tab
25671 @item
25673 @cite{Volatile_Components}
25675 @tab
25677 @item
25679 @cite{Warnings}
25681 @tab
25683 -- GNAT
25685 @end multitable
25688 @quotation
25690 Note that for aspects with an expression, e.g. @cite{Size}, the expression is
25691 treated like a default expression (visibility is analyzed at the point of
25692 occurrence of the aspect, but evaluation of the expression occurs at the
25693 freeze point of the entity involved).
25695 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
25696 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
25697 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
25698 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
25699 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
25700 13.03.01 (0)
25701 @end quotation
25703 @geindex AI-0128 (Ada 2012 feature)
25706 @itemize *
25708 @item 
25709 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
25711 If an equality operator ("=") is declared for a type, then the implicitly
25712 declared inequality operator ("/=") is a primitive operation of the type.
25713 This is the only reasonable interpretation, and is the one always implemented
25714 by GNAT, but the RM was not entirely clear in making this point.
25716 RM References:  3.02.03 (6)   6.06 (6)
25717 @end itemize
25719 @geindex AI-0003 (Ada 2012 feature)
25722 @itemize *
25724 @item 
25725 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
25727 In Ada 2012, a qualified expression is considered to be syntactically a name,
25728 meaning that constructs such as @cite{A'(F(X)).B} are now legal. This is
25729 useful in disambiguating some cases of overloading.
25731 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
25732 5.04 (7)
25733 @end itemize
25735 @geindex AI-0120 (Ada 2012 feature)
25738 @itemize *
25740 @item 
25741 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
25743 This is an RM editorial change only. The section that lists objects that are
25744 constant failed to include the current instance of a protected object
25745 within a protected function. This has always been treated as a constant
25746 in GNAT.
25748 RM References:  3.03 (21)
25749 @end itemize
25751 @geindex AI-0008 (Ada 2012 feature)
25754 @itemize *
25756 @item 
25757 @emph{AI-0008 General access to constrained objects (0000-00-00)}
25759 The wording in the RM implied that if you have a general access to a
25760 constrained object, it could be used to modify the discriminants. This was
25761 obviously not intended. @cite{Constraint_Error} should be raised, and GNAT
25762 has always done so in this situation.
25764 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
25765 @end itemize
25767 @geindex AI-0093 (Ada 2012 feature)
25770 @itemize *
25772 @item 
25773 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
25775 This is an editorial change only, to make more widespread use of the Ada 2012
25776 'immutably limited'.
25778 RM References:  3.03 (23.4/3)
25779 @end itemize
25781 @geindex AI-0096 (Ada 2012 feature)
25784 @itemize *
25786 @item 
25787 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
25789 In general it is illegal for a type derived from a formal limited type to be
25790 nonlimited.  This AI makes an exception to this rule: derivation is legal
25791 if it appears in the private part of the generic, and the formal type is not
25792 tagged. If the type is tagged, the legality check must be applied to the
25793 private part of the package.
25795 RM References:  3.04 (5.1/2)   6.02 (7)
25796 @end itemize
25798 @geindex AI-0181 (Ada 2012 feature)
25801 @itemize *
25803 @item 
25804 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
25806 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
25807 means that it has a special name (@cite{SOFT_HYPHEN}) in conjunction with the
25808 @cite{Image} and @cite{Value} attributes for the character types. Strictly
25809 speaking this is an inconsistency with Ada 95, but in practice the use of
25810 these attributes is so obscure that it will not cause problems.
25812 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
25813 @end itemize
25815 @geindex AI-0182 (Ada 2012 feature)
25818 @itemize *
25820 @item 
25821 @emph{AI-0182 Additional forms for `Character'Value} (0000-00-00)`
25823 This AI allows @cite{Character'Value} to accept the string @cite{'?'} where
25824 @cite{?} is any character including non-graphic control characters. GNAT has
25825 always accepted such strings. It also allows strings such as
25826 @cite{HEX_00000041} to be accepted, but GNAT does not take advantage of this
25827 permission and raises @cite{Constraint_Error}, as is certainly still
25828 permitted.
25830 RM References:  3.05 (56/2)
25831 @end itemize
25833 @geindex AI-0214 (Ada 2012 feature)
25836 @itemize *
25838 @item 
25839 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
25841 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
25842 to have default expressions by allowing them when the type is limited. It
25843 is often useful to define a default value for a discriminant even though
25844 it can't be changed by assignment.
25846 RM References:  3.07 (9.1/2)   3.07.02 (3)
25847 @end itemize
25849 @geindex AI-0102 (Ada 2012 feature)
25852 @itemize *
25854 @item 
25855 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
25857 It is illegal to assign an anonymous access constant to an anonymous access
25858 variable. The RM did not have a clear rule to prevent this, but GNAT has
25859 always generated an error for this usage.
25861 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
25862 @end itemize
25864 @geindex AI-0158 (Ada 2012 feature)
25867 @itemize *
25869 @item 
25870 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
25872 This AI extends the syntax of membership tests to simplify complex conditions
25873 that can be expressed as membership in a subset of values of any type. It
25874 introduces syntax for a list of expressions that may be used in loop contexts
25875 as well.
25877 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
25878 @end itemize
25880 @geindex AI-0173 (Ada 2012 feature)
25883 @itemize *
25885 @item 
25886 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
25888 The function @cite{Ada.Tags.Type_Is_Abstract} returns @cite{True} if invoked
25889 with the tag of an abstract type, and @cite{False} otherwise.
25891 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
25892 @end itemize
25894 @geindex AI-0076 (Ada 2012 feature)
25897 @itemize *
25899 @item 
25900 @emph{AI-0076 function with controlling result (0000-00-00)}
25902 This is an editorial change only. The RM defines calls with controlling
25903 results, but uses the term 'function with controlling result' without an
25904 explicit definition.
25906 RM References:  3.09.02 (2/2)
25907 @end itemize
25909 @geindex AI-0126 (Ada 2012 feature)
25912 @itemize *
25914 @item 
25915 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
25917 This AI clarifies dispatching rules, and simply confirms that dispatching
25918 executes the operation of the parent type when there is no explicitly or
25919 implicitly declared operation for the descendant type. This has always been
25920 the case in all versions of GNAT.
25922 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
25923 @end itemize
25925 @geindex AI-0097 (Ada 2012 feature)
25928 @itemize *
25930 @item 
25931 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
25933 The RM as written implied that in some cases it was possible to create an
25934 object of an abstract type, by having an abstract extension inherit a non-
25935 abstract constructor from its parent type. This mistake has been corrected
25936 in GNAT and in the RM, and this construct is now illegal.
25938 RM References:  3.09.03 (4/2)
25939 @end itemize
25941 @geindex AI-0203 (Ada 2012 feature)
25944 @itemize *
25946 @item 
25947 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
25949 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
25950 permitted such usage.
25952 RM References:  3.09.03 (8/3)
25953 @end itemize
25955 @geindex AI-0198 (Ada 2012 feature)
25958 @itemize *
25960 @item 
25961 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
25963 This AI resolves a conflict between two rules involving inherited abstract
25964 operations and predefined operators. If a derived numeric type inherits
25965 an abstract operator, it overrides the predefined one. This interpretation
25966 was always the one implemented in GNAT.
25968 RM References:  3.09.03 (4/3)
25969 @end itemize
25971 @geindex AI-0073 (Ada 2012 feature)
25974 @itemize *
25976 @item 
25977 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
25979 This AI covers a number of issues regarding returning abstract types. In
25980 particular generic functions cannot have abstract result types or access
25981 result types designated an abstract type. There are some other cases which
25982 are detailed in the AI. Note that this binding interpretation has not been
25983 retrofitted to operate before Ada 2012 mode, since it caused a significant
25984 number of regressions.
25986 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
25987 @end itemize
25989 @geindex AI-0070 (Ada 2012 feature)
25992 @itemize *
25994 @item 
25995 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
25997 This is an editorial change only, there are no testable consequences short of
25998 checking for the absence of generated code for an interface declaration.
26000 RM References:  3.09.04 (18/2)
26001 @end itemize
26003 @geindex AI-0208 (Ada 2012 feature)
26006 @itemize *
26008 @item 
26009 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
26011 The wording in the Ada 2005 RM concerning characteristics of incomplete views
26012 was incorrect and implied that some programs intended to be legal were now
26013 illegal. GNAT had never considered such programs illegal, so it has always
26014 implemented the intent of this AI.
26016 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
26017 @end itemize
26019 @geindex AI-0162 (Ada 2012 feature)
26022 @itemize *
26024 @item 
26025 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
26027 Incomplete types are made more useful by allowing them to be completed by
26028 private types and private extensions.
26030 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
26031 @end itemize
26033 @geindex AI-0098 (Ada 2012 feature)
26036 @itemize *
26038 @item 
26039 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
26041 An unintentional omission in the RM implied some inconsistent restrictions on
26042 the use of anonymous access to subprogram values. These restrictions were not
26043 intentional, and have never been enforced by GNAT.
26045 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
26046 @end itemize
26048 @geindex AI-0199 (Ada 2012 feature)
26051 @itemize *
26053 @item 
26054 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
26056 A choice list in a record aggregate can include several components of
26057 (distinct) anonymous access types as long as they have matching designated
26058 subtypes.
26060 RM References:  4.03.01 (16)
26061 @end itemize
26063 @geindex AI-0220 (Ada 2012 feature)
26066 @itemize *
26068 @item 
26069 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
26071 This AI addresses a wording problem in the RM that appears to permit some
26072 complex cases of aggregates with non-static discriminants. GNAT has always
26073 implemented the intended semantics.
26075 RM References:  4.03.01 (17)
26076 @end itemize
26078 @geindex AI-0147 (Ada 2012 feature)
26081 @itemize *
26083 @item 
26084 @emph{AI-0147 Conditional expressions (2009-03-29)}
26086 Conditional expressions are permitted. The form of such an expression is:
26088 @example
26089 (if expr then expr @{elsif expr then expr@} [else expr])
26090 @end example
26092 The parentheses can be omitted in contexts where parentheses are present
26093 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
26094 clause is omitted, @strong{else} @emph{True} is assumed;
26095 thus @code{(if A then B)} is a way to conveniently represent
26096 @emph{(A implies B)} in standard logic.
26098 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
26099 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
26100 @end itemize
26102 @geindex AI-0037 (Ada 2012 feature)
26105 @itemize *
26107 @item 
26108 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
26110 This AI confirms that an association of the form @cite{Indx => <>} in an
26111 array aggregate must raise @cite{Constraint_Error} if @cite{Indx}
26112 is out of range. The RM specified a range check on other associations, but
26113 not when the value of the association was defaulted. GNAT has always inserted
26114 a constraint check on the index value.
26116 RM References:  4.03.03 (29)
26117 @end itemize
26119 @geindex AI-0123 (Ada 2012 feature)
26122 @itemize *
26124 @item 
26125 @emph{AI-0123 Composability of equality (2010-04-13)}
26127 Equality of untagged record composes, so that the predefined equality for a
26128 composite type that includes a component of some untagged record type
26129 @cite{R} uses the equality operation of @cite{R} (which may be user-defined
26130 or predefined). This makes the behavior of untagged records identical to that
26131 of tagged types in this respect.
26133 This change is an incompatibility with previous versions of Ada, but it
26134 corrects a non-uniformity that was often a source of confusion. Analysis of
26135 a large number of industrial programs indicates that in those rare cases
26136 where a composite type had an untagged record component with a user-defined
26137 equality, either there was no use of the composite equality, or else the code
26138 expected the same composability as for tagged types, and thus had a bug that
26139 would be fixed by this change.
26141 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
26142 8.05.04 (8)
26143 @end itemize
26145 @geindex AI-0088 (Ada 2012 feature)
26148 @itemize *
26150 @item 
26151 @emph{AI-0088 The value of exponentiation (0000-00-00)}
26153 This AI clarifies the equivalence rule given for the dynamic semantics of
26154 exponentiation: the value of the operation can be obtained by repeated
26155 multiplication, but the operation can be implemented otherwise (for example
26156 using the familiar divide-by-two-and-square algorithm, even if this is less
26157 accurate), and does not imply repeated reads of a volatile base.
26159 RM References:  4.05.06 (11)
26160 @end itemize
26162 @geindex AI-0188 (Ada 2012 feature)
26165 @itemize *
26167 @item 
26168 @emph{AI-0188 Case expressions (2010-01-09)}
26170 Case expressions are permitted. This allows use of constructs such as:
26172 @example
26173 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
26174 @end example
26176 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
26177 @end itemize
26179 @geindex AI-0104 (Ada 2012 feature)
26182 @itemize *
26184 @item 
26185 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
26187 The assignment @code{Ptr := new not null Some_Ptr;} will raise
26188 @code{Constraint_Error} because the default value of the allocated object is
26189 @strong{null}. This useless construct is illegal in Ada 2012.
26191 RM References:  4.08 (2)
26192 @end itemize
26194 @geindex AI-0157 (Ada 2012 feature)
26197 @itemize *
26199 @item 
26200 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
26202 Allocation and Deallocation from an empty storage pool (i.e. allocation or
26203 deallocation of a pointer for which a static storage size clause of zero
26204 has been given) is now illegal and is detected as such. GNAT
26205 previously gave a warning but not an error.
26207 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
26208 @end itemize
26210 @geindex AI-0179 (Ada 2012 feature)
26213 @itemize *
26215 @item 
26216 @emph{AI-0179 Statement not required after label (2010-04-10)}
26218 It is not necessary to have a statement following a label, so a label
26219 can appear at the end of a statement sequence without the need for putting a
26220 null statement afterwards, but it is not allowable to have only labels and
26221 no real statements in a statement sequence.
26223 RM References:  5.01 (2)
26224 @end itemize
26226 @geindex AI-0139-2 (Ada 2012 feature)
26229 @itemize *
26231 @item 
26232 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
26234 The new syntax for iterating over arrays and containers is now implemented.
26235 Iteration over containers is for now limited to read-only iterators. Only
26236 default iterators are supported, with the syntax:  @cite{for Elem of C}.
26238 RM References:  5.05
26239 @end itemize
26241 @geindex AI-0134 (Ada 2012 feature)
26244 @itemize *
26246 @item 
26247 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
26249 For full conformance, the profiles of anonymous-access-to-subprogram
26250 parameters must match. GNAT has always enforced this rule.
26252 RM References:  6.03.01 (18)
26253 @end itemize
26255 @geindex AI-0207 (Ada 2012 feature)
26258 @itemize *
26260 @item 
26261 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
26263 This AI confirms that access_to_constant indication must match for mode
26264 conformance. This was implemented in GNAT when the qualifier was originally
26265 introduced in Ada 2005.
26267 RM References:  6.03.01 (16/2)
26268 @end itemize
26270 @geindex AI-0046 (Ada 2012 feature)
26273 @itemize *
26275 @item 
26276 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
26278 For full conformance, in the case of access parameters, the null exclusion
26279 must match (either both or neither must have @code{not null}).
26281 RM References:  6.03.02 (18)
26282 @end itemize
26284 @geindex AI-0118 (Ada 2012 feature)
26287 @itemize *
26289 @item 
26290 @emph{AI-0118 The association of parameter associations (0000-00-00)}
26292 This AI clarifies the rules for named associations in subprogram calls and
26293 generic instantiations. The rules have been in place since Ada 83.
26295 RM References:  6.04.01 (2)   12.03 (9)
26296 @end itemize
26298 @geindex AI-0196 (Ada 2012 feature)
26301 @itemize *
26303 @item 
26304 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
26306 Null exclusion checks are not made for @cite{**out**} parameters when
26307 evaluating the actual parameters. GNAT has never generated these checks.
26309 RM References:  6.04.01 (13)
26310 @end itemize
26312 @geindex AI-0015 (Ada 2012 feature)
26315 @itemize *
26317 @item 
26318 @emph{AI-0015 Constant return objects (0000-00-00)}
26320 The return object declared in an @emph{extended_return_statement} may be
26321 declared constant. This was always intended, and GNAT has always allowed it.
26323 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
26324 6.05 (5.7/2)
26325 @end itemize
26327 @geindex AI-0032 (Ada 2012 feature)
26330 @itemize *
26332 @item 
26333 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
26335 If a function returns a class-wide type, the object of an extended return
26336 statement can be declared with a specific type that is covered by the class-
26337 wide type. This has been implemented in GNAT since the introduction of
26338 extended returns. Note AI-0103 complements this AI by imposing matching
26339 rules for constrained return types.
26341 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
26342 6.05 (8/2)
26343 @end itemize
26345 @geindex AI-0103 (Ada 2012 feature)
26348 @itemize *
26350 @item 
26351 @emph{AI-0103 Static matching for extended return (2010-07-23)}
26353 If the return subtype of a function is an elementary type or a constrained
26354 type, the subtype indication in an extended return statement must match
26355 statically this return subtype.
26357 RM References:  6.05 (5.2/2)
26358 @end itemize
26360 @geindex AI-0058 (Ada 2012 feature)
26363 @itemize *
26365 @item 
26366 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
26368 The RM had some incorrect wording implying wrong treatment of abnormal
26369 completion in an extended return. GNAT has always implemented the intended
26370 correct semantics as described by this AI.
26372 RM References:  6.05 (22/2)
26373 @end itemize
26375 @geindex AI-0050 (Ada 2012 feature)
26378 @itemize *
26380 @item 
26381 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
26383 The implementation permissions for raising @cite{Constraint_Error} early on a function call
26384 when it was clear an exception would be raised were over-permissive and allowed
26385 mishandling of discriminants in some cases. GNAT did
26386 not take advantage of these incorrect permissions in any case.
26388 RM References:  6.05 (24/2)
26389 @end itemize
26391 @geindex AI-0125 (Ada 2012 feature)
26394 @itemize *
26396 @item 
26397 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
26399 In Ada 2012, the declaration of a primitive operation of a type extension
26400 or private extension can also override an inherited primitive that is not
26401 visible at the point of this declaration.
26403 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
26404 @end itemize
26406 @geindex AI-0062 (Ada 2012 feature)
26409 @itemize *
26411 @item 
26412 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
26414 A full constant may have a null exclusion even if its associated deferred
26415 constant does not. GNAT has always allowed this.
26417 RM References:  7.04 (6/2)   7.04 (7.1/2)
26418 @end itemize
26420 @geindex AI-0178 (Ada 2012 feature)
26423 @itemize *
26425 @item 
26426 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
26428 This AI clarifies the role of incomplete views and plugs an omission in the
26429 RM. GNAT always correctly restricted the use of incomplete views and types.
26431 RM References:  7.05 (3/2)   7.05 (6/2)
26432 @end itemize
26434 @geindex AI-0087 (Ada 2012 feature)
26437 @itemize *
26439 @item 
26440 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
26442 The actual for a formal nonlimited derived type cannot be limited. In
26443 particular, a formal derived type that extends a limited interface but which
26444 is not explicitly limited cannot be instantiated with a limited type.
26446 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
26447 @end itemize
26449 @geindex AI-0099 (Ada 2012 feature)
26452 @itemize *
26454 @item 
26455 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
26457 This AI clarifies that 'needs finalization' is part of dynamic semantics,
26458 and therefore depends on the run-time characteristics of an object (i.e. its
26459 tag) and not on its nominal type. As the AI indicates: "we do not expect
26460 this to affect any implementation'@w{'}.
26462 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
26463 @end itemize
26465 @geindex AI-0064 (Ada 2012 feature)
26468 @itemize *
26470 @item 
26471 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
26473 This is an editorial change only. The intended behavior is already checked
26474 by an existing ACATS test, which GNAT has always executed correctly.
26476 RM References:  7.06.01 (17.1/1)
26477 @end itemize
26479 @geindex AI-0026 (Ada 2012 feature)
26482 @itemize *
26484 @item 
26485 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
26487 Record representation clauses concerning Unchecked_Union types cannot mention
26488 the discriminant of the type. The type of a component declared in the variant
26489 part of an Unchecked_Union cannot be controlled, have controlled components,
26490 nor have protected or task parts. If an Unchecked_Union type is declared
26491 within the body of a generic unit or its descendants, then the type of a
26492 component declared in the variant part cannot be a formal private type or a
26493 formal private extension declared within the same generic unit.
26495 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
26496 @end itemize
26498 @geindex AI-0205 (Ada 2012 feature)
26501 @itemize *
26503 @item 
26504 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
26506 This AI corrects a simple omission in the RM. Return objects have always
26507 been visible within an extended return statement.
26509 RM References:  8.03 (17)
26510 @end itemize
26512 @geindex AI-0042 (Ada 2012 feature)
26515 @itemize *
26517 @item 
26518 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
26520 This AI fixes a wording gap in the RM. An operation of a synchronized
26521 interface can be implemented by a protected or task entry, but the abstract
26522 operation is not being overridden in the usual sense, and it must be stated
26523 separately that this implementation is legal. This has always been the case
26524 in GNAT.
26526 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
26527 @end itemize
26529 @geindex AI-0030 (Ada 2012 feature)
26532 @itemize *
26534 @item 
26535 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
26537 Requeue is permitted to a protected, synchronized or task interface primitive
26538 providing it is known that the overriding operation is an entry. Otherwise
26539 the requeue statement has the same effect as a procedure call. Use of pragma
26540 @cite{Implemented} provides a way to impose a static requirement on the
26541 overriding operation by adhering to one of the implementation kinds: entry,
26542 protected procedure or any of the above.
26544 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
26545 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
26546 @end itemize
26548 @geindex AI-0201 (Ada 2012 feature)
26551 @itemize *
26553 @item 
26554 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
26556 If an Atomic object has a pragma @cite{Pack} or a @cite{Component_Size}
26557 attribute, then individual components may not be addressable by independent
26558 tasks. However, if the representation clause has no effect (is confirming),
26559 then independence is not compromised. Furthermore, in GNAT, specification of
26560 other appropriately addressable component sizes (e.g. 16 for 8-bit
26561 characters) also preserves independence. GNAT now gives very clear warnings
26562 both for the declaration of such a type, and for any assignment to its components.
26564 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
26565 @end itemize
26567 @geindex AI-0009 (Ada 2012 feature)
26570 @itemize *
26572 @item 
26573 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
26575 This AI introduces the new pragmas @cite{Independent} and
26576 @cite{Independent_Components},
26577 which control guaranteeing independence of access to objects and components.
26578 The AI also requires independence not unaffected by confirming rep clauses.
26580 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
26581 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
26582 @end itemize
26584 @geindex AI-0072 (Ada 2012 feature)
26587 @itemize *
26589 @item 
26590 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
26592 This AI clarifies that task signalling for reading @cite{'Terminated} only
26593 occurs if the result is True. GNAT semantics has always been consistent with
26594 this notion of task signalling.
26596 RM References:  9.10 (6.1/1)
26597 @end itemize
26599 @geindex AI-0108 (Ada 2012 feature)
26602 @itemize *
26604 @item 
26605 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
26607 This AI confirms that an incomplete type from a limited view does not have
26608 discriminants. This has always been the case in GNAT.
26610 RM References:  10.01.01 (12.3/2)
26611 @end itemize
26613 @geindex AI-0129 (Ada 2012 feature)
26616 @itemize *
26618 @item 
26619 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
26621 This AI clarifies the description of limited views: a limited view of a
26622 package includes only one view of a type that has an incomplete declaration
26623 and a full declaration (there is no possible ambiguity in a client package).
26624 This AI also fixes an omission: a nested package in the private part has no
26625 limited view. GNAT always implemented this correctly.
26627 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
26628 @end itemize
26630 @geindex AI-0077 (Ada 2012 feature)
26633 @itemize *
26635 @item 
26636 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
26638 This AI clarifies that a declaration does not include a context clause,
26639 and confirms that it is illegal to have a context in which both a limited
26640 and a nonlimited view of a package are accessible. Such double visibility
26641 was always rejected by GNAT.
26643 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
26644 @end itemize
26646 @geindex AI-0122 (Ada 2012 feature)
26649 @itemize *
26651 @item 
26652 @emph{AI-0122 Private with and children of generics (0000-00-00)}
26654 This AI clarifies the visibility of private children of generic units within
26655 instantiations of a parent. GNAT has always handled this correctly.
26657 RM References:  10.01.02 (12/2)
26658 @end itemize
26660 @geindex AI-0040 (Ada 2012 feature)
26663 @itemize *
26665 @item 
26666 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
26668 This AI confirms that a limited with clause in a child unit cannot name
26669 an ancestor of the unit. This has always been checked in GNAT.
26671 RM References:  10.01.02 (20/2)
26672 @end itemize
26674 @geindex AI-0132 (Ada 2012 feature)
26677 @itemize *
26679 @item 
26680 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
26682 This AI fills a gap in the description of library unit pragmas. The pragma
26683 clearly must apply to a library unit, even if it does not carry the name
26684 of the enclosing unit. GNAT has always enforced the required check.
26686 RM References:  10.01.05 (7)
26687 @end itemize
26689 @geindex AI-0034 (Ada 2012 feature)
26692 @itemize *
26694 @item 
26695 @emph{AI-0034 Categorization of limited views (0000-00-00)}
26697 The RM makes certain limited with clauses illegal because of categorization
26698 considerations, when the corresponding normal with would be legal. This is
26699 not intended, and GNAT has always implemented the recommended behavior.
26701 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
26702 @end itemize
26704 @geindex AI-0035 (Ada 2012 feature)
26707 @itemize *
26709 @item 
26710 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
26712 This AI remedies some inconsistencies in the legality rules for Pure units.
26713 Derived access types are legal in a pure unit (on the assumption that the
26714 rule for a zero storage pool size has been enforced on the ancestor type).
26715 The rules are enforced in generic instances and in subunits. GNAT has always
26716 implemented the recommended behavior.
26718 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)
26719 @end itemize
26721 @geindex AI-0219 (Ada 2012 feature)
26724 @itemize *
26726 @item 
26727 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
26729 This AI refines the rules for the cases with limited parameters which do not
26730 allow the implementations to omit 'redundant'. GNAT now properly conforms
26731 to the requirements of this binding interpretation.
26733 RM References:  10.02.01 (18/2)
26734 @end itemize
26736 @geindex AI-0043 (Ada 2012 feature)
26739 @itemize *
26741 @item 
26742 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
26744 This AI covers various omissions in the RM regarding the raising of
26745 exceptions. GNAT has always implemented the intended semantics.
26747 RM References:  11.04.01 (10.1/2)   11 (2)
26748 @end itemize
26750 @geindex AI-0200 (Ada 2012 feature)
26753 @itemize *
26755 @item 
26756 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
26758 This AI plugs a gap in the RM which appeared to allow some obviously intended
26759 illegal instantiations. GNAT has never allowed these instantiations.
26761 RM References:  12.07 (16)
26762 @end itemize
26764 @geindex AI-0112 (Ada 2012 feature)
26767 @itemize *
26769 @item 
26770 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
26772 This AI concerns giving names to various representation aspects, but the
26773 practical effect is simply to make the use of duplicate
26774 @cite{Atomic[_Components]},
26775 @cite{Volatile[_Components]}, and
26776 @cite{Independent[_Components]} pragmas illegal, and GNAT
26777 now performs this required check.
26779 RM References:  13.01 (8)
26780 @end itemize
26782 @geindex AI-0106 (Ada 2012 feature)
26785 @itemize *
26787 @item 
26788 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
26790 The RM appeared to allow representation pragmas on generic formal parameters,
26791 but this was not intended, and GNAT has never permitted this usage.
26793 RM References:  13.01 (9.1/1)
26794 @end itemize
26796 @geindex AI-0012 (Ada 2012 feature)
26799 @itemize *
26801 @item 
26802 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
26804 It is now illegal to give an inappropriate component size or a pragma
26805 @cite{Pack} that attempts to change the component size in the case of atomic
26806 or aliased components. Previously GNAT ignored such an attempt with a
26807 warning.
26809 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
26810 @end itemize
26812 @geindex AI-0039 (Ada 2012 feature)
26815 @itemize *
26817 @item 
26818 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
26820 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
26821 for stream attributes, but these were never useful and are now illegal. GNAT
26822 has always regarded such expressions as illegal.
26824 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
26825 @end itemize
26827 @geindex AI-0095 (Ada 2012 feature)
26830 @itemize *
26832 @item 
26833 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
26835 The prefix of @cite{'Address} cannot statically denote a subprogram with
26836 convention @cite{Intrinsic}. The use of the @cite{Address} attribute raises
26837 @cite{Program_Error} if the prefix denotes a subprogram with convention
26838 @cite{Intrinsic}.
26840 RM References:  13.03 (11/1)
26841 @end itemize
26843 @geindex AI-0116 (Ada 2012 feature)
26846 @itemize *
26848 @item 
26849 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
26851 This AI requires that the alignment of a class-wide object be no greater
26852 than the alignment of any type in the class. GNAT has always followed this
26853 recommendation.
26855 RM References:  13.03 (29)   13.11 (16)
26856 @end itemize
26858 @geindex AI-0146 (Ada 2012 feature)
26861 @itemize *
26863 @item 
26864 @emph{AI-0146 Type invariants (2009-09-21)}
26866 Type invariants may be specified for private types using the aspect notation.
26867 Aspect @cite{Type_Invariant} may be specified for any private type,
26868 @cite{Type_Invariant'Class} can
26869 only be specified for tagged types, and is inherited by any descendent of the
26870 tagged types. The invariant is a boolean expression that is tested for being
26871 true in the following situations: conversions to the private type, object
26872 declarations for the private type that are default initialized, and
26873 [@strong{in}] @strong{out}
26874 parameters and returned result on return from any primitive operation for
26875 the type that is visible to a client.
26876 GNAT defines the synonyms @cite{Invariant} for @cite{Type_Invariant} and
26877 @cite{Invariant'Class} for @cite{Type_Invariant'Class}.
26879 RM References:  13.03.03 (00)
26880 @end itemize
26882 @geindex AI-0078 (Ada 2012 feature)
26885 @itemize *
26887 @item 
26888 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
26890 In Ada 2012, compilers are required to support unchecked conversion where the
26891 target alignment is a multiple of the source alignment. GNAT always supported
26892 this case (and indeed all cases of differing alignments, doing copies where
26893 required if the alignment was reduced).
26895 RM References:  13.09 (7)
26896 @end itemize
26898 @geindex AI-0195 (Ada 2012 feature)
26901 @itemize *
26903 @item 
26904 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
26906 The handling of invalid values is now designated to be implementation
26907 defined. This is a documentation change only, requiring Annex M in the GNAT
26908 Reference Manual to document this handling.
26909 In GNAT, checks for invalid values are made
26910 only when necessary to avoid erroneous behavior. Operations like assignments
26911 which cannot cause erroneous behavior ignore the possibility of invalid
26912 values and do not do a check. The date given above applies only to the
26913 documentation change, this behavior has always been implemented by GNAT.
26915 RM References:  13.09.01 (10)
26916 @end itemize
26918 @geindex AI-0193 (Ada 2012 feature)
26921 @itemize *
26923 @item 
26924 @emph{AI-0193 Alignment of allocators (2010-09-16)}
26926 This AI introduces a new attribute @cite{Max_Alignment_For_Allocation},
26927 analogous to @cite{Max_Size_In_Storage_Elements}, but for alignment instead
26928 of size.
26930 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
26931 13.11.01 (2)   13.11.01 (3)
26932 @end itemize
26934 @geindex AI-0177 (Ada 2012 feature)
26937 @itemize *
26939 @item 
26940 @emph{AI-0177 Parameterized expressions (2010-07-10)}
26942 The new Ada 2012 notion of parameterized expressions is implemented. The form
26945 @example
26946 function-specification is (expression)
26947 @end example
26949 This is exactly equivalent to the
26950 corresponding function body that returns the expression, but it can appear
26951 in a package spec. Note that the expression must be parenthesized.
26953 RM References:  13.11.01 (3/2)
26954 @end itemize
26956 @geindex AI-0033 (Ada 2012 feature)
26959 @itemize *
26961 @item 
26962 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
26964 Neither of these two pragmas may appear within a generic template, because
26965 the generic might be instantiated at other than the library level.
26967 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
26968 @end itemize
26970 @geindex AI-0161 (Ada 2012 feature)
26973 @itemize *
26975 @item 
26976 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
26978 A new restriction @cite{No_Default_Stream_Attributes} prevents the use of any
26979 of the default stream attributes for elementary types. If this restriction is
26980 in force, then it is necessary to provide explicit subprograms for any
26981 stream attributes used.
26983 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
26984 @end itemize
26986 @geindex AI-0194 (Ada 2012 feature)
26989 @itemize *
26991 @item 
26992 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
26994 The @cite{Stream_Size} attribute returns the default number of bits in the
26995 stream representation of the given type.
26996 This value is not affected by the presence
26997 of stream subprogram attributes for the type. GNAT has always implemented
26998 this interpretation.
27000 RM References:  13.13.02 (1.2/2)
27001 @end itemize
27003 @geindex AI-0109 (Ada 2012 feature)
27006 @itemize *
27008 @item 
27009 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
27011 This AI is an editorial change only. It removes the need for a tag check
27012 that can never fail.
27014 RM References:  13.13.02 (34/2)
27015 @end itemize
27017 @geindex AI-0007 (Ada 2012 feature)
27020 @itemize *
27022 @item 
27023 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
27025 The RM as written appeared to limit the possibilities of declaring read
27026 attribute procedures for private scalar types. This limitation was not
27027 intended, and has never been enforced by GNAT.
27029 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
27030 @end itemize
27032 @geindex AI-0065 (Ada 2012 feature)
27035 @itemize *
27037 @item 
27038 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
27040 This AI clarifies the fact that all remote access types support external
27041 streaming. This fixes an obvious oversight in the definition of the
27042 language, and GNAT always implemented the intended correct rules.
27044 RM References:  13.13.02 (52/2)
27045 @end itemize
27047 @geindex AI-0019 (Ada 2012 feature)
27050 @itemize *
27052 @item 
27053 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
27055 The RM suggests that primitive subprograms of a specific tagged type are
27056 frozen when the tagged type is frozen. This would be an incompatible change
27057 and is not intended. GNAT has never attempted this kind of freezing and its
27058 behavior is consistent with the recommendation of this AI.
27060 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)
27061 @end itemize
27063 @geindex AI-0017 (Ada 2012 feature)
27066 @itemize *
27068 @item 
27069 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
27071 So-called 'Taft-amendment types' (i.e., types that are completed in package
27072 bodies) are not frozen by the occurrence of bodies in the
27073 enclosing declarative part. GNAT always implemented this properly.
27075 RM References:  13.14 (3/1)
27076 @end itemize
27078 @geindex AI-0060 (Ada 2012 feature)
27081 @itemize *
27083 @item 
27084 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
27086 This AI extends the definition of remote access types to include access
27087 to limited, synchronized, protected or task class-wide interface types.
27088 GNAT already implemented this extension.
27090 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
27091 @end itemize
27093 @geindex AI-0114 (Ada 2012 feature)
27096 @itemize *
27098 @item 
27099 @emph{AI-0114 Classification of letters (0000-00-00)}
27101 The code points 170 (@cite{FEMININE ORDINAL INDICATOR}),
27102 181 (@cite{MICRO SIGN}), and
27103 186 (@cite{MASCULINE ORDINAL INDICATOR}) are technically considered
27104 lower case letters by Unicode.
27105 However, they are not allowed in identifiers, and they
27106 return @cite{False} to @cite{Ada.Characters.Handling.Is_Letter/Is_Lower}.
27107 This behavior is consistent with that defined in Ada 95.
27109 RM References:  A.03.02 (59)   A.04.06 (7)
27110 @end itemize
27112 @geindex AI-0185 (Ada 2012 feature)
27115 @itemize *
27117 @item 
27118 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
27120 Two new packages @cite{Ada.Wide_[Wide_]Characters.Handling} provide
27121 classification functions for @cite{Wide_Character} and
27122 @cite{Wide_Wide_Character}, as well as providing
27123 case folding routines for @cite{Wide_[Wide_]Character} and
27124 @cite{Wide_[Wide_]String}.
27126 RM References:  A.03.05 (0)   A.03.06 (0)
27127 @end itemize
27129 @geindex AI-0031 (Ada 2012 feature)
27132 @itemize *
27134 @item 
27135 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
27137 A new version of @cite{Find_Token} is added to all relevant string packages,
27138 with an extra parameter @cite{From}. Instead of starting at the first
27139 character of the string, the search for a matching Token starts at the
27140 character indexed by the value of @cite{From}.
27141 These procedures are available in all versions of Ada
27142 but if used in versions earlier than Ada 2012 they will generate a warning
27143 that an Ada 2012 subprogram is being used.
27145 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
27146 A.04.05 (46)
27147 @end itemize
27149 @geindex AI-0056 (Ada 2012 feature)
27152 @itemize *
27154 @item 
27155 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
27157 The wording in the Ada 2005 RM implied an incompatible handling of the
27158 @cite{Index} functions, resulting in raising an exception instead of
27159 returning zero in some situations.
27160 This was not intended and has been corrected.
27161 GNAT always returned zero, and is thus consistent with this AI.
27163 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
27164 @end itemize
27166 @geindex AI-0137 (Ada 2012 feature)
27169 @itemize *
27171 @item 
27172 @emph{AI-0137 String encoding package (2010-03-25)}
27174 The packages @cite{Ada.Strings.UTF_Encoding}, together with its child
27175 packages, @cite{Conversions}, @cite{Strings}, @cite{Wide_Strings},
27176 and @cite{Wide_Wide_Strings} have been
27177 implemented. These packages (whose documentation can be found in the spec
27178 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
27179 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
27180 @cite{String}, @cite{Wide_String}, and @cite{Wide_Wide_String}
27181 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
27182 UTF-16), as well as conversions between the different UTF encodings. With
27183 the exception of @cite{Wide_Wide_Strings}, these packages are available in
27184 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
27185 The @cite{Wide_Wide_Strings package}
27186 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
27187 mode since it uses @cite{Wide_Wide_Character}).
27189 RM References:  A.04.11
27190 @end itemize
27192 @geindex AI-0038 (Ada 2012 feature)
27195 @itemize *
27197 @item 
27198 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
27200 These are minor errors in the description on three points. The intent on
27201 all these points has always been clear, and GNAT has always implemented the
27202 correct intended semantics.
27204 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)
27205 @end itemize
27207 @geindex AI-0044 (Ada 2012 feature)
27210 @itemize *
27212 @item 
27213 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
27215 This AI places restrictions on allowed instantiations of generic containers.
27216 These restrictions are not checked by the compiler, so there is nothing to
27217 change in the implementation. This affects only the RM documentation.
27219 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)
27220 @end itemize
27222 @geindex AI-0127 (Ada 2012 feature)
27225 @itemize *
27227 @item 
27228 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
27230 This package provides an interface for identifying the current locale.
27232 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
27233 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
27234 @end itemize
27236 @geindex AI-0002 (Ada 2012 feature)
27239 @itemize *
27241 @item 
27242 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
27244 The compiler is not required to support exporting an Ada subprogram with
27245 convention C if there are parameters or a return type of an unconstrained
27246 array type (such as @cite{String}). GNAT allows such declarations but
27247 generates warnings. It is possible, but complicated, to write the
27248 corresponding C code and certainly such code would be specific to GNAT and
27249 non-portable.
27251 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
27252 @end itemize
27254 @geindex AI05-0216 (Ada 2012 feature)
27257 @itemize *
27259 @item 
27260 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
27262 It is clearly the intention that @cite{No_Task_Hierarchy} is intended to
27263 forbid tasks declared locally within subprograms, or functions returning task
27264 objects, and that is the implementation that GNAT has always provided.
27265 However the language in the RM was not sufficiently clear on this point.
27266 Thus this is a documentation change in the RM only.
27268 RM References:  D.07 (3/3)
27269 @end itemize
27271 @geindex AI-0211 (Ada 2012 feature)
27274 @itemize *
27276 @item 
27277 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
27279 The restriction @cite{No_Relative_Delays} forbids any calls to the subprogram
27280 @cite{Ada.Real_Time.Timing_Events.Set_Handler}.
27282 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
27283 @end itemize
27285 @geindex AI-0190 (Ada 2012 feature)
27288 @itemize *
27290 @item 
27291 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
27293 This AI introduces a new pragma @cite{Default_Storage_Pool}, which can be
27294 used to control storage pools globally.
27295 In particular, you can force every access
27296 type that is used for allocation (@strong{new}) to have an explicit storage pool,
27297 or you can declare a pool globally to be used for all access types that lack
27298 an explicit one.
27300 RM References:  D.07 (8)
27301 @end itemize
27303 @geindex AI-0189 (Ada 2012 feature)
27306 @itemize *
27308 @item 
27309 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
27311 This AI introduces a new restriction @cite{No_Allocators_After_Elaboration},
27312 which says that no dynamic allocation will occur once elaboration is
27313 completed.
27314 In general this requires a run-time check, which is not required, and which
27315 GNAT does not attempt. But the static cases of allocators in a task body or
27316 in the body of the main program are detected and flagged at compile or bind
27317 time.
27319 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
27320 @end itemize
27322 @geindex AI-0171 (Ada 2012 feature)
27325 @itemize *
27327 @item 
27328 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
27330 A new package @cite{System.Multiprocessors} is added, together with the
27331 definition of pragma @cite{CPU} for controlling task affinity. A new no
27332 dependence restriction, on @cite{System.Multiprocessors.Dispatching_Domains},
27333 is added to the Ravenscar profile.
27335 RM References:  D.13.01 (4/2)   D.16
27336 @end itemize
27338 @geindex AI-0210 (Ada 2012 feature)
27341 @itemize *
27343 @item 
27344 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
27346 This is a documentation only issue regarding wording of metric requirements,
27347 that does not affect the implementation of the compiler.
27349 RM References:  D.15 (24/2)
27350 @end itemize
27352 @geindex AI-0206 (Ada 2012 feature)
27355 @itemize *
27357 @item 
27358 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
27360 Remote types packages are now allowed to depend on preelaborated packages.
27361 This was formerly considered illegal.
27363 RM References:  E.02.02 (6)
27364 @end itemize
27366 @geindex AI-0152 (Ada 2012 feature)
27369 @itemize *
27371 @item 
27372 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
27374 Restriction @cite{No_Anonymous_Allocators} prevents the use of allocators
27375 where the type of the returned value is an anonymous access type.
27377 RM References:  H.04 (8/1)
27378 @end itemize
27380 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
27381 @anchor{gnat_rm/obsolescent_features id1}@anchor{3cb}@anchor{gnat_rm/obsolescent_features doc}@anchor{3cc}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
27382 @chapter Obsolescent Features
27385 This chapter describes features that are provided by GNAT, but are
27386 considered obsolescent since there are preferred ways of achieving
27387 the same effect. These features are provided solely for historical
27388 compatibility purposes.
27390 @menu
27391 * pragma No_Run_Time:: 
27392 * pragma Ravenscar:: 
27393 * pragma Restricted_Run_Time:: 
27394 * pragma Task_Info:: 
27395 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
27397 @end menu
27399 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
27400 @anchor{gnat_rm/obsolescent_features id2}@anchor{3cd}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{3ce}
27401 @section pragma No_Run_Time
27404 The pragma @cite{No_Run_Time} is used to achieve an affect similar
27405 to the use of the "Zero Foot Print" configurable run time, but without
27406 requiring a specially configured run time. The result of using this
27407 pragma, which must be used for all units in a partition, is to restrict
27408 the use of any language features requiring run-time support code. The
27409 preferred usage is to use an appropriately configured run-time that
27410 includes just those features that are to be made accessible.
27412 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
27413 @anchor{gnat_rm/obsolescent_features id3}@anchor{3cf}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{3d0}
27414 @section pragma Ravenscar
27417 The pragma @cite{Ravenscar} has exactly the same effect as pragma
27418 @cite{Profile (Ravenscar)}. The latter usage is preferred since it
27419 is part of the new Ada 2005 standard.
27421 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
27422 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{3d1}@anchor{gnat_rm/obsolescent_features id4}@anchor{3d2}
27423 @section pragma Restricted_Run_Time
27426 The pragma @cite{Restricted_Run_Time} has exactly the same effect as
27427 pragma @cite{Profile (Restricted)}. The latter usage is
27428 preferred since the Ada 2005 pragma @cite{Profile} is intended for
27429 this kind of implementation dependent addition.
27431 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
27432 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{3d3}@anchor{gnat_rm/obsolescent_features id5}@anchor{3d4}
27433 @section pragma Task_Info
27436 The functionality provided by pragma @cite{Task_Info} is now part of the
27437 Ada language. The @cite{CPU} aspect and the package
27438 @cite{System.Multiprocessors} offer a less system-dependent way to specify
27439 task affinity or to query the number of processsors.
27441 Syntax
27443 @example
27444 pragma Task_Info (EXPRESSION);
27445 @end example
27447 This pragma appears within a task definition (like pragma
27448 @cite{Priority}) and applies to the task in which it appears.  The
27449 argument must be of type @cite{System.Task_Info.Task_Info_Type}.
27450 The @cite{Task_Info} pragma provides system dependent control over
27451 aspects of tasking implementation, for example, the ability to map
27452 tasks to specific processors.  For details on the facilities available
27453 for the version of GNAT that you are using, see the documentation
27454 in the spec of package System.Task_Info in the runtime
27455 library.
27457 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
27458 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{3d5}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{3d6}
27459 @section package System.Task_Info (@code{s-tasinf.ads})
27462 This package provides target dependent functionality that is used
27463 to support the @cite{Task_Info} pragma. The predefined Ada package
27464 @cite{System.Multiprocessors} and the @cite{CPU} aspect now provide a
27465 standard replacement for GNAT's @cite{Task_Info} functionality.
27467 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
27468 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{3d7}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{3d8}
27469 @chapter Compatibility and Porting Guide
27472 This chapter presents some guidelines for developing portable Ada code,
27473 describes the compatibility issues that may arise between
27474 GNAT and other Ada compilation systems (including those for Ada 83),
27475 and shows how GNAT can expedite porting
27476 applications developed in other Ada environments.
27478 @menu
27479 * Writing Portable Fixed-Point Declarations:: 
27480 * Compatibility with Ada 83:: 
27481 * Compatibility between Ada 95 and Ada 2005:: 
27482 * Implementation-dependent characteristics:: 
27483 * Compatibility with Other Ada Systems:: 
27484 * Representation Clauses:: 
27485 * Compatibility with HP Ada 83:: 
27487 @end menu
27489 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
27490 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{3d9}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{3da}
27491 @section Writing Portable Fixed-Point Declarations
27494 The Ada Reference Manual gives an implementation freedom to choose bounds
27495 that are narrower by @cite{Small} from the given bounds.
27496 For example, if we write
27498 @example
27499 type F1 is delta 1.0 range -128.0 .. +128.0;
27500 @end example
27502 then the implementation is allowed to choose -128.0 .. +127.0 if it
27503 likes, but is not required to do so.
27505 This leads to possible portability problems, so let's have a closer
27506 look at this, and figure out how to avoid these problems.
27508 First, why does this freedom exist, and why would an implementation
27509 take advantage of it? To answer this, take a closer look at the type
27510 declaration for @cite{F1} above. If the compiler uses the given bounds,
27511 it would need 9 bits to hold the largest positive value (and typically
27512 that means 16 bits on all machines). But if the implementation chooses
27513 the +127.0 bound then it can fit values of the type in 8 bits.
27515 Why not make the user write +127.0 if that's what is wanted?
27516 The rationale is that if you are thinking of fixed point
27517 as a kind of 'poor man's floating-point', then you don't want
27518 to be thinking about the scaled integers that are used in its
27519 representation. Let's take another example:
27521 @example
27522 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
27523 @end example
27525 Looking at this declaration, it seems casually as though
27526 it should fit in 16 bits, but again that extra positive value
27527 +1.0 has the scaled integer equivalent of 2**15 which is one too
27528 big for signed 16 bits. The implementation can treat this as:
27530 @example
27531 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
27532 @end example
27534 and the Ada language design team felt that this was too annoying
27535 to require. We don't need to debate this decision at this point,
27536 since it is well established (the rule about narrowing the ranges
27537 dates to Ada 83).
27539 But the important point is that an implementation is not required
27540 to do this narrowing, so we have a potential portability problem.
27541 We could imagine three types of implementation:
27544 @enumerate a
27546 @item 
27547 those that narrow the range automatically if they can figure
27548 out that the narrower range will allow storage in a smaller machine unit,
27550 @item 
27551 those that will narrow only if forced to by a @cite{'Size} clause, and
27553 @item 
27554 those that will never narrow.
27555 @end enumerate
27557 Now if we are language theoreticians, we can imagine a fourth
27558 approach: to narrow all the time, e.g. to treat
27560 @example
27561 type F3 is delta 1.0 range -10.0 .. +23.0;
27562 @end example
27564 as though it had been written:
27566 @example
27567 type F3 is delta 1.0 range -9.0 .. +22.0;
27568 @end example
27570 But although technically allowed, such a behavior would be hostile and silly,
27571 and no real compiler would do this. All real compilers will fall into one of
27572 the categories (a), (b) or (c) above.
27574 So, how do you get the compiler to do what you want? The answer is give the
27575 actual bounds you want, and then use a @cite{'Small} clause and a
27576 @cite{'Size} clause to absolutely pin down what the compiler does.
27577 E.g., for @cite{F2} above, we will write:
27579 @example
27580 My_Small : constant := 2.0**(-15);
27581 My_First : constant := -1.0;
27582 My_Last  : constant := +1.0 - My_Small;
27584 type F2 is delta My_Small range My_First .. My_Last;
27585 @end example
27587 and then add
27589 @example
27590 for F2'Small use my_Small;
27591 for F2'Size  use 16;
27592 @end example
27594 In practice all compilers will do the same thing here and will give you
27595 what you want, so the above declarations are fully portable. If you really
27596 want to play language lawyer and guard against ludicrous behavior by the
27597 compiler you could add
27599 @example
27600 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
27601 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
27602 @end example
27604 One or other or both are allowed to be illegal if the compiler is
27605 behaving in a silly manner, but at least the silly compiler will not
27606 get away with silently messing with your (very clear) intentions.
27608 If you follow this scheme you will be guaranteed that your fixed-point
27609 types will be portable.
27611 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
27612 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{3db}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{3dc}
27613 @section Compatibility with Ada 83
27616 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
27618 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
27619 are highly upwards compatible with Ada 83.  In
27620 particular, the design intention was that the difficulties associated
27621 with moving from Ada 83 to later versions of the standard should be no greater
27622 than those that occur when moving from one Ada 83 system to another.
27624 However, there are a number of points at which there are minor
27625 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
27626 full details of these issues as they relate to Ada 95,
27627 and should be consulted for a complete treatment.
27628 In practice the
27629 following subsections treat the most likely issues to be encountered.
27631 @menu
27632 * Legal Ada 83 programs that are illegal in Ada 95:: 
27633 * More deterministic semantics:: 
27634 * Changed semantics:: 
27635 * Other language compatibility issues:: 
27637 @end menu
27639 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
27640 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{3dd}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{3de}
27641 @subsection Legal Ada 83 programs that are illegal in Ada 95
27644 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
27645 Ada 95 and later versions of the standard:
27648 @itemize *
27650 @item 
27651 @emph{Character literals}
27653 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
27654 @cite{Wide_Character} as a new predefined character type, some uses of
27655 character literals that were legal in Ada 83 are illegal in Ada 95.
27656 For example:
27658 @example
27659 for Char in 'A' .. 'Z' loop ... end loop;
27660 @end example
27662 The problem is that 'A' and 'Z' could be from either
27663 @cite{Character} or @cite{Wide_Character}.  The simplest correction
27664 is to make the type explicit; e.g.:
27666 @example
27667 for Char in Character range 'A' .. 'Z' loop ... end loop;
27668 @end example
27670 @item 
27671 @emph{New reserved words}
27673 The identifiers @cite{abstract}, @cite{aliased}, @cite{protected},
27674 @cite{requeue}, @cite{tagged}, and @cite{until} are reserved in Ada 95.
27675 Existing Ada 83 code using any of these identifiers must be edited to
27676 use some alternative name.
27678 @item 
27679 @emph{Freezing rules}
27681 The rules in Ada 95 are slightly different with regard to the point at
27682 which entities are frozen, and representation pragmas and clauses are
27683 not permitted past the freeze point.  This shows up most typically in
27684 the form of an error message complaining that a representation item
27685 appears too late, and the appropriate corrective action is to move
27686 the item nearer to the declaration of the entity to which it refers.
27688 A particular case is that representation pragmas
27689 cannot be applied to a subprogram body.  If necessary, a separate subprogram
27690 declaration must be introduced to which the pragma can be applied.
27692 @item 
27693 @emph{Optional bodies for library packages}
27695 In Ada 83, a package that did not require a package body was nevertheless
27696 allowed to have one.  This lead to certain surprises in compiling large
27697 systems (situations in which the body could be unexpectedly ignored by the
27698 binder).  In Ada 95, if a package does not require a body then it is not
27699 permitted to have a body.  To fix this problem, simply remove a redundant
27700 body if it is empty, or, if it is non-empty, introduce a dummy declaration
27701 into the spec that makes the body required.  One approach is to add a private
27702 part to the package declaration (if necessary), and define a parameterless
27703 procedure called @cite{Requires_Body}, which must then be given a dummy
27704 procedure body in the package body, which then becomes required.
27705 Another approach (assuming that this does not introduce elaboration
27706 circularities) is to add an @cite{Elaborate_Body} pragma to the package spec,
27707 since one effect of this pragma is to require the presence of a package body.
27709 @item 
27710 @emph{Numeric_Error is the same exception as Constraint_Error}
27712 In Ada 95, the exception @cite{Numeric_Error} is a renaming of @cite{Constraint_Error}.
27713 This means that it is illegal to have separate exception handlers for
27714 the two exceptions.  The fix is simply to remove the handler for the
27715 @cite{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
27716 @cite{Constraint_Error} in place of @cite{Numeric_Error} in all cases).
27718 @item 
27719 @emph{Indefinite subtypes in generics}
27721 In Ada 83, it was permissible to pass an indefinite type (e.g, @cite{String})
27722 as the actual for a generic formal private type, but then the instantiation
27723 would be illegal if there were any instances of declarations of variables
27724 of this type in the generic body.  In Ada 95, to avoid this clear violation
27725 of the methodological principle known as the 'contract model',
27726 the generic declaration explicitly indicates whether
27727 or not such instantiations are permitted.  If a generic formal parameter
27728 has explicit unknown discriminants, indicated by using @cite{(<>)} after the
27729 subtype name, then it can be instantiated with indefinite types, but no
27730 stand-alone variables can be declared of this type.  Any attempt to declare
27731 such a variable will result in an illegality at the time the generic is
27732 declared.  If the @cite{(<>)} notation is not used, then it is illegal
27733 to instantiate the generic with an indefinite type.
27734 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
27735 It will show up as a compile time error, and
27736 the fix is usually simply to add the @cite{(<>)} to the generic declaration.
27737 @end itemize
27739 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
27740 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{3df}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{3e0}
27741 @subsection More deterministic semantics
27745 @itemize *
27747 @item 
27748 @emph{Conversions}
27750 Conversions from real types to integer types round away from 0.  In Ada 83
27751 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
27752 implementation freedom was intended to support unbiased rounding in
27753 statistical applications, but in practice it interfered with portability.
27754 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
27755 is required.  Numeric code may be affected by this change in semantics.
27756 Note, though, that this issue is no worse than already existed in Ada 83
27757 when porting code from one vendor to another.
27759 @item 
27760 @emph{Tasking}
27762 The Real-Time Annex introduces a set of policies that define the behavior of
27763 features that were implementation dependent in Ada 83, such as the order in
27764 which open select branches are executed.
27765 @end itemize
27767 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
27768 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{3e1}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{3e2}
27769 @subsection Changed semantics
27772 The worst kind of incompatibility is one where a program that is legal in
27773 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
27774 possible in Ada 83.  Fortunately this is extremely rare, but the one
27775 situation that you should be alert to is the change in the predefined type
27776 @cite{Character} from 7-bit ASCII to 8-bit Latin-1.
27778 @quotation
27780 @geindex Latin-1
27781 @end quotation
27784 @itemize *
27786 @item 
27787 @emph{Range of type `Character`}
27789 The range of @cite{Standard.Character} is now the full 256 characters
27790 of Latin-1, whereas in most Ada 83 implementations it was restricted
27791 to 128 characters. Although some of the effects of
27792 this change will be manifest in compile-time rejection of legal
27793 Ada 83 programs it is possible for a working Ada 83 program to have
27794 a different effect in Ada 95, one that was not permitted in Ada 83.
27795 As an example, the expression
27796 @cite{Character'Pos(Character'Last)} returned @cite{127} in Ada 83 and now
27797 delivers @cite{255} as its value.
27798 In general, you should look at the logic of any
27799 character-processing Ada 83 program and see whether it needs to be adapted
27800 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
27801 character handling package that may be relevant if code needs to be adapted
27802 to account for the additional Latin-1 elements.
27803 The desirable fix is to
27804 modify the program to accommodate the full character set, but in some cases
27805 it may be convenient to define a subtype or derived type of Character that
27806 covers only the restricted range.
27807 @end itemize
27809 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
27810 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{3e3}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{3e4}
27811 @subsection Other language compatibility issues
27815 @itemize *
27817 @item 
27818 @emph{-gnat83} switch
27820 All implementations of GNAT provide a switch that causes GNAT to operate
27821 in Ada 83 mode.  In this mode, some but not all compatibility problems
27822 of the type described above are handled automatically.  For example, the
27823 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
27824 as identifiers as in Ada 83.  However,
27825 in practice, it is usually advisable to make the necessary modifications
27826 to the program to remove the need for using this switch.
27827 See the @cite{Compiling Different Versions of Ada} section in
27828 the @cite{GNAT User's Guide}.
27830 @item 
27831 Support for removed Ada 83 pragmas and attributes
27833 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
27834 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
27835 compilers are allowed, but not required, to implement these missing
27836 elements.  In contrast with some other compilers, GNAT implements all
27837 such pragmas and attributes, eliminating this compatibility concern.  These
27838 include @cite{pragma Interface} and the floating point type attributes
27839 (@cite{Emax}, @cite{Mantissa}, etc.), among other items.
27840 @end itemize
27842 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
27843 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{3e5}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{3e6}
27844 @section Compatibility between Ada 95 and Ada 2005
27847 @geindex Compatibility between Ada 95 and Ada 2005
27849 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
27850 a number of incompatibilities. Several are enumerated below;
27851 for a complete description please see the
27852 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
27853 @cite{Rationale for Ada 2005}.
27856 @itemize *
27858 @item 
27859 @emph{New reserved words.}
27861 The words @cite{interface}, @cite{overriding} and @cite{synchronized} are
27862 reserved in Ada 2005.
27863 A pre-Ada 2005 program that uses any of these as an identifier will be
27864 illegal.
27866 @item 
27867 @emph{New declarations in predefined packages.}
27869 A number of packages in the predefined environment contain new declarations:
27870 @cite{Ada.Exceptions}, @cite{Ada.Real_Time}, @cite{Ada.Strings},
27871 @cite{Ada.Strings.Fixed}, @cite{Ada.Strings.Bounded},
27872 @cite{Ada.Strings.Unbounded}, @cite{Ada.Strings.Wide_Fixed},
27873 @cite{Ada.Strings.Wide_Bounded}, @cite{Ada.Strings.Wide_Unbounded},
27874 @cite{Ada.Tags}, @cite{Ada.Text_IO}, and @cite{Interfaces.C}.
27875 If an Ada 95 program does a @cite{with} and @cite{use} of any of these
27876 packages, the new declarations may cause name clashes.
27878 @item 
27879 @emph{Access parameters.}
27881 A nondispatching subprogram with an access parameter cannot be renamed
27882 as a dispatching operation.  This was permitted in Ada 95.
27884 @item 
27885 @emph{Access types, discriminants, and constraints.}
27887 Rule changes in this area have led to some incompatibilities; for example,
27888 constrained subtypes of some access types are not permitted in Ada 2005.
27890 @item 
27891 @emph{Aggregates for limited types.}
27893 The allowance of aggregates for limited types in Ada 2005 raises the
27894 possibility of ambiguities in legal Ada 95 programs, since additional types
27895 now need to be considered in expression resolution.
27897 @item 
27898 @emph{Fixed-point multiplication and division.}
27900 Certain expressions involving '*' or '/' for a fixed-point type, which
27901 were legal in Ada 95 and invoked the predefined versions of these operations,
27902 are now ambiguous.
27903 The ambiguity may be resolved either by applying a type conversion to the
27904 expression, or by explicitly invoking the operation from package
27905 @cite{Standard}.
27907 @item 
27908 @emph{Return-by-reference types.}
27910 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
27911 can declare a function returning a value from an anonymous access type.
27912 @end itemize
27914 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
27915 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{3e7}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{3e8}
27916 @section Implementation-dependent characteristics
27919 Although the Ada language defines the semantics of each construct as
27920 precisely as practical, in some situations (for example for reasons of
27921 efficiency, or where the effect is heavily dependent on the host or target
27922 platform) the implementation is allowed some freedom.  In porting Ada 83
27923 code to GNAT, you need to be aware of whether / how the existing code
27924 exercised such implementation dependencies.  Such characteristics fall into
27925 several categories, and GNAT offers specific support in assisting the
27926 transition from certain Ada 83 compilers.
27928 @menu
27929 * Implementation-defined pragmas:: 
27930 * Implementation-defined attributes:: 
27931 * Libraries:: 
27932 * Elaboration order:: 
27933 * Target-specific aspects:: 
27935 @end menu
27937 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
27938 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{3e9}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{3ea}
27939 @subsection Implementation-defined pragmas
27942 Ada compilers are allowed to supplement the language-defined pragmas, and
27943 these are a potential source of non-portability.  All GNAT-defined pragmas
27944 are described in the @cite{Implementation Defined Pragmas} chapter of the
27945 @cite{GNAT Reference Manual}, and these include several that are specifically
27946 intended to correspond to other vendors' Ada 83 pragmas.
27947 For migrating from VADS, the pragma @cite{Use_VADS_Size} may be useful.
27948 For compatibility with HP Ada 83, GNAT supplies the pragmas
27949 @cite{Extend_System}, @cite{Ident}, @cite{Inline_Generic},
27950 @cite{Interface_Name}, @cite{Passive}, @cite{Suppress_All},
27951 and @cite{Volatile}.
27952 Other relevant pragmas include @cite{External} and @cite{Link_With}.
27953 Some vendor-specific
27954 Ada 83 pragmas (@cite{Share_Generic}, @cite{Subtitle}, and @cite{Title}) are
27955 recognized, thus
27956 avoiding compiler rejection of units that contain such pragmas; they are not
27957 relevant in a GNAT context and hence are not otherwise implemented.
27959 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
27960 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{3eb}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{3ec}
27961 @subsection Implementation-defined attributes
27964 Analogous to pragmas, the set of attributes may be extended by an
27965 implementation.  All GNAT-defined attributes are described in
27966 @cite{Implementation Defined Attributes} section of the
27967 @cite{GNAT Reference Manual}, and these include several that are specifically intended
27968 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
27969 the attribute @cite{VADS_Size} may be useful.  For compatibility with HP
27970 Ada 83, GNAT supplies the attributes @cite{Bit}, @cite{Machine_Size} and
27971 @cite{Type_Class}.
27973 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
27974 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{3ed}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{3ee}
27975 @subsection Libraries
27978 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
27979 code uses vendor-specific libraries then there are several ways to manage
27980 this in Ada 95 and later versions of the standard:
27983 @itemize *
27985 @item 
27986 If the source code for the libraries (specs and bodies) are
27987 available, then the libraries can be migrated in the same way as the
27988 application.
27990 @item 
27991 If the source code for the specs but not the bodies are
27992 available, then you can reimplement the bodies.
27994 @item 
27995 Some features introduced by Ada 95 obviate the need for library support.  For
27996 example most Ada 83 vendors supplied a package for unsigned integers.  The
27997 Ada 95 modular type feature is the preferred way to handle this need, so
27998 instead of migrating or reimplementing the unsigned integer package it may
27999 be preferable to retrofit the application using modular types.
28000 @end itemize
28002 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
28003 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{3ef}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{3f0}
28004 @subsection Elaboration order
28007 The implementation can choose any elaboration order consistent with the unit
28008 dependency relationship.  This freedom means that some orders can result in
28009 Program_Error being raised due to an 'Access Before Elaboration': an attempt
28010 to invoke a subprogram its body has been elaborated, or to instantiate a
28011 generic before the generic body has been elaborated.  By default GNAT
28012 attempts to choose a safe order (one that will not encounter access before
28013 elaboration problems) by implicitly inserting @cite{Elaborate} or
28014 @cite{Elaborate_All} pragmas where
28015 needed.  However, this can lead to the creation of elaboration circularities
28016 and a resulting rejection of the program by gnatbind.  This issue is
28017 thoroughly described in the @cite{Elaboration Order Handling in GNAT} appendix
28018 in the @cite{GNAT User's Guide}.
28019 In brief, there are several
28020 ways to deal with this situation:
28023 @itemize *
28025 @item 
28026 Modify the program to eliminate the circularities, e.g., by moving
28027 elaboration-time code into explicitly-invoked procedures
28029 @item 
28030 Constrain the elaboration order by including explicit @cite{Elaborate_Body} or
28031 @cite{Elaborate} pragmas, and then inhibit the generation of implicit
28032 @cite{Elaborate_All}
28033 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
28034 (by selectively suppressing elaboration checks via pragma
28035 @cite{Suppress(Elaboration_Check)} when it is safe to do so).
28036 @end itemize
28038 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
28039 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{3f1}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{3f2}
28040 @subsection Target-specific aspects
28043 Low-level applications need to deal with machine addresses, data
28044 representations, interfacing with assembler code, and similar issues.  If
28045 such an Ada 83 application is being ported to different target hardware (for
28046 example where the byte endianness has changed) then you will need to
28047 carefully examine the program logic; the porting effort will heavily depend
28048 on the robustness of the original design.  Moreover, Ada 95 (and thus
28049 Ada 2005 and Ada 2012) are sometimes
28050 incompatible with typical Ada 83 compiler practices regarding implicit
28051 packing, the meaning of the Size attribute, and the size of access values.
28052 GNAT's approach to these issues is described in @ref{3f3,,Representation Clauses}.
28054 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
28055 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{3f4}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{3f5}
28056 @section Compatibility with Other Ada Systems
28059 If programs avoid the use of implementation dependent and
28060 implementation defined features, as documented in the
28061 @cite{Ada Reference Manual}, there should be a high degree of portability between
28062 GNAT and other Ada systems.  The following are specific items which
28063 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
28064 compilers, but do not affect porting code to GNAT.
28065 (As of January 2007, GNAT is the only compiler available for Ada 2005;
28066 the following issues may or may not arise for Ada 2005 programs
28067 when other compilers appear.)
28070 @itemize *
28072 @item 
28073 @emph{Ada 83 Pragmas and Attributes}
28075 Ada 95 compilers are allowed, but not required, to implement the missing
28076 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
28077 GNAT implements all such pragmas and attributes, eliminating this as
28078 a compatibility concern, but some other Ada 95 compilers reject these
28079 pragmas and attributes.
28081 @item 
28082 @emph{Specialized Needs Annexes}
28084 GNAT implements the full set of special needs annexes.  At the
28085 current time, it is the only Ada 95 compiler to do so.  This means that
28086 programs making use of these features may not be portable to other Ada
28087 95 compilation systems.
28089 @item 
28090 @emph{Representation Clauses}
28092 Some other Ada 95 compilers implement only the minimal set of
28093 representation clauses required by the Ada 95 reference manual.  GNAT goes
28094 far beyond this minimal set, as described in the next section.
28095 @end itemize
28097 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
28098 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{3f3}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{3f6}
28099 @section Representation Clauses
28102 The Ada 83 reference manual was quite vague in describing both the minimal
28103 required implementation of representation clauses, and also their precise
28104 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
28105 minimal set of capabilities required is still quite limited.
28107 GNAT implements the full required set of capabilities in
28108 Ada 95 and Ada 2005, but also goes much further, and in particular
28109 an effort has been made to be compatible with existing Ada 83 usage to the
28110 greatest extent possible.
28112 A few cases exist in which Ada 83 compiler behavior is incompatible with
28113 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
28114 intentional or accidental dependence on specific implementation dependent
28115 characteristics of these Ada 83 compilers.  The following is a list of
28116 the cases most likely to arise in existing Ada 83 code.
28119 @itemize *
28121 @item 
28122 @emph{Implicit Packing}
28124 Some Ada 83 compilers allowed a Size specification to cause implicit
28125 packing of an array or record.  This could cause expensive implicit
28126 conversions for change of representation in the presence of derived
28127 types, and the Ada design intends to avoid this possibility.
28128 Subsequent AI's were issued to make it clear that such implicit
28129 change of representation in response to a Size clause is inadvisable,
28130 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
28131 Reference Manuals as implementation advice that is followed by GNAT.
28132 The problem will show up as an error
28133 message rejecting the size clause.  The fix is simply to provide
28134 the explicit pragma @cite{Pack}, or for more fine tuned control, provide
28135 a Component_Size clause.
28137 @item 
28138 @emph{Meaning of Size Attribute}
28140 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
28141 the minimal number of bits required to hold values of the type.  For example,
28142 on a 32-bit machine, the size of @cite{Natural} will typically be 31 and not
28143 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
28144 some 32 in this situation.  This problem will usually show up as a compile
28145 time error, but not always.  It is a good idea to check all uses of the
28146 'Size attribute when porting Ada 83 code.  The GNAT specific attribute
28147 Object_Size can provide a useful way of duplicating the behavior of
28148 some Ada 83 compiler systems.
28150 @item 
28151 @emph{Size of Access Types}
28153 A common assumption in Ada 83 code is that an access type is in fact a pointer,
28154 and that therefore it will be the same size as a System.Address value.  This
28155 assumption is true for GNAT in most cases with one exception.  For the case of
28156 a pointer to an unconstrained array type (where the bounds may vary from one
28157 value of the access type to another), the default is to use a 'fat pointer',
28158 which is represented as two separate pointers, one to the bounds, and one to
28159 the array.  This representation has a number of advantages, including improved
28160 efficiency.  However, it may cause some difficulties in porting existing Ada 83
28161 code which makes the assumption that, for example, pointers fit in 32 bits on
28162 a machine with 32-bit addressing.
28164 To get around this problem, GNAT also permits the use of 'thin pointers' for
28165 access types in this case (where the designated type is an unconstrained array
28166 type).  These thin pointers are indeed the same size as a System.Address value.
28167 To specify a thin pointer, use a size clause for the type, for example:
28169 @example
28170 type X is access all String;
28171 for X'Size use Standard'Address_Size;
28172 @end example
28174 which will cause the type X to be represented using a single pointer.
28175 When using this representation, the bounds are right behind the array.
28176 This representation is slightly less efficient, and does not allow quite
28177 such flexibility in the use of foreign pointers or in using the
28178 Unrestricted_Access attribute to create pointers to non-aliased objects.
28179 But for any standard portable use of the access type it will work in
28180 a functionally correct manner and allow porting of existing code.
28181 Note that another way of forcing a thin pointer representation
28182 is to use a component size clause for the element size in an array,
28183 or a record representation clause for an access field in a record.
28185 See the documentation of Unrestricted_Access in the GNAT RM for a
28186 full discussion of possible problems using this attribute in conjunction
28187 with thin pointers.
28188 @end itemize
28190 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
28191 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{3f7}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{3f8}
28192 @section Compatibility with HP Ada 83
28195 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
28196 of them can sensibly be implemented.  The description of pragmas in
28197 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
28198 applicable to GNAT.
28201 @itemize *
28203 @item 
28204 @emph{Default floating-point representation}
28206 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
28207 it is VMS format.
28209 @item 
28210 @emph{System}
28212 the package System in GNAT exactly corresponds to the definition in the
28213 Ada 95 reference manual, which means that it excludes many of the
28214 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
28215 that contains the additional definitions, and a special pragma,
28216 Extend_System allows this package to be treated transparently as an
28217 extension of package System.
28218 @end itemize
28220 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
28221 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{3f9}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{3fa}
28222 @chapter GNU Free Documentation License
28225 Version 1.3, 3 November 2008
28227 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
28228 @indicateurl{http://fsf.org/}
28230 Everyone is permitted to copy and distribute verbatim copies of this
28231 license document, but changing it is not allowed.
28233 @strong{Preamble}
28235 The purpose of this License is to make a manual, textbook, or other
28236 functional and useful document "free" in the sense of freedom: to
28237 assure everyone the effective freedom to copy and redistribute it,
28238 with or without modifying it, either commercially or noncommercially.
28239 Secondarily, this License preserves for the author and publisher a way
28240 to get credit for their work, while not being considered responsible
28241 for modifications made by others.
28243 This License is a kind of "copyleft", which means that derivative
28244 works of the document must themselves be free in the same sense.  It
28245 complements the GNU General Public License, which is a copyleft
28246 license designed for free software.
28248 We have designed this License in order to use it for manuals for free
28249 software, because free software needs free documentation: a free
28250 program should come with manuals providing the same freedoms that the
28251 software does.  But this License is not limited to software manuals;
28252 it can be used for any textual work, regardless of subject matter or
28253 whether it is published as a printed book.  We recommend this License
28254 principally for works whose purpose is instruction or reference.
28256 @strong{1. APPLICABILITY AND DEFINITIONS}
28258 This License applies to any manual or other work, in any medium, that
28259 contains a notice placed by the copyright holder saying it can be
28260 distributed under the terms of this License.  Such a notice grants a
28261 world-wide, royalty-free license, unlimited in duration, to use that
28262 work under the conditions stated herein.  The @strong{Document}, below,
28263 refers to any such manual or work.  Any member of the public is a
28264 licensee, and is addressed as "@strong{you}".  You accept the license if you
28265 copy, modify or distribute the work in a way requiring permission
28266 under copyright law.
28268 A "@strong{Modified Version}" of the Document means any work containing the
28269 Document or a portion of it, either copied verbatim, or with
28270 modifications and/or translated into another language.
28272 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
28273 the Document that deals exclusively with the relationship of the
28274 publishers or authors of the Document to the Document's overall subject
28275 (or to related matters) and contains nothing that could fall directly
28276 within that overall subject.  (Thus, if the Document is in part a
28277 textbook of mathematics, a Secondary Section may not explain any
28278 mathematics.)  The relationship could be a matter of historical
28279 connection with the subject or with related matters, or of legal,
28280 commercial, philosophical, ethical or political position regarding
28281 them.
28283 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
28284 are designated, as being those of Invariant Sections, in the notice
28285 that says that the Document is released under this License.  If a
28286 section does not fit the above definition of Secondary then it is not
28287 allowed to be designated as Invariant.  The Document may contain zero
28288 Invariant Sections.  If the Document does not identify any Invariant
28289 Sections then there are none.
28291 The "@strong{Cover Texts}" are certain short passages of text that are listed,
28292 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
28293 the Document is released under this License.  A Front-Cover Text may
28294 be at most 5 words, and a Back-Cover Text may be at most 25 words.
28296 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
28297 represented in a format whose specification is available to the
28298 general public, that is suitable for revising the document
28299 straightforwardly with generic text editors or (for images composed of
28300 pixels) generic paint programs or (for drawings) some widely available
28301 drawing editor, and that is suitable for input to text formatters or
28302 for automatic translation to a variety of formats suitable for input
28303 to text formatters.  A copy made in an otherwise Transparent file
28304 format whose markup, or absence of markup, has been arranged to thwart
28305 or discourage subsequent modification by readers is not Transparent.
28306 An image format is not Transparent if used for any substantial amount
28307 of text.  A copy that is not "Transparent" is called @strong{Opaque}.
28309 Examples of suitable formats for Transparent copies include plain
28310 ASCII without markup, Texinfo input format, LaTeX input format, SGML
28311 or XML using a publicly available DTD, and standard-conforming simple
28312 HTML, PostScript or PDF designed for human modification.  Examples of
28313 transparent image formats include PNG, XCF and JPG.  Opaque formats
28314 include proprietary formats that can be read and edited only by
28315 proprietary word processors, SGML or XML for which the DTD and/or
28316 processing tools are not generally available, and the
28317 machine-generated HTML, PostScript or PDF produced by some word
28318 processors for output purposes only.
28320 The "@strong{Title Page}" means, for a printed book, the title page itself,
28321 plus such following pages as are needed to hold, legibly, the material
28322 this License requires to appear in the title page.  For works in
28323 formats which do not have any title page as such, "Title Page" means
28324 the text near the most prominent appearance of the work's title,
28325 preceding the beginning of the body of the text.
28327 The "@strong{publisher}" means any person or entity that distributes
28328 copies of the Document to the public.
28330 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
28331 title either is precisely XYZ or contains XYZ in parentheses following
28332 text that translates XYZ in another language.  (Here XYZ stands for a
28333 specific section name mentioned below, such as "@strong{Acknowledgements}",
28334 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
28335 To "@strong{Preserve the Title}"
28336 of such a section when you modify the Document means that it remains a
28337 section "Entitled XYZ" according to this definition.
28339 The Document may include Warranty Disclaimers next to the notice which
28340 states that this License applies to the Document.  These Warranty
28341 Disclaimers are considered to be included by reference in this
28342 License, but only as regards disclaiming warranties: any other
28343 implication that these Warranty Disclaimers may have is void and has
28344 no effect on the meaning of this License.
28346 @strong{2. VERBATIM COPYING}
28348 You may copy and distribute the Document in any medium, either
28349 commercially or noncommercially, provided that this License, the
28350 copyright notices, and the license notice saying this License applies
28351 to the Document are reproduced in all copies, and that you add no other
28352 conditions whatsoever to those of this License.  You may not use
28353 technical measures to obstruct or control the reading or further
28354 copying of the copies you make or distribute.  However, you may accept
28355 compensation in exchange for copies.  If you distribute a large enough
28356 number of copies you must also follow the conditions in section 3.
28358 You may also lend copies, under the same conditions stated above, and
28359 you may publicly display copies.
28361 @strong{3. COPYING IN QUANTITY}
28363 If you publish printed copies (or copies in media that commonly have
28364 printed covers) of the Document, numbering more than 100, and the
28365 Document's license notice requires Cover Texts, you must enclose the
28366 copies in covers that carry, clearly and legibly, all these Cover
28367 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
28368 the back cover.  Both covers must also clearly and legibly identify
28369 you as the publisher of these copies.  The front cover must present
28370 the full title with all words of the title equally prominent and
28371 visible.  You may add other material on the covers in addition.
28372 Copying with changes limited to the covers, as long as they preserve
28373 the title of the Document and satisfy these conditions, can be treated
28374 as verbatim copying in other respects.
28376 If the required texts for either cover are too voluminous to fit
28377 legibly, you should put the first ones listed (as many as fit
28378 reasonably) on the actual cover, and continue the rest onto adjacent
28379 pages.
28381 If you publish or distribute Opaque copies of the Document numbering
28382 more than 100, you must either include a machine-readable Transparent
28383 copy along with each Opaque copy, or state in or with each Opaque copy
28384 a computer-network location from which the general network-using
28385 public has access to download using public-standard network protocols
28386 a complete Transparent copy of the Document, free of added material.
28387 If you use the latter option, you must take reasonably prudent steps,
28388 when you begin distribution of Opaque copies in quantity, to ensure
28389 that this Transparent copy will remain thus accessible at the stated
28390 location until at least one year after the last time you distribute an
28391 Opaque copy (directly or through your agents or retailers) of that
28392 edition to the public.
28394 It is requested, but not required, that you contact the authors of the
28395 Document well before redistributing any large number of copies, to give
28396 them a chance to provide you with an updated version of the Document.
28398 @strong{4. MODIFICATIONS}
28400 You may copy and distribute a Modified Version of the Document under
28401 the conditions of sections 2 and 3 above, provided that you release
28402 the Modified Version under precisely this License, with the Modified
28403 Version filling the role of the Document, thus licensing distribution
28404 and modification of the Modified Version to whoever possesses a copy
28405 of it.  In addition, you must do these things in the Modified Version:
28408 @enumerate A
28410 @item 
28411 Use in the Title Page (and on the covers, if any) a title distinct
28412 from that of the Document, and from those of previous versions
28413 (which should, if there were any, be listed in the History section
28414 of the Document).  You may use the same title as a previous version
28415 if the original publisher of that version gives permission.
28417 @item 
28418 List on the Title Page, as authors, one or more persons or entities
28419 responsible for authorship of the modifications in the Modified
28420 Version, together with at least five of the principal authors of the
28421 Document (all of its principal authors, if it has fewer than five),
28422 unless they release you from this requirement.
28424 @item 
28425 State on the Title page the name of the publisher of the
28426 Modified Version, as the publisher.
28428 @item 
28429 Preserve all the copyright notices of the Document.
28431 @item 
28432 Add an appropriate copyright notice for your modifications
28433 adjacent to the other copyright notices.
28435 @item 
28436 Include, immediately after the copyright notices, a license notice
28437 giving the public permission to use the Modified Version under the
28438 terms of this License, in the form shown in the Addendum below.
28440 @item 
28441 Preserve in that license notice the full lists of Invariant Sections
28442 and required Cover Texts given in the Document's license notice.
28444 @item 
28445 Include an unaltered copy of this License.
28447 @item 
28448 Preserve the section Entitled "History", Preserve its Title, and add
28449 to it an item stating at least the title, year, new authors, and
28450 publisher of the Modified Version as given on the Title Page.  If
28451 there is no section Entitled "History" in the Document, create one
28452 stating the title, year, authors, and publisher of the Document as
28453 given on its Title Page, then add an item describing the Modified
28454 Version as stated in the previous sentence.
28456 @item 
28457 Preserve the network location, if any, given in the Document for
28458 public access to a Transparent copy of the Document, and likewise
28459 the network locations given in the Document for previous versions
28460 it was based on.  These may be placed in the "History" section.
28461 You may omit a network location for a work that was published at
28462 least four years before the Document itself, or if the original
28463 publisher of the version it refers to gives permission.
28465 @item 
28466 For any section Entitled "Acknowledgements" or "Dedications",
28467 Preserve the Title of the section, and preserve in the section all
28468 the substance and tone of each of the contributor acknowledgements
28469 and/or dedications given therein.
28471 @item 
28472 Preserve all the Invariant Sections of the Document,
28473 unaltered in their text and in their titles.  Section numbers
28474 or the equivalent are not considered part of the section titles.
28476 @item 
28477 Delete any section Entitled "Endorsements".  Such a section
28478 may not be included in the Modified Version.
28480 @item 
28481 Do not retitle any existing section to be Entitled "Endorsements"
28482 or to conflict in title with any Invariant Section.
28484 @item 
28485 Preserve any Warranty Disclaimers.
28486 @end enumerate
28488 If the Modified Version includes new front-matter sections or
28489 appendices that qualify as Secondary Sections and contain no material
28490 copied from the Document, you may at your option designate some or all
28491 of these sections as invariant.  To do this, add their titles to the
28492 list of Invariant Sections in the Modified Version's license notice.
28493 These titles must be distinct from any other section titles.
28495 You may add a section Entitled "Endorsements", provided it contains
28496 nothing but endorsements of your Modified Version by various
28497 parties---for example, statements of peer review or that the text has
28498 been approved by an organization as the authoritative definition of a
28499 standard.
28501 You may add a passage of up to five words as a Front-Cover Text, and a
28502 passage of up to 25 words as a Back-Cover Text, to the end of the list
28503 of Cover Texts in the Modified Version.  Only one passage of
28504 Front-Cover Text and one of Back-Cover Text may be added by (or
28505 through arrangements made by) any one entity.  If the Document already
28506 includes a cover text for the same cover, previously added by you or
28507 by arrangement made by the same entity you are acting on behalf of,
28508 you may not add another; but you may replace the old one, on explicit
28509 permission from the previous publisher that added the old one.
28511 The author(s) and publisher(s) of the Document do not by this License
28512 give permission to use their names for publicity for or to assert or
28513 imply endorsement of any Modified Version.
28515 @strong{5. COMBINING DOCUMENTS}
28517 You may combine the Document with other documents released under this
28518 License, under the terms defined in section 4 above for modified
28519 versions, provided that you include in the combination all of the
28520 Invariant Sections of all of the original documents, unmodified, and
28521 list them all as Invariant Sections of your combined work in its
28522 license notice, and that you preserve all their Warranty Disclaimers.
28524 The combined work need only contain one copy of this License, and
28525 multiple identical Invariant Sections may be replaced with a single
28526 copy.  If there are multiple Invariant Sections with the same name but
28527 different contents, make the title of each such section unique by
28528 adding at the end of it, in parentheses, the name of the original
28529 author or publisher of that section if known, or else a unique number.
28530 Make the same adjustment to the section titles in the list of
28531 Invariant Sections in the license notice of the combined work.
28533 In the combination, you must combine any sections Entitled "History"
28534 in the various original documents, forming one section Entitled
28535 "History"; likewise combine any sections Entitled "Acknowledgements",
28536 and any sections Entitled "Dedications".  You must delete all sections
28537 Entitled "Endorsements".
28539 @strong{6. COLLECTIONS OF DOCUMENTS}
28541 You may make a collection consisting of the Document and other documents
28542 released under this License, and replace the individual copies of this
28543 License in the various documents with a single copy that is included in
28544 the collection, provided that you follow the rules of this License for
28545 verbatim copying of each of the documents in all other respects.
28547 You may extract a single document from such a collection, and distribute
28548 it individually under this License, provided you insert a copy of this
28549 License into the extracted document, and follow this License in all
28550 other respects regarding verbatim copying of that document.
28552 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
28554 A compilation of the Document or its derivatives with other separate
28555 and independent documents or works, in or on a volume of a storage or
28556 distribution medium, is called an "aggregate" if the copyright
28557 resulting from the compilation is not used to limit the legal rights
28558 of the compilation's users beyond what the individual works permit.
28559 When the Document is included in an aggregate, this License does not
28560 apply to the other works in the aggregate which are not themselves
28561 derivative works of the Document.
28563 If the Cover Text requirement of section 3 is applicable to these
28564 copies of the Document, then if the Document is less than one half of
28565 the entire aggregate, the Document's Cover Texts may be placed on
28566 covers that bracket the Document within the aggregate, or the
28567 electronic equivalent of covers if the Document is in electronic form.
28568 Otherwise they must appear on printed covers that bracket the whole
28569 aggregate.
28571 @strong{8. TRANSLATION}
28573 Translation is considered a kind of modification, so you may
28574 distribute translations of the Document under the terms of section 4.
28575 Replacing Invariant Sections with translations requires special
28576 permission from their copyright holders, but you may include
28577 translations of some or all Invariant Sections in addition to the
28578 original versions of these Invariant Sections.  You may include a
28579 translation of this License, and all the license notices in the
28580 Document, and any Warranty Disclaimers, provided that you also include
28581 the original English version of this License and the original versions
28582 of those notices and disclaimers.  In case of a disagreement between
28583 the translation and the original version of this License or a notice
28584 or disclaimer, the original version will prevail.
28586 If a section in the Document is Entitled "Acknowledgements",
28587 "Dedications", or "History", the requirement (section 4) to Preserve
28588 its Title (section 1) will typically require changing the actual
28589 title.
28591 @strong{9. TERMINATION}
28593 You may not copy, modify, sublicense, or distribute the Document
28594 except as expressly provided under this License.  Any attempt
28595 otherwise to copy, modify, sublicense, or distribute it is void, and
28596 will automatically terminate your rights under this License.
28598 However, if you cease all violation of this License, then your license
28599 from a particular copyright holder is reinstated (a) provisionally,
28600 unless and until the copyright holder explicitly and finally
28601 terminates your license, and (b) permanently, if the copyright holder
28602 fails to notify you of the violation by some reasonable means prior to
28603 60 days after the cessation.
28605 Moreover, your license from a particular copyright holder is
28606 reinstated permanently if the copyright holder notifies you of the
28607 violation by some reasonable means, this is the first time you have
28608 received notice of violation of this License (for any work) from that
28609 copyright holder, and you cure the violation prior to 30 days after
28610 your receipt of the notice.
28612 Termination of your rights under this section does not terminate the
28613 licenses of parties who have received copies or rights from you under
28614 this License.  If your rights have been terminated and not permanently
28615 reinstated, receipt of a copy of some or all of the same material does
28616 not give you any rights to use it.
28618 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
28620 The Free Software Foundation may publish new, revised versions
28621 of the GNU Free Documentation License from time to time.  Such new
28622 versions will be similar in spirit to the present version, but may
28623 differ in detail to address new problems or concerns.  See
28624 @indicateurl{http://www.gnu.org/copyleft/}.
28626 Each version of the License is given a distinguishing version number.
28627 If the Document specifies that a particular numbered version of this
28628 License "or any later version" applies to it, you have the option of
28629 following the terms and conditions either of that specified version or
28630 of any later version that has been published (not as a draft) by the
28631 Free Software Foundation.  If the Document does not specify a version
28632 number of this License, you may choose any version ever published (not
28633 as a draft) by the Free Software Foundation.  If the Document
28634 specifies that a proxy can decide which future versions of this
28635 License can be used, that proxy's public statement of acceptance of a
28636 version permanently authorizes you to choose that version for the
28637 Document.
28639 @strong{11. RELICENSING}
28641 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
28642 World Wide Web server that publishes copyrightable works and also
28643 provides prominent facilities for anybody to edit those works.  A
28644 public wiki that anybody can edit is an example of such a server.  A
28645 "Massive Multiauthor Collaboration" (or "MMC") contained in the
28646 site means any set of copyrightable works thus published on the MMC
28647 site.
28649 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
28650 license published by Creative Commons Corporation, a not-for-profit
28651 corporation with a principal place of business in San Francisco,
28652 California, as well as future copyleft versions of that license
28653 published by that same organization.
28655 "Incorporate" means to publish or republish a Document, in whole or
28656 in part, as part of another Document.
28658 An MMC is "eligible for relicensing" if it is licensed under this
28659 License, and if all works that were first published under this License
28660 somewhere other than this MMC, and subsequently incorporated in whole
28661 or in part into the MMC, (1) had no cover texts or invariant sections,
28662 and (2) were thus incorporated prior to November 1, 2008.
28664 The operator of an MMC Site may republish an MMC contained in the site
28665 under CC-BY-SA on the same site at any time before August 1, 2009,
28666 provided the MMC is eligible for relicensing.
28668 @strong{ADDENDUM: How to use this License for your documents}
28670 To use this License in a document you have written, include a copy of
28671 the License in the document and put the following copyright and
28672 license notices just after the title page:
28674 @quotation
28676 Copyright © YEAR  YOUR NAME.
28677 Permission is granted to copy, distribute and/or modify this document
28678 under the terms of the GNU Free Documentation License, Version 1.3
28679 or any later version published by the Free Software Foundation;
28680 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
28681 A copy of the license is included in the section entitled "GNU
28682 Free Documentation License".
28683 @end quotation
28685 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
28686 replace the "with ... Texts." line with this:
28688 @quotation
28690 with the Invariant Sections being LIST THEIR TITLES, with the
28691 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
28692 @end quotation
28694 If you have Invariant Sections without Cover Texts, or some other
28695 combination of the three, merge those two alternatives to suit the
28696 situation.
28698 If your document contains nontrivial examples of program code, we
28699 recommend releasing these examples in parallel under your choice of
28700 free software license, such as the GNU General Public License,
28701 to permit their use in free software.
28703 @node Index,,GNU Free Documentation License,Top
28704 @unnumbered Index
28707 @printindex ge
28710 @c %**end of body
28711 @bye