Fix ChangeLog entry for r240730
[official-gcc.git] / gcc / ada / gnat_rm.texi
blob9e95db9351c1618910e8884c637e383f57cb12c4
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 , July 04, 2016
26 AdaCore
28 Copyright @copyright{} 2008-2016, 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 Comment:: 
122 * Pragma Common_Object:: 
123 * Pragma Compile_Time_Error:: 
124 * Pragma Compile_Time_Warning:: 
125 * Pragma Compiler_Unit:: 
126 * Pragma Compiler_Unit_Warning:: 
127 * Pragma Complete_Representation:: 
128 * Pragma Complex_Representation:: 
129 * Pragma Component_Alignment:: 
130 * Pragma Constant_After_Elaboration:: 
131 * Pragma Contract_Cases:: 
132 * Pragma Convention_Identifier:: 
133 * Pragma CPP_Class:: 
134 * Pragma CPP_Constructor:: 
135 * Pragma CPP_Virtual:: 
136 * Pragma CPP_Vtable:: 
137 * Pragma CPU:: 
138 * Pragma Default_Initial_Condition:: 
139 * Pragma Debug:: 
140 * Pragma Debug_Policy:: 
141 * Pragma Default_Scalar_Storage_Order:: 
142 * Pragma Default_Storage_Pool:: 
143 * Pragma Depends:: 
144 * Pragma Detect_Blocking:: 
145 * Pragma Disable_Atomic_Synchronization:: 
146 * Pragma Dispatching_Domain:: 
147 * Pragma Effective_Reads:: 
148 * Pragma Effective_Writes:: 
149 * Pragma Elaboration_Checks:: 
150 * Pragma Eliminate:: 
151 * Pragma Enable_Atomic_Synchronization:: 
152 * Pragma Export_Function:: 
153 * Pragma Export_Object:: 
154 * Pragma Export_Procedure:: 
155 * Pragma Export_Value:: 
156 * Pragma Export_Valued_Procedure:: 
157 * Pragma Extend_System:: 
158 * Pragma Extensions_Allowed:: 
159 * Pragma Extensions_Visible:: 
160 * Pragma External:: 
161 * Pragma External_Name_Casing:: 
162 * Pragma Fast_Math:: 
163 * Pragma Favor_Top_Level:: 
164 * Pragma Finalize_Storage_Only:: 
165 * Pragma Float_Representation:: 
166 * Pragma Ghost:: 
167 * Pragma Global:: 
168 * Pragma Ident:: 
169 * Pragma Ignore_Pragma:: 
170 * Pragma Implementation_Defined:: 
171 * Pragma Implemented:: 
172 * Pragma Implicit_Packing:: 
173 * Pragma Import_Function:: 
174 * Pragma Import_Object:: 
175 * Pragma Import_Procedure:: 
176 * Pragma Import_Valued_Procedure:: 
177 * Pragma Independent:: 
178 * Pragma Independent_Components:: 
179 * Pragma Initial_Condition:: 
180 * Pragma Initialize_Scalars:: 
181 * Pragma Initializes:: 
182 * Pragma Inline_Always:: 
183 * Pragma Inline_Generic:: 
184 * Pragma Interface:: 
185 * Pragma Interface_Name:: 
186 * Pragma Interrupt_Handler:: 
187 * Pragma Interrupt_State:: 
188 * Pragma Invariant:: 
189 * Pragma Keep_Names:: 
190 * Pragma License:: 
191 * Pragma Link_With:: 
192 * Pragma Linker_Alias:: 
193 * Pragma Linker_Constructor:: 
194 * Pragma Linker_Destructor:: 
195 * Pragma Linker_Section:: 
196 * Pragma Lock_Free:: 
197 * Pragma Loop_Invariant:: 
198 * Pragma Loop_Optimize:: 
199 * Pragma Loop_Variant:: 
200 * Pragma Machine_Attribute:: 
201 * Pragma Main:: 
202 * Pragma Main_Storage:: 
203 * Pragma No_Body:: 
204 * Pragma No_Elaboration_Code_All:: 
205 * Pragma No_Inline:: 
206 * Pragma No_Return:: 
207 * Pragma No_Run_Time:: 
208 * Pragma No_Strict_Aliasing:: 
209 * Pragma No_Tagged_Streams:: 
210 * Pragma Normalize_Scalars:: 
211 * Pragma Obsolescent:: 
212 * Pragma Optimize_Alignment:: 
213 * Pragma Ordered:: 
214 * Pragma Overflow_Mode:: 
215 * Pragma Overriding_Renamings:: 
216 * Pragma Partition_Elaboration_Policy:: 
217 * Pragma Part_Of:: 
218 * Pragma Passive:: 
219 * Pragma Persistent_BSS:: 
220 * Pragma Polling:: 
221 * Pragma Post:: 
222 * Pragma Postcondition:: 
223 * Pragma Post_Class:: 
224 * Pragma Pre:: 
225 * Pragma Precondition:: 
226 * Pragma Predicate:: 
227 * Pragma Predicate_Failure:: 
228 * Pragma Preelaborable_Initialization:: 
229 * Pragma Prefix_Exception_Messages:: 
230 * Pragma Pre_Class:: 
231 * Pragma Priority_Specific_Dispatching:: 
232 * Pragma Profile:: 
233 * Pragma Profile_Warnings:: 
234 * Pragma Propagate_Exceptions:: 
235 * Pragma Provide_Shift_Operators:: 
236 * Pragma Psect_Object:: 
237 * Pragma Pure_Function:: 
238 * Pragma Rational:: 
239 * Pragma Ravenscar:: 
240 * Pragma Refined_Depends:: 
241 * Pragma Refined_Global:: 
242 * Pragma Refined_Post:: 
243 * Pragma Refined_State:: 
244 * Pragma Relative_Deadline:: 
245 * Pragma Remote_Access_Type:: 
246 * Pragma Restricted_Run_Time:: 
247 * Pragma Restriction_Warnings:: 
248 * Pragma Reviewable:: 
249 * Pragma Share_Generic:: 
250 * Pragma Shared:: 
251 * Pragma Short_Circuit_And_Or:: 
252 * Pragma Short_Descriptors:: 
253 * Pragma Simple_Storage_Pool_Type:: 
254 * Pragma Source_File_Name:: 
255 * Pragma Source_File_Name_Project:: 
256 * Pragma Source_Reference:: 
257 * Pragma SPARK_Mode:: 
258 * Pragma Static_Elaboration_Desired:: 
259 * Pragma Stream_Convert:: 
260 * Pragma Style_Checks:: 
261 * Pragma Subtitle:: 
262 * Pragma Suppress:: 
263 * Pragma Suppress_All:: 
264 * Pragma Suppress_Debug_Info:: 
265 * Pragma Suppress_Exception_Locations:: 
266 * Pragma Suppress_Initialization:: 
267 * Pragma Task_Name:: 
268 * Pragma Task_Storage:: 
269 * Pragma Test_Case:: 
270 * Pragma Thread_Local_Storage:: 
271 * Pragma Time_Slice:: 
272 * Pragma Title:: 
273 * Pragma Type_Invariant:: 
274 * Pragma Type_Invariant_Class:: 
275 * Pragma Unchecked_Union:: 
276 * Pragma Unevaluated_Use_Of_Old:: 
277 * Pragma Unimplemented_Unit:: 
278 * Pragma Universal_Aliasing:: 
279 * Pragma Universal_Data:: 
280 * Pragma Unmodified:: 
281 * Pragma Unreferenced:: 
282 * Pragma Unreferenced_Objects:: 
283 * Pragma Unreserve_All_Interrupts:: 
284 * Pragma Unsuppress:: 
285 * Pragma Use_VADS_Size:: 
286 * Pragma Unused:: 
287 * Pragma Validity_Checks:: 
288 * Pragma Volatile:: 
289 * Pragma Volatile_Full_Access:: 
290 * Pragma Volatile_Function:: 
291 * Pragma Warning_As_Error:: 
292 * Pragma Warnings:: 
293 * Pragma Weak_External:: 
294 * Pragma Wide_Character_Encoding:: 
296 Implementation Defined Aspects
298 * Aspect Abstract_State:: 
299 * Annotate:: 
300 * Aspect Async_Readers:: 
301 * Aspect Async_Writers:: 
302 * Aspect Constant_After_Elaboration:: 
303 * Aspect Contract_Cases:: 
304 * Aspect Depends:: 
305 * Aspect Default_Initial_Condition:: 
306 * Aspect Dimension:: 
307 * Aspect Dimension_System:: 
308 * Aspect Disable_Controlled:: 
309 * Aspect Effective_Reads:: 
310 * Aspect Effective_Writes:: 
311 * Aspect Extensions_Visible:: 
312 * Aspect Favor_Top_Level:: 
313 * Aspect Ghost:: 
314 * Aspect Global:: 
315 * Aspect Initial_Condition:: 
316 * Aspect Initializes:: 
317 * Aspect Inline_Always:: 
318 * Aspect Invariant:: 
319 * Aspect Invariant'Class:: 
320 * Aspect Iterable:: 
321 * Aspect Linker_Section:: 
322 * Aspect Lock_Free:: 
323 * Aspect No_Elaboration_Code_All:: 
324 * Aspect No_Tagged_Streams:: 
325 * Aspect Object_Size:: 
326 * Aspect Obsolescent:: 
327 * Aspect Part_Of:: 
328 * Aspect Persistent_BSS:: 
329 * Aspect Predicate:: 
330 * Aspect Pure_Function:: 
331 * Aspect Refined_Depends:: 
332 * Aspect Refined_Global:: 
333 * Aspect Refined_Post:: 
334 * Aspect Refined_State:: 
335 * Aspect Remote_Access_Type:: 
336 * Aspect Scalar_Storage_Order:: 
337 * Aspect Shared:: 
338 * Aspect Simple_Storage_Pool:: 
339 * Aspect Simple_Storage_Pool_Type:: 
340 * Aspect SPARK_Mode:: 
341 * Aspect Suppress_Debug_Info:: 
342 * Aspect Suppress_Initialization:: 
343 * Aspect Test_Case:: 
344 * Aspect Thread_Local_Storage:: 
345 * Aspect Universal_Aliasing:: 
346 * Aspect Universal_Data:: 
347 * Aspect Unmodified:: 
348 * Aspect Unreferenced:: 
349 * Aspect Unreferenced_Objects:: 
350 * Aspect Value_Size:: 
351 * Aspect Volatile_Full_Access:: 
352 * Aspect Volatile_Function:: 
353 * Aspect Warnings:: 
355 Implementation Defined Attributes
357 * Attribute Abort_Signal:: 
358 * Attribute Address_Size:: 
359 * Attribute Asm_Input:: 
360 * Attribute Asm_Output:: 
361 * Attribute Atomic_Always_Lock_Free:: 
362 * Attribute Bit:: 
363 * Attribute Bit_Position:: 
364 * Attribute Code_Address:: 
365 * Attribute Compiler_Version:: 
366 * Attribute Constrained:: 
367 * Attribute Default_Bit_Order:: 
368 * Attribute Default_Scalar_Storage_Order:: 
369 * Attribute Deref:: 
370 * Attribute Descriptor_Size:: 
371 * Attribute Elaborated:: 
372 * Attribute Elab_Body:: 
373 * Attribute Elab_Spec:: 
374 * Attribute Elab_Subp_Body:: 
375 * Attribute Emax:: 
376 * Attribute Enabled:: 
377 * Attribute Enum_Rep:: 
378 * Attribute Enum_Val:: 
379 * Attribute Epsilon:: 
380 * Attribute Fast_Math:: 
381 * Attribute Fixed_Value:: 
382 * Attribute From_Any:: 
383 * Attribute Has_Access_Values:: 
384 * Attribute Has_Discriminants:: 
385 * Attribute Img:: 
386 * Attribute Integer_Value:: 
387 * Attribute Invalid_Value:: 
388 * Attribute Iterable:: 
389 * Attribute Large:: 
390 * Attribute Library_Level:: 
391 * Attribute Lock_Free:: 
392 * Attribute Loop_Entry:: 
393 * Attribute Machine_Size:: 
394 * Attribute Mantissa:: 
395 * Attribute Maximum_Alignment:: 
396 * Attribute Mechanism_Code:: 
397 * Attribute Null_Parameter:: 
398 * Attribute Object_Size:: 
399 * Attribute Old:: 
400 * Attribute Passed_By_Reference:: 
401 * Attribute Pool_Address:: 
402 * Attribute Range_Length:: 
403 * Attribute Restriction_Set:: 
404 * Attribute Result:: 
405 * Attribute Safe_Emax:: 
406 * Attribute Safe_Large:: 
407 * Attribute Safe_Small:: 
408 * Attribute Scalar_Storage_Order:: 
409 * Attribute Simple_Storage_Pool:: 
410 * Attribute Small:: 
411 * Attribute Storage_Unit:: 
412 * Attribute Stub_Type:: 
413 * Attribute System_Allocator_Alignment:: 
414 * Attribute Target_Name:: 
415 * Attribute To_Address:: 
416 * Attribute To_Any:: 
417 * Attribute Type_Class:: 
418 * Attribute Type_Key:: 
419 * Attribute TypeCode:: 
420 * Attribute Unconstrained_Array:: 
421 * Attribute Universal_Literal_String:: 
422 * Attribute Unrestricted_Access:: 
423 * Attribute Update:: 
424 * Attribute Valid_Scalars:: 
425 * Attribute VADS_Size:: 
426 * Attribute Value_Size:: 
427 * Attribute Wchar_T_Size:: 
428 * Attribute Word_Size:: 
430 Standard and Implementation Defined Restrictions
432 * Partition-Wide Restrictions:: 
433 * Program Unit Level Restrictions:: 
435 Partition-Wide Restrictions
437 * Immediate_Reclamation:: 
438 * Max_Asynchronous_Select_Nesting:: 
439 * Max_Entry_Queue_Length:: 
440 * Max_Protected_Entries:: 
441 * Max_Select_Alternatives:: 
442 * Max_Storage_At_Blocking:: 
443 * Max_Task_Entries:: 
444 * Max_Tasks:: 
445 * No_Abort_Statements:: 
446 * No_Access_Parameter_Allocators:: 
447 * No_Access_Subprograms:: 
448 * No_Allocators:: 
449 * No_Anonymous_Allocators:: 
450 * No_Asynchronous_Control:: 
451 * No_Calendar:: 
452 * No_Coextensions:: 
453 * No_Default_Initialization:: 
454 * No_Delay:: 
455 * No_Dependence:: 
456 * No_Direct_Boolean_Operators:: 
457 * No_Dispatch:: 
458 * No_Dispatching_Calls:: 
459 * No_Dynamic_Attachment:: 
460 * No_Dynamic_Priorities:: 
461 * No_Entry_Calls_In_Elaboration_Code:: 
462 * No_Enumeration_Maps:: 
463 * No_Exception_Handlers:: 
464 * No_Exception_Propagation:: 
465 * No_Exception_Registration:: 
466 * No_Exceptions:: 
467 * No_Finalization:: 
468 * No_Fixed_Point:: 
469 * No_Floating_Point:: 
470 * No_Implicit_Conditionals:: 
471 * No_Implicit_Dynamic_Code:: 
472 * No_Implicit_Heap_Allocations:: 
473 * No_Implicit_Protected_Object_Allocations:: 
474 * No_Implicit_Task_Allocations:: 
475 * No_Initialize_Scalars:: 
476 * No_IO:: 
477 * No_Local_Allocators:: 
478 * No_Local_Protected_Objects:: 
479 * No_Local_Timing_Events:: 
480 * No_Long_Long_Integers:: 
481 * No_Multiple_Elaboration:: 
482 * No_Nested_Finalization:: 
483 * No_Protected_Type_Allocators:: 
484 * No_Protected_Types:: 
485 * No_Recursion:: 
486 * No_Reentrancy:: 
487 * No_Relative_Delay:: 
488 * No_Requeue_Statements:: 
489 * No_Secondary_Stack:: 
490 * No_Select_Statements:: 
491 * No_Specific_Termination_Handlers:: 
492 * No_Specification_of_Aspect:: 
493 * No_Standard_Allocators_After_Elaboration:: 
494 * No_Standard_Storage_Pools:: 
495 * No_Stream_Optimizations:: 
496 * No_Streams:: 
497 * No_Task_Allocators:: 
498 * No_Task_At_Interrupt_Priority:: 
499 * No_Task_Attributes_Package:: 
500 * No_Task_Hierarchy:: 
501 * No_Task_Termination:: 
502 * No_Tasking:: 
503 * No_Terminate_Alternatives:: 
504 * No_Unchecked_Access:: 
505 * No_Unchecked_Conversion:: 
506 * No_Unchecked_Deallocation:: 
507 * No_Use_Of_Entity:: 
508 * Pure_Barriers:: 
509 * Simple_Barriers:: 
510 * Static_Priorities:: 
511 * Static_Storage_Size:: 
513 Program Unit Level Restrictions
515 * No_Elaboration_Code:: 
516 * No_Dynamic_Sized_Objects:: 
517 * No_Entry_Queue:: 
518 * No_Implementation_Aspect_Specifications:: 
519 * No_Implementation_Attributes:: 
520 * No_Implementation_Identifiers:: 
521 * No_Implementation_Pragmas:: 
522 * No_Implementation_Restrictions:: 
523 * No_Implementation_Units:: 
524 * No_Implicit_Aliasing:: 
525 * No_Implicit_Loops:: 
526 * No_Obsolescent_Features:: 
527 * No_Wide_Characters:: 
528 * SPARK_05:: 
530 Implementation Advice
532 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
533 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
534 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
535 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
536 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
537 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
538 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
539 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
540 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
541 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
542 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
543 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
544 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
545 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
546 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
547 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
548 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
549 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
550 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
551 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
552 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
553 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
554 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
555 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
556 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
557 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
558 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
559 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
560 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
561 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
562 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
563 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
564 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
565 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
566 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
567 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
568 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
569 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
570 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
571 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
572 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
573 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
574 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
575 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
576 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
577 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
578 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
579 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
580 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
581 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
582 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
583 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
584 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
585 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
586 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
587 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
588 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
589 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
590 * RM G; Numerics: RM G Numerics. 
591 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
592 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
593 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
594 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
595 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
597 Intrinsic Subprograms
599 * Intrinsic Operators:: 
600 * Compilation_Date:: 
601 * Compilation_Time:: 
602 * Enclosing_Entity:: 
603 * Exception_Information:: 
604 * Exception_Message:: 
605 * Exception_Name:: 
606 * File:: 
607 * Line:: 
608 * Shifts and Rotates:: 
609 * Source_Location:: 
611 Representation Clauses and Pragmas
613 * Alignment Clauses:: 
614 * Size Clauses:: 
615 * Storage_Size Clauses:: 
616 * Size of Variant Record Objects:: 
617 * Biased Representation:: 
618 * Value_Size and Object_Size Clauses:: 
619 * Component_Size Clauses:: 
620 * Bit_Order Clauses:: 
621 * Effect of Bit_Order on Byte Ordering:: 
622 * Pragma Pack for Arrays:: 
623 * Pragma Pack for Records:: 
624 * Record Representation Clauses:: 
625 * Handling of Records with Holes:: 
626 * Enumeration Clauses:: 
627 * Address Clauses:: 
628 * Use of Address Clauses for Memory-Mapped I/O:: 
629 * Effect of Convention on Representation:: 
630 * Conventions and Anonymous Access Types:: 
631 * Determining the Representations chosen by GNAT:: 
633 The Implementation of Standard I/O
635 * Standard I/O Packages:: 
636 * FORM Strings:: 
637 * Direct_IO:: 
638 * Sequential_IO:: 
639 * Text_IO:: 
640 * Wide_Text_IO:: 
641 * Wide_Wide_Text_IO:: 
642 * Stream_IO:: 
643 * Text Translation:: 
644 * Shared Files:: 
645 * Filenames encoding:: 
646 * File content encoding:: 
647 * Open Modes:: 
648 * Operations on C Streams:: 
649 * Interfacing to C Streams:: 
651 Text_IO
653 * Stream Pointer Positioning:: 
654 * Reading and Writing Non-Regular Files:: 
655 * Get_Immediate:: 
656 * Treating Text_IO Files as Streams:: 
657 * Text_IO Extensions:: 
658 * Text_IO Facilities for Unbounded Strings:: 
660 Wide_Text_IO
662 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
663 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
665 Wide_Wide_Text_IO
667 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
668 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
670 The GNAT Library
672 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
673 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
674 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
675 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
676 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
677 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
678 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
679 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
680 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
681 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
682 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
683 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
684 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
685 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
686 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
687 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
688 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
689 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
690 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
691 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
692 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
693 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
694 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
695 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
696 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
697 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
698 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
699 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
700 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
701 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
702 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
703 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
704 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
705 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
706 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
707 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
708 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
709 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
710 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
711 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
712 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
713 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
714 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
715 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
716 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
717 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
718 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
719 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
720 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
721 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
722 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
723 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
724 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
725 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
726 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
727 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
728 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
729 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
730 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
731 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
732 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
733 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
734 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
735 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
736 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
737 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
738 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
739 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
740 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
741 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
742 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
743 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
744 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
745 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
746 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
747 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
748 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
749 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
750 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
751 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
752 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
753 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
754 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
755 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
756 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
757 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
758 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
759 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
760 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
761 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
762 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
763 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
764 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
765 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
766 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
767 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
768 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
769 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
770 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
771 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
772 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
773 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
774 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
775 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
776 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
777 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
778 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
779 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
780 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
781 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
782 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
783 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
784 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
785 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
786 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
787 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
788 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
789 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
790 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
791 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
792 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
793 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
794 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
795 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
796 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
797 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
798 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
799 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
800 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
801 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
802 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
803 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
804 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
805 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
806 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
807 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
808 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
809 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
810 * System.Memory (s-memory.ads): System Memory s-memory ads. 
811 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
812 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
813 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
814 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
815 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
816 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
817 * System.Rident (s-rident.ads): System Rident s-rident ads. 
818 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
819 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
820 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
821 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
823 Interfacing to Other Languages
825 * Interfacing to C:: 
826 * Interfacing to C++:: 
827 * Interfacing to COBOL:: 
828 * Interfacing to Fortran:: 
829 * Interfacing to non-GNAT Ada code:: 
831 Implementation of Specific Ada Features
833 * Machine Code Insertions:: 
834 * GNAT Implementation of Tasking:: 
835 * GNAT Implementation of Shared Passive Packages:: 
836 * Code Generation for Array Aggregates:: 
837 * The Size of Discriminated Records with Default Discriminants:: 
838 * Strict Conformance to the Ada Reference Manual:: 
840 GNAT Implementation of Tasking
842 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
843 * Ensuring Compliance with the Real-Time Annex:: 
845 Code Generation for Array Aggregates
847 * Static constant aggregates with static bounds:: 
848 * Constant aggregates with unconstrained nominal types:: 
849 * Aggregates with static bounds:: 
850 * Aggregates with nonstatic bounds:: 
851 * Aggregates in assignment statements:: 
853 Obsolescent Features
855 * pragma No_Run_Time:: 
856 * pragma Ravenscar:: 
857 * pragma Restricted_Run_Time:: 
858 * pragma Task_Info:: 
859 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
861 Compatibility and Porting Guide
863 * Writing Portable Fixed-Point Declarations:: 
864 * Compatibility with Ada 83:: 
865 * Compatibility between Ada 95 and Ada 2005:: 
866 * Implementation-dependent characteristics:: 
867 * Compatibility with Other Ada Systems:: 
868 * Representation Clauses:: 
869 * Compatibility with HP Ada 83:: 
871 Compatibility with Ada 83
873 * Legal Ada 83 programs that are illegal in Ada 95:: 
874 * More deterministic semantics:: 
875 * Changed semantics:: 
876 * Other language compatibility issues:: 
878 Implementation-dependent characteristics
880 * Implementation-defined pragmas:: 
881 * Implementation-defined attributes:: 
882 * Libraries:: 
883 * Elaboration order:: 
884 * Target-specific aspects:: 
886 @end detailmenu
887 @end menu
889 @node About This Guide,Implementation Defined Pragmas,Top,Top
890 @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}
891 @chapter About This Guide
895 This manual contains useful information in writing programs using the
896 GNAT compiler.  It includes information on implementation dependent
897 characteristics of GNAT, including all the information required by
898 Annex M of the Ada language standard.
900 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
901 invoked in Ada 83 compatibility mode.
902 By default, GNAT assumes Ada 2012,
903 but you can override with a compiler switch
904 to explicitly specify the language version.
905 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
906 Throughout this manual, references to 'Ada' without a year suffix
907 apply to all the Ada versions of the language.
909 Ada is designed to be highly portable.
910 In general, a program will have the same effect even when compiled by
911 different compilers on different platforms.
912 However, since Ada is designed to be used in a
913 wide variety of applications, it also contains a number of system
914 dependent features to be used in interfacing to the external world.
916 @geindex Implementation-dependent features
918 @geindex Portability
920 Note: Any program that makes use of implementation-dependent features
921 may be non-portable.  You should follow good programming practice and
922 isolate and clearly document any sections of your program that make use
923 of these features in a non-portable manner.
925 @menu
926 * What This Reference Manual Contains:: 
927 * Conventions:: 
928 * Related Information:: 
930 @end menu
932 @node What This Reference Manual Contains,Conventions,,About This Guide
933 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
934 @section What This Reference Manual Contains
937 This reference manual contains the following chapters:
940 @itemize *
942 @item 
943 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
944 pragmas, which can be used to extend and enhance the functionality of the
945 compiler.
947 @item 
948 @ref{8,,Implementation Defined Attributes}, lists GNAT
949 implementation-dependent attributes, which can be used to extend and
950 enhance the functionality of the compiler.
952 @item 
953 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
954 implementation-dependent restrictions, which can be used to extend and
955 enhance the functionality of the compiler.
957 @item 
958 @ref{a,,Implementation Advice}, provides information on generally
959 desirable behavior which are not requirements that all compilers must
960 follow since it cannot be provided on all systems, or which may be
961 undesirable on some systems.
963 @item 
964 @ref{b,,Implementation Defined Characteristics}, provides a guide to
965 minimizing implementation dependent features.
967 @item 
968 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
969 implemented by GNAT, and how they can be imported into user
970 application programs.
972 @item 
973 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
974 way that GNAT represents data, and in particular the exact set
975 of representation clauses and pragmas that is accepted.
977 @item 
978 @ref{e,,Standard Library Routines}, provides a listing of packages and a
979 brief description of the functionality that is provided by Ada's
980 extensive set of standard library routines as implemented by GNAT.
982 @item 
983 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
984 implementation of the input-output facilities.
986 @item 
987 @ref{10,,The GNAT Library}, is a catalog of packages that complement
988 the Ada predefined library.
990 @item 
991 @ref{11,,Interfacing to Other Languages}, describes how programs
992 written in Ada using GNAT can be interfaced to other programming
993 languages.
995 @item 
996 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
997 of the specialized needs annexes.
999 @item 
1000 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1001 to GNAT's implementation of machine code insertions, tasking, and several
1002 other features.
1004 @item 
1005 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1006 GNAT implementation of the Ada 2012 language standard.
1008 @item 
1009 @ref{15,,Obsolescent Features} documents implementation dependent features,
1010 including pragmas and attributes, which are considered obsolescent, since
1011 there are other preferred ways of achieving the same results. These
1012 obsolescent forms are retained for backwards compatibility.
1014 @item 
1015 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
1016 developing portable Ada code, describes the compatibility issues that
1017 may arise between GNAT and other Ada compilation systems (including those
1018 for Ada 83), and shows how GNAT can expedite porting applications
1019 developed in other Ada environments.
1021 @item 
1022 @ref{1,,GNU Free Documentation License} contains the license for this document.
1023 @end itemize
1025 @geindex Ada 95 Language Reference Manual
1027 @geindex Ada 2005 Language Reference Manual
1029 This reference manual assumes a basic familiarity with the Ada 95 language, as
1030 described in the
1031 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1032 It does not require knowledge of the new features introduced by Ada 2005 or
1033 Ada 2012.
1034 All three reference manuals are included in the GNAT documentation
1035 package.
1037 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1038 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1039 @section Conventions
1042 @geindex Conventions
1043 @geindex typographical
1045 @geindex Typographical conventions
1047 Following are examples of the typographical and graphic conventions used
1048 in this guide:
1051 @itemize *
1053 @item 
1054 @cite{Functions}, @cite{utility program names}, @cite{standard names},
1055 and @cite{classes}.
1057 @item 
1058 @cite{Option flags}
1060 @item 
1061 @code{File names}
1063 @item 
1064 @cite{Variables}
1066 @item 
1067 @emph{Emphasis}
1069 @item 
1070 [optional information or parameters]
1072 @item 
1073 Examples are described by text
1075 @example
1076 and then shown this way.
1077 @end example
1079 @item 
1080 Commands that are entered by the user are shown as preceded by a prompt string
1081 comprising the @code{$} character followed by a space.
1082 @end itemize
1084 @node Related Information,,Conventions,About This Guide
1085 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1086 @section Related Information
1089 See the following documents for further information on GNAT:
1092 @itemize *
1094 @item 
1095 @cite{GNAT User's Guide for Native Platforms},
1096 which provides information on how to use the
1097 GNAT development environment.
1099 @item 
1100 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1102 @item 
1103 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1104 of the Ada 95 standard.  The annotations describe
1105 detailed aspects of the design decision, and in particular contain useful
1106 sections on Ada 83 compatibility.
1108 @item 
1109 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1111 @item 
1112 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1113 of the Ada 2005 standard.  The annotations describe
1114 detailed aspects of the design decision.
1116 @item 
1117 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1119 @item 
1120 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1121 which contains specific information on compatibility between GNAT and
1122 DEC Ada 83 systems.
1124 @item 
1125 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1126 describes in detail the pragmas and attributes provided by the DEC Ada 83
1127 compiler system.
1128 @end itemize
1130 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1131 @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}
1132 @chapter Implementation Defined Pragmas
1135 Ada defines a set of pragmas that can be used to supply additional
1136 information to the compiler.  These language defined pragmas are
1137 implemented in GNAT and work as described in the Ada Reference Manual.
1139 In addition, Ada allows implementations to define additional pragmas
1140 whose meaning is defined by the implementation.  GNAT provides a number
1141 of these implementation-defined pragmas, which can be used to extend
1142 and enhance the functionality of the compiler.  This section of the GNAT
1143 Reference Manual describes these additional pragmas.
1145 Note that any program using these pragmas might not be portable to other
1146 compilers (although GNAT implements this set of pragmas on all
1147 platforms).  Therefore if portability to other compilers is an important
1148 consideration, the use of these pragmas should be minimized.
1150 @menu
1151 * Pragma Abort_Defer:: 
1152 * Pragma Abstract_State:: 
1153 * Pragma Ada_83:: 
1154 * Pragma Ada_95:: 
1155 * Pragma Ada_05:: 
1156 * Pragma Ada_2005:: 
1157 * Pragma Ada_12:: 
1158 * Pragma Ada_2012:: 
1159 * Pragma Allow_Integer_Address:: 
1160 * Pragma Annotate:: 
1161 * Pragma Assert:: 
1162 * Pragma Assert_And_Cut:: 
1163 * Pragma Assertion_Policy:: 
1164 * Pragma Assume:: 
1165 * Pragma Assume_No_Invalid_Values:: 
1166 * Pragma Async_Readers:: 
1167 * Pragma Async_Writers:: 
1168 * Pragma Attribute_Definition:: 
1169 * Pragma C_Pass_By_Copy:: 
1170 * Pragma Check:: 
1171 * Pragma Check_Float_Overflow:: 
1172 * Pragma Check_Name:: 
1173 * Pragma Check_Policy:: 
1174 * Pragma Comment:: 
1175 * Pragma Common_Object:: 
1176 * Pragma Compile_Time_Error:: 
1177 * Pragma Compile_Time_Warning:: 
1178 * Pragma Compiler_Unit:: 
1179 * Pragma Compiler_Unit_Warning:: 
1180 * Pragma Complete_Representation:: 
1181 * Pragma Complex_Representation:: 
1182 * Pragma Component_Alignment:: 
1183 * Pragma Constant_After_Elaboration:: 
1184 * Pragma Contract_Cases:: 
1185 * Pragma Convention_Identifier:: 
1186 * Pragma CPP_Class:: 
1187 * Pragma CPP_Constructor:: 
1188 * Pragma CPP_Virtual:: 
1189 * Pragma CPP_Vtable:: 
1190 * Pragma CPU:: 
1191 * Pragma Default_Initial_Condition:: 
1192 * Pragma Debug:: 
1193 * Pragma Debug_Policy:: 
1194 * Pragma Default_Scalar_Storage_Order:: 
1195 * Pragma Default_Storage_Pool:: 
1196 * Pragma Depends:: 
1197 * Pragma Detect_Blocking:: 
1198 * Pragma Disable_Atomic_Synchronization:: 
1199 * Pragma Dispatching_Domain:: 
1200 * Pragma Effective_Reads:: 
1201 * Pragma Effective_Writes:: 
1202 * Pragma Elaboration_Checks:: 
1203 * Pragma Eliminate:: 
1204 * Pragma Enable_Atomic_Synchronization:: 
1205 * Pragma Export_Function:: 
1206 * Pragma Export_Object:: 
1207 * Pragma Export_Procedure:: 
1208 * Pragma Export_Value:: 
1209 * Pragma Export_Valued_Procedure:: 
1210 * Pragma Extend_System:: 
1211 * Pragma Extensions_Allowed:: 
1212 * Pragma Extensions_Visible:: 
1213 * Pragma External:: 
1214 * Pragma External_Name_Casing:: 
1215 * Pragma Fast_Math:: 
1216 * Pragma Favor_Top_Level:: 
1217 * Pragma Finalize_Storage_Only:: 
1218 * Pragma Float_Representation:: 
1219 * Pragma Ghost:: 
1220 * Pragma Global:: 
1221 * Pragma Ident:: 
1222 * Pragma Ignore_Pragma:: 
1223 * Pragma Implementation_Defined:: 
1224 * Pragma Implemented:: 
1225 * Pragma Implicit_Packing:: 
1226 * Pragma Import_Function:: 
1227 * Pragma Import_Object:: 
1228 * Pragma Import_Procedure:: 
1229 * Pragma Import_Valued_Procedure:: 
1230 * Pragma Independent:: 
1231 * Pragma Independent_Components:: 
1232 * Pragma Initial_Condition:: 
1233 * Pragma Initialize_Scalars:: 
1234 * Pragma Initializes:: 
1235 * Pragma Inline_Always:: 
1236 * Pragma Inline_Generic:: 
1237 * Pragma Interface:: 
1238 * Pragma Interface_Name:: 
1239 * Pragma Interrupt_Handler:: 
1240 * Pragma Interrupt_State:: 
1241 * Pragma Invariant:: 
1242 * Pragma Keep_Names:: 
1243 * Pragma License:: 
1244 * Pragma Link_With:: 
1245 * Pragma Linker_Alias:: 
1246 * Pragma Linker_Constructor:: 
1247 * Pragma Linker_Destructor:: 
1248 * Pragma Linker_Section:: 
1249 * Pragma Lock_Free:: 
1250 * Pragma Loop_Invariant:: 
1251 * Pragma Loop_Optimize:: 
1252 * Pragma Loop_Variant:: 
1253 * Pragma Machine_Attribute:: 
1254 * Pragma Main:: 
1255 * Pragma Main_Storage:: 
1256 * Pragma No_Body:: 
1257 * Pragma No_Elaboration_Code_All:: 
1258 * Pragma No_Inline:: 
1259 * Pragma No_Return:: 
1260 * Pragma No_Run_Time:: 
1261 * Pragma No_Strict_Aliasing:: 
1262 * Pragma No_Tagged_Streams:: 
1263 * Pragma Normalize_Scalars:: 
1264 * Pragma Obsolescent:: 
1265 * Pragma Optimize_Alignment:: 
1266 * Pragma Ordered:: 
1267 * Pragma Overflow_Mode:: 
1268 * Pragma Overriding_Renamings:: 
1269 * Pragma Partition_Elaboration_Policy:: 
1270 * Pragma Part_Of:: 
1271 * Pragma Passive:: 
1272 * Pragma Persistent_BSS:: 
1273 * Pragma Polling:: 
1274 * Pragma Post:: 
1275 * Pragma Postcondition:: 
1276 * Pragma Post_Class:: 
1277 * Pragma Pre:: 
1278 * Pragma Precondition:: 
1279 * Pragma Predicate:: 
1280 * Pragma Predicate_Failure:: 
1281 * Pragma Preelaborable_Initialization:: 
1282 * Pragma Prefix_Exception_Messages:: 
1283 * Pragma Pre_Class:: 
1284 * Pragma Priority_Specific_Dispatching:: 
1285 * Pragma Profile:: 
1286 * Pragma Profile_Warnings:: 
1287 * Pragma Propagate_Exceptions:: 
1288 * Pragma Provide_Shift_Operators:: 
1289 * Pragma Psect_Object:: 
1290 * Pragma Pure_Function:: 
1291 * Pragma Rational:: 
1292 * Pragma Ravenscar:: 
1293 * Pragma Refined_Depends:: 
1294 * Pragma Refined_Global:: 
1295 * Pragma Refined_Post:: 
1296 * Pragma Refined_State:: 
1297 * Pragma Relative_Deadline:: 
1298 * Pragma Remote_Access_Type:: 
1299 * Pragma Restricted_Run_Time:: 
1300 * Pragma Restriction_Warnings:: 
1301 * Pragma Reviewable:: 
1302 * Pragma Share_Generic:: 
1303 * Pragma Shared:: 
1304 * Pragma Short_Circuit_And_Or:: 
1305 * Pragma Short_Descriptors:: 
1306 * Pragma Simple_Storage_Pool_Type:: 
1307 * Pragma Source_File_Name:: 
1308 * Pragma Source_File_Name_Project:: 
1309 * Pragma Source_Reference:: 
1310 * Pragma SPARK_Mode:: 
1311 * Pragma Static_Elaboration_Desired:: 
1312 * Pragma Stream_Convert:: 
1313 * Pragma Style_Checks:: 
1314 * Pragma Subtitle:: 
1315 * Pragma Suppress:: 
1316 * Pragma Suppress_All:: 
1317 * Pragma Suppress_Debug_Info:: 
1318 * Pragma Suppress_Exception_Locations:: 
1319 * Pragma Suppress_Initialization:: 
1320 * Pragma Task_Name:: 
1321 * Pragma Task_Storage:: 
1322 * Pragma Test_Case:: 
1323 * Pragma Thread_Local_Storage:: 
1324 * Pragma Time_Slice:: 
1325 * Pragma Title:: 
1326 * Pragma Type_Invariant:: 
1327 * Pragma Type_Invariant_Class:: 
1328 * Pragma Unchecked_Union:: 
1329 * Pragma Unevaluated_Use_Of_Old:: 
1330 * Pragma Unimplemented_Unit:: 
1331 * Pragma Universal_Aliasing:: 
1332 * Pragma Universal_Data:: 
1333 * Pragma Unmodified:: 
1334 * Pragma Unreferenced:: 
1335 * Pragma Unreferenced_Objects:: 
1336 * Pragma Unreserve_All_Interrupts:: 
1337 * Pragma Unsuppress:: 
1338 * Pragma Use_VADS_Size:: 
1339 * Pragma Unused:: 
1340 * Pragma Validity_Checks:: 
1341 * Pragma Volatile:: 
1342 * Pragma Volatile_Full_Access:: 
1343 * Pragma Volatile_Function:: 
1344 * Pragma Warning_As_Error:: 
1345 * Pragma Warnings:: 
1346 * Pragma Weak_External:: 
1347 * Pragma Wide_Character_Encoding:: 
1349 @end menu
1351 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1352 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1353 @section Pragma Abort_Defer
1356 @geindex Deferring aborts
1358 Syntax:
1360 @example
1361 pragma Abort_Defer;
1362 @end example
1364 This pragma must appear at the start of the statement sequence of a
1365 handled sequence of statements (right after the @cite{begin}).  It has
1366 the effect of deferring aborts for the sequence of statements (but not
1367 for the declarations or handlers, if any, associated with this statement
1368 sequence).
1370 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1371 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
1372 @section Pragma Abstract_State
1375 Syntax:
1377 @example
1378 pragma Abstract_State (ABSTRACT_STATE_LIST);
1380 ABSTRACT_STATE_LIST ::=
1381      null
1382   |  STATE_NAME_WITH_OPTIONS
1383   | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1385 STATE_NAME_WITH_OPTIONS ::=
1386      STATE_NAME
1387   | (STATE_NAME with OPTION_LIST)
1389 OPTION_LIST ::= OPTION @{, OPTION@}
1391 OPTION ::=
1392     SIMPLE_OPTION
1393   | NAME_VALUE_OPTION
1395 SIMPLE_OPTION ::= Ghost | Synchronous
1397 NAME_VALUE_OPTION ::=
1398     Part_Of => ABSTRACT_STATE
1399   | External [=> EXTERNAL_PROPERTY_LIST]
1401 EXTERNAL_PROPERTY_LIST ::=
1402      EXTERNAL_PROPERTY
1403   | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1405 EXTERNAL_PROPERTY ::=
1406     Async_Readers    [=> boolean_EXPRESSION]
1407   | Async_Writers    [=> boolean_EXPRESSION]
1408   | Effective_Reads  [=> boolean_EXPRESSION]
1409   | Effective_Writes [=> boolean_EXPRESSION]
1410     others            => boolean_EXPRESSION
1412 STATE_NAME ::= defining_identifier
1414 ABSTRACT_STATE ::= name
1415 @end example
1417 For the semantics of this pragma, see the entry for aspect @cite{Abstract_State} in
1418 the SPARK 2014 Reference Manual, section 7.1.4.
1420 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1421 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1e}
1422 @section Pragma Ada_83
1425 Syntax:
1427 @example
1428 pragma Ada_83;
1429 @end example
1431 A configuration pragma that establishes Ada 83 mode for the unit to
1432 which it applies, regardless of the mode set by the command line
1433 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1434 the syntax and semantics of Ada 83, as defined in the original Ada
1435 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1436 and Ada 2005 are not recognized, optional package bodies are allowed,
1437 and generics may name types with unknown discriminants without using
1438 the @cite{(<>)} notation.  In addition, some but not all of the additional
1439 restrictions of Ada 83 are enforced.
1441 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1442 Ada 83 code to be compiled and adapted to GNAT with less effort.
1443 Secondly, it aids in keeping code backwards compatible with Ada 83.
1444 However, there is no guarantee that code that is processed correctly
1445 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1446 83 compiler, since GNAT does not enforce all the additional checks
1447 required by Ada 83.
1449 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1450 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{1f}
1451 @section Pragma Ada_95
1454 Syntax:
1456 @example
1457 pragma Ada_95;
1458 @end example
1460 A configuration pragma that establishes Ada 95 mode for the unit to which
1461 it applies, regardless of the mode set by the command line switches.
1462 This mode is set automatically for the @cite{Ada} and @cite{System}
1463 packages and their children, so you need not specify it in these
1464 contexts.  This pragma is useful when writing a reusable component that
1465 itself uses Ada 95 features, but which is intended to be usable from
1466 either Ada 83 or Ada 95 programs.
1468 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1469 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{20}
1470 @section Pragma Ada_05
1473 Syntax:
1475 @example
1476 pragma Ada_05;
1477 pragma Ada_05 (local_NAME);
1478 @end example
1480 A configuration pragma that establishes Ada 2005 mode for the unit to which
1481 it applies, regardless of the mode set by the command line switches.
1482 This pragma is useful when writing a reusable component that
1483 itself uses Ada 2005 features, but which is intended to be usable from
1484 either Ada 83 or Ada 95 programs.
1486 The one argument form (which is not a configuration pragma)
1487 is used for managing the transition from
1488 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1489 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1490 mode will generate a warning. In addition, in Ada_83 or Ada_95
1491 mode, a preference rule is established which does not choose
1492 such an entity unless it is unambiguously specified. This avoids
1493 extra subprograms marked this way from generating ambiguities in
1494 otherwise legal pre-Ada_2005 programs. The one argument form is
1495 intended for exclusive use in the GNAT run-time library.
1497 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1498 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{21}
1499 @section Pragma Ada_2005
1502 Syntax:
1504 @example
1505 pragma Ada_2005;
1506 @end example
1508 This configuration pragma is a synonym for pragma Ada_05 and has the
1509 same syntax and effect.
1511 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1512 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{22}
1513 @section Pragma Ada_12
1516 Syntax:
1518 @example
1519 pragma Ada_12;
1520 pragma Ada_12 (local_NAME);
1521 @end example
1523 A configuration pragma that establishes Ada 2012 mode for the unit to which
1524 it applies, regardless of the mode set by the command line switches.
1525 This mode is set automatically for the @cite{Ada} and @cite{System}
1526 packages and their children, so you need not specify it in these
1527 contexts.  This pragma is useful when writing a reusable component that
1528 itself uses Ada 2012 features, but which is intended to be usable from
1529 Ada 83, Ada 95, or Ada 2005 programs.
1531 The one argument form, which is not a configuration pragma,
1532 is used for managing the transition from Ada
1533 2005 to Ada 2012 in the run-time library. If an entity is marked
1534 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1535 mode will generate a warning. In addition, in any pre-Ada_2012
1536 mode, a preference rule is established which does not choose
1537 such an entity unless it is unambiguously specified. This avoids
1538 extra subprograms marked this way from generating ambiguities in
1539 otherwise legal pre-Ada_2012 programs. The one argument form is
1540 intended for exclusive use in the GNAT run-time library.
1542 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1543 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{23}
1544 @section Pragma Ada_2012
1547 Syntax:
1549 @example
1550 pragma Ada_2012;
1551 @end example
1553 This configuration pragma is a synonym for pragma Ada_12 and has the
1554 same syntax and effect.
1556 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1557 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{24}
1558 @section Pragma Allow_Integer_Address
1561 Syntax:
1563 @example
1564 pragma Allow_Integer_Address;
1565 @end example
1567 In almost all versions of GNAT, @cite{System.Address} is a private
1568 type in accordance with the implementation advice in the RM. This
1569 means that integer values,
1570 in particular integer literals, are not allowed as address values.
1571 If the configuration pragma
1572 @cite{Allow_Integer_Address} is given, then integer expressions may
1573 be used anywhere a value of type @cite{System.Address} is required.
1574 The effect is to introduce an implicit unchecked conversion from the
1575 integer value to type @cite{System.Address}. The reverse case of using
1576 an address where an integer type is required is handled analogously.
1577 The following example compiles without errors:
1579 @example
1580 pragma Allow_Integer_Address;
1581 with System; use System;
1582 package AddrAsInt is
1583    X : Integer;
1584    Y : Integer;
1585    for X'Address use 16#1240#;
1586    for Y use at 16#3230#;
1587    m : Address := 16#4000#;
1588    n : constant Address := 4000;
1589    p : constant Address := Address (X + Y);
1590    v : Integer := y'Address;
1591    w : constant Integer := Integer (Y'Address);
1592    type R is new integer;
1593    RR : R := 1000;
1594    Z : Integer;
1595    for Z'Address use RR;
1596 end AddrAsInt;
1597 @end example
1599 Note that pragma @cite{Allow_Integer_Address} is ignored if @cite{System.Address}
1600 is not a private type. In implementations of @cite{GNAT} where
1601 System.Address is a visible integer type,
1602 this pragma serves no purpose but is ignored
1603 rather than rejected to allow common sets of sources to be used
1604 in the two situations.
1606 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1607 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{25}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{26}
1608 @section Pragma Annotate
1611 Syntax:
1613 @example
1614 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1616 ARG ::= NAME | EXPRESSION
1617 @end example
1619 This pragma is used to annotate programs.  @cite{identifier} identifies
1620 the type of annotation.  GNAT verifies that it is an identifier, but does
1621 not otherwise analyze it. The second optional identifier is also left
1622 unanalyzed, and by convention is used to control the action of the tool to
1623 which the annotation is addressed.  The remaining @cite{arg} arguments
1624 can be either string literals or more generally expressions.
1625 String literals are assumed to be either of type
1626 @cite{Standard.String} or else @cite{Wide_String} or @cite{Wide_Wide_String}
1627 depending on the character literals they contain.
1628 All other kinds of arguments are analyzed as expressions, and must be
1629 unambiguous. The last argument if present must have the identifier
1630 @cite{Entity} and GNAT verifies that a local name is given.
1632 The analyzed pragma is retained in the tree, but not otherwise processed
1633 by any part of the GNAT compiler, except to generate corresponding note
1634 lines in the generated ALI file. For the format of these note lines, see
1635 the compiler source file lib-writ.ads. This pragma is intended for use by
1636 external tools, including ASIS. The use of pragma Annotate does not
1637 affect the compilation process in any way. This pragma may be used as
1638 a configuration pragma.
1640 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1641 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{27}
1642 @section Pragma Assert
1645 Syntax:
1647 @example
1648 pragma Assert (
1649   boolean_EXPRESSION
1650   [, string_EXPRESSION]);
1651 @end example
1653 The effect of this pragma depends on whether the corresponding command
1654 line switch is set to activate assertions.  The pragma expands into code
1655 equivalent to the following:
1657 @example
1658 if assertions-enabled then
1659    if not boolean_EXPRESSION then
1660       System.Assertions.Raise_Assert_Failure
1661         (string_EXPRESSION);
1662    end if;
1663 end if;
1664 @end example
1666 The string argument, if given, is the message that will be associated
1667 with the exception occurrence if the exception is raised.  If no second
1668 argument is given, the default message is @cite{file}:@cite{nnn},
1669 where @cite{file} is the name of the source file containing the assert,
1670 and @cite{nnn} is the line number of the assert.
1672 Note that, as with the @cite{if} statement to which it is equivalent, the
1673 type of the expression is either @cite{Standard.Boolean}, or any type derived
1674 from this standard type.
1676 Assert checks can be either checked or ignored. By default they are ignored.
1677 They will be checked if either the command line switch @emph{-gnata} is
1678 used, or if an @cite{Assertion_Policy} or @cite{Check_Policy} pragma is used
1679 to enable @cite{Assert_Checks}.
1681 If assertions are ignored, then there
1682 is no run-time effect (and in particular, any side effects from the
1683 expression will not occur at run time).  (The expression is still
1684 analyzed at compile time, and may cause types to be frozen if they are
1685 mentioned here for the first time).
1687 If assertions are checked, then the given expression is tested, and if
1688 it is @cite{False} then @cite{System.Assertions.Raise_Assert_Failure} is called
1689 which results in the raising of @cite{Assert_Failure} with the given message.
1691 You should generally avoid side effects in the expression arguments of
1692 this pragma, because these side effects will turn on and off with the
1693 setting of the assertions mode, resulting in assertions that have an
1694 effect on the program.  However, the expressions are analyzed for
1695 semantic correctness whether or not assertions are enabled, so turning
1696 assertions on and off cannot affect the legality of a program.
1698 Note that the implementation defined policy @cite{DISABLE}, given in a
1699 pragma @cite{Assertion_Policy}, can be used to suppress this semantic analysis.
1701 Note: this is a standard language-defined pragma in versions
1702 of Ada from 2005 on. In GNAT, it is implemented in all versions
1703 of Ada, and the DISABLE policy is an implementation-defined
1704 addition.
1706 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1707 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{28}
1708 @section Pragma Assert_And_Cut
1711 Syntax:
1713 @example
1714 pragma Assert_And_Cut (
1715   boolean_EXPRESSION
1716   [, string_EXPRESSION]);
1717 @end example
1719 The effect of this pragma is identical to that of pragma @cite{Assert},
1720 except that in an @cite{Assertion_Policy} pragma, the identifier
1721 @cite{Assert_And_Cut} is used to control whether it is ignored or checked
1722 (or disabled).
1724 The intention is that this be used within a subprogram when the
1725 given test expresion sums up all the work done so far in the
1726 subprogram, so that the rest of the subprogram can be verified
1727 (informally or formally) using only the entry preconditions,
1728 and the expression in this pragma. This allows dividing up
1729 a subprogram into sections for the purposes of testing or
1730 formal verification. The pragma also serves as useful
1731 documentation.
1733 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1734 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{29}
1735 @section Pragma Assertion_Policy
1738 Syntax:
1740 @example
1741 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1743 pragma Assertion_Policy (
1744     ASSERTION_KIND => POLICY_IDENTIFIER
1745  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1747 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1749 RM_ASSERTION_KIND ::= Assert               |
1750                       Static_Predicate     |
1751                       Dynamic_Predicate    |
1752                       Pre                  |
1753                       Pre'Class            |
1754                       Post                 |
1755                       Post'Class           |
1756                       Type_Invariant       |
1757                       Type_Invariant'Class
1759 ID_ASSERTION_KIND ::= Assertions           |
1760                       Assert_And_Cut       |
1761                       Assume               |
1762                       Contract_Cases       |
1763                       Debug                |
1764                       Invariant            |
1765                       Invariant'Class      |
1766                       Loop_Invariant       |
1767                       Loop_Variant         |
1768                       Postcondition        |
1769                       Precondition         |
1770                       Predicate            |
1771                       Refined_Post         |
1772                       Statement_Assertions
1774 POLICY_IDENTIFIER ::= Check | Disable | Ignore
1775 @end example
1777 This is a standard Ada 2012 pragma that is available as an
1778 implementation-defined pragma in earlier versions of Ada.
1779 The assertion kinds @cite{RM_ASSERTION_KIND} are those defined in
1780 the Ada standard. The assertion kinds @cite{ID_ASSERTION_KIND}
1781 are implementation defined additions recognized by the GNAT compiler.
1783 The pragma applies in both cases to pragmas and aspects with matching
1784 names, e.g. @cite{Pre} applies to the Pre aspect, and @cite{Precondition}
1785 applies to both the @cite{Precondition} pragma
1786 and the aspect @cite{Precondition}. Note that the identifiers for
1787 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1788 Pre_Class and Post_Class), since these pragmas are intended to be
1789 identical to the corresponding aspects).
1791 If the policy is @cite{CHECK}, then assertions are enabled, i.e.
1792 the corresponding pragma or aspect is activated.
1793 If the policy is @cite{IGNORE}, then assertions are ignored, i.e.
1794 the corresponding pragma or aspect is deactivated.
1795 This pragma overrides the effect of the @emph{-gnata} switch on the
1796 command line.
1798 The implementation defined policy @cite{DISABLE} is like
1799 @cite{IGNORE} except that it completely disables semantic
1800 checking of the corresponding pragma or aspect. This is
1801 useful when the pragma or aspect argument references subprograms
1802 in a with'ed package which is replaced by a dummy package
1803 for the final build.
1805 The implementation defined assertion kind @cite{Assertions} applies to all
1806 assertion kinds. The form with no assertion kind given implies this
1807 choice, so it applies to all assertion kinds (RM defined, and
1808 implementation defined).
1810 The implementation defined assertion kind @cite{Statement_Assertions}
1811 applies to @cite{Assert}, @cite{Assert_And_Cut},
1812 @cite{Assume}, @cite{Loop_Invariant}, and @cite{Loop_Variant}.
1814 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1815 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2a}
1816 @section Pragma Assume
1819 Syntax:
1821 @example
1822 pragma Assume (
1823   boolean_EXPRESSION
1824   [, string_EXPRESSION]);
1825 @end example
1827 The effect of this pragma is identical to that of pragma @cite{Assert},
1828 except that in an @cite{Assertion_Policy} pragma, the identifier
1829 @cite{Assume} is used to control whether it is ignored or checked
1830 (or disabled).
1832 The intention is that this be used for assumptions about the
1833 external environment. So you cannot expect to verify formally
1834 or informally that the condition is met, this must be
1835 established by examining things outside the program itself.
1836 For example, we may have code that depends on the size of
1837 @cite{Long_Long_Integer} being at least 64. So we could write:
1839 @example
1840 pragma Assume (Long_Long_Integer'Size >= 64);
1841 @end example
1843 This assumption cannot be proved from the program itself,
1844 but it acts as a useful run-time check that the assumption
1845 is met, and documents the need to ensure that it is met by
1846 reference to information outside the program.
1848 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1849 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2b}
1850 @section Pragma Assume_No_Invalid_Values
1853 @geindex Invalid representations
1855 @geindex Invalid values
1857 Syntax:
1859 @example
1860 pragma Assume_No_Invalid_Values (On | Off);
1861 @end example
1863 This is a configuration pragma that controls the assumptions made by the
1864 compiler about the occurrence of invalid representations (invalid values)
1865 in the code.
1867 The default behavior (corresponding to an Off argument for this pragma), is
1868 to assume that values may in general be invalid unless the compiler can
1869 prove they are valid. Consider the following example:
1871 @example
1872 V1 : Integer range 1 .. 10;
1873 V2 : Integer range 11 .. 20;
1875 for J in V2 .. V1 loop
1876    ...
1877 end loop;
1878 @end example
1880 if V1 and V2 have valid values, then the loop is known at compile
1881 time not to execute since the lower bound must be greater than the
1882 upper bound. However in default mode, no such assumption is made,
1883 and the loop may execute. If @cite{Assume_No_Invalid_Values (On)}
1884 is given, the compiler will assume that any occurrence of a variable
1885 other than in an explicit @cite{'Valid} test always has a valid
1886 value, and the loop above will be optimized away.
1888 The use of @cite{Assume_No_Invalid_Values (On)} is appropriate if
1889 you know your code is free of uninitialized variables and other
1890 possible sources of invalid representations, and may result in
1891 more efficient code. A program that accesses an invalid representation
1892 with this pragma in effect is erroneous, so no guarantees can be made
1893 about its behavior.
1895 It is peculiar though permissible to use this pragma in conjunction
1896 with validity checking (-gnatVa). In such cases, accessing invalid
1897 values will generally give an exception, though formally the program
1898 is erroneous so there are no guarantees that this will always be the
1899 case, and it is recommended that these two options not be used together.
1901 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
1902 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{2c}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2d}
1903 @section Pragma Async_Readers
1906 Syntax:
1908 @example
1909 pragma Asynch_Readers   [ (boolean_EXPRESSION) ];
1910 @end example
1912 For the semantics of this pragma, see the entry for aspect @cite{Async_Readers} in
1913 the SPARK 2014 Reference Manual, section 7.1.2.
1915 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
1916 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{2e}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{2f}
1917 @section Pragma Async_Writers
1920 Syntax:
1922 @example
1923 pragma Asynch_Writers   [ (boolean_EXPRESSION) ];
1924 @end example
1926 For the semantics of this pragma, see the entry for aspect @cite{Async_Writers} in
1927 the SPARK 2014 Reference Manual, section 7.1.2.
1929 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
1930 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{30}
1931 @section Pragma Attribute_Definition
1934 Syntax:
1936 @example
1937 pragma Attribute_Definition
1938   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1939    [Entity     =>] LOCAL_NAME,
1940    [Expression =>] EXPRESSION | NAME);
1941 @end example
1943 If @cite{Attribute} is a known attribute name, this pragma is equivalent to
1944 the attribute definition clause:
1946 @example
1947 for Entity'Attribute use Expression;
1948 @end example
1950 If @cite{Attribute} is not a recognized attribute name, the pragma is
1951 ignored, and a warning is emitted. This allows source
1952 code to be written that takes advantage of some new attribute, while remaining
1953 compilable with earlier compilers.
1955 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
1956 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{31}
1957 @section Pragma C_Pass_By_Copy
1960 @geindex Passing by copy
1962 Syntax:
1964 @example
1965 pragma C_Pass_By_Copy
1966   ([Max_Size =>] static_integer_EXPRESSION);
1967 @end example
1969 Normally the default mechanism for passing C convention records to C
1970 convention subprograms is to pass them by reference, as suggested by RM
1971 B.3(69).  Use the configuration pragma @cite{C_Pass_By_Copy} to change
1972 this default, by requiring that record formal parameters be passed by
1973 copy if all of the following conditions are met:
1976 @itemize *
1978 @item 
1979 The size of the record type does not exceed the value specified for
1980 @cite{Max_Size}.
1982 @item 
1983 The record type has @cite{Convention C}.
1985 @item 
1986 The formal parameter has this record type, and the subprogram has a
1987 foreign (non-Ada) convention.
1988 @end itemize
1990 If these conditions are met the argument is passed by copy; i.e., in a
1991 manner consistent with what C expects if the corresponding formal in the
1992 C prototype is a struct (rather than a pointer to a struct).
1994 You can also pass records by copy by specifying the convention
1995 @cite{C_Pass_By_Copy} for the record type, or by using the extended
1996 @cite{Import} and @cite{Export} pragmas, which allow specification of
1997 passing mechanisms on a parameter by parameter basis.
1999 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2000 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{32}
2001 @section Pragma Check
2004 @geindex Assertions
2006 @geindex Named assertions
2008 Syntax:
2010 @example
2011 pragma Check (
2012      [Name    =>] CHECK_KIND,
2013      [Check   =>] Boolean_EXPRESSION
2014   [, [Message =>] string_EXPRESSION] );
2016 CHECK_KIND ::= IDENTIFIER           |
2017                Pre'Class            |
2018                Post'Class           |
2019                Type_Invariant'Class |
2020                Invariant'Class
2021 @end example
2023 This pragma is similar to the predefined pragma @cite{Assert} except that an
2024 extra identifier argument is present. In conjunction with pragma
2025 @cite{Check_Policy}, this can be used to define groups of assertions that can
2026 be independently controlled. The identifier @cite{Assertion} is special, it
2027 refers to the normal set of pragma @cite{Assert} statements.
2029 Checks introduced by this pragma are normally deactivated by default. They can
2030 be activated either by the command line option @emph{-gnata}, which turns on
2031 all checks, or individually controlled using pragma @cite{Check_Policy}.
2033 The identifiers @cite{Assertions} and @cite{Statement_Assertions} are not
2034 permitted as check kinds, since this would cause confusion with the use
2035 of these identifiers in @cite{Assertion_Policy} and @cite{Check_Policy}
2036 pragmas, where they are used to refer to sets of assertions.
2038 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2039 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{33}
2040 @section Pragma Check_Float_Overflow
2043 @geindex Floating-point overflow
2045 Syntax:
2047 @example
2048 pragma Check_Float_Overflow;
2049 @end example
2051 In Ada, the predefined floating-point types (@cite{Short_Float},
2052 @cite{Float}, @cite{Long_Float}, @cite{Long_Long_Float}) are
2053 defined to be @emph{unconstrained}. This means that even though each
2054 has a well-defined base range, an operation that delivers a result
2055 outside this base range is not required to raise an exception.
2056 This implementation permission accommodates the notion
2057 of infinities in IEEE floating-point, and corresponds to the
2058 efficient execution mode on most machines. GNAT will not raise
2059 overflow exceptions on these machines; instead it will generate
2060 infinities and NaN's as defined in the IEEE standard.
2062 Generating infinities, although efficient, is not always desirable.
2063 Often the preferable approach is to check for overflow, even at the
2064 (perhaps considerable) expense of run-time performance.
2065 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2066 range constraints -- and indeed such a subtype
2067 can have the same base range as its base type. For example:
2069 @example
2070 subtype My_Float is Float range Float'Range;
2071 @end example
2073 Here @cite{My_Float} has the same range as
2074 @cite{Float} but is constrained, so operations on
2075 @cite{My_Float} values will be checked for overflow
2076 against this range.
2078 This style will achieve the desired goal, but
2079 it is often more convenient to be able to simply use
2080 the standard predefined floating-point types as long
2081 as overflow checking could be guaranteed.
2082 The @cite{Check_Float_Overflow}
2083 configuration pragma achieves this effect. If a unit is compiled
2084 subject to this configuration pragma, then all operations
2085 on predefined floating-point types including operations on
2086 base types of these floating-point types will be treated as
2087 though those types were constrained, and overflow checks
2088 will be generated. The @cite{Constraint_Error}
2089 exception is raised if the result is out of range.
2091 This mode can also be set by use of the compiler
2092 switch @emph{-gnateF}.
2094 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2095 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{34}
2096 @section Pragma Check_Name
2099 @geindex Defining check names
2101 @geindex Check names
2102 @geindex defining
2104 Syntax:
2106 @example
2107 pragma Check_Name (check_name_IDENTIFIER);
2108 @end example
2110 This is a configuration pragma that defines a new implementation
2111 defined check name (unless IDENTIFIER matches one of the predefined
2112 check names, in which case the pragma has no effect). Check names
2113 are global to a partition, so if two or more configuration pragmas
2114 are present in a partition mentioning the same name, only one new
2115 check name is introduced.
2117 An implementation defined check name introduced with this pragma may
2118 be used in only three contexts: @cite{pragma Suppress},
2119 @cite{pragma Unsuppress},
2120 and as the prefix of a @cite{Check_Name'Enabled} attribute reference. For
2121 any of these three cases, the check name must be visible. A check
2122 name is visible if it is in the configuration pragmas applying to
2123 the current unit, or if it appears at the start of any unit that
2124 is part of the dependency set of the current unit (e.g., units that
2125 are mentioned in @cite{with} clauses).
2127 Check names introduced by this pragma are subject to control by compiler
2128 switches (in particular -gnatp) in the usual manner.
2130 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2131 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{35}
2132 @section Pragma Check_Policy
2135 @geindex Controlling assertions
2137 @geindex Assertions
2138 @geindex control
2140 @geindex Check pragma control
2142 @geindex Named assertions
2144 Syntax:
2146 @example
2147 pragma Check_Policy
2148  ([Name   =>] CHECK_KIND,
2149   [Policy =>] POLICY_IDENTIFIER);
2151 pragma Check_Policy (
2152     CHECK_KIND => POLICY_IDENTIFIER
2153  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2155 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2157 CHECK_KIND ::= IDENTIFIER           |
2158                Pre'Class            |
2159                Post'Class           |
2160                Type_Invariant'Class |
2161                Invariant'Class
2163 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2164 avoids confusion between the two possible syntax forms for this pragma.
2166 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2167 @end example
2169 This pragma is used to set the checking policy for assertions (specified
2170 by aspects or pragmas), the @cite{Debug} pragma, or additional checks
2171 to be checked using the @cite{Check} pragma. It may appear either as
2172 a configuration pragma, or within a declarative part of package. In the
2173 latter case, it applies from the point where it appears to the end of
2174 the declarative region (like pragma @cite{Suppress}).
2176 The @cite{Check_Policy} pragma is similar to the
2177 predefined @cite{Assertion_Policy} pragma,
2178 and if the check kind corresponds to one of the assertion kinds that
2179 are allowed by @cite{Assertion_Policy}, then the effect is identical.
2181 If the first argument is Debug, then the policy applies to Debug pragmas,
2182 disabling their effect if the policy is @cite{OFF}, @cite{DISABLE}, or
2183 @cite{IGNORE}, and allowing them to execute with normal semantics if
2184 the policy is @cite{ON} or @cite{CHECK}. In addition if the policy is
2185 @cite{DISABLE}, then the procedure call in @cite{Debug} pragmas will
2186 be totally ignored and not analyzed semantically.
2188 Finally the first argument may be some other identifier than the above
2189 possibilities, in which case it controls a set of named assertions
2190 that can be checked using pragma @cite{Check}. For example, if the pragma:
2192 @example
2193 pragma Check_Policy (Critical_Error, OFF);
2194 @end example
2196 is given, then subsequent @cite{Check} pragmas whose first argument is also
2197 @cite{Critical_Error} will be disabled.
2199 The check policy is @cite{OFF} to turn off corresponding checks, and @cite{ON}
2200 to turn on corresponding checks. The default for a set of checks for which no
2201 @cite{Check_Policy} is given is @cite{OFF} unless the compiler switch
2202 @emph{-gnata} is given, which turns on all checks by default.
2204 The check policy settings @cite{CHECK} and @cite{IGNORE} are recognized
2205 as synonyms for @cite{ON} and @cite{OFF}. These synonyms are provided for
2206 compatibility with the standard @cite{Assertion_Policy} pragma. The check
2207 policy setting @cite{DISABLE} causes the second argument of a corresponding
2208 @cite{Check} pragma to be completely ignored and not analyzed.
2210 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2211 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{36}
2212 @section Pragma Comment
2215 Syntax:
2217 @example
2218 pragma Comment (static_string_EXPRESSION);
2219 @end example
2221 This is almost identical in effect to pragma @cite{Ident}.  It allows the
2222 placement of a comment into the object file and hence into the
2223 executable file if the operating system permits such usage.  The
2224 difference is that @cite{Comment}, unlike @cite{Ident}, has
2225 no limitations on placement of the pragma (it can be placed
2226 anywhere in the main source unit), and if more than one pragma
2227 is used, all comments are retained.
2229 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2230 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{37}
2231 @section Pragma Common_Object
2234 Syntax:
2236 @example
2237 pragma Common_Object (
2238      [Internal =>] LOCAL_NAME
2239   [, [External =>] EXTERNAL_SYMBOL]
2240   [, [Size     =>] EXTERNAL_SYMBOL] );
2242 EXTERNAL_SYMBOL ::=
2243   IDENTIFIER
2244 | static_string_EXPRESSION
2245 @end example
2247 This pragma enables the shared use of variables stored in overlaid
2248 linker areas corresponding to the use of @cite{COMMON}
2249 in Fortran.  The single
2250 object @cite{LOCAL_NAME} is assigned to the area designated by
2251 the @cite{External} argument.
2252 You may define a record to correspond to a series
2253 of fields.  The @cite{Size} argument
2254 is syntax checked in GNAT, but otherwise ignored.
2256 @cite{Common_Object} is not supported on all platforms.  If no
2257 support is available, then the code generator will issue a message
2258 indicating that the necessary attribute for implementation of this
2259 pragma is not available.
2261 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2262 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{38}
2263 @section Pragma Compile_Time_Error
2266 Syntax:
2268 @example
2269 pragma Compile_Time_Error
2270          (boolean_EXPRESSION, static_string_EXPRESSION);
2271 @end example
2273 This pragma can be used to generate additional compile time
2274 error messages. It
2275 is particularly useful in generics, where errors can be issued for
2276 specific problematic instantiations. The first parameter is a boolean
2277 expression. The pragma is effective only if the value of this expression
2278 is known at compile time, and has the value True. The set of expressions
2279 whose values are known at compile time includes all static boolean
2280 expressions, and also other values which the compiler can determine
2281 at compile time (e.g., the size of a record type set by an explicit
2282 size representation clause, or the value of a variable which was
2283 initialized to a constant and is known not to have been modified).
2284 If these conditions are met, an error message is generated using
2285 the value given as the second argument. This string value may contain
2286 embedded ASCII.LF characters to break the message into multiple lines.
2288 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2289 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{39}
2290 @section Pragma Compile_Time_Warning
2293 Syntax:
2295 @example
2296 pragma Compile_Time_Warning
2297          (boolean_EXPRESSION, static_string_EXPRESSION);
2298 @end example
2300 Same as pragma Compile_Time_Error, except a warning is issued instead
2301 of an error message. Note that if this pragma is used in a package that
2302 is with'ed by a client, the client will get the warning even though it
2303 is issued by a with'ed package (normally warnings in with'ed units are
2304 suppressed, but this is a special exception to that rule).
2306 One typical use is within a generic where compile time known characteristics
2307 of formal parameters are tested, and warnings given appropriately. Another use
2308 with a first parameter of True is to warn a client about use of a package,
2309 for example that it is not fully implemented.
2311 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2312 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3a}
2313 @section Pragma Compiler_Unit
2316 Syntax:
2318 @example
2319 pragma Compiler_Unit;
2320 @end example
2322 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2323 retained so that old versions of the GNAT run-time that use this pragma can
2324 be compiled with newer versions of the compiler.
2326 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2327 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{3b}
2328 @section Pragma Compiler_Unit_Warning
2331 Syntax:
2333 @example
2334 pragma Compiler_Unit_Warning;
2335 @end example
2337 This pragma is intended only for internal use in the GNAT run-time library.
2338 It indicates that the unit is used as part of the compiler build. The effect
2339 is to generate warnings for the use of constructs (for example, conditional
2340 expressions) that would cause trouble when bootstrapping using an older
2341 version of GNAT. For the exact list of restrictions, see the compiler sources
2342 and references to Check_Compiler_Unit.
2344 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2345 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{3c}
2346 @section Pragma Complete_Representation
2349 Syntax:
2351 @example
2352 pragma Complete_Representation;
2353 @end example
2355 This pragma must appear immediately within a record representation
2356 clause. Typical placements are before the first component clause
2357 or after the last component clause. The effect is to give an error
2358 message if any component is missing a component clause. This pragma
2359 may be used to ensure that a record representation clause is
2360 complete, and that this invariant is maintained if fields are
2361 added to the record in the future.
2363 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2364 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3d}
2365 @section Pragma Complex_Representation
2368 Syntax:
2370 @example
2371 pragma Complex_Representation
2372         ([Entity =>] LOCAL_NAME);
2373 @end example
2375 The @cite{Entity} argument must be the name of a record type which has
2376 two fields of the same floating-point type.  The effect of this pragma is
2377 to force gcc to use the special internal complex representation form for
2378 this record, which may be more efficient.  Note that this may result in
2379 the code for this type not conforming to standard ABI (application
2380 binary interface) requirements for the handling of record types.  For
2381 example, in some environments, there is a requirement for passing
2382 records by pointer, and the use of this pragma may result in passing
2383 this type in floating-point registers.
2385 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2386 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{3e}
2387 @section Pragma Component_Alignment
2390 @geindex Alignments of components
2392 @geindex Pragma Component_Alignment
2394 Syntax:
2396 @example
2397 pragma Component_Alignment (
2398      [Form =>] ALIGNMENT_CHOICE
2399   [, [Name =>] type_LOCAL_NAME]);
2401 ALIGNMENT_CHOICE ::=
2402   Component_Size
2403 | Component_Size_4
2404 | Storage_Unit
2405 | Default
2406 @end example
2408 Specifies the alignment of components in array or record types.
2409 The meaning of the @cite{Form} argument is as follows:
2411 @quotation
2413 @geindex Component_Size (in pragma Component_Alignment)
2414 @end quotation
2417 @table @asis
2419 @item @emph{Component_Size}
2421 Aligns scalar components and subcomponents of the array or record type
2422 on boundaries appropriate to their inherent size (naturally
2423 aligned).  For example, 1-byte components are aligned on byte boundaries,
2424 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2425 integer components are aligned on 4-byte boundaries and so on.  These
2426 alignment rules correspond to the normal rules for C compilers on all
2427 machines except the VAX.
2429 @geindex Component_Size_4 (in pragma Component_Alignment)
2431 @item @emph{Component_Size_4}
2433 Naturally aligns components with a size of four or fewer
2434 bytes.  Components that are larger than 4 bytes are placed on the next
2435 4-byte boundary.
2437 @geindex Storage_Unit (in pragma Component_Alignment)
2439 @item @emph{Storage_Unit}
2441 Specifies that array or record components are byte aligned, i.e.,
2442 aligned on boundaries determined by the value of the constant
2443 @cite{System.Storage_Unit}.
2445 @geindex Default (in pragma Component_Alignment)
2447 @item @emph{Default}
2449 Specifies that array or record components are aligned on default
2450 boundaries, appropriate to the underlying hardware or operating system or
2451 both. The @cite{Default} choice is the same as @cite{Component_Size} (natural
2452 alignment).
2453 @end table
2455 If the @cite{Name} parameter is present, @cite{type_LOCAL_NAME} must
2456 refer to a local record or array type, and the specified alignment
2457 choice applies to the specified type.  The use of
2458 @cite{Component_Alignment} together with a pragma @cite{Pack} causes the
2459 @cite{Component_Alignment} pragma to be ignored.  The use of
2460 @cite{Component_Alignment} together with a record representation clause
2461 is only effective for fields not specified by the representation clause.
2463 If the @cite{Name} parameter is absent, the pragma can be used as either
2464 a configuration pragma, in which case it applies to one or more units in
2465 accordance with the normal rules for configuration pragmas, or it can be
2466 used within a declarative part, in which case it applies to types that
2467 are declared within this declarative part, or within any nested scope
2468 within this declarative part.  In either case it specifies the alignment
2469 to be applied to any record or array type which has otherwise standard
2470 representation.
2472 If the alignment for a record or array type is not specified (using
2473 pragma @cite{Pack}, pragma @cite{Component_Alignment}, or a record rep
2474 clause), the GNAT uses the default alignment as described previously.
2476 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2477 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{3f}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{40}
2478 @section Pragma Constant_After_Elaboration
2481 Syntax:
2483 @example
2484 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2485 @end example
2487 For the semantics of this pragma, see the entry for aspect
2488 @cite{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2490 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2491 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{41}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{42}
2492 @section Pragma Contract_Cases
2495 @geindex Contract cases
2497 Syntax:
2499 @example
2500 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2502 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2504 CASE_GUARD ::= boolean_EXPRESSION | others
2506 CONSEQUENCE ::= boolean_EXPRESSION
2507 @end example
2509 The @cite{Contract_Cases} pragma allows defining fine-grain specifications
2510 that can complement or replace the contract given by a precondition and a
2511 postcondition. Additionally, the @cite{Contract_Cases} pragma can be used
2512 by testing and formal verification tools. The compiler checks its validity and,
2513 depending on the assertion policy at the point of declaration of the pragma,
2514 it may insert a check in the executable. For code generation, the contract
2515 cases
2517 @example
2518 pragma Contract_Cases (
2519   Cond1 => Pred1,
2520   Cond2 => Pred2);
2521 @end example
2523 are equivalent to
2525 @example
2526 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2527 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2528 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2529 pragma Postcondition (if C1 then Pred1);
2530 pragma Postcondition (if C2 then Pred2);
2531 @end example
2533 The precondition ensures that one and only one of the conditions is
2534 satisfied on entry to the subprogram.
2535 The postcondition ensures that for the condition that was True on entry,
2536 the corrresponding consequence is True on exit. Other consequence expressions
2537 are not evaluated.
2539 A precondition @cite{P} and postcondition @cite{Q} can also be
2540 expressed as contract cases:
2542 @example
2543 pragma Contract_Cases (P => Q);
2544 @end example
2546 The placement and visibility rules for @cite{Contract_Cases} pragmas are
2547 identical to those described for preconditions and postconditions.
2549 The compiler checks that boolean expressions given in conditions and
2550 consequences are valid, where the rules for conditions are the same as
2551 the rule for an expression in @cite{Precondition} and the rules for
2552 consequences are the same as the rule for an expression in
2553 @cite{Postcondition}. In particular, attributes @cite{'Old} and
2554 @cite{'Result} can only be used within consequence expressions.
2555 The condition for the last contract case may be @cite{others}, to denote
2556 any case not captured by the previous cases. The
2557 following is an example of use within a package spec:
2559 @example
2560 package Math_Functions is
2561    ...
2562    function Sqrt (Arg : Float) return Float;
2563    pragma Contract_Cases ((Arg in 0 .. 99) => Sqrt'Result < 10,
2564                           Arg >= 100       => Sqrt'Result >= 10,
2565                           others           => Sqrt'Result = 0);
2566    ...
2567 end Math_Functions;
2568 @end example
2570 The meaning of contract cases is that only one case should apply at each
2571 call, as determined by the corresponding condition evaluating to True,
2572 and that the consequence for this case should hold when the subprogram
2573 returns.
2575 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2576 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{43}
2577 @section Pragma Convention_Identifier
2580 @geindex Conventions
2581 @geindex synonyms
2583 Syntax:
2585 @example
2586 pragma Convention_Identifier (
2587          [Name =>]       IDENTIFIER,
2588          [Convention =>] convention_IDENTIFIER);
2589 @end example
2591 This pragma provides a mechanism for supplying synonyms for existing
2592 convention identifiers. The @cite{Name} identifier can subsequently
2593 be used as a synonym for the given convention in other pragmas (including
2594 for example pragma @cite{Import} or another @cite{Convention_Identifier}
2595 pragma). As an example of the use of this, suppose you had legacy code
2596 which used Fortran77 as the identifier for Fortran. Then the pragma:
2598 @example
2599 pragma Convention_Identifier (Fortran77, Fortran);
2600 @end example
2602 would allow the use of the convention identifier @cite{Fortran77} in
2603 subsequent code, avoiding the need to modify the sources. As another
2604 example, you could use this to parameterize convention requirements
2605 according to systems. Suppose you needed to use @cite{Stdcall} on
2606 windows systems, and @cite{C} on some other system, then you could
2607 define a convention identifier @cite{Library} and use a single
2608 @cite{Convention_Identifier} pragma to specify which convention
2609 would be used system-wide.
2611 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2612 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{44}
2613 @section Pragma CPP_Class
2616 @geindex Interfacing with C++
2618 Syntax:
2620 @example
2621 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2622 @end example
2624 The argument denotes an entity in the current declarative region that is
2625 declared as a record type. It indicates that the type corresponds to an
2626 externally declared C++ class type, and is to be laid out the same way
2627 that C++ would lay out the type. If the C++ class has virtual primitives
2628 then the record must be declared as a tagged record type.
2630 Types for which @cite{CPP_Class} is specified do not have assignment or
2631 equality operators defined (such operations can be imported or declared
2632 as subprograms as required). Initialization is allowed only by constructor
2633 functions (see pragma @cite{CPP_Constructor}). Such types are implicitly
2634 limited if not explicitly declared as limited or derived from a limited
2635 type, and an error is issued in that case.
2637 See @ref{45,,Interfacing to C++} for related information.
2639 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
2640 for backward compatibility but its functionality is available
2641 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
2643 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2644 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{46}
2645 @section Pragma CPP_Constructor
2648 @geindex Interfacing with C++
2650 Syntax:
2652 @example
2653 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2654   [, [External_Name =>] static_string_EXPRESSION ]
2655   [, [Link_Name     =>] static_string_EXPRESSION ]);
2656 @end example
2658 This pragma identifies an imported function (imported in the usual way
2659 with pragma @cite{Import}) as corresponding to a C++ constructor. If
2660 @cite{External_Name} and @cite{Link_Name} are not specified then the
2661 @cite{Entity} argument is a name that must have been previously mentioned
2662 in a pragma @cite{Import} with @cite{Convention} = @cite{CPP}. Such name
2663 must be of one of the following forms:
2666 @itemize *
2668 @item 
2669 @strong{function} @cite{Fname} @strong{return} T`
2671 @item 
2672 @strong{function} @cite{Fname} @strong{return} T'Class
2674 @item 
2675 @strong{function} @cite{Fname} (...) @strong{return} T`
2677 @item 
2678 @strong{function} @cite{Fname} (...) @strong{return} T'Class
2679 @end itemize
2681 where @cite{T} is a limited record type imported from C++ with pragma
2682 @cite{Import} and @cite{Convention} = @cite{CPP}.
2684 The first two forms import the default constructor, used when an object
2685 of type @cite{T} is created on the Ada side with no explicit constructor.
2686 The latter two forms cover all the non-default constructors of the type.
2687 See the GNAT User's Guide for details.
2689 If no constructors are imported, it is impossible to create any objects
2690 on the Ada side and the type is implicitly declared abstract.
2692 Pragma @cite{CPP_Constructor} is intended primarily for automatic generation
2693 using an automatic binding generator tool (such as the @cite{-fdump-ada-spec}
2694 GCC switch).
2695 See @ref{45,,Interfacing to C++} for more related information.
2697 Note: The use of functions returning class-wide types for constructors is
2698 currently obsolete. They are supported for backward compatibility. The
2699 use of functions returning the type T leave the Ada sources more clear
2700 because the imported C++ constructors always return an object of type T;
2701 that is, they never return an object whose type is a descendant of type T.
2703 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2704 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{47}
2705 @section Pragma CPP_Virtual
2708 @geindex Interfacing to C++
2710 This pragma is now obsolete and, other than generating a warning if warnings
2711 on obsolescent features are enabled, is completely ignored.
2712 It is retained for compatibility
2713 purposes. It used to be required to ensure compoatibility with C++, but
2714 is no longer required for that purpose because GNAT generates
2715 the same object layout as the G++ compiler by default.
2717 See @ref{45,,Interfacing to C++} for related information.
2719 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2720 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{48}
2721 @section Pragma CPP_Vtable
2724 @geindex Interfacing with C++
2726 This pragma is now obsolete and, other than generating a warning if warnings
2727 on obsolescent features are enabled, is completely ignored.
2728 It used to be required to ensure compatibility with C++, but
2729 is no longer required for that purpose because GNAT generates
2730 the same object layout as the G++ compiler by default.
2732 See @ref{45,,Interfacing to C++} for related information.
2734 @node Pragma CPU,Pragma Default_Initial_Condition,Pragma CPP_Vtable,Implementation Defined Pragmas
2735 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{49}
2736 @section Pragma CPU
2739 Syntax:
2741 @example
2742 pragma CPU (EXPRESSION);
2743 @end example
2745 This pragma is standard in Ada 2012, but is available in all earlier
2746 versions of Ada as an implementation-defined pragma.
2747 See Ada 2012 Reference Manual for details.
2749 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma CPU,Implementation Defined Pragmas
2750 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4a}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{4b}
2751 @section Pragma Default_Initial_Condition
2754 Syntax:
2756 @example
2757 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2758 @end example
2760 For the semantics of this pragma, see the entry for aspect
2761 @cite{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2763 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2764 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4c}
2765 @section Pragma Debug
2768 Syntax:
2770 @example
2771 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2773 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2774   PROCEDURE_NAME
2775 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2776 @end example
2778 The procedure call argument has the syntactic form of an expression, meeting
2779 the syntactic requirements for pragmas.
2781 If debug pragmas are not enabled or if the condition is present and evaluates
2782 to False, this pragma has no effect. If debug pragmas are enabled, the
2783 semantics of the pragma is exactly equivalent to the procedure call statement
2784 corresponding to the argument with a terminating semicolon. Pragmas are
2785 permitted in sequences of declarations, so you can use pragma @cite{Debug} to
2786 intersperse calls to debug procedures in the middle of declarations. Debug
2787 pragmas can be enabled either by use of the command line switch @emph{-gnata}
2788 or by use of the pragma @cite{Check_Policy} with a first argument of
2789 @cite{Debug}.
2791 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2792 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{4d}
2793 @section Pragma Debug_Policy
2796 Syntax:
2798 @example
2799 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2800 @end example
2802 This pragma is equivalent to a corresponding @cite{Check_Policy} pragma
2803 with a first argument of @cite{Debug}. It is retained for historical
2804 compatibility reasons.
2806 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2807 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{4e}
2808 @section Pragma Default_Scalar_Storage_Order
2811 @geindex Default_Scalar_Storage_Order
2813 @geindex Scalar_Storage_Order
2815 Syntax:
2817 @example
2818 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2819 @end example
2821 Normally if no explicit @cite{Scalar_Storage_Order} is given for a record
2822 type or array type, then the scalar storage order defaults to the ordinary
2823 default for the target. But this default may be overridden using this pragma.
2824 The pragma may appear as a configuration pragma, or locally within a package
2825 spec or declarative part. In the latter case, it applies to all subsequent
2826 types declared within that package spec or declarative part.
2828 The following example shows the use of this pragma:
2830 @example
2831 pragma Default_Scalar_Storage_Order (High_Order_First);
2832 with System; use System;
2833 package DSSO1 is
2834    type H1 is record
2835       a : Integer;
2836    end record;
2838    type L2 is record
2839       a : Integer;
2840    end record;
2841    for L2'Scalar_Storage_Order use Low_Order_First;
2843    type L2a is new L2;
2845    package Inner is
2846       type H3 is record
2847          a : Integer;
2848       end record;
2850       pragma Default_Scalar_Storage_Order (Low_Order_First);
2852       type L4 is record
2853          a : Integer;
2854       end record;
2855    end Inner;
2857    type H4a is new Inner.L4;
2859    type H5 is record
2860       a : Integer;
2861    end record;
2862 end DSSO1;
2863 @end example
2865 In this example record types L.. have @cite{Low_Order_First} scalar
2866 storage order, and record types H.. have @cite{High_Order_First}.
2867 Note that in the case of @cite{H4a}, the order is not inherited
2868 from the parent type. Only an explicitly set @cite{Scalar_Storage_Order}
2869 gets inherited on type derivation.
2871 If this pragma is used as a configuration pragma which appears within a
2872 configuration pragma file (as opposed to appearing explicitly at the start
2873 of a single unit), then the binder will require that all units in a partition
2874 be compiled in a similar manner, other than run-time units, which are not
2875 affected by this pragma. Note that the use of this form is discouraged because
2876 it may significantly degrade the run-time performance of the software, instead
2877 the default scalar storage order ought to be changed only on a local basis.
2879 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2880 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{4f}
2881 @section Pragma Default_Storage_Pool
2884 @geindex Default_Storage_Pool
2886 Syntax:
2888 @example
2889 pragma Default_Storage_Pool (storage_pool_NAME | null);
2890 @end example
2892 This pragma is standard in Ada 2012, but is available in all earlier
2893 versions of Ada as an implementation-defined pragma.
2894 See Ada 2012 Reference Manual for details.
2896 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
2897 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{50}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{51}
2898 @section Pragma Depends
2901 Syntax:
2903 @example
2904 pragma Depends (DEPENDENCY_RELATION);
2906 DEPENDENCY_RELATION ::=
2907      null
2908   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
2910 DEPENDENCY_CLAUSE ::=
2911     OUTPUT_LIST =>[+] INPUT_LIST
2912   | NULL_DEPENDENCY_CLAUSE
2914 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
2916 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
2918 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
2920 OUTPUT ::= NAME | FUNCTION_RESULT
2921 INPUT  ::= NAME
2923 where FUNCTION_RESULT is a function Result attribute_reference
2924 @end example
2926 For the semantics of this pragma, see the entry for aspect @cite{Depends} in the
2927 SPARK 2014 Reference Manual, section 6.1.5.
2929 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
2930 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{52}
2931 @section Pragma Detect_Blocking
2934 Syntax:
2936 @example
2937 pragma Detect_Blocking;
2938 @end example
2940 This is a standard pragma in Ada 2005, that is available in all earlier
2941 versions of Ada as an implementation-defined pragma.
2943 This is a configuration pragma that forces the detection of potentially
2944 blocking operations within a protected operation, and to raise Program_Error
2945 if that happens.
2947 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
2948 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{53}
2949 @section Pragma Disable_Atomic_Synchronization
2952 @geindex Atomic Synchronization
2954 Syntax:
2956 @example
2957 pragma Disable_Atomic_Synchronization [(Entity)];
2958 @end example
2960 Ada requires that accesses (reads or writes) of an atomic variable be
2961 regarded as synchronization points in the case of multiple tasks.
2962 Particularly in the case of multi-processors this may require special
2963 handling, e.g. the generation of memory barriers. This capability may
2964 be turned off using this pragma in cases where it is known not to be
2965 required.
2967 The placement and scope rules for this pragma are the same as those
2968 for @cite{pragma Suppress}. In particular it can be used as a
2969 configuration  pragma, or in a declaration sequence where it applies
2970 till the end of the scope. If an @cite{Entity} argument is present,
2971 the action applies only to that entity.
2973 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
2974 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{54}
2975 @section Pragma Dispatching_Domain
2978 Syntax:
2980 @example
2981 pragma Dispatching_Domain (EXPRESSION);
2982 @end example
2984 This pragma is standard in Ada 2012, but is available in all earlier
2985 versions of Ada as an implementation-defined pragma.
2986 See Ada 2012 Reference Manual for details.
2988 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
2989 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{55}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{56}
2990 @section Pragma Effective_Reads
2993 Syntax:
2995 @example
2996 pragma Effective_Reads  [ (boolean_EXPRESSION) ];
2997 @end example
2999 For the semantics of this pragma, see the entry for aspect @cite{Effective_Reads} in
3000 the SPARK 2014 Reference Manual, section 7.1.2.
3002 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3003 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{57}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{58}
3004 @section Pragma Effective_Writes
3007 Syntax:
3009 @example
3010 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3011 @end example
3013 For the semantics of this pragma, see the entry for aspect @cite{Effective_Writes}
3014 in the SPARK 2014 Reference Manual, section 7.1.2.
3016 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3017 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{59}
3018 @section Pragma Elaboration_Checks
3021 @geindex Elaboration control
3023 Syntax:
3025 @example
3026 pragma Elaboration_Checks (Dynamic | Static);
3027 @end example
3029 This is a configuration pragma that provides control over the
3030 elaboration model used by the compilation affected by the
3031 pragma.  If the parameter is @cite{Dynamic},
3032 then the dynamic elaboration
3033 model described in the Ada Reference Manual is used, as though
3034 the @emph{-gnatE} switch had been specified on the command
3035 line.  If the parameter is @cite{Static}, then the default GNAT static
3036 model is used.  This configuration pragma overrides the setting
3037 of the command line.  For full details on the elaboration models
3038 used by the GNAT compiler, see the chapter on elaboration order handling
3039 in the @emph{GNAT User's Guide}.
3041 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3042 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5a}
3043 @section Pragma Eliminate
3046 @geindex Elimination of unused subprograms
3048 Syntax:
3050 @example
3051 pragma Eliminate ([Entity          =>] DEFINING_DESIGNATOR,
3052                   [Source_Location =>] STRING_LITERAL);
3053 @end example
3055 The string literal given for the source location is a string which
3056 specifies the line number of the occurrence of the entity, using
3057 the syntax for SOURCE_TRACE given below:
3059 @example
3060 SOURCE_TRACE     ::= SOURCE_REFERENCE [LBRACKET SOURCE_TRACE RBRACKET]
3062 LBRACKET         ::= [
3063 RBRACKET         ::= ]
3065 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3067 LINE_NUMBER      ::= DIGIT @{DIGIT@}
3068 @end example
3070 Spaces around the colon in a @cite{Source_Reference} are optional.
3072 The @cite{DEFINING_DESIGNATOR} matches the defining designator used in an
3073 explicit subprogram declaration, where the @cite{entity} name in this
3074 designator appears on the source line specified by the source location.
3076 The source trace that is given as the @cite{Source_Location} shall obey the
3077 following rules. The @cite{FILE_NAME} is the short name (with no directory
3078 information) of an Ada source file, given using exactly the required syntax
3079 for the underlying file system (e.g. case is important if the underlying
3080 operating system is case sensitive). @cite{LINE_NUMBER} gives the line
3081 number of the occurrence of the @cite{entity}
3082 as a decimal literal without an exponent or point. If an @cite{entity} is not
3083 declared in a generic instantiation (this includes generic subprogram
3084 instances), the source trace includes only one source reference. If an entity
3085 is declared inside a generic instantiation, its source trace (when parsing
3086 from left to right) starts with the source location of the declaration of the
3087 entity in the generic unit and ends with the source location of the
3088 instantiation (it is given in square brackets). This approach is recursively
3089 used in case of nested instantiations: the rightmost (nested most deeply in
3090 square brackets) element of the source trace is the location of the outermost
3091 instantiation, the next to left element is the location of the next (first
3092 nested) instantiation in the code of the corresponding generic unit, and so
3093 on, and the leftmost element (that is out of any square brackets) is the
3094 location of the declaration of the entity to eliminate in a generic unit.
3096 Note that the @cite{Source_Location} argument specifies which of a set of
3097 similarly named entities is being eliminated, dealing both with overloading,
3098 and also appearance of the same entity name in different scopes.
3100 This pragma indicates that the given entity is not used in the program to be
3101 compiled and built. The effect of the pragma is to allow the compiler to
3102 eliminate the code or data associated with the named entity. Any reference to
3103 an eliminated entity causes a compile-time or link-time error.
3105 The intention of pragma @cite{Eliminate} is to allow a program to be compiled
3106 in a system-independent manner, with unused entities eliminated, without
3107 needing to modify the source text. Normally the required set of
3108 @cite{Eliminate} pragmas is constructed automatically using the gnatelim tool.
3110 Any source file change that removes, splits, or
3111 adds lines may make the set of Eliminate pragmas invalid because their
3112 @cite{Source_Location} argument values may get out of date.
3114 Pragma @cite{Eliminate} may be used where the referenced entity is a dispatching
3115 operation. In this case all the subprograms to which the given operation can
3116 dispatch are considered to be unused (are never called as a result of a direct
3117 or a dispatching call).
3119 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3120 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{5b}
3121 @section Pragma Enable_Atomic_Synchronization
3124 @geindex Atomic Synchronization
3126 Syntax:
3128 @example
3129 pragma Enable_Atomic_Synchronization [(Entity)];
3130 @end example
3132 Ada requires that accesses (reads or writes) of an atomic variable be
3133 regarded as synchronization points in the case of multiple tasks.
3134 Particularly in the case of multi-processors this may require special
3135 handling, e.g. the generation of memory barriers. This synchronization
3136 is performed by default, but can be turned off using
3137 @cite{pragma Disable_Atomic_Synchronization}. The
3138 @cite{Enable_Atomic_Synchronization} pragma can be used to turn
3139 it back on.
3141 The placement and scope rules for this pragma are the same as those
3142 for @cite{pragma Unsuppress}. In particular it can be used as a
3143 configuration  pragma, or in a declaration sequence where it applies
3144 till the end of the scope. If an @cite{Entity} argument is present,
3145 the action applies only to that entity.
3147 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3148 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{5c}
3149 @section Pragma Export_Function
3152 @geindex Argument passing mechanisms
3154 Syntax:
3156 @example
3157 pragma Export_Function (
3158      [Internal         =>] LOCAL_NAME
3159   [, [External         =>] EXTERNAL_SYMBOL]
3160   [, [Parameter_Types  =>] PARAMETER_TYPES]
3161   [, [Result_Type      =>] result_SUBTYPE_MARK]
3162   [, [Mechanism        =>] MECHANISM]
3163   [, [Result_Mechanism =>] MECHANISM_NAME]);
3165 EXTERNAL_SYMBOL ::=
3166   IDENTIFIER
3167 | static_string_EXPRESSION
3168 | ""
3170 PARAMETER_TYPES ::=
3171   null
3172 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3174 TYPE_DESIGNATOR ::=
3175   subtype_NAME
3176 | subtype_Name ' Access
3178 MECHANISM ::=
3179   MECHANISM_NAME
3180 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3182 MECHANISM_ASSOCIATION ::=
3183   [formal_parameter_NAME =>] MECHANISM_NAME
3185 MECHANISM_NAME ::= Value | Reference
3186 @end example
3188 Use this pragma to make a function externally callable and optionally
3189 provide information on mechanisms to be used for passing parameter and
3190 result values.  We recommend, for the purposes of improving portability,
3191 this pragma always be used in conjunction with a separate pragma
3192 @cite{Export}, which must precede the pragma @cite{Export_Function}.
3193 GNAT does not require a separate pragma @cite{Export}, but if none is
3194 present, @cite{Convention Ada} is assumed, which is usually
3195 not what is wanted, so it is usually appropriate to use this
3196 pragma in conjunction with a @cite{Export} or @cite{Convention}
3197 pragma that specifies the desired foreign convention.
3198 Pragma @cite{Export_Function}
3199 (and @cite{Export}, if present) must appear in the same declarative
3200 region as the function to which they apply.
3202 @cite{internal_name} must uniquely designate the function to which the
3203 pragma applies.  If more than one function name exists of this name in
3204 the declarative part you must use the @cite{Parameter_Types} and
3205 @cite{Result_Type} parameters is mandatory to achieve the required
3206 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
3207 anonymous access parameter.
3209 @geindex Suppressing external name
3211 Special treatment is given if the EXTERNAL is an explicit null
3212 string or a static string expressions that evaluates to the null
3213 string. In this case, no external name is generated. This form
3214 still allows the specification of parameter mechanisms.
3216 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3217 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{5d}
3218 @section Pragma Export_Object
3221 Syntax:
3223 @example
3224 pragma Export_Object
3225       [Internal =>] LOCAL_NAME
3226    [, [External =>] EXTERNAL_SYMBOL]
3227    [, [Size     =>] EXTERNAL_SYMBOL]
3229 EXTERNAL_SYMBOL ::=
3230   IDENTIFIER
3231 | static_string_EXPRESSION
3232 @end example
3234 This pragma designates an object as exported, and apart from the
3235 extended rules for external symbols, is identical in effect to the use of
3236 the normal @cite{Export} pragma applied to an object.  You may use a
3237 separate Export pragma (and you probably should from the point of view
3238 of portability), but it is not required.  @cite{Size} is syntax checked,
3239 but otherwise ignored by GNAT.
3241 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3242 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{5e}
3243 @section Pragma Export_Procedure
3246 Syntax:
3248 @example
3249 pragma Export_Procedure (
3250      [Internal        =>] LOCAL_NAME
3251   [, [External        =>] EXTERNAL_SYMBOL]
3252   [, [Parameter_Types =>] PARAMETER_TYPES]
3253   [, [Mechanism       =>] MECHANISM]);
3255 EXTERNAL_SYMBOL ::=
3256   IDENTIFIER
3257 | static_string_EXPRESSION
3258 | ""
3260 PARAMETER_TYPES ::=
3261   null
3262 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3264 TYPE_DESIGNATOR ::=
3265   subtype_NAME
3266 | subtype_Name ' Access
3268 MECHANISM ::=
3269   MECHANISM_NAME
3270 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3272 MECHANISM_ASSOCIATION ::=
3273   [formal_parameter_NAME =>] MECHANISM_NAME
3275 MECHANISM_NAME ::= Value | Reference
3276 @end example
3278 This pragma is identical to @cite{Export_Function} except that it
3279 applies to a procedure rather than a function and the parameters
3280 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3281 GNAT does not require a separate pragma @cite{Export}, but if none is
3282 present, @cite{Convention Ada} is assumed, which is usually
3283 not what is wanted, so it is usually appropriate to use this
3284 pragma in conjunction with a @cite{Export} or @cite{Convention}
3285 pragma that specifies the desired foreign convention.
3287 @geindex Suppressing external name
3289 Special treatment is given if the EXTERNAL is an explicit null
3290 string or a static string expressions that evaluates to the null
3291 string. In this case, no external name is generated. This form
3292 still allows the specification of parameter mechanisms.
3294 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3295 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{5f}
3296 @section Pragma Export_Value
3299 Syntax:
3301 @example
3302 pragma Export_Value (
3303   [Value     =>] static_integer_EXPRESSION,
3304   [Link_Name =>] static_string_EXPRESSION);
3305 @end example
3307 This pragma serves to export a static integer value for external use.
3308 The first argument specifies the value to be exported. The Link_Name
3309 argument specifies the symbolic name to be associated with the integer
3310 value. This pragma is useful for defining a named static value in Ada
3311 that can be referenced in assembly language units to be linked with
3312 the application. This pragma is currently supported only for the
3313 AAMP target and is ignored for other targets.
3315 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3316 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{60}
3317 @section Pragma Export_Valued_Procedure
3320 Syntax:
3322 @example
3323 pragma Export_Valued_Procedure (
3324      [Internal        =>] LOCAL_NAME
3325   [, [External        =>] EXTERNAL_SYMBOL]
3326   [, [Parameter_Types =>] PARAMETER_TYPES]
3327   [, [Mechanism       =>] MECHANISM]);
3329 EXTERNAL_SYMBOL ::=
3330   IDENTIFIER
3331 | static_string_EXPRESSION
3332 | ""
3334 PARAMETER_TYPES ::=
3335   null
3336 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3338 TYPE_DESIGNATOR ::=
3339   subtype_NAME
3340 | subtype_Name ' Access
3342 MECHANISM ::=
3343   MECHANISM_NAME
3344 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3346 MECHANISM_ASSOCIATION ::=
3347   [formal_parameter_NAME =>] MECHANISM_NAME
3349 MECHANISM_NAME ::= Value | Reference
3350 @end example
3352 This pragma is identical to @cite{Export_Procedure} except that the
3353 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3354 mode @cite{OUT}, and externally the subprogram is treated as a function
3355 with this parameter as the result of the function.  GNAT provides for
3356 this capability to allow the use of @cite{OUT} and @cite{IN OUT}
3357 parameters in interfacing to external functions (which are not permitted
3358 in Ada functions).
3359 GNAT does not require a separate pragma @cite{Export}, but if none is
3360 present, @cite{Convention Ada} is assumed, which is almost certainly
3361 not what is wanted since the whole point of this pragma is to interface
3362 with foreign language functions, so it is usually appropriate to use this
3363 pragma in conjunction with a @cite{Export} or @cite{Convention}
3364 pragma that specifies the desired foreign convention.
3366 @geindex Suppressing external name
3368 Special treatment is given if the EXTERNAL is an explicit null
3369 string or a static string expressions that evaluates to the null
3370 string. In this case, no external name is generated. This form
3371 still allows the specification of parameter mechanisms.
3373 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3374 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{61}
3375 @section Pragma Extend_System
3378 @geindex System
3379 @geindex extending
3381 @geindex DEC Ada 83
3383 Syntax:
3385 @example
3386 pragma Extend_System ([Name =>] IDENTIFIER);
3387 @end example
3389 This pragma is used to provide backwards compatibility with other
3390 implementations that extend the facilities of package @cite{System}.  In
3391 GNAT, @cite{System} contains only the definitions that are present in
3392 the Ada RM.  However, other implementations, notably the DEC Ada 83
3393 implementation, provide many extensions to package @cite{System}.
3395 For each such implementation accommodated by this pragma, GNAT provides a
3396 package @cite{Aux_`xxx`}, e.g., @cite{Aux_DEC} for the DEC Ada 83
3397 implementation, which provides the required additional definitions.  You
3398 can use this package in two ways.  You can @cite{with} it in the normal
3399 way and access entities either by selection or using a @cite{use}
3400 clause.  In this case no special processing is required.
3402 However, if existing code contains references such as
3403 @cite{System.`xxx`} where @cite{xxx} is an entity in the extended
3404 definitions provided in package @cite{System}, you may use this pragma
3405 to extend visibility in @cite{System} in a non-standard way that
3406 provides greater compatibility with the existing code.  Pragma
3407 @cite{Extend_System} is a configuration pragma whose single argument is
3408 the name of the package containing the extended definition
3409 (e.g., @cite{Aux_DEC} for the DEC Ada case).  A unit compiled under
3410 control of this pragma will be processed using special visibility
3411 processing that looks in package @cite{System.Aux_`xxx`} where
3412 @cite{Aux_`xxx`} is the pragma argument for any entity referenced in
3413 package @cite{System}, but not found in package @cite{System}.
3415 You can use this pragma either to access a predefined @cite{System}
3416 extension supplied with the compiler, for example @cite{Aux_DEC} or
3417 you can construct your own extension unit following the above
3418 definition.  Note that such a package is a child of @cite{System}
3419 and thus is considered part of the implementation.
3420 To compile it you will have to use the @emph{-gnatg} switch
3421 for compiling System units, as explained in the
3422 GNAT User's Guide.
3424 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3425 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{62}
3426 @section Pragma Extensions_Allowed
3429 @geindex Ada Extensions
3431 @geindex GNAT Extensions
3433 Syntax:
3435 @example
3436 pragma Extensions_Allowed (On | Off);
3437 @end example
3439 This configuration pragma enables or disables the implementation
3440 extension mode (the use of Off as a parameter cancels the effect
3441 of the @emph{-gnatX} command switch).
3443 In extension mode, the latest version of the Ada language is
3444 implemented (currently Ada 2012), and in addition a small number
3445 of GNAT specific extensions are recognized as follows:
3448 @table @asis
3450 @item @emph{Constrained attribute for generic objects}
3452 The @cite{Constrained} attribute is permitted for objects of
3453 generic types. The result indicates if the corresponding actual
3454 is constrained.
3455 @end table
3457 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3458 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{63}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{64}
3459 @section Pragma Extensions_Visible
3462 Syntax:
3464 @example
3465 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3466 @end example
3468 For the semantics of this pragma, see the entry for aspect @cite{Extensions_Visible}
3469 in the SPARK 2014 Reference Manual, section 6.1.7.
3471 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3472 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{65}
3473 @section Pragma External
3476 Syntax:
3478 @example
3479 pragma External (
3480   [   Convention    =>] convention_IDENTIFIER,
3481   [   Entity        =>] LOCAL_NAME
3482   [, [External_Name =>] static_string_EXPRESSION ]
3483   [, [Link_Name     =>] static_string_EXPRESSION ]);
3484 @end example
3486 This pragma is identical in syntax and semantics to pragma
3487 @cite{Export} as defined in the Ada Reference Manual.  It is
3488 provided for compatibility with some Ada 83 compilers that
3489 used this pragma for exactly the same purposes as pragma
3490 @cite{Export} before the latter was standardized.
3492 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3493 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{66}
3494 @section Pragma External_Name_Casing
3497 @geindex Dec Ada 83 casing compatibility
3499 @geindex External Names
3500 @geindex casing
3502 @geindex Casing of External names
3504 Syntax:
3506 @example
3507 pragma External_Name_Casing (
3508   Uppercase | Lowercase
3509   [, Uppercase | Lowercase | As_Is]);
3510 @end example
3512 This pragma provides control over the casing of external names associated
3513 with Import and Export pragmas.  There are two cases to consider:
3516 @itemize *
3518 @item 
3519 Implicit external names
3521 Implicit external names are derived from identifiers.  The most common case
3522 arises when a standard Ada Import or Export pragma is used with only two
3523 arguments, as in:
3525 @example
3526 pragma Import (C, C_Routine);
3527 @end example
3529 Since Ada is a case-insensitive language, the spelling of the identifier in
3530 the Ada source program does not provide any information on the desired
3531 casing of the external name, and so a convention is needed.  In GNAT the
3532 default treatment is that such names are converted to all lower case
3533 letters.  This corresponds to the normal C style in many environments.
3534 The first argument of pragma @cite{External_Name_Casing} can be used to
3535 control this treatment.  If @cite{Uppercase} is specified, then the name
3536 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3537 then the normal default of all lower case letters will be used.
3539 This same implicit treatment is also used in the case of extended DEC Ada 83
3540 compatible Import and Export pragmas where an external name is explicitly
3541 specified using an identifier rather than a string.
3543 @item 
3544 Explicit external names
3546 Explicit external names are given as string literals.  The most common case
3547 arises when a standard Ada Import or Export pragma is used with three
3548 arguments, as in:
3550 @example
3551 pragma Import (C, C_Routine, "C_routine");
3552 @end example
3554 In this case, the string literal normally provides the exact casing required
3555 for the external name.  The second argument of pragma
3556 @cite{External_Name_Casing} may be used to modify this behavior.
3557 If @cite{Uppercase} is specified, then the name
3558 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3559 then the name will be forced to all lowercase letters.  A specification of
3560 @cite{As_Is} provides the normal default behavior in which the casing is
3561 taken from the string provided.
3562 @end itemize
3564 This pragma may appear anywhere that a pragma is valid.  In particular, it
3565 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3566 case it applies to all subsequent compilations, or it can be used as a program
3567 unit pragma, in which case it only applies to the current unit, or it can
3568 be used more locally to control individual Import/Export pragmas.
3570 It was primarily intended for use with OpenVMS systems, where many
3571 compilers convert all symbols to upper case by default.  For interfacing to
3572 such compilers (e.g., the DEC C compiler), it may be convenient to use
3573 the pragma:
3575 @example
3576 pragma External_Name_Casing (Uppercase, Uppercase);
3577 @end example
3579 to enforce the upper casing of all external symbols.
3581 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3582 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{67}
3583 @section Pragma Fast_Math
3586 Syntax:
3588 @example
3589 pragma Fast_Math;
3590 @end example
3592 This is a configuration pragma which activates a mode in which speed is
3593 considered more important for floating-point operations than absolutely
3594 accurate adherence to the requirements of the standard. Currently the
3595 following operations are affected:
3598 @table @asis
3600 @item @emph{Complex Multiplication}
3602 The normal simple formula for complex multiplication can result in intermediate
3603 overflows for numbers near the end of the range. The Ada standard requires that
3604 this situation be detected and corrected by scaling, but in Fast_Math mode such
3605 cases will simply result in overflow. Note that to take advantage of this you
3606 must instantiate your own version of @cite{Ada.Numerics.Generic_Complex_Types}
3607 under control of the pragma, rather than use the preinstantiated versions.
3608 @end table
3610 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3611 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{68}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{69}
3612 @section Pragma Favor_Top_Level
3615 Syntax:
3617 @example
3618 pragma Favor_Top_Level (type_NAME);
3619 @end example
3621 The named type must be an access-to-subprogram type. This pragma is an
3622 efficiency hint to the compiler, regarding the use of 'Access or
3623 'Unrestricted_Access on nested (non-library-level) subprograms. The
3624 pragma means that nested subprograms are not used with this type, or
3625 are rare, so that the generated code should be efficient in the
3626 top-level case. When this pragma is used, dynamically generated
3627 trampolines may be used on some targets for nested subprograms.
3628 See also the No_Implicit_Dynamic_Code restriction.
3630 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3631 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6a}
3632 @section Pragma Finalize_Storage_Only
3635 Syntax:
3637 @example
3638 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3639 @end example
3641 This pragma allows the compiler not to emit a Finalize call for objects
3642 defined at the library level.  This is mostly useful for types where
3643 finalization is only used to deal with storage reclamation since in most
3644 environments it is not necessary to reclaim memory just before terminating
3645 execution, hence the name.
3647 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3648 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{6b}
3649 @section Pragma Float_Representation
3652 Syntax:
3654 @example
3655 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3657 FLOAT_REP ::= VAX_Float | IEEE_Float
3658 @end example
3660 In the one argument form, this pragma is a configuration pragma which
3661 allows control over the internal representation chosen for the predefined
3662 floating point types declared in the packages @cite{Standard} and
3663 @cite{System}. This pragma is only provided for compatibility and has no effect.
3665 The two argument form specifies the representation to be used for
3666 the specified floating-point type. The argument must
3667 be @cite{IEEE_Float} to specify the use of IEEE format, as follows:
3670 @itemize *
3672 @item 
3673 For a digits value of 6, 32-bit IEEE short format will be used.
3675 @item 
3676 For a digits value of 15, 64-bit IEEE long format will be used.
3678 @item 
3679 No other value of digits is permitted.
3680 @end itemize
3682 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3683 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{6c}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6d}
3684 @section Pragma Ghost
3687 Syntax:
3689 @example
3690 pragma Ghost [ (boolean_EXPRESSION) ];
3691 @end example
3693 For the semantics of this pragma, see the entry for aspect @cite{Ghost} in the SPARK
3694 2014 Reference Manual, section 6.9.
3696 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
3697 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{6e}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{6f}
3698 @section Pragma Global
3701 Syntax:
3703 @example
3704 pragma Global (GLOBAL_SPECIFICATION);
3706 GLOBAL_SPECIFICATION ::=
3707      null
3708   | (GLOBAL_LIST)
3709   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
3711 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
3713 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
3714 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
3715 GLOBAL_ITEM   ::= NAME
3716 @end example
3718 For the semantics of this pragma, see the entry for aspect @cite{Global} in the
3719 SPARK 2014 Reference Manual, section 6.1.4.
3721 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3722 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{70}
3723 @section Pragma Ident
3726 Syntax:
3728 @example
3729 pragma Ident (static_string_EXPRESSION);
3730 @end example
3732 This pragma is identical in effect to pragma @cite{Comment}. It is provided
3733 for compatibility with other Ada compilers providing this pragma.
3735 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3736 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{71}
3737 @section Pragma Ignore_Pragma
3740 Syntax:
3742 @example
3743 pragma Ignore_Pragma (pragma_IDENTIFIER);
3744 @end example
3746 This is a configuration pragma
3747 that takes a single argument that is a simple identifier. Any subsequent
3748 use of a pragma whose pragma identifier matches this argument will be
3749 silently ignored. This may be useful when legacy code or code intended
3750 for compilation with some other compiler contains pragmas that match the
3751 name, but not the exact implementation, of a @cite{GNAT} pragma. The use of this
3752 pragma allows such pragmas to be ignored, which may be useful in @cite{CodePeer}
3753 mode, or during porting of legacy code.
3755 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
3756 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{72}
3757 @section Pragma Implementation_Defined
3760 Syntax:
3762 @example
3763 pragma Implementation_Defined (local_NAME);
3764 @end example
3766 This pragma marks a previously declared entioty as implementation-defined.
3767 For an overloaded entity, applies to the most recent homonym.
3769 @example
3770 pragma Implementation_Defined;
3771 @end example
3773 The form with no arguments appears anywhere within a scope, most
3774 typically a package spec, and indicates that all entities that are
3775 defined within the package spec are Implementation_Defined.
3777 This pragma is used within the GNAT runtime library to identify
3778 implementation-defined entities introduced in language-defined units,
3779 for the purpose of implementing the No_Implementation_Identifiers
3780 restriction.
3782 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3783 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{73}
3784 @section Pragma Implemented
3787 Syntax:
3789 @example
3790 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3792 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3793 @end example
3795 This is an Ada 2012 representation pragma which applies to protected, task
3796 and synchronized interface primitives. The use of pragma Implemented provides
3797 a way to impose a static requirement on the overriding operation by adhering
3798 to one of the three implementation kinds: entry, protected procedure or any of
3799 the above. This pragma is available in all earlier versions of Ada as an
3800 implementation-defined pragma.
3802 @example
3803 type Synch_Iface is synchronized interface;
3804 procedure Prim_Op (Obj : in out Iface) is abstract;
3805 pragma Implemented (Prim_Op, By_Protected_Procedure);
3807 protected type Prot_1 is new Synch_Iface with
3808    procedure Prim_Op;  --  Legal
3809 end Prot_1;
3811 protected type Prot_2 is new Synch_Iface with
3812    entry Prim_Op;      --  Illegal
3813 end Prot_2;
3815 task type Task_Typ is new Synch_Iface with
3816    entry Prim_Op;      --  Illegal
3817 end Task_Typ;
3818 @end example
3820 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3821 Implemented determines the runtime behavior of the requeue. Implementation kind
3822 By_Entry guarantees that the action of requeueing will proceed from an entry to
3823 another entry. Implementation kind By_Protected_Procedure transforms the
3824 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3825 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3826 the target's overriding subprogram kind.
3828 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
3829 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{74}
3830 @section Pragma Implicit_Packing
3833 @geindex Rational Profile
3835 Syntax:
3837 @example
3838 pragma Implicit_Packing;
3839 @end example
3841 This is a configuration pragma that requests implicit packing for packed
3842 arrays for which a size clause is given but no explicit pragma Pack or
3843 specification of Component_Size is present. It also applies to records
3844 where no record representation clause is present. Consider this example:
3846 @example
3847 type R is array (0 .. 7) of Boolean;
3848 for R'Size use 8;
3849 @end example
3851 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3852 does not change the layout of a composite object. So the Size clause in the
3853 above example is normally rejected, since the default layout of the array uses
3854 8-bit components, and thus the array requires a minimum of 64 bits.
3856 If this declaration is compiled in a region of code covered by an occurrence
3857 of the configuration pragma Implicit_Packing, then the Size clause in this
3858 and similar examples will cause implicit packing and thus be accepted. For
3859 this implicit packing to occur, the type in question must be an array of small
3860 components whose size is known at compile time, and the Size clause must
3861 specify the exact size that corresponds to the number of elements in the array
3862 multiplied by the size in bits of the component type (both single and
3863 multi-dimensioned arrays can be controlled with this pragma).
3865 @geindex Array packing
3867 Similarly, the following example shows the use in the record case
3869 @example
3870 type r is record
3871    a, b, c, d, e, f, g, h : boolean;
3872    chr                    : character;
3873 end record;
3874 for r'size use 16;
3875 @end example
3877 Without a pragma Pack, each Boolean field requires 8 bits, so the
3878 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
3879 sufficient. The use of pragma Implicit_Packing allows this record
3880 declaration to compile without an explicit pragma Pack.
3882 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
3883 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{75}
3884 @section Pragma Import_Function
3887 Syntax:
3889 @example
3890 pragma Import_Function (
3891      [Internal                 =>] LOCAL_NAME,
3892   [, [External                 =>] EXTERNAL_SYMBOL]
3893   [, [Parameter_Types          =>] PARAMETER_TYPES]
3894   [, [Result_Type              =>] SUBTYPE_MARK]
3895   [, [Mechanism                =>] MECHANISM]
3896   [, [Result_Mechanism         =>] MECHANISM_NAME]);
3898 EXTERNAL_SYMBOL ::=
3899   IDENTIFIER
3900 | static_string_EXPRESSION
3902 PARAMETER_TYPES ::=
3903   null
3904 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3906 TYPE_DESIGNATOR ::=
3907   subtype_NAME
3908 | subtype_Name ' Access
3910 MECHANISM ::=
3911   MECHANISM_NAME
3912 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3914 MECHANISM_ASSOCIATION ::=
3915   [formal_parameter_NAME =>] MECHANISM_NAME
3917 MECHANISM_NAME ::=
3918   Value
3919 | Reference
3920 @end example
3922 This pragma is used in conjunction with a pragma @cite{Import} to
3923 specify additional information for an imported function.  The pragma
3924 @cite{Import} (or equivalent pragma @cite{Interface}) must precede the
3925 @cite{Import_Function} pragma and both must appear in the same
3926 declarative part as the function specification.
3928 The @cite{Internal} argument must uniquely designate
3929 the function to which the
3930 pragma applies.  If more than one function name exists of this name in
3931 the declarative part you must use the @cite{Parameter_Types} and
3932 @cite{Result_Type} parameters to achieve the required unique
3933 designation.  Subtype marks in these parameters must exactly match the
3934 subtypes in the corresponding function specification, using positional
3935 notation to match parameters with subtype marks.
3936 The form with an @cite{'Access} attribute can be used to match an
3937 anonymous access parameter.
3939 You may optionally use the @cite{Mechanism} and @cite{Result_Mechanism}
3940 parameters to specify passing mechanisms for the
3941 parameters and result.  If you specify a single mechanism name, it
3942 applies to all parameters.  Otherwise you may specify a mechanism on a
3943 parameter by parameter basis using either positional or named
3944 notation.  If the mechanism is not specified, the default mechanism
3945 is used.
3947 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
3948 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{76}
3949 @section Pragma Import_Object
3952 Syntax:
3954 @example
3955 pragma Import_Object
3956      [Internal =>] LOCAL_NAME
3957   [, [External =>] EXTERNAL_SYMBOL]
3958   [, [Size     =>] EXTERNAL_SYMBOL]);
3960 EXTERNAL_SYMBOL ::=
3961   IDENTIFIER
3962 | static_string_EXPRESSION
3963 @end example
3965 This pragma designates an object as imported, and apart from the
3966 extended rules for external symbols, is identical in effect to the use of
3967 the normal @cite{Import} pragma applied to an object.  Unlike the
3968 subprogram case, you need not use a separate @cite{Import} pragma,
3969 although you may do so (and probably should do so from a portability
3970 point of view).  @cite{size} is syntax checked, but otherwise ignored by
3971 GNAT.
3973 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
3974 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{77}
3975 @section Pragma Import_Procedure
3978 Syntax:
3980 @example
3981 pragma Import_Procedure (
3982      [Internal                 =>] LOCAL_NAME
3983   [, [External                 =>] EXTERNAL_SYMBOL]
3984   [, [Parameter_Types          =>] PARAMETER_TYPES]
3985   [, [Mechanism                =>] MECHANISM]);
3987 EXTERNAL_SYMBOL ::=
3988   IDENTIFIER
3989 | static_string_EXPRESSION
3991 PARAMETER_TYPES ::=
3992   null
3993 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3995 TYPE_DESIGNATOR ::=
3996   subtype_NAME
3997 | subtype_Name ' Access
3999 MECHANISM ::=
4000   MECHANISM_NAME
4001 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4003 MECHANISM_ASSOCIATION ::=
4004   [formal_parameter_NAME =>] MECHANISM_NAME
4006 MECHANISM_NAME ::= Value | Reference
4007 @end example
4009 This pragma is identical to @cite{Import_Function} except that it
4010 applies to a procedure rather than a function and the parameters
4011 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
4013 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4014 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{78}
4015 @section Pragma Import_Valued_Procedure
4018 Syntax:
4020 @example
4021 pragma Import_Valued_Procedure (
4022      [Internal                 =>] LOCAL_NAME
4023   [, [External                 =>] EXTERNAL_SYMBOL]
4024   [, [Parameter_Types          =>] PARAMETER_TYPES]
4025   [, [Mechanism                =>] MECHANISM]);
4027 EXTERNAL_SYMBOL ::=
4028   IDENTIFIER
4029 | static_string_EXPRESSION
4031 PARAMETER_TYPES ::=
4032   null
4033 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4035 TYPE_DESIGNATOR ::=
4036   subtype_NAME
4037 | subtype_Name ' Access
4039 MECHANISM ::=
4040   MECHANISM_NAME
4041 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4043 MECHANISM_ASSOCIATION ::=
4044   [formal_parameter_NAME =>] MECHANISM_NAME
4046 MECHANISM_NAME ::= Value | Reference
4047 @end example
4049 This pragma is identical to @cite{Import_Procedure} except that the
4050 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
4051 mode @cite{OUT}, and externally the subprogram is treated as a function
4052 with this parameter as the result of the function.  The purpose of this
4053 capability is to allow the use of @cite{OUT} and @cite{IN OUT}
4054 parameters in interfacing to external functions (which are not permitted
4055 in Ada functions).  You may optionally use the @cite{Mechanism}
4056 parameters to specify passing mechanisms for the parameters.
4057 If you specify a single mechanism name, it applies to all parameters.
4058 Otherwise you may specify a mechanism on a parameter by parameter
4059 basis using either positional or named notation.  If the mechanism is not
4060 specified, the default mechanism is used.
4062 Note that it is important to use this pragma in conjunction with a separate
4063 pragma Import that specifies the desired convention, since otherwise the
4064 default convention is Ada, which is almost certainly not what is required.
4066 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4067 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{79}
4068 @section Pragma Independent
4071 Syntax:
4073 @example
4074 pragma Independent (Local_NAME);
4075 @end example
4077 This pragma is standard in Ada 2012 mode (which also provides an aspect
4078 of the same name). It is also available as an implementation-defined
4079 pragma in all earlier versions. It specifies that the
4080 designated object or all objects of the designated type must be
4081 independently addressable. This means that separate tasks can safely
4082 manipulate such objects. For example, if two components of a record are
4083 independent, then two separate tasks may access these two components.
4084 This may place
4085 constraints on the representation of the object (for instance prohibiting
4086 tight packing).
4088 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4089 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7a}
4090 @section Pragma Independent_Components
4093 Syntax:
4095 @example
4096 pragma Independent_Components (Local_NAME);
4097 @end example
4099 This pragma is standard in Ada 2012 mode (which also provides an aspect
4100 of the same name). It is also available as an implementation-defined
4101 pragma in all earlier versions. It specifies that the components of the
4102 designated object, or the components of each object of the designated
4103 type, must be
4104 independently addressable. This means that separate tasks can safely
4105 manipulate separate components in the composite object. This may place
4106 constraints on the representation of the object (for instance prohibiting
4107 tight packing).
4109 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4110 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{7b}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{7c}
4111 @section Pragma Initial_Condition
4114 Syntax:
4116 @example
4117 pragma Initial_Condition (boolean_EXPRESSION);
4118 @end example
4120 For the semantics of this pragma, see the entry for aspect @cite{Initial_Condition}
4121 in the SPARK 2014 Reference Manual, section 7.1.6.
4123 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4124 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{7d}
4125 @section Pragma Initialize_Scalars
4128 @geindex debugging with Initialize_Scalars
4130 Syntax:
4132 @example
4133 pragma Initialize_Scalars;
4134 @end example
4136 This pragma is similar to @cite{Normalize_Scalars} conceptually but has
4137 two important differences.  First, there is no requirement for the pragma
4138 to be used uniformly in all units of a partition, in particular, it is fine
4139 to use this just for some or all of the application units of a partition,
4140 without needing to recompile the run-time library.
4142 In the case where some units are compiled with the pragma, and some without,
4143 then a declaration of a variable where the type is defined in package
4144 Standard or is locally declared will always be subject to initialization,
4145 as will any declaration of a scalar variable.  For composite variables,
4146 whether the variable is initialized may also depend on whether the package
4147 in which the type of the variable is declared is compiled with the pragma.
4149 The other important difference is that you can control the value used
4150 for initializing scalar objects.  At bind time, you can select several
4151 options for initialization. You can
4152 initialize with invalid values (similar to Normalize_Scalars, though for
4153 Initialize_Scalars it is not always possible to determine the invalid
4154 values in complex cases like signed component fields with non-standard
4155 sizes). You can also initialize with high or
4156 low values, or with a specified bit pattern.  See the GNAT
4157 User's Guide for binder options for specifying these cases.
4159 This means that you can compile a program, and then without having to
4160 recompile the program, you can run it with different values being used
4161 for initializing otherwise uninitialized values, to test if your program
4162 behavior depends on the choice.  Of course the behavior should not change,
4163 and if it does, then most likely you have an incorrect reference to an
4164 uninitialized value.
4166 It is even possible to change the value at execution time eliminating even
4167 the need to rebind with a different switch using an environment variable.
4168 See the GNAT User's Guide for details.
4170 Note that pragma @cite{Initialize_Scalars} is particularly useful in
4171 conjunction with the enhanced validity checking that is now provided
4172 in GNAT, which checks for invalid values under more conditions.
4173 Using this feature (see description of the @emph{-gnatV} flag in the
4174 GNAT User's Guide) in conjunction with
4175 pragma @cite{Initialize_Scalars}
4176 provides a powerful new tool to assist in the detection of problems
4177 caused by uninitialized variables.
4179 Note: the use of @cite{Initialize_Scalars} has a fairly extensive
4180 effect on the generated code. This may cause your code to be
4181 substantially larger. It may also cause an increase in the amount
4182 of stack required, so it is probably a good idea to turn on stack
4183 checking (see description of stack checking in the GNAT
4184 User's Guide) when using this pragma.
4186 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4187 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{7e}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{7f}
4188 @section Pragma Initializes
4191 Syntax:
4193 @example
4194 pragma Initializes (INITIALIZATION_LIST);
4196 INITIALIZATION_LIST ::=
4197      null
4198   | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4200 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4202 INPUT_LIST ::=
4203      null
4204   |  INPUT
4205   | (INPUT @{, INPUT@})
4207 INPUT ::= name
4208 @end example
4210 For the semantics of this pragma, see the entry for aspect @cite{Initializes} in the
4211 SPARK 2014 Reference Manual, section 7.1.5.
4213 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4214 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{80}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{81}
4215 @section Pragma Inline_Always
4218 Syntax:
4220 @example
4221 pragma Inline_Always (NAME [, NAME]);
4222 @end example
4224 Similar to pragma @cite{Inline} except that inlining is not subject to
4225 the use of option @emph{-gnatn} or @emph{-gnatN} and the inlining
4226 happens regardless of whether these options are used.
4228 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4229 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{82}
4230 @section Pragma Inline_Generic
4233 Syntax:
4235 @example
4236 pragma Inline_Generic (GNAME @{, GNAME@});
4238 GNAME ::= generic_unit_NAME | generic_instance_NAME
4239 @end example
4241 This pragma is provided for compatibility with Dec Ada 83. It has
4242 no effect in @cite{GNAT} (which always inlines generics), other
4243 than to check that the given names are all names of generic units or
4244 generic instances.
4246 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4247 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{83}
4248 @section Pragma Interface
4251 Syntax:
4253 @example
4254 pragma Interface (
4255      [Convention    =>] convention_identifier,
4256      [Entity        =>] local_NAME
4257   [, [External_Name =>] static_string_expression]
4258   [, [Link_Name     =>] static_string_expression]);
4259 @end example
4261 This pragma is identical in syntax and semantics to
4262 the standard Ada pragma @cite{Import}.  It is provided for compatibility
4263 with Ada 83.  The definition is upwards compatible both with pragma
4264 @cite{Interface} as defined in the Ada 83 Reference Manual, and also
4265 with some extended implementations of this pragma in certain Ada 83
4266 implementations.  The only difference between pragma @cite{Interface}
4267 and pragma @cite{Import} is that there is special circuitry to allow
4268 both pragmas to appear for the same subprogram entity (normally it
4269 is illegal to have multiple @cite{Import} pragmas. This is useful in
4270 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4271 Ada 83 compilers.
4273 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4274 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{84}
4275 @section Pragma Interface_Name
4278 Syntax:
4280 @example
4281 pragma Interface_Name (
4282      [Entity        =>] LOCAL_NAME
4283   [, [External_Name =>] static_string_EXPRESSION]
4284   [, [Link_Name     =>] static_string_EXPRESSION]);
4285 @end example
4287 This pragma provides an alternative way of specifying the interface name
4288 for an interfaced subprogram, and is provided for compatibility with Ada
4289 83 compilers that use the pragma for this purpose.  You must provide at
4290 least one of @cite{External_Name} or @cite{Link_Name}.
4292 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4293 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{85}
4294 @section Pragma Interrupt_Handler
4297 Syntax:
4299 @example
4300 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4301 @end example
4303 This program unit pragma is supported for parameterless protected procedures
4304 as described in Annex C of the Ada Reference Manual. On the AAMP target
4305 the pragma can also be specified for nonprotected parameterless procedures
4306 that are declared at the library level (which includes procedures
4307 declared at the top level of a library package). In the case of AAMP,
4308 when this pragma is applied to a nonprotected procedure, the instruction
4309 @cite{IERET} is generated for returns from the procedure, enabling
4310 maskable interrupts, in place of the normal return instruction.
4312 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4313 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{86}
4314 @section Pragma Interrupt_State
4317 Syntax:
4319 @example
4320 pragma Interrupt_State
4321  ([Name  =>] value,
4322   [State =>] SYSTEM | RUNTIME | USER);
4323 @end example
4325 Normally certain interrupts are reserved to the implementation.  Any attempt
4326 to attach an interrupt causes Program_Error to be raised, as described in
4327 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
4328 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4329 reserved to the implementation, so that @code{Ctrl-C} can be used to
4330 interrupt execution.  Additionally, signals such as @cite{SIGSEGV},
4331 @cite{SIGABRT}, @cite{SIGFPE} and @cite{SIGILL} are often mapped to specific
4332 Ada exceptions, or used to implement run-time functions such as the
4333 @cite{abort} statement and stack overflow checking.
4335 Pragma @cite{Interrupt_State} provides a general mechanism for overriding
4336 such uses of interrupts.  It subsumes the functionality of pragma
4337 @cite{Unreserve_All_Interrupts}.  Pragma @cite{Interrupt_State} is not
4338 available on Windows or VMS.  On all other platforms than VxWorks,
4339 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4340 and may be used to mark interrupts required by the board support package
4341 as reserved.
4343 Interrupts can be in one of three states:
4346 @itemize *
4348 @item 
4349 System
4351 The interrupt is reserved (no Ada handler can be installed), and the
4352 Ada run-time may not install a handler. As a result you are guaranteed
4353 standard system default action if this interrupt is raised.
4355 @item 
4356 Runtime
4358 The interrupt is reserved (no Ada handler can be installed). The run time
4359 is allowed to install a handler for internal control purposes, but is
4360 not required to do so.
4362 @item 
4363 User
4365 The interrupt is unreserved.  The user may install a handler to provide
4366 some other action.
4367 @end itemize
4369 These states are the allowed values of the @cite{State} parameter of the
4370 pragma.  The @cite{Name} parameter is a value of the type
4371 @cite{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4372 @cite{Ada.Interrupts.Names}.
4374 This is a configuration pragma, and the binder will check that there
4375 are no inconsistencies between different units in a partition in how a
4376 given interrupt is specified. It may appear anywhere a pragma is legal.
4378 The effect is to move the interrupt to the specified state.
4380 By declaring interrupts to be SYSTEM, you guarantee the standard system
4381 action, such as a core dump.
4383 By declaring interrupts to be USER, you guarantee that you can install
4384 a handler.
4386 Note that certain signals on many operating systems cannot be caught and
4387 handled by applications.  In such cases, the pragma is ignored.  See the
4388 operating system documentation, or the value of the array @cite{Reserved}
4389 declared in the spec of package @cite{System.OS_Interface}.
4391 Overriding the default state of signals used by the Ada runtime may interfere
4392 with an application's runtime behavior in the cases of the synchronous signals,
4393 and in the case of the signal used to implement the @cite{abort} statement.
4395 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4396 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{87}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{88}
4397 @section Pragma Invariant
4400 Syntax:
4402 @example
4403 pragma Invariant
4404   ([Entity =>]    private_type_LOCAL_NAME,
4405    [Check  =>]    EXPRESSION
4406    [,[Message =>] String_Expression]);
4407 @end example
4409 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4410 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4411 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4412 requires the use of the aspect syntax, which is not available except in 2012
4413 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4414 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4415 note that the aspect Invariant is a synonym in GNAT for the aspect
4416 Type_Invariant, but there is no pragma Type_Invariant.
4418 The pragma must appear within the visible part of the package specification,
4419 after the type to which its Entity argument appears. As with the Invariant
4420 aspect, the Check expression is not analyzed until the end of the visible
4421 part of the package, so it may contain forward references. The Message
4422 argument, if present, provides the exception message used if the invariant
4423 is violated. If no Message parameter is provided, a default message that
4424 identifies the line on which the pragma appears is used.
4426 It is permissible to have multiple Invariants for the same type entity, in
4427 which case they are and'ed together. It is permissible to use this pragma
4428 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4429 invariant pragma for the same entity.
4431 For further details on the use of this pragma, see the Ada 2012 documentation
4432 of the Type_Invariant aspect.
4434 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4435 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{89}
4436 @section Pragma Keep_Names
4439 Syntax:
4441 @example
4442 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4443 @end example
4445 The @cite{LOCAL_NAME} argument
4446 must refer to an enumeration first subtype
4447 in the current declarative part. The effect is to retain the enumeration
4448 literal names for use by @cite{Image} and @cite{Value} even if a global
4449 @cite{Discard_Names} pragma applies. This is useful when you want to
4450 generally suppress enumeration literal names and for example you therefore
4451 use a @cite{Discard_Names} pragma in the @code{gnat.adc} file, but you
4452 want to retain the names for specific enumeration types.
4454 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4455 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8a}
4456 @section Pragma License
4459 @geindex License checking
4461 Syntax:
4463 @example
4464 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4465 @end example
4467 This pragma is provided to allow automated checking for appropriate license
4468 conditions with respect to the standard and modified GPL.  A pragma
4469 @cite{License}, which is a configuration pragma that typically appears at
4470 the start of a source file or in a separate @code{gnat.adc} file, specifies
4471 the licensing conditions of a unit as follows:
4474 @itemize *
4476 @item 
4477 Unrestricted
4478 This is used for a unit that can be freely used with no license restrictions.
4479 Examples of such units are public domain units, and units from the Ada
4480 Reference Manual.
4482 @item 
4484 This is used for a unit that is licensed under the unmodified GPL, and which
4485 therefore cannot be @cite{with}'ed by a restricted unit.
4487 @item 
4488 Modified_GPL
4489 This is used for a unit licensed under the GNAT modified GPL that includes
4490 a special exception paragraph that specifically permits the inclusion of
4491 the unit in programs without requiring the entire program to be released
4492 under the GPL.
4494 @item 
4495 Restricted
4496 This is used for a unit that is restricted in that it is not permitted to
4497 depend on units that are licensed under the GPL.  Typical examples are
4498 proprietary code that is to be released under more restrictive license
4499 conditions.  Note that restricted units are permitted to @cite{with} units
4500 which are licensed under the modified GPL (this is the whole point of the
4501 modified GPL).
4502 @end itemize
4504 Normally a unit with no @cite{License} pragma is considered to have an
4505 unknown license, and no checking is done.  However, standard GNAT headers
4506 are recognized, and license information is derived from them as follows.
4508 A GNAT license header starts with a line containing 78 hyphens.  The following
4509 comment text is searched for the appearance of any of the following strings.
4511 If the string 'GNU General Public License' is found, then the unit is assumed
4512 to have GPL license, unless the string 'As a special exception' follows, in
4513 which case the license is assumed to be modified GPL.
4515 If one of the strings
4516 'This specification is adapted from the Ada Semantic Interface' or
4517 'This specification is derived from the Ada Reference Manual' is found
4518 then the unit is assumed to be unrestricted.
4520 These default actions means that a program with a restricted license pragma
4521 will automatically get warnings if a GPL unit is inappropriately
4522 @cite{with}'ed.  For example, the program:
4524 @example
4525 with Sem_Ch3;
4526 with GNAT.Sockets;
4527 procedure Secret_Stuff is
4528   ...
4529 end Secret_Stuff
4530 @end example
4532 if compiled with pragma @cite{License} (@cite{Restricted}) in a
4533 @code{gnat.adc} file will generate the warning:
4535 @example
4536 1.  with Sem_Ch3;
4537         |
4538    >>> license of withed unit "Sem_Ch3" is incompatible
4540 2.  with GNAT.Sockets;
4541 3.  procedure Secret_Stuff is
4542 @end example
4544 Here we get a warning on @cite{Sem_Ch3} since it is part of the GNAT
4545 compiler and is licensed under the
4546 GPL, but no warning for @cite{GNAT.Sockets} which is part of the GNAT
4547 run time, and is therefore licensed under the modified GPL.
4549 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4550 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{8b}
4551 @section Pragma Link_With
4554 Syntax:
4556 @example
4557 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4558 @end example
4560 This pragma is provided for compatibility with certain Ada 83 compilers.
4561 It has exactly the same effect as pragma @cite{Linker_Options} except
4562 that spaces occurring within one of the string expressions are treated
4563 as separators. For example, in the following case:
4565 @example
4566 pragma Link_With ("-labc -ldef");
4567 @end example
4569 results in passing the strings @cite{-labc} and @cite{-ldef} as two
4570 separate arguments to the linker. In addition pragma Link_With allows
4571 multiple arguments, with the same effect as successive pragmas.
4573 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4574 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{8c}
4575 @section Pragma Linker_Alias
4578 Syntax:
4580 @example
4581 pragma Linker_Alias (
4582   [Entity =>] LOCAL_NAME,
4583   [Target =>] static_string_EXPRESSION);
4584 @end example
4586 @cite{LOCAL_NAME} must refer to an object that is declared at the library
4587 level. This pragma establishes the given entity as a linker alias for the
4588 given target. It is equivalent to @cite{__attribute__((alias))} in GNU C
4589 and causes @cite{LOCAL_NAME} to be emitted as an alias for the symbol
4590 @cite{static_string_EXPRESSION} in the object file, that is to say no space
4591 is reserved for @cite{LOCAL_NAME} by the assembler and it will be resolved
4592 to the same address as @cite{static_string_EXPRESSION} by the linker.
4594 The actual linker name for the target must be used (e.g., the fully
4595 encoded name with qualification in Ada, or the mangled name in C++),
4596 or it must be declared using the C convention with @cite{pragma Import}
4597 or @cite{pragma Export}.
4599 Not all target machines support this pragma. On some of them it is accepted
4600 only if @cite{pragma Weak_External} has been applied to @cite{LOCAL_NAME}.
4602 @example
4603 --  Example of the use of pragma Linker_Alias
4605 package p is
4606   i : Integer := 1;
4607   pragma Export (C, i);
4609   new_name_for_i : Integer;
4610   pragma Linker_Alias (new_name_for_i, "i");
4611 end p;
4612 @end example
4614 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4615 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{8d}
4616 @section Pragma Linker_Constructor
4619 Syntax:
4621 @example
4622 pragma Linker_Constructor (procedure_LOCAL_NAME);
4623 @end example
4625 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4626 is declared at the library level. A procedure to which this pragma is
4627 applied will be treated as an initialization routine by the linker.
4628 It is equivalent to @cite{__attribute__((constructor))} in GNU C and
4629 causes @cite{procedure_LOCAL_NAME} to be invoked before the entry point
4630 of the executable is called (or immediately after the shared library is
4631 loaded if the procedure is linked in a shared library), in particular
4632 before the Ada run-time environment is set up.
4634 Because of these specific contexts, the set of operations such a procedure
4635 can perform is very limited and the type of objects it can manipulate is
4636 essentially restricted to the elementary types. In particular, it must only
4637 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4639 This pragma is used by GNAT to implement auto-initialization of shared Stand
4640 Alone Libraries, which provides a related capability without the restrictions
4641 listed above. Where possible, the use of Stand Alone Libraries is preferable
4642 to the use of this pragma.
4644 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4645 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{8e}
4646 @section Pragma Linker_Destructor
4649 Syntax:
4651 @example
4652 pragma Linker_Destructor (procedure_LOCAL_NAME);
4653 @end example
4655 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4656 is declared at the library level. A procedure to which this pragma is
4657 applied will be treated as a finalization routine by the linker.
4658 It is equivalent to @cite{__attribute__((destructor))} in GNU C and
4659 causes @cite{procedure_LOCAL_NAME} to be invoked after the entry point
4660 of the executable has exited (or immediately before the shared library
4661 is unloaded if the procedure is linked in a shared library), in particular
4662 after the Ada run-time environment is shut down.
4664 See @cite{pragma Linker_Constructor} for the set of restrictions that apply
4665 because of these specific contexts.
4667 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4668 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{8f}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{90}
4669 @section Pragma Linker_Section
4672 Syntax:
4674 @example
4675 pragma Linker_Section (
4676   [Entity  =>] LOCAL_NAME,
4677   [Section =>] static_string_EXPRESSION);
4678 @end example
4680 @cite{LOCAL_NAME} must refer to an object, type, or subprogram that is
4681 declared at the library level. This pragma specifies the name of the
4682 linker section for the given entity. It is equivalent to
4683 @cite{__attribute__((section))} in GNU C and causes @cite{LOCAL_NAME} to
4684 be placed in the @cite{static_string_EXPRESSION} section of the
4685 executable (assuming the linker doesn't rename the section).
4686 GNAT also provides an implementation defined aspect of the same name.
4688 In the case of specifying this aspect for a type, the effect is to
4689 specify the corresponding for all library level objects of the type which
4690 do not have an explicit linker section set. Note that this only applies to
4691 whole objects, not to components of composite objects.
4693 In the case of a subprogram, the linker section applies to all previously
4694 declared matching overloaded subprograms in the current declarative part
4695 which do not already have a linker section assigned. The linker section
4696 aspect is useful in this case for specifying different linker sections
4697 for different elements of such an overloaded set.
4699 Note that an empty string specifies that no linker section is specified.
4700 This is not quite the same as omitting the pragma or aspect, since it
4701 can be used to specify that one element of an overloaded set of subprograms
4702 has the default linker section, or that one object of a type for which a
4703 linker section is specified should has the default linker section.
4705 The compiler normally places library-level entities in standard sections
4706 depending on the class: procedures and functions generally go in the
4707 @cite{.text} section, initialized variables in the @cite{.data} section
4708 and uninitialized variables in the @cite{.bss} section.
4710 Other, special sections may exist on given target machines to map special
4711 hardware, for example I/O ports or flash memory. This pragma is a means to
4712 defer the final layout of the executable to the linker, thus fully working
4713 at the symbolic level with the compiler.
4715 Some file formats do not support arbitrary sections so not all target
4716 machines support this pragma. The use of this pragma may cause a program
4717 execution to be erroneous if it is used to place an entity into an
4718 inappropriate section (e.g., a modified variable into the @cite{.text}
4719 section). See also @cite{pragma Persistent_BSS}.
4721 @example
4722 --  Example of the use of pragma Linker_Section
4724 package IO_Card is
4725   Port_A : Integer;
4726   pragma Volatile (Port_A);
4727   pragma Linker_Section (Port_A, ".bss.port_a");
4729   Port_B : Integer;
4730   pragma Volatile (Port_B);
4731   pragma Linker_Section (Port_B, ".bss.port_b");
4733   type Port_Type is new Integer with Linker_Section => ".bss";
4734   PA : Port_Type with Linker_Section => ".bss.PA";
4735   PB : Port_Type; --  ends up in linker section ".bss"
4737   procedure Q with Linker_Section => "Qsection";
4738 end IO_Card;
4739 @end example
4741 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4742 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{91}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{92}
4743 @section Pragma Lock_Free
4746 Syntax:
4747 This pragma may be specified for protected types or objects. It specifies that
4748 the implementation of protected operations must be implemented without locks.
4749 Compilation fails if the compiler cannot generate lock-free code for the
4750 operations.
4752 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
4753 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{93}
4754 @section Pragma Loop_Invariant
4757 Syntax:
4759 @example
4760 pragma Loop_Invariant ( boolean_EXPRESSION );
4761 @end example
4763 The effect of this pragma is similar to that of pragma @cite{Assert},
4764 except that in an @cite{Assertion_Policy} pragma, the identifier
4765 @cite{Loop_Invariant} is used to control whether it is ignored or checked
4766 (or disabled).
4768 @cite{Loop_Invariant} can only appear as one of the items in the sequence
4769 of statements of a loop body, or nested inside block statements that
4770 appear in the sequence of statements of a loop body.
4771 The intention is that it be used to
4772 represent a "loop invariant" assertion, i.e. something that is true each
4773 time through the loop, and which can be used to show that the loop is
4774 achieving its purpose.
4776 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4777 apply to the same loop should be grouped in the same sequence of
4778 statements.
4780 To aid in writing such invariants, the special attribute @cite{Loop_Entry}
4781 may be used to refer to the value of an expression on entry to the loop. This
4782 attribute can only be used within the expression of a @cite{Loop_Invariant}
4783 pragma. For full details, see documentation of attribute @cite{Loop_Entry}.
4785 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
4786 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{94}
4787 @section Pragma Loop_Optimize
4790 Syntax:
4792 @example
4793 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4795 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
4796 @end example
4798 This pragma must appear immediately within a loop statement.  It allows the
4799 programmer to specify optimization hints for the enclosing loop.  The hints
4800 are not mutually exclusive and can be freely mixed, but not all combinations
4801 will yield a sensible outcome.
4803 There are five supported optimization hints for a loop:
4806 @itemize *
4808 @item 
4809 Ivdep
4811 The programmer asserts that there are no loop-carried dependencies
4812 which would prevent consecutive iterations of the loop from being
4813 executed simultaneously.
4815 @item 
4816 No_Unroll
4818 The loop must not be unrolled.  This is a strong hint: the compiler will not
4819 unroll a loop marked with this hint.
4821 @item 
4822 Unroll
4824 The loop should be unrolled.  This is a weak hint: the compiler will try to
4825 apply unrolling to this loop preferably to other optimizations, notably
4826 vectorization, but there is no guarantee that the loop will be unrolled.
4828 @item 
4829 No_Vector
4831 The loop must not be vectorized.  This is a strong hint: the compiler will not
4832 vectorize a loop marked with this hint.
4834 @item 
4835 Vector
4837 The loop should be vectorized.  This is a weak hint: the compiler will try to
4838 apply vectorization to this loop preferably to other optimizations, notably
4839 unrolling, but there is no guarantee that the loop will be vectorized.
4840 @end itemize
4842 These hints do not remove the need to pass the appropriate switches to the
4843 compiler in order to enable the relevant optimizations, that is to say
4844 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
4845 vectorization.
4847 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
4848 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{95}
4849 @section Pragma Loop_Variant
4852 Syntax:
4854 @example
4855 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
4856 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
4857 CHANGE_DIRECTION ::= Increases | Decreases
4858 @end example
4860 @cite{Loop_Variant} can only appear as one of the items in the sequence
4861 of statements of a loop body, or nested inside block statements that
4862 appear in the sequence of statements of a loop body.
4863 It allows the specification of quantities which must always
4864 decrease or increase in successive iterations of the loop. In its simplest
4865 form, just one expression is specified, whose value must increase or decrease
4866 on each iteration of the loop.
4868 In a more complex form, multiple arguments can be given which are intepreted
4869 in a nesting lexicographic manner. For example:
4871 @example
4872 pragma Loop_Variant (Increases => X, Decreases => Y);
4873 @end example
4875 specifies that each time through the loop either X increases, or X stays
4876 the same and Y decreases. A @cite{Loop_Variant} pragma ensures that the
4877 loop is making progress. It can be useful in helping to show informally
4878 or prove formally that the loop always terminates.
4880 @cite{Loop_Variant} is an assertion whose effect can be controlled using
4881 an @cite{Assertion_Policy} with a check name of @cite{Loop_Variant}. The
4882 policy can be @cite{Check} to enable the loop variant check, @cite{Ignore}
4883 to ignore the check (in which case the pragma has no effect on the program),
4884 or @cite{Disable} in which case the pragma is not even checked for correct
4885 syntax.
4887 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4888 apply to the same loop should be grouped in the same sequence of
4889 statements.
4891 The @cite{Loop_Entry} attribute may be used within the expressions of the
4892 @cite{Loop_Variant} pragma to refer to values on entry to the loop.
4894 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
4895 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{96}
4896 @section Pragma Machine_Attribute
4899 Syntax:
4901 @example
4902 pragma Machine_Attribute (
4903      [Entity         =>] LOCAL_NAME,
4904      [Attribute_Name =>] static_string_EXPRESSION
4905   [, [Info           =>] static_EXPRESSION] );
4906 @end example
4908 Machine-dependent attributes can be specified for types and/or
4909 declarations.  This pragma is semantically equivalent to
4910 @cite{__attribute__((`attribute_name}))` (if @cite{info} is not
4911 specified) or @cite{__attribute__((`attribute_name`(`info})))
4912 in GNU C, where @code{attribute_name} is recognized by the
4913 compiler middle-end or the @cite{TARGET_ATTRIBUTE_TABLE} machine
4914 specific macro.  A string literal for the optional parameter @cite{info}
4915 is transformed into an identifier, which may make this pragma unusable
4916 for some attributes.
4917 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
4919 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
4920 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{97}
4921 @section Pragma Main
4924 Syntax:
4926 @example
4927 pragma Main
4928  (MAIN_OPTION [, MAIN_OPTION]);
4930 MAIN_OPTION ::=
4931   [Stack_Size              =>] static_integer_EXPRESSION
4932 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
4933 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
4934 @end example
4936 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4937 no effect in GNAT, other than being syntax checked.
4939 @node Pragma Main_Storage,Pragma No_Body,Pragma Main,Implementation Defined Pragmas
4940 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{98}
4941 @section Pragma Main_Storage
4944 Syntax:
4946 @example
4947 pragma Main_Storage
4948   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
4950 MAIN_STORAGE_OPTION ::=
4951   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
4952 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
4953 @end example
4955 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4956 no effect in GNAT, other than being syntax checked.
4958 @node Pragma No_Body,Pragma No_Elaboration_Code_All,Pragma Main_Storage,Implementation Defined Pragmas
4959 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{99}
4960 @section Pragma No_Body
4963 Syntax:
4965 @example
4966 pragma No_Body;
4967 @end example
4969 There are a number of cases in which a package spec does not require a body,
4970 and in fact a body is not permitted. GNAT will not permit the spec to be
4971 compiled if there is a body around. The pragma No_Body allows you to provide
4972 a body file, even in a case where no body is allowed. The body file must
4973 contain only comments and a single No_Body pragma. This is recognized by
4974 the compiler as indicating that no body is logically present.
4976 This is particularly useful during maintenance when a package is modified in
4977 such a way that a body needed before is no longer needed. The provision of a
4978 dummy body with a No_Body pragma ensures that there is no interference from
4979 earlier versions of the package body.
4981 @node Pragma No_Elaboration_Code_All,Pragma No_Inline,Pragma No_Body,Implementation Defined Pragmas
4982 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9a}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{9b}
4983 @section Pragma No_Elaboration_Code_All
4986 Syntax:
4988 @example
4989 pragma No_Elaboration_Code_All [(program_unit_NAME)];
4990 @end example
4992 This is a program unit pragma (there is also an equivalent aspect of the
4993 same name) that establishes the restriction @cite{No_Elaboration_Code} for
4994 the current unit and any extended main source units (body and subunits.
4995 It also has has the effect of enforcing a transitive application of this
4996 aspect, so that if any unit is implicitly or explicitly WITH'ed by the
4997 current unit, it must also have the No_Elaboration_Code_All aspect set.
4998 It may be applied to package or subprogram specs or their generic versions.
5000 @node Pragma No_Inline,Pragma No_Return,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5001 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{9c}
5002 @section Pragma No_Inline
5005 Syntax:
5007 @example
5008 pragma No_Inline (NAME @{, NAME@});
5009 @end example
5011 This pragma suppresses inlining for the callable entity or the instances of
5012 the generic subprogram designated by @cite{NAME}, including inlining that
5013 results from the use of pragma @cite{Inline}.  This pragma is always active,
5014 in particular it is not subject to the use of option @emph{-gnatn} or
5015 @emph{-gnatN}.  It is illegal to specify both pragma @cite{No_Inline} and
5016 pragma @cite{Inline_Always} for the same @cite{NAME}.
5018 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
5019 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{9d}
5020 @section Pragma No_Return
5023 Syntax:
5025 @example
5026 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5027 @end example
5029 Each @cite{procedure_LOCAL_NAME} argument must refer to one or more procedure
5030 declarations in the current declarative part.  A procedure to which this
5031 pragma is applied may not contain any explicit @cite{return} statements.
5032 In addition, if the procedure contains any implicit returns from falling
5033 off the end of a statement sequence, then execution of that implicit
5034 return will cause Program_Error to be raised.
5036 One use of this pragma is to identify procedures whose only purpose is to raise
5037 an exception. Another use of this pragma is to suppress incorrect warnings
5038 about missing returns in functions, where the last statement of a function
5039 statement sequence is a call to such a procedure.
5041 Note that in Ada 2005 mode, this pragma is part of the language. It is
5042 available in all earlier versions of Ada as an implementation-defined
5043 pragma.
5045 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
5046 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{9e}
5047 @section Pragma No_Run_Time
5050 Syntax:
5052 @example
5053 pragma No_Run_Time;
5054 @end example
5056 This is an obsolete configuration pragma that historically was used to
5057 set up a runtime library with no object code. It is now used only for
5058 internal testing. The pragma has been superseded by the reconfigurable
5059 runtime capability of @cite{GNAT}.
5061 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
5062 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{9f}
5063 @section Pragma No_Strict_Aliasing
5066 Syntax:
5068 @example
5069 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5070 @end example
5072 @cite{type_LOCAL_NAME} must refer to an access type
5073 declaration in the current declarative part.  The effect is to inhibit
5074 strict aliasing optimization for the given type.  The form with no
5075 arguments is a configuration pragma which applies to all access types
5076 declared in units to which the pragma applies. For a detailed
5077 description of the strict aliasing optimization, and the situations
5078 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5079 in the @cite{GNAT User's Guide}.
5081 This pragma currently has no effects on access to unconstrained array types.
5083 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5084 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{a0}@anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{a1}
5085 @section Pragma No_Tagged_Streams
5088 Syntax:
5090 @example
5091 pragma No_Tagged_Streams;
5092 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5093 @end example
5095 Normally when a tagged type is introduced using a full type declaration,
5096 part of the processing includes generating stream access routines to be
5097 used by stream attributes referencing the type (or one of its subtypes
5098 or derived types). This can involve the generation of significant amounts
5099 of code which is wasted space if stream routines are not needed for the
5100 type in question.
5102 The @cite{No_Tagged_Streams} pragma causes the generation of these stream
5103 routines to be skipped, and any attempt to use stream operations on
5104 types subject to this pragma will be statically rejected as illegal.
5106 There are two forms of the pragma. The form with no arguments must appear
5107 in a declarative sequence or in the declarations of a package spec. This
5108 pragma affects all subsequent root tagged types declared in the declaration
5109 sequence, and specifies that no stream routines be generated. The form with
5110 an argument (for which there is also a corresponding aspect) specifies a
5111 single root tagged type for which stream routines are not to be generated.
5113 Once the pragma has been given for a particular root tagged type, all subtypes
5114 and derived types of this type inherit the pragma automatically, so the effect
5115 applies to a complete hierarchy (this is necessary to deal with the class-wide
5116 dispatching versions of the stream routines).
5118 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5119 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{a2}
5120 @section Pragma Normalize_Scalars
5123 Syntax:
5125 @example
5126 pragma Normalize_Scalars;
5127 @end example
5129 This is a language defined pragma which is fully implemented in GNAT.  The
5130 effect is to cause all scalar objects that are not otherwise initialized
5131 to be initialized.  The initial values are implementation dependent and
5132 are as follows:
5135 @table @asis
5137 @item @emph{Standard.Character}
5139 Objects whose root type is Standard.Character are initialized to
5140 Character'Last unless the subtype range excludes NUL (in which case
5141 NUL is used). This choice will always generate an invalid value if
5142 one exists.
5144 @item @emph{Standard.Wide_Character}
5146 Objects whose root type is Standard.Wide_Character are initialized to
5147 Wide_Character'Last unless the subtype range excludes NUL (in which case
5148 NUL is used). This choice will always generate an invalid value if
5149 one exists.
5151 @item @emph{Standard.Wide_Wide_Character}
5153 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5154 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5155 which case NUL is used). This choice will always generate an invalid value if
5156 one exists.
5158 @item @emph{Integer types}
5160 Objects of an integer type are treated differently depending on whether
5161 negative values are present in the subtype. If no negative values are
5162 present, then all one bits is used as the initial value except in the
5163 special case where zero is excluded from the subtype, in which case
5164 all zero bits are used. This choice will always generate an invalid
5165 value if one exists.
5167 For subtypes with negative values present, the largest negative number
5168 is used, except in the unusual case where this largest negative number
5169 is in the subtype, and the largest positive number is not, in which case
5170 the largest positive value is used. This choice will always generate
5171 an invalid value if one exists.
5173 @item @emph{Floating-Point Types}
5175 Objects of all floating-point types are initialized to all 1-bits. For
5176 standard IEEE format, this corresponds to a NaN (not a number) which is
5177 indeed an invalid value.
5179 @item @emph{Fixed-Point Types}
5181 Objects of all fixed-point types are treated as described above for integers,
5182 with the rules applying to the underlying integer value used to represent
5183 the fixed-point value.
5185 @item @emph{Modular types}
5187 Objects of a modular type are initialized to all one bits, except in
5188 the special case where zero is excluded from the subtype, in which
5189 case all zero bits are used. This choice will always generate an
5190 invalid value if one exists.
5192 @item @emph{Enumeration types}
5194 Objects of an enumeration type are initialized to all one-bits, i.e., to
5195 the value @cite{2 ** typ'Size - 1} unless the subtype excludes the literal
5196 whose Pos value is zero, in which case a code of zero is used. This choice
5197 will always generate an invalid value if one exists.
5198 @end table
5200 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5201 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{a3}@anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a4}
5202 @section Pragma Obsolescent
5205 Syntax:
5207 @example
5208 pragma Obsolescent;
5210 pragma Obsolescent (
5211   [Message =>] static_string_EXPRESSION
5212 [,[Version =>] Ada_05]]);
5214 pragma Obsolescent (
5215   [Entity  =>] NAME
5216 [,[Message =>] static_string_EXPRESSION
5217 [,[Version =>] Ada_05]] );
5218 @end example
5220 This pragma can occur immediately following a declaration of an entity,
5221 including the case of a record component. If no Entity argument is present,
5222 then this declaration is the one to which the pragma applies. If an Entity
5223 parameter is present, it must either match the name of the entity in this
5224 declaration, or alternatively, the pragma can immediately follow an enumeration
5225 type declaration, where the Entity argument names one of the enumeration
5226 literals.
5228 This pragma is used to indicate that the named entity
5229 is considered obsolescent and should not be used. Typically this is
5230 used when an API must be modified by eventually removing or modifying
5231 existing subprograms or other entities. The pragma can be used at an
5232 intermediate stage when the entity is still present, but will be
5233 removed later.
5235 The effect of this pragma is to output a warning message on a reference to
5236 an entity thus marked that the subprogram is obsolescent if the appropriate
5237 warning option in the compiler is activated. If the Message parameter is
5238 present, then a second warning message is given containing this text. In
5239 addition, a reference to the entity is considered to be a violation of pragma
5240 Restrictions (No_Obsolescent_Features).
5242 This pragma can also be used as a program unit pragma for a package,
5243 in which case the entity name is the name of the package, and the
5244 pragma indicates that the entire package is considered
5245 obsolescent. In this case a client @cite{with}'ing such a package
5246 violates the restriction, and the @cite{with} statement is
5247 flagged with warnings if the warning option is set.
5249 If the Version parameter is present (which must be exactly
5250 the identifier Ada_05, no other argument is allowed), then the
5251 indication of obsolescence applies only when compiling in Ada 2005
5252 mode. This is primarily intended for dealing with the situations
5253 in the predefined library where subprograms or packages
5254 have become defined as obsolescent in Ada 2005
5255 (e.g., in Ada.Characters.Handling), but may be used anywhere.
5257 The following examples show typical uses of this pragma:
5259 @example
5260 package p is
5261    pragma Obsolescent (p, Message => "use pp instead of p");
5262 end p;
5264 package q is
5265    procedure q2;
5266    pragma Obsolescent ("use q2new instead");
5268    type R is new integer;
5269    pragma Obsolescent
5270      (Entity  => R,
5271       Message => "use RR in Ada 2005",
5272       Version => Ada_05);
5274    type M is record
5275       F1 : Integer;
5276       F2 : Integer;
5277       pragma Obsolescent;
5278       F3 : Integer;
5279    end record;
5281    type E is (a, bc, 'd', quack);
5282    pragma Obsolescent (Entity => bc)
5283    pragma Obsolescent (Entity => 'd')
5285    function "+"
5286      (a, b : character) return character;
5287    pragma Obsolescent (Entity => "+");
5288 end;
5289 @end example
5291 Note that, as for all pragmas, if you use a pragma argument identifier,
5292 then all subsequent parameters must also use a pragma argument identifier.
5293 So if you specify "Entity =>" for the Entity argument, and a Message
5294 argument is present, it must be preceded by "Message =>".
5296 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5297 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{a5}
5298 @section Pragma Optimize_Alignment
5301 @geindex Alignment
5302 @geindex default settings
5304 Syntax:
5306 @example
5307 pragma Optimize_Alignment (TIME | SPACE | OFF);
5308 @end example
5310 This is a configuration pragma which affects the choice of default alignments
5311 for types and objects where no alignment is explicitly specified. There is a
5312 time/space trade-off in the selection of these values. Large alignments result
5313 in more efficient code, at the expense of larger data space, since sizes have
5314 to be increased to match these alignments. Smaller alignments save space, but
5315 the access code is slower. The normal choice of default alignments for types
5316 and individual alignment promotions for objects (which is what you get if you
5317 do not use this pragma, or if you use an argument of OFF), tries to balance
5318 these two requirements.
5320 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5321 First any packed record is given an alignment of 1. Second, if a size is given
5322 for the type, then the alignment is chosen to avoid increasing this size. For
5323 example, consider:
5325 @example
5326 type R is record
5327    X : Integer;
5328    Y : Character;
5329 end record;
5331 for R'Size use 5*8;
5332 @end example
5334 In the default mode, this type gets an alignment of 4, so that access to the
5335 Integer field X are efficient. But this means that objects of the type end up
5336 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5337 allowed to be bigger than the size of the type, but it can waste space if for
5338 example fields of type R appear in an enclosing record. If the above type is
5339 compiled in @cite{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5341 However, there is one case in which SPACE is ignored. If a variable length
5342 record (that is a discriminated record with a component which is an array
5343 whose length depends on a discriminant), has a pragma Pack, then it is not
5344 in general possible to set the alignment of such a record to one, so the
5345 pragma is ignored in this case (with a warning).
5347 Specifying SPACE also disables alignment promotions for standalone objects,
5348 which occur when the compiler increases the alignment of a specific object
5349 without changing the alignment of its type.
5351 Specifying TIME causes larger default alignments to be chosen in the case of
5352 small types with sizes that are not a power of 2. For example, consider:
5354 @example
5355 type R is record
5356    A : Character;
5357    B : Character;
5358    C : Boolean;
5359 end record;
5361 pragma Pack (R);
5362 for R'Size use 17;
5363 @end example
5365 The default alignment for this record is normally 1, but if this type is
5366 compiled in @cite{Optimize_Alignment (Time)} mode, then the alignment is set
5367 to 4, which wastes space for objects of the type, since they are now 4 bytes
5368 long, but results in more efficient access when the whole record is referenced.
5370 As noted above, this is a configuration pragma, and there is a requirement
5371 that all units in a partition be compiled with a consistent setting of the
5372 optimization setting. This would normally be achieved by use of a configuration
5373 pragma file containing the appropriate setting. The exception to this rule is
5374 that units with an explicit configuration pragma in the same file as the source
5375 unit are excluded from the consistency check, as are all predefined units. The
5376 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5377 pragma appears at the start of the file.
5379 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5380 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{a6}
5381 @section Pragma Ordered
5384 Syntax:
5386 @example
5387 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5388 @end example
5390 Most enumeration types are from a conceptual point of view unordered.
5391 For example, consider:
5393 @example
5394 type Color is (Red, Blue, Green, Yellow);
5395 @end example
5397 By Ada semantics @cite{Blue > Red} and @cite{Green > Blue},
5398 but really these relations make no sense; the enumeration type merely
5399 specifies a set of possible colors, and the order is unimportant.
5401 For unordered enumeration types, it is generally a good idea if
5402 clients avoid comparisons (other than equality or inequality) and
5403 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5404 other than the unit where the type is declared, its body, and its subunits.)
5405 For example, if code buried in some client says:
5407 @example
5408 if Current_Color < Yellow then ...
5409 if Current_Color in Blue .. Green then ...
5410 @end example
5412 then the client code is relying on the order, which is undesirable.
5413 It makes the code hard to read and creates maintenance difficulties if
5414 entries have to be added to the enumeration type. Instead,
5415 the code in the client should list the possibilities, or an
5416 appropriate subtype should be declared in the unit that declares
5417 the original enumeration type. E.g., the following subtype could
5418 be declared along with the type @cite{Color}:
5420 @example
5421 subtype RBG is Color range Red .. Green;
5422 @end example
5424 and then the client could write:
5426 @example
5427 if Current_Color in RBG then ...
5428 if Current_Color = Blue or Current_Color = Green then ...
5429 @end example
5431 However, some enumeration types are legitimately ordered from a conceptual
5432 point of view. For example, if you declare:
5434 @example
5435 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5436 @end example
5438 then the ordering imposed by the language is reasonable, and
5439 clients can depend on it, writing for example:
5441 @example
5442 if D in Mon .. Fri then ...
5443 if D < Wed then ...
5444 @end example
5446 The pragma @emph{Ordered} is provided to mark enumeration types that
5447 are conceptually ordered, alerting the reader that clients may depend
5448 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5449 rather than one to mark them as unordered, since in our experience,
5450 the great majority of enumeration types are conceptually unordered.
5452 The types @cite{Boolean}, @cite{Character}, @cite{Wide_Character},
5453 and @cite{Wide_Wide_Character}
5454 are considered to be ordered types, so each is declared with a
5455 pragma @cite{Ordered} in package @cite{Standard}.
5457 Normally pragma @cite{Ordered} serves only as documentation and a guide for
5458 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5459 requests warnings for inappropriate uses (comparisons and explicit
5460 subranges) for unordered types. If this switch is used, then any
5461 enumeration type not marked with pragma @cite{Ordered} will be considered
5462 as unordered, and will generate warnings for inappropriate uses.
5464 Note that generic types are not considered ordered or unordered (since the
5465 template can be instantiated for both cases), so we never generate warnings
5466 for the case of generic enumerated types.
5468 For additional information please refer to the description of the
5469 @emph{-gnatw.u} switch in the GNAT User's Guide.
5471 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5472 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{a7}
5473 @section Pragma Overflow_Mode
5476 Syntax:
5478 @example
5479 pragma Overflow_Mode
5480  (  [General    =>] MODE
5481   [,[Assertions =>] MODE]);
5483 MODE ::= STRICT | MINIMIZED | ELIMINATED
5484 @end example
5486 This pragma sets the current overflow mode to the given setting. For details
5487 of the meaning of these modes, please refer to the
5488 'Overflow Check Handling in GNAT' appendix in the
5489 GNAT User's Guide. If only the @cite{General} parameter is present,
5490 the given mode applies to all expressions. If both parameters are present,
5491 the @cite{General} mode applies to expressions outside assertions, and
5492 the @cite{Eliminated} mode applies to expressions within assertions.
5494 The case of the @cite{MODE} parameter is ignored,
5495 so @cite{MINIMIZED}, @cite{Minimized} and
5496 @cite{minimized} all have the same effect.
5498 The @cite{Overflow_Mode} pragma has the same scoping and placement
5499 rules as pragma @cite{Suppress}, so it can occur either as a
5500 configuration pragma, specifying a default for the whole
5501 program, or in a declarative scope, where it applies to the
5502 remaining declarations and statements in that scope.
5504 The pragma @cite{Suppress (Overflow_Check)} suppresses
5505 overflow checking, but does not affect the overflow mode.
5507 The pragma @cite{Unsuppress (Overflow_Check)} unsuppresses (enables)
5508 overflow checking, but does not affect the overflow mode.
5510 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5511 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{a8}
5512 @section Pragma Overriding_Renamings
5515 @geindex Rational profile
5517 @geindex Rational compatibility
5519 Syntax:
5521 @example
5522 pragma Overriding_Renamings;
5523 @end example
5525 This is a GNAT configuration pragma to simplify porting
5526 legacy code accepted by the Rational
5527 Ada compiler. In the presence of this pragma, a renaming declaration that
5528 renames an inherited operation declared in the same scope is legal if selected
5529 notation is used as in:
5531 @example
5532 pragma Overriding_Renamings;
5534 package R is
5535   function F (..);
5536   ...
5537   function F (..) renames R.F;
5538 end R;
5539 @end example
5541 even though
5542 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5543 declaration of the overriding operation.
5545 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5546 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{a9}
5547 @section Pragma Partition_Elaboration_Policy
5550 Syntax:
5552 @example
5553 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5555 POLICY_IDENTIFIER ::= Concurrent | Sequential
5556 @end example
5558 This pragma is standard in Ada 2005, but is available in all earlier
5559 versions of Ada as an implementation-defined pragma.
5560 See Ada 2012 Reference Manual for details.
5562 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5563 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{aa}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{ab}
5564 @section Pragma Part_Of
5567 Syntax:
5569 @example
5570 pragma Part_Of (ABSTRACT_STATE);
5572 ABSTRACT_STATE ::= NAME
5573 @end example
5575 For the semantics of this pragma, see the entry for aspect @cite{Part_Of} in the
5576 SPARK 2014 Reference Manual, section 7.2.6.
5578 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
5579 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{ac}
5580 @section Pragma Passive
5583 Syntax:
5585 @example
5586 pragma Passive [(Semaphore | No)];
5587 @end example
5589 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5590 compatibility with DEC Ada 83 implementations, where it is used within a
5591 task definition to request that a task be made passive.  If the argument
5592 @cite{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5593 treats the pragma as an assertion that the containing task is passive
5594 and that optimization of context switch with this task is permitted and
5595 desired.  If the argument @cite{No} is present, the task must not be
5596 optimized.  GNAT does not attempt to optimize any tasks in this manner
5597 (since protected objects are available in place of passive tasks).
5599 For more information on the subject of passive tasks, see the section
5600 'Passive Task Optimization' in the GNAT Users Guide.
5602 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
5603 @anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{ad}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{ae}
5604 @section Pragma Persistent_BSS
5607 Syntax:
5609 @example
5610 pragma Persistent_BSS [(LOCAL_NAME)]
5611 @end example
5613 This pragma allows selected objects to be placed in the @cite{.persistent_bss}
5614 section. On some targets the linker and loader provide for special
5615 treatment of this section, allowing a program to be reloaded without
5616 affecting the contents of this data (hence the name persistent).
5618 There are two forms of usage. If an argument is given, it must be the
5619 local name of a library level object, with no explicit initialization
5620 and whose type is potentially persistent. If no argument is given, then
5621 the pragma is a configuration pragma, and applies to all library level
5622 objects with no explicit initialization of potentially persistent types.
5624 A potentially persistent type is a scalar type, or an untagged,
5625 non-discriminated record, all of whose components have no explicit
5626 initialization and are themselves of a potentially persistent type,
5627 or an array, all of whose constraints are static, and whose component
5628 type is potentially persistent.
5630 If this pragma is used on a target where this feature is not supported,
5631 then the pragma will be ignored. See also @cite{pragma Linker_Section}.
5633 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
5634 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{af}
5635 @section Pragma Polling
5638 Syntax:
5640 @example
5641 pragma Polling (ON | OFF);
5642 @end example
5644 This pragma controls the generation of polling code.  This is normally off.
5645 If @cite{pragma Polling (ON)} is used then periodic calls are generated to
5646 the routine @cite{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5647 runtime library, and can be found in file @code{a-excpol.adb}.
5649 Pragma @cite{Polling} can appear as a configuration pragma (for example it
5650 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
5651 can be used in the statement or declaration sequence to control polling
5652 more locally.
5654 A call to the polling routine is generated at the start of every loop and
5655 at the start of every subprogram call.  This guarantees that the @cite{Poll}
5656 routine is called frequently, and places an upper bound (determined by
5657 the complexity of the code) on the period between two @cite{Poll} calls.
5659 The primary purpose of the polling interface is to enable asynchronous
5660 aborts on targets that cannot otherwise support it (for example Windows
5661 NT), but it may be used for any other purpose requiring periodic polling.
5662 The standard version is null, and can be replaced by a user program.  This
5663 will require re-compilation of the @cite{Ada.Exceptions} package that can
5664 be found in files @code{a-except.ads} and @code{a-except.adb}.
5666 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
5667 distribution) is used to enable the asynchronous abort capability on
5668 targets that do not normally support the capability.  The version of
5669 @cite{Poll} in this file makes a call to the appropriate runtime routine
5670 to test for an abort condition.
5672 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
5673 See the section on switches for gcc in the @cite{GNAT User's Guide}.
5675 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
5676 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b0}
5677 @section Pragma Post
5680 @geindex Post
5682 @geindex Checks
5683 @geindex postconditions
5685 Syntax:
5687 @example
5688 pragma Post (Boolean_Expression);
5689 @end example
5691 The @cite{Post} pragma is intended to be an exact replacement for
5692 the language-defined
5693 @cite{Post} aspect, and shares its restrictions and semantics.
5694 It must appear either immediately following the corresponding
5695 subprogram declaration (only other pragmas may intervene), or
5696 if there is no separate subprogram declaration, then it can
5697 appear at the start of the declarations in a subprogram body
5698 (preceded only by other pragmas).
5700 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
5701 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{b1}
5702 @section Pragma Postcondition
5705 @geindex Postcondition
5707 @geindex Checks
5708 @geindex postconditions
5710 Syntax:
5712 @example
5713 pragma Postcondition (
5714    [Check   =>] Boolean_Expression
5715  [,[Message =>] String_Expression]);
5716 @end example
5718 The @cite{Postcondition} pragma allows specification of automatic
5719 postcondition checks for subprograms. These checks are similar to
5720 assertions, but are automatically inserted just prior to the return
5721 statements of the subprogram with which they are associated (including
5722 implicit returns at the end of procedure bodies and associated
5723 exception handlers).
5725 In addition, the boolean expression which is the condition which
5726 must be true may contain references to function'Result in the case
5727 of a function to refer to the returned value.
5729 @cite{Postcondition} pragmas may appear either immediately following the
5730 (separate) declaration of a subprogram, or at the start of the
5731 declarations of a subprogram body. Only other pragmas may intervene
5732 (that is appear between the subprogram declaration and its
5733 postconditions, or appear before the postcondition in the
5734 declaration sequence in a subprogram body). In the case of a
5735 postcondition appearing after a subprogram declaration, the
5736 formal arguments of the subprogram are visible, and can be
5737 referenced in the postcondition expressions.
5739 The postconditions are collected and automatically tested just
5740 before any return (implicit or explicit) in the subprogram body.
5741 A postcondition is only recognized if postconditions are active
5742 at the time the pragma is encountered. The compiler switch @emph{gnata}
5743 turns on all postconditions by default, and pragma @cite{Check_Policy}
5744 with an identifier of @cite{Postcondition} can also be used to
5745 control whether postconditions are active.
5747 The general approach is that postconditions are placed in the spec
5748 if they represent functional aspects which make sense to the client.
5749 For example we might have:
5751 @example
5752 function Direction return Integer;
5753 pragma Postcondition
5754  (Direction'Result = +1
5755     or else
5756   Direction'Result = -1);
5757 @end example
5759 which serves to document that the result must be +1 or -1, and
5760 will test that this is the case at run time if postcondition
5761 checking is active.
5763 Postconditions within the subprogram body can be used to
5764 check that some internal aspect of the implementation,
5765 not visible to the client, is operating as expected.
5766 For instance if a square root routine keeps an internal
5767 counter of the number of times it is called, then we
5768 might have the following postcondition:
5770 @example
5771 Sqrt_Calls : Natural := 0;
5773 function Sqrt (Arg : Float) return Float is
5774   pragma Postcondition
5775     (Sqrt_Calls = Sqrt_Calls'Old + 1);
5776   ...
5777 end Sqrt
5778 @end example
5780 As this example, shows, the use of the @cite{Old} attribute
5781 is often useful in postconditions to refer to the state on
5782 entry to the subprogram.
5784 Note that postconditions are only checked on normal returns
5785 from the subprogram. If an abnormal return results from
5786 raising an exception, then the postconditions are not checked.
5788 If a postcondition fails, then the exception
5789 @cite{System.Assertions.Assert_Failure} is raised. If
5790 a message argument was supplied, then the given string
5791 will be used as the exception message. If no message
5792 argument was supplied, then the default message has
5793 the form "Postcondition failed at file_name:line". The
5794 exception is raised in the context of the subprogram
5795 body, so it is possible to catch postcondition failures
5796 within the subprogram body itself.
5798 Within a package spec, normal visibility rules
5799 in Ada would prevent forward references within a
5800 postcondition pragma to functions defined later in
5801 the same package. This would introduce undesirable
5802 ordering constraints. To avoid this problem, all
5803 postcondition pragmas are analyzed at the end of
5804 the package spec, allowing forward references.
5806 The following example shows that this even allows
5807 mutually recursive postconditions as in:
5809 @example
5810 package Parity_Functions is
5811    function Odd  (X : Natural) return Boolean;
5812    pragma Postcondition
5813      (Odd'Result =
5814         (x = 1
5815           or else
5816         (x /= 0 and then Even (X - 1))));
5818    function Even (X : Natural) return Boolean;
5819    pragma Postcondition
5820      (Even'Result =
5821         (x = 0
5822           or else
5823         (x /= 1 and then Odd (X - 1))));
5825 end Parity_Functions;
5826 @end example
5828 There are no restrictions on the complexity or form of
5829 conditions used within @cite{Postcondition} pragmas.
5830 The following example shows that it is even possible
5831 to verify performance behavior.
5833 @example
5834 package Sort is
5836    Performance : constant Float;
5837    --  Performance constant set by implementation
5838    --  to match target architecture behavior.
5840    procedure Treesort (Arg : String);
5841    --  Sorts characters of argument using N*logN sort
5842    pragma Postcondition
5843      (Float (Clock - Clock'Old) <=
5844         Float (Arg'Length) *
5845         log (Float (Arg'Length)) *
5846         Performance);
5847 end Sort;
5848 @end example
5850 Note: postcondition pragmas associated with subprograms that are
5851 marked as Inline_Always, or those marked as Inline with front-end
5852 inlining (-gnatN option set) are accepted and legality-checked
5853 by the compiler, but are ignored at run-time even if postcondition
5854 checking is enabled.
5856 Note that pragma @cite{Postcondition} differs from the language-defined
5857 @cite{Post} aspect (and corresponding @cite{Post} pragma) in allowing
5858 multiple occurrences, allowing occurences in the body even if there
5859 is a separate spec, and allowing a second string parameter, and the
5860 use of the pragma identifier @cite{Check}. Historically, pragma
5861 @cite{Postcondition} was implemented prior to the development of
5862 Ada 2012, and has been retained in its original form for
5863 compatibility purposes.
5865 @node Pragma Post_Class,Pragma Pre,Pragma Postcondition,Implementation Defined Pragmas
5866 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{b2}
5867 @section Pragma Post_Class
5870 @geindex Post
5872 @geindex Checks
5873 @geindex postconditions
5875 Syntax:
5877 @example
5878 pragma Post_Class (Boolean_Expression);
5879 @end example
5881 The @cite{Post_Class} pragma is intended to be an exact replacement for
5882 the language-defined
5883 @cite{Post'Class} aspect, and shares its restrictions and semantics.
5884 It must appear either immediately following the corresponding
5885 subprogram declaration (only other pragmas may intervene), or
5886 if there is no separate subprogram declaration, then it can
5887 appear at the start of the declarations in a subprogram body
5888 (preceded only by other pragmas).
5890 Note: This pragma is called @cite{Post_Class} rather than
5891 @cite{Post'Class} because the latter would not be strictly
5892 conforming to the allowed syntax for pragmas. The motivation
5893 for provinding pragmas equivalent to the aspects is to allow a program
5894 to be written using the pragmas, and then compiled if necessary
5895 using an Ada compiler that does not recognize the pragmas or
5896 aspects, but is prepared to ignore the pragmas. The assertion
5897 policy that controls this pragma is @cite{Post'Class}, not
5898 @cite{Post_Class}.
5900 @node Pragma Pre,Pragma Precondition,Pragma Post_Class,Implementation Defined Pragmas
5901 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{b3}
5902 @section Pragma Pre
5905 @geindex Pre
5907 @geindex Checks
5908 @geindex preconditions
5910 Syntax:
5912 @example
5913 pragma Pre (Boolean_Expression);
5914 @end example
5916 The @cite{Pre} pragma is intended to be an exact replacement for
5917 the language-defined
5918 @cite{Pre} aspect, and shares its restrictions and semantics.
5919 It must appear either immediately following the corresponding
5920 subprogram declaration (only other pragmas may intervene), or
5921 if there is no separate subprogram declaration, then it can
5922 appear at the start of the declarations in a subprogram body
5923 (preceded only by other pragmas).
5925 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
5926 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{b4}
5927 @section Pragma Precondition
5930 @geindex Preconditions
5932 @geindex Checks
5933 @geindex preconditions
5935 Syntax:
5937 @example
5938 pragma Precondition (
5939    [Check   =>] Boolean_Expression
5940  [,[Message =>] String_Expression]);
5941 @end example
5943 The @cite{Precondition} pragma is similar to @cite{Postcondition}
5944 except that the corresponding checks take place immediately upon
5945 entry to the subprogram, and if a precondition fails, the exception
5946 is raised in the context of the caller, and the attribute 'Result
5947 cannot be used within the precondition expression.
5949 Otherwise, the placement and visibility rules are identical to those
5950 described for postconditions. The following is an example of use
5951 within a package spec:
5953 @example
5954 package Math_Functions is
5955    ...
5956    function Sqrt (Arg : Float) return Float;
5957    pragma Precondition (Arg >= 0.0)
5958    ...
5959 end Math_Functions;
5960 @end example
5962 @cite{Precondition} pragmas may appear either immediately following the
5963 (separate) declaration of a subprogram, or at the start of the
5964 declarations of a subprogram body. Only other pragmas may intervene
5965 (that is appear between the subprogram declaration and its
5966 postconditions, or appear before the postcondition in the
5967 declaration sequence in a subprogram body).
5969 Note: precondition pragmas associated with subprograms that are
5970 marked as Inline_Always, or those marked as Inline with front-end
5971 inlining (-gnatN option set) are accepted and legality-checked
5972 by the compiler, but are ignored at run-time even if precondition
5973 checking is enabled.
5975 Note that pragma @cite{Precondition} differs from the language-defined
5976 @cite{Pre} aspect (and corresponding @cite{Pre} pragma) in allowing
5977 multiple occurrences, allowing occurences in the body even if there
5978 is a separate spec, and allowing a second string parameter, and the
5979 use of the pragma identifier @cite{Check}. Historically, pragma
5980 @cite{Precondition} was implemented prior to the development of
5981 Ada 2012, and has been retained in its original form for
5982 compatibility purposes.
5984 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
5985 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{b5}@anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{b6}
5986 @section Pragma Predicate
5989 Syntax:
5991 @example
5992 pragma Predicate
5993   ([Entity =>] type_LOCAL_NAME,
5994    [Check  =>] EXPRESSION);
5995 @end example
5997 This pragma (available in all versions of Ada in GNAT) encompasses both
5998 the @cite{Static_Predicate} and @cite{Dynamic_Predicate} aspects in
5999 Ada 2012. A predicate is regarded as static if it has an allowed form
6000 for @cite{Static_Predicate} and is otherwise treated as a
6001 @cite{Dynamic_Predicate}. Otherwise, predicates specified by this
6002 pragma behave exactly as described in the Ada 2012 reference manual.
6003 For example, if we have
6005 @example
6006 type R is range 1 .. 10;
6007 subtype S is R;
6008 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6009 subtype Q is R
6010 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6011 @end example
6013 the effect is identical to the following Ada 2012 code:
6015 @example
6016 type R is range 1 .. 10;
6017 subtype S is R with
6018   Static_Predicate => S not in 4 .. 6;
6019 subtype Q is R with
6020   Dynamic_Predicate => F(Q) or G(Q);
6021 @end example
6023 Note that there are no pragmas @cite{Dynamic_Predicate}
6024 or @cite{Static_Predicate}. That is
6025 because these pragmas would affect legality and semantics of
6026 the program and thus do not have a neutral effect if ignored.
6027 The motivation behind providing pragmas equivalent to
6028 corresponding aspects is to allow a program to be written
6029 using the pragmas, and then compiled with a compiler that
6030 will ignore the pragmas. That doesn't work in the case of
6031 static and dynamic predicates, since if the corresponding
6032 pragmas are ignored, then the behavior of the program is
6033 fundamentally changed (for example a membership test
6034 @cite{A in B} would not take into account a predicate
6035 defined for subtype B). When following this approach, the
6036 use of predicates should be avoided.
6038 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6039 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{b7}
6040 @section Pragma Predicate_Failure
6043 Syntax:
6045 @example
6046 pragma Predicate_Failure
6047   ([Entity  =>] type_LOCAL_NAME,
6048    [Message =>] String_Expression);
6049 @end example
6051 The @cite{Predicate_Failure} pragma is intended to be an exact replacement for
6052 the language-defined
6053 @cite{Predicate_Failure} aspect, and shares its restrictions and semantics.
6055 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6056 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{b8}
6057 @section Pragma Preelaborable_Initialization
6060 Syntax:
6062 @example
6063 pragma Preelaborable_Initialization (DIRECT_NAME);
6064 @end example
6066 This pragma is standard in Ada 2005, but is available in all earlier
6067 versions of Ada as an implementation-defined pragma.
6068 See Ada 2012 Reference Manual for details.
6070 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6071 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{b9}
6072 @section Pragma Prefix_Exception_Messages
6075 @geindex Prefix_Exception_Messages
6077 @geindex exception
6079 @geindex Exception_Message
6081 Syntax:
6083 @example
6084 pragma Prefix_Exception_Messages;
6085 @end example
6087 This is an implementation-defined configuration pragma that affects the
6088 behavior of raise statements with a message given as a static string
6089 constant (typically a string literal). In such cases, the string will
6090 be automatically prefixed by the name of the enclosing entity (giving
6091 the package and subprogram containing the raise statement). This helps
6092 to identify where messages are coming from, and this mode is automatic
6093 for the run-time library.
6095 The pragma has no effect if the message is computed with an expression other
6096 than a static string constant, since the assumption in this case is that
6097 the program computes exactly the string it wants. If you still want the
6098 prefixing in this case, you can always call
6099 @cite{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6101 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6102 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{ba}
6103 @section Pragma Pre_Class
6106 @geindex Pre_Class
6108 @geindex Checks
6109 @geindex preconditions
6111 Syntax:
6113 @example
6114 pragma Pre_Class (Boolean_Expression);
6115 @end example
6117 The @cite{Pre_Class} pragma is intended to be an exact replacement for
6118 the language-defined
6119 @cite{Pre'Class} aspect, and shares its restrictions and semantics.
6120 It must appear either immediately following the corresponding
6121 subprogram declaration (only other pragmas may intervene), or
6122 if there is no separate subprogram declaration, then it can
6123 appear at the start of the declarations in a subprogram body
6124 (preceded only by other pragmas).
6126 Note: This pragma is called @cite{Pre_Class} rather than
6127 @cite{Pre'Class} because the latter would not be strictly
6128 conforming to the allowed syntax for pragmas. The motivation
6129 for providing pragmas equivalent to the aspects is to allow a program
6130 to be written using the pragmas, and then compiled if necessary
6131 using an Ada compiler that does not recognize the pragmas or
6132 aspects, but is prepared to ignore the pragmas. The assertion
6133 policy that controls this pragma is @cite{Pre'Class}, not
6134 @cite{Pre_Class}.
6136 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6137 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{bb}
6138 @section Pragma Priority_Specific_Dispatching
6141 Syntax:
6143 @example
6144 pragma Priority_Specific_Dispatching (
6145    POLICY_IDENTIFIER,
6146    first_priority_EXPRESSION,
6147    last_priority_EXPRESSION)
6149 POLICY_IDENTIFIER ::=
6150    EDF_Across_Priorities            |
6151    FIFO_Within_Priorities           |
6152    Non_Preemptive_Within_Priorities |
6153    Round_Robin_Within_Priorities
6154 @end example
6156 This pragma is standard in Ada 2005, but is available in all earlier
6157 versions of Ada as an implementation-defined pragma.
6158 See Ada 2012 Reference Manual for details.
6160 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6161 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{bc}
6162 @section Pragma Profile
6165 Syntax:
6167 @example
6168 pragma Profile (Ravenscar | Restricted | Rational | GNAT_Extended_Ravenscar);
6169 @end example
6171 This pragma is standard in Ada 2005, but is available in all earlier
6172 versions of Ada as an implementation-defined pragma. This is a
6173 configuration pragma that establishes a set of configuration pragmas
6174 that depend on the argument. @cite{Ravenscar} is standard in Ada 2005.
6175 The other possibilities (@cite{Restricted}, @cite{Rational}, @cite{GNAT_Extended_Ravenscar})
6176 are implementation-defined. The set of configuration pragmas
6177 is defined in the following sections.
6180 @itemize *
6182 @item 
6183 Pragma Profile (Ravenscar)
6185 The @cite{Ravenscar} profile is standard in Ada 2005,
6186 but is available in all earlier
6187 versions of Ada as an implementation-defined pragma. This profile
6188 establishes the following set of configuration pragmas:
6191 @itemize *
6193 @item 
6194 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6196 [RM D.2.2] Tasks are dispatched following a preemptive
6197 priority-ordered scheduling policy.
6199 @item 
6200 @code{Locking_Policy (Ceiling_Locking)}
6202 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6203 the ceiling priority of the corresponding protected object.
6205 @item 
6206 @code{Detect_Blocking}
6208 This pragma forces the detection of potentially blocking operations within a
6209 protected operation, and to raise Program_Error if that happens.
6210 @end itemize
6212 plus the following set of restrictions:
6215 @itemize *
6217 @item 
6218 @code{Max_Entry_Queue_Length => 1}
6220 No task can be queued on a protected entry.
6222 @item 
6223 @code{Max_Protected_Entries => 1}
6225 @item 
6226 @code{Max_Task_Entries => 0}
6228 No rendezvous statements are allowed.
6230 @item 
6231 @code{No_Abort_Statements}
6233 @item 
6234 @code{No_Dynamic_Attachment}
6236 @item 
6237 @code{No_Dynamic_Priorities}
6239 @item 
6240 @code{No_Implicit_Heap_Allocations}
6242 @item 
6243 @code{No_Local_Protected_Objects}
6245 @item 
6246 @code{No_Local_Timing_Events}
6248 @item 
6249 @code{No_Protected_Type_Allocators}
6251 @item 
6252 @code{No_Relative_Delay}
6254 @item 
6255 @code{No_Requeue_Statements}
6257 @item 
6258 @code{No_Select_Statements}
6260 @item 
6261 @code{No_Specific_Termination_Handlers}
6263 @item 
6264 @code{No_Task_Allocators}
6266 @item 
6267 @code{No_Task_Hierarchy}
6269 @item 
6270 @code{No_Task_Termination}
6272 @item 
6273 @code{Simple_Barriers}
6274 @end itemize
6276 The Ravenscar profile also includes the following restrictions that specify
6277 that there are no semantic dependences on the corresponding predefined
6278 packages:
6281 @itemize *
6283 @item 
6284 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6286 @item 
6287 @code{No_Dependence => Ada.Calendar}
6289 @item 
6290 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6292 @item 
6293 @code{No_Dependence => Ada.Execution_Time.Timers}
6295 @item 
6296 @code{No_Dependence => Ada.Task_Attributes}
6298 @item 
6299 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6300 @end itemize
6302 This set of configuration pragmas and restrictions correspond to the
6303 definition of the 'Ravenscar Profile' for limited tasking, devised and
6304 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6305 A description is also available at
6306 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6308 The original definition of the profile was revised at subsequent IRTAW
6309 meetings. It has been included in the ISO
6310 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6311 and was made part of the Ada 2005 standard.
6312 The formal definition given by
6313 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6314 AI-305) available at
6315 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6316 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6318 The above set is a superset of the restrictions provided by pragma
6319 @code{Profile (Restricted)}, it includes six additional restrictions
6320 (@code{Simple_Barriers}, @code{No_Select_Statements},
6321 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6322 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6323 that pragma @code{Profile (Ravenscar)}, like the pragma
6324 @code{Profile (Restricted)},
6325 automatically causes the use of a simplified,
6326 more efficient version of the tasking run-time library.
6328 @item 
6329 Pragma Profile (GNAT_Extended_Ravenscar)
6331 This profile corresponds to a GNAT specific extension of the
6332 Ravenscar profile. The profile may change in the future although
6333 only in a compatible way: some restrictions may be removed or
6334 relaxed. It is defined as a variation of the Ravenscar profile.
6336 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6337 by @code{No_Implicit_Task_Allocations} and
6338 @code{No_Implicit_Protected_Object_Allocations}.
6340 The @code{Simple_Barriers} restriction has been replaced by
6341 @code{Pure_Barriers}.
6343 @item 
6344 Pragma Profile (Restricted)
6346 This profile corresponds to the GNAT restricted run time. It
6347 establishes the following set of restrictions:
6350 @itemize *
6352 @item 
6353 @code{No_Abort_Statements}
6355 @item 
6356 @code{No_Entry_Queue}
6358 @item 
6359 @code{No_Task_Hierarchy}
6361 @item 
6362 @code{No_Task_Allocators}
6364 @item 
6365 @code{No_Dynamic_Priorities}
6367 @item 
6368 @code{No_Terminate_Alternatives}
6370 @item 
6371 @code{No_Dynamic_Attachment}
6373 @item 
6374 @code{No_Protected_Type_Allocators}
6376 @item 
6377 @code{No_Local_Protected_Objects}
6379 @item 
6380 @code{No_Requeue_Statements}
6382 @item 
6383 @code{No_Task_Attributes_Package}
6385 @item 
6386 @code{Max_Asynchronous_Select_Nesting =  0}
6388 @item 
6389 @code{Max_Task_Entries =  0}
6391 @item 
6392 @code{Max_Protected_Entries = 1}
6394 @item 
6395 @code{Max_Select_Alternatives = 0}
6396 @end itemize
6398 This set of restrictions causes the automatic selection of a simplified
6399 version of the run time that provides improved performance for the
6400 limited set of tasking functionality permitted by this set of restrictions.
6402 @item 
6403 Pragma Profile (Rational)
6405 The Rational profile is intended to facilitate porting legacy code that
6406 compiles with the Rational APEX compiler, even when the code includes non-
6407 conforming Ada constructs.  The profile enables the following three pragmas:
6410 @itemize *
6412 @item 
6413 @code{pragma Implicit_Packing}
6415 @item 
6416 @code{pragma Overriding_Renamings}
6418 @item 
6419 @code{pragma Use_VADS_Size}
6420 @end itemize
6421 @end itemize
6423 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6424 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{bd}
6425 @section Pragma Profile_Warnings
6428 Syntax:
6430 @example
6431 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6432 @end example
6434 This is an implementation-defined pragma that is similar in
6435 effect to @cite{pragma Profile} except that instead of
6436 generating @cite{Restrictions} pragmas, it generates
6437 @cite{Restriction_Warnings} pragmas. The result is that
6438 violations of the profile generate warning messages instead
6439 of error messages.
6441 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6442 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{be}
6443 @section Pragma Propagate_Exceptions
6446 @geindex Interfacing to C++
6448 Syntax:
6450 @example
6451 pragma Propagate_Exceptions;
6452 @end example
6454 This pragma is now obsolete and, other than generating a warning if warnings
6455 on obsolescent features are enabled, is ignored.
6456 It is retained for compatibility
6457 purposes. It used to be used in connection with optimization of
6458 a now-obsolete mechanism for implementation of exceptions.
6460 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6461 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{bf}
6462 @section Pragma Provide_Shift_Operators
6465 @geindex Shift operators
6467 Syntax:
6469 @example
6470 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6471 @end example
6473 This pragma can be applied to a first subtype local name that specifies
6474 either an unsigned or signed type. It has the effect of providing the
6475 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6476 Rotate_Left and Rotate_Right) for the given type. It is similar to
6477 including the function declarations for these five operators, together
6478 with the pragma Import (Intrinsic, ...) statements.
6480 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6481 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{c0}
6482 @section Pragma Psect_Object
6485 Syntax:
6487 @example
6488 pragma Psect_Object (
6489      [Internal =>] LOCAL_NAME,
6490   [, [External =>] EXTERNAL_SYMBOL]
6491   [, [Size     =>] EXTERNAL_SYMBOL]);
6493 EXTERNAL_SYMBOL ::=
6494   IDENTIFIER
6495 | static_string_EXPRESSION
6496 @end example
6498 This pragma is identical in effect to pragma @cite{Common_Object}.
6500 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6501 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{c1}@anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{c2}
6502 @section Pragma Pure_Function
6505 Syntax:
6507 @example
6508 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6509 @end example
6511 This pragma appears in the same declarative part as a function
6512 declaration (or a set of function declarations if more than one
6513 overloaded declaration exists, in which case the pragma applies
6514 to all entities).  It specifies that the function @cite{Entity} is
6515 to be considered pure for the purposes of code generation.  This means
6516 that the compiler can assume that there are no side effects, and
6517 in particular that two calls with identical arguments produce the
6518 same result.  It also means that the function can be used in an
6519 address clause.
6521 Note that, quite deliberately, there are no static checks to try
6522 to ensure that this promise is met, so @cite{Pure_Function} can be used
6523 with functions that are conceptually pure, even if they do modify
6524 global variables.  For example, a square root function that is
6525 instrumented to count the number of times it is called is still
6526 conceptually pure, and can still be optimized, even though it
6527 modifies a global variable (the count).  Memo functions are another
6528 example (where a table of previous calls is kept and consulted to
6529 avoid re-computation).
6531 Note also that the normal rules excluding optimization of subprograms
6532 in pure units (when parameter types are descended from System.Address,
6533 or when the full view of a parameter type is limited), do not apply
6534 for the Pure_Function case. If you explicitly specify Pure_Function,
6535 the compiler may optimize away calls with identical arguments, and
6536 if that results in unexpected behavior, the proper action is not to
6537 use the pragma for subprograms that are not (conceptually) pure.
6539 Note: Most functions in a @cite{Pure} package are automatically pure, and
6540 there is no need to use pragma @cite{Pure_Function} for such functions.  One
6541 exception is any function that has at least one formal of type
6542 @cite{System.Address} or a type derived from it.  Such functions are not
6543 considered pure by default, since the compiler assumes that the
6544 @cite{Address} parameter may be functioning as a pointer and that the
6545 referenced data may change even if the address value does not.
6546 Similarly, imported functions are not considered to be pure by default,
6547 since there is no way of checking that they are in fact pure.  The use
6548 of pragma @cite{Pure_Function} for such a function will override these default
6549 assumption, and cause the compiler to treat a designated subprogram as pure
6550 in these cases.
6552 Note: If pragma @cite{Pure_Function} is applied to a renamed function, it
6553 applies to the underlying renamed function.  This can be used to
6554 disambiguate cases of overloading where some but not all functions
6555 in a set of overloaded functions are to be designated as pure.
6557 If pragma @cite{Pure_Function} is applied to a library level function, the
6558 function is also considered pure from an optimization point of view, but the
6559 unit is not a Pure unit in the categorization sense. So for example, a function
6560 thus marked is free to @cite{with} non-pure units.
6562 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6563 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{c3}
6564 @section Pragma Rational
6567 Syntax:
6569 @example
6570 pragma Rational;
6571 @end example
6573 This pragma is considered obsolescent, but is retained for
6574 compatibility purposes. It is equivalent to:
6576 @example
6577 pragma Profile (Rational);
6578 @end example
6580 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6581 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{c4}
6582 @section Pragma Ravenscar
6585 Syntax:
6587 @example
6588 pragma Ravenscar;
6589 @end example
6591 This pragma is considered obsolescent, but is retained for
6592 compatibility purposes. It is equivalent to:
6594 @example
6595 pragma Profile (Ravenscar);
6596 @end example
6598 which is the preferred method of setting the @cite{Ravenscar} profile.
6600 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6601 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{c5}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{c6}
6602 @section Pragma Refined_Depends
6605 Syntax:
6607 @example
6608 pragma Refined_Depends (DEPENDENCY_RELATION);
6610 DEPENDENCY_RELATION ::=
6611      null
6612   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
6614 DEPENDENCY_CLAUSE ::=
6615     OUTPUT_LIST =>[+] INPUT_LIST
6616   | NULL_DEPENDENCY_CLAUSE
6618 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
6620 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
6622 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
6624 OUTPUT ::= NAME | FUNCTION_RESULT
6625 INPUT  ::= NAME
6627 where FUNCTION_RESULT is a function Result attribute_reference
6628 @end example
6630 For the semantics of this pragma, see the entry for aspect @cite{Refined_Depends} in
6631 the SPARK 2014 Reference Manual, section 6.1.5.
6633 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6634 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{c7}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{c8}
6635 @section Pragma Refined_Global
6638 Syntax:
6640 @example
6641 pragma Refined_Global (GLOBAL_SPECIFICATION);
6643 GLOBAL_SPECIFICATION ::=
6644      null
6645   | (GLOBAL_LIST)
6646   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
6648 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
6650 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
6651 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
6652 GLOBAL_ITEM   ::= NAME
6653 @end example
6655 For the semantics of this pragma, see the entry for aspect @cite{Refined_Global} in
6656 the SPARK 2014 Reference Manual, section 6.1.4.
6658 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
6659 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{c9}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{ca}
6660 @section Pragma Refined_Post
6663 Syntax:
6665 @example
6666 pragma Refined_Post (boolean_EXPRESSION);
6667 @end example
6669 For the semantics of this pragma, see the entry for aspect @cite{Refined_Post} in
6670 the SPARK 2014 Reference Manual, section 7.2.7.
6672 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
6673 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{cb}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{cc}
6674 @section Pragma Refined_State
6677 Syntax:
6679 @example
6680 pragma Refined_State (REFINEMENT_LIST);
6682 REFINEMENT_LIST ::=
6683   (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
6685 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
6687 CONSTITUENT_LIST ::=
6688      null
6689   |  CONSTITUENT
6690   | (CONSTITUENT @{, CONSTITUENT@})
6692 CONSTITUENT ::= object_NAME | state_NAME
6693 @end example
6695 For the semantics of this pragma, see the entry for aspect @cite{Refined_State} in
6696 the SPARK 2014 Reference Manual, section 7.2.2.
6698 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
6699 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{cd}
6700 @section Pragma Relative_Deadline
6703 Syntax:
6705 @example
6706 pragma Relative_Deadline (time_span_EXPRESSION);
6707 @end example
6709 This pragma is standard in Ada 2005, but is available in all earlier
6710 versions of Ada as an implementation-defined pragma.
6711 See Ada 2012 Reference Manual for details.
6713 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
6714 @anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{cf}
6715 @section Pragma Remote_Access_Type
6718 Syntax:
6720 @example
6721 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
6722 @end example
6724 This pragma appears in the formal part of a generic declaration.
6725 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
6726 the use of a remote access to class-wide type as actual for a formal
6727 access type.
6729 When this pragma applies to a formal access type @cite{Entity}, that
6730 type is treated as a remote access to class-wide type in the generic.
6731 It must be a formal general access type, and its designated type must
6732 be the class-wide type of a formal tagged limited private type from the
6733 same generic declaration.
6735 In the generic unit, the formal type is subject to all restrictions
6736 pertaining to remote access to class-wide types. At instantiation, the
6737 actual type must be a remote access to class-wide type.
6739 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
6740 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{d0}
6741 @section Pragma Restricted_Run_Time
6744 Syntax:
6746 @example
6747 pragma Restricted_Run_Time;
6748 @end example
6750 This pragma is considered obsolescent, but is retained for
6751 compatibility purposes. It is equivalent to:
6753 @example
6754 pragma Profile (Restricted);
6755 @end example
6757 which is the preferred method of setting the restricted run time
6758 profile.
6760 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
6761 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{d1}
6762 @section Pragma Restriction_Warnings
6765 Syntax:
6767 @example
6768 pragma Restriction_Warnings
6769   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
6770 @end example
6772 This pragma allows a series of restriction identifiers to be
6773 specified (the list of allowed identifiers is the same as for
6774 pragma @cite{Restrictions}). For each of these identifiers
6775 the compiler checks for violations of the restriction, but
6776 generates a warning message rather than an error message
6777 if the restriction is violated.
6779 One use of this is in situations where you want to know
6780 about violations of a restriction, but you want to ignore some of
6781 these violations. Consider this example, where you want to set
6782 Ada_95 mode and enable style checks, but you want to know about
6783 any other use of implementation pragmas:
6785 @example
6786 pragma Restriction_Warnings (No_Implementation_Pragmas);
6787 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
6788 pragma Ada_95;
6789 pragma Style_Checks ("2bfhkM160");
6790 pragma Warnings (On, "violation of No_Implementation_Pragmas");
6791 @end example
6793 By including the above lines in a configuration pragmas file,
6794 the Ada_95 and Style_Checks pragmas are accepted without
6795 generating a warning, but any other use of implementation
6796 defined pragmas will cause a warning to be generated.
6798 @node Pragma Reviewable,Pragma Share_Generic,Pragma Restriction_Warnings,Implementation Defined Pragmas
6799 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{d2}
6800 @section Pragma Reviewable
6803 Syntax:
6805 @example
6806 pragma Reviewable;
6807 @end example
6809 This pragma is an RM-defined standard pragma, but has no effect on the
6810 program being compiled, or on the code generated for the program.
6812 To obtain the required output specified in RM H.3.1, the compiler must be
6813 run with various special switches as follows:
6816 @itemize *
6818 @item 
6819 @emph{Where compiler-generated run-time checks remain}
6821 The switch @emph{-gnatGL}
6822 may be used to list the expanded code in pseudo-Ada form.
6823 Runtime checks show up in the listing either as explicit
6824 checks or operators marked with @{@} to indicate a check is present.
6826 @item 
6827 @emph{An identification of known exceptions at compile time}
6829 If the program is compiled with @emph{-gnatwa},
6830 the compiler warning messages will indicate all cases where the compiler
6831 detects that an exception is certain to occur at run time.
6833 @item 
6834 @emph{Possible reads of uninitialized variables}
6836 The compiler warns of many such cases, but its output is incomplete.
6837 @end itemize
6840 A supplemental static analysis tool
6841 may be used to obtain a comprehensive list of all
6842 possible points at which uninitialized data may be read.
6845 @itemize *
6847 @item 
6848 @emph{Where run-time support routines are implicitly invoked}
6850 In the output from @emph{-gnatGL},
6851 run-time calls are explicitly listed as calls to the relevant
6852 run-time routine.
6854 @item 
6855 @emph{Object code listing}
6857 This may be obtained either by using the @emph{-S} switch,
6858 or the objdump utility.
6860 @item 
6861 @emph{Constructs known to be erroneous at compile time}
6863 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
6865 @item 
6866 @emph{Stack usage information}
6868 Static stack usage data (maximum per-subprogram) can be obtained via the
6869 @emph{-fstack-usage} switch to the compiler.
6870 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
6871 to gnatbind
6872 @end itemize
6876 @itemize *
6878 @item 
6879 @emph{Object code listing of entire partition}
6881 This can be obtained by compiling the partition with @emph{-S},
6882 or by applying objdump
6883 to all the object files that are part of the partition.
6885 @item 
6886 @emph{A description of the run-time model}
6888 The full sources of the run-time are available, and the documentation of
6889 these routines describes how these run-time routines interface to the
6890 underlying operating system facilities.
6892 @item 
6893 @emph{Control and data-flow information}
6894 @end itemize
6897 A supplemental static analysis tool
6898 may be used to obtain complete control and data-flow information, as well as
6899 comprehensive messages identifying possible problems based on this
6900 information.
6902 @node Pragma Share_Generic,Pragma Shared,Pragma Reviewable,Implementation Defined Pragmas
6903 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{d3}
6904 @section Pragma Share_Generic
6907 Syntax:
6909 @example
6910 pragma Share_Generic (GNAME @{, GNAME@});
6912 GNAME ::= generic_unit_NAME | generic_instance_NAME
6913 @end example
6915 This pragma is provided for compatibility with Dec Ada 83. It has
6916 no effect in @cite{GNAT} (which does not implement shared generics), other
6917 than to check that the given names are all names of generic units or
6918 generic instances.
6920 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
6921 @anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d4}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{d5}
6922 @section Pragma Shared
6925 This pragma is provided for compatibility with Ada 83. The syntax and
6926 semantics are identical to pragma Atomic.
6928 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
6929 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{d6}
6930 @section Pragma Short_Circuit_And_Or
6933 Syntax:
6935 @example
6936 pragma Short_Circuit_And_Or;
6937 @end example
6939 This configuration pragma causes any occurrence of the AND operator applied to
6940 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
6941 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
6942 may be useful in the context of certification protocols requiring the use of
6943 short-circuited logical operators. If this configuration pragma occurs locally
6944 within the file being compiled, it applies only to the file being compiled.
6945 There is no requirement that all units in a partition use this option.
6947 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
6948 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{d7}
6949 @section Pragma Short_Descriptors
6952 Syntax:
6954 @example
6955 pragma Short_Descriptors
6956 @end example
6958 This pragma is provided for compatibility with other Ada implementations. It
6959 is recognized but ignored by all current versions of GNAT.
6961 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
6962 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{d8}@anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d9}
6963 @section Pragma Simple_Storage_Pool_Type
6966 @geindex Storage pool
6967 @geindex simple
6969 @geindex Simple storage pool
6971 Syntax:
6973 @example
6974 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
6975 @end example
6977 A type can be established as a 'simple storage pool type' by applying
6978 the representation pragma @cite{Simple_Storage_Pool_Type} to the type.
6979 A type named in the pragma must be a library-level immutably limited record
6980 type or limited tagged type declared immediately within a package declaration.
6981 The type can also be a limited private type whose full type is allowed as
6982 a simple storage pool type.
6984 For a simple storage pool type @cite{SSP}, nonabstract primitive subprograms
6985 @cite{Allocate}, @cite{Deallocate}, and @cite{Storage_Size} can be declared that
6986 are subtype conformant with the following subprogram declarations:
6988 @example
6989 procedure Allocate
6990   (Pool                     : in out SSP;
6991    Storage_Address          : out System.Address;
6992    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6993    Alignment                : System.Storage_Elements.Storage_Count);
6995 procedure Deallocate
6996   (Pool : in out SSP;
6997    Storage_Address          : System.Address;
6998    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6999    Alignment                : System.Storage_Elements.Storage_Count);
7001 function Storage_Size (Pool : SSP)
7002   return System.Storage_Elements.Storage_Count;
7003 @end example
7005 Procedure @cite{Allocate} must be declared, whereas @cite{Deallocate} and
7006 @cite{Storage_Size} are optional. If @cite{Deallocate} is not declared, then
7007 applying an unchecked deallocation has no effect other than to set its actual
7008 parameter to null. If @cite{Storage_Size} is not declared, then the
7009 @cite{Storage_Size} attribute applied to an access type associated with
7010 a pool object of type SSP returns zero. Additional operations can be declared
7011 for a simple storage pool type (such as for supporting a mark/release
7012 storage-management discipline).
7014 An object of a simple storage pool type can be associated with an access
7015 type by specifying the attribute
7016 @ref{da,,Simple_Storage_Pool}. For example:
7018 @example
7019 My_Pool : My_Simple_Storage_Pool_Type;
7021 type Acc is access My_Data_Type;
7023 for Acc'Simple_Storage_Pool use My_Pool;
7024 @end example
7026 See attribute @ref{da,,Simple_Storage_Pool}
7027 for further details.
7029 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7030 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{db}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{dc}
7031 @section Pragma Source_File_Name
7034 Syntax:
7036 @example
7037 pragma Source_File_Name (
7038   [Unit_Name   =>] unit_NAME,
7039   Spec_File_Name =>  STRING_LITERAL,
7040   [Index => INTEGER_LITERAL]);
7042 pragma Source_File_Name (
7043   [Unit_Name   =>] unit_NAME,
7044   Body_File_Name =>  STRING_LITERAL,
7045   [Index => INTEGER_LITERAL]);
7046 @end example
7048 Use this to override the normal naming convention.  It is a configuration
7049 pragma, and so has the usual applicability of configuration pragmas
7050 (i.e., it applies to either an entire partition, or to all units in a
7051 compilation, or to a single unit, depending on how it is used.
7052 @cite{unit_name} is mapped to @cite{file_name_literal}.  The identifier for
7053 the second argument is required, and indicates whether this is the file
7054 name for the spec or for the body.
7056 The optional Index argument should be used when a file contains multiple
7057 units, and when you do not want to use @cite{gnatchop} to separate then
7058 into multiple files (which is the recommended procedure to limit the
7059 number of recompilations that are needed when some sources change).
7060 For instance, if the source file @code{source.ada} contains
7062 @example
7063 package B is
7065 end B;
7067 with B;
7068 procedure A is
7069 begin
7070    ..
7071 end A;
7072 @end example
7074 you could use the following configuration pragmas:
7076 @example
7077 pragma Source_File_Name
7078   (B, Spec_File_Name => "source.ada", Index => 1);
7079 pragma Source_File_Name
7080   (A, Body_File_Name => "source.ada", Index => 2);
7081 @end example
7083 Note that the @cite{gnatname} utility can also be used to generate those
7084 configuration pragmas.
7086 Another form of the @cite{Source_File_Name} pragma allows
7087 the specification of patterns defining alternative file naming schemes
7088 to apply to all files.
7090 @example
7091 pragma Source_File_Name
7092   (  [Spec_File_Name  =>] STRING_LITERAL
7093    [,[Casing          =>] CASING_SPEC]
7094    [,[Dot_Replacement =>] STRING_LITERAL]);
7096 pragma Source_File_Name
7097   (  [Body_File_Name  =>] STRING_LITERAL
7098    [,[Casing          =>] CASING_SPEC]
7099    [,[Dot_Replacement =>] STRING_LITERAL]);
7101 pragma Source_File_Name
7102   (  [Subunit_File_Name =>] STRING_LITERAL
7103    [,[Casing            =>] CASING_SPEC]
7104    [,[Dot_Replacement   =>] STRING_LITERAL]);
7106 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7107 @end example
7109 The first argument is a pattern that contains a single asterisk indicating
7110 the point at which the unit name is to be inserted in the pattern string
7111 to form the file name.  The second argument is optional.  If present it
7112 specifies the casing of the unit name in the resulting file name string.
7113 The default is lower case.  Finally the third argument allows for systematic
7114 replacement of any dots in the unit name by the specified string literal.
7116 Note that Source_File_Name pragmas should not be used if you are using
7117 project files. The reason for this rule is that the project manager is not
7118 aware of these pragmas, and so other tools that use the projet file would not
7119 be aware of the intended naming conventions. If you are using project files,
7120 file naming is controlled by Source_File_Name_Project pragmas, which are
7121 usually supplied automatically by the project manager. A pragma
7122 Source_File_Name cannot appear after a @ref{dd,,Pragma Source_File_Name_Project}.
7124 For more details on the use of the @cite{Source_File_Name} pragma, see the
7125 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7127 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7128 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{de}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{dd}
7129 @section Pragma Source_File_Name_Project
7132 This pragma has the same syntax and semantics as pragma Source_File_Name.
7133 It is only allowed as a stand-alone configuration pragma.
7134 It cannot appear after a @ref{dc,,Pragma Source_File_Name}, and
7135 most importantly, once pragma Source_File_Name_Project appears,
7136 no further Source_File_Name pragmas are allowed.
7138 The intention is that Source_File_Name_Project pragmas are always
7139 generated by the Project Manager in a manner consistent with the naming
7140 specified in a project file, and when naming is controlled in this manner,
7141 it is not permissible to attempt to modify this naming scheme using
7142 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7143 known to the project manager).
7145 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7146 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{df}
7147 @section Pragma Source_Reference
7150 Syntax:
7152 @example
7153 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7154 @end example
7156 This pragma must appear as the first line of a source file.
7157 @cite{integer_literal} is the logical line number of the line following
7158 the pragma line (for use in error messages and debugging
7159 information).  @cite{string_literal} is a static string constant that
7160 specifies the file name to be used in error messages and debugging
7161 information.  This is most notably used for the output of @cite{gnatchop}
7162 with the @emph{-r} switch, to make sure that the original unchopped
7163 source file is the one referred to.
7165 The second argument must be a string literal, it cannot be a static
7166 string expression other than a string literal.  This is because its value
7167 is needed for error messages issued by all phases of the compiler.
7169 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7170 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{e0}@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e1}
7171 @section Pragma SPARK_Mode
7174 Syntax:
7176 @example
7177 pragma SPARK_Mode [(On | Off)] ;
7178 @end example
7180 In general a program can have some parts that are in SPARK 2014 (and
7181 follow all the rules in the SPARK Reference Manual), and some parts
7182 that are full Ada 2012.
7184 The SPARK_Mode pragma is used to identify which parts are in SPARK
7185 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7186 be used in the following places:
7189 @itemize *
7191 @item 
7192 As a configuration pragma, in which case it sets the default mode for
7193 all units compiled with this pragma.
7195 @item 
7196 Immediately following a library-level subprogram spec
7198 @item 
7199 Immediately within a library-level package body
7201 @item 
7202 Immediately following the @cite{private} keyword of a library-level
7203 package spec
7205 @item 
7206 Immediately following the @cite{begin} keyword of a library-level
7207 package body
7209 @item 
7210 Immediately within a library-level subprogram body
7211 @end itemize
7213 Normally a subprogram or package spec/body inherits the current mode
7214 that is active at the point it is declared. But this can be overridden
7215 by pragma within the spec or body as above.
7217 The basic consistency rule is that you can't turn SPARK_Mode back
7218 @cite{On}, once you have explicitly (with a pragma) turned if
7219 @cite{Off}. So the following rules apply:
7221 If a subprogram spec has SPARK_Mode @cite{Off}, then the body must
7222 also have SPARK_Mode @cite{Off}.
7224 For a package, we have four parts:
7227 @itemize *
7229 @item 
7230 the package public declarations
7232 @item 
7233 the package private part
7235 @item 
7236 the body of the package
7238 @item 
7239 the elaboration code after @cite{begin}
7240 @end itemize
7242 For a package, the rule is that if you explicitly turn SPARK_Mode
7243 @cite{Off} for any part, then all the following parts must have
7244 SPARK_Mode @cite{Off}. Note that this may require repeating a pragma
7245 SPARK_Mode (@cite{Off}) in the body. For example, if we have a
7246 configuration pragma SPARK_Mode (@cite{On}) that turns the mode on by
7247 default everywhere, and one particular package spec has pragma
7248 SPARK_Mode (@cite{Off}), then that pragma will need to be repeated in
7249 the package body.
7251 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7252 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{e2}
7253 @section Pragma Static_Elaboration_Desired
7256 Syntax:
7258 @example
7259 pragma Static_Elaboration_Desired;
7260 @end example
7262 This pragma is used to indicate that the compiler should attempt to initialize
7263 statically the objects declared in the library unit to which the pragma applies,
7264 when these objects are initialized (explicitly or implicitly) by an aggregate.
7265 In the absence of this pragma, aggregates in object declarations are expanded
7266 into assignments and loops, even when the aggregate components are static
7267 constants. When the aggregate is present the compiler builds a static expression
7268 that requires no run-time code, so that the initialized object can be placed in
7269 read-only data space. If the components are not static, or the aggregate has
7270 more that 100 components, the compiler emits a warning that the pragma cannot
7271 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7272 construction of larger aggregates with static components that include an others
7273 choice.)
7275 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7276 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{e3}
7277 @section Pragma Stream_Convert
7280 Syntax:
7282 @example
7283 pragma Stream_Convert (
7284   [Entity =>] type_LOCAL_NAME,
7285   [Read   =>] function_NAME,
7286   [Write  =>] function_NAME);
7287 @end example
7289 This pragma provides an efficient way of providing user-defined stream
7290 attributes.  Not only is it simpler to use than specifying the attributes
7291 directly, but more importantly, it allows the specification to be made in such
7292 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7293 needed (i.e. unless the stream attributes are actually used); the use of
7294 the Stream_Convert pragma adds no overhead at all, unless the stream
7295 attributes are actually used on the designated type.
7297 The first argument specifies the type for which stream functions are
7298 provided.  The second parameter provides a function used to read values
7299 of this type.  It must name a function whose argument type may be any
7300 subtype, and whose returned type must be the type given as the first
7301 argument to the pragma.
7303 The meaning of the @cite{Read} parameter is that if a stream attribute directly
7304 or indirectly specifies reading of the type given as the first parameter,
7305 then a value of the type given as the argument to the Read function is
7306 read from the stream, and then the Read function is used to convert this
7307 to the required target type.
7309 Similarly the @cite{Write} parameter specifies how to treat write attributes
7310 that directly or indirectly apply to the type given as the first parameter.
7311 It must have an input parameter of the type specified by the first parameter,
7312 and the return type must be the same as the input type of the Read function.
7313 The effect is to first call the Write function to convert to the given stream
7314 type, and then write the result type to the stream.
7316 The Read and Write functions must not be overloaded subprograms.  If necessary
7317 renamings can be supplied to meet this requirement.
7318 The usage of this attribute is best illustrated by a simple example, taken
7319 from the GNAT implementation of package Ada.Strings.Unbounded:
7321 @example
7322 function To_Unbounded (S : String) return Unbounded_String
7323   renames To_Unbounded_String;
7325 pragma Stream_Convert
7326   (Unbounded_String, To_Unbounded, To_String);
7327 @end example
7329 The specifications of the referenced functions, as given in the Ada
7330 Reference Manual are:
7332 @example
7333 function To_Unbounded_String (Source : String)
7334   return Unbounded_String;
7336 function To_String (Source : Unbounded_String)
7337   return String;
7338 @end example
7340 The effect is that if the value of an unbounded string is written to a stream,
7341 then the representation of the item in the stream is in the same format that
7342 would be used for @cite{Standard.String'Output}, and this same representation
7343 is expected when a value of this type is read from the stream. Note that the
7344 value written always includes the bounds, even for Unbounded_String'Write,
7345 since Unbounded_String is not an array type.
7347 Note that the @cite{Stream_Convert} pragma is not effective in the case of
7348 a derived type of a non-limited tagged type. If such a type is specified then
7349 the pragma is silently ignored, and the default implementation of the stream
7350 attributes is used instead.
7352 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7353 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{e4}
7354 @section Pragma Style_Checks
7357 Syntax:
7359 @example
7360 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7361                      On | Off [, LOCAL_NAME]);
7362 @end example
7364 This pragma is used in conjunction with compiler switches to control the
7365 built in style checking provided by GNAT.  The compiler switches, if set,
7366 provide an initial setting for the switches, and this pragma may be used
7367 to modify these settings, or the settings may be provided entirely by
7368 the use of the pragma.  This pragma can be used anywhere that a pragma
7369 is legal, including use as a configuration pragma (including use in
7370 the @code{gnat.adc} file).
7372 The form with a string literal specifies which style options are to be
7373 activated.  These are additive, so they apply in addition to any previously
7374 set style check options.  The codes for the options are the same as those
7375 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7376 For example the following two methods can be used to enable
7377 layout checking:
7380 @itemize *
7382 @item 
7383 @example
7384 pragma Style_Checks ("l");
7385 @end example
7387 @item 
7388 @example
7389 gcc -c -gnatyl ...
7390 @end example
7391 @end itemize
7393 The form ALL_CHECKS activates all standard checks (its use is equivalent
7394 to the use of the @cite{gnaty} switch with no options.
7395 See the @cite{GNAT User's Guide} for details.)
7397 Note: the behavior is slightly different in GNAT mode (@emph{-gnatg} used).
7398 In this case, ALL_CHECKS implies the standard set of GNAT mode style check
7399 options (i.e. equivalent to @emph{-gnatyg}).
7401 The forms with @cite{Off} and @cite{On}
7402 can be used to temporarily disable style checks
7403 as shown in the following example:
7405 @example
7406 pragma Style_Checks ("k"); -- requires keywords in lower case
7407 pragma Style_Checks (Off); -- turn off style checks
7408 NULL;                      -- this will not generate an error message
7409 pragma Style_Checks (On);  -- turn style checks back on
7410 NULL;                      -- this will generate an error message
7411 @end example
7413 Finally the two argument form is allowed only if the first argument is
7414 @cite{On} or @cite{Off}.  The effect is to turn of semantic style checks
7415 for the specified entity, as shown in the following example:
7417 @example
7418 pragma Style_Checks ("r"); -- require consistency of identifier casing
7419 Arg : Integer;
7420 Rf1 : Integer := ARG;      -- incorrect, wrong case
7421 pragma Style_Checks (Off, Arg);
7422 Rf2 : Integer := ARG;      -- OK, no error
7423 @end example
7425 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7426 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{e5}
7427 @section Pragma Subtitle
7430 Syntax:
7432 @example
7433 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7434 @end example
7436 This pragma is recognized for compatibility with other Ada compilers
7437 but is ignored by GNAT.
7439 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7440 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{e6}
7441 @section Pragma Suppress
7444 Syntax:
7446 @example
7447 pragma Suppress (Identifier [, [On =>] Name]);
7448 @end example
7450 This is a standard pragma, and supports all the check names required in
7451 the RM. It is included here because GNAT recognizes some additional check
7452 names that are implementation defined (as permitted by the RM):
7455 @itemize *
7457 @item 
7458 @cite{Alignment_Check} can be used to suppress alignment checks
7459 on addresses used in address clauses. Such checks can also be suppressed
7460 by suppressing range checks, but the specific use of @cite{Alignment_Check}
7461 allows suppression of alignment checks without suppressing other range checks.
7462 Note that @cite{Alignment_Check} is suppressed by default on machines (such as
7463 the x86) with non-strict alignment.
7465 @item 
7466 @cite{Atomic_Synchronization} can be used to suppress the special memory
7467 synchronization instructions that are normally generated for access to
7468 @cite{Atomic} variables to ensure correct synchronization between tasks
7469 that use such variables for synchronization purposes.
7471 @item 
7472 @cite{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7473 for a duplicated tag value when a tagged type is declared.
7475 @item 
7476 @cite{Container_Checks} Can be used to suppress all checks within Ada.Containers
7477 and instances of its children, including Tampering_Check.
7479 @item 
7480 @cite{Tampering_Check} Can be used to suppress tampering check in the containers.
7482 @item 
7483 @cite{Predicate_Check} can be used to control whether predicate checks are
7484 active. It is applicable only to predicates for which the policy is
7485 @cite{Check}. Unlike @cite{Assertion_Policy}, which determines if a given
7486 predicate is ignored or checked for the whole program, the use of
7487 @cite{Suppress} and @cite{Unsuppress} with this check name allows a given
7488 predicate to be turned on and off at specific points in the program.
7490 @item 
7491 @cite{Validity_Check} can be used specifically to control validity checks.
7492 If @cite{Suppress} is used to suppress validity checks, then no validity
7493 checks are performed, including those specified by the appropriate compiler
7494 switch or the @cite{Validity_Checks} pragma.
7496 @item 
7497 Additional check names previously introduced by use of the @cite{Check_Name}
7498 pragma are also allowed.
7499 @end itemize
7501 Note that pragma Suppress gives the compiler permission to omit
7502 checks, but does not require the compiler to omit checks. The compiler
7503 will generate checks if they are essentially free, even when they are
7504 suppressed. In particular, if the compiler can prove that a certain
7505 check will necessarily fail, it will generate code to do an
7506 unconditional 'raise', even if checks are suppressed. The compiler
7507 warns in this case.
7509 Of course, run-time checks are omitted whenever the compiler can prove
7510 that they will not fail, whether or not checks are suppressed.
7512 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7513 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{e7}
7514 @section Pragma Suppress_All
7517 Syntax:
7519 @example
7520 pragma Suppress_All;
7521 @end example
7523 This pragma can appear anywhere within a unit.
7524 The effect is to apply @cite{Suppress (All_Checks)} to the unit
7525 in which it appears.  This pragma is implemented for compatibility with DEC
7526 Ada 83 usage where it appears at the end of a unit, and for compatibility
7527 with Rational Ada, where it appears as a program unit pragma.
7528 The use of the standard Ada pragma @cite{Suppress (All_Checks)}
7529 as a normal configuration pragma is the preferred usage in GNAT.
7531 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7532 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{e8}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e9}
7533 @section Pragma Suppress_Debug_Info
7536 Syntax:
7538 @example
7539 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7540 @end example
7542 This pragma can be used to suppress generation of debug information
7543 for the specified entity. It is intended primarily for use in debugging
7544 the debugger, and navigating around debugger problems.
7546 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7547 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{ea}
7548 @section Pragma Suppress_Exception_Locations
7551 Syntax:
7553 @example
7554 pragma Suppress_Exception_Locations;
7555 @end example
7557 In normal mode, a raise statement for an exception by default generates
7558 an exception message giving the file name and line number for the location
7559 of the raise. This is useful for debugging and logging purposes, but this
7560 entails extra space for the strings for the messages. The configuration
7561 pragma @cite{Suppress_Exception_Locations} can be used to suppress the
7562 generation of these strings, with the result that space is saved, but the
7563 exception message for such raises is null. This configuration pragma may
7564 appear in a global configuration pragma file, or in a specific unit as
7565 usual. It is not required that this pragma be used consistently within
7566 a partition, so it is fine to have some units within a partition compiled
7567 with this pragma and others compiled in normal mode without it.
7569 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7570 @anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{eb}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{ec}
7571 @section Pragma Suppress_Initialization
7574 @geindex Suppressing initialization
7576 @geindex Initialization
7577 @geindex suppression of
7579 Syntax:
7581 @example
7582 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
7583 @end example
7585 Here variable_or_subtype_Name is the name introduced by a type declaration
7586 or subtype declaration or the name of a variable introduced by an
7587 object declaration.
7589 In the case of a type or subtype
7590 this pragma suppresses any implicit or explicit initialization
7591 for all variables of the given type or subtype,
7592 including initialization resulting from the use of pragmas
7593 Normalize_Scalars or Initialize_Scalars.
7595 This is considered a representation item, so it cannot be given after
7596 the type is frozen. It applies to all subsequent object declarations,
7597 and also any allocator that creates objects of the type.
7599 If the pragma is given for the first subtype, then it is considered
7600 to apply to the base type and all its subtypes. If the pragma is given
7601 for other than a first subtype, then it applies only to the given subtype.
7602 The pragma may not be given after the type is frozen.
7604 Note that this includes eliminating initialization of discriminants
7605 for discriminated types, and tags for tagged types. In these cases,
7606 you will have to use some non-portable mechanism (e.g. address
7607 overlays or unchecked conversion) to achieve required initialization
7608 of these fields before accessing any object of the corresponding type.
7610 For the variable case, implicit initialization for the named variable
7611 is suppressed, just as though its subtype had been given in a pragma
7612 Suppress_Initialization, as described above.
7614 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
7615 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{ed}
7616 @section Pragma Task_Name
7619 Syntax
7621 @example
7622 pragma Task_Name (string_EXPRESSION);
7623 @end example
7625 This pragma appears within a task definition (like pragma
7626 @cite{Priority}) and applies to the task in which it appears.  The
7627 argument must be of type String, and provides a name to be used for
7628 the task instance when the task is created.  Note that this expression
7629 is not required to be static, and in particular, it can contain
7630 references to task discriminants.  This facility can be used to
7631 provide different names for different tasks as they are created,
7632 as illustrated in the example below.
7634 The task name is recorded internally in the run-time structures
7635 and is accessible to tools like the debugger.  In addition the
7636 routine @cite{Ada.Task_Identification.Image} will return this
7637 string, with a unique task address appended.
7639 @example
7640 --  Example of the use of pragma Task_Name
7642 with Ada.Task_Identification;
7643 use Ada.Task_Identification;
7644 with Text_IO; use Text_IO;
7645 procedure t3 is
7647    type Astring is access String;
7649    task type Task_Typ (Name : access String) is
7650       pragma Task_Name (Name.all);
7651    end Task_Typ;
7653    task body Task_Typ is
7654       Nam : constant String := Image (Current_Task);
7655    begin
7656       Put_Line ("-->" & Nam (1 .. 14) & "<--");
7657    end Task_Typ;
7659    type Ptr_Task is access Task_Typ;
7660    Task_Var : Ptr_Task;
7662 begin
7663    Task_Var :=
7664      new Task_Typ (new String'("This is task 1"));
7665    Task_Var :=
7666      new Task_Typ (new String'("This is task 2"));
7667 end;
7668 @end example
7670 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
7671 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{ee}
7672 @section Pragma Task_Storage
7675 Syntax:
7677 @example
7678 pragma Task_Storage (
7679   [Task_Type =>] LOCAL_NAME,
7680   [Top_Guard =>] static_integer_EXPRESSION);
7681 @end example
7683 This pragma specifies the length of the guard area for tasks.  The guard
7684 area is an additional storage area allocated to a task.  A value of zero
7685 means that either no guard area is created or a minimal guard area is
7686 created, depending on the target.  This pragma can appear anywhere a
7687 @cite{Storage_Size} attribute definition clause is allowed for a task
7688 type.
7690 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
7691 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{ef}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{f0}
7692 @section Pragma Test_Case
7695 @geindex Test cases
7697 Syntax:
7699 @example
7700 pragma Test_Case (
7701    [Name     =>] static_string_Expression
7702   ,[Mode     =>] (Nominal | Robustness)
7703  [, Requires =>  Boolean_Expression]
7704  [, Ensures  =>  Boolean_Expression]);
7705 @end example
7707 The @cite{Test_Case} pragma allows defining fine-grain specifications
7708 for use by testing tools.
7709 The compiler checks the validity of the @cite{Test_Case} pragma, but its
7710 presence does not lead to any modification of the code generated by the
7711 compiler.
7713 @cite{Test_Case} pragmas may only appear immediately following the
7714 (separate) declaration of a subprogram in a package declaration, inside
7715 a package spec unit. Only other pragmas may intervene (that is appear
7716 between the subprogram declaration and a test case).
7718 The compiler checks that boolean expressions given in @cite{Requires} and
7719 @cite{Ensures} are valid, where the rules for @cite{Requires} are the
7720 same as the rule for an expression in @cite{Precondition} and the rules
7721 for @cite{Ensures} are the same as the rule for an expression in
7722 @cite{Postcondition}. In particular, attributes @cite{'Old} and
7723 @cite{'Result} can only be used within the @cite{Ensures}
7724 expression. The following is an example of use within a package spec:
7726 @example
7727 package Math_Functions is
7728    ...
7729    function Sqrt (Arg : Float) return Float;
7730    pragma Test_Case (Name     => "Test 1",
7731                      Mode     => Nominal,
7732                      Requires => Arg < 10000,
7733                      Ensures  => Sqrt'Result < 10);
7734    ...
7735 end Math_Functions;
7736 @end example
7738 The meaning of a test case is that there is at least one context where
7739 @cite{Requires} holds such that, if the associated subprogram is executed in
7740 that context, then @cite{Ensures} holds when the subprogram returns.
7741 Mode @cite{Nominal} indicates that the input context should also satisfy the
7742 precondition of the subprogram, and the output context should also satisfy its
7743 postcondition. Mode @cite{Robustness} indicates that the precondition and
7744 postcondition of the subprogram should be ignored for this test case.
7746 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
7747 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{f1}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f2}
7748 @section Pragma Thread_Local_Storage
7751 @geindex Task specific storage
7753 @geindex TLS (Thread Local Storage)
7755 @geindex Task_Attributes
7757 Syntax:
7759 @example
7760 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
7761 @end example
7763 This pragma specifies that the specified entity, which must be
7764 a variable declared in a library level package, is to be marked as
7765 "Thread Local Storage" (@cite{TLS}). On systems supporting this (which
7766 include Windows, Solaris, GNU/Linux and VxWorks 6), this causes each
7767 thread (and hence each Ada task) to see a distinct copy of the variable.
7769 The variable may not have default initialization, and if there is
7770 an explicit initialization, it must be either @cite{null} for an
7771 access variable, or a static expression for a scalar variable.
7772 This provides a low level mechanism similar to that provided by
7773 the @cite{Ada.Task_Attributes} package, but much more efficient
7774 and is also useful in writing interface code that will interact
7775 with foreign threads.
7777 If this pragma is used on a system where @cite{TLS} is not supported,
7778 then an error message will be generated and the program will be rejected.
7780 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
7781 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{f3}
7782 @section Pragma Time_Slice
7785 Syntax:
7787 @example
7788 pragma Time_Slice (static_duration_EXPRESSION);
7789 @end example
7791 For implementations of GNAT on operating systems where it is possible
7792 to supply a time slice value, this pragma may be used for this purpose.
7793 It is ignored if it is used in a system that does not allow this control,
7794 or if it appears in other than the main program unit.
7796 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
7797 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{f4}
7798 @section Pragma Title
7801 Syntax:
7803 @example
7804 pragma Title (TITLING_OPTION [, TITLING OPTION]);
7806 TITLING_OPTION ::=
7807   [Title    =>] STRING_LITERAL,
7808 | [Subtitle =>] STRING_LITERAL
7809 @end example
7811 Syntax checked but otherwise ignored by GNAT.  This is a listing control
7812 pragma used in DEC Ada 83 implementations to provide a title and/or
7813 subtitle for the program listing.  The program listing generated by GNAT
7814 does not have titles or subtitles.
7816 Unlike other pragmas, the full flexibility of named notation is allowed
7817 for this pragma, i.e., the parameters may be given in any order if named
7818 notation is used, and named and positional notation can be mixed
7819 following the normal rules for procedure calls in Ada.
7821 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
7822 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{f5}
7823 @section Pragma Type_Invariant
7826 Syntax:
7828 @example
7829 pragma Type_Invariant
7830   ([Entity =>] type_LOCAL_NAME,
7831    [Check  =>] EXPRESSION);
7832 @end example
7834 The @cite{Type_Invariant} pragma is intended to be an exact
7835 replacement for the language-defined @cite{Type_Invariant}
7836 aspect, and shares its restrictions and semantics. It differs
7837 from the language defined @cite{Invariant} pragma in that it
7838 does not permit a string parameter, and it is
7839 controlled by the assertion identifier @cite{Type_Invariant}
7840 rather than @cite{Invariant}.
7842 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
7843 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f6}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{f7}
7844 @section Pragma Type_Invariant_Class
7847 Syntax:
7849 @example
7850 pragma Type_Invariant_Class
7851   ([Entity =>] type_LOCAL_NAME,
7852    [Check  =>] EXPRESSION);
7853 @end example
7855 The @cite{Type_Invariant_Class} pragma is intended to be an exact
7856 replacement for the language-defined @cite{Type_Invariant'Class}
7857 aspect, and shares its restrictions and semantics.
7859 Note: This pragma is called @cite{Type_Invariant_Class} rather than
7860 @cite{Type_Invariant'Class} because the latter would not be strictly
7861 conforming to the allowed syntax for pragmas. The motivation
7862 for providing pragmas equivalent to the aspects is to allow a program
7863 to be written using the pragmas, and then compiled if necessary
7864 using an Ada compiler that does not recognize the pragmas or
7865 aspects, but is prepared to ignore the pragmas. The assertion
7866 policy that controls this pragma is @cite{Type_Invariant'Class},
7867 not @cite{Type_Invariant_Class}.
7869 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
7870 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{f8}
7871 @section Pragma Unchecked_Union
7874 @geindex Unions in C
7876 Syntax:
7878 @example
7879 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
7880 @end example
7882 This pragma is used to specify a representation of a record type that is
7883 equivalent to a C union. It was introduced as a GNAT implementation defined
7884 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
7885 pragma, making it language defined, and GNAT fully implements this extended
7886 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
7887 details, consult the Ada 2012 Reference Manual, section B.3.3.
7889 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
7890 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{f9}
7891 @section Pragma Unevaluated_Use_Of_Old
7894 @geindex Attribute Old
7896 @geindex Attribute Loop_Entry
7898 @geindex Unevaluated_Use_Of_Old
7900 Syntax:
7902 @example
7903 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
7904 @end example
7906 This pragma controls the processing of attributes Old and Loop_Entry.
7907 If either of these attributes is used in a potentially unevaluated
7908 expression  (e.g. the then or else parts of an if expression), then
7909 normally this usage is considered illegal if the prefix of the attribute
7910 is other than an entity name. The language requires this
7911 behavior for Old, and GNAT copies the same rule for Loop_Entry.
7913 The reason for this rule is that otherwise, we can have a situation
7914 where we save the Old value, and this results in an exception, even
7915 though we might not evaluate the attribute. Consider this example:
7917 @example
7918 package UnevalOld is
7919    K : Character;
7920    procedure U (A : String; C : Boolean)  -- ERROR
7921      with Post => (if C then A(1)'Old = K else True);
7922 end;
7923 @end example
7925 If procedure U is called with a string with a lower bound of 2, and
7926 C false, then an exception would be raised trying to evaluate A(1)
7927 on entry even though the value would not be actually used.
7929 Although the rule guarantees against this possibility, it is sometimes
7930 too restrictive. For example if we know that the string has a lower
7931 bound of 1, then we will never raise an exception.
7932 The pragma @cite{Unevaluated_Use_Of_Old} can be
7933 used to modify this behavior. If the argument is @cite{Error} then an
7934 error is given (this is the default RM behavior). If the argument is
7935 @cite{Warn} then the usage is allowed as legal but with a warning
7936 that an exception might be raised. If the argument is @cite{Allow}
7937 then the usage is allowed as legal without generating a warning.
7939 This pragma may appear as a configuration pragma, or in a declarative
7940 part or package specification. In the latter case it applies to
7941 uses up to the end of the corresponding statement sequence or
7942 sequence of package declarations.
7944 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
7945 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{fa}
7946 @section Pragma Unimplemented_Unit
7949 Syntax:
7951 @example
7952 pragma Unimplemented_Unit;
7953 @end example
7955 If this pragma occurs in a unit that is processed by the compiler, GNAT
7956 aborts with the message @code{xxx not implemented}, where
7957 @cite{xxx} is the name of the current compilation unit.  This pragma is
7958 intended to allow the compiler to handle unimplemented library units in
7959 a clean manner.
7961 The abort only happens if code is being generated.  Thus you can use
7962 specs of unimplemented packages in syntax or semantic checking mode.
7964 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
7965 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{fb}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{fc}
7966 @section Pragma Universal_Aliasing
7969 Syntax:
7971 @example
7972 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
7973 @end example
7975 @cite{type_LOCAL_NAME} must refer to a type declaration in the current
7976 declarative part.  The effect is to inhibit strict type-based aliasing
7977 optimization for the given type.  In other words, the effect is as though
7978 access types designating this type were subject to pragma No_Strict_Aliasing.
7979 For a detailed description of the strict aliasing optimization, and the
7980 situations in which it must be suppressed, see the section on
7981 @cite{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
7983 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
7984 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{fd}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{fe}
7985 @section Pragma Universal_Data
7988 Syntax:
7990 @example
7991 pragma Universal_Data [(library_unit_Name)];
7992 @end example
7994 This pragma is supported only for the AAMP target and is ignored for
7995 other targets. The pragma specifies that all library-level objects
7996 (Counter 0 data) associated with the library unit are to be accessed
7997 and updated using universal addressing (24-bit addresses for AAMP5)
7998 rather than the default of 16-bit Data Environment (DENV) addressing.
7999 Use of this pragma will generally result in less efficient code for
8000 references to global data associated with the library unit, but
8001 allows such data to be located anywhere in memory. This pragma is
8002 a library unit pragma, but can also be used as a configuration pragma
8003 (including use in the @code{gnat.adc} file). The functionality
8004 of this pragma is also available by applying the -univ switch on the
8005 compilations of units where universal addressing of the data is desired.
8007 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8008 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{ff}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{100}
8009 @section Pragma Unmodified
8012 @geindex Warnings
8013 @geindex unmodified
8015 Syntax:
8017 @example
8018 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8019 @end example
8021 This pragma signals that the assignable entities (variables,
8022 @cite{out} parameters, @cite{in out} parameters) whose names are listed are
8023 deliberately not assigned in the current source unit. This
8024 suppresses warnings about the
8025 entities being referenced but not assigned, and in addition a warning will be
8026 generated if one of these entities is in fact assigned in the
8027 same unit as the pragma (or in the corresponding body, or one
8028 of its subunits).
8030 This is particularly useful for clearly signaling that a particular
8031 parameter is not modified, even though the spec suggests that it might
8034 For the variable case, warnings are never given for unreferenced variables
8035 whose name contains one of the substrings
8036 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8037 are typically to be used in cases where such warnings are expected.
8038 Thus it is never necessary to use @cite{pragma Unmodified} for such
8039 variables, though it is harmless to do so.
8041 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8042 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{101}@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{102}
8043 @section Pragma Unreferenced
8046 @geindex Warnings
8047 @geindex unreferenced
8049 Syntax:
8051 @example
8052 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8053 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8054 @end example
8056 This pragma signals that the entities whose names are listed are
8057 deliberately not referenced in the current source unit after the
8058 occurrence of the pragma. This
8059 suppresses warnings about the
8060 entities being unreferenced, and in addition a warning will be
8061 generated if one of these entities is in fact subsequently referenced in the
8062 same unit as the pragma (or in the corresponding body, or one
8063 of its subunits).
8065 This is particularly useful for clearly signaling that a particular
8066 parameter is not referenced in some particular subprogram implementation
8067 and that this is deliberate. It can also be useful in the case of
8068 objects declared only for their initialization or finalization side
8069 effects.
8071 If @cite{LOCAL_NAME} identifies more than one matching homonym in the
8072 current scope, then the entity most recently declared is the one to which
8073 the pragma applies. Note that in the case of accept formals, the pragma
8074 Unreferenced may appear immediately after the keyword @cite{do} which
8075 allows the indication of whether or not accept formals are referenced
8076 or not to be given individually for each accept statement.
8078 The left hand side of an assignment does not count as a reference for the
8079 purpose of this pragma. Thus it is fine to assign to an entity for which
8080 pragma Unreferenced is given.
8082 Note that if a warning is desired for all calls to a given subprogram,
8083 regardless of whether they occur in the same unit as the subprogram
8084 declaration, then this pragma should not be used (calls from another
8085 unit would not be flagged); pragma Obsolescent can be used instead
8086 for this purpose, see @ref{a3,,Pragma Obsolescent}.
8088 The second form of pragma @cite{Unreferenced} is used within a context
8089 clause. In this case the arguments must be unit names of units previously
8090 mentioned in @cite{with} clauses (similar to the usage of pragma
8091 @cite{Elaborate_All}. The effect is to suppress warnings about unreferenced
8092 units and unreferenced entities within these units.
8094 For the variable case, warnings are never given for unreferenced variables
8095 whose name contains one of the substrings
8096 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8097 are typically to be used in cases where such warnings are expected.
8098 Thus it is never necessary to use @cite{pragma Unreferenced} for such
8099 variables, though it is harmless to do so.
8101 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8102 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{103}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{104}
8103 @section Pragma Unreferenced_Objects
8106 @geindex Warnings
8107 @geindex unreferenced
8109 Syntax:
8111 @example
8112 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8113 @end example
8115 This pragma signals that for the types or subtypes whose names are
8116 listed, objects which are declared with one of these types or subtypes may
8117 not be referenced, and if no references appear, no warnings are given.
8119 This is particularly useful for objects which are declared solely for their
8120 initialization and finalization effect. Such variables are sometimes referred
8121 to as RAII variables (Resource Acquisition Is Initialization). Using this
8122 pragma on the relevant type (most typically a limited controlled type), the
8123 compiler will automatically suppress unwanted warnings about these variables
8124 not being referenced.
8126 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8127 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{105}
8128 @section Pragma Unreserve_All_Interrupts
8131 Syntax:
8133 @example
8134 pragma Unreserve_All_Interrupts;
8135 @end example
8137 Normally certain interrupts are reserved to the implementation.  Any attempt
8138 to attach an interrupt causes Program_Error to be raised, as described in
8139 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
8140 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
8141 reserved to the implementation, so that @code{Ctrl-C} can be used to
8142 interrupt execution.
8144 If the pragma @cite{Unreserve_All_Interrupts} appears anywhere in any unit in
8145 a program, then all such interrupts are unreserved.  This allows the
8146 program to handle these interrupts, but disables their standard
8147 functions.  For example, if this pragma is used, then pressing
8148 @code{Ctrl-C} will not automatically interrupt execution.  However,
8149 a program can then handle the @cite{SIGINT} interrupt as it chooses.
8151 For a full list of the interrupts handled in a specific implementation,
8152 see the source code for the spec of @cite{Ada.Interrupts.Names} in
8153 file @code{a-intnam.ads}.  This is a target dependent file that contains the
8154 list of interrupts recognized for a given target.  The documentation in
8155 this file also specifies what interrupts are affected by the use of
8156 the @cite{Unreserve_All_Interrupts} pragma.
8158 For a more general facility for controlling what interrupts can be
8159 handled, see pragma @cite{Interrupt_State}, which subsumes the functionality
8160 of the @cite{Unreserve_All_Interrupts} pragma.
8162 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8163 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{106}
8164 @section Pragma Unsuppress
8167 Syntax:
8169 @example
8170 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8171 @end example
8173 This pragma undoes the effect of a previous pragma @cite{Suppress}.  If
8174 there is no corresponding pragma @cite{Suppress} in effect, it has no
8175 effect.  The range of the effect is the same as for pragma
8176 @cite{Suppress}.  The meaning of the arguments is identical to that used
8177 in pragma @cite{Suppress}.
8179 One important application is to ensure that checks are on in cases where
8180 code depends on the checks for its correct functioning, so that the code
8181 will compile correctly even if the compiler switches are set to suppress
8182 checks. For example, in a program that depends on external names of tagged
8183 types and wants to ensure that the duplicated tag check occurs even if all
8184 run-time checks are suppressed by a compiler switch, the following
8185 configuration pragma will ensure this test is not suppressed:
8187 @example
8188 pragma Unsuppress (Duplicated_Tag_Check);
8189 @end example
8191 This pragma is standard in Ada 2005. It is available in all earlier versions
8192 of Ada as an implementation-defined pragma.
8194 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8195 number of implementation-defined check names. See the description of pragma
8196 @cite{Suppress} for full details.
8198 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8199 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{107}
8200 @section Pragma Use_VADS_Size
8203 @geindex Size
8204 @geindex VADS compatibility
8206 @geindex Rational profile
8208 Syntax:
8210 @example
8211 pragma Use_VADS_Size;
8212 @end example
8214 This is a configuration pragma.  In a unit to which it applies, any use
8215 of the 'Size attribute is automatically interpreted as a use of the
8216 'VADS_Size attribute.  Note that this may result in incorrect semantic
8217 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
8218 the handling of existing code which depends on the interpretation of Size
8219 as implemented in the VADS compiler.  See description of the VADS_Size
8220 attribute for further details.
8222 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8223 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{108}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{109}
8224 @section Pragma Unused
8227 @geindex Warnings
8228 @geindex unused
8230 Syntax:
8232 @example
8233 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8234 @end example
8236 This pragma signals that the assignable entities (variables,
8237 @cite{out} parameters, and @cite{in out} parameters) whose names are listed
8238 deliberately do not get assigned or referenced in the current source unit
8239 after the occurrence of the pragma in the current source unit. This
8240 suppresses warnings about the entities that are unreferenced and/or not
8241 assigned, and, in addition, a warning will be generated if one of these
8242 entities gets assigned or subsequently referenced in the same unit as the
8243 pragma (in the corresponding body or one of its subunits).
8245 This is particularly useful for clearly signaling that a particular
8246 parameter is not modified or referenced, even though the spec suggests
8247 that it might be.
8249 For the variable case, warnings are never given for unreferenced
8250 variables whose name contains one of the substrings
8251 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8252 are typically to be used in cases where such warnings are expected.
8253 Thus it is never necessary to use @cite{pragma Unmodified} for such
8254 variables, though it is harmless to do so.
8256 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8257 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{10a}
8258 @section Pragma Validity_Checks
8261 Syntax:
8263 @example
8264 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8265 @end example
8267 This pragma is used in conjunction with compiler switches to control the
8268 built-in validity checking provided by GNAT.  The compiler switches, if set
8269 provide an initial setting for the switches, and this pragma may be used
8270 to modify these settings, or the settings may be provided entirely by
8271 the use of the pragma.  This pragma can be used anywhere that a pragma
8272 is legal, including use as a configuration pragma (including use in
8273 the @code{gnat.adc} file).
8275 The form with a string literal specifies which validity options are to be
8276 activated.  The validity checks are first set to include only the default
8277 reference manual settings, and then a string of letters in the string
8278 specifies the exact set of options required.  The form of this string
8279 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8280 GNAT User's Guide for details).  For example the following two
8281 methods can be used to enable validity checking for mode @cite{in} and
8282 @cite{in out} subprogram parameters:
8285 @itemize *
8287 @item 
8288 @example
8289 pragma Validity_Checks ("im");
8290 @end example
8292 @item 
8293 @example
8294 $ gcc -c -gnatVim ...
8295 @end example
8296 @end itemize
8298 The form ALL_CHECKS activates all standard checks (its use is equivalent
8299 to the use of the @cite{gnatva} switch.
8301 The forms with @cite{Off} and @cite{On}
8302 can be used to temporarily disable validity checks
8303 as shown in the following example:
8305 @example
8306 pragma Validity_Checks ("c"); -- validity checks for copies
8307 pragma Validity_Checks (Off); -- turn off validity checks
8308 A := B;                       -- B will not be validity checked
8309 pragma Validity_Checks (On);  -- turn validity checks back on
8310 A := C;                       -- C will be validity checked
8311 @end example
8313 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8314 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{10b}
8315 @section Pragma Volatile
8318 Syntax:
8320 @example
8321 pragma Volatile (LOCAL_NAME);
8322 @end example
8324 This pragma is defined by the Ada Reference Manual, and the GNAT
8325 implementation is fully conformant with this definition.  The reason it
8326 is mentioned in this section is that a pragma of the same name was supplied
8327 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8328 implementation of pragma Volatile is upwards compatible with the
8329 implementation in DEC Ada 83.
8331 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8332 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10d}
8333 @section Pragma Volatile_Full_Access
8336 Syntax:
8338 @example
8339 pragma Volatile_Full_Access (LOCAL_NAME);
8340 @end example
8342 This is similar in effect to pragma Volatile, except that any reference to the
8343 object is guaranteed to be done only with instructions that read or write all
8344 the bits of the object. Furthermore, if the object is of a composite type,
8345 then any reference to a component of the object is guaranteed to read and/or
8346 write all the bits of the object.
8348 The intention is that this be suitable for use with memory-mapped I/O devices
8349 on some machines. Note that there are two important respects in which this is
8350 different from @cite{pragma Atomic}. First a reference to a @cite{Volatile_Full_Access}
8351 object is not a sequential action in the RM 9.10 sense and, therefore, does
8352 not create a synchronization point. Second, in the case of @cite{pragma Atomic},
8353 there is no guarantee that all the bits will be accessed if the reference
8354 is not to the whole object; the compiler is allowed (and generally will)
8355 access only part of the object in this case.
8357 It is not permissible to specify @cite{Atomic} and @cite{Volatile_Full_Access} for
8358 the same object.
8360 It is not permissible to specify @cite{Volatile_Full_Access} for a composite
8361 (record or array) type or object that has at least one @cite{Aliased} component.
8363 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8364 @anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{10f}
8365 @section Pragma Volatile_Function
8368 Syntax:
8370 @example
8371 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8372 @end example
8374 For the semantics of this pragma, see the entry for aspect @cite{Volatile_Function}
8375 in the SPARK 2014 Reference Manual, section 7.1.2.
8377 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8378 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{110}
8379 @section Pragma Warning_As_Error
8382 Syntax:
8384 @example
8385 pragma Warning_As_Error (static_string_EXPRESSION);
8386 @end example
8388 This configuration pragma allows the programmer to specify a set
8389 of warnings that will be treated as errors. Any warning which
8390 matches the pattern given by the pragma argument will be treated
8391 as an error. This gives much more precise control that -gnatwe
8392 which treats all warnings as errors.
8394 The pattern may contain asterisks, which match zero or more characters in
8395 the message. For example, you can use
8396 @cite{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8397 message @cite{warning: 960 bits of "a" unused} as an error. No other regular
8398 expression notations are permitted. All characters other than asterisk in
8399 these three specific cases are treated as literal characters in the match.
8400 The match is case insensitive, for example XYZ matches xyz.
8402 Note that the pattern matches if it occurs anywhere within the warning
8403 message string (it is not necessary to put an asterisk at the start and
8404 the end of the message, since this is implied).
8406 Another possibility for the static_string_EXPRESSION which works whether
8407 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8408 @emph{-gnatw} tag string, enclosed in brackets,
8409 as shown in the example below, to treat a class of warnings as errors.
8411 The above use of patterns to match the message applies only to warning
8412 messages generated by the front end. This pragma can also be applied to
8413 warnings provided by the back end and mentioned in @ref{111,,Pragma Warnings}.
8414 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8415 can also be treated as errors.
8417 The pragma can appear either in a global configuration pragma file
8418 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8419 configuration pragma file containing:
8421 @example
8422 pragma Warning_As_Error ("[-gnatwj]");
8423 @end example
8425 which will treat all obsolescent feature warnings as errors, the
8426 following program compiles as shown (compile options here are
8427 @emph{-gnatwa.d -gnatl -gnatj55}).
8429 @example
8430     1. pragma Warning_As_Error ("*never assigned*");
8431     2. function Warnerr return String is
8432     3.    X : Integer;
8433           |
8434        >>> error: variable "X" is never read and
8435            never assigned [-gnatwv] [warning-as-error]
8437     4.    Y : Integer;
8438           |
8439        >>> warning: variable "Y" is assigned but
8440            never read [-gnatwu]
8442     5. begin
8443     6.    Y := 0;
8444     7.    return %ABC%;
8445                  |
8446        >>> error: use of "%" is an obsolescent
8447            feature (RM J.2(4)), use """ instead
8448            [-gnatwj] [warning-as-error]
8450     8. end;
8452 8 lines: No errors, 3 warnings (2 treated as errors)
8453 @end example
8455 Note that this pragma does not affect the set of warnings issued in
8456 any way, it merely changes the effect of a matching warning if one
8457 is produced as a result of other warnings options. As shown in this
8458 example, if the pragma results in a warning being treated as an error,
8459 the tag is changed from "warning:" to "error:" and the string
8460 "[warning-as-error]" is appended to the end of the message.
8462 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8463 @anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{111}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{112}
8464 @section Pragma Warnings
8467 Syntax:
8469 @example
8470 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8472 DETAILS ::= On | Off
8473 DETAILS ::= On | Off, local_NAME
8474 DETAILS ::= static_string_EXPRESSION
8475 DETAILS ::= On | Off, static_string_EXPRESSION
8477 TOOL_NAME ::= GNAT | GNATProve
8479 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8480 @end example
8482 Note: in Ada 83 mode, a string literal may be used in place of a static string
8483 expression (which does not exist in Ada 83).
8485 Note if the second argument of @cite{DETAILS} is a @cite{local_NAME} then the
8486 second form is always understood. If the intention is to use
8487 the fourth form, then you can write @cite{NAME & ""} to force the
8488 intepretation as a @cite{static_string_EXPRESSION}.
8490 Note: if the first argument is a valid @cite{TOOL_NAME}, it will be interpreted
8491 that way. The use of the @cite{TOOL_NAME} argument is relevant only to users
8492 of SPARK and GNATprove, see last part of this section for details.
8494 Normally warnings are enabled, with the output being controlled by
8495 the command line switch.  Warnings (@cite{Off}) turns off generation of
8496 warnings until a Warnings (@cite{On}) is encountered or the end of the
8497 current unit.  If generation of warnings is turned off using this
8498 pragma, then some or all of the warning messages are suppressed,
8499 regardless of the setting of the command line switches.
8501 The @cite{Reason} parameter may optionally appear as the last argument
8502 in any of the forms of this pragma. It is intended purely for the
8503 purposes of documenting the reason for the @cite{Warnings} pragma.
8504 The compiler will check that the argument is a static string but
8505 otherwise ignore this argument. Other tools may provide specialized
8506 processing for this string.
8508 The form with a single argument (or two arguments if Reason present),
8509 where the first argument is @cite{ON} or @cite{OFF}
8510 may be used as a configuration pragma.
8512 If the @cite{LOCAL_NAME} parameter is present, warnings are suppressed for
8513 the specified entity.  This suppression is effective from the point where
8514 it occurs till the end of the extended scope of the variable (similar to
8515 the scope of @cite{Suppress}). This form cannot be used as a configuration
8516 pragma.
8518 In the case where the first argument is other than @cite{ON} or
8519 @cite{OFF},
8520 the third form with a single static_string_EXPRESSION argument (and possible
8521 reason) provides more precise
8522 control over which warnings are active. The string is a list of letters
8523 specifying which warnings are to be activated and which deactivated. The
8524 code for these letters is the same as the string used in the command
8525 line switch controlling warnings. For a brief summary, use the gnatmake
8526 command with no arguments, which will generate usage information containing
8527 the list of warnings switches supported. For
8528 full details see the section on @cite{Warning Message Control} in the
8529 @cite{GNAT User's Guide}.
8530 This form can also be used as a configuration pragma.
8532 The warnings controlled by the @emph{-gnatw} switch are generated by the
8533 front end of the compiler. The GCC back end can provide additional warnings
8534 and they are controlled by the @emph{-W} switch. Such warnings can be
8535 identified by the appearance of a string of the form @cite{[-Wxxx]} in the
8536 message which designates the @emph{-Wxxx} switch that controls the message.
8537 The form with a single static_string_EXPRESSION argument also works for these
8538 warnings, but the string must be a single full @emph{-Wxxx} switch in this
8539 case. The above reference lists a few examples of these additional warnings.
8541 The specified warnings will be in effect until the end of the program
8542 or another pragma Warnings is encountered. The effect of the pragma is
8543 cumulative. Initially the set of warnings is the standard default set
8544 as possibly modified by compiler switches. Then each pragma Warning
8545 modifies this set of warnings as specified. This form of the pragma may
8546 also be used as a configuration pragma.
8548 The fourth form, with an @cite{On|Off} parameter and a string, is used to
8549 control individual messages, based on their text. The string argument
8550 is a pattern that is used to match against the text of individual
8551 warning messages (not including the initial "warning: " tag).
8553 The pattern may contain asterisks, which match zero or more characters in
8554 the message. For example, you can use
8555 @cite{pragma Warnings (Off@comma{} "bits of*unused")} to suppress the warning
8556 message @cite{warning: 960 bits of "a" unused}. No other regular
8557 expression notations are permitted. All characters other than asterisk in
8558 these three specific cases are treated as literal characters in the match.
8559 The match is case insensitive, for example XYZ matches xyz.
8561 Note that the pattern matches if it occurs anywhere within the warning
8562 message string (it is not necessary to put an asterisk at the start and
8563 the end of the message, since this is implied).
8565 The above use of patterns to match the message applies only to warning
8566 messages generated by the front end. This form of the pragma with a string
8567 argument can also be used to control warnings provided by the back end and
8568 mentioned above. By using a single full @emph{-Wxxx} switch in the pragma,
8569 such warnings can be turned on and off.
8571 There are two ways to use the pragma in this form. The OFF form can be used
8572 as a configuration pragma. The effect is to suppress all warnings (if any)
8573 that match the pattern string throughout the compilation (or match the
8574 -W switch in the back end case).
8576 The second usage is to suppress a warning locally, and in this case, two
8577 pragmas must appear in sequence:
8579 @example
8580 pragma Warnings (Off, Pattern);
8581 ... code where given warning is to be suppressed
8582 pragma Warnings (On, Pattern);
8583 @end example
8585 In this usage, the pattern string must match in the Off and On
8586 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
8587 warning must be suppressed.
8589 Note: to write a string that will match any warning, use the string
8590 @cite{"***"}. It will not work to use a single asterisk or two
8591 asterisks since this looks like an operator name. This form with three
8592 asterisks is similar in effect to specifying @cite{pragma Warnings (Off)} except (if @emph{-gnatw.w} is given) that a matching
8593 @cite{pragma Warnings (On@comma{} "***")} will be required. This can be
8594 helpful in avoiding forgetting to turn warnings back on.
8596 Note: the debug flag -gnatd.i (@cite{/NOWARNINGS_PRAGMAS} in VMS) can be
8597 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
8598 be useful in checking whether obsolete pragmas in existing programs are hiding
8599 real problems.
8601 Note: pragma Warnings does not affect the processing of style messages. See
8602 separate entry for pragma Style_Checks for control of style messages.
8604 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
8605 use the version of the pragma with a @cite{TOOL_NAME} parameter.
8607 If present, @cite{TOOL_NAME} is the name of a tool, currently either @cite{GNAT} for the
8608 compiler or @cite{GNATprove} for the formal verification tool. A given tool only
8609 takes into account pragma Warnings that do not specify a tool name, or that
8610 specify the matching tool name. This makes it possible to disable warnings
8611 selectively for each tool, and as a consequence to detect useless pragma
8612 Warnings with switch @cite{-gnatw.w}.
8614 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
8615 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{113}
8616 @section Pragma Weak_External
8619 Syntax:
8621 @example
8622 pragma Weak_External ([Entity =>] LOCAL_NAME);
8623 @end example
8625 @cite{LOCAL_NAME} must refer to an object that is declared at the library
8626 level. This pragma specifies that the given entity should be marked as a
8627 weak symbol for the linker. It is equivalent to @cite{__attribute__((weak))}
8628 in GNU C and causes @cite{LOCAL_NAME} to be emitted as a weak symbol instead
8629 of a regular symbol, that is to say a symbol that does not have to be
8630 resolved by the linker if used in conjunction with a pragma Import.
8632 When a weak symbol is not resolved by the linker, its address is set to
8633 zero. This is useful in writing interfaces to external modules that may
8634 or may not be linked in the final executable, for example depending on
8635 configuration settings.
8637 If a program references at run time an entity to which this pragma has been
8638 applied, and the corresponding symbol was not resolved at link time, then
8639 the execution of the program is erroneous. It is not erroneous to take the
8640 Address of such an entity, for example to guard potential references,
8641 as shown in the example below.
8643 Some file formats do not support weak symbols so not all target machines
8644 support this pragma.
8646 @example
8647 --  Example of the use of pragma Weak_External
8649 package External_Module is
8650   key : Integer;
8651   pragma Import (C, key);
8652   pragma Weak_External (key);
8653   function Present return boolean;
8654 end External_Module;
8656 with System; use System;
8657 package body External_Module is
8658   function Present return boolean is
8659   begin
8660     return key'Address /= System.Null_Address;
8661   end Present;
8662 end External_Module;
8663 @end example
8665 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
8666 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{114}
8667 @section Pragma Wide_Character_Encoding
8670 Syntax:
8672 @example
8673 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
8674 @end example
8676 This pragma specifies the wide character encoding to be used in program
8677 source text appearing subsequently. It is a configuration pragma, but may
8678 also be used at any point that a pragma is allowed, and it is permissible
8679 to have more than one such pragma in a file, allowing multiple encodings
8680 to appear within the same file.
8682 The argument can be an identifier or a character literal. In the identifier
8683 case, it is one of @cite{HEX}, @cite{UPPER}, @cite{SHIFT_JIS},
8684 @cite{EUC}, @cite{UTF8}, or @cite{BRACKETS}. In the character literal
8685 case it is correspondingly one of the characters @code{h}, @code{u},
8686 @code{s}, @code{e}, @code{8}, or @code{b}.
8688 Note that when the pragma is used within a file, it affects only the
8689 encoding within that file, and does not affect withed units, specs,
8690 or subunits.
8692 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
8693 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{115}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{116}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{117}
8694 @chapter Implementation Defined Aspects
8697 Ada defines (throughout the Ada 2012 reference manual, summarized
8698 in Annex K) a set of aspects that can be specified for certain entities.
8699 These language defined aspects are implemented in GNAT in Ada 2012 mode
8700 and work as described in the Ada 2012 Reference Manual.
8702 In addition, Ada 2012 allows implementations to define additional aspects
8703 whose meaning is defined by the implementation.  GNAT provides
8704 a number of these implementation-defined aspects which can be used
8705 to extend and enhance the functionality of the compiler.  This section of
8706 the GNAT reference manual describes these additional aspects.
8708 Note that any program using these aspects may not be portable to
8709 other compilers (although GNAT implements this set of aspects on all
8710 platforms).  Therefore if portability to other compilers is an important
8711 consideration, you should minimize the use of these aspects.
8713 Note that for many of these aspects, the effect is essentially similar
8714 to the use of a pragma or attribute specification with the same name
8715 applied to the entity. For example, if we write:
8717 @example
8718 type R is range 1 .. 100
8719   with Value_Size => 10;
8720 @end example
8722 then the effect is the same as:
8724 @example
8725 type R is range 1 .. 100;
8726 for R'Value_Size use 10;
8727 @end example
8729 and if we write:
8731 @example
8732 type R is new Integer
8733   with Shared => True;
8734 @end example
8736 then the effect is the same as:
8738 @example
8739 type R is new Integer;
8740 pragma Shared (R);
8741 @end example
8743 In the documentation below, such cases are simply marked
8744 as being boolean aspects equivalent to the corresponding pragma
8745 or attribute definition clause.
8747 @menu
8748 * Aspect Abstract_State:: 
8749 * Annotate:: 
8750 * Aspect Async_Readers:: 
8751 * Aspect Async_Writers:: 
8752 * Aspect Constant_After_Elaboration:: 
8753 * Aspect Contract_Cases:: 
8754 * Aspect Depends:: 
8755 * Aspect Default_Initial_Condition:: 
8756 * Aspect Dimension:: 
8757 * Aspect Dimension_System:: 
8758 * Aspect Disable_Controlled:: 
8759 * Aspect Effective_Reads:: 
8760 * Aspect Effective_Writes:: 
8761 * Aspect Extensions_Visible:: 
8762 * Aspect Favor_Top_Level:: 
8763 * Aspect Ghost:: 
8764 * Aspect Global:: 
8765 * Aspect Initial_Condition:: 
8766 * Aspect Initializes:: 
8767 * Aspect Inline_Always:: 
8768 * Aspect Invariant:: 
8769 * Aspect Invariant'Class:: 
8770 * Aspect Iterable:: 
8771 * Aspect Linker_Section:: 
8772 * Aspect Lock_Free:: 
8773 * Aspect No_Elaboration_Code_All:: 
8774 * Aspect No_Tagged_Streams:: 
8775 * Aspect Object_Size:: 
8776 * Aspect Obsolescent:: 
8777 * Aspect Part_Of:: 
8778 * Aspect Persistent_BSS:: 
8779 * Aspect Predicate:: 
8780 * Aspect Pure_Function:: 
8781 * Aspect Refined_Depends:: 
8782 * Aspect Refined_Global:: 
8783 * Aspect Refined_Post:: 
8784 * Aspect Refined_State:: 
8785 * Aspect Remote_Access_Type:: 
8786 * Aspect Scalar_Storage_Order:: 
8787 * Aspect Shared:: 
8788 * Aspect Simple_Storage_Pool:: 
8789 * Aspect Simple_Storage_Pool_Type:: 
8790 * Aspect SPARK_Mode:: 
8791 * Aspect Suppress_Debug_Info:: 
8792 * Aspect Suppress_Initialization:: 
8793 * Aspect Test_Case:: 
8794 * Aspect Thread_Local_Storage:: 
8795 * Aspect Universal_Aliasing:: 
8796 * Aspect Universal_Data:: 
8797 * Aspect Unmodified:: 
8798 * Aspect Unreferenced:: 
8799 * Aspect Unreferenced_Objects:: 
8800 * Aspect Value_Size:: 
8801 * Aspect Volatile_Full_Access:: 
8802 * Aspect Volatile_Function:: 
8803 * Aspect Warnings:: 
8805 @end menu
8807 @node Aspect Abstract_State,Annotate,,Implementation Defined Aspects
8808 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{118}
8809 @section Aspect Abstract_State
8812 @geindex Abstract_State
8814 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
8816 @node Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
8817 @anchor{gnat_rm/implementation_defined_aspects annotate}@anchor{119}
8818 @section Annotate
8821 @geindex Annotate
8823 There are three forms of this aspect (where ID is an identifier,
8824 and ARG is a general expression),
8825 corresponding to @ref{25,,pragma Annotate}.
8828 @table @asis
8830 @item @emph{Annotate => ID}
8832 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8834 @item @emph{Annotate => (ID)}
8836 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
8838 @item @emph{Annotate => (ID ,ID @{, ARG@})}
8840 Equivalent to @cite{pragma Annotate (ID@comma{} ID @{@comma{} ARG@}@comma{} Entity => Name);}
8841 @end table
8843 @node Aspect Async_Readers,Aspect Async_Writers,Annotate,Implementation Defined Aspects
8844 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{11a}
8845 @section Aspect Async_Readers
8848 @geindex Async_Readers
8850 This boolean aspect is equivalent to @ref{2c,,pragma Async_Readers}.
8852 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
8853 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{11b}
8854 @section Aspect Async_Writers
8857 @geindex Async_Writers
8859 This boolean aspect is equivalent to @ref{2f,,pragma Async_Writers}.
8861 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
8862 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{11c}
8863 @section Aspect Constant_After_Elaboration
8866 @geindex Constant_After_Elaboration
8868 This aspect is equivalent to @ref{40,,pragma Constant_After_Elaboration}.
8870 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
8871 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{11d}
8872 @section Aspect Contract_Cases
8875 @geindex Contract_Cases
8877 This aspect is equivalent to @ref{42,,pragma Contract_Cases}, the sequence
8878 of clauses being enclosed in parentheses so that syntactically it is an
8879 aggregate.
8881 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
8882 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{11e}
8883 @section Aspect Depends
8886 @geindex Depends
8888 This aspect is equivalent to @ref{50,,pragma Depends}.
8890 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
8891 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{11f}
8892 @section Aspect Default_Initial_Condition
8895 @geindex Default_Initial_Condition
8897 This aspect is equivalent to @ref{4b,,pragma Default_Initial_Condition}.
8899 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
8900 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{120}
8901 @section Aspect Dimension
8904 @geindex Dimension
8906 The @cite{Dimension} aspect is used to specify the dimensions of a given
8907 subtype of a dimensioned numeric type. The aspect also specifies a symbol
8908 used when doing formatted output of dimensioned quantities. The syntax is:
8910 @example
8911 with Dimension =>
8912   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
8914 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
8916 DIMENSION_VALUE ::=
8917   RATIONAL
8918 | others               => RATIONAL
8919 | DISCRETE_CHOICE_LIST => RATIONAL
8921 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
8922 @end example
8924 This aspect can only be applied to a subtype whose parent type has
8925 a @cite{Dimension_Systen} aspect. The aspect must specify values for
8926 all dimensions of the system. The rational values are the powers of the
8927 corresponding dimensions that are used by the compiler to verify that
8928 physical (numeric) computations are dimensionally consistent. For example,
8929 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
8930 For further examples of the usage
8931 of this aspect, see package @cite{System.Dim.Mks}.
8932 Note that when the dimensioned type is an integer type, then any
8933 dimension value must be an integer literal.
8935 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
8936 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{121}
8937 @section Aspect Dimension_System
8940 @geindex Dimension_System
8942 The @cite{Dimension_System} aspect is used to define a system of
8943 dimensions that will be used in subsequent subtype declarations with
8944 @cite{Dimension} aspects that reference this system. The syntax is:
8946 @example
8947 with Dimension_System => (DIMENSION @{, DIMENSION@});
8949 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
8950                [Unit_Symbol =>] SYMBOL,
8951                [Dim_Symbol  =>] SYMBOL)
8953 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
8954 @end example
8956 This aspect is applied to a type, which must be a numeric derived type
8957 (typically a floating-point type), that
8958 will represent values within the dimension system. Each @cite{DIMENSION}
8959 corresponds to one particular dimension. A maximum of 7 dimensions may
8960 be specified. @cite{Unit_Name} is the name of the dimension (for example
8961 @cite{Meter}). @cite{Unit_Symbol} is the shorthand used for quantities
8962 of this dimension (for example @cite{m} for @cite{Meter}).
8963 @cite{Dim_Symbol} gives
8964 the identification within the dimension system (typically this is a
8965 single letter, e.g. @cite{L} standing for length for unit name @cite{Meter}).
8966 The @cite{Unit_Symbol} is used in formatted output of dimensioned quantities.
8967 The @cite{Dim_Symbol} is used in error messages when numeric operations have
8968 inconsistent dimensions.
8970 GNAT provides the standard definition of the International MKS system in
8971 the run-time package @cite{System.Dim.Mks}. You can easily define
8972 similar packages for cgs units or British units, and define conversion factors
8973 between values in different systems. The MKS system is characterized by the
8974 following aspect:
8976 @example
8977 type Mks_Type is new Long_Long_Float with
8978   Dimension_System => (
8979     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
8980     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
8981     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
8982     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
8983     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
8984     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
8985     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
8986 @end example
8988 Note that in the above type definition, we use the @cite{at} symbol (@code{@@}) to
8989 represent a theta character (avoiding the use of extended Latin-1
8990 characters in this context).
8992 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
8993 Guide for detailed examples of use of the dimension system.
8995 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
8996 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{122}
8997 @section Aspect Disable_Controlled
9000 @geindex Disable_Controlled
9002 The aspect  @cite{Disable_Controlled} is defined for controlled record types. If
9003 active, this aspect causes suppression of all related calls to @cite{Initialize},
9004 @cite{Adjust}, and @cite{Finalize}. The intended use is for conditional compilation,
9005 where for example you might want a record to be controlled or not depending on
9006 whether some run-time check is enabled or suppressed.
9008 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9009 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{123}
9010 @section Aspect Effective_Reads
9013 @geindex Effective_Reads
9015 This aspect is equivalent to @ref{56,,pragma Effective_Reads}.
9017 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9018 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{124}
9019 @section Aspect Effective_Writes
9022 @geindex Effective_Writes
9024 This aspect is equivalent to @ref{58,,pragma Effective_Writes}.
9026 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9027 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{125}
9028 @section Aspect Extensions_Visible
9031 @geindex Extensions_Visible
9033 This aspect is equivalent to @ref{64,,pragma Extensions_Visible}.
9035 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9036 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{126}
9037 @section Aspect Favor_Top_Level
9040 @geindex Favor_Top_Level
9042 This boolean aspect is equivalent to @ref{69,,pragma Favor_Top_Level}.
9044 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9045 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{127}
9046 @section Aspect Ghost
9049 @geindex Ghost
9051 This aspect is equivalent to @ref{6c,,pragma Ghost}.
9053 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9054 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{128}
9055 @section Aspect Global
9058 @geindex Global
9060 This aspect is equivalent to @ref{6e,,pragma Global}.
9062 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9063 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{129}
9064 @section Aspect Initial_Condition
9067 @geindex Initial_Condition
9069 This aspect is equivalent to @ref{7c,,pragma Initial_Condition}.
9071 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9072 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{12a}
9073 @section Aspect Initializes
9076 @geindex Initializes
9078 This aspect is equivalent to @ref{7e,,pragma Initializes}.
9080 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9081 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{12b}
9082 @section Aspect Inline_Always
9085 @geindex Inline_Always
9087 This boolean aspect is equivalent to @ref{81,,pragma Inline_Always}.
9089 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9090 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{12c}
9091 @section Aspect Invariant
9094 @geindex Invariant
9096 This aspect is equivalent to @ref{88,,pragma Invariant}. It is a
9097 synonym for the language defined aspect @cite{Type_Invariant} except
9098 that it is separately controllable using pragma @cite{Assertion_Policy}.
9100 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9101 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{12d}
9102 @section Aspect Invariant'Class
9105 @geindex Invariant'Class
9107 This aspect is equivalent to @ref{f7,,pragma Type_Invariant_Class}. It is a
9108 synonym for the language defined aspect @cite{Type_Invariant'Class} except
9109 that it is separately controllable using pragma @cite{Assertion_Policy}.
9111 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9112 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{12e}
9113 @section Aspect Iterable
9116 @geindex Iterable
9118 This aspect provides a light-weight mechanism for loops and quantified
9119 expressions over container types, without the overhead imposed by the tampering
9120 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9121 with four named components: @cite{First}, @cite{Next}, @cite{Has_Element}, and @cite{Element} (the
9122 last one being optional). When only 3 components are specified, only the
9123 @cite{for .. in} form of iteration over cursors is available. When all 4 components
9124 are specified, both this form and the @cite{for .. of} form of iteration over
9125 elements are available. The following is a typical example of use:
9127 @example
9128 type List is private with
9129     Iterable => (First        => First_Cursor,
9130                  Next         => Advance,
9131                  Has_Element  => Cursor_Has_Element,
9132                 [Element      => Get_Element]);
9133 @end example
9136 @itemize *
9138 @item 
9139 The value denoted by @cite{First} must denote a primitive operation of the
9140 container type that returns a @cite{Cursor}, which must a be a type declared in
9141 the container package or visible from it. For example:
9142 @end itemize
9144 @example
9145 function First_Cursor (Cont : Container) return Cursor;
9146 @end example
9149 @itemize *
9151 @item 
9152 The value of @cite{Next} is a primitive operation of the container type that takes
9153 both a container and a cursor and yields a cursor. For example:
9154 @end itemize
9156 @example
9157 function Advance (Cont : Container; Position : Cursor) return Cursor;
9158 @end example
9161 @itemize *
9163 @item 
9164 The value of @cite{Has_Element} is a primitive operation of the container type
9165 that takes both a container and a cursor and yields a boolean. For example:
9166 @end itemize
9168 @example
9169 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9170 @end example
9173 @itemize *
9175 @item 
9176 The value of @cite{Element} is a primitive operation of the container type that
9177 takes both a container and a cursor and yields an @cite{Element_Type}, which must
9178 be a type declared in the container package or visible from it. For example:
9179 @end itemize
9181 @example
9182 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9183 @end example
9185 This aspect is used in the GNAT-defined formal container packages.
9187 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9188 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{12f}
9189 @section Aspect Linker_Section
9192 @geindex Linker_Section
9194 This aspect is equivalent to @ref{90,,pragma Linker_Section}.
9196 @node Aspect Lock_Free,Aspect No_Elaboration_Code_All,Aspect Linker_Section,Implementation Defined Aspects
9197 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{130}
9198 @section Aspect Lock_Free
9201 @geindex Lock_Free
9203 This boolean aspect is equivalent to @ref{92,,pragma Lock_Free}.
9205 @node Aspect No_Elaboration_Code_All,Aspect No_Tagged_Streams,Aspect Lock_Free,Implementation Defined Aspects
9206 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{131}
9207 @section Aspect No_Elaboration_Code_All
9210 @geindex No_Elaboration_Code_All
9212 This aspect is equivalent to @ref{9b,,pragma No_Elaboration_Code_All}
9213 for a program unit.
9215 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9216 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{132}
9217 @section Aspect No_Tagged_Streams
9220 @geindex No_Tagged_Streams
9222 This aspect is equivalent to @ref{a0,,pragma No_Tagged_Streams} with an
9223 argument specifying a root tagged type (thus this aspect can only be
9224 applied to such a type).
9226 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9227 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{133}
9228 @section Aspect Object_Size
9231 @geindex Object_Size
9233 This aspect is equivalent to @ref{134,,attribute Object_Size}.
9235 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9236 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{135}
9237 @section Aspect Obsolescent
9240 @geindex Obsolsecent
9242 This aspect is equivalent to @ref{a3,,pragma Obsolescent}. Note that the
9243 evaluation of this aspect happens at the point of occurrence, it is not
9244 delayed until the freeze point.
9246 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9247 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{136}
9248 @section Aspect Part_Of
9251 @geindex Part_Of
9253 This aspect is equivalent to @ref{ab,,pragma Part_Of}.
9255 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9256 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{137}
9257 @section Aspect Persistent_BSS
9260 @geindex Persistent_BSS
9262 This boolean aspect is equivalent to @ref{ad,,pragma Persistent_BSS}.
9264 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9265 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{138}
9266 @section Aspect Predicate
9269 @geindex Predicate
9271 This aspect is equivalent to @ref{b5,,pragma Predicate}. It is thus
9272 similar to the language defined aspects @cite{Dynamic_Predicate}
9273 and @cite{Static_Predicate} except that whether the resulting
9274 predicate is static or dynamic is controlled by the form of the
9275 expression. It is also separately controllable using pragma
9276 @cite{Assertion_Policy}.
9278 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9279 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{139}
9280 @section Aspect Pure_Function
9283 @geindex Pure_Function
9285 This boolean aspect is equivalent to @ref{c1,,pragma Pure_Function}.
9287 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9288 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{13a}
9289 @section Aspect Refined_Depends
9292 @geindex Refined_Depends
9294 This aspect is equivalent to @ref{c6,,pragma Refined_Depends}.
9296 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9297 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{13b}
9298 @section Aspect Refined_Global
9301 @geindex Refined_Global
9303 This aspect is equivalent to @ref{c7,,pragma Refined_Global}.
9305 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9306 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{13c}
9307 @section Aspect Refined_Post
9310 @geindex Refined_Post
9312 This aspect is equivalent to @ref{c9,,pragma Refined_Post}.
9314 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9315 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{13d}
9316 @section Aspect Refined_State
9319 @geindex Refined_State
9321 This aspect is equivalent to @ref{cb,,pragma Refined_State}.
9323 @node Aspect Remote_Access_Type,Aspect Scalar_Storage_Order,Aspect Refined_State,Implementation Defined Aspects
9324 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{13e}
9325 @section Aspect Remote_Access_Type
9328 @geindex Remote_Access_Type
9330 This aspect is equivalent to @ref{cf,,pragma Remote_Access_Type}.
9332 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Remote_Access_Type,Implementation Defined Aspects
9333 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{13f}
9334 @section Aspect Scalar_Storage_Order
9337 @geindex Scalar_Storage_Order
9339 This aspect is equivalent to a @ref{140,,attribute Scalar_Storage_Order}.
9341 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9342 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{141}
9343 @section Aspect Shared
9346 @geindex Shared
9348 This boolean aspect is equivalent to @ref{d5,,pragma Shared}
9349 and is thus a synonym for aspect @cite{Atomic}.
9351 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9352 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{142}
9353 @section Aspect Simple_Storage_Pool
9356 @geindex Simple_Storage_Pool
9358 This aspect is equivalent to @ref{da,,attribute Simple_Storage_Pool}.
9360 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9361 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{143}
9362 @section Aspect Simple_Storage_Pool_Type
9365 @geindex Simple_Storage_Pool_Type
9367 This boolean aspect is equivalent to @ref{d8,,pragma Simple_Storage_Pool_Type}.
9369 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9370 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{144}
9371 @section Aspect SPARK_Mode
9374 @geindex SPARK_Mode
9376 This aspect is equivalent to @ref{e0,,pragma SPARK_Mode} and
9377 may be specified for either or both of the specification and body
9378 of a subprogram or package.
9380 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9381 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{145}
9382 @section Aspect Suppress_Debug_Info
9385 @geindex Suppress_Debug_Info
9387 This boolean aspect is equivalent to @ref{e8,,pragma Suppress_Debug_Info}.
9389 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9390 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{146}
9391 @section Aspect Suppress_Initialization
9394 @geindex Suppress_Initialization
9396 This boolean aspect is equivalent to @ref{ec,,pragma Suppress_Initialization}.
9398 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9399 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{147}
9400 @section Aspect Test_Case
9403 @geindex Test_Case
9405 This aspect is equivalent to @ref{ef,,pragma Test_Case}.
9407 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9408 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{148}
9409 @section Aspect Thread_Local_Storage
9412 @geindex Thread_Local_Storage
9414 This boolean aspect is equivalent to @ref{f1,,pragma Thread_Local_Storage}.
9416 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
9417 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{149}
9418 @section Aspect Universal_Aliasing
9421 @geindex Universal_Aliasing
9423 This boolean aspect is equivalent to @ref{fc,,pragma Universal_Aliasing}.
9425 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
9426 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{14a}
9427 @section Aspect Universal_Data
9430 @geindex Universal_Data
9432 This aspect is equivalent to @ref{fd,,pragma Universal_Data}.
9434 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
9435 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{14b}
9436 @section Aspect Unmodified
9439 @geindex Unmodified
9441 This boolean aspect is equivalent to @ref{100,,pragma Unmodified}.
9443 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9444 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{14c}
9445 @section Aspect Unreferenced
9448 @geindex Unreferenced
9450 This boolean aspect is equivalent to @ref{102,,pragma Unreferenced}. Note that
9451 in the case of formal parameters, it is not permitted to have aspects for
9452 a formal parameter, so in this case the pragma form must be used.
9454 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9455 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{14d}
9456 @section Aspect Unreferenced_Objects
9459 @geindex Unreferenced_Objects
9461 This boolean aspect is equivalent to @ref{103,,pragma Unreferenced_Objects}.
9463 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
9464 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{14e}
9465 @section Aspect Value_Size
9468 @geindex Value_Size
9470 This aspect is equivalent to @ref{14f,,attribute Value_Size}.
9472 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
9473 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{150}
9474 @section Aspect Volatile_Full_Access
9477 @geindex Volatile_Full_Access
9479 This boolean aspect is equivalent to @ref{10c,,pragma Volatile_Full_Access}.
9481 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
9482 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{151}
9483 @section Aspect Volatile_Function
9486 @geindex Volatile_Function
9488 This boolean aspect is equivalent to @ref{10f,,pragma Volatile_Function}.
9490 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
9491 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{152}
9492 @section Aspect Warnings
9495 @geindex Warnings
9497 This aspect is equivalent to the two argument form of @ref{111,,pragma Warnings},
9498 where the first argument is @cite{ON} or @cite{OFF} and the second argument
9499 is the entity.
9501 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9502 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{153}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{154}
9503 @chapter Implementation Defined Attributes
9506 Ada defines (throughout the Ada reference manual,
9507 summarized in Annex K),
9508 a set of attributes that provide useful additional functionality in all
9509 areas of the language.  These language defined attributes are implemented
9510 in GNAT and work as described in the Ada Reference Manual.
9512 In addition, Ada allows implementations to define additional
9513 attributes whose meaning is defined by the implementation.  GNAT provides
9514 a number of these implementation-dependent attributes which can be used
9515 to extend and enhance the functionality of the compiler.  This section of
9516 the GNAT reference manual describes these additional attributes.  It also
9517 describes additional implementation-dependent features of standard
9518 language-defined attributes.
9520 Note that any program using these attributes may not be portable to
9521 other compilers (although GNAT implements this set of attributes on all
9522 platforms).  Therefore if portability to other compilers is an important
9523 consideration, you should minimize the use of these attributes.
9525 @menu
9526 * Attribute Abort_Signal:: 
9527 * Attribute Address_Size:: 
9528 * Attribute Asm_Input:: 
9529 * Attribute Asm_Output:: 
9530 * Attribute Atomic_Always_Lock_Free:: 
9531 * Attribute Bit:: 
9532 * Attribute Bit_Position:: 
9533 * Attribute Code_Address:: 
9534 * Attribute Compiler_Version:: 
9535 * Attribute Constrained:: 
9536 * Attribute Default_Bit_Order:: 
9537 * Attribute Default_Scalar_Storage_Order:: 
9538 * Attribute Deref:: 
9539 * Attribute Descriptor_Size:: 
9540 * Attribute Elaborated:: 
9541 * Attribute Elab_Body:: 
9542 * Attribute Elab_Spec:: 
9543 * Attribute Elab_Subp_Body:: 
9544 * Attribute Emax:: 
9545 * Attribute Enabled:: 
9546 * Attribute Enum_Rep:: 
9547 * Attribute Enum_Val:: 
9548 * Attribute Epsilon:: 
9549 * Attribute Fast_Math:: 
9550 * Attribute Fixed_Value:: 
9551 * Attribute From_Any:: 
9552 * Attribute Has_Access_Values:: 
9553 * Attribute Has_Discriminants:: 
9554 * Attribute Img:: 
9555 * Attribute Integer_Value:: 
9556 * Attribute Invalid_Value:: 
9557 * Attribute Iterable:: 
9558 * Attribute Large:: 
9559 * Attribute Library_Level:: 
9560 * Attribute Lock_Free:: 
9561 * Attribute Loop_Entry:: 
9562 * Attribute Machine_Size:: 
9563 * Attribute Mantissa:: 
9564 * Attribute Maximum_Alignment:: 
9565 * Attribute Mechanism_Code:: 
9566 * Attribute Null_Parameter:: 
9567 * Attribute Object_Size:: 
9568 * Attribute Old:: 
9569 * Attribute Passed_By_Reference:: 
9570 * Attribute Pool_Address:: 
9571 * Attribute Range_Length:: 
9572 * Attribute Restriction_Set:: 
9573 * Attribute Result:: 
9574 * Attribute Safe_Emax:: 
9575 * Attribute Safe_Large:: 
9576 * Attribute Safe_Small:: 
9577 * Attribute Scalar_Storage_Order:: 
9578 * Attribute Simple_Storage_Pool:: 
9579 * Attribute Small:: 
9580 * Attribute Storage_Unit:: 
9581 * Attribute Stub_Type:: 
9582 * Attribute System_Allocator_Alignment:: 
9583 * Attribute Target_Name:: 
9584 * Attribute To_Address:: 
9585 * Attribute To_Any:: 
9586 * Attribute Type_Class:: 
9587 * Attribute Type_Key:: 
9588 * Attribute TypeCode:: 
9589 * Attribute Unconstrained_Array:: 
9590 * Attribute Universal_Literal_String:: 
9591 * Attribute Unrestricted_Access:: 
9592 * Attribute Update:: 
9593 * Attribute Valid_Scalars:: 
9594 * Attribute VADS_Size:: 
9595 * Attribute Value_Size:: 
9596 * Attribute Wchar_T_Size:: 
9597 * Attribute Word_Size:: 
9599 @end menu
9601 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
9602 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{155}
9603 @section Attribute Abort_Signal
9606 @geindex Abort_Signal
9608 @cite{Standard'Abort_Signal} (@cite{Standard} is the only allowed
9609 prefix) provides the entity for the special exception used to signal
9610 task abort or asynchronous transfer of control.  Normally this attribute
9611 should only be used in the tasking runtime (it is highly peculiar, and
9612 completely outside the normal semantics of Ada, for a user program to
9613 intercept the abort exception).
9615 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
9616 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{156}
9617 @section Attribute Address_Size
9620 @geindex Size of `Address`
9622 @geindex Address_Size
9624 @cite{Standard'Address_Size} (@cite{Standard} is the only allowed
9625 prefix) is a static constant giving the number of bits in an
9626 @cite{Address}. It is the same value as System.Address'Size,
9627 but has the advantage of being static, while a direct
9628 reference to System.Address'Size is nonstatic because Address
9629 is a private type.
9631 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
9632 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{157}
9633 @section Attribute Asm_Input
9636 @geindex Asm_Input
9638 The @cite{Asm_Input} attribute denotes a function that takes two
9639 parameters.  The first is a string, the second is an expression of the
9640 type designated by the prefix.  The first (string) argument is required
9641 to be a static expression, and is the constraint for the parameter,
9642 (e.g., what kind of register is required).  The second argument is the
9643 value to be used as the input argument.  The possible values for the
9644 constant are the same as those used in the RTL, and are dependent on
9645 the configuration file used to built the GCC back end.
9646 @ref{158,,Machine Code Insertions}
9648 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
9649 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{159}
9650 @section Attribute Asm_Output
9653 @geindex Asm_Output
9655 The @cite{Asm_Output} attribute denotes a function that takes two
9656 parameters.  The first is a string, the second is the name of a variable
9657 of the type designated by the attribute prefix.  The first (string)
9658 argument is required to be a static expression and designates the
9659 constraint for the parameter (e.g., what kind of register is
9660 required).  The second argument is the variable to be updated with the
9661 result.  The possible values for constraint are the same as those used in
9662 the RTL, and are dependent on the configuration file used to build the
9663 GCC back end.  If there are no output operands, then this argument may
9664 either be omitted, or explicitly given as @cite{No_Output_Operands}.
9665 @ref{158,,Machine Code Insertions}
9667 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
9668 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{15a}
9669 @section Attribute Atomic_Always_Lock_Free
9672 @geindex Atomic_Always_Lock_Free
9674 The prefix of the @cite{Atomic_Always_Lock_Free} attribute is a type.
9675 The result is a Boolean value which is True if the type has discriminants,
9676 and False otherwise.  The result indicate whether atomic operations are
9677 supported by the target for the given type.
9679 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
9680 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{15b}
9681 @section Attribute Bit
9684 @geindex Bit
9686 @code{obj'Bit}, where @cite{obj} is any object, yields the bit
9687 offset within the storage unit (byte) that contains the first bit of
9688 storage allocated for the object.  The value of this attribute is of the
9689 type @cite{Universal_Integer}, and is always a non-negative number not
9690 exceeding the value of @cite{System.Storage_Unit}.
9692 For an object that is a variable or a constant allocated in a register,
9693 the value is zero.  (The use of this attribute does not force the
9694 allocation of a variable to memory).
9696 For an object that is a formal parameter, this attribute applies
9697 to either the matching actual parameter or to a copy of the
9698 matching actual parameter.
9700 For an access object the value is zero.  Note that
9701 @code{obj.all'Bit} is subject to an @cite{Access_Check} for the
9702 designated object.  Similarly for a record component
9703 @code{X.C'Bit} is subject to a discriminant check and
9704 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
9705 are subject to index checks.
9707 This attribute is designed to be compatible with the DEC Ada 83 definition
9708 and implementation of the @cite{Bit} attribute.
9710 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
9711 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{15c}
9712 @section Attribute Bit_Position
9715 @geindex Bit_Position
9717 @code{R.C'Bit_Position}, where @cite{R} is a record object and @cite{C} is one
9718 of the fields of the record type, yields the bit
9719 offset within the record contains the first bit of
9720 storage allocated for the object.  The value of this attribute is of the
9721 type @cite{Universal_Integer}.  The value depends only on the field
9722 @cite{C} and is independent of the alignment of
9723 the containing record @cite{R}.
9725 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
9726 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{15d}
9727 @section Attribute Code_Address
9730 @geindex Code_Address
9732 @geindex Subprogram address
9734 @geindex Address of subprogram code
9736 The @cite{'Address}
9737 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
9738 intended effect seems to be to provide
9739 an address value which can be used to call the subprogram by means of
9740 an address clause as in the following example:
9742 @example
9743 procedure K is ...
9745 procedure L;
9746 for L'Address use K'Address;
9747 pragma Import (Ada, L);
9748 @end example
9750 A call to @cite{L} is then expected to result in a call to @cite{K}.
9751 In Ada 83, where there were no access-to-subprogram values, this was
9752 a common work-around for getting the effect of an indirect call.
9753 GNAT implements the above use of @cite{Address} and the technique
9754 illustrated by the example code works correctly.
9756 However, for some purposes, it is useful to have the address of the start
9757 of the generated code for the subprogram.  On some architectures, this is
9758 not necessarily the same as the @cite{Address} value described above.
9759 For example, the @cite{Address} value may reference a subprogram
9760 descriptor rather than the subprogram itself.
9762 The @cite{'Code_Address} attribute, which can only be applied to
9763 subprogram entities, always returns the address of the start of the
9764 generated code of the specified subprogram, which may or may not be
9765 the same value as is returned by the corresponding @cite{'Address}
9766 attribute.
9768 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
9769 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{15e}
9770 @section Attribute Compiler_Version
9773 @geindex Compiler_Version
9775 @cite{Standard'Compiler_Version} (@cite{Standard} is the only allowed
9776 prefix) yields a static string identifying the version of the compiler
9777 being used to compile the unit containing the attribute reference.
9779 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
9780 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{15f}
9781 @section Attribute Constrained
9784 @geindex Constrained
9786 In addition to the usage of this attribute in the Ada RM, @cite{GNAT}
9787 also permits the use of the @cite{'Constrained} attribute
9788 in a generic template
9789 for any type, including types without discriminants. The value of this
9790 attribute in the generic instance when applied to a scalar type or a
9791 record type without discriminants is always @cite{True}. This usage is
9792 compatible with older Ada compilers, including notably DEC Ada.
9794 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
9795 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{160}
9796 @section Attribute Default_Bit_Order
9799 @geindex Big endian
9801 @geindex Little endian
9803 @geindex Default_Bit_Order
9805 @cite{Standard'Default_Bit_Order} (@cite{Standard} is the only
9806 permissible prefix), provides the value @cite{System.Default_Bit_Order}
9807 as a @cite{Pos} value (0 for @cite{High_Order_First}, 1 for
9808 @cite{Low_Order_First}).  This is used to construct the definition of
9809 @cite{Default_Bit_Order} in package @cite{System}.
9811 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
9812 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{161}
9813 @section Attribute Default_Scalar_Storage_Order
9816 @geindex Big endian
9818 @geindex Little endian
9820 @geindex Default_Scalar_Storage_Order
9822 @cite{Standard'Default_Scalar_Storage_Order} (@cite{Standard} is the only
9823 permissible prefix), provides the current value of the default scalar storage
9824 order (as specified using pragma @cite{Default_Scalar_Storage_Order}, or
9825 equal to @cite{Default_Bit_Order} if unspecified) as a
9826 @cite{System.Bit_Order} value. This is a static attribute.
9828 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
9829 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{162}
9830 @section Attribute Deref
9833 @geindex Deref
9835 The attribute @cite{typ'Deref(expr)} where @cite{expr} is of type @cite{System.Address} yields
9836 the variable of type @cite{typ} that is located at the given address. It is similar
9837 to @cite{(totyp (expr).all)}, where @cite{totyp} is an unchecked conversion from address to
9838 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
9839 used on the left side of an assignment.
9841 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
9842 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{163}
9843 @section Attribute Descriptor_Size
9846 @geindex Descriptor
9848 @geindex Dope vector
9850 @geindex Descriptor_Size
9852 Nonstatic attribute @cite{Descriptor_Size} returns the size in bits of the
9853 descriptor allocated for a type.  The result is non-zero only for unconstrained
9854 array types and the returned value is of type universal integer.  In GNAT, an
9855 array descriptor contains bounds information and is located immediately before
9856 the first element of the array.
9858 @example
9859 type Unconstr_Array is array (Positive range <>) of Boolean;
9860 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
9861 @end example
9863 The attribute takes into account any additional padding due to type alignment.
9864 In the example above, the descriptor contains two values of type
9865 @cite{Positive} representing the low and high bound.  Since @cite{Positive} has
9866 a size of 31 bits and an alignment of 4, the descriptor size is @cite{2 * Positive'Size + 2} or 64 bits.
9868 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
9869 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{164}
9870 @section Attribute Elaborated
9873 @geindex Elaborated
9875 The prefix of the @cite{'Elaborated} attribute must be a unit name.  The
9876 value is a Boolean which indicates whether or not the given unit has been
9877 elaborated.  This attribute is primarily intended for internal use by the
9878 generated code for dynamic elaboration checking, but it can also be used
9879 in user programs.  The value will always be True once elaboration of all
9880 units has been completed.  An exception is for units which need no
9881 elaboration, the value is always False for such units.
9883 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
9884 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{165}
9885 @section Attribute Elab_Body
9888 @geindex Elab_Body
9890 This attribute can only be applied to a program unit name.  It returns
9891 the entity for the corresponding elaboration procedure for elaborating
9892 the body of the referenced unit.  This is used in the main generated
9893 elaboration procedure by the binder and is not normally used in any
9894 other context.  However, there may be specialized situations in which it
9895 is useful to be able to call this elaboration procedure from Ada code,
9896 e.g., if it is necessary to do selective re-elaboration to fix some
9897 error.
9899 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
9900 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{166}
9901 @section Attribute Elab_Spec
9904 @geindex Elab_Spec
9906 This attribute can only be applied to a program unit name.  It returns
9907 the entity for the corresponding elaboration procedure for elaborating
9908 the spec of the referenced unit.  This is used in the main
9909 generated elaboration procedure by the binder and is not normally used
9910 in any other context.  However, there may be specialized situations in
9911 which it is useful to be able to call this elaboration procedure from
9912 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
9913 some error.
9915 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
9916 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{167}
9917 @section Attribute Elab_Subp_Body
9920 @geindex Elab_Subp_Body
9922 This attribute can only be applied to a library level subprogram
9923 name and is only allowed in CodePeer mode. It returns the entity
9924 for the corresponding elaboration procedure for elaborating the body
9925 of the referenced subprogram unit. This is used in the main generated
9926 elaboration procedure by the binder in CodePeer mode only and is unrecognized
9927 otherwise.
9929 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
9930 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{168}
9931 @section Attribute Emax
9934 @geindex Ada 83 attributes
9936 @geindex Emax
9938 The @cite{Emax} attribute is provided for compatibility with Ada 83.  See
9939 the Ada 83 reference manual for an exact description of the semantics of
9940 this attribute.
9942 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
9943 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{169}
9944 @section Attribute Enabled
9947 @geindex Enabled
9949 The @cite{Enabled} attribute allows an application program to check at compile
9950 time to see if the designated check is currently enabled. The prefix is a
9951 simple identifier, referencing any predefined check name (other than
9952 @cite{All_Checks}) or a check name introduced by pragma Check_Name. If
9953 no argument is given for the attribute, the check is for the general state
9954 of the check, if an argument is given, then it is an entity name, and the
9955 check indicates whether an @cite{Suppress} or @cite{Unsuppress} has been
9956 given naming the entity (if not, then the argument is ignored).
9958 Note that instantiations inherit the check status at the point of the
9959 instantiation, so a useful idiom is to have a library package that
9960 introduces a check name with @cite{pragma Check_Name}, and then contains
9961 generic packages or subprograms which use the @cite{Enabled} attribute
9962 to see if the check is enabled. A user of this package can then issue
9963 a @cite{pragma Suppress} or @cite{pragma Unsuppress} before instantiating
9964 the package or subprogram, controlling whether the check will be present.
9966 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
9967 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{16a}
9968 @section Attribute Enum_Rep
9971 @geindex Representation of enums
9973 @geindex Enum_Rep
9975 For every enumeration subtype @cite{S}, @code{S'Enum_Rep} denotes a
9976 function with the following spec:
9978 @example
9979 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
9980 @end example
9982 It is also allowable to apply @cite{Enum_Rep} directly to an object of an
9983 enumeration type or to a non-overloaded enumeration
9984 literal.  In this case @code{S'Enum_Rep} is equivalent to
9985 @code{typ'Enum_Rep(S)} where @cite{typ} is the type of the
9986 enumeration literal or object.
9988 The function returns the representation value for the given enumeration
9989 value.  This will be equal to value of the @cite{Pos} attribute in the
9990 absence of an enumeration representation clause.  This is a static
9991 attribute (i.e.,:the result is static if the argument is static).
9993 @code{S'Enum_Rep} can also be used with integer types and objects,
9994 in which case it simply returns the integer value.  The reason for this
9995 is to allow it to be used for @cite{(<>)} discrete formal arguments in
9996 a generic unit that can be instantiated with either enumeration types
9997 or integer types.  Note that if @cite{Enum_Rep} is used on a modular
9998 type whose upper bound exceeds the upper bound of the largest signed
9999 integer type, and the argument is a variable, so that the universal
10000 integer calculation is done at run time, then the call to @cite{Enum_Rep}
10001 may raise @cite{Constraint_Error}.
10003 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10004 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{16b}
10005 @section Attribute Enum_Val
10008 @geindex Representation of enums
10010 @geindex Enum_Val
10012 For every enumeration subtype @cite{S}, @code{S'Enum_Val} denotes a
10013 function with the following spec:
10015 @example
10016 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10017 @end example
10019 The function returns the enumeration value whose representation matches the
10020 argument, or raises Constraint_Error if no enumeration literal of the type
10021 has the matching value.
10022 This will be equal to value of the @cite{Val} attribute in the
10023 absence of an enumeration representation clause.  This is a static
10024 attribute (i.e., the result is static if the argument is static).
10026 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10027 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{16c}
10028 @section Attribute Epsilon
10031 @geindex Ada 83 attributes
10033 @geindex Epsilon
10035 The @cite{Epsilon} attribute is provided for compatibility with Ada 83.  See
10036 the Ada 83 reference manual for an exact description of the semantics of
10037 this attribute.
10039 @node Attribute Fast_Math,Attribute Fixed_Value,Attribute Epsilon,Implementation Defined Attributes
10040 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{16d}
10041 @section Attribute Fast_Math
10044 @geindex Fast_Math
10046 @cite{Standard'Fast_Math} (@cite{Standard} is the only allowed
10047 prefix) yields a static Boolean value that is True if pragma
10048 @cite{Fast_Math} is active, and False otherwise.
10050 @node Attribute Fixed_Value,Attribute From_Any,Attribute Fast_Math,Implementation Defined Attributes
10051 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{16e}
10052 @section Attribute Fixed_Value
10055 @geindex Fixed_Value
10057 For every fixed-point type @cite{S}, @code{S'Fixed_Value} denotes a
10058 function with the following specification:
10060 @example
10061 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10062 @end example
10064 The value returned is the fixed-point value @cite{V} such that:
10066 @example
10067 V = Arg * S'Small
10068 @end example
10070 The effect is thus similar to first converting the argument to the
10071 integer type used to represent @cite{S}, and then doing an unchecked
10072 conversion to the fixed-point type.  The difference is
10073 that there are full range checks, to ensure that the result is in range.
10074 This attribute is primarily intended for use in implementation of the
10075 input-output functions for fixed-point values.
10077 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10078 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{16f}
10079 @section Attribute From_Any
10082 @geindex From_Any
10084 This internal attribute is used for the generation of remote subprogram
10085 stubs in the context of the Distributed Systems Annex.
10087 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10088 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{170}
10089 @section Attribute Has_Access_Values
10092 @geindex Access values
10093 @geindex testing for
10095 @geindex Has_Access_Values
10097 The prefix of the @cite{Has_Access_Values} attribute is a type.  The result
10098 is a Boolean value which is True if the is an access type, or is a composite
10099 type with a component (at any nesting depth) that is an access type, and is
10100 False otherwise.
10101 The intended use of this attribute is in conjunction with generic
10102 definitions.  If the attribute is applied to a generic private type, it
10103 indicates whether or not the corresponding actual type has access values.
10105 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10106 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{171}
10107 @section Attribute Has_Discriminants
10110 @geindex Discriminants
10111 @geindex testing for
10113 @geindex Has_Discriminants
10115 The prefix of the @cite{Has_Discriminants} attribute is a type.  The result
10116 is a Boolean value which is True if the type has discriminants, and False
10117 otherwise.  The intended use of this attribute is in conjunction with generic
10118 definitions.  If the attribute is applied to a generic private type, it
10119 indicates whether or not the corresponding actual type has discriminants.
10121 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10122 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{172}
10123 @section Attribute Img
10126 @geindex Img
10128 The @cite{Img} attribute differs from @cite{Image} in that it is applied
10129 directly to an object, and yields the same result as
10130 @cite{Image} for the subtype of the object.  This is convenient for
10131 debugging:
10133 @example
10134 Put_Line ("X = " & X'Img);
10135 @end example
10137 has the same meaning as the more verbose:
10139 @example
10140 Put_Line ("X = " & T'Image (X));
10141 @end example
10143 where @cite{T} is the (sub)type of the object @cite{X}.
10145 Note that technically, in analogy to @cite{Image},
10146 @cite{X'Img} returns a parameterless function
10147 that returns the appropriate string when called. This means that
10148 @cite{X'Img} can be renamed as a function-returning-string, or used
10149 in an instantiation as a function parameter.
10151 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10152 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{173}
10153 @section Attribute Integer_Value
10156 @geindex Integer_Value
10158 For every integer type @cite{S}, @code{S'Integer_Value} denotes a
10159 function with the following spec:
10161 @example
10162 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10163 @end example
10165 The value returned is the integer value @cite{V}, such that:
10167 @example
10168 Arg = V * T'Small
10169 @end example
10171 where @cite{T} is the type of @cite{Arg}.
10172 The effect is thus similar to first doing an unchecked conversion from
10173 the fixed-point type to its corresponding implementation type, and then
10174 converting the result to the target integer type.  The difference is
10175 that there are full range checks, to ensure that the result is in range.
10176 This attribute is primarily intended for use in implementation of the
10177 standard input-output functions for fixed-point values.
10179 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10180 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{174}
10181 @section Attribute Invalid_Value
10184 @geindex Invalid_Value
10186 For every scalar type S, S'Invalid_Value returns an undefined value of the
10187 type. If possible this value is an invalid representation for the type. The
10188 value returned is identical to the value used to initialize an otherwise
10189 uninitialized value of the type if pragma Initialize_Scalars is used,
10190 including the ability to modify the value with the binder -Sxx flag and
10191 relevant environment variables at run time.
10193 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10194 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{175}
10195 @section Attribute Iterable
10198 @geindex Iterable
10200 Equivalent to Aspect Iterable.
10202 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10203 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{176}
10204 @section Attribute Large
10207 @geindex Ada 83 attributes
10209 @geindex Large
10211 The @cite{Large} attribute is provided for compatibility with Ada 83.  See
10212 the Ada 83 reference manual for an exact description of the semantics of
10213 this attribute.
10215 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10216 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{177}
10217 @section Attribute Library_Level
10220 @geindex Library_Level
10222 @cite{P'Library_Level}, where P is an entity name,
10223 returns a Boolean value which is True if the entity is declared
10224 at the library level, and False otherwise. Note that within a
10225 generic instantition, the name of the generic unit denotes the
10226 instance, which means that this attribute can be used to test
10227 if a generic is instantiated at the library level, as shown
10228 in this example:
10230 @example
10231 generic
10232   ...
10233 package Gen is
10234   pragma Compile_Time_Error
10235     (not Gen'Library_Level,
10236      "Gen can only be instantiated at library level");
10237   ...
10238 end Gen;
10239 @end example
10241 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10242 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{178}
10243 @section Attribute Lock_Free
10246 @geindex Lock_Free
10248 @cite{P'Lock_Free}, where P is a protected object, returns True if a
10249 pragma @cite{Lock_Free} applies to P.
10251 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10252 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{179}
10253 @section Attribute Loop_Entry
10256 @geindex Loop_Entry
10258 Syntax:
10260 @example
10261 X'Loop_Entry [(loop_name)]
10262 @end example
10264 The @cite{Loop_Entry} attribute is used to refer to the value that an
10265 expression had upon entry to a given loop in much the same way that the
10266 @cite{Old} attribute in a subprogram postcondition can be used to refer
10267 to the value an expression had upon entry to the subprogram. The
10268 relevant loop is either identified by the given loop name, or it is the
10269 innermost enclosing loop when no loop name is given.
10271 A @cite{Loop_Entry} attribute can only occur within a
10272 @cite{Loop_Variant} or @cite{Loop_Invariant} pragma. A common use of
10273 @cite{Loop_Entry} is to compare the current value of objects with their
10274 initial value at loop entry, in a @cite{Loop_Invariant} pragma.
10276 The effect of using @cite{X'Loop_Entry} is the same as declaring
10277 a constant initialized with the initial value of @cite{X} at loop
10278 entry. This copy is not performed if the loop is not entered, or if the
10279 corresponding pragmas are ignored or disabled.
10281 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10282 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{17a}
10283 @section Attribute Machine_Size
10286 @geindex Machine_Size
10288 This attribute is identical to the @cite{Object_Size} attribute.  It is
10289 provided for compatibility with the DEC Ada 83 attribute of this name.
10291 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10292 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{17b}
10293 @section Attribute Mantissa
10296 @geindex Ada 83 attributes
10298 @geindex Mantissa
10300 The @cite{Mantissa} attribute is provided for compatibility with Ada 83.  See
10301 the Ada 83 reference manual for an exact description of the semantics of
10302 this attribute.
10304 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10305 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{17c}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{17d}
10306 @section Attribute Maximum_Alignment
10309 @geindex Alignment
10310 @geindex maximum
10312 @geindex Maximum_Alignment
10314 @cite{Standard'Maximum_Alignment} (@cite{Standard} is the only
10315 permissible prefix) provides the maximum useful alignment value for the
10316 target.  This is a static value that can be used to specify the alignment
10317 for an object, guaranteeing that it is properly aligned in all
10318 cases.
10320 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10321 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{17e}
10322 @section Attribute Mechanism_Code
10325 @geindex Return values
10326 @geindex passing mechanism
10328 @geindex Parameters
10329 @geindex passing mechanism
10331 @geindex Mechanism_Code
10333 @code{function'Mechanism_Code} yields an integer code for the
10334 mechanism used for the result of function, and
10335 @code{subprogram'Mechanism_Code (n)} yields the mechanism
10336 used for formal parameter number @cite{n} (a static integer value with 1
10337 meaning the first parameter) of @cite{subprogram}.  The code returned is:
10340 @table @asis
10342 @item @emph{1}
10344 by copy (value)
10346 @item @emph{2}
10348 by reference
10349 @end table
10351 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
10352 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{17f}
10353 @section Attribute Null_Parameter
10356 @geindex Zero address
10357 @geindex passing
10359 @geindex Null_Parameter
10361 A reference @code{T'Null_Parameter} denotes an imaginary object of
10362 type or subtype @cite{T} allocated at machine address zero.  The attribute
10363 is allowed only as the default expression of a formal parameter, or as
10364 an actual expression of a subprogram call.  In either case, the
10365 subprogram must be imported.
10367 The identity of the object is represented by the address zero in the
10368 argument list, independent of the passing mechanism (explicit or
10369 default).
10371 This capability is needed to specify that a zero address should be
10372 passed for a record or other composite object passed by reference.
10373 There is no way of indicating this without the @cite{Null_Parameter}
10374 attribute.
10376 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10377 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{134}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{180}
10378 @section Attribute Object_Size
10381 @geindex Size
10382 @geindex used for objects
10384 @geindex Object_Size
10386 The size of an object is not necessarily the same as the size of the type
10387 of an object.  This is because by default object sizes are increased to be
10388 a multiple of the alignment of the object.  For example,
10389 @cite{Natural'Size} is
10390 31, but by default objects of type @cite{Natural} will have a size of 32 bits.
10391 Similarly, a record containing an integer and a character:
10393 @example
10394 type Rec is record
10395    I : Integer;
10396    C : Character;
10397 end record;
10398 @end example
10400 will have a size of 40 (that is @cite{Rec'Size} will be 40).  The
10401 alignment will be 4, because of the
10402 integer field, and so the default size of record objects for this type
10403 will be 64 (8 bytes).
10405 If the alignment of the above record is specified to be 1, then the
10406 object size will be 40 (5 bytes). This is true by default, and also
10407 an object size of 40 can be explicitly specified in this case.
10409 A consequence of this capability is that different object sizes can be
10410 given to subtypes that would otherwise be considered in Ada to be
10411 statically matching.  But it makes no sense to consider such subtypes
10412 as statically matching.  Consequently, in @cite{GNAT} we add a rule
10413 to the static matching rules that requires object sizes to match.
10414 Consider this example:
10416 @example
10417  1. procedure BadAVConvert is
10418  2.    type R is new Integer;
10419  3.    subtype R1 is R range 1 .. 10;
10420  4.    subtype R2 is R range 1 .. 10;
10421  5.    for R1'Object_Size use 8;
10422  6.    for R2'Object_Size use 16;
10423  7.    type R1P is access all R1;
10424  8.    type R2P is access all R2;
10425  9.    R1PV : R1P := new R1'(4);
10426 10.    R2PV : R2P;
10427 11. begin
10428 12.    R2PV := R2P (R1PV);
10429                |
10430        >>> target designated subtype not compatible with
10431            type "R1" defined at line 3
10433 13. end;
10434 @end example
10436 In the absence of lines 5 and 6,
10437 types @cite{R1} and @cite{R2} statically match and
10438 hence the conversion on line 12 is legal. But since lines 5 and 6
10439 cause the object sizes to differ, @cite{GNAT} considers that types
10440 @cite{R1} and @cite{R2} are not statically matching, and line 12
10441 generates the diagnostic shown above.
10443 Similar additional checks are performed in other contexts requiring
10444 statically matching subtypes.
10446 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
10447 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{181}
10448 @section Attribute Old
10451 @geindex Old
10453 In addition to the usage of @cite{Old} defined in the Ada 2012 RM (usage
10454 within @cite{Post} aspect), GNAT also permits the use of this attribute
10455 in implementation defined pragmas @cite{Postcondition},
10456 @cite{Contract_Cases} and @cite{Test_Case}. Also usages of
10457 @cite{Old} which would be illegal according to the Ada 2012 RM
10458 definition are allowed under control of
10459 implementation defined pragma @cite{Unevaluated_Use_Of_Old}.
10461 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
10462 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{182}
10463 @section Attribute Passed_By_Reference
10466 @geindex Parameters
10467 @geindex when passed by reference
10469 @geindex Passed_By_Reference
10471 @code{type'Passed_By_Reference} for any subtype @cite{type} returns
10472 a value of type @cite{Boolean} value that is @cite{True} if the type is
10473 normally passed by reference and @cite{False} if the type is normally
10474 passed by copy in calls.  For scalar types, the result is always @cite{False}
10475 and is static.  For non-scalar types, the result is nonstatic.
10477 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
10478 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{183}
10479 @section Attribute Pool_Address
10482 @geindex Parameters
10483 @geindex when passed by reference
10485 @geindex Pool_Address
10487 @code{X'Pool_Address} for any object @cite{X} returns the address
10488 of X within its storage pool. This is the same as
10489 @code{X'Address}, except that for an unconstrained array whose
10490 bounds are allocated just before the first component,
10491 @code{X'Pool_Address} returns the address of those bounds,
10492 whereas @code{X'Address} returns the address of the first
10493 component.
10495 Here, we are interpreting 'storage pool' broadly to mean
10496 @code{wherever the object is allocated}, which could be a
10497 user-defined storage pool,
10498 the global heap, on the stack, or in a static memory area.
10499 For an object created by @cite{new}, @code{Ptr.all'Pool_Address} is
10500 what is passed to @cite{Allocate} and returned from @cite{Deallocate}.
10502 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
10503 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{184}
10504 @section Attribute Range_Length
10507 @geindex Range_Length
10509 @code{type'Range_Length} for any discrete type @cite{type} yields
10510 the number of values represented by the subtype (zero for a null
10511 range).  The result is static for static subtypes.  @cite{Range_Length}
10512 applied to the index subtype of a one dimensional array always gives the
10513 same result as @cite{Length} applied to the array itself.
10515 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
10516 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{185}
10517 @section Attribute Restriction_Set
10520 @geindex Restriction_Set
10522 @geindex Restrictions
10524 This attribute allows compile time testing of restrictions that
10525 are currently in effect. It is primarily intended for specializing
10526 code in the run-time based on restrictions that are active (e.g.
10527 don't need to save fpt registers if restriction No_Floating_Point
10528 is known to be in effect), but can be used anywhere.
10530 There are two forms:
10532 @example
10533 System'Restriction_Set (partition_boolean_restriction_NAME)
10534 System'Restriction_Set (No_Dependence => library_unit_NAME);
10535 @end example
10537 In the case of the first form, the only restriction names
10538 allowed are parameterless restrictions that are checked
10539 for consistency at bind time. For a complete list see the
10540 subtype @cite{System.Rident.Partition_Boolean_Restrictions}.
10542 The result returned is True if the restriction is known to
10543 be in effect, and False if the restriction is known not to
10544 be in effect. An important guarantee is that the value of
10545 a Restriction_Set attribute is known to be consistent throughout
10546 all the code of a partition.
10548 This is trivially achieved if the entire partition is compiled
10549 with a consistent set of restriction pragmas. However, the
10550 compilation model does not require this. It is possible to
10551 compile one set of units with one set of pragmas, and another
10552 set of units with another set of pragmas. It is even possible
10553 to compile a spec with one set of pragmas, and then WITH the
10554 same spec with a different set of pragmas. Inconsistencies
10555 in the actual use of the restriction are checked at bind time.
10557 In order to achieve the guarantee of consistency for the
10558 Restriction_Set pragma, we consider that a use of the pragma
10559 that yields False is equivalent to a violation of the
10560 restriction.
10562 So for example if you write
10564 @example
10565 if System'Restriction_Set (No_Floating_Point) then
10566    ...
10567 else
10568    ...
10569 end if;
10570 @end example
10572 And the result is False, so that the else branch is executed,
10573 you can assume that this restriction is not set for any unit
10574 in the partition. This is checked by considering this use of
10575 the restriction pragma to be a violation of the restriction
10576 No_Floating_Point. This means that no other unit can attempt
10577 to set this restriction (if some unit does attempt to set it,
10578 the binder will refuse to bind the partition).
10580 Technical note: The restriction name and the unit name are
10581 intepreted entirely syntactically, as in the corresponding
10582 Restrictions pragma, they are not analyzed semantically,
10583 so they do not have a type.
10585 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
10586 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{186}
10587 @section Attribute Result
10590 @geindex Result
10592 @code{function'Result} can only be used with in a Postcondition pragma
10593 for a function. The prefix must be the name of the corresponding function. This
10594 is used to refer to the result of the function in the postcondition expression.
10595 For a further discussion of the use of this attribute and examples of its use,
10596 see the description of pragma Postcondition.
10598 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
10599 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{187}
10600 @section Attribute Safe_Emax
10603 @geindex Ada 83 attributes
10605 @geindex Safe_Emax
10607 The @cite{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
10608 the Ada 83 reference manual for an exact description of the semantics of
10609 this attribute.
10611 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
10612 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{188}
10613 @section Attribute Safe_Large
10616 @geindex Ada 83 attributes
10618 @geindex Safe_Large
10620 The @cite{Safe_Large} attribute is provided for compatibility with Ada 83.  See
10621 the Ada 83 reference manual for an exact description of the semantics of
10622 this attribute.
10624 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
10625 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{189}
10626 @section Attribute Safe_Small
10629 @geindex Ada 83 attributes
10631 @geindex Safe_Small
10633 The @cite{Safe_Small} attribute is provided for compatibility with Ada 83.  See
10634 the Ada 83 reference manual for an exact description of the semantics of
10635 this attribute.
10637 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
10638 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{18a}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{140}
10639 @section Attribute Scalar_Storage_Order
10642 @geindex Endianness
10644 @geindex Scalar storage order
10646 @geindex Scalar_Storage_Order
10648 For every array or record type @cite{S}, the representation attribute
10649 @cite{Scalar_Storage_Order} denotes the order in which storage elements
10650 that make up scalar components are ordered within S. The value given must
10651 be a static expression of type System.Bit_Order. The following is an example
10652 of the use of this feature:
10654 @example
10655 --  Component type definitions
10657 subtype Yr_Type is Natural range 0 .. 127;
10658 subtype Mo_Type is Natural range 1 .. 12;
10659 subtype Da_Type is Natural range 1 .. 31;
10661 --  Record declaration
10663 type Date is record
10664    Years_Since_1980 : Yr_Type;
10665    Month            : Mo_Type;
10666    Day_Of_Month     : Da_Type;
10667 end record;
10669 --  Record representation clause
10671 for Date use record
10672    Years_Since_1980 at 0 range 0  ..  6;
10673    Month            at 0 range 7  .. 10;
10674    Day_Of_Month     at 0 range 11 .. 15;
10675 end record;
10677 --  Attribute definition clauses
10679 for Date'Bit_Order use System.High_Order_First;
10680 for Date'Scalar_Storage_Order use System.High_Order_First;
10681 --  If Scalar_Storage_Order is specified, it must be consistent with
10682 --  Bit_Order, so it's best to always define the latter explicitly if
10683 --  the former is used.
10684 @end example
10686 Other properties are as for standard representation attribute @cite{Bit_Order},
10687 as defined by Ada RM 13.5.3(4). The default is @cite{System.Default_Bit_Order}.
10689 For a record type @cite{T}, if @code{T'Scalar_Storage_Order} is
10690 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
10691 this means that if a @cite{Scalar_Storage_Order} attribute definition
10692 clause is not confirming, then the type's @cite{Bit_Order} shall be
10693 specified explicitly and set to the same value.
10695 Derived types inherit an explicitly set scalar storage order from their parent
10696 types. This may be overridden for the derived type by giving an explicit scalar
10697 storage order for the derived type. For a record extension, the derived type
10698 must have the same scalar storage order as the parent type.
10700 A component of a record or array type that is a bit-packed array, or that
10701 does not start on a byte boundary, must have the same scalar storage order
10702 as the enclosing record or array type.
10704 No component of a type that has an explicit @cite{Scalar_Storage_Order}
10705 attribute definition may be aliased.
10707 A confirming @cite{Scalar_Storage_Order} attribute definition clause (i.e.
10708 with a value equal to @cite{System.Default_Bit_Order}) has no effect.
10710 If the opposite storage order is specified, then whenever the value of
10711 a scalar component of an object of type @cite{S} is read, the storage
10712 elements of the enclosing machine scalar are first reversed (before
10713 retrieving the component value, possibly applying some shift and mask
10714 operatings on the enclosing machine scalar), and the opposite operation
10715 is done for writes.
10717 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
10718 are relaxed. Instead, the following rules apply:
10721 @itemize *
10723 @item 
10724 the underlying storage elements are those at positions
10725 @cite{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
10727 @item 
10728 the sequence of underlying storage elements shall have
10729 a size no greater than the largest machine scalar
10731 @item 
10732 the enclosing machine scalar is defined as the smallest machine
10733 scalar starting at a position no greater than
10734 @cite{position + first_bit / storage_element_size} and covering
10735 storage elements at least up to @cite{position + (last_bit + storage_element_size - 1) / storage_element_size}
10737 @item 
10738 the position of the component is interpreted relative to that machine
10739 scalar.
10740 @end itemize
10742 If no scalar storage order is specified for a type (either directly, or by
10743 inheritance in the case of a derived type), then the default is normally
10744 the native ordering of the target, but this default can be overridden using
10745 pragma @cite{Default_Scalar_Storage_Order}.
10747 Note that if a component of @cite{T} is itself of a record or array type,
10748 the specfied @cite{Scalar_Storage_Order} does @emph{not} apply to that nested type:
10749 an explicit attribute definition clause must be provided for the component
10750 type as well if desired.
10752 Note that the scalar storage order only affects the in-memory data
10753 representation. It has no effect on the representation used by stream
10754 attributes.
10756 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
10757 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{da}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{18b}
10758 @section Attribute Simple_Storage_Pool
10761 @geindex Storage pool
10762 @geindex simple
10764 @geindex Simple storage pool
10766 @geindex Simple_Storage_Pool
10768 For every nonformal, nonderived access-to-object type @cite{Acc}, the
10769 representation attribute @cite{Simple_Storage_Pool} may be specified
10770 via an attribute_definition_clause (or by specifying the equivalent aspect):
10772 @example
10773 My_Pool : My_Simple_Storage_Pool_Type;
10775 type Acc is access My_Data_Type;
10777 for Acc'Simple_Storage_Pool use My_Pool;
10778 @end example
10780 The name given in an attribute_definition_clause for the
10781 @cite{Simple_Storage_Pool} attribute shall denote a variable of
10782 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
10784 The use of this attribute is only allowed for a prefix denoting a type
10785 for which it has been specified. The type of the attribute is the type
10786 of the variable specified as the simple storage pool of the access type,
10787 and the attribute denotes that variable.
10789 It is illegal to specify both @cite{Storage_Pool} and @cite{Simple_Storage_Pool}
10790 for the same access type.
10792 If the @cite{Simple_Storage_Pool} attribute has been specified for an access
10793 type, then applying the @cite{Storage_Pool} attribute to the type is flagged
10794 with a warning and its evaluation raises the exception @cite{Program_Error}.
10796 If the Simple_Storage_Pool attribute has been specified for an access
10797 type @cite{S}, then the evaluation of the attribute @code{S'Storage_Size}
10798 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
10799 which is intended to indicate the number of storage elements reserved for
10800 the simple storage pool. If the Storage_Size function has not been defined
10801 for the simple storage pool type, then this attribute returns zero.
10803 If an access type @cite{S} has a specified simple storage pool of type
10804 @cite{SSP}, then the evaluation of an allocator for that access type calls
10805 the primitive @cite{Allocate} procedure for type @cite{SSP}, passing
10806 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
10807 semantics of such allocators is the same as those defined for allocators
10808 in section 13.11 of the @cite{Ada Reference Manual}, with the term
10809 @cite{simple storage pool} substituted for @cite{storage pool}.
10811 If an access type @cite{S} has a specified simple storage pool of type
10812 @cite{SSP}, then a call to an instance of the @cite{Ada.Unchecked_Deallocation}
10813 for that access type invokes the primitive @cite{Deallocate} procedure
10814 for type @cite{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
10815 parameter. The detailed semantics of such unchecked deallocations is the same
10816 as defined in section 13.11.2 of the Ada Reference Manual, except that the
10817 term 'simple storage pool' is substituted for 'storage pool'.
10819 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
10820 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{18c}
10821 @section Attribute Small
10824 @geindex Ada 83 attributes
10826 @geindex Small
10828 The @cite{Small} attribute is defined in Ada 95 (and Ada 2005) only for
10829 fixed-point types.
10830 GNAT also allows this attribute to be applied to floating-point types
10831 for compatibility with Ada 83.  See
10832 the Ada 83 reference manual for an exact description of the semantics of
10833 this attribute when applied to floating-point types.
10835 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
10836 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{18d}
10837 @section Attribute Storage_Unit
10840 @geindex Storage_Unit
10842 @cite{Standard'Storage_Unit} (@cite{Standard} is the only permissible
10843 prefix) provides the same value as @cite{System.Storage_Unit}.
10845 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
10846 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{18e}
10847 @section Attribute Stub_Type
10850 @geindex Stub_Type
10852 The GNAT implementation of remote access-to-classwide types is
10853 organized as described in AARM section E.4 (20.t): a value of an RACW type
10854 (designating a remote object) is represented as a normal access
10855 value, pointing to a "stub" object which in turn contains the
10856 necessary information to contact the designated remote object. A
10857 call on any dispatching operation of such a stub object does the
10858 remote call, if necessary, using the information in the stub object
10859 to locate the target partition, etc.
10861 For a prefix @cite{T} that denotes a remote access-to-classwide type,
10862 @cite{T'Stub_Type} denotes the type of the corresponding stub objects.
10864 By construction, the layout of @cite{T'Stub_Type} is identical to that of
10865 type @cite{RACW_Stub_Type} declared in the internal implementation-defined
10866 unit @cite{System.Partition_Interface}. Use of this attribute will create
10867 an implicit dependency on this unit.
10869 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
10870 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{18f}
10871 @section Attribute System_Allocator_Alignment
10874 @geindex Alignment
10875 @geindex allocator
10877 @geindex System_Allocator_Alignment
10879 @cite{Standard'System_Allocator_Alignment} (@cite{Standard} is the only
10880 permissible prefix) provides the observable guaranted to be honored by
10881 the system allocator (malloc). This is a static value that can be used
10882 in user storage pools based on malloc either to reject allocation
10883 with alignment too large or to enable a realignment circuitry if the
10884 alignment request is larger than this value.
10886 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
10887 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{190}
10888 @section Attribute Target_Name
10891 @geindex Target_Name
10893 @cite{Standard'Target_Name} (@cite{Standard} is the only permissible
10894 prefix) provides a static string value that identifies the target
10895 for the current compilation. For GCC implementations, this is the
10896 standard gcc target name without the terminating slash (for
10897 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
10899 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
10900 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{191}
10901 @section Attribute To_Address
10904 @geindex To_Address
10906 The @cite{System'To_Address}
10907 (@cite{System} is the only permissible prefix)
10908 denotes a function identical to
10909 @cite{System.Storage_Elements.To_Address} except that
10910 it is a static attribute.  This means that if its argument is
10911 a static expression, then the result of the attribute is a
10912 static expression.  This means that such an expression can be
10913 used in contexts (e.g., preelaborable packages) which require a
10914 static expression and where the function call could not be used
10915 (since the function call is always nonstatic, even if its
10916 argument is static). The argument must be in the range
10917 -(2**(m-1) .. 2**m-1, where m is the memory size
10918 (typically 32 or 64). Negative values are intepreted in a
10919 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
10920 a 32 bits machine).
10922 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
10923 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{192}
10924 @section Attribute To_Any
10927 @geindex To_Any
10929 This internal attribute is used for the generation of remote subprogram
10930 stubs in the context of the Distributed Systems Annex.
10932 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
10933 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{193}
10934 @section Attribute Type_Class
10937 @geindex Type_Class
10939 @code{type'Type_Class} for any type or subtype @cite{type} yields
10940 the value of the type class for the full type of @cite{type}.  If
10941 @cite{type} is a generic formal type, the value is the value for the
10942 corresponding actual subtype.  The value of this attribute is of type
10943 @code{System.Aux_DEC.Type_Class}, which has the following definition:
10945 @example
10946 type Type_Class is
10947   (Type_Class_Enumeration,
10948    Type_Class_Integer,
10949    Type_Class_Fixed_Point,
10950    Type_Class_Floating_Point,
10951    Type_Class_Array,
10952    Type_Class_Record,
10953    Type_Class_Access,
10954    Type_Class_Task,
10955    Type_Class_Address);
10956 @end example
10958 Protected types yield the value @cite{Type_Class_Task}, which thus
10959 applies to all concurrent types.  This attribute is designed to
10960 be compatible with the DEC Ada 83 attribute of the same name.
10962 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
10963 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{194}
10964 @section Attribute Type_Key
10967 @geindex Type_Key
10969 The @cite{Type_Key} attribute is applicable to a type or subtype and
10970 yields a value of type Standard.String containing encoded information
10971 about the type or subtype. This provides improved compatibility with
10972 other implementations that support this attribute.
10974 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
10975 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{195}
10976 @section Attribute TypeCode
10979 @geindex TypeCode
10981 This internal attribute is used for the generation of remote subprogram
10982 stubs in the context of the Distributed Systems Annex.
10984 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
10985 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{196}
10986 @section Attribute Unconstrained_Array
10989 @geindex Unconstrained_Array
10991 The @cite{Unconstrained_Array} attribute can be used with a prefix that
10992 denotes any type or subtype. It is a static attribute that yields
10993 @cite{True} if the prefix designates an unconstrained array,
10994 and @cite{False} otherwise. In a generic instance, the result is
10995 still static, and yields the result of applying this test to the
10996 generic actual.
10998 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
10999 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{197}
11000 @section Attribute Universal_Literal_String
11003 @geindex Named numbers
11004 @geindex representation of
11006 @geindex Universal_Literal_String
11008 The prefix of @cite{Universal_Literal_String} must be a named
11009 number.  The static result is the string consisting of the characters of
11010 the number as defined in the original source.  This allows the user
11011 program to access the actual text of named numbers without intermediate
11012 conversions and without the need to enclose the strings in quotes (which
11013 would preclude their use as numbers).
11015 For example, the following program prints the first 50 digits of pi:
11017 @example
11018 with Text_IO; use Text_IO;
11019 with Ada.Numerics;
11020 procedure Pi is
11021 begin
11022    Put (Ada.Numerics.Pi'Universal_Literal_String);
11023 end;
11024 @end example
11026 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11027 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{198}
11028 @section Attribute Unrestricted_Access
11031 @geindex Access
11032 @geindex unrestricted
11034 @geindex Unrestricted_Access
11036 The @cite{Unrestricted_Access} attribute is similar to @cite{Access}
11037 except that all accessibility and aliased view checks are omitted.  This
11038 is a user-beware attribute.
11040 For objects, it is similar to @cite{Address}, for which it is a
11041 desirable replacement where the value desired is an access type.
11042 In other words, its effect is similar to first applying the
11043 @cite{Address} attribute and then doing an unchecked conversion to a
11044 desired access type.
11046 For subprograms, @cite{P'Unrestricted_Access} may be used where
11047 @cite{P'Access} would be illegal, to construct a value of a
11048 less-nested named access type that designates a more-nested
11049 subprogram. This value may be used in indirect calls, so long as the
11050 more-nested subprogram still exists; once the subprogram containing it
11051 has returned, such calls are erroneous. For example:
11053 @example
11054 package body P is
11056    type Less_Nested is not null access procedure;
11057    Global : Less_Nested;
11059    procedure P1 is
11060    begin
11061       Global.all;
11062    end P1;
11064    procedure P2 is
11065       Local_Var : Integer;
11067       procedure More_Nested is
11068       begin
11069          ... Local_Var ...
11070       end More_Nested;
11071    begin
11072       Global := More_Nested'Unrestricted_Access;
11073       P1;
11074    end P2;
11076 end P;
11077 @end example
11079 When P1 is called from P2, the call via Global is OK, but if P1 were
11080 called after P2 returns, it would be an erroneous use of a dangling
11081 pointer.
11083 For objects, it is possible to use @cite{Unrestricted_Access} for any
11084 type. However, if the result is of an access-to-unconstrained array
11085 subtype, then the resulting pointer has the same scope as the context
11086 of the attribute, and must not be returned to some enclosing scope.
11087 For instance, if a function uses @cite{Unrestricted_Access} to create
11088 an access-to-unconstrained-array and returns that value to the caller,
11089 the result will involve dangling pointers. In addition, it is only
11090 valid to create pointers to unconstrained arrays using this attribute
11091 if the pointer has the normal default 'fat' representation where a
11092 pointer has two components, one points to the array and one points to
11093 the bounds. If a size clause is used to force 'thin' representation
11094 for a pointer to unconstrained where there is only space for a single
11095 pointer, then the resulting pointer is not usable.
11097 In the simple case where a direct use of Unrestricted_Access attempts
11098 to make a thin pointer for a non-aliased object, the compiler will
11099 reject the use as illegal, as shown in the following example:
11101 @example
11102 with System; use System;
11103 procedure SliceUA2 is
11104    type A is access all String;
11105    for A'Size use Standard'Address_Size;
11107    procedure P (Arg : A) is
11108    begin
11109       null;
11110    end P;
11112    X : String := "hello world!";
11113    X2 : aliased String := "hello world!";
11115    AV : A := X'Unrestricted_Access;    -- ERROR
11116              |
11117 >>> illegal use of Unrestricted_Access attribute
11118 >>> attempt to generate thin pointer to unaliased object
11120 begin
11121    P (X'Unrestricted_Access);          -- ERROR
11122       |
11123 >>> illegal use of Unrestricted_Access attribute
11124 >>> attempt to generate thin pointer to unaliased object
11126    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11127       |
11128 >>> illegal use of Unrestricted_Access attribute
11129 >>> attempt to generate thin pointer to unaliased object
11131    P (X2'Unrestricted_Access);         -- OK
11132 end;
11133 @end example
11135 but other cases cannot be detected by the compiler, and are
11136 considered to be erroneous. Consider the following example:
11138 @example
11139 with System; use System;
11140 with System; use System;
11141 procedure SliceUA is
11142    type AF is access all String;
11144    type A is access all String;
11145    for A'Size use Standard'Address_Size;
11147    procedure P (Arg : A) is
11148    begin
11149       if Arg'Length /= 6 then
11150          raise Program_Error;
11151       end if;
11152    end P;
11154    X : String := "hello world!";
11155    Y : AF := X (7 .. 12)'Unrestricted_Access;
11157 begin
11158    P (A (Y));
11159 end;
11160 @end example
11162 A normal unconstrained array value
11163 or a constrained array object marked as aliased has the bounds in memory
11164 just before the array, so a thin pointer can retrieve both the data and
11165 the bounds.  But in this case, the non-aliased object @cite{X} does not have the
11166 bounds before the string.  If the size clause for type @cite{A}
11167 were not present, then the pointer
11168 would be a fat pointer, where one component is a pointer to the bounds,
11169 and all would be well.  But with the size clause present, the conversion from
11170 fat pointer to thin pointer in the call loses the bounds, and so this
11171 is erroneous, and the program likely raises a @cite{Program_Error} exception.
11173 In general, it is advisable to completely
11174 avoid mixing the use of thin pointers and the use of
11175 @cite{Unrestricted_Access} where the designated type is an
11176 unconstrained array.  The use of thin pointers should be restricted to
11177 cases of porting legacy code that implicitly assumes the size of pointers,
11178 and such code should not in any case be using this attribute.
11180 Another erroneous situation arises if the attribute is
11181 applied to a constant. The resulting pointer can be used to access the
11182 constant, but the effect of trying to modify a constant in this manner
11183 is not well-defined. Consider this example:
11185 @example
11186 P : constant Integer := 4;
11187 type R is access all Integer;
11188 RV : R := P'Unrestricted_Access;
11190 RV.all := 3;
11191 @end example
11193 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11194 or may not notice this attempt, and subsequent references to P may yield
11195 either the value 3 or the value 4 or the assignment may blow up if the
11196 compiler decides to put P in read-only memory. One particular case where
11197 @cite{Unrestricted_Access} can be used in this way is to modify the
11198 value of an @cite{IN} parameter:
11200 @example
11201 procedure K (S : in String) is
11202    type R is access all Character;
11203    RV : R := S (3)'Unrestricted_Access;
11204 begin
11205    RV.all := 'a';
11206 end;
11207 @end example
11209 In general this is a risky approach. It may appear to "work" but such uses of
11210 @cite{Unrestricted_Access} are potentially non-portable, even from one version
11211 of @cite{GNAT} to another, so are best avoided if possible.
11213 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11214 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{199}
11215 @section Attribute Update
11218 @geindex Update
11220 The @cite{Update} attribute creates a copy of an array or record value
11221 with one or more modified components. The syntax is:
11223 @example
11224 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11225 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11226 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11227                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11229 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11230 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11231 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
11232 @end example
11234 where @cite{PREFIX} is the name of an array or record object, the
11235 association list in parentheses does not contain an @cite{others}
11236 choice and the box symbol @cite{<>} may not appear in any
11237 expression. The effect is to yield a copy of the array or record value
11238 which is unchanged apart from the components mentioned in the
11239 association list, which are changed to the indicated value. The
11240 original value of the array or record value is not affected. For
11241 example:
11243 @example
11244 type Arr is Array (1 .. 5) of Integer;
11246 Avar1 : Arr := (1,2,3,4,5);
11247 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11248 @end example
11250 yields a value for @cite{Avar2} of 1,10,20,20,5 with @cite{Avar1}
11251 begin unmodified. Similarly:
11253 @example
11254 type Rec is A, B, C : Integer;
11256 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11257 Rvar2 : Rec := Rvar1'Update (B => 20);
11258 @end example
11260 yields a value for @cite{Rvar2} of (A => 1, B => 20, C => 3),
11261 with @cite{Rvar1} being unmodifed.
11262 Note that the value of the attribute reference is computed
11263 completely before it is used. This means that if you write:
11265 @example
11266 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11267 @end example
11269 then the value of @cite{Avar1} is not modified if @cite{Function_Call}
11270 raises an exception, unlike the effect of a series of direct assignments
11271 to elements of @cite{Avar1}. In general this requires that
11272 two extra complete copies of the object are required, which should be
11273 kept in mind when considering efficiency.
11275 The @cite{Update} attribute cannot be applied to prefixes of a limited
11276 type, and cannot reference discriminants in the case of a record type.
11277 The accessibility level of an Update attribute result object is defined
11278 as for an aggregate.
11280 In the record case, no component can be mentioned more than once. In
11281 the array case, two overlapping ranges can appear in the association list,
11282 in which case the modifications are processed left to right.
11284 Multi-dimensional arrays can be modified, as shown by this example:
11286 @example
11287 A : array (1 .. 10, 1 .. 10) of Integer;
11289 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11290 @end example
11292 which changes element (1,2) to 20 and (3,4) to 30.
11294 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11295 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{19a}
11296 @section Attribute Valid_Scalars
11299 @geindex Valid_Scalars
11301 The @cite{'Valid_Scalars} attribute is intended to make it easier to
11302 check the validity of scalar subcomponents of composite objects. It
11303 is defined for any prefix @cite{X} that denotes an object.
11304 The value of this attribute is of the predefined type Boolean.
11305 @cite{X'Valid_Scalars} yields True if and only if evaluation of
11306 @cite{P'Valid} yields True for every scalar part P of X or if X has
11307 no scalar parts. It is not specified in what order the scalar parts
11308 are checked, nor whether any more are checked after any one of them
11309 is determined to be invalid. If the prefix @cite{X} is of a class-wide
11310 type @cite{T'Class} (where @cite{T} is the associated specific type),
11311 or if the prefix @cite{X} is of a specific tagged type @cite{T}, then
11312 only the scalar parts of components of @cite{T} are traversed; in other
11313 words, components of extensions of @cite{T} are not traversed even if
11314 @cite{T'Class (X)'Tag /= T'Tag} . The compiler will issue a warning if it can
11315 be determined at compile time that the prefix of the attribute has no
11316 scalar parts (e.g., if the prefix is of an access type, an interface type,
11317 an undiscriminated task type, or an undiscriminated protected type).
11319 For scalar types, @cite{Valid_Scalars} is equivalent to @cite{Valid}. The use
11320 of this attribute is not permitted for @cite{Unchecked_Union} types for which
11321 in general it is not possible to determine the values of the discriminants.
11323 Note: @cite{Valid_Scalars} can generate a lot of code, especially in the case
11324 of a large variant record. If the attribute is called in many places in the
11325 same program applied to objects of the same type, it can reduce program size
11326 to write a function with a single use of the attribute, and then call that
11327 function from multiple places.
11329 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11330 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{19b}
11331 @section Attribute VADS_Size
11334 @geindex Size
11335 @geindex VADS compatibility
11337 @geindex VADS_Size
11339 The @cite{'VADS_Size} attribute is intended to make it easier to port
11340 legacy code which relies on the semantics of @cite{'Size} as implemented
11341 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
11342 same semantic interpretation.  In particular, @cite{'VADS_Size} applied
11343 to a predefined or other primitive type with no Size clause yields the
11344 Object_Size (for example, @cite{Natural'Size} is 32 rather than 31 on
11345 typical machines).  In addition @cite{'VADS_Size} applied to an object
11346 gives the result that would be obtained by applying the attribute to
11347 the corresponding type.
11349 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11350 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{19c}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{14f}
11351 @section Attribute Value_Size
11354 @geindex Size
11355 @geindex setting for not-first subtype
11357 @geindex Value_Size
11359 @code{type'Value_Size} is the number of bits required to represent
11360 a value of the given subtype.  It is the same as @code{type'Size},
11361 but, unlike @cite{Size}, may be set for non-first subtypes.
11363 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11364 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{19d}
11365 @section Attribute Wchar_T_Size
11368 @geindex Wchar_T_Size
11370 @cite{Standard'Wchar_T_Size} (@cite{Standard} is the only permissible
11371 prefix) provides the size in bits of the C @cite{wchar_t} type
11372 primarily for constructing the definition of this type in
11373 package @cite{Interfaces.C}. The result is a static constant.
11375 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
11376 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{19e}
11377 @section Attribute Word_Size
11380 @geindex Word_Size
11382 @cite{Standard'Word_Size} (@cite{Standard} is the only permissible
11383 prefix) provides the value @cite{System.Word_Size}. The result is
11384 a static constant.
11386 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
11387 @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{19f}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1a0}
11388 @chapter Standard and Implementation Defined Restrictions
11391 All Ada Reference Manual-defined Restriction identifiers are implemented:
11394 @itemize *
11396 @item 
11397 language-defined restrictions (see 13.12.1)
11399 @item 
11400 tasking restrictions (see D.7)
11402 @item 
11403 high integrity restrictions (see H.4)
11404 @end itemize
11406 GNAT implements additional restriction identifiers. All restrictions, whether
11407 language defined or GNAT-specific, are listed in the following.
11409 @menu
11410 * Partition-Wide Restrictions:: 
11411 * Program Unit Level Restrictions:: 
11413 @end menu
11415 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
11416 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1a1}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1a2}
11417 @section Partition-Wide Restrictions
11420 There are two separate lists of restriction identifiers. The first
11421 set requires consistency throughout a partition (in other words, if the
11422 restriction identifier is used for any compilation unit in the partition,
11423 then all compilation units in the partition must obey the restriction).
11425 @menu
11426 * Immediate_Reclamation:: 
11427 * Max_Asynchronous_Select_Nesting:: 
11428 * Max_Entry_Queue_Length:: 
11429 * Max_Protected_Entries:: 
11430 * Max_Select_Alternatives:: 
11431 * Max_Storage_At_Blocking:: 
11432 * Max_Task_Entries:: 
11433 * Max_Tasks:: 
11434 * No_Abort_Statements:: 
11435 * No_Access_Parameter_Allocators:: 
11436 * No_Access_Subprograms:: 
11437 * No_Allocators:: 
11438 * No_Anonymous_Allocators:: 
11439 * No_Asynchronous_Control:: 
11440 * No_Calendar:: 
11441 * No_Coextensions:: 
11442 * No_Default_Initialization:: 
11443 * No_Delay:: 
11444 * No_Dependence:: 
11445 * No_Direct_Boolean_Operators:: 
11446 * No_Dispatch:: 
11447 * No_Dispatching_Calls:: 
11448 * No_Dynamic_Attachment:: 
11449 * No_Dynamic_Priorities:: 
11450 * No_Entry_Calls_In_Elaboration_Code:: 
11451 * No_Enumeration_Maps:: 
11452 * No_Exception_Handlers:: 
11453 * No_Exception_Propagation:: 
11454 * No_Exception_Registration:: 
11455 * No_Exceptions:: 
11456 * No_Finalization:: 
11457 * No_Fixed_Point:: 
11458 * No_Floating_Point:: 
11459 * No_Implicit_Conditionals:: 
11460 * No_Implicit_Dynamic_Code:: 
11461 * No_Implicit_Heap_Allocations:: 
11462 * No_Implicit_Protected_Object_Allocations:: 
11463 * No_Implicit_Task_Allocations:: 
11464 * No_Initialize_Scalars:: 
11465 * No_IO:: 
11466 * No_Local_Allocators:: 
11467 * No_Local_Protected_Objects:: 
11468 * No_Local_Timing_Events:: 
11469 * No_Long_Long_Integers:: 
11470 * No_Multiple_Elaboration:: 
11471 * No_Nested_Finalization:: 
11472 * No_Protected_Type_Allocators:: 
11473 * No_Protected_Types:: 
11474 * No_Recursion:: 
11475 * No_Reentrancy:: 
11476 * No_Relative_Delay:: 
11477 * No_Requeue_Statements:: 
11478 * No_Secondary_Stack:: 
11479 * No_Select_Statements:: 
11480 * No_Specific_Termination_Handlers:: 
11481 * No_Specification_of_Aspect:: 
11482 * No_Standard_Allocators_After_Elaboration:: 
11483 * No_Standard_Storage_Pools:: 
11484 * No_Stream_Optimizations:: 
11485 * No_Streams:: 
11486 * No_Task_Allocators:: 
11487 * No_Task_At_Interrupt_Priority:: 
11488 * No_Task_Attributes_Package:: 
11489 * No_Task_Hierarchy:: 
11490 * No_Task_Termination:: 
11491 * No_Tasking:: 
11492 * No_Terminate_Alternatives:: 
11493 * No_Unchecked_Access:: 
11494 * No_Unchecked_Conversion:: 
11495 * No_Unchecked_Deallocation:: 
11496 * No_Use_Of_Entity:: 
11497 * Pure_Barriers:: 
11498 * Simple_Barriers:: 
11499 * Static_Priorities:: 
11500 * Static_Storage_Size:: 
11502 @end menu
11504 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
11505 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1a3}
11506 @subsection Immediate_Reclamation
11509 @geindex Immediate_Reclamation
11511 [RM H.4] This restriction ensures that, except for storage occupied by
11512 objects created by allocators and not deallocated via unchecked
11513 deallocation, any storage reserved at run time for an object is
11514 immediately reclaimed when the object no longer exists.
11516 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
11517 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1a4}
11518 @subsection Max_Asynchronous_Select_Nesting
11521 @geindex Max_Asynchronous_Select_Nesting
11523 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
11524 selects. Violations of this restriction with a value of zero are
11525 detected at compile time. Violations of this restriction with values
11526 other than zero cause Storage_Error to be raised.
11528 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
11529 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1a5}
11530 @subsection Max_Entry_Queue_Length
11533 @geindex Max_Entry_Queue_Length
11535 [RM D.7] This restriction is a declaration that any protected entry compiled in
11536 the scope of the restriction has at most the specified number of
11537 tasks waiting on the entry at any one time, and so no queue is required.
11538 Note that this restriction is checked at run time. Violation of this
11539 restriction results in the raising of Program_Error exception at the point of
11540 the call.
11542 @geindex Max_Entry_Queue_Depth
11544 The restriction @cite{Max_Entry_Queue_Depth} is recognized as a
11545 synonym for @cite{Max_Entry_Queue_Length}. This is retained for historical
11546 compatibility purposes (and a warning will be generated for its use if
11547 warnings on obsolescent features are activated).
11549 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
11550 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1a6}
11551 @subsection Max_Protected_Entries
11554 @geindex Max_Protected_Entries
11556 [RM D.7] Specifies the maximum number of entries per protected type. The
11557 bounds of every entry family of a protected unit shall be static, or shall be
11558 defined by a discriminant of a subtype whose corresponding bound is static.
11560 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
11561 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1a7}
11562 @subsection Max_Select_Alternatives
11565 @geindex Max_Select_Alternatives
11567 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
11569 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
11570 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1a8}
11571 @subsection Max_Storage_At_Blocking
11574 @geindex Max_Storage_At_Blocking
11576 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
11577 Storage_Size that can be retained by a blocked task. A violation of this
11578 restriction causes Storage_Error to be raised.
11580 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
11581 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1a9}
11582 @subsection Max_Task_Entries
11585 @geindex Max_Task_Entries
11587 [RM D.7] Specifies the maximum number of entries
11588 per task.  The bounds of every entry family
11589 of a task unit shall be static, or shall be
11590 defined by a discriminant of a subtype whose
11591 corresponding bound is static.
11593 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
11594 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1aa}
11595 @subsection Max_Tasks
11598 @geindex Max_Tasks
11600 [RM D.7] Specifies the maximum number of task that may be created, not
11601 counting the creation of the environment task.  Violations of this
11602 restriction with a value of zero are detected at compile
11603 time. Violations of this restriction with values other than zero cause
11604 Storage_Error to be raised.
11606 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
11607 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1ab}
11608 @subsection No_Abort_Statements
11611 @geindex No_Abort_Statements
11613 [RM D.7] There are no abort_statements, and there are
11614 no calls to Task_Identification.Abort_Task.
11616 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
11617 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1ac}
11618 @subsection No_Access_Parameter_Allocators
11621 @geindex No_Access_Parameter_Allocators
11623 [RM H.4] This restriction ensures at compile time that there are no
11624 occurrences of an allocator as the actual parameter to an access
11625 parameter.
11627 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
11628 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1ad}
11629 @subsection No_Access_Subprograms
11632 @geindex No_Access_Subprograms
11634 [RM H.4] This restriction ensures at compile time that there are no
11635 declarations of access-to-subprogram types.
11637 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
11638 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1ae}
11639 @subsection No_Allocators
11642 @geindex No_Allocators
11644 [RM H.4] This restriction ensures at compile time that there are no
11645 occurrences of an allocator.
11647 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
11648 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1af}
11649 @subsection No_Anonymous_Allocators
11652 @geindex No_Anonymous_Allocators
11654 [RM H.4] This restriction ensures at compile time that there are no
11655 occurrences of an allocator of anonymous access type.
11657 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
11658 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1b0}
11659 @subsection No_Asynchronous_Control
11662 @geindex No_Asynchronous_Control
11664 [RM J.13] This restriction ensures at compile time that there are no semantic
11665 dependences on the predefined package Asynchronous_Task_Control.
11667 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
11668 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1b1}
11669 @subsection No_Calendar
11672 @geindex No_Calendar
11674 [GNAT] This restriction ensures at compile time that there are no semantic
11675 dependences on package Calendar.
11677 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
11678 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1b2}
11679 @subsection No_Coextensions
11682 @geindex No_Coextensions
11684 [RM H.4] This restriction ensures at compile time that there are no
11685 coextensions. See 3.10.2.
11687 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
11688 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1b3}
11689 @subsection No_Default_Initialization
11692 @geindex No_Default_Initialization
11694 [GNAT] This restriction prohibits any instance of default initialization
11695 of variables.  The binder implements a consistency rule which prevents
11696 any unit compiled without the restriction from with'ing a unit with the
11697 restriction (this allows the generation of initialization procedures to
11698 be skipped, since you can be sure that no call is ever generated to an
11699 initialization procedure in a unit with the restriction active). If used
11700 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
11701 is to prohibit all cases of variables declared without a specific
11702 initializer (including the case of OUT scalar parameters).
11704 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
11705 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1b4}
11706 @subsection No_Delay
11709 @geindex No_Delay
11711 [RM H.4] This restriction ensures at compile time that there are no
11712 delay statements and no semantic dependences on package Calendar.
11714 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
11715 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1b5}
11716 @subsection No_Dependence
11719 @geindex No_Dependence
11721 [RM 13.12.1] This restriction ensures at compile time that there are no
11722 dependences on a library unit.
11724 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
11725 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1b6}
11726 @subsection No_Direct_Boolean_Operators
11729 @geindex No_Direct_Boolean_Operators
11731 [GNAT] This restriction ensures that no logical operators (and/or/xor)
11732 are used on operands of type Boolean (or any type derived from Boolean).
11733 This is intended for use in safety critical programs where the certification
11734 protocol requires the use of short-circuit (and then, or else) forms for all
11735 composite boolean operations.
11737 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
11738 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1b7}
11739 @subsection No_Dispatch
11742 @geindex No_Dispatch
11744 [RM H.4] This restriction ensures at compile time that there are no
11745 occurrences of @cite{T'Class}, for any (tagged) subtype @cite{T}.
11747 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
11748 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1b8}
11749 @subsection No_Dispatching_Calls
11752 @geindex No_Dispatching_Calls
11754 [GNAT] This restriction ensures at compile time that the code generated by the
11755 compiler involves no dispatching calls. The use of this restriction allows the
11756 safe use of record extensions, classwide membership tests and other classwide
11757 features not involving implicit dispatching. This restriction ensures that
11758 the code contains no indirect calls through a dispatching mechanism. Note that
11759 this includes internally-generated calls created by the compiler, for example
11760 in the implementation of class-wide objects assignments. The
11761 membership test is allowed in the presence of this restriction, because its
11762 implementation requires no dispatching.
11763 This restriction is comparable to the official Ada restriction
11764 @cite{No_Dispatch} except that it is a bit less restrictive in that it allows
11765 all classwide constructs that do not imply dispatching.
11766 The following example indicates constructs that violate this restriction.
11768 @example
11769 package Pkg is
11770   type T is tagged record
11771     Data : Natural;
11772   end record;
11773   procedure P (X : T);
11775   type DT is new T with record
11776     More_Data : Natural;
11777   end record;
11778   procedure Q (X : DT);
11779 end Pkg;
11781 with Pkg; use Pkg;
11782 procedure Example is
11783   procedure Test (O : T'Class) is
11784     N : Natural  := O'Size;--  Error: Dispatching call
11785     C : T'Class := O;      --  Error: implicit Dispatching Call
11786   begin
11787     if O in DT'Class then  --  OK   : Membership test
11788        Q (DT (O));         --  OK   : Type conversion plus direct call
11789     else
11790        P (O);              --  Error: Dispatching call
11791     end if;
11792   end Test;
11794   Obj : DT;
11795 begin
11796   P (Obj);                 --  OK   : Direct call
11797   P (T (Obj));             --  OK   : Type conversion plus direct call
11798   P (T'Class (Obj));       --  Error: Dispatching call
11800   Test (Obj);              --  OK   : Type conversion
11802   if Obj in T'Class then   --  OK   : Membership test
11803      null;
11804   end if;
11805 end Example;
11806 @end example
11808 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
11809 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1b9}
11810 @subsection No_Dynamic_Attachment
11813 @geindex No_Dynamic_Attachment
11815 [RM D.7] This restriction ensures that there is no call to any of the
11816 operations defined in package Ada.Interrupts
11817 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
11818 Detach_Handler, and Reference).
11820 @geindex No_Dynamic_Interrupts
11822 The restriction @cite{No_Dynamic_Interrupts} is recognized as a
11823 synonym for @cite{No_Dynamic_Attachment}. This is retained for historical
11824 compatibility purposes (and a warning will be generated for its use if
11825 warnings on obsolescent features are activated).
11827 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
11828 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1ba}
11829 @subsection No_Dynamic_Priorities
11832 @geindex No_Dynamic_Priorities
11834 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
11836 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
11837 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1bb}
11838 @subsection No_Entry_Calls_In_Elaboration_Code
11841 @geindex No_Entry_Calls_In_Elaboration_Code
11843 [GNAT] This restriction ensures at compile time that no task or protected entry
11844 calls are made during elaboration code.  As a result of the use of this
11845 restriction, the compiler can assume that no code past an accept statement
11846 in a task can be executed at elaboration time.
11848 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
11849 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1bc}
11850 @subsection No_Enumeration_Maps
11853 @geindex No_Enumeration_Maps
11855 [GNAT] This restriction ensures at compile time that no operations requiring
11856 enumeration maps are used (that is Image and Value attributes applied
11857 to enumeration types).
11859 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
11860 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1bd}
11861 @subsection No_Exception_Handlers
11864 @geindex No_Exception_Handlers
11866 [GNAT] This restriction ensures at compile time that there are no explicit
11867 exception handlers. It also indicates that no exception propagation will
11868 be provided. In this mode, exceptions may be raised but will result in
11869 an immediate call to the last chance handler, a routine that the user
11870 must define with the following profile:
11872 @example
11873 procedure Last_Chance_Handler
11874   (Source_Location : System.Address; Line : Integer);
11875 pragma Export (C, Last_Chance_Handler,
11876                "__gnat_last_chance_handler");
11877 @end example
11879 The parameter is a C null-terminated string representing a message to be
11880 associated with the exception (typically the source location of the raise
11881 statement generated by the compiler). The Line parameter when nonzero
11882 represents the line number in the source program where the raise occurs.
11884 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
11885 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1be}
11886 @subsection No_Exception_Propagation
11889 @geindex No_Exception_Propagation
11891 [GNAT] This restriction guarantees that exceptions are never propagated
11892 to an outer subprogram scope. The only case in which an exception may
11893 be raised is when the handler is statically in the same subprogram, so
11894 that the effect of a raise is essentially like a goto statement. Any
11895 other raise statement (implicit or explicit) will be considered
11896 unhandled. Exception handlers are allowed, but may not contain an
11897 exception occurrence identifier (exception choice). In addition, use of
11898 the package GNAT.Current_Exception is not permitted, and reraise
11899 statements (raise with no operand) are not permitted.
11901 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
11902 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1bf}
11903 @subsection No_Exception_Registration
11906 @geindex No_Exception_Registration
11908 [GNAT] This restriction ensures at compile time that no stream operations for
11909 types Exception_Id or Exception_Occurrence are used. This also makes it
11910 impossible to pass exceptions to or from a partition with this restriction
11911 in a distributed environment. If this restriction is active, the generated
11912 code is simplified by omitting the otherwise-required global registration
11913 of exceptions when they are declared.
11915 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
11916 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1c0}
11917 @subsection No_Exceptions
11920 @geindex No_Exceptions
11922 [RM H.4] This restriction ensures at compile time that there are no
11923 raise statements and no exception handlers.
11925 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
11926 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1c1}
11927 @subsection No_Finalization
11930 @geindex No_Finalization
11932 [GNAT] This restriction disables the language features described in
11933 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
11934 performed by the compiler to support these features. The following types
11935 are no longer considered controlled when this restriction is in effect:
11938 @itemize *
11940 @item 
11941 @cite{Ada.Finalization.Controlled}
11943 @item 
11944 @cite{Ada.Finalization.Limited_Controlled}
11946 @item 
11947 Derivations from @cite{Controlled} or @cite{Limited_Controlled}
11949 @item 
11950 Class-wide types
11952 @item 
11953 Protected types
11955 @item 
11956 Task types
11958 @item 
11959 Array and record types with controlled components
11960 @end itemize
11962 The compiler no longer generates code to initialize, finalize or adjust an
11963 object or a nested component, either declared on the stack or on the heap. The
11964 deallocation of a controlled object no longer finalizes its contents.
11966 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
11967 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1c2}
11968 @subsection No_Fixed_Point
11971 @geindex No_Fixed_Point
11973 [RM H.4] This restriction ensures at compile time that there are no
11974 occurrences of fixed point types and operations.
11976 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
11977 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1c3}
11978 @subsection No_Floating_Point
11981 @geindex No_Floating_Point
11983 [RM H.4] This restriction ensures at compile time that there are no
11984 occurrences of floating point types and operations.
11986 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
11987 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1c4}
11988 @subsection No_Implicit_Conditionals
11991 @geindex No_Implicit_Conditionals
11993 [GNAT] This restriction ensures that the generated code does not contain any
11994 implicit conditionals, either by modifying the generated code where possible,
11995 or by rejecting any construct that would otherwise generate an implicit
11996 conditional. Note that this check does not include run time constraint
11997 checks, which on some targets may generate implicit conditionals as
11998 well. To control the latter, constraint checks can be suppressed in the
11999 normal manner. Constructs generating implicit conditionals include comparisons
12000 of composite objects and the Max/Min attributes.
12002 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12003 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1c5}
12004 @subsection No_Implicit_Dynamic_Code
12007 @geindex No_Implicit_Dynamic_Code
12009 @geindex trampoline
12011 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12012 This is a structure that is built on the stack and contains dynamic
12013 code to be executed at run time. On some targets, a trampoline is
12014 built for the following features: @cite{Access},
12015 @cite{Unrestricted_Access}, or @cite{Address} of a nested subprogram;
12016 nested task bodies; primitive operations of nested tagged types.
12017 Trampolines do not work on machines that prevent execution of stack
12018 data. For example, on windows systems, enabling DEP (data execution
12019 protection) will cause trampolines to raise an exception.
12020 Trampolines are also quite slow at run time.
12022 On many targets, trampolines have been largely eliminated. Look at the
12023 version of system.ads for your target --- if it has
12024 Always_Compatible_Rep equal to False, then trampolines are largely
12025 eliminated. In particular, a trampoline is built for the following
12026 features: @cite{Address} of a nested subprogram;
12027 @cite{Access} or @cite{Unrestricted_Access} of a nested subprogram,
12028 but only if pragma Favor_Top_Level applies, or the access type has a
12029 foreign-language convention; primitive operations of nested tagged
12030 types.
12032 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12033 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1c6}
12034 @subsection No_Implicit_Heap_Allocations
12037 @geindex No_Implicit_Heap_Allocations
12039 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12041 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12042 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1c7}
12043 @subsection No_Implicit_Protected_Object_Allocations
12046 @geindex No_Implicit_Protected_Object_Allocations
12048 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12049 protected object.
12051 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12052 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1c8}
12053 @subsection No_Implicit_Task_Allocations
12056 @geindex No_Implicit_Task_Allocations
12058 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12060 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12061 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1c9}
12062 @subsection No_Initialize_Scalars
12065 @geindex No_Initialize_Scalars
12067 [GNAT] This restriction ensures that no unit in the partition is compiled with
12068 pragma Initialize_Scalars. This allows the generation of more efficient
12069 code, and in particular eliminates dummy null initialization routines that
12070 are otherwise generated for some record and array types.
12072 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12073 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1ca}
12074 @subsection No_IO
12077 @geindex No_IO
12079 [RM H.4] This restriction ensures at compile time that there are no
12080 dependences on any of the library units Sequential_IO, Direct_IO,
12081 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12083 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12084 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1cb}
12085 @subsection No_Local_Allocators
12088 @geindex No_Local_Allocators
12090 [RM H.4] This restriction ensures at compile time that there are no
12091 occurrences of an allocator in subprograms, generic subprograms, tasks,
12092 and entry bodies.
12094 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12095 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1cc}
12096 @subsection No_Local_Protected_Objects
12099 @geindex No_Local_Protected_Objects
12101 [RM D.7] This restriction ensures at compile time that protected objects are
12102 only declared at the library level.
12104 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12105 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1cd}
12106 @subsection No_Local_Timing_Events
12109 @geindex No_Local_Timing_Events
12111 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12112 declared at the library level.
12114 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12115 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1ce}
12116 @subsection No_Long_Long_Integers
12119 @geindex No_Long_Long_Integers
12121 [GNAT] This partition-wide restriction forbids any explicit reference to
12122 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12123 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12124 Long_Integer'Size.
12126 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12127 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1cf}
12128 @subsection No_Multiple_Elaboration
12131 @geindex No_Multiple_Elaboration
12133 [GNAT] When this restriction is active, we are not requesting control-flow
12134 preservation with -fpreserve-control-flow, and the static elaboration model is
12135 used, the compiler is allowed to suppress the elaboration counter normally
12136 associated with the unit, even if the unit has elaboration code. This counter
12137 is typically used to check for access before elaboration and to control
12138 multiple elaboration attempts. If the restriction is used, then the
12139 situations in which multiple elaboration is possible, including non-Ada main
12140 programs and Stand Alone libraries, are not permitted and will be diagnosed
12141 by the binder.
12143 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12144 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1d0}
12145 @subsection No_Nested_Finalization
12148 @geindex No_Nested_Finalization
12150 [RM D.7] All objects requiring finalization are declared at the library level.
12152 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12153 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1d1}
12154 @subsection No_Protected_Type_Allocators
12157 @geindex No_Protected_Type_Allocators
12159 [RM D.7] This restriction ensures at compile time that there are no allocator
12160 expressions that attempt to allocate protected objects.
12162 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12163 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1d2}
12164 @subsection No_Protected_Types
12167 @geindex No_Protected_Types
12169 [RM H.4] This restriction ensures at compile time that there are no
12170 declarations of protected types or protected objects.
12172 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12173 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1d3}
12174 @subsection No_Recursion
12177 @geindex No_Recursion
12179 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12180 part of its execution.
12182 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12183 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1d4}
12184 @subsection No_Reentrancy
12187 @geindex No_Reentrancy
12189 [RM H.4] A program execution is erroneous if a subprogram is executed by
12190 two tasks at the same time.
12192 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12193 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1d5}
12194 @subsection No_Relative_Delay
12197 @geindex No_Relative_Delay
12199 [RM D.7] This restriction ensures at compile time that there are no delay
12200 relative statements and prevents expressions such as @cite{delay 1.23;} from
12201 appearing in source code.
12203 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12204 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1d6}
12205 @subsection No_Requeue_Statements
12208 @geindex No_Requeue_Statements
12210 [RM D.7] This restriction ensures at compile time that no requeue statements
12211 are permitted and prevents keyword @cite{requeue} from being used in source
12212 code.
12214 @geindex No_Requeue
12216 The restriction @cite{No_Requeue} is recognized as a
12217 synonym for @cite{No_Requeue_Statements}. This is retained for historical
12218 compatibility purposes (and a warning will be generated for its use if
12219 warnings on oNobsolescent features are activated).
12221 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12222 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1d7}
12223 @subsection No_Secondary_Stack
12226 @geindex No_Secondary_Stack
12228 [GNAT] This restriction ensures at compile time that the generated code
12229 does not contain any reference to the secondary stack.  The secondary
12230 stack is used to implement functions returning unconstrained objects
12231 (arrays or records) on some targets.
12233 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12234 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1d8}
12235 @subsection No_Select_Statements
12238 @geindex No_Select_Statements
12240 [RM D.7] This restriction ensures at compile time no select statements of any
12241 kind are permitted, that is the keyword @cite{select} may not appear.
12243 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12244 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1d9}
12245 @subsection No_Specific_Termination_Handlers
12248 @geindex No_Specific_Termination_Handlers
12250 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12251 or to Ada.Task_Termination.Specific_Handler.
12253 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12254 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1da}
12255 @subsection No_Specification_of_Aspect
12258 @geindex No_Specification_of_Aspect
12260 [RM 13.12.1] This restriction checks at compile time that no aspect
12261 specification, attribute definition clause, or pragma is given for a
12262 given aspect.
12264 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12265 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1db}
12266 @subsection No_Standard_Allocators_After_Elaboration
12269 @geindex No_Standard_Allocators_After_Elaboration
12271 [RM D.7] Specifies that an allocator using a standard storage pool
12272 should never be evaluated at run time after the elaboration of the
12273 library items of the partition has completed. Otherwise, Storage_Error
12274 is raised.
12276 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12277 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1dc}
12278 @subsection No_Standard_Storage_Pools
12281 @geindex No_Standard_Storage_Pools
12283 [GNAT] This restriction ensures at compile time that no access types
12284 use the standard default storage pool.  Any access type declared must
12285 have an explicit Storage_Pool attribute defined specifying a
12286 user-defined storage pool.
12288 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12289 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1dd}
12290 @subsection No_Stream_Optimizations
12293 @geindex No_Stream_Optimizations
12295 [GNAT] This restriction affects the performance of stream operations on types
12296 @cite{String}, @cite{Wide_String} and @cite{Wide_Wide_String}. By default, the
12297 compiler uses block reads and writes when manipulating @cite{String} objects
12298 due to their supperior performance. When this restriction is in effect, the
12299 compiler performs all IO operations on a per-character basis.
12301 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12302 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1de}
12303 @subsection No_Streams
12306 @geindex No_Streams
12308 [GNAT] This restriction ensures at compile/bind time that there are no
12309 stream objects created and no use of stream attributes.
12310 This restriction does not forbid dependences on the package
12311 @cite{Ada.Streams}. So it is permissible to with
12312 @cite{Ada.Streams} (or another package that does so itself)
12313 as long as no actual stream objects are created and no
12314 stream attributes are used.
12316 Note that the use of restriction allows optimization of tagged types,
12317 since they do not need to worry about dispatching stream operations.
12318 To take maximum advantage of this space-saving optimization, any
12319 unit declaring a tagged type should be compiled with the restriction,
12320 though this is not required.
12322 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12323 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1df}
12324 @subsection No_Task_Allocators
12327 @geindex No_Task_Allocators
12329 [RM D.7] There are no allocators for task types
12330 or types containing task subcomponents.
12332 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
12333 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1e0}
12334 @subsection No_Task_At_Interrupt_Priority
12337 @geindex No_Task_At_Interrupt_Priority
12339 [GNAT] This restriction ensures at compile time that there is no
12340 Interrupt_Priority aspect or pragma for a task or a task type. As
12341 a consequence, the tasks are always created with a priority below
12342 that an interrupt priority.
12344 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
12345 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1e1}
12346 @subsection No_Task_Attributes_Package
12349 @geindex No_Task_Attributes_Package
12351 [GNAT] This restriction ensures at compile time that there are no implicit or
12352 explicit dependencies on the package @cite{Ada.Task_Attributes}.
12354 @geindex No_Task_Attributes
12356 The restriction @cite{No_Task_Attributes} is recognized as a synonym
12357 for @cite{No_Task_Attributes_Package}. This is retained for historical
12358 compatibility purposes (and a warning will be generated for its use if
12359 warnings on obsolescent features are activated).
12361 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
12362 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1e2}
12363 @subsection No_Task_Hierarchy
12366 @geindex No_Task_Hierarchy
12368 [RM D.7] All (non-environment) tasks depend
12369 directly on the environment task of the partition.
12371 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
12372 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1e3}
12373 @subsection No_Task_Termination
12376 @geindex No_Task_Termination
12378 [RM D.7] Tasks that terminate are erroneous.
12380 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
12381 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1e4}
12382 @subsection No_Tasking
12385 @geindex No_Tasking
12387 [GNAT] This restriction prevents the declaration of tasks or task types
12388 throughout the partition.  It is similar in effect to the use of
12389 @cite{Max_Tasks => 0} except that violations are caught at compile time
12390 and cause an error message to be output either by the compiler or
12391 binder.
12393 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
12394 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1e5}
12395 @subsection No_Terminate_Alternatives
12398 @geindex No_Terminate_Alternatives
12400 [RM D.7] There are no selective accepts with terminate alternatives.
12402 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
12403 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1e6}
12404 @subsection No_Unchecked_Access
12407 @geindex No_Unchecked_Access
12409 [RM H.4] This restriction ensures at compile time that there are no
12410 occurrences of the Unchecked_Access attribute.
12412 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
12413 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1e7}
12414 @subsection No_Unchecked_Conversion
12417 @geindex No_Unchecked_Conversion
12419 [RM J.13] This restriction ensures at compile time that there are no semantic
12420 dependences on the predefined generic function Unchecked_Conversion.
12422 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
12423 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1e8}
12424 @subsection No_Unchecked_Deallocation
12427 @geindex No_Unchecked_Deallocation
12429 [RM J.13] This restriction ensures at compile time that there are no semantic
12430 dependences on the predefined generic procedure Unchecked_Deallocation.
12432 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
12433 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1e9}
12434 @subsection No_Use_Of_Entity
12437 @geindex No_Use_Of_Entity
12439 [GNAT] This restriction ensures at compile time that there are no references
12440 to the entity given in the form
12442 @example
12443 No_Use_Of_Entity => Name
12444 @end example
12446 where @code{Name} is the fully qualified entity, for example
12448 @example
12449 No_Use_Of_Entity => Ada.Text_IO.Put_Line
12450 @end example
12452 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
12453 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1ea}
12454 @subsection Pure_Barriers
12457 @geindex Pure_Barriers
12459 [GNAT] This restriction ensures at compile time that protected entry
12460 barriers are restricted to:
12463 @itemize *
12465 @item 
12466 simple variables defined in the private part of the
12467 protected type/object,
12469 @item 
12470 constant declarations,
12472 @item 
12473 named numbers,
12475 @item 
12476 enumeration literals,
12478 @item 
12479 integer literals,
12481 @item 
12482 real literals,
12484 @item 
12485 character literals,
12487 @item 
12488 implicitly defined comparison operators,
12490 @item 
12491 uses of the Standard."not" operator,
12493 @item 
12494 short-circuit operator
12495 @end itemize
12497 This restriction is a relaxation of the Simple_Barriers restriction,
12498 but still ensures absence of side effects, exceptions, and recursion
12499 during the evaluation of the barriers.
12501 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
12502 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1eb}
12503 @subsection Simple_Barriers
12506 @geindex Simple_Barriers
12508 [RM D.7] This restriction ensures at compile time that barriers in entry
12509 declarations for protected types are restricted to either static boolean
12510 expressions or references to simple boolean variables defined in the private
12511 part of the protected type.  No other form of entry barriers is permitted.
12513 @geindex Boolean_Entry_Barriers
12515 The restriction @cite{Boolean_Entry_Barriers} is recognized as a
12516 synonym for @cite{Simple_Barriers}. This is retained for historical
12517 compatibility purposes (and a warning will be generated for its use if
12518 warnings on obsolescent features are activated).
12520 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
12521 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1ec}
12522 @subsection Static_Priorities
12525 @geindex Static_Priorities
12527 [GNAT] This restriction ensures at compile time that all priority expressions
12528 are static, and that there are no dependences on the package
12529 @cite{Ada.Dynamic_Priorities}.
12531 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
12532 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1ed}
12533 @subsection Static_Storage_Size
12536 @geindex Static_Storage_Size
12538 [GNAT] This restriction ensures at compile time that any expression appearing
12539 in a Storage_Size pragma or attribute definition clause is static.
12541 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
12542 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1ee}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{1ef}
12543 @section Program Unit Level Restrictions
12546 The second set of restriction identifiers
12547 does not require partition-wide consistency.
12548 The restriction may be enforced for a single
12549 compilation unit without any effect on any of the
12550 other compilation units in the partition.
12552 @menu
12553 * No_Elaboration_Code:: 
12554 * No_Dynamic_Sized_Objects:: 
12555 * No_Entry_Queue:: 
12556 * No_Implementation_Aspect_Specifications:: 
12557 * No_Implementation_Attributes:: 
12558 * No_Implementation_Identifiers:: 
12559 * No_Implementation_Pragmas:: 
12560 * No_Implementation_Restrictions:: 
12561 * No_Implementation_Units:: 
12562 * No_Implicit_Aliasing:: 
12563 * No_Implicit_Loops:: 
12564 * No_Obsolescent_Features:: 
12565 * No_Wide_Characters:: 
12566 * SPARK_05:: 
12568 @end menu
12570 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
12571 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{1f0}
12572 @subsection No_Elaboration_Code
12575 @geindex No_Elaboration_Code
12577 [GNAT] This restriction ensures at compile time that no elaboration code is
12578 generated.  Note that this is not the same condition as is enforced
12579 by pragma @cite{Preelaborate}.  There are cases in which pragma
12580 @cite{Preelaborate} still permits code to be generated (e.g., code
12581 to initialize a large array to all zeroes), and there are cases of units
12582 which do not meet the requirements for pragma @cite{Preelaborate},
12583 but for which no elaboration code is generated.  Generally, it is
12584 the case that preelaborable units will meet the restrictions, with
12585 the exception of large aggregates initialized with an others_clause,
12586 and exception declarations (which generate calls to a run-time
12587 registry procedure).  This restriction is enforced on
12588 a unit by unit basis, it need not be obeyed consistently
12589 throughout a partition.
12591 In the case of aggregates with others, if the aggregate has a dynamic
12592 size, there is no way to eliminate the elaboration code (such dynamic
12593 bounds would be incompatible with @cite{Preelaborate} in any case). If
12594 the bounds are static, then use of this restriction actually modifies
12595 the code choice of the compiler to avoid generating a loop, and instead
12596 generate the aggregate statically if possible, no matter how many times
12597 the data for the others clause must be repeatedly generated.
12599 It is not possible to precisely document
12600 the constructs which are compatible with this restriction, since,
12601 unlike most other restrictions, this is not a restriction on the
12602 source code, but a restriction on the generated object code. For
12603 example, if the source contains a declaration:
12605 @example
12606 Val : constant Integer := X;
12607 @end example
12609 where X is not a static constant, it may be possible, depending
12610 on complex optimization circuitry, for the compiler to figure
12611 out the value of X at compile time, in which case this initialization
12612 can be done by the loader, and requires no initialization code. It
12613 is not possible to document the precise conditions under which the
12614 optimizer can figure this out.
12616 Note that this the implementation of this restriction requires full
12617 code generation. If it is used in conjunction with "semantics only"
12618 checking, then some cases of violations may be missed.
12620 When this restriction is active, we are not requesting control-flow
12621 preservation with -fpreserve-control-flow, and the static elaboration model is
12622 used, the compiler is allowed to suppress the elaboration counter normally
12623 associated with the unit. This counter is typically used to check for access
12624 before elaboration and to control multiple elaboration attempts.
12626 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
12627 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{1f1}
12628 @subsection No_Dynamic_Sized_Objects
12631 @geindex No_Dynamic_Sized_Objects
12633 [GNAT] This restriction disallows certain constructs that might lead to the
12634 creation of dynamic-sized composite objects (or array or discriminated type).
12635 An array subtype indication is illegal if the bounds are not static
12636 or references to discriminants of an enclosing type.
12637 A discriminated subtype indication is illegal if the type has
12638 discriminant-dependent array components or a variant part, and the
12639 discriminants are not static. In addition, array and record aggregates are
12640 illegal in corresponding cases. Note that this restriction does not forbid
12641 access discriminants. It is often a good idea to combine this restriction
12642 with No_Secondary_Stack.
12644 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
12645 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{1f2}
12646 @subsection No_Entry_Queue
12649 @geindex No_Entry_Queue
12651 [GNAT] This restriction is a declaration that any protected entry compiled in
12652 the scope of the restriction has at most one task waiting on the entry
12653 at any one time, and so no queue is required.  This restriction is not
12654 checked at compile time.  A program execution is erroneous if an attempt
12655 is made to queue a second task on such an entry.
12657 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
12658 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{1f3}
12659 @subsection No_Implementation_Aspect_Specifications
12662 @geindex No_Implementation_Aspect_Specifications
12664 [RM 13.12.1] This restriction checks at compile time that no
12665 GNAT-defined aspects are present.  With this restriction, the only
12666 aspects that can be used are those defined in the Ada Reference Manual.
12668 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
12669 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{1f4}
12670 @subsection No_Implementation_Attributes
12673 @geindex No_Implementation_Attributes
12675 [RM 13.12.1] This restriction checks at compile time that no
12676 GNAT-defined attributes are present.  With this restriction, the only
12677 attributes that can be used are those defined in the Ada Reference
12678 Manual.
12680 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
12681 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{1f5}
12682 @subsection No_Implementation_Identifiers
12685 @geindex No_Implementation_Identifiers
12687 [RM 13.12.1] This restriction checks at compile time that no
12688 implementation-defined identifiers (marked with pragma Implementation_Defined)
12689 occur within language-defined packages.
12691 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
12692 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{1f6}
12693 @subsection No_Implementation_Pragmas
12696 @geindex No_Implementation_Pragmas
12698 [RM 13.12.1] This restriction checks at compile time that no
12699 GNAT-defined pragmas are present.  With this restriction, the only
12700 pragmas that can be used are those defined in the Ada Reference Manual.
12702 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
12703 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{1f7}
12704 @subsection No_Implementation_Restrictions
12707 @geindex No_Implementation_Restrictions
12709 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
12710 identifiers (other than @cite{No_Implementation_Restrictions} itself)
12711 are present.  With this restriction, the only other restriction identifiers
12712 that can be used are those defined in the Ada Reference Manual.
12714 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
12715 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{1f8}
12716 @subsection No_Implementation_Units
12719 @geindex No_Implementation_Units
12721 [RM 13.12.1] This restriction checks at compile time that there is no
12722 mention in the context clause of any implementation-defined descendants
12723 of packages Ada, Interfaces, or System.
12725 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
12726 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{1f9}
12727 @subsection No_Implicit_Aliasing
12730 @geindex No_Implicit_Aliasing
12732 [GNAT] This restriction, which is not required to be partition-wide consistent,
12733 requires an explicit aliased keyword for an object to which 'Access,
12734 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
12735 the 'Unrestricted_Access attribute for objects. Note: the reason that
12736 Unrestricted_Access is forbidden is that it would require the prefix
12737 to be aliased, and in such cases, it can always be replaced by
12738 the standard attribute Unchecked_Access which is preferable.
12740 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
12741 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{1fa}
12742 @subsection No_Implicit_Loops
12745 @geindex No_Implicit_Loops
12747 [GNAT] This restriction ensures that the generated code of the unit marked
12748 with this restriction does not contain any implicit @cite{for} loops, either by
12749 modifying the generated code where possible, or by rejecting any construct
12750 that would otherwise generate an implicit @cite{for} loop. If this restriction is
12751 active, it is possible to build large array aggregates with all static
12752 components without generating an intermediate temporary, and without generating
12753 a loop to initialize individual components. Otherwise, a loop is created for
12754 arrays larger than about 5000 scalar components. Note that if this restriction
12755 is set in the spec of a package, it will not apply to its body.
12757 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
12758 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{1fb}
12759 @subsection No_Obsolescent_Features
12762 @geindex No_Obsolescent_Features
12764 [RM 13.12.1] This restriction checks at compile time that no obsolescent
12765 features are used, as defined in Annex J of the Ada Reference Manual.
12767 @node No_Wide_Characters,SPARK_05,No_Obsolescent_Features,Program Unit Level Restrictions
12768 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{1fc}
12769 @subsection No_Wide_Characters
12772 @geindex No_Wide_Characters
12774 [GNAT] This restriction ensures at compile time that no uses of the types
12775 @cite{Wide_Character} or @cite{Wide_String} or corresponding wide
12776 wide types
12777 appear, and that no wide or wide wide string or character literals
12778 appear in the program (that is literals representing characters not in
12779 type @cite{Character}).
12781 @node SPARK_05,,No_Wide_Characters,Program Unit Level Restrictions
12782 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{1fd}
12783 @subsection SPARK_05
12786 @geindex SPARK_05
12788 [GNAT] This restriction checks at compile time that some constructs
12789 forbidden in SPARK 2005 are not present. Error messages related to
12790 SPARK restriction have the form:
12792 @example
12793 violation of restriction "SPARK_05" at <source-location>
12794  <error message>
12795 @end example
12797 @geindex SPARK
12799 The restriction @cite{SPARK} is recognized as a
12800 synonym for @cite{SPARK_05}. This is retained for historical
12801 compatibility purposes (and an unconditional warning will be generated
12802 for its use, advising replacement by @cite{SPARK}).
12804 This is not a replacement for the semantic checks performed by the
12805 SPARK Examiner tool, as the compiler currently only deals with code,
12806 not SPARK 2005 annotations, and does not guarantee catching all
12807 cases of constructs forbidden by SPARK 2005.
12809 Thus it may well be the case that code which passes the compiler with
12810 the SPARK restriction is rejected by the SPARK Examiner, e.g. due to
12811 the different visibility rules of the Examiner based on SPARK 2005
12812 @cite{inherit} annotations.
12814 This restriction can be useful in providing an initial filter for code
12815 developed using SPARK 2005, or in examining legacy code to see how far
12816 it is from meeting SPARK restrictions.
12818 The list below summarizes the checks that are performed when this
12819 restriction is in force:
12822 @itemize *
12824 @item 
12825 No block statements
12827 @item 
12828 No case statements with only an others clause
12830 @item 
12831 Exit statements in loops must respect the SPARK 2005 language restrictions
12833 @item 
12834 No goto statements
12836 @item 
12837 Return can only appear as last statement in function
12839 @item 
12840 Function must have return statement
12842 @item 
12843 Loop parameter specification must include subtype mark
12845 @item 
12846 Prefix of expanded name cannot be a loop statement
12848 @item 
12849 Abstract subprogram not allowed
12851 @item 
12852 User-defined operators not allowed
12854 @item 
12855 Access type parameters not allowed
12857 @item 
12858 Default expressions for parameters not allowed
12860 @item 
12861 Default expressions for record fields not allowed
12863 @item 
12864 No tasking constructs allowed
12866 @item 
12867 Label needed at end of subprograms and packages
12869 @item 
12870 No mixing of positional and named parameter association
12872 @item 
12873 No access types as result type
12875 @item 
12876 No unconstrained arrays as result types
12878 @item 
12879 No null procedures
12881 @item 
12882 Initial and later declarations must be in correct order (declaration can't come after body)
12884 @item 
12885 No attributes on private types if full declaration not visible
12887 @item 
12888 No package declaration within package specification
12890 @item 
12891 No controlled types
12893 @item 
12894 No discriminant types
12896 @item 
12897 No overloading
12899 @item 
12900 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
12902 @item 
12903 Access attribute not allowed
12905 @item 
12906 Allocator not allowed
12908 @item 
12909 Result of catenation must be String
12911 @item 
12912 Operands of catenation must be string literal, static char or another catenation
12914 @item 
12915 No conditional expressions
12917 @item 
12918 No explicit dereference
12920 @item 
12921 Quantified expression not allowed
12923 @item 
12924 Slicing not allowed
12926 @item 
12927 No exception renaming
12929 @item 
12930 No generic renaming
12932 @item 
12933 No object renaming
12935 @item 
12936 No use clause
12938 @item 
12939 Aggregates must be qualified
12941 @item 
12942 Nonstatic choice in array aggregates not allowed
12944 @item 
12945 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
12947 @item 
12948 No mixing of positional and named association in aggregate, no multi choice
12950 @item 
12951 AND, OR and XOR for arrays only allowed when operands have same static bounds
12953 @item 
12954 Fixed point operands to * or / must be qualified or converted
12956 @item 
12957 Comparison operators not allowed for Booleans or arrays (except strings)
12959 @item 
12960 Equality not allowed for arrays with non-matching static bounds (except strings)
12962 @item 
12963 Conversion / qualification not allowed for arrays with non-matching static bounds
12965 @item 
12966 Subprogram declaration only allowed in package spec (unless followed by import)
12968 @item 
12969 Access types not allowed
12971 @item 
12972 Incomplete type declaration not allowed
12974 @item 
12975 Object and subtype declarations must respect SPARK restrictions
12977 @item 
12978 Digits or delta constraint not allowed
12980 @item 
12981 Decimal fixed point type not allowed
12983 @item 
12984 Aliasing of objects not allowed
12986 @item 
12987 Modular type modulus must be power of 2
12989 @item 
12990 Base not allowed on subtype mark
12992 @item 
12993 Unary operators not allowed on modular types (except not)
12995 @item 
12996 Untagged record cannot be null
12998 @item 
12999 No class-wide operations
13001 @item 
13002 Initialization expressions must respect SPARK restrictions
13004 @item 
13005 Nonstatic ranges not allowed except in iteration schemes
13007 @item 
13008 String subtypes must have lower bound of 1
13010 @item 
13011 Subtype of Boolean cannot have constraint
13013 @item 
13014 At most one tagged type or extension per package
13016 @item 
13017 Interface is not allowed
13019 @item 
13020 Character literal cannot be prefixed (selector name cannot be character literal)
13022 @item 
13023 Record aggregate cannot contain 'others'
13025 @item 
13026 Component association in record aggregate must contain a single choice
13028 @item 
13029 Ancestor part cannot be a type mark
13031 @item 
13032 Attributes 'Image, 'Width and 'Value not allowed
13034 @item 
13035 Functions may not update globals
13037 @item 
13038 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13040 @item 
13041 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13042 @end itemize
13044 The following restrictions are enforced, but note that they are actually more
13045 strict that the latest SPARK 2005 language definition:
13048 @itemize *
13050 @item 
13051 No derived types other than tagged type extensions
13053 @item 
13054 Subtype of unconstrained array must have constraint
13055 @end itemize
13057 This list summarises the main SPARK 2005 language rules that are not
13058 currently checked by the SPARK_05 restriction:
13061 @itemize *
13063 @item 
13064 SPARK annotations are treated as comments so are not checked at all
13066 @item 
13067 Based real literals not allowed
13069 @item 
13070 Objects cannot be initialized at declaration by calls to user-defined functions
13072 @item 
13073 Objects cannot be initialized at declaration by assignments from variables
13075 @item 
13076 Objects cannot be initialized at declaration by assignments from indexed/selected components
13078 @item 
13079 Ranges shall not be null
13081 @item 
13082 A fixed point delta expression must be a simple expression
13084 @item 
13085 Restrictions on where renaming declarations may be placed
13087 @item 
13088 Externals of mode 'out' cannot be referenced
13090 @item 
13091 Externals of mode 'in' cannot be updated
13093 @item 
13094 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13096 @item 
13097 Subprogram cannot have parent unit name
13099 @item 
13100 SPARK 2005 inherited subprogram must be prefixed with overriding
13102 @item 
13103 External variables (or functions that reference them) may not be passed as actual parameters
13105 @item 
13106 Globals must be explicitly mentioned in contract
13108 @item 
13109 Deferred constants cannot be completed by pragma Import
13111 @item 
13112 Package initialization cannot read/write variables from other packages
13114 @item 
13115 Prefix not allowed for entities that are directly visible
13117 @item 
13118 Identifier declaration can't override inherited package name
13120 @item 
13121 Cannot use Standard or other predefined packages as identifiers
13123 @item 
13124 After renaming, cannot use the original name
13126 @item 
13127 Subprograms can only be renamed to remove package prefix
13129 @item 
13130 Pragma import must be immediately after entity it names
13132 @item 
13133 No mutual recursion between multiple units (this can be checked with gnatcheck)
13134 @end itemize
13136 Note that if a unit is compiled in Ada 95 mode with the SPARK restriction,
13137 violations will be reported for constructs forbidden in SPARK 95,
13138 instead of SPARK 2005.
13140 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13141 @anchor{gnat_rm/implementation_advice doc}@anchor{1fe}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{1ff}
13142 @chapter Implementation Advice
13145 The main text of the Ada Reference Manual describes the required
13146 behavior of all Ada compilers, and the GNAT compiler conforms to
13147 these requirements.
13149 In addition, there are sections throughout the Ada Reference Manual headed
13150 by the phrase 'Implementation advice'.  These sections are not normative,
13151 i.e., they do not specify requirements that all compilers must
13152 follow.  Rather they provide advice on generally desirable behavior.
13153 They are not requirements, because they describe behavior that cannot
13154 be provided on all systems, or may be undesirable on some systems.
13156 As far as practical, GNAT follows the implementation advice in
13157 the Ada Reference Manual.  Each such RM section corresponds to a section
13158 in this chapter whose title specifies the
13159 RM section number and paragraph number and the subject of
13160 the advice.  The contents of each section consists of the RM text within
13161 quotation marks,
13162 followed by the GNAT interpretation of the advice.  Most often, this simply says
13163 'followed', which means that GNAT follows the advice.  However, in a
13164 number of cases, GNAT deliberately deviates from this advice, in which
13165 case the text describes what GNAT does and why.
13167 @geindex Error detection
13169 @menu
13170 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
13171 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
13172 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
13173 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
13174 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
13175 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
13176 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
13177 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
13178 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
13179 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
13180 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
13181 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
13182 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
13183 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
13184 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
13185 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
13186 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
13187 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
13188 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
13189 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
13190 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
13191 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
13192 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
13193 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
13194 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
13195 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
13196 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
13197 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
13198 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
13199 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
13200 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
13201 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
13202 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
13203 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
13204 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
13205 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
13206 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
13207 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
13208 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
13209 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
13210 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
13211 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
13212 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
13213 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
13214 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
13215 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
13216 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
13217 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
13218 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
13219 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
13220 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
13221 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
13222 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
13223 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
13224 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
13225 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
13226 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
13227 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
13228 * RM G; Numerics: RM G Numerics. 
13229 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
13230 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
13231 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
13232 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
13233 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
13235 @end menu
13237 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13238 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{200}
13239 @section RM 1.1.3(20): Error Detection
13242 @quotation
13244 "If an implementation detects the use of an unsupported Specialized Needs
13245 Annex feature at run time, it should raise @cite{Program_Error} if
13246 feasible."
13247 @end quotation
13249 Not relevant.  All specialized needs annex features are either supported,
13250 or diagnosed at compile time.
13252 @geindex Child Units
13254 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13255 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{201}
13256 @section RM 1.1.3(31): Child Units
13259 @quotation
13261 "If an implementation wishes to provide implementation-defined
13262 extensions to the functionality of a language-defined library unit, it
13263 should normally do so by adding children to the library unit."
13264 @end quotation
13266 Followed.
13268 @geindex Bounded errors
13270 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13271 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{202}
13272 @section RM 1.1.5(12): Bounded Errors
13275 @quotation
13277 "If an implementation detects a bounded error or erroneous
13278 execution, it should raise @cite{Program_Error}."
13279 @end quotation
13281 Followed in all cases in which the implementation detects a bounded
13282 error or erroneous execution.  Not all such situations are detected at
13283 runtime.
13285 @geindex Pragmas
13287 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13288 @anchor{gnat_rm/implementation_advice id2}@anchor{203}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{204}
13289 @section RM 2.8(16): Pragmas
13292 @quotation
13294 "Normally, implementation-defined pragmas should have no semantic effect
13295 for error-free programs; that is, if the implementation-defined pragmas
13296 are removed from a working program, the program should still be legal,
13297 and should still have the same semantics."
13298 @end quotation
13300 The following implementation defined pragmas are exceptions to this
13301 rule:
13304 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
13305 @headitem
13307 Pragma
13309 @tab
13311 Explanation
13313 @item
13315 @emph{Abort_Defer}
13317 @tab
13319 Affects semantics
13321 @item
13323 @emph{Ada_83}
13325 @tab
13327 Affects legality
13329 @item
13331 @emph{Assert}
13333 @tab
13335 Affects semantics
13337 @item
13339 @emph{CPP_Class}
13341 @tab
13343 Affects semantics
13345 @item
13347 @emph{CPP_Constructor}
13349 @tab
13351 Affects semantics
13353 @item
13355 @emph{Debug}
13357 @tab
13359 Affects semantics
13361 @item
13363 @emph{Interface_Name}
13365 @tab
13367 Affects semantics
13369 @item
13371 @emph{Machine_Attribute}
13373 @tab
13375 Affects semantics
13377 @item
13379 @emph{Unimplemented_Unit}
13381 @tab
13383 Affects legality
13385 @item
13387 @emph{Unchecked_Union}
13389 @tab
13391 Affects semantics
13393 @end multitable
13396 In each of the above cases, it is essential to the purpose of the pragma
13397 that this advice not be followed.  For details see
13398 @ref{7,,Implementation Defined Pragmas}.
13400 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
13401 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{205}
13402 @section RM 2.8(17-19): Pragmas
13405 @quotation
13407 "Normally, an implementation should not define pragmas that can
13408 make an illegal program legal, except as follows:
13411 @itemize *
13413 @item 
13414 A pragma used to complete a declaration, such as a pragma @cite{Import};
13416 @item 
13417 A pragma used to configure the environment by adding, removing, or
13418 replacing @cite{library_items}."
13419 @end itemize
13420 @end quotation
13422 See @ref{204,,RM 2.8(16); Pragmas}.
13424 @geindex Character Sets
13426 @geindex Alternative Character Sets
13428 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
13429 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{206}
13430 @section RM 3.5.2(5): Alternative Character Sets
13433 @quotation
13435 "If an implementation supports a mode with alternative interpretations
13436 for @cite{Character} and @cite{Wide_Character}, the set of graphic
13437 characters of @cite{Character} should nevertheless remain a proper
13438 subset of the set of graphic characters of @cite{Wide_Character}.  Any
13439 character set 'localizations' should be reflected in the results of
13440 the subprograms defined in the language-defined package
13441 @cite{Characters.Handling} (see A.3) available in such a mode.  In a mode with
13442 an alternative interpretation of @cite{Character}, the implementation should
13443 also support a corresponding change in what is a legal
13444 @cite{identifier_letter}."
13445 @end quotation
13447 Not all wide character modes follow this advice, in particular the JIS
13448 and IEC modes reflect standard usage in Japan, and in these encoding,
13449 the upper half of the Latin-1 set is not part of the wide-character
13450 subset, since the most significant bit is used for wide character
13451 encoding.  However, this only applies to the external forms.  Internally
13452 there is no such restriction.
13454 @geindex Integer types
13456 @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
13457 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{207}
13458 @section RM 3.5.4(28): Integer Types
13461 @quotation
13463 "An implementation should support @cite{Long_Integer} in addition to
13464 @cite{Integer} if the target machine supports 32-bit (or longer)
13465 arithmetic.  No other named integer subtypes are recommended for package
13466 @cite{Standard}.  Instead, appropriate named integer subtypes should be
13467 provided in the library package @cite{Interfaces} (see B.2)."
13468 @end quotation
13470 @cite{Long_Integer} is supported.  Other standard integer types are supported
13471 so this advice is not fully followed.  These types
13472 are supported for convenient interface to C, and so that all hardware
13473 types of the machine are easily available.
13475 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
13476 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{208}
13477 @section RM 3.5.4(29): Integer Types
13480 @quotation
13482 "An implementation for a two's complement machine should support
13483 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
13484 implementation should support a non-binary modules up to @cite{Integer'Last}."
13485 @end quotation
13487 Followed.
13489 @geindex Enumeration values
13491 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
13492 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{209}
13493 @section RM 3.5.5(8): Enumeration Values
13496 @quotation
13498 "For the evaluation of a call on @code{S'Pos} for an enumeration
13499 subtype, if the value of the operand does not correspond to the internal
13500 code for any enumeration literal of its type (perhaps due to an
13501 un-initialized variable), then the implementation should raise
13502 @cite{Program_Error}.  This is particularly important for enumeration
13503 types with noncontiguous internal codes specified by an
13504 enumeration_representation_clause."
13505 @end quotation
13507 Followed.
13509 @geindex Float types
13511 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
13512 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{20a}
13513 @section RM 3.5.7(17): Float Types
13516 @quotation
13518 "An implementation should support @cite{Long_Float} in addition to
13519 @cite{Float} if the target machine supports 11 or more digits of
13520 precision.  No other named floating point subtypes are recommended for
13521 package @cite{Standard}.  Instead, appropriate named floating point subtypes
13522 should be provided in the library package @cite{Interfaces} (see B.2)."
13523 @end quotation
13525 @cite{Short_Float} and @cite{Long_Long_Float} are also provided.  The
13526 former provides improved compatibility with other implementations
13527 supporting this type.  The latter corresponds to the highest precision
13528 floating-point type supported by the hardware.  On most machines, this
13529 will be the same as @cite{Long_Float}, but on some machines, it will
13530 correspond to the IEEE extended form.  The notable case is all ia32
13531 (x86) implementations, where @cite{Long_Long_Float} corresponds to
13532 the 80-bit extended precision format supported in hardware on this
13533 processor.  Note that the 128-bit format on SPARC is not supported,
13534 since this is a software rather than a hardware format.
13536 @geindex Multidimensional arrays
13538 @geindex Arrays
13539 @geindex multidimensional
13541 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
13542 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{20b}
13543 @section RM 3.6.2(11): Multidimensional Arrays
13546 @quotation
13548 "An implementation should normally represent multidimensional arrays in
13549 row-major order, consistent with the notation used for multidimensional
13550 array aggregates (see 4.3.3).  However, if a pragma @cite{Convention}
13551 (@cite{Fortran}, ...) applies to a multidimensional array type, then
13552 column-major order should be used instead (see B.5, @cite{Interfacing with Fortran})."
13553 @end quotation
13555 Followed.
13557 @geindex Duration'Small
13559 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
13560 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{20c}
13561 @section RM 9.6(30-31): Duration'Small
13564 @quotation
13566 "Whenever possible in an implementation, the value of @cite{Duration'Small}
13567 should be no greater than 100 microseconds."
13568 @end quotation
13570 Followed.  (@cite{Duration'Small} = 10**(-9)).
13572 @quotation
13574 "The time base for @cite{delay_relative_statements} should be monotonic;
13575 it need not be the same time base as used for @cite{Calendar.Clock}."
13576 @end quotation
13578 Followed.
13580 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
13581 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{20d}
13582 @section RM 10.2.1(12): Consistent Representation
13585 @quotation
13587 "In an implementation, a type declared in a pre-elaborated package should
13588 have the same representation in every elaboration of a given version of
13589 the package, whether the elaborations occur in distinct executions of
13590 the same program, or in executions of distinct programs or partitions
13591 that include the given version."
13592 @end quotation
13594 Followed, except in the case of tagged types.  Tagged types involve
13595 implicit pointers to a local copy of a dispatch table, and these pointers
13596 have representations which thus depend on a particular elaboration of the
13597 package.  It is not easy to see how it would be possible to follow this
13598 advice without severely impacting efficiency of execution.
13600 @geindex Exception information
13602 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
13603 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{20e}
13604 @section RM 11.4.1(19): Exception Information
13607 @quotation
13609 "@cite{Exception_Message} by default and @cite{Exception_Information}
13610 should produce information useful for
13611 debugging.  @cite{Exception_Message} should be short, about one
13612 line.  @cite{Exception_Information} can be long.  @cite{Exception_Message}
13613 should not include the
13614 @cite{Exception_Name}.  @cite{Exception_Information} should include both
13615 the @cite{Exception_Name} and the @cite{Exception_Message}."
13616 @end quotation
13618 Followed.  For each exception that doesn't have a specified
13619 @cite{Exception_Message}, the compiler generates one containing the location
13620 of the raise statement.  This location has the form 'file_name:line', where
13621 file_name is the short file name (without path information) and line is the line
13622 number in the file.  Note that in the case of the Zero Cost Exception
13623 mechanism, these messages become redundant with the Exception_Information that
13624 contains a full backtrace of the calling sequence, so they are disabled.
13625 To disable explicitly the generation of the source location message, use the
13626 Pragma @cite{Discard_Names}.
13628 @geindex Suppression of checks
13630 @geindex Checks
13631 @geindex suppression of
13633 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
13634 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{20f}
13635 @section RM 11.5(28): Suppression of Checks
13638 @quotation
13640 "The implementation should minimize the code executed for checks that
13641 have been suppressed."
13642 @end quotation
13644 Followed.
13646 @geindex Representation clauses
13648 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
13649 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{210}
13650 @section RM 13.1 (21-24): Representation Clauses
13653 @quotation
13655 "The recommended level of support for all representation items is
13656 qualified as follows:
13658 An implementation need not support representation items containing
13659 nonstatic expressions, except that an implementation should support a
13660 representation item for a given entity if each nonstatic expression in
13661 the representation item is a name that statically denotes a constant
13662 declared before the entity."
13663 @end quotation
13665 Followed.  In fact, GNAT goes beyond the recommended level of support
13666 by allowing nonstatic expressions in some representation clauses even
13667 without the need to declare constants initialized with the values of
13668 such expressions.
13669 For example:
13671 @example
13672   X : Integer;
13673   Y : Float;
13674   for Y'Address use X'Address;>>
13677 "An implementation need not support a specification for the `Size`
13678 for a given composite subtype, nor the size or storage place for an
13679 object (including a component) of a given composite subtype, unless the
13680 constraints on the subtype and its composite subcomponents (if any) are
13681 all static constraints."
13682 @end example
13684 Followed.  Size Clauses are not permitted on nonstatic components, as
13685 described above.
13687 @quotation
13689 "An aliased component, or a component whose type is by-reference, should
13690 always be allocated at an addressable location."
13691 @end quotation
13693 Followed.
13695 @geindex Packed types
13697 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
13698 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{211}
13699 @section RM 13.2(6-8): Packed Types
13702 @quotation
13704 "If a type is packed, then the implementation should try to minimize
13705 storage allocated to objects of the type, possibly at the expense of
13706 speed of accessing components, subject to reasonable complexity in
13707 addressing calculations.
13709 The recommended level of support pragma @cite{Pack} is:
13711 For a packed record type, the components should be packed as tightly as
13712 possible subject to the Sizes of the component subtypes, and subject to
13713 any @cite{record_representation_clause} that applies to the type; the
13714 implementation may, but need not, reorder components or cross aligned
13715 word boundaries to improve the packing.  A component whose @cite{Size} is
13716 greater than the word size may be allocated an integral number of words."
13717 @end quotation
13719 Followed.  Tight packing of arrays is supported for all component sizes
13720 up to 64-bits. If the array component size is 1 (that is to say, if
13721 the component is a boolean type or an enumeration type with two values)
13722 then values of the type are implicitly initialized to zero. This
13723 happens both for objects of the packed type, and for objects that have a
13724 subcomponent of the packed type.
13726 @quotation
13728 "An implementation should support Address clauses for imported
13729 subprograms."
13730 @end quotation
13732 Followed.
13734 @geindex Address clauses
13736 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
13737 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{212}
13738 @section RM 13.3(14-19): Address Clauses
13741 @quotation
13743 "For an array @cite{X}, @code{X'Address} should point at the first
13744 component of the array, and not at the array bounds."
13745 @end quotation
13747 Followed.
13749 @quotation
13751 "The recommended level of support for the @cite{Address} attribute is:
13753 @code{X'Address} should produce a useful result if @cite{X} is an
13754 object that is aliased or of a by-reference type, or is an entity whose
13755 @cite{Address} has been specified."
13756 @end quotation
13758 Followed.  A valid address will be produced even if none of those
13759 conditions have been met.  If necessary, the object is forced into
13760 memory to ensure the address is valid.
13762 @quotation
13764 "An implementation should support @cite{Address} clauses for imported
13765 subprograms."
13766 @end quotation
13768 Followed.
13770 @quotation
13772 "Objects (including subcomponents) that are aliased or of a by-reference
13773 type should be allocated on storage element boundaries."
13774 @end quotation
13776 Followed.
13778 @quotation
13780 "If the @cite{Address} of an object is specified, or it is imported or exported,
13781 then the implementation should not perform optimizations based on
13782 assumptions of no aliases."
13783 @end quotation
13785 Followed.
13787 @geindex Alignment clauses
13789 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
13790 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{213}
13791 @section RM 13.3(29-35): Alignment Clauses
13794 @quotation
13796 "The recommended level of support for the @cite{Alignment} attribute for
13797 subtypes is:
13799 An implementation should support specified Alignments that are factors
13800 and multiples of the number of storage elements per word, subject to the
13801 following:"
13802 @end quotation
13804 Followed.
13806 @quotation
13808 "An implementation need not support specified Alignments for
13809 combinations of Sizes and Alignments that cannot be easily
13810 loaded and stored by available machine instructions."
13811 @end quotation
13813 Followed.
13815 @quotation
13817 "An implementation need not support specified Alignments that are
13818 greater than the maximum @cite{Alignment} the implementation ever returns by
13819 default."
13820 @end quotation
13822 Followed.
13824 @quotation
13826 "The recommended level of support for the @cite{Alignment} attribute for
13827 objects is:
13829 Same as above, for subtypes, but in addition:"
13830 @end quotation
13832 Followed.
13834 @quotation
13836 "For stand-alone library-level objects of statically constrained
13837 subtypes, the implementation should support all alignments
13838 supported by the target linker.  For example, page alignment is likely to
13839 be supported for such objects, but not for subtypes."
13840 @end quotation
13842 Followed.
13844 @geindex Size clauses
13846 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
13847 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{214}
13848 @section RM 13.3(42-43): Size Clauses
13851 @quotation
13853 "The recommended level of support for the @cite{Size} attribute of
13854 objects is:
13856 A @cite{Size} clause should be supported for an object if the specified
13857 @cite{Size} is at least as large as its subtype's @cite{Size}, and
13858 corresponds to a size in storage elements that is a multiple of the
13859 object's @cite{Alignment} (if the @cite{Alignment} is nonzero)."
13860 @end quotation
13862 Followed.
13864 @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
13865 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{215}
13866 @section RM 13.3(50-56): Size Clauses
13869 @quotation
13871 "If the @cite{Size} of a subtype is specified, and allows for efficient
13872 independent addressability (see 9.10) on the target architecture, then
13873 the @cite{Size} of the following objects of the subtype should equal the
13874 @cite{Size} of the subtype:
13876 Aliased objects (including components)."
13877 @end quotation
13879 Followed.
13881 @quotation
13883 "@cite{Size} clause on a composite subtype should not affect the
13884 internal layout of components."
13885 @end quotation
13887 Followed. But note that this can be overridden by use of the implementation
13888 pragma Implicit_Packing in the case of packed arrays.
13890 @quotation
13892 "The recommended level of support for the @cite{Size} attribute of subtypes is:
13894 The @cite{Size} (if not specified) of a static discrete or fixed point
13895 subtype should be the number of bits needed to represent each value
13896 belonging to the subtype using an unbiased representation, leaving space
13897 for a sign bit only if the subtype contains negative values.  If such a
13898 subtype is a first subtype, then an implementation should support a
13899 specified @cite{Size} for it that reflects this representation."
13900 @end quotation
13902 Followed.
13904 @quotation
13906 "For a subtype implemented with levels of indirection, the @cite{Size}
13907 should include the size of the pointers, but not the size of what they
13908 point at."
13909 @end quotation
13911 Followed.
13913 @geindex Component_Size clauses
13915 @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
13916 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{216}
13917 @section RM 13.3(71-73): Component Size Clauses
13920 @quotation
13922 "The recommended level of support for the @cite{Component_Size}
13923 attribute is:
13925 An implementation need not support specified @cite{Component_Sizes} that are
13926 less than the @cite{Size} of the component subtype."
13927 @end quotation
13929 Followed.
13931 @quotation
13933 "An implementation should support specified Component_Sizes that
13934 are factors and multiples of the word size.  For such
13935 Component_Sizes, the array should contain no gaps between
13936 components.  For other Component_Sizes (if supported), the array
13937 should contain no gaps between components when packing is also
13938 specified; the implementation should forbid this combination in cases
13939 where it cannot support a no-gaps representation."
13940 @end quotation
13942 Followed.
13944 @geindex Enumeration representation clauses
13946 @geindex Representation clauses
13947 @geindex enumeration
13949 @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
13950 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{217}
13951 @section RM 13.4(9-10): Enumeration Representation Clauses
13954 @quotation
13956 "The recommended level of support for enumeration representation clauses
13959 An implementation need not support enumeration representation clauses
13960 for boolean types, but should at minimum support the internal codes in
13961 the range @cite{System.Min_Int .. System.Max_Int}."
13962 @end quotation
13964 Followed.
13966 @geindex Record representation clauses
13968 @geindex Representation clauses
13969 @geindex records
13971 @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
13972 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{218}
13973 @section RM 13.5.1(17-22): Record Representation Clauses
13976 @quotation
13978 "The recommended level of support for
13979 @cite{record_representation_clauses} is:
13981 An implementation should support storage places that can be extracted
13982 with a load, mask, shift sequence of machine code, and set with a load,
13983 shift, mask, store sequence, given the available machine instructions
13984 and run-time model."
13985 @end quotation
13987 Followed.
13989 @quotation
13991 "A storage place should be supported if its size is equal to the
13992 @cite{Size} of the component subtype, and it starts and ends on a
13993 boundary that obeys the @cite{Alignment} of the component subtype."
13994 @end quotation
13996 Followed.
13998 @quotation
14000 "If the default bit ordering applies to the declaration of a given type,
14001 then for a component whose subtype's @cite{Size} is less than the word
14002 size, any storage place that does not cross an aligned word boundary
14003 should be supported."
14004 @end quotation
14006 Followed.
14008 @quotation
14010 "An implementation may reserve a storage place for the tag field of a
14011 tagged type, and disallow other components from overlapping that place."
14012 @end quotation
14014 Followed.  The storage place for the tag field is the beginning of the tagged
14015 record, and its size is Address'Size.  GNAT will reject an explicit component
14016 clause for the tag field.
14018 @quotation
14020 "An implementation need not support a @cite{component_clause} for a
14021 component of an extension part if the storage place is not after the
14022 storage places of all components of the parent type, whether or not
14023 those storage places had been specified."
14024 @end quotation
14026 Followed.  The above advice on record representation clauses is followed,
14027 and all mentioned features are implemented.
14029 @geindex Storage place attributes
14031 @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
14032 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{219}
14033 @section RM 13.5.2(5): Storage Place Attributes
14036 @quotation
14038 "If a component is represented using some form of pointer (such as an
14039 offset) to the actual data of the component, and this data is contiguous
14040 with the rest of the object, then the storage place attributes should
14041 reflect the place of the actual data, not the pointer.  If a component is
14042 allocated discontinuously from the rest of the object, then a warning
14043 should be generated upon reference to one of its storage place
14044 attributes."
14045 @end quotation
14047 Followed.  There are no such components in GNAT.
14049 @geindex Bit ordering
14051 @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
14052 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{21a}
14053 @section RM 13.5.3(7-8): Bit Ordering
14056 @quotation
14058 "The recommended level of support for the non-default bit ordering is:
14060 If @cite{Word_Size} = @cite{Storage_Unit}, then the implementation
14061 should support the non-default bit ordering in addition to the default
14062 bit ordering."
14063 @end quotation
14065 Followed.  Word size does not equal storage size in this implementation.
14066 Thus non-default bit ordering is not supported.
14068 @geindex Address
14069 @geindex as private type
14071 @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
14072 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{21b}
14073 @section RM 13.7(37): Address as Private
14076 @quotation
14078 "@cite{Address} should be of a private type."
14079 @end quotation
14081 Followed.
14083 @geindex Operations
14084 @geindex on `Address`
14086 @geindex Address
14087 @geindex operations of
14089 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14090 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{21c}
14091 @section RM 13.7.1(16): Address Operations
14094 @quotation
14096 "Operations in @cite{System} and its children should reflect the target
14097 environment semantics as closely as is reasonable.  For example, on most
14098 machines, it makes sense for address arithmetic to 'wrap around'.
14099 Operations that do not make sense should raise @cite{Program_Error}."
14100 @end quotation
14102 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
14103 operation raises @cite{Program_Error}, since all operations make sense.
14105 @geindex Unchecked conversion
14107 @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
14108 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{21d}
14109 @section RM 13.9(14-17): Unchecked Conversion
14112 @quotation
14114 "The @cite{Size} of an array object should not include its bounds; hence,
14115 the bounds should not be part of the converted data."
14116 @end quotation
14118 Followed.
14120 @quotation
14122 "The implementation should not generate unnecessary run-time checks to
14123 ensure that the representation of @cite{S} is a representation of the
14124 target type.  It should take advantage of the permission to return by
14125 reference when possible.  Restrictions on unchecked conversions should be
14126 avoided unless required by the target environment."
14127 @end quotation
14129 Followed.  There are no restrictions on unchecked conversion.  A warning is
14130 generated if the source and target types do not have the same size since
14131 the semantics in this case may be target dependent.
14133 @quotation
14135 "The recommended level of support for unchecked conversions is:
14137 Unchecked conversions should be supported and should be reversible in
14138 the cases where this clause defines the result.  To enable meaningful use
14139 of unchecked conversion, a contiguous representation should be used for
14140 elementary subtypes, for statically constrained array subtypes whose
14141 component subtype is one of the subtypes described in this paragraph,
14142 and for record subtypes without discriminants whose component subtypes
14143 are described in this paragraph."
14144 @end quotation
14146 Followed.
14148 @geindex Heap usage
14149 @geindex implicit
14151 @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
14152 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{21e}
14153 @section RM 13.11(23-25): Implicit Heap Usage
14156 @quotation
14158 "An implementation should document any cases in which it dynamically
14159 allocates heap storage for a purpose other than the evaluation of an
14160 allocator."
14161 @end quotation
14163 Followed, the only other points at which heap storage is dynamically
14164 allocated are as follows:
14167 @itemize *
14169 @item 
14170 At initial elaboration time, to allocate dynamically sized global
14171 objects.
14173 @item 
14174 To allocate space for a task when a task is created.
14176 @item 
14177 To extend the secondary stack dynamically when needed.  The secondary
14178 stack is used for returning variable length results.
14179 @end itemize
14182 @quotation
14184 "A default (implementation-provided) storage pool for an
14185 access-to-constant type should not have overhead to support deallocation of
14186 individual objects."
14187 @end quotation
14189 Followed.
14191 @quotation
14193 "A storage pool for an anonymous access type should be created at the
14194 point of an allocator for the type, and be reclaimed when the designated
14195 object becomes inaccessible."
14196 @end quotation
14198 Followed.
14200 @geindex Unchecked deallocation
14202 @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
14203 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{21f}
14204 @section RM 13.11.2(17): Unchecked Deallocation
14207 @quotation
14209 "For a standard storage pool, @cite{Free} should actually reclaim the
14210 storage."
14211 @end quotation
14213 Followed.
14215 @geindex Stream oriented attributes
14217 @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
14218 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{220}
14219 @section RM 13.13.2(17): Stream Oriented Attributes
14222 @quotation
14224 "If a stream element is the same size as a storage element, then the
14225 normal in-memory representation should be used by @cite{Read} and
14226 @cite{Write} for scalar objects.  Otherwise, @cite{Read} and @cite{Write}
14227 should use the smallest number of stream elements needed to represent
14228 all values in the base range of the scalar type."
14229 @end quotation
14231 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
14232 which specifies using the size of the first subtype.
14233 However, such an implementation is based on direct binary
14234 representations and is therefore target- and endianness-dependent.
14235 To address this issue, GNAT also supplies an alternate implementation
14236 of the stream attributes @cite{Read} and @cite{Write},
14237 which uses the target-independent XDR standard representation
14238 for scalar types.
14240 @geindex XDR representation
14242 @geindex Read attribute
14244 @geindex Write attribute
14246 @geindex Stream oriented attributes
14248 The XDR implementation is provided as an alternative body of the
14249 @cite{System.Stream_Attributes} package, in the file
14250 @code{s-stratt-xdr.adb} in the GNAT library.
14251 There is no @code{s-stratt-xdr.ads} file.
14252 In order to install the XDR implementation, do the following:
14255 @itemize *
14257 @item 
14258 Replace the default implementation of the
14259 @cite{System.Stream_Attributes} package with the XDR implementation.
14260 For example on a Unix platform issue the commands:
14262 @example
14263 $ mv s-stratt.adb s-stratt-default.adb
14264 $ mv s-stratt-xdr.adb s-stratt.adb
14265 @end example
14267 @item 
14268 Rebuild the GNAT run-time library as documented in
14269 the @cite{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14270 @end itemize
14272 @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
14273 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{221}
14274 @section RM A.1(52): Names of Predefined Numeric Types
14277 @quotation
14279 "If an implementation provides additional named predefined integer types,
14280 then the names should end with @code{Integer} as in
14281 @code{Long_Integer}.  If an implementation provides additional named
14282 predefined floating point types, then the names should end with
14283 @code{Float} as in @code{Long_Float}."
14284 @end quotation
14286 Followed.
14288 @geindex Ada.Characters.Handling
14290 @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
14291 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{222}
14292 @section RM A.3.2(49): @cite{Ada.Characters.Handling}
14295 @quotation
14297 "If an implementation provides a localized definition of @cite{Character}
14298 or @cite{Wide_Character}, then the effects of the subprograms in
14299 @cite{Characters.Handling} should reflect the localizations.
14300 See also 3.5.2."
14301 @end quotation
14303 Followed.  GNAT provides no such localized definitions.
14305 @geindex Bounded-length strings
14307 @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
14308 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{223}
14309 @section RM A.4.4(106): Bounded-Length String Handling
14312 @quotation
14314 "Bounded string objects should not be implemented by implicit pointers
14315 and dynamic allocation."
14316 @end quotation
14318 Followed.  No implicit pointers or dynamic allocation are used.
14320 @geindex Random number generation
14322 @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
14323 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{224}
14324 @section RM A.5.2(46-47): Random Number Generation
14327 @quotation
14329 "Any storage associated with an object of type @cite{Generator} should be
14330 reclaimed on exit from the scope of the object."
14331 @end quotation
14333 Followed.
14335 @quotation
14337 "If the generator period is sufficiently long in relation to the number
14338 of distinct initiator values, then each possible value of
14339 @cite{Initiator} passed to @cite{Reset} should initiate a sequence of
14340 random numbers that does not, in a practical sense, overlap the sequence
14341 initiated by any other value.  If this is not possible, then the mapping
14342 between initiator values and generator states should be a rapidly
14343 varying function of the initiator value."
14344 @end quotation
14346 Followed.  The generator period is sufficiently long for the first
14347 condition here to hold true.
14349 @geindex Get_Immediate
14351 @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
14352 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{225}
14353 @section RM A.10.7(23): @cite{Get_Immediate}
14356 @quotation
14358 "The @cite{Get_Immediate} procedures should be implemented with
14359 unbuffered input.  For a device such as a keyboard, input should be
14360 available if a key has already been typed, whereas for a disk
14361 file, input should always be available except at end of file.  For a file
14362 associated with a keyboard-like device, any line-editing features of the
14363 underlying operating system should be disabled during the execution of
14364 @cite{Get_Immediate}."
14365 @end quotation
14367 Followed on all targets except VxWorks. For VxWorks, there is no way to
14368 provide this functionality that does not result in the input buffer being
14369 flushed before the @cite{Get_Immediate} call. A special unit
14370 @cite{Interfaces.Vxworks.IO} is provided that contains routines to enable
14371 this functionality.
14373 @geindex Export
14375 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
14376 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{226}
14377 @section RM B.1(39-41): Pragma @cite{Export}
14380 @quotation
14382 "If an implementation supports pragma @cite{Export} to a given language,
14383 then it should also allow the main subprogram to be written in that
14384 language.  It should support some mechanism for invoking the elaboration
14385 of the Ada library units included in the system, and for invoking the
14386 finalization of the environment task.  On typical systems, the
14387 recommended mechanism is to provide two subprograms whose link names are
14388 @cite{adainit} and @cite{adafinal}.  @cite{adainit} should contain the
14389 elaboration code for library units.  @cite{adafinal} should contain the
14390 finalization code.  These subprograms should have no effect the second
14391 and subsequent time they are called."
14392 @end quotation
14394 Followed.
14396 @quotation
14398 "Automatic elaboration of pre-elaborated packages should be
14399 provided when pragma @cite{Export} is supported."
14400 @end quotation
14402 Followed when the main program is in Ada.  If the main program is in a
14403 foreign language, then
14404 @cite{adainit} must be called to elaborate pre-elaborated
14405 packages.
14407 @quotation
14409 "For each supported convention @cite{L} other than @cite{Intrinsic}, an
14410 implementation should support @cite{Import} and @cite{Export} pragmas
14411 for objects of @cite{L}-compatible types and for subprograms, and pragma
14412 @cite{Convention} for @cite{L}-eligible types and for subprograms,
14413 presuming the other language has corresponding features.  Pragma
14414 @cite{Convention} need not be supported for scalar types."
14415 @end quotation
14417 Followed.
14419 @geindex Package Interfaces
14421 @geindex Interfaces
14423 @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
14424 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{227}
14425 @section RM B.2(12-13): Package @cite{Interfaces}
14428 @quotation
14430 "For each implementation-defined convention identifier, there should be a
14431 child package of package Interfaces with the corresponding name.  This
14432 package should contain any declarations that would be useful for
14433 interfacing to the language (implementation) represented by the
14434 convention.  Any declarations useful for interfacing to any language on
14435 the given hardware architecture should be provided directly in
14436 @cite{Interfaces}."
14437 @end quotation
14439 Followed.
14441 @quotation
14443 "An implementation supporting an interface to C, COBOL, or Fortran should
14444 provide the corresponding package or packages described in the following
14445 clauses."
14446 @end quotation
14448 Followed.  GNAT provides all the packages described in this section.
14450 @geindex C
14451 @geindex interfacing with
14453 @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
14454 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{228}
14455 @section RM B.3(63-71): Interfacing with C
14458 @quotation
14460 "An implementation should support the following interface correspondences
14461 between Ada and C."
14462 @end quotation
14464 Followed.
14466 @quotation
14468 "An Ada procedure corresponds to a void-returning C function."
14469 @end quotation
14471 Followed.
14473 @quotation
14475 "An Ada function corresponds to a non-void C function."
14476 @end quotation
14478 Followed.
14480 @quotation
14482 "An Ada @cite{in} scalar parameter is passed as a scalar argument to a C
14483 function."
14484 @end quotation
14486 Followed.
14488 @quotation
14490 "An Ada @cite{in} parameter of an access-to-object type with designated
14491 type @cite{T} is passed as a @code{t*} argument to a C function,
14492 where @code{t} is the C type corresponding to the Ada type @cite{T}."
14493 @end quotation
14495 Followed.
14497 @quotation
14499 "An Ada access @cite{T} parameter, or an Ada @cite{out} or @cite{in out}
14500 parameter of an elementary type @cite{T}, is passed as a @code{t*}
14501 argument to a C function, where @code{t} is the C type corresponding to
14502 the Ada type @cite{T}.  In the case of an elementary @cite{out} or
14503 @cite{in out} parameter, a pointer to a temporary copy is used to
14504 preserve by-copy semantics."
14505 @end quotation
14507 Followed.
14509 @quotation
14511 "An Ada parameter of a record type @cite{T}, of any mode, is passed as a
14512 @code{t*} argument to a C function, where @code{t} is the C
14513 structure corresponding to the Ada type @cite{T}."
14514 @end quotation
14516 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
14517 pragma, or Convention, or by explicitly specifying the mechanism for a given
14518 call using an extended import or export pragma.
14520 @quotation
14522 "An Ada parameter of an array type with component type @cite{T}, of any
14523 mode, is passed as a @code{t*} argument to a C function, where
14524 @code{t} is the C type corresponding to the Ada type @cite{T}."
14525 @end quotation
14527 Followed.
14529 @quotation
14531 "An Ada parameter of an access-to-subprogram type is passed as a pointer
14532 to a C function whose prototype corresponds to the designated
14533 subprogram's specification."
14534 @end quotation
14536 Followed.
14538 @geindex COBOL
14539 @geindex interfacing with
14541 @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
14542 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{229}
14543 @section RM B.4(95-98): Interfacing with COBOL
14546 @quotation
14548 "An Ada implementation should support the following interface
14549 correspondences between Ada and COBOL."
14550 @end quotation
14552 Followed.
14554 @quotation
14556 "An Ada access @cite{T} parameter is passed as a @code{BY REFERENCE} data item of
14557 the COBOL type corresponding to @cite{T}."
14558 @end quotation
14560 Followed.
14562 @quotation
14564 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
14565 the corresponding COBOL type."
14566 @end quotation
14568 Followed.
14570 @quotation
14572 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
14573 COBOL type corresponding to the Ada parameter type; for scalars, a local
14574 copy is used if necessary to ensure by-copy semantics."
14575 @end quotation
14577 Followed.
14579 @geindex Fortran
14580 @geindex interfacing with
14582 @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
14583 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{22a}
14584 @section RM B.5(22-26): Interfacing with Fortran
14587 @quotation
14589 "An Ada implementation should support the following interface
14590 correspondences between Ada and Fortran:"
14591 @end quotation
14593 Followed.
14595 @quotation
14597 "An Ada procedure corresponds to a Fortran subroutine."
14598 @end quotation
14600 Followed.
14602 @quotation
14604 "An Ada function corresponds to a Fortran function."
14605 @end quotation
14607 Followed.
14609 @quotation
14611 "An Ada parameter of an elementary, array, or record type @cite{T} is
14612 passed as a @cite{T} argument to a Fortran procedure, where @cite{T} is
14613 the Fortran type corresponding to the Ada type @cite{T}, and where the
14614 INTENT attribute of the corresponding dummy argument matches the Ada
14615 formal parameter mode; the Fortran implementation's parameter passing
14616 conventions are used.  For elementary types, a local copy is used if
14617 necessary to ensure by-copy semantics."
14618 @end quotation
14620 Followed.
14622 @quotation
14624 "An Ada parameter of an access-to-subprogram type is passed as a
14625 reference to a Fortran procedure whose interface corresponds to the
14626 designated subprogram's specification."
14627 @end quotation
14629 Followed.
14631 @geindex Machine operations
14633 @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
14634 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{22b}
14635 @section RM C.1(3-5): Access to Machine Operations
14638 @quotation
14640 "The machine code or intrinsic support should allow access to all
14641 operations normally available to assembly language programmers for the
14642 target environment, including privileged instructions, if any."
14643 @end quotation
14645 Followed.
14647 @quotation
14649 "The interfacing pragmas (see Annex B) should support interface to
14650 assembler; the default assembler should be associated with the
14651 convention identifier @cite{Assembler}."
14652 @end quotation
14654 Followed.
14656 @quotation
14658 "If an entity is exported to assembly language, then the implementation
14659 should allocate it at an addressable location, and should ensure that it
14660 is retained by the linking process, even if not otherwise referenced
14661 from the Ada code.  The implementation should assume that any call to a
14662 machine code or assembler subprogram is allowed to read or update every
14663 object that is specified as exported."
14664 @end quotation
14666 Followed.
14668 @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
14669 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{22c}
14670 @section RM C.1(10-16): Access to Machine Operations
14673 @quotation
14675 "The implementation should ensure that little or no overhead is
14676 associated with calling intrinsic and machine-code subprograms."
14677 @end quotation
14679 Followed for both intrinsics and machine-code subprograms.
14681 @quotation
14683 "It is recommended that intrinsic subprograms be provided for convenient
14684 access to any machine operations that provide special capabilities or
14685 efficiency and that are not otherwise available through the language
14686 constructs."
14687 @end quotation
14689 Followed.  A full set of machine operation intrinsic subprograms is provided.
14691 @quotation
14693 "Atomic read-modify-write operations---e.g., test and set, compare and
14694 swap, decrement and test, enqueue/dequeue."
14695 @end quotation
14697 Followed on any target supporting such operations.
14699 @quotation
14701 "Standard numeric functions---e.g.:, sin, log."
14702 @end quotation
14704 Followed on any target supporting such operations.
14706 @quotation
14708 "String manipulation operations---e.g.:, translate and test."
14709 @end quotation
14711 Followed on any target supporting such operations.
14713 @quotation
14715 "Vector operations---e.g.:, compare vector against thresholds."
14716 @end quotation
14718 Followed on any target supporting such operations.
14720 @quotation
14722 "Direct operations on I/O ports."
14723 @end quotation
14725 Followed on any target supporting such operations.
14727 @geindex Interrupt support
14729 @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
14730 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{22d}
14731 @section RM C.3(28): Interrupt Support
14734 @quotation
14736 "If the @cite{Ceiling_Locking} policy is not in effect, the
14737 implementation should provide means for the application to specify which
14738 interrupts are to be blocked during protected actions, if the underlying
14739 system allows for a finer-grain control of interrupt blocking."
14740 @end quotation
14742 Followed.  The underlying system does not allow for finer-grain control
14743 of interrupt blocking.
14745 @geindex Protected procedure handlers
14747 @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
14748 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{22e}
14749 @section RM C.3.1(20-21): Protected Procedure Handlers
14752 @quotation
14754 "Whenever possible, the implementation should allow interrupt handlers to
14755 be called directly by the hardware."
14756 @end quotation
14758 Followed on any target where the underlying operating system permits
14759 such direct calls.
14761 @quotation
14763 "Whenever practical, violations of any
14764 implementation-defined restrictions should be detected before run time."
14765 @end quotation
14767 Followed.  Compile time warnings are given when possible.
14769 @geindex Package `Interrupts`
14771 @geindex Interrupts
14773 @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
14774 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{22f}
14775 @section RM C.3.2(25): Package @cite{Interrupts}
14778 @quotation
14780 "If implementation-defined forms of interrupt handler procedures are
14781 supported, such as protected procedures with parameters, then for each
14782 such form of a handler, a type analogous to @cite{Parameterless_Handler}
14783 should be specified in a child package of @cite{Interrupts}, with the
14784 same operations as in the predefined package Interrupts."
14785 @end quotation
14787 Followed.
14789 @geindex Pre-elaboration requirements
14791 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
14792 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{230}
14793 @section RM C.4(14): Pre-elaboration Requirements
14796 @quotation
14798 "It is recommended that pre-elaborated packages be implemented in such a
14799 way that there should be little or no code executed at run time for the
14800 elaboration of entities not already covered by the Implementation
14801 Requirements."
14802 @end quotation
14804 Followed.  Executable code is generated in some cases, e.g., loops
14805 to initialize large arrays.
14807 @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
14808 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{231}
14809 @section RM C.5(8): Pragma @cite{Discard_Names}
14812 @quotation
14814 "If the pragma applies to an entity, then the implementation should
14815 reduce the amount of storage used for storing names associated with that
14816 entity."
14817 @end quotation
14819 Followed.
14821 @geindex Package Task_Attributes
14823 @geindex Task_Attributes
14825 @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
14826 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{232}
14827 @section RM C.7.2(30): The Package Task_Attributes
14830 @quotation
14832 "Some implementations are targeted to domains in which memory use at run
14833 time must be completely deterministic.  For such implementations, it is
14834 recommended that the storage for task attributes will be pre-allocated
14835 statically and not from the heap.  This can be accomplished by either
14836 placing restrictions on the number and the size of the task's
14837 attributes, or by using the pre-allocated storage for the first @cite{N}
14838 attribute objects, and the heap for the others.  In the latter case,
14839 @cite{N} should be documented."
14840 @end quotation
14842 Not followed.  This implementation is not targeted to such a domain.
14844 @geindex Locking Policies
14846 @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
14847 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{233}
14848 @section RM D.3(17): Locking Policies
14851 @quotation
14853 "The implementation should use names that end with @code{_Locking} for
14854 locking policies defined by the implementation."
14855 @end quotation
14857 Followed.  Two implementation-defined locking policies are defined,
14858 whose names (@cite{Inheritance_Locking} and
14859 @cite{Concurrent_Readers_Locking}) follow this suggestion.
14861 @geindex Entry queuing policies
14863 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
14864 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{234}
14865 @section RM D.4(16): Entry Queuing Policies
14868 @quotation
14870 "Names that end with @code{_Queuing} should be used
14871 for all implementation-defined queuing policies."
14872 @end quotation
14874 Followed.  No such implementation-defined queuing policies exist.
14876 @geindex Preemptive abort
14878 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
14879 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{235}
14880 @section RM D.6(9-10): Preemptive Abort
14883 @quotation
14885 "Even though the @cite{abort_statement} is included in the list of
14886 potentially blocking operations (see 9.5.1), it is recommended that this
14887 statement be implemented in a way that never requires the task executing
14888 the @cite{abort_statement} to block."
14889 @end quotation
14891 Followed.
14893 @quotation
14895 "On a multi-processor, the delay associated with aborting a task on
14896 another processor should be bounded; the implementation should use
14897 periodic polling, if necessary, to achieve this."
14898 @end quotation
14900 Followed.
14902 @geindex Tasking restrictions
14904 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
14905 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{236}
14906 @section RM D.7(21): Tasking Restrictions
14909 @quotation
14911 "When feasible, the implementation should take advantage of the specified
14912 restrictions to produce a more efficient implementation."
14913 @end quotation
14915 GNAT currently takes advantage of these restrictions by providing an optimized
14916 run time when the Ravenscar profile and the GNAT restricted run time set
14917 of restrictions are specified.  See pragma @cite{Profile (Ravenscar)} and
14918 pragma @cite{Profile (Restricted)} for more details.
14920 @geindex Time
14921 @geindex monotonic
14923 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
14924 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{237}
14925 @section RM D.8(47-49): Monotonic Time
14928 @quotation
14930 "When appropriate, implementations should provide configuration
14931 mechanisms to change the value of @cite{Tick}."
14932 @end quotation
14934 Such configuration mechanisms are not appropriate to this implementation
14935 and are thus not supported.
14937 @quotation
14939 "It is recommended that @cite{Calendar.Clock} and @cite{Real_Time.Clock}
14940 be implemented as transformations of the same time base."
14941 @end quotation
14943 Followed.
14945 @quotation
14947 "It is recommended that the best time base which exists in
14948 the underlying system be available to the application through
14949 @cite{Clock}.  @cite{Best} may mean highest accuracy or largest range."
14950 @end quotation
14952 Followed.
14954 @geindex Partition communication subsystem
14956 @geindex PCS
14958 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
14959 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{238}
14960 @section RM E.5(28-29): Partition Communication Subsystem
14963 @quotation
14965 "Whenever possible, the PCS on the called partition should allow for
14966 multiple tasks to call the RPC-receiver with different messages and
14967 should allow them to block until the corresponding subprogram body
14968 returns."
14969 @end quotation
14971 Followed by GLADE, a separately supplied PCS that can be used with
14972 GNAT.
14974 @quotation
14976 "The @cite{Write} operation on a stream of type @cite{Params_Stream_Type}
14977 should raise @cite{Storage_Error} if it runs out of space trying to
14978 write the @cite{Item} into the stream."
14979 @end quotation
14981 Followed by GLADE, a separately supplied PCS that can be used with
14982 GNAT.
14984 @geindex COBOL support
14986 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
14987 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{239}
14988 @section RM F(7): COBOL Support
14991 @quotation
14993 "If COBOL (respectively, C) is widely supported in the target
14994 environment, implementations supporting the Information Systems Annex
14995 should provide the child package @cite{Interfaces.COBOL} (respectively,
14996 @cite{Interfaces.C}) specified in Annex B and should support a
14997 @cite{convention_identifier} of COBOL (respectively, C) in the interfacing
14998 pragmas (see Annex B), thus allowing Ada programs to interface with
14999 programs written in that language."
15000 @end quotation
15002 Followed.
15004 @geindex Decimal radix support
15006 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15007 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{23a}
15008 @section RM F.1(2): Decimal Radix Support
15011 @quotation
15013 "Packed decimal should be used as the internal representation for objects
15014 of subtype @cite{S} when @cite{S}'Machine_Radix = 10."
15015 @end quotation
15017 Not followed.  GNAT ignores @cite{S}'Machine_Radix and always uses binary
15018 representations.
15020 @geindex Numerics
15022 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15023 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{23b}
15024 @section RM G: Numerics
15027 @quotation
15029 "If Fortran (respectively, C) is widely supported in the target
15030 environment, implementations supporting the Numerics Annex
15031 should provide the child package @cite{Interfaces.Fortran} (respectively,
15032 @cite{Interfaces.C}) specified in Annex B and should support a
15033 @cite{convention_identifier} of Fortran (respectively, C) in the interfacing
15034 pragmas (see Annex B), thus allowing Ada programs to interface with
15035 programs written in that language."
15036 @end quotation
15038 Followed.
15040 @geindex Complex types
15042 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15043 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{23c}
15044 @section RM G.1.1(56-58): Complex Types
15047 @quotation
15049 "Because the usual mathematical meaning of multiplication of a complex
15050 operand and a real operand is that of the scaling of both components of
15051 the former by the latter, an implementation should not perform this
15052 operation by first promoting the real operand to complex type and then
15053 performing a full complex multiplication.  In systems that, in the
15054 future, support an Ada binding to IEC 559:1989, the latter technique
15055 will not generate the required result when one of the components of the
15056 complex operand is infinite.  (Explicit multiplication of the infinite
15057 component by the zero component obtained during promotion yields a NaN
15058 that propagates into the final result.) Analogous advice applies in the
15059 case of multiplication of a complex operand and a pure-imaginary
15060 operand, and in the case of division of a complex operand by a real or
15061 pure-imaginary operand."
15062 @end quotation
15064 Not followed.
15066 @quotation
15068 "Similarly, because the usual mathematical meaning of addition of a
15069 complex operand and a real operand is that the imaginary operand remains
15070 unchanged, an implementation should not perform this operation by first
15071 promoting the real operand to complex type and then performing a full
15072 complex addition.  In implementations in which the @cite{Signed_Zeros}
15073 attribute of the component type is @cite{True} (and which therefore
15074 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15075 predefined arithmetic operations), the latter technique will not
15076 generate the required result when the imaginary component of the complex
15077 operand is a negatively signed zero.  (Explicit addition of the negative
15078 zero to the zero obtained during promotion yields a positive zero.)
15079 Analogous advice applies in the case of addition of a complex operand
15080 and a pure-imaginary operand, and in the case of subtraction of a
15081 complex operand and a real or pure-imaginary operand."
15082 @end quotation
15084 Not followed.
15086 @quotation
15088 "Implementations in which @cite{Real'Signed_Zeros} is @cite{True} should
15089 attempt to provide a rational treatment of the signs of zero results and
15090 result components.  As one example, the result of the @cite{Argument}
15091 function should have the sign of the imaginary component of the
15092 parameter @cite{X} when the point represented by that parameter lies on
15093 the positive real axis; as another, the sign of the imaginary component
15094 of the @cite{Compose_From_Polar} function should be the same as
15095 (respectively, the opposite of) that of the @cite{Argument} parameter when that
15096 parameter has a value of zero and the @cite{Modulus} parameter has a
15097 nonnegative (respectively, negative) value."
15098 @end quotation
15100 Followed.
15102 @geindex Complex elementary functions
15104 @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
15105 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{23d}
15106 @section RM G.1.2(49): Complex Elementary Functions
15109 @quotation
15111 "Implementations in which @cite{Complex_Types.Real'Signed_Zeros} is
15112 @cite{True} should attempt to provide a rational treatment of the signs
15113 of zero results and result components.  For example, many of the complex
15114 elementary functions have components that are odd functions of one of
15115 the parameter components; in these cases, the result component should
15116 have the sign of the parameter component at the origin.  Other complex
15117 elementary functions have zero components whose sign is opposite that of
15118 a parameter component at the origin, or is always positive or always
15119 negative."
15120 @end quotation
15122 Followed.
15124 @geindex Accuracy requirements
15126 @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
15127 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{23e}
15128 @section RM G.2.4(19): Accuracy Requirements
15131 @quotation
15133 "The versions of the forward trigonometric functions without a
15134 @cite{Cycle} parameter should not be implemented by calling the
15135 corresponding version with a @cite{Cycle} parameter of
15136 @cite{2.0*Numerics.Pi}, since this will not provide the required
15137 accuracy in some portions of the domain.  For the same reason, the
15138 version of @cite{Log} without a @cite{Base} parameter should not be
15139 implemented by calling the corresponding version with a @cite{Base}
15140 parameter of @cite{Numerics.e}."
15141 @end quotation
15143 Followed.
15145 @geindex Complex arithmetic accuracy
15147 @geindex Accuracy
15148 @geindex complex arithmetic
15150 @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
15151 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{23f}
15152 @section RM G.2.6(15): Complex Arithmetic Accuracy
15155 @quotation
15157 "The version of the @cite{Compose_From_Polar} function without a
15158 @cite{Cycle} parameter should not be implemented by calling the
15159 corresponding version with a @cite{Cycle} parameter of
15160 @cite{2.0*Numerics.Pi}, since this will not provide the required
15161 accuracy in some portions of the domain."
15162 @end quotation
15164 Followed.
15166 @geindex Sequential elaboration policy
15168 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15169 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{240}
15170 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15173 @quotation
15175 "If the partition elaboration policy is @cite{Sequential} and the
15176 Environment task becomes permanently blocked during elaboration then the
15177 partition is deadlocked and it is recommended that the partition be
15178 immediately terminated."
15179 @end quotation
15181 Not followed.
15183 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15184 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{241}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{242}
15185 @chapter Implementation Defined Characteristics
15188 In addition to the implementation dependent pragmas and attributes, and the
15189 implementation advice, there are a number of other Ada features that are
15190 potentially implementation dependent and are designated as
15191 implementation-defined. These are mentioned throughout the Ada Reference
15192 Manual, and are summarized in Annex M.
15194 A requirement for conforming Ada compilers is that they provide
15195 documentation describing how the implementation deals with each of these
15196 issues.  In this chapter you will find each point in Annex M listed,
15197 followed by a description of how GNAT
15198 handles the implementation dependence.
15200 You can use this chapter as a guide to minimizing implementation
15201 dependent features in your programs if portability to other compilers
15202 and other operating systems is an important consideration.  The numbers
15203 in each entry below correspond to the paragraph numbers in the Ada
15204 Reference Manual.
15207 @itemize *
15209 @item 
15210 "Whether or not each recommendation given in Implementation
15211 Advice is followed.  See 1.1.2(37)."
15212 @end itemize
15214 See @ref{a,,Implementation Advice}.
15217 @itemize *
15219 @item 
15220 "Capacity limitations of the implementation.  See 1.1.3(3)."
15221 @end itemize
15223 The complexity of programs that can be processed is limited only by the
15224 total amount of available virtual memory, and disk space for the
15225 generated object files.
15228 @itemize *
15230 @item 
15231 "Variations from the standard that are impractical to avoid
15232 given the implementation's execution environment.  See 1.1.3(6)."
15233 @end itemize
15235 There are no variations from the standard.
15238 @itemize *
15240 @item 
15241 "Which code_statements cause external
15242 interactions.  See 1.1.3(10)."
15243 @end itemize
15245 Any @cite{code_statement} can potentially cause external interactions.
15248 @itemize *
15250 @item 
15251 "The coded representation for the text of an Ada
15252 program.  See 2.1(4)."
15253 @end itemize
15255 See separate section on source representation.
15258 @itemize *
15260 @item 
15261 "The control functions allowed in comments.  See 2.1(14)."
15262 @end itemize
15264 See separate section on source representation.
15267 @itemize *
15269 @item 
15270 "The representation for an end of line.  See 2.2(2)."
15271 @end itemize
15273 See separate section on source representation.
15276 @itemize *
15278 @item 
15279 "Maximum supported line length and lexical element
15280 length.  See 2.2(15)."
15281 @end itemize
15283 The maximum line length is 255 characters and the maximum length of
15284 a lexical element is also 255 characters. This is the default setting
15285 if not overridden by the use of compiler switch @emph{-gnaty} (which
15286 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15287 line length to be specified to be any value up to 32767. The maximum
15288 length of a lexical element is the same as the maximum line length.
15291 @itemize *
15293 @item 
15294 "Implementation defined pragmas.  See 2.8(14)."
15295 @end itemize
15297 See @ref{7,,Implementation Defined Pragmas}.
15300 @itemize *
15302 @item 
15303 "Effect of pragma @cite{Optimize}.  See 2.8(27)."
15304 @end itemize
15306 Pragma @cite{Optimize}, if given with a @cite{Time} or @cite{Space}
15307 parameter, checks that the optimization flag is set, and aborts if it is
15308 not.
15311 @itemize *
15313 @item 
15314 "The sequence of characters of the value returned by
15315 @code{S'Image} when some of the graphic characters of
15316 @code{S'Wide_Image} are not defined in @cite{Character}.  See
15317 3.5(37)."
15318 @end itemize
15320 The sequence of characters is as defined by the wide character encoding
15321 method used for the source.  See section on source representation for
15322 further details.
15325 @itemize *
15327 @item 
15328 "The predefined integer types declared in
15329 @cite{Standard}.  See 3.5.4(25)."
15330 @end itemize
15333 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15334 @headitem
15336 Type
15338 @tab
15340 Representation
15342 @item
15344 @emph{Short_Short_Integer}
15346 @tab
15348 8 bit signed
15350 @item
15352 @emph{Short_Integer}
15354 @tab
15356 (Short) 16 bit signed
15358 @item
15360 @emph{Integer}
15362 @tab
15364 32 bit signed
15366 @item
15368 @emph{Long_Integer}
15370 @tab
15372 64 bit signed (on most 64 bit targets,
15373 depending on the C definition of long).
15374 32 bit signed (all other targets)
15376 @item
15378 @emph{Long_Long_Integer}
15380 @tab
15382 64 bit signed
15384 @end multitable
15388 @itemize *
15390 @item 
15391 "Any nonstandard integer types and the operators defined
15392 for them.  See 3.5.4(26)."
15393 @end itemize
15395 There are no nonstandard integer types.
15398 @itemize *
15400 @item 
15401 "Any nonstandard real types and the operators defined for
15402 them.  See 3.5.6(8)."
15403 @end itemize
15405 There are no nonstandard real types.
15408 @itemize *
15410 @item 
15411 "What combinations of requested decimal precision and range
15412 are supported for floating point types.  See 3.5.7(7)."
15413 @end itemize
15415 The precision and range is as defined by the IEEE standard.
15418 @itemize *
15420 @item 
15421 "The predefined floating point types declared in
15422 @cite{Standard}.  See 3.5.7(16)."
15423 @end itemize
15426 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15427 @headitem
15429 Type
15431 @tab
15433 Representation
15435 @item
15437 @emph{Short_Float}
15439 @tab
15441 32 bit IEEE short
15443 @item
15445 @emph{Float}
15447 @tab
15449 (Short) 32 bit IEEE short
15451 @item
15453 @emph{Long_Float}
15455 @tab
15457 64 bit IEEE long
15459 @item
15461 @emph{Long_Long_Float}
15463 @tab
15465 64 bit IEEE long (80 bit IEEE long on x86 processors)
15467 @end multitable
15471 @itemize *
15473 @item 
15474 "The small of an ordinary fixed point type.  See 3.5.9(8)."
15475 @end itemize
15477 @cite{Fine_Delta} is 2**(-63)
15480 @itemize *
15482 @item 
15483 "What combinations of small, range, and digits are
15484 supported for fixed point types.  See 3.5.9(10)."
15485 @end itemize
15487 Any combinations are permitted that do not result in a small less than
15488 @cite{Fine_Delta} and do not result in a mantissa larger than 63 bits.
15489 If the mantissa is larger than 53 bits on machines where Long_Long_Float
15490 is 64 bits (true of all architectures except ia32), then the output from
15491 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
15492 is because floating-point conversions are used to convert fixed point.
15495 @itemize *
15497 @item 
15498 "The result of @cite{Tags.Expanded_Name} for types declared
15499 within an unnamed @cite{block_statement}.  See 3.9(10)."
15500 @end itemize
15502 Block numbers of the form @cite{B`nnn`}, where @cite{nnn} is a
15503 decimal integer are allocated.
15506 @itemize *
15508 @item 
15509 "Implementation-defined attributes.  See 4.1.4(12)."
15510 @end itemize
15512 See @ref{8,,Implementation Defined Attributes}.
15515 @itemize *
15517 @item 
15518 "Any implementation-defined time types.  See 9.6(6)."
15519 @end itemize
15521 There are no implementation-defined time types.
15524 @itemize *
15526 @item 
15527 "The time base associated with relative delays."
15528 @end itemize
15530 See 9.6(20).  The time base used is that provided by the C library
15531 function @cite{gettimeofday}.
15534 @itemize *
15536 @item 
15537 "The time base of the type @cite{Calendar.Time}.  See
15538 9.6(23)."
15539 @end itemize
15541 The time base used is that provided by the C library function
15542 @cite{gettimeofday}.
15545 @itemize *
15547 @item 
15548 "The time zone used for package @cite{Calendar}
15549 operations.  See 9.6(24)."
15550 @end itemize
15552 The time zone used by package @cite{Calendar} is the current system time zone
15553 setting for local time, as accessed by the C library function
15554 @cite{localtime}.
15557 @itemize *
15559 @item 
15560 "Any limit on @cite{delay_until_statements} of
15561 @cite{select_statements}.  See 9.6(29)."
15562 @end itemize
15564 There are no such limits.
15567 @itemize *
15569 @item 
15570 "Whether or not two non-overlapping parts of a composite
15571 object are independently addressable, in the case where packing, record
15572 layout, or @cite{Component_Size} is specified for the object.  See
15573 9.10(1)."
15574 @end itemize
15576 Separate components are independently addressable if they do not share
15577 overlapping storage units.
15580 @itemize *
15582 @item 
15583 "The representation for a compilation.  See 10.1(2)."
15584 @end itemize
15586 A compilation is represented by a sequence of files presented to the
15587 compiler in a single invocation of the @emph{gcc} command.
15590 @itemize *
15592 @item 
15593 "Any restrictions on compilations that contain multiple
15594 compilation_units.  See 10.1(4)."
15595 @end itemize
15597 No single file can contain more than one compilation unit, but any
15598 sequence of files can be presented to the compiler as a single
15599 compilation.
15602 @itemize *
15604 @item 
15605 "The mechanisms for creating an environment and for adding
15606 and replacing compilation units.  See 10.1.4(3)."
15607 @end itemize
15609 See separate section on compilation model.
15612 @itemize *
15614 @item 
15615 "The manner of explicitly assigning library units to a
15616 partition.  See 10.2(2)."
15617 @end itemize
15619 If a unit contains an Ada main program, then the Ada units for the partition
15620 are determined by recursive application of the rules in the Ada Reference
15621 Manual section 10.2(2-6).  In other words, the Ada units will be those that
15622 are needed by the main program, and then this definition of need is applied
15623 recursively to those units, and the partition contains the transitive
15624 closure determined by this relationship.  In short, all the necessary units
15625 are included, with no need to explicitly specify the list.  If additional
15626 units are required, e.g., by foreign language units, then all units must be
15627 mentioned in the context clause of one of the needed Ada units.
15629 If the partition contains no main program, or if the main program is in
15630 a language other than Ada, then GNAT
15631 provides the binder options @emph{-z} and @emph{-n} respectively, and in
15632 this case a list of units can be explicitly supplied to the binder for
15633 inclusion in the partition (all units needed by these units will also
15634 be included automatically).  For full details on the use of these
15635 options, refer to the @cite{GNAT Make Program gnatmake} in the
15636 @cite{GNAT User's Guide}.
15639 @itemize *
15641 @item 
15642 "The implementation-defined means, if any, of specifying
15643 which compilation units are needed by a given compilation unit.  See
15644 10.2(2)."
15645 @end itemize
15647 The units needed by a given compilation unit are as defined in
15648 the Ada Reference Manual section 10.2(2-6).  There are no
15649 implementation-defined pragmas or other implementation-defined
15650 means for specifying needed units.
15653 @itemize *
15655 @item 
15656 "The manner of designating the main subprogram of a
15657 partition.  See 10.2(7)."
15658 @end itemize
15660 The main program is designated by providing the name of the
15661 corresponding @code{ALI} file as the input parameter to the binder.
15664 @itemize *
15666 @item 
15667 "The order of elaboration of @cite{library_items}.  See
15668 10.2(18)."
15669 @end itemize
15671 The first constraint on ordering is that it meets the requirements of
15672 Chapter 10 of the Ada Reference Manual.  This still leaves some
15673 implementation dependent choices, which are resolved by first
15674 elaborating bodies as early as possible (i.e., in preference to specs
15675 where there is a choice), and second by evaluating the immediate with
15676 clauses of a unit to determine the probably best choice, and
15677 third by elaborating in alphabetical order of unit names
15678 where a choice still remains.
15681 @itemize *
15683 @item 
15684 "Parameter passing and function return for the main
15685 subprogram.  See 10.2(21)."
15686 @end itemize
15688 The main program has no parameters.  It may be a procedure, or a function
15689 returning an integer type.  In the latter case, the returned integer
15690 value is the return code of the program (overriding any value that
15691 may have been set by a call to @cite{Ada.Command_Line.Set_Exit_Status}).
15694 @itemize *
15696 @item 
15697 "The mechanisms for building and running partitions.  See
15698 10.2(24)."
15699 @end itemize
15701 GNAT itself supports programs with only a single partition.  The GNATDIST
15702 tool provided with the GLADE package (which also includes an implementation
15703 of the PCS) provides a completely flexible method for building and running
15704 programs consisting of multiple partitions.  See the separate GLADE manual
15705 for details.
15708 @itemize *
15710 @item 
15711 "The details of program execution, including program
15712 termination.  See 10.2(25)."
15713 @end itemize
15715 See separate section on compilation model.
15718 @itemize *
15720 @item 
15721 "The semantics of any non-active partitions supported by the
15722 implementation.  See 10.2(28)."
15723 @end itemize
15725 Passive partitions are supported on targets where shared memory is
15726 provided by the operating system.  See the GLADE reference manual for
15727 further details.
15730 @itemize *
15732 @item 
15733 "The information returned by @cite{Exception_Message}.  See
15734 11.4.1(10)."
15735 @end itemize
15737 Exception message returns the null string unless a specific message has
15738 been passed by the program.
15741 @itemize *
15743 @item 
15744 "The result of @cite{Exceptions.Exception_Name} for types
15745 declared within an unnamed @cite{block_statement}.  See 11.4.1(12)."
15746 @end itemize
15748 Blocks have implementation defined names of the form @cite{B`nnn`}
15749 where @cite{nnn} is an integer.
15752 @itemize *
15754 @item 
15755 "The information returned by
15756 @cite{Exception_Information}.  See 11.4.1(13)."
15757 @end itemize
15759 @cite{Exception_Information} returns a string in the following format:
15761 @example
15762 *Exception_Name:* nnnnn
15763 *Message:* mmmmm
15764 *PID:* ppp
15765 *Load address:* 0xhhhh
15766 *Call stack traceback locations:*
15767 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
15768 @end example
15770 where
15772 @quotation
15775 @itemize *
15777 @item 
15778 @cite{nnnn} is the fully qualified name of the exception in all upper
15779 case letters. This line is always present.
15781 @item 
15782 @cite{mmmm} is the message (this line present only if message is non-null)
15784 @item 
15785 @cite{ppp} is the Process Id value as a decimal integer (this line is
15786 present only if the Process Id is nonzero). Currently we are
15787 not making use of this field.
15789 @item 
15790 The Load address line, the Call stack traceback locations line and the
15791 following values are present only if at least one traceback location was
15792 recorded. The Load address indicates the address at which the main executable
15793 was loaded; this line may not be present if operating system hasn't relocated
15794 the main executable. The values are given in C style format, with lower case
15795 letters for a-f, and only as many digits present as are necessary.
15796 The line terminator sequence at the end of each line, including
15797 the last line is a single @cite{LF} character (@cite{16#0A#}).
15798 @end itemize
15799 @end quotation
15802 @itemize *
15804 @item 
15805 "Implementation-defined check names.  See 11.5(27)."
15806 @end itemize
15808 The implementation defined check names include Alignment_Check,
15809 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
15810 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
15811 program can add implementation-defined check names by means of the pragma
15812 Check_Name. See the description of pragma @cite{Suppress} for full details.
15815 @itemize *
15817 @item 
15818 "The interpretation of each aspect of representation.  See
15819 13.1(20)."
15820 @end itemize
15822 See separate section on data representations.
15825 @itemize *
15827 @item 
15828 "Any restrictions placed upon representation items.  See
15829 13.1(20)."
15830 @end itemize
15832 See separate section on data representations.
15835 @itemize *
15837 @item 
15838 "The meaning of @cite{Size} for indefinite subtypes.  See
15839 13.3(48)."
15840 @end itemize
15842 Size for an indefinite subtype is the maximum possible size, except that
15843 for the case of a subprogram parameter, the size of the parameter object
15844 is the actual size.
15847 @itemize *
15849 @item 
15850 "The default external representation for a type tag.  See
15851 13.3(75)."
15852 @end itemize
15854 The default external representation for a type tag is the fully expanded
15855 name of the type in upper case letters.
15858 @itemize *
15860 @item 
15861 "What determines whether a compilation unit is the same in
15862 two different partitions.  See 13.3(76)."
15863 @end itemize
15865 A compilation unit is the same in two different partitions if and only
15866 if it derives from the same source file.
15869 @itemize *
15871 @item 
15872 "Implementation-defined components.  See 13.5.1(15)."
15873 @end itemize
15875 The only implementation defined component is the tag for a tagged type,
15876 which contains a pointer to the dispatching table.
15879 @itemize *
15881 @item 
15882 "If @cite{Word_Size} = @cite{Storage_Unit}, the default bit
15883 ordering.  See 13.5.3(5)."
15884 @end itemize
15886 @cite{Word_Size} (32) is not the same as @cite{Storage_Unit} (8) for this
15887 implementation, so no non-default bit ordering is supported.  The default
15888 bit ordering corresponds to the natural endianness of the target architecture.
15891 @itemize *
15893 @item 
15894 "The contents of the visible part of package @cite{System}
15895 and its language-defined children.  See 13.7(2)."
15896 @end itemize
15898 See the definition of these packages in files @code{system.ads} and
15899 @code{s-stoele.ads}. Note that two declarations are added to package
15900 System.
15902 @example
15903 Max_Priority           : constant Positive := Priority'Last;
15904 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
15905 @end example
15908 @itemize *
15910 @item 
15911 "The contents of the visible part of package
15912 @cite{System.Machine_Code}, and the meaning of
15913 @cite{code_statements}.  See 13.8(7)."
15914 @end itemize
15916 See the definition and documentation in file @code{s-maccod.ads}.
15919 @itemize *
15921 @item 
15922 "The effect of unchecked conversion.  See 13.9(11)."
15923 @end itemize
15925 Unchecked conversion between types of the same size
15926 results in an uninterpreted transmission of the bits from one type
15927 to the other.  If the types are of unequal sizes, then in the case of
15928 discrete types, a shorter source is first zero or sign extended as
15929 necessary, and a shorter target is simply truncated on the left.
15930 For all non-discrete types, the source is first copied if necessary
15931 to ensure that the alignment requirements of the target are met, then
15932 a pointer is constructed to the source value, and the result is obtained
15933 by dereferencing this pointer after converting it to be a pointer to the
15934 target type. Unchecked conversions where the target subtype is an
15935 unconstrained array are not permitted. If the target alignment is
15936 greater than the source alignment, then a copy of the result is
15937 made with appropriate alignment
15940 @itemize *
15942 @item 
15943 "The semantics of operations on invalid representations.
15944 See 13.9.2(10-11)."
15945 @end itemize
15947 For assignments and other operations where the use of invalid values cannot
15948 result in erroneous behavior, the compiler ignores the possibility of invalid
15949 values. An exception is raised at the point where an invalid value would
15950 result in erroneous behavior. For example executing:
15952 @example
15953 procedure invalidvals is
15954   X : Integer := -1;
15955   Y : Natural range 1 .. 10;
15956   for Y'Address use X'Address;
15957   Z : Natural range 1 .. 10;
15958   A : array (Natural range 1 .. 10) of Integer;
15959 begin
15960   Z := Y;     -- no exception
15961   A (Z) := 3; -- exception raised;
15962 end;
15963 @end example
15965 As indicated, an exception is raised on the array assignment, but not
15966 on the simple assignment of the invalid negative value from Y to Z.
15969 @itemize *
15971 @item 
15972 "The manner of choosing a storage pool for an access type
15973 when @cite{Storage_Pool} is not specified for the type.  See 13.11(17)."
15974 @end itemize
15976 There are 3 different standard pools used by the compiler when
15977 @cite{Storage_Pool} is not specified depending whether the type is local
15978 to a subprogram or defined at the library level and whether
15979 @cite{Storage_Size`is specified or not. See documentation in the runtime library units `System.Pool_Global}, @cite{System.Pool_Size} and
15980 @cite{System.Pool_Local} in files @code{s-poosiz.ads},
15981 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
15982 default pools used.
15985 @itemize *
15987 @item 
15988 "Whether or not the implementation provides user-accessible
15989 names for the standard pool type(s).  See 13.11(17)."
15990 @end itemize
15992 See documentation in the sources of the run time mentioned in the previous
15993 paragraph.  All these pools are accessible by means of @cite{with}'ing
15994 these units.
15997 @itemize *
15999 @item 
16000 "The meaning of @cite{Storage_Size}.  See 13.11(18)."
16001 @end itemize
16003 @cite{Storage_Size} is measured in storage units, and refers to the
16004 total space available for an access type collection, or to the primary
16005 stack space for a task.
16008 @itemize *
16010 @item 
16011 "Implementation-defined aspects of storage pools.  See
16012 13.11(22)."
16013 @end itemize
16015 See documentation in the sources of the run time mentioned in the
16016 paragraph about standard storage pools above
16017 for details on GNAT-defined aspects of storage pools.
16020 @itemize *
16022 @item 
16023 "The set of restrictions allowed in a pragma
16024 @cite{Restrictions}.  See 13.12(7)."
16025 @end itemize
16027 See @ref{9,,Standard and Implementation Defined Restrictions}.
16030 @itemize *
16032 @item 
16033 "The consequences of violating limitations on
16034 @cite{Restrictions} pragmas.  See 13.12(9)."
16035 @end itemize
16037 Restrictions that can be checked at compile time result in illegalities
16038 if violated.  Currently there are no other consequences of violating
16039 restrictions.
16042 @itemize *
16044 @item 
16045 "The representation used by the @cite{Read} and
16046 @cite{Write} attributes of elementary types in terms of stream
16047 elements.  See 13.13.2(9)."
16048 @end itemize
16050 The representation is the in-memory representation of the base type of
16051 the type, using the number of bits corresponding to the
16052 @code{type'Size} value, and the natural ordering of the machine.
16055 @itemize *
16057 @item 
16058 "The names and characteristics of the numeric subtypes
16059 declared in the visible part of package @cite{Standard}.  See A.1(3)."
16060 @end itemize
16062 See items describing the integer and floating-point types supported.
16065 @itemize *
16067 @item 
16068 "The string returned by @cite{Character_Set_Version}.
16069 See A.3.5(3)."
16070 @end itemize
16072 @cite{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16073 the string "Unicode 4.0", referring to version 4.0 of the
16074 Unicode specification.
16077 @itemize *
16079 @item 
16080 "The accuracy actually achieved by the elementary
16081 functions.  See A.5.1(1)."
16082 @end itemize
16084 The elementary functions correspond to the functions available in the C
16085 library.  Only fast math mode is implemented.
16088 @itemize *
16090 @item 
16091 "The sign of a zero result from some of the operators or
16092 functions in @cite{Numerics.Generic_Elementary_Functions}, when
16093 @cite{Float_Type'Signed_Zeros} is @cite{True}.  See A.5.1(46)."
16094 @end itemize
16096 The sign of zeroes follows the requirements of the IEEE 754 standard on
16097 floating-point.
16100 @itemize *
16102 @item 
16103 "The value of
16104 @cite{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27)."
16105 @end itemize
16107 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16110 @itemize *
16112 @item 
16113 "The value of
16114 @cite{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27)."
16115 @end itemize
16117 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16120 @itemize *
16122 @item 
16123 "The algorithms for random number generation.  See
16124 A.5.2(32)."
16125 @end itemize
16127 The algorithm is the Mersenne Twister, as documented in the source file
16128 @code{s-rannum.adb}. This version of the algorithm has a period of
16129 2**19937-1.
16132 @itemize *
16134 @item 
16135 "The string representation of a random number generator's
16136 state.  See A.5.2(38)."
16137 @end itemize
16139 The value returned by the Image function is the concatenation of
16140 the fixed-width decimal representations of the 624 32-bit integers
16141 of the state vector.
16144 @itemize *
16146 @item 
16147 "The minimum time interval between calls to the
16148 time-dependent Reset procedure that are guaranteed to initiate different
16149 random number sequences.  See A.5.2(45)."
16150 @end itemize
16152 The minimum period between reset calls to guarantee distinct series of
16153 random numbers is one microsecond.
16156 @itemize *
16158 @item 
16159 "The values of the @cite{Model_Mantissa},
16160 @cite{Model_Emin}, @cite{Model_Epsilon}, @cite{Model},
16161 @cite{Safe_First}, and @cite{Safe_Last} attributes, if the Numerics
16162 Annex is not supported.  See A.5.3(72)."
16163 @end itemize
16165 Run the compiler with @emph{-gnatS} to produce a listing of package
16166 @cite{Standard}, has the values of all numeric attributes.
16169 @itemize *
16171 @item 
16172 "Any implementation-defined characteristics of the
16173 input-output packages.  See A.7(14)."
16174 @end itemize
16176 There are no special implementation defined characteristics for these
16177 packages.
16180 @itemize *
16182 @item 
16183 "The value of @cite{Buffer_Size} in @cite{Storage_IO}.  See
16184 A.9(10)."
16185 @end itemize
16187 All type representations are contiguous, and the @cite{Buffer_Size} is
16188 the value of @code{type'Size} rounded up to the next storage unit
16189 boundary.
16192 @itemize *
16194 @item 
16195 "External files for standard input, standard output, and
16196 standard error See A.10(5)."
16197 @end itemize
16199 These files are mapped onto the files provided by the C streams
16200 libraries.  See source file @code{i-cstrea.ads} for further details.
16203 @itemize *
16205 @item 
16206 "The accuracy of the value produced by @cite{Put}.  See
16207 A.10.9(36)."
16208 @end itemize
16210 If more digits are requested in the output than are represented by the
16211 precision of the value, zeroes are output in the corresponding least
16212 significant digit positions.
16215 @itemize *
16217 @item 
16218 "The meaning of @cite{Argument_Count}, @cite{Argument}, and
16219 @cite{Command_Name}.  See A.15(1)."
16220 @end itemize
16222 These are mapped onto the @cite{argv} and @cite{argc} parameters of the
16223 main program in the natural manner.
16226 @itemize *
16228 @item 
16229 "The interpretation of the @cite{Form} parameter in procedure
16230 @cite{Create_Directory}.  See A.16(56)."
16231 @end itemize
16233 The @cite{Form} parameter is not used.
16236 @itemize *
16238 @item 
16239 "The interpretation of the @cite{Form} parameter in procedure
16240 @cite{Create_Path}.  See A.16(60)."
16241 @end itemize
16243 The @cite{Form} parameter is not used.
16246 @itemize *
16248 @item 
16249 "The interpretation of the @cite{Form} parameter in procedure
16250 @cite{Copy_File}.  See A.16(68)."
16251 @end itemize
16253 The @cite{Form} parameter is case-insensitive.
16254 Two fields are recognized in the @cite{Form} parameter:
16256 @example
16257 *preserve=<value>*
16258 *mode=<value>*
16259 @end example
16261 <value> starts immediately after the character '=' and ends with the
16262 character immediately preceding the next comma (',') or with the last
16263 character of the parameter.
16265 The only possible values for preserve= are:
16268 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16269 @headitem
16271 Value
16273 @tab
16275 Meaning
16277 @item
16279 @emph{no_attributes}
16281 @tab
16283 Do not try to preserve any file attributes. This is the
16284 default if no preserve= is found in Form.
16286 @item
16288 @emph{all_attributes}
16290 @tab
16292 Try to preserve all file attributes (timestamps, access rights).
16294 @item
16296 @emph{timestamps}
16298 @tab
16300 Preserve the timestamp of the copied file, but not the other
16301 file attributes.
16303 @end multitable
16306 The only possible values for mode= are:
16309 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16310 @headitem
16312 Value
16314 @tab
16316 Meaning
16318 @item
16320 @emph{copy}
16322 @tab
16324 Only do the copy if the destination file does not already exist.
16325 If it already exists, Copy_File fails.
16327 @item
16329 @emph{overwrite}
16331 @tab
16333 Copy the file in all cases. Overwrite an already existing destination file.
16335 @item
16337 @emph{append}
16339 @tab
16341 Append the original file to the destination file. If the destination file
16342 does not exist, the destination file is a copy of the source file.
16343 When mode=append, the field preserve=, if it exists, is not taken into account.
16345 @end multitable
16348 If the Form parameter includes one or both of the fields and the value or
16349 values are incorrect, Copy_file fails with Use_Error.
16351 Examples of correct Forms:
16353 @example
16354 Form => "preserve=no_attributes,mode=overwrite" (the default)
16355 Form => "mode=append"
16356 Form => "mode=copy, preserve=all_attributes"
16357 @end example
16359 Examples of incorrect Forms:
16361 @example
16362 Form => "preserve=junk"
16363 Form => "mode=internal, preserve=timestamps"
16364 @end example
16367 @itemize *
16369 @item 
16370 "The interpretation of the @cite{Pattern} parameter, when not the null string,
16371 in the @cite{Start_Search} and @cite{Search} procedures.
16372 See A.16(104) and A.16(112)."
16373 @end itemize
16375 When the @cite{Pattern} parameter is not the null string, it is interpreted
16376 according to the syntax of regular expressions as defined in the
16377 @cite{GNAT.Regexp} package.
16379 See @ref{243,,GNAT.Regexp (g-regexp.ads)}.
16382 @itemize *
16384 @item 
16385 "Implementation-defined convention names.  See B.1(11)."
16386 @end itemize
16388 The following convention names are supported
16391 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16392 @headitem
16394 Convention Name
16396 @tab
16398 Interpretation
16400 @item
16402 @emph{Ada}
16404 @tab
16408 @item
16410 @emph{Ada_Pass_By_Copy}
16412 @tab
16414 Allowed for any types except by-reference types such as limited
16415 records. Compatible with convention Ada, but causes any parameters
16416 with this convention to be passed by copy.
16418 @item
16420 @emph{Ada_Pass_By_Reference}
16422 @tab
16424 Allowed for any types except by-copy types such as scalars.
16425 Compatible with convention Ada, but causes any parameters
16426 with this convention to be passed by reference.
16428 @item
16430 @emph{Assembler}
16432 @tab
16434 Assembly language
16436 @item
16438 @emph{Asm}
16440 @tab
16442 Synonym for Assembler
16444 @item
16446 @emph{Assembly}
16448 @tab
16450 Synonym for Assembler
16452 @item
16454 @emph{C}
16456 @tab
16460 @item
16462 @emph{C_Pass_By_Copy}
16464 @tab
16466 Allowed only for record types, like C, but also notes that record
16467 is to be passed by copy rather than reference.
16469 @item
16471 @emph{COBOL}
16473 @tab
16475 COBOL
16477 @item
16479 @emph{C_Plus_Plus (or CPP)}
16481 @tab
16485 @item
16487 @emph{Default}
16489 @tab
16491 Treated the same as C
16493 @item
16495 @emph{External}
16497 @tab
16499 Treated the same as C
16501 @item
16503 @emph{Fortran}
16505 @tab
16507 Fortran
16509 @item
16511 @emph{Intrinsic}
16513 @tab
16515 For support of pragma @cite{Import} with convention Intrinsic, see
16516 separate section on Intrinsic Subprograms.
16518 @item
16520 @emph{Stdcall}
16522 @tab
16524 Stdcall (used for Windows implementations only).  This convention correspond
16525 to the WINAPI (previously called Pascal convention) C/C++ convention under
16526 Windows.  A routine with this convention cleans the stack before
16527 exit. This pragma cannot be applied to a dispatching call.
16529 @item
16531 @emph{DLL}
16533 @tab
16535 Synonym for Stdcall
16537 @item
16539 @emph{Win32}
16541 @tab
16543 Synonym for Stdcall
16545 @item
16547 @emph{Stubbed}
16549 @tab
16551 Stubbed is a special convention used to indicate that the body of the
16552 subprogram will be entirely ignored.  Any call to the subprogram
16553 is converted into a raise of the @cite{Program_Error} exception.  If a
16554 pragma @cite{Import} specifies convention @cite{stubbed} then no body need
16555 be present at all.  This convention is useful during development for the
16556 inclusion of subprograms whose body has not yet been written.
16557 In addition, all otherwise unrecognized convention names are also
16558 treated as being synonymous with convention C.  In all implementations
16559 except for VMS, use of such other names results in a warning.  In VMS
16560 implementations, these names are accepted silently.
16562 @end multitable
16566 @itemize *
16568 @item 
16569 "The meaning of link names.  See B.1(36)."
16570 @end itemize
16572 Link names are the actual names used by the linker.
16575 @itemize *
16577 @item 
16578 "The manner of choosing link names when neither the link
16579 name nor the address of an imported or exported entity is specified.  See
16580 B.1(36)."
16581 @end itemize
16583 The default linker name is that which would be assigned by the relevant
16584 external language, interpreting the Ada name as being in all lower case
16585 letters.
16588 @itemize *
16590 @item 
16591 "The effect of pragma @cite{Linker_Options}.  See B.1(37)."
16592 @end itemize
16594 The string passed to @cite{Linker_Options} is presented uninterpreted as
16595 an argument to the link command, unless it contains ASCII.NUL characters.
16596 NUL characters if they appear act as argument separators, so for example
16598 @example
16599 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
16600 @end example
16602 causes two separate arguments @cite{-labc} and @cite{-ldef} to be passed to the
16603 linker. The order of linker options is preserved for a given unit. The final
16604 list of options passed to the linker is in reverse order of the elaboration
16605 order. For example, linker options for a body always appear before the options
16606 from the corresponding package spec.
16609 @itemize *
16611 @item 
16612 "The contents of the visible part of package
16613 @cite{Interfaces} and its language-defined descendants.  See B.2(1)."
16614 @end itemize
16616 See files with prefix @code{i-} in the distributed library.
16619 @itemize *
16621 @item 
16622 "Implementation-defined children of package
16623 @cite{Interfaces}.  The contents of the visible part of package
16624 @cite{Interfaces}.  See B.2(11)."
16625 @end itemize
16627 See files with prefix @code{i-} in the distributed library.
16630 @itemize *
16632 @item 
16633 "The types @cite{Floating}, @cite{Long_Floating},
16634 @cite{Binary}, @cite{Long_Binary}, @cite{Decimal_ Element}, and
16635 @cite{COBOL_Character}; and the initialization of the variables
16636 @cite{Ada_To_COBOL} and @cite{COBOL_To_Ada}, in
16637 @cite{Interfaces.COBOL}.  See B.4(50)."
16638 @end itemize
16641 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16642 @headitem
16644 COBOL
16646 @tab
16650 @item
16652 @emph{Floating}
16654 @tab
16656 Float
16658 @item
16660 @emph{Long_Floating}
16662 @tab
16664 (Floating) Long_Float
16666 @item
16668 @emph{Binary}
16670 @tab
16672 Integer
16674 @item
16676 @emph{Long_Binary}
16678 @tab
16680 Long_Long_Integer
16682 @item
16684 @emph{Decimal_Element}
16686 @tab
16688 Character
16690 @item
16692 @emph{COBOL_Character}
16694 @tab
16696 Character
16698 @end multitable
16701 For initialization, see the file @code{i-cobol.ads} in the distributed library.
16704 @itemize *
16706 @item 
16707 "Support for access to machine instructions.  See C.1(1)."
16708 @end itemize
16710 See documentation in file @code{s-maccod.ads} in the distributed library.
16713 @itemize *
16715 @item 
16716 "Implementation-defined aspects of access to machine
16717 operations.  See C.1(9)."
16718 @end itemize
16720 See documentation in file @code{s-maccod.ads} in the distributed library.
16723 @itemize *
16725 @item 
16726 "Implementation-defined aspects of interrupts.  See C.3(2)."
16727 @end itemize
16729 Interrupts are mapped to signals or conditions as appropriate.  See
16730 definition of unit
16731 @cite{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
16732 on the interrupts supported on a particular target.
16735 @itemize *
16737 @item 
16738 "Implementation-defined aspects of pre-elaboration.  See
16739 C.4(13)."
16740 @end itemize
16742 GNAT does not permit a partition to be restarted without reloading,
16743 except under control of the debugger.
16746 @itemize *
16748 @item 
16749 "The semantics of pragma @cite{Discard_Names}.  See C.5(7)."
16750 @end itemize
16752 Pragma @cite{Discard_Names} causes names of enumeration literals to
16753 be suppressed.  In the presence of this pragma, the Image attribute
16754 provides the image of the Pos of the literal, and Value accepts
16755 Pos values.
16758 @itemize *
16760 @item 
16761 "The result of the @cite{Task_Identification.Image}
16762 attribute.  See C.7.1(7)."
16763 @end itemize
16765 The result of this attribute is a string that identifies
16766 the object or component that denotes a given task. If a variable @cite{Var}
16767 has a task type, the image for this task will have the form @cite{Var_`XXXXXXXX`},
16768 where the suffix
16769 is the hexadecimal representation of the virtual address of the corresponding
16770 task control block. If the variable is an array of tasks, the image of each
16771 task will have the form of an indexed component indicating the position of a
16772 given task in the array, e.g., @cite{Group(5)_`XXXXXXX`}. If the task is a
16773 component of a record, the image of the task will have the form of a selected
16774 component. These rules are fully recursive, so that the image of a task that
16775 is a subcomponent of a composite object corresponds to the expression that
16776 designates this task.
16778 If a task is created by an allocator, its image depends on the context. If the
16779 allocator is part of an object declaration, the rules described above are used
16780 to construct its image, and this image is not affected by subsequent
16781 assignments. If the allocator appears within an expression, the image
16782 includes only the name of the task type.
16784 If the configuration pragma Discard_Names is present, or if the restriction
16785 No_Implicit_Heap_Allocation is in effect,  the image reduces to
16786 the numeric suffix, that is to say the hexadecimal representation of the
16787 virtual address of the control block of the task.
16790 @itemize *
16792 @item 
16793 "The value of @cite{Current_Task} when in a protected entry
16794 or interrupt handler.  See C.7.1(17)."
16795 @end itemize
16797 Protected entries or interrupt handlers can be executed by any
16798 convenient thread, so the value of @cite{Current_Task} is undefined.
16801 @itemize *
16803 @item 
16804 "The effect of calling @cite{Current_Task} from an entry
16805 body or interrupt handler.  See C.7.1(19)."
16806 @end itemize
16808 The effect of calling @cite{Current_Task} from an entry body or
16809 interrupt handler is to return the identification of the task currently
16810 executing the code.
16813 @itemize *
16815 @item 
16816 "Implementation-defined aspects of
16817 @cite{Task_Attributes}.  See C.7.2(19)."
16818 @end itemize
16820 There are no implementation-defined aspects of @cite{Task_Attributes}.
16823 @itemize *
16825 @item 
16826 "Values of all @cite{Metrics}.  See D(2)."
16827 @end itemize
16829 The metrics information for GNAT depends on the performance of the
16830 underlying operating system.  The sources of the run-time for tasking
16831 implementation, together with the output from @emph{-gnatG} can be
16832 used to determine the exact sequence of operating systems calls made
16833 to implement various tasking constructs.  Together with appropriate
16834 information on the performance of the underlying operating system,
16835 on the exact target in use, this information can be used to determine
16836 the required metrics.
16839 @itemize *
16841 @item 
16842 "The declarations of @cite{Any_Priority} and
16843 @cite{Priority}.  See D.1(11)."
16844 @end itemize
16846 See declarations in file @code{system.ads}.
16849 @itemize *
16851 @item 
16852 "Implementation-defined execution resources.  See D.1(15)."
16853 @end itemize
16855 There are no implementation-defined execution resources.
16858 @itemize *
16860 @item 
16861 "Whether, on a multiprocessor, a task that is waiting for
16862 access to a protected object keeps its processor busy.  See D.2.1(3)."
16863 @end itemize
16865 On a multi-processor, a task that is waiting for access to a protected
16866 object does not keep its processor busy.
16869 @itemize *
16871 @item 
16872 "The affect of implementation defined execution resources
16873 on task dispatching.  See D.2.1(9)."
16874 @end itemize
16876 Tasks map to threads in the threads package used by GNAT.  Where possible
16877 and appropriate, these threads correspond to native threads of the
16878 underlying operating system.
16881 @itemize *
16883 @item 
16884 "Implementation-defined @cite{policy_identifiers} allowed
16885 in a pragma @cite{Task_Dispatching_Policy}.  See D.2.2(3)."
16886 @end itemize
16888 There are no implementation-defined policy-identifiers allowed in this
16889 pragma.
16892 @itemize *
16894 @item 
16895 "Implementation-defined aspects of priority inversion.  See
16896 D.2.2(16)."
16897 @end itemize
16899 Execution of a task cannot be preempted by the implementation processing
16900 of delay expirations for lower priority tasks.
16903 @itemize *
16905 @item 
16906 "Implementation-defined task dispatching.  See D.2.2(18)."
16907 @end itemize
16909 The policy is the same as that of the underlying threads implementation.
16912 @itemize *
16914 @item 
16915 "Implementation-defined @cite{policy_identifiers} allowed
16916 in a pragma @cite{Locking_Policy}.  See D.3(4)."
16917 @end itemize
16919 The two implementation defined policies permitted in GNAT are
16920 @cite{Inheritance_Locking} and  @cite{Conccurent_Readers_Locking}.  On
16921 targets that support the @cite{Inheritance_Locking} policy, locking is
16922 implemented by inheritance, i.e., the task owning the lock operates
16923 at a priority equal to the highest priority of any task currently
16924 requesting the lock.  On targets that support the
16925 @cite{Conccurent_Readers_Locking} policy, locking is implemented with a
16926 read/write lock allowing multiple propected object functions to enter
16927 concurrently.
16930 @itemize *
16932 @item 
16933 "Default ceiling priorities.  See D.3(10)."
16934 @end itemize
16936 The ceiling priority of protected objects of the type
16937 @cite{System.Interrupt_Priority'Last} as described in the Ada
16938 Reference Manual D.3(10),
16941 @itemize *
16943 @item 
16944 "The ceiling of any protected object used internally by
16945 the implementation.  See D.3(16)."
16946 @end itemize
16948 The ceiling priority of internal protected objects is
16949 @cite{System.Priority'Last}.
16952 @itemize *
16954 @item 
16955 "Implementation-defined queuing policies.  See D.4(1)."
16956 @end itemize
16958 There are no implementation-defined queuing policies.
16961 @itemize *
16963 @item 
16964 "On a multiprocessor, any conditions that cause the
16965 completion of an aborted construct to be delayed later than what is
16966 specified for a single processor.  See D.6(3)."
16967 @end itemize
16969 The semantics for abort on a multi-processor is the same as on a single
16970 processor, there are no further delays.
16973 @itemize *
16975 @item 
16976 "Any operations that implicitly require heap storage
16977 allocation.  See D.7(8)."
16978 @end itemize
16980 The only operation that implicitly requires heap storage allocation is
16981 task creation.
16984 @itemize *
16986 @item 
16987 "What happens when a task terminates in the presence of
16988 pragma @cite{No_Task_Termination}. See D.7(15)."
16989 @end itemize
16991 Execution is erroneous in that case.
16994 @itemize *
16996 @item 
16997 "Implementation-defined aspects of pragma
16998 @cite{Restrictions}.  See D.7(20)."
16999 @end itemize
17001 There are no such implementation-defined aspects.
17004 @itemize *
17006 @item 
17007 "Implementation-defined aspects of package
17008 @cite{Real_Time}.  See D.8(17)."
17009 @end itemize
17011 There are no implementation defined aspects of package @cite{Real_Time}.
17014 @itemize *
17016 @item 
17017 "Implementation-defined aspects of
17018 @cite{delay_statements}.  See D.9(8)."
17019 @end itemize
17021 Any difference greater than one microsecond will cause the task to be
17022 delayed (see D.9(7)).
17025 @itemize *
17027 @item 
17028 "The upper bound on the duration of interrupt blocking
17029 caused by the implementation.  See D.12(5)."
17030 @end itemize
17032 The upper bound is determined by the underlying operating system.  In
17033 no cases is it more than 10 milliseconds.
17036 @itemize *
17038 @item 
17039 "The means for creating and executing distributed
17040 programs.  See E(5)."
17041 @end itemize
17043 The GLADE package provides a utility GNATDIST for creating and executing
17044 distributed programs.  See the GLADE reference manual for further details.
17047 @itemize *
17049 @item 
17050 "Any events that can result in a partition becoming
17051 inaccessible.  See E.1(7)."
17052 @end itemize
17054 See the GLADE reference manual for full details on such events.
17057 @itemize *
17059 @item 
17060 "The scheduling policies, treatment of priorities, and
17061 management of shared resources between partitions in certain cases.  See
17062 E.1(11)."
17063 @end itemize
17065 See the GLADE reference manual for full details on these aspects of
17066 multi-partition execution.
17069 @itemize *
17071 @item 
17072 "Events that cause the version of a compilation unit to
17073 change.  See E.3(5)."
17074 @end itemize
17076 Editing the source file of a compilation unit, or the source files of
17077 any units on which it is dependent in a significant way cause the version
17078 to change.  No other actions cause the version number to change.  All changes
17079 are significant except those which affect only layout, capitalization or
17080 comments.
17083 @itemize *
17085 @item 
17086 "Whether the execution of the remote subprogram is
17087 immediately aborted as a result of cancellation.  See E.4(13)."
17088 @end itemize
17090 See the GLADE reference manual for details on the effect of abort in
17091 a distributed application.
17094 @itemize *
17096 @item 
17097 "Implementation-defined aspects of the PCS.  See E.5(25)."
17098 @end itemize
17100 See the GLADE reference manual for a full description of all implementation
17101 defined aspects of the PCS.
17104 @itemize *
17106 @item 
17107 "Implementation-defined interfaces in the PCS.  See
17108 E.5(26)."
17109 @end itemize
17111 See the GLADE reference manual for a full description of all
17112 implementation defined interfaces.
17115 @itemize *
17117 @item 
17118 "The values of named numbers in the package
17119 @cite{Decimal}.  See F.2(7)."
17120 @end itemize
17123 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
17124 @headitem
17126 Named Number
17128 @tab
17130 Value
17132 @item
17134 @emph{Max_Scale}
17136 @tab
17140 @item
17142 @emph{Min_Scale}
17144 @tab
17148 @item
17150 @emph{Min_Delta}
17152 @tab
17154 1.0E-18
17156 @item
17158 @emph{Max_Delta}
17160 @tab
17162 1.0E+18
17164 @item
17166 @emph{Max_Decimal_Digits}
17168 @tab
17172 @end multitable
17176 @itemize *
17178 @item 
17179 "The value of @cite{Max_Picture_Length} in the package
17180 @cite{Text_IO.Editing}.  See F.3.3(16)."
17181 @end itemize
17186 @itemize *
17188 @item 
17189 "The value of @cite{Max_Picture_Length} in the package
17190 @cite{Wide_Text_IO.Editing}.  See F.3.4(5)."
17191 @end itemize
17196 @itemize *
17198 @item 
17199 "The accuracy actually achieved by the complex elementary
17200 functions and by other complex arithmetic operations.  See G.1(1)."
17201 @end itemize
17203 Standard library functions are used for the complex arithmetic
17204 operations.  Only fast math mode is currently supported.
17207 @itemize *
17209 @item 
17210 "The sign of a zero result (or a component thereof) from
17211 any operator or function in @cite{Numerics.Generic_Complex_Types}, when
17212 @cite{Real'Signed_Zeros} is True.  See G.1.1(53)."
17213 @end itemize
17215 The signs of zero values are as recommended by the relevant
17216 implementation advice.
17219 @itemize *
17221 @item 
17222 "The sign of a zero result (or a component thereof) from
17223 any operator or function in
17224 @cite{Numerics.Generic_Complex_Elementary_Functions}, when
17225 @cite{Real'Signed_Zeros} is @cite{True}.  See G.1.2(45)."
17226 @end itemize
17228 The signs of zero values are as recommended by the relevant
17229 implementation advice.
17232 @itemize *
17234 @item 
17235 "Whether the strict mode or the relaxed mode is the
17236 default.  See G.2(2)."
17237 @end itemize
17239 The strict mode is the default.  There is no separate relaxed mode.  GNAT
17240 provides a highly efficient implementation of strict mode.
17243 @itemize *
17245 @item 
17246 "The result interval in certain cases of fixed-to-float
17247 conversion.  See G.2.1(10)."
17248 @end itemize
17250 For cases where the result interval is implementation dependent, the
17251 accuracy is that provided by performing all operations in 64-bit IEEE
17252 floating-point format.
17255 @itemize *
17257 @item 
17258 "The result of a floating point arithmetic operation in
17259 overflow situations, when the @cite{Machine_Overflows} attribute of the
17260 result type is @cite{False}.  See G.2.1(13)."
17261 @end itemize
17263 Infinite and NaN values are produced as dictated by the IEEE
17264 floating-point standard.
17265 Note that on machines that are not fully compliant with the IEEE
17266 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17267 must be used for achieving IEEE conforming behavior (although at the cost
17268 of a significant performance penalty), so infinite and NaN values are
17269 properly generated.
17272 @itemize *
17274 @item 
17275 "The result interval for division (or exponentiation by a
17276 negative exponent), when the floating point hardware implements division
17277 as multiplication by a reciprocal.  See G.2.1(16)."
17278 @end itemize
17280 Not relevant, division is IEEE exact.
17283 @itemize *
17285 @item 
17286 "The definition of close result set, which determines the
17287 accuracy of certain fixed point multiplications and divisions.  See
17288 G.2.3(5)."
17289 @end itemize
17291 Operations in the close result set are performed using IEEE long format
17292 floating-point arithmetic.  The input operands are converted to
17293 floating-point, the operation is done in floating-point, and the result
17294 is converted to the target type.
17297 @itemize *
17299 @item 
17300 "Conditions on a @cite{universal_real} operand of a fixed
17301 point multiplication or division for which the result shall be in the
17302 perfect result set.  See G.2.3(22)."
17303 @end itemize
17305 The result is only defined to be in the perfect result set if the result
17306 can be computed by a single scaling operation involving a scale factor
17307 representable in 64-bits.
17310 @itemize *
17312 @item 
17313 "The result of a fixed point arithmetic operation in
17314 overflow situations, when the @cite{Machine_Overflows} attribute of the
17315 result type is @cite{False}.  See G.2.3(27)."
17316 @end itemize
17318 Not relevant, @cite{Machine_Overflows} is @cite{True} for fixed-point
17319 types.
17322 @itemize *
17324 @item 
17325 "The result of an elementary function reference in
17326 overflow situations, when the @cite{Machine_Overflows} attribute of the
17327 result type is @cite{False}.  See G.2.4(4)."
17328 @end itemize
17330 IEEE infinite and Nan values are produced as appropriate.
17333 @itemize *
17335 @item 
17336 "The value of the angle threshold, within which certain
17337 elementary functions, complex arithmetic operations, and complex
17338 elementary functions yield results conforming to a maximum relative
17339 error bound.  See G.2.4(10)."
17340 @end itemize
17342 Information on this subject is not yet available.
17345 @itemize *
17347 @item 
17348 "The accuracy of certain elementary functions for
17349 parameters beyond the angle threshold.  See G.2.4(10)."
17350 @end itemize
17352 Information on this subject is not yet available.
17355 @itemize *
17357 @item 
17358 "The result of a complex arithmetic operation or complex
17359 elementary function reference in overflow situations, when the
17360 @cite{Machine_Overflows} attribute of the corresponding real type is
17361 @cite{False}.  See G.2.6(5)."
17362 @end itemize
17364 IEEE infinite and Nan values are produced as appropriate.
17367 @itemize *
17369 @item 
17370 "The accuracy of certain complex arithmetic operations and
17371 certain complex elementary functions for parameters (or components
17372 thereof) beyond the angle threshold.  See G.2.6(8)."
17373 @end itemize
17375 Information on those subjects is not yet available.
17378 @itemize *
17380 @item 
17381 "Information regarding bounded errors and erroneous
17382 execution.  See H.2(1)."
17383 @end itemize
17385 Information on this subject is not yet available.
17388 @itemize *
17390 @item 
17391 "Implementation-defined aspects of pragma
17392 @cite{Inspection_Point}.  See H.3.2(8)."
17393 @end itemize
17395 Pragma @cite{Inspection_Point} ensures that the variable is live and can
17396 be examined by the debugger at the inspection point.
17399 @itemize *
17401 @item 
17402 "Implementation-defined aspects of pragma
17403 @cite{Restrictions}.  See H.4(25)."
17404 @end itemize
17406 There are no implementation-defined aspects of pragma @cite{Restrictions}.  The
17407 use of pragma @cite{Restrictions [No_Exceptions]} has no effect on the
17408 generated code.  Checks must suppressed by use of pragma @cite{Suppress}.
17411 @itemize *
17413 @item 
17414 "Any restrictions on pragma @cite{Restrictions}.  See
17415 H.4(27)."
17416 @end itemize
17418 There are no restrictions on pragma @cite{Restrictions}.
17420 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
17421 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{244}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{245}
17422 @chapter Intrinsic Subprograms
17425 @geindex Intrinsic Subprograms
17427 GNAT allows a user application program to write the declaration:
17429 @example
17430 pragma Import (Intrinsic, name);
17431 @end example
17433 providing that the name corresponds to one of the implemented intrinsic
17434 subprograms in GNAT, and that the parameter profile of the referenced
17435 subprogram meets the requirements.  This chapter describes the set of
17436 implemented intrinsic subprograms, and the requirements on parameter profiles.
17437 Note that no body is supplied; as with other uses of pragma Import, the
17438 body is supplied elsewhere (in this case by the compiler itself).  Note
17439 that any use of this feature is potentially non-portable, since the
17440 Ada standard does not require Ada compilers to implement this feature.
17442 @menu
17443 * Intrinsic Operators:: 
17444 * Compilation_Date:: 
17445 * Compilation_Time:: 
17446 * Enclosing_Entity:: 
17447 * Exception_Information:: 
17448 * Exception_Message:: 
17449 * Exception_Name:: 
17450 * File:: 
17451 * Line:: 
17452 * Shifts and Rotates:: 
17453 * Source_Location:: 
17455 @end menu
17457 @node Intrinsic Operators,Compilation_Date,,Intrinsic Subprograms
17458 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{246}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{247}
17459 @section Intrinsic Operators
17462 @geindex Intrinsic operator
17464 All the predefined numeric operators in package Standard
17465 in @cite{pragma Import (Intrinsic@comma{}..)}
17466 declarations.  In the binary operator case, the operands must have the same
17467 size.  The operand or operands must also be appropriate for
17468 the operator.  For example, for addition, the operands must
17469 both be floating-point or both be fixed-point, and the
17470 right operand for @cite{"**"} must have a root type of
17471 @cite{Standard.Integer'Base}.
17472 You can use an intrinsic operator declaration as in the following example:
17474 @example
17475 type Int1 is new Integer;
17476 type Int2 is new Integer;
17478 function "+" (X1 : Int1; X2 : Int2) return Int1;
17479 function "+" (X1 : Int1; X2 : Int2) return Int2;
17480 pragma Import (Intrinsic, "+");
17481 @end example
17483 This declaration would permit 'mixed mode' arithmetic on items
17484 of the differing types @cite{Int1} and @cite{Int2}.
17485 It is also possible to specify such operators for private types, if the
17486 full views are appropriate arithmetic types.
17488 @node Compilation_Date,Compilation_Time,Intrinsic Operators,Intrinsic Subprograms
17489 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{248}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{249}
17490 @section Compilation_Date
17493 @geindex Compilation_Date
17495 This intrinsic subprogram is used in the implementation of the
17496 library package @cite{GNAT.Source_Info}.  The only useful use of the
17497 intrinsic import in this case is the one in this unit, so an
17498 application program should simply call the function
17499 @cite{GNAT.Source_Info.Compilation_Date} to obtain the date of
17500 the current compilation (in local time format MMM DD YYYY).
17502 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
17503 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{24a}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{24b}
17504 @section Compilation_Time
17507 @geindex Compilation_Time
17509 This intrinsic subprogram is used in the implementation of the
17510 library package @cite{GNAT.Source_Info}.  The only useful use of the
17511 intrinsic import in this case is the one in this unit, so an
17512 application program should simply call the function
17513 @cite{GNAT.Source_Info.Compilation_Time} to obtain the time of
17514 the current compilation (in local time format HH:MM:SS).
17516 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
17517 @anchor{gnat_rm/intrinsic_subprograms id5}@anchor{24c}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{24d}
17518 @section Enclosing_Entity
17521 @geindex Enclosing_Entity
17523 This intrinsic subprogram is used in the implementation of the
17524 library package @cite{GNAT.Source_Info}.  The only useful use of the
17525 intrinsic import in this case is the one in this unit, so an
17526 application program should simply call the function
17527 @cite{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
17528 the current subprogram, package, task, entry, or protected subprogram.
17530 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
17531 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{24e}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{24f}
17532 @section Exception_Information
17535 @geindex Exception_Information'
17537 This intrinsic subprogram is used in the implementation of the
17538 library package @cite{GNAT.Current_Exception}.  The only useful
17539 use of the intrinsic import in this case is the one in this unit,
17540 so an application program should simply call the function
17541 @cite{GNAT.Current_Exception.Exception_Information} to obtain
17542 the exception information associated with the current exception.
17544 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
17545 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{250}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{251}
17546 @section Exception_Message
17549 @geindex Exception_Message
17551 This intrinsic subprogram is used in the implementation of the
17552 library package @cite{GNAT.Current_Exception}.  The only useful
17553 use of the intrinsic import in this case is the one in this unit,
17554 so an application program should simply call the function
17555 @cite{GNAT.Current_Exception.Exception_Message} to obtain
17556 the message associated with the current exception.
17558 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
17559 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{252}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{253}
17560 @section Exception_Name
17563 @geindex Exception_Name
17565 This intrinsic subprogram is used in the implementation of the
17566 library package @cite{GNAT.Current_Exception}.  The only useful
17567 use of the intrinsic import in this case is the one in this unit,
17568 so an application program should simply call the function
17569 @cite{GNAT.Current_Exception.Exception_Name} to obtain
17570 the name of the current exception.
17572 @node File,Line,Exception_Name,Intrinsic Subprograms
17573 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{254}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{255}
17574 @section File
17577 @geindex File
17579 This intrinsic subprogram is used in the implementation of the
17580 library package @cite{GNAT.Source_Info}.  The only useful use of the
17581 intrinsic import in this case is the one in this unit, so an
17582 application program should simply call the function
17583 @cite{GNAT.Source_Info.File} to obtain the name of the current
17584 file.
17586 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
17587 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{256}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{257}
17588 @section Line
17591 @geindex Line
17593 This intrinsic subprogram is used in the implementation of the
17594 library package @cite{GNAT.Source_Info}.  The only useful use of the
17595 intrinsic import in this case is the one in this unit, so an
17596 application program should simply call the function
17597 @cite{GNAT.Source_Info.Line} to obtain the number of the current
17598 source line.
17600 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
17601 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{258}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{259}
17602 @section Shifts and Rotates
17605 @geindex Shift_Left
17607 @geindex Shift_Right
17609 @geindex Shift_Right_Arithmetic
17611 @geindex Rotate_Left
17613 @geindex Rotate_Right
17615 In standard Ada, the shift and rotate functions are available only
17616 for the predefined modular types in package @cite{Interfaces}.  However, in
17617 GNAT it is possible to define these functions for any integer
17618 type (signed or modular), as in this example:
17620 @example
17621 function Shift_Left
17622   (Value  : T;
17623    Amount : Natural) return T;
17624 @end example
17626 The function name must be one of
17627 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
17628 Rotate_Right. T must be an integer type. T'Size must be
17629 8, 16, 32 or 64 bits; if T is modular, the modulus
17630 must be 2**8, 2**16, 2**32 or 2**64.
17631 The result type must be the same as the type of @cite{Value}.
17632 The shift amount must be Natural.
17633 The formal parameter names can be anything.
17635 A more convenient way of providing these shift operators is to use
17636 the Provide_Shift_Operators pragma, which provides the function declarations
17637 and corresponding pragma Import's for all five shift functions.
17639 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
17640 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{25a}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{25b}
17641 @section Source_Location
17644 @geindex Source_Location
17646 This intrinsic subprogram is used in the implementation of the
17647 library routine @cite{GNAT.Source_Info}.  The only useful use of the
17648 intrinsic import in this case is the one in this unit, so an
17649 application program should simply call the function
17650 @cite{GNAT.Source_Info.Source_Location} to obtain the current
17651 source file location.
17653 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
17654 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{25c}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{25d}
17655 @chapter Representation Clauses and Pragmas
17658 @geindex Representation Clauses
17660 @geindex Representation Clause
17662 @geindex Representation Pragma
17664 @geindex Pragma
17665 @geindex representation
17667 This section describes the representation clauses accepted by GNAT, and
17668 their effect on the representation of corresponding data objects.
17670 GNAT fully implements Annex C (Systems Programming).  This means that all
17671 the implementation advice sections in chapter 13 are fully implemented.
17672 However, these sections only require a minimal level of support for
17673 representation clauses.  GNAT provides much more extensive capabilities,
17674 and this section describes the additional capabilities provided.
17676 @menu
17677 * Alignment Clauses:: 
17678 * Size Clauses:: 
17679 * Storage_Size Clauses:: 
17680 * Size of Variant Record Objects:: 
17681 * Biased Representation:: 
17682 * Value_Size and Object_Size Clauses:: 
17683 * Component_Size Clauses:: 
17684 * Bit_Order Clauses:: 
17685 * Effect of Bit_Order on Byte Ordering:: 
17686 * Pragma Pack for Arrays:: 
17687 * Pragma Pack for Records:: 
17688 * Record Representation Clauses:: 
17689 * Handling of Records with Holes:: 
17690 * Enumeration Clauses:: 
17691 * Address Clauses:: 
17692 * Use of Address Clauses for Memory-Mapped I/O:: 
17693 * Effect of Convention on Representation:: 
17694 * Conventions and Anonymous Access Types:: 
17695 * Determining the Representations chosen by GNAT:: 
17697 @end menu
17699 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
17700 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{25e}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{25f}
17701 @section Alignment Clauses
17704 @geindex Alignment Clause
17706 GNAT requires that all alignment clauses specify a power of 2, and all
17707 default alignments are always a power of 2.  The default alignment
17708 values are as follows:
17711 @itemize *
17713 @item 
17714 @emph{Elementary Types}.
17716 For elementary types, the alignment is the minimum of the actual size of
17717 objects of the type divided by @cite{Storage_Unit},
17718 and the maximum alignment supported by the target.
17719 (This maximum alignment is given by the GNAT-specific attribute
17720 @cite{Standard'Maximum_Alignment}; see @ref{17c,,Attribute Maximum_Alignment}.)
17722 @geindex Maximum_Alignment attribute
17724 For example, for type @cite{Long_Float}, the object size is 8 bytes, and the
17725 default alignment will be 8 on any target that supports alignments
17726 this large, but on some targets, the maximum alignment may be smaller
17727 than 8, in which case objects of type @cite{Long_Float} will be maximally
17728 aligned.
17730 @item 
17731 @emph{Arrays}.
17733 For arrays, the alignment is equal to the alignment of the component type
17734 for the normal case where no packing or component size is given.  If the
17735 array is packed, and the packing is effective (see separate section on
17736 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
17737 arrays or arrays whose length is not known at compile time, depending on
17738 whether the component size is divisible by 4, 2, or is odd.  For short packed
17739 arrays, which are handled internally as modular types, the alignment
17740 will be as described for elementary types, e.g. a packed array of length
17741 31 bits will have an object size of four bytes, and an alignment of 4.
17743 @item 
17744 @emph{Records}.
17746 For the normal non-packed case, the alignment of a record is equal to
17747 the maximum alignment of any of its components.  For tagged records, this
17748 includes the implicit access type used for the tag.  If a pragma @cite{Pack}
17749 is used and all components are packable (see separate section on pragma
17750 @cite{Pack}), then the resulting alignment is 1, unless the layout of the
17751 record makes it profitable to increase it.
17753 A special case is when:
17756 @itemize *
17758 @item 
17759 the size of the record is given explicitly, or a
17760 full record representation clause is given, and
17762 @item 
17763 the size of the record is 2, 4, or 8 bytes.
17764 @end itemize
17766 In this case, an alignment is chosen to match the
17767 size of the record. For example, if we have:
17769 @example
17770 type Small is record
17771    A, B : Character;
17772 end record;
17773 for Small'Size use 16;
17774 @end example
17776 then the default alignment of the record type @cite{Small} is 2, not 1. This
17777 leads to more efficient code when the record is treated as a unit, and also
17778 allows the type to specified as @cite{Atomic} on architectures requiring
17779 strict alignment.
17780 @end itemize
17782 An alignment clause may specify a larger alignment than the default value
17783 up to some maximum value dependent on the target (obtainable by using the
17784 attribute reference @cite{Standard'Maximum_Alignment}). It may also specify
17785 a smaller alignment than the default value for enumeration, integer and
17786 fixed point types, as well as for record types, for example
17788 @example
17789 type V is record
17790    A : Integer;
17791 end record;
17793 for V'alignment use 1;
17794 @end example
17796 @geindex Alignment
17797 @geindex default
17799 The default alignment for the type @cite{V} is 4, as a result of the
17800 Integer field in the record, but it is permissible, as shown, to
17801 override the default alignment of the record with a smaller value.
17803 @geindex Alignment
17804 @geindex subtypes
17806 Note that according to the Ada standard, an alignment clause applies only
17807 to the first named subtype. If additional subtypes are declared, then the
17808 compiler is allowed to choose any alignment it likes, and there is no way
17809 to control this choice. Consider:
17811 @example
17812 type R is range 1 .. 10_000;
17813 for R'Alignment use 1;
17814 subtype RS is R range 1 .. 1000;
17815 @end example
17817 The alignment clause specifies an alignment of 1 for the first named subtype
17818 @cite{R} but this does not necessarily apply to @cite{RS}. When writing
17819 portable Ada code, you should avoid writing code that explicitly or
17820 implicitly relies on the alignment of such subtypes.
17822 For the GNAT compiler, if an explicit alignment clause is given, this
17823 value is also used for any subsequent subtypes. So for GNAT, in the
17824 above example, you can count on the alignment of @cite{RS} being 1. But this
17825 assumption is non-portable, and other compilers may choose different
17826 alignments for the subtype @cite{RS}.
17828 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
17829 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{260}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{261}
17830 @section Size Clauses
17833 @geindex Size Clause
17835 The default size for a type @cite{T} is obtainable through the
17836 language-defined attribute @cite{T'Size} and also through the
17837 equivalent GNAT-defined attribute @cite{T'Value_Size}.
17838 For objects of type @cite{T}, GNAT will generally increase the type size
17839 so that the object size (obtainable through the GNAT-defined attribute
17840 @cite{T'Object_Size})
17841 is a multiple of @cite{T'Alignment * Storage_Unit}.
17843 For example:
17845 @example
17846 type Smallint is range 1 .. 6;
17848 type Rec is record
17849    Y1 : integer;
17850    Y2 : boolean;
17851 end record;
17852 @end example
17854 In this example, @cite{Smallint'Size} = @cite{Smallint'Value_Size} = 3,
17855 as specified by the RM rules,
17856 but objects of this type will have a size of 8
17857 (@cite{Smallint'Object_Size} = 8),
17858 since objects by default occupy an integral number
17859 of storage units.  On some targets, notably older
17860 versions of the Digital Alpha, the size of stand
17861 alone objects of this type may be 32, reflecting
17862 the inability of the hardware to do byte load/stores.
17864 Similarly, the size of type @cite{Rec} is 40 bits
17865 (@cite{Rec'Size} = @cite{Rec'Value_Size} = 40), but
17866 the alignment is 4, so objects of this type will have
17867 their size increased to 64 bits so that it is a multiple
17868 of the alignment (in bits).  This decision is
17869 in accordance with the specific Implementation Advice in RM 13.3(43):
17871 @quotation
17873 "A @cite{Size} clause should be supported for an object if the specified
17874 @cite{Size} is at least as large as its subtype's @cite{Size}, and corresponds
17875 to a size in storage elements that is a multiple of the object's
17876 @cite{Alignment} (if the @cite{Alignment} is nonzero)."
17877 @end quotation
17879 An explicit size clause may be used to override the default size by
17880 increasing it.  For example, if we have:
17882 @example
17883 type My_Boolean is new Boolean;
17884 for My_Boolean'Size use 32;
17885 @end example
17887 then values of this type will always be 32 bits long.  In the case of
17888 discrete types, the size can be increased up to 64 bits, with the effect
17889 that the entire specified field is used to hold the value, sign- or
17890 zero-extended as appropriate.  If more than 64 bits is specified, then
17891 padding space is allocated after the value, and a warning is issued that
17892 there are unused bits.
17894 Similarly the size of records and arrays may be increased, and the effect
17895 is to add padding bits after the value.  This also causes a warning message
17896 to be generated.
17898 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
17899 Size in bits, this corresponds to an object of size 256 megabytes (minus
17900 one).  This limitation is true on all targets.  The reason for this
17901 limitation is that it improves the quality of the code in many cases
17902 if it is known that a Size value can be accommodated in an object of
17903 type Integer.
17905 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
17906 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{262}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{263}
17907 @section Storage_Size Clauses
17910 @geindex Storage_Size Clause
17912 For tasks, the @cite{Storage_Size} clause specifies the amount of space
17913 to be allocated for the task stack.  This cannot be extended, and if the
17914 stack is exhausted, then @cite{Storage_Error} will be raised (if stack
17915 checking is enabled).  Use a @cite{Storage_Size} attribute definition clause,
17916 or a @cite{Storage_Size} pragma in the task definition to set the
17917 appropriate required size.  A useful technique is to include in every
17918 task definition a pragma of the form:
17920 @example
17921 pragma Storage_Size (Default_Stack_Size);
17922 @end example
17924 Then @cite{Default_Stack_Size} can be defined in a global package, and
17925 modified as required. Any tasks requiring stack sizes different from the
17926 default can have an appropriate alternative reference in the pragma.
17928 You can also use the @emph{-d} binder switch to modify the default stack
17929 size.
17931 For access types, the @cite{Storage_Size} clause specifies the maximum
17932 space available for allocation of objects of the type.  If this space is
17933 exceeded then @cite{Storage_Error} will be raised by an allocation attempt.
17934 In the case where the access type is declared local to a subprogram, the
17935 use of a @cite{Storage_Size} clause triggers automatic use of a special
17936 predefined storage pool (@cite{System.Pool_Size}) that ensures that all
17937 space for the pool is automatically reclaimed on exit from the scope in
17938 which the type is declared.
17940 A special case recognized by the compiler is the specification of a
17941 @cite{Storage_Size} of zero for an access type.  This means that no
17942 items can be allocated from the pool, and this is recognized at compile
17943 time, and all the overhead normally associated with maintaining a fixed
17944 size storage pool is eliminated.  Consider the following example:
17946 @example
17947 procedure p is
17948    type R is array (Natural) of Character;
17949    type P is access all R;
17950    for P'Storage_Size use 0;
17951    --  Above access type intended only for interfacing purposes
17953    y : P;
17955    procedure g (m : P);
17956    pragma Import (C, g);
17958    --  ...
17960 begin
17961    --  ...
17962    y := new R;
17963 end;
17964 @end example
17966 As indicated in this example, these dummy storage pools are often useful in
17967 connection with interfacing where no object will ever be allocated.  If you
17968 compile the above example, you get the warning:
17970 @example
17971 p.adb:16:09: warning: allocation from empty storage pool
17972 p.adb:16:09: warning: Storage_Error will be raised at run time
17973 @end example
17975 Of course in practice, there will not be any explicit allocators in the
17976 case of such an access declaration.
17978 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
17979 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{264}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{265}
17980 @section Size of Variant Record Objects
17983 @geindex Size
17984 @geindex variant record objects
17986 @geindex Variant record objects
17987 @geindex size
17989 In the case of variant record objects, there is a question whether Size gives
17990 information about a particular variant, or the maximum size required
17991 for any variant.  Consider the following program
17993 @example
17994 with Text_IO; use Text_IO;
17995 procedure q is
17996    type R1 (A : Boolean := False) is record
17997      case A is
17998        when True  => X : Character;
17999        when False => null;
18000      end case;
18001    end record;
18003    V1 : R1 (False);
18004    V2 : R1;
18006 begin
18007    Put_Line (Integer'Image (V1'Size));
18008    Put_Line (Integer'Image (V2'Size));
18009 end q;
18010 @end example
18012 Here we are dealing with a variant record, where the True variant
18013 requires 16 bits, and the False variant requires 8 bits.
18014 In the above example, both V1 and V2 contain the False variant,
18015 which is only 8 bits long.  However, the result of running the
18016 program is:
18018 @example
18021 @end example
18023 The reason for the difference here is that the discriminant value of
18024 V1 is fixed, and will always be False.  It is not possible to assign
18025 a True variant value to V1, therefore 8 bits is sufficient.  On the
18026 other hand, in the case of V2, the initial discriminant value is
18027 False (from the default), but it is possible to assign a True
18028 variant value to V2, therefore 16 bits must be allocated for V2
18029 in the general case, even fewer bits may be needed at any particular
18030 point during the program execution.
18032 As can be seen from the output of this program, the @cite{'Size}
18033 attribute applied to such an object in GNAT gives the actual allocated
18034 size of the variable, which is the largest size of any of the variants.
18035 The Ada Reference Manual is not completely clear on what choice should
18036 be made here, but the GNAT behavior seems most consistent with the
18037 language in the RM.
18039 In some cases, it may be desirable to obtain the size of the current
18040 variant, rather than the size of the largest variant.  This can be
18041 achieved in GNAT by making use of the fact that in the case of a
18042 subprogram parameter, GNAT does indeed return the size of the current
18043 variant (because a subprogram has no way of knowing how much space
18044 is actually allocated for the actual).
18046 Consider the following modified version of the above program:
18048 @example
18049 with Text_IO; use Text_IO;
18050 procedure q is
18051    type R1 (A : Boolean := False) is record
18052      case A is
18053        when True  => X : Character;
18054        when False => null;
18055      end case;
18056    end record;
18058    V2 : R1;
18060    function Size (V : R1) return Integer is
18061    begin
18062       return V'Size;
18063    end Size;
18065 begin
18066    Put_Line (Integer'Image (V2'Size));
18067    Put_Line (Integer'Image (Size (V2)));
18068    V2 := (True, 'x');
18069    Put_Line (Integer'Image (V2'Size));
18070    Put_Line (Integer'Image (Size (V2)));
18071 end q;
18072 @end example
18074 The output from this program is
18076 @example
18081 @end example
18083 Here we see that while the @cite{'Size} attribute always returns
18084 the maximum size, regardless of the current variant value, the
18085 @cite{Size} function does indeed return the size of the current
18086 variant value.
18088 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18089 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{266}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{267}
18090 @section Biased Representation
18093 @geindex Size for biased representation
18095 @geindex Biased representation
18097 In the case of scalars with a range starting at other than zero, it is
18098 possible in some cases to specify a size smaller than the default minimum
18099 value, and in such cases, GNAT uses an unsigned biased representation,
18100 in which zero is used to represent the lower bound, and successive values
18101 represent successive values of the type.
18103 For example, suppose we have the declaration:
18105 @example
18106 type Small is range -7 .. -4;
18107 for Small'Size use 2;
18108 @end example
18110 Although the default size of type @cite{Small} is 4, the @cite{Size}
18111 clause is accepted by GNAT and results in the following representation
18112 scheme:
18114 @example
18115 -7 is represented as 2#00#
18116 -6 is represented as 2#01#
18117 -5 is represented as 2#10#
18118 -4 is represented as 2#11#
18119 @end example
18121 Biased representation is only used if the specified @cite{Size} clause
18122 cannot be accepted in any other manner.  These reduced sizes that force
18123 biased representation can be used for all discrete types except for
18124 enumeration types for which a representation clause is given.
18126 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18127 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{268}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{269}
18128 @section Value_Size and Object_Size Clauses
18131 @geindex Value_Size
18133 @geindex Object_Size
18135 @geindex Size
18136 @geindex of objects
18138 In Ada 95 and Ada 2005, @cite{T'Size} for a type @cite{T} is the minimum
18139 number of bits required to hold values of type @cite{T}.
18140 Although this interpretation was allowed in Ada 83, it was not required,
18141 and this requirement in practice can cause some significant difficulties.
18142 For example, in most Ada 83 compilers, @cite{Natural'Size} was 32.
18143 However, in Ada 95 and Ada 2005,
18144 @cite{Natural'Size} is
18145 typically 31.  This means that code may change in behavior when moving
18146 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
18148 @example
18149 type Rec is record;
18150    A : Natural;
18151    B : Natural;
18152 end record;
18154 for Rec use record
18155    at 0  range 0 .. Natural'Size - 1;
18156    at 0  range Natural'Size .. 2 * Natural'Size - 1;
18157 end record;
18158 @end example
18160 In the above code, since the typical size of @cite{Natural} objects
18161 is 32 bits and @cite{Natural'Size} is 31, the above code can cause
18162 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18163 there are cases where the fact that the object size can exceed the
18164 size of the type causes surprises.
18166 To help get around this problem GNAT provides two implementation
18167 defined attributes, @cite{Value_Size} and @cite{Object_Size}.  When
18168 applied to a type, these attributes yield the size of the type
18169 (corresponding to the RM defined size attribute), and the size of
18170 objects of the type respectively.
18172 The @cite{Object_Size} is used for determining the default size of
18173 objects and components.  This size value can be referred to using the
18174 @cite{Object_Size} attribute.  The phrase 'is used' here means that it is
18175 the basis of the determination of the size.  The backend is free to
18176 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18177 character might be stored in 32 bits on a machine with no efficient
18178 byte access instructions such as the Alpha.
18180 The default rules for the value of @cite{Object_Size} for
18181 discrete types are as follows:
18184 @itemize *
18186 @item 
18187 The @cite{Object_Size} for base subtypes reflect the natural hardware
18188 size in bits (run the compiler with @emph{-gnatS} to find those values
18189 for numeric types). Enumeration types and fixed-point base subtypes have
18190 8, 16, 32, or 64 bits for this size, depending on the range of values
18191 to be stored.
18193 @item 
18194 The @cite{Object_Size} of a subtype is the same as the
18195 @cite{Object_Size} of
18196 the type from which it is obtained.
18198 @item 
18199 The @cite{Object_Size} of a derived base type is copied from the parent
18200 base type, and the @cite{Object_Size} of a derived first subtype is copied
18201 from the parent first subtype.
18202 @end itemize
18204 The @cite{Value_Size} attribute
18205 is the (minimum) number of bits required to store a value
18206 of the type.
18207 This value is used to determine how tightly to pack
18208 records or arrays with components of this type, and also affects
18209 the semantics of unchecked conversion (unchecked conversions where
18210 the @cite{Value_Size} values differ generate a warning, and are potentially
18211 target dependent).
18213 The default rules for the value of @cite{Value_Size} are as follows:
18216 @itemize *
18218 @item 
18219 The @cite{Value_Size} for a base subtype is the minimum number of bits
18220 required to store all values of the type (including the sign bit
18221 only if negative values are possible).
18223 @item 
18224 If a subtype statically matches the first subtype of a given type, then it has
18225 by default the same @cite{Value_Size} as the first subtype.  This is a
18226 consequence of RM 13.1(14): "if two subtypes statically match,
18227 then their subtype-specific aspects are the same".)
18229 @item 
18230 All other subtypes have a @cite{Value_Size} corresponding to the minimum
18231 number of bits required to store all values of the subtype.  For
18232 dynamic bounds, it is assumed that the value can range down or up
18233 to the corresponding bound of the ancestor
18234 @end itemize
18236 The RM defined attribute @cite{Size} corresponds to the
18237 @cite{Value_Size} attribute.
18239 The @cite{Size} attribute may be defined for a first-named subtype.  This sets
18240 the @cite{Value_Size} of
18241 the first-named subtype to the given value, and the
18242 @cite{Object_Size} of this first-named subtype to the given value padded up
18243 to an appropriate boundary.  It is a consequence of the default rules
18244 above that this @cite{Object_Size} will apply to all further subtypes.  On the
18245 other hand, @cite{Value_Size} is affected only for the first subtype, any
18246 dynamic subtypes obtained from it directly, and any statically matching
18247 subtypes.  The @cite{Value_Size} of any other static subtypes is not affected.
18249 @cite{Value_Size} and
18250 @cite{Object_Size} may be explicitly set for any subtype using
18251 an attribute definition clause.  Note that the use of these attributes
18252 can cause the RM 13.1(14) rule to be violated.  If two access types
18253 reference aliased objects whose subtypes have differing @cite{Object_Size}
18254 values as a result of explicit attribute definition clauses, then it
18255 is illegal to convert from one access subtype to the other. For a more
18256 complete description of this additional legality rule, see the
18257 description of the @cite{Object_Size} attribute.
18259 To get a feel for the difference, consider the following examples (note
18260 that in each case the base is @cite{Short_Short_Integer} with a size of 8):
18263 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
18264 @headitem
18266 Type or subtype declaration
18268 @tab
18270 Object_Size
18272 @tab
18274 Value_Size
18276 @item
18278 @code{type x1 is range 0 .. 5;}
18280 @tab
18284 @tab
18288 @item
18290 @code{type x2 is range 0 .. 5;}
18291 @code{for x2'size use 12;}
18293 @tab
18297 @tab
18301 @item
18303 @code{subtype x3 is x2 range 0 .. 3;}
18305 @tab
18309 @tab
18313 @item
18315 @code{subtype x4 is x2'base range 0 .. 10;}
18317 @tab
18321 @tab
18325 @item
18327 @code{dynamic : x2'Base range -64 .. +63;}
18329 @tab
18331 @tab
18333 @item
18335 @code{subtype x5 is x2 range 0 .. dynamic;}
18337 @tab
18341 @tab
18345 @item
18347 @code{subtype x6 is x2'base range 0 .. dynamic;}
18349 @tab
18353 @tab
18357 @end multitable
18360 Note: the entries marked '*' are not actually specified by the Ada
18361 Reference Manual, which has nothing to say about size in the dynamic
18362 case. What GNAT does is to allocate sufficient bits to accomodate any
18363 possible dynamic values for the bounds at run-time.
18365 So far, so good, but GNAT has to obey the RM rules, so the question is
18366 under what conditions must the RM @cite{Size} be used.
18367 The following is a list
18368 of the occasions on which the RM @cite{Size} must be used:
18371 @itemize *
18373 @item 
18374 Component size for packed arrays or records
18376 @item 
18377 Value of the attribute @cite{Size} for a type
18379 @item 
18380 Warning about sizes not matching for unchecked conversion
18381 @end itemize
18383 For record types, the @cite{Object_Size} is always a multiple of the
18384 alignment of the type (this is true for all types). In some cases the
18385 @cite{Value_Size} can be smaller. Consider:
18387 @example
18388 type R is record
18389   X : Integer;
18390   Y : Character;
18391 end record;
18392 @end example
18394 On a typical 32-bit architecture, the X component will be four bytes, and
18395 require four-byte alignment, and the Y component will be one byte. In this
18396 case @cite{R'Value_Size} will be 40 (bits) since this is the minimum size
18397 required to store a value of this type, and for example, it is permissible
18398 to have a component of type R in an outer array whose component size is
18399 specified to be 48 bits. However, @cite{R'Object_Size} will be 64 (bits),
18400 since it must be rounded up so that this value is a multiple of the
18401 alignment (4 bytes = 32 bits).
18403 For all other types, the @cite{Object_Size}
18404 and @cite{Value_Size} are the same (and equivalent to the RM attribute @cite{Size}).
18405 Only @cite{Size} may be specified for such types.
18407 Note that @cite{Value_Size} can be used to force biased representation
18408 for a particular subtype. Consider this example:
18410 @example
18411 type R is (A, B, C, D, E, F);
18412 subtype RAB is R range A .. B;
18413 subtype REF is R range E .. F;
18414 @end example
18416 By default, @cite{RAB}
18417 has a size of 1 (sufficient to accommodate the representation
18418 of @cite{A} and @cite{B}, 0 and 1), and @cite{REF}
18419 has a size of 3 (sufficient to accommodate the representation
18420 of @cite{E} and @cite{F}, 4 and 5). But if we add the
18421 following @cite{Value_Size} attribute definition clause:
18423 @example
18424 for REF'Value_Size use 1;
18425 @end example
18427 then biased representation is forced for @cite{REF},
18428 and 0 will represent @cite{E} and 1 will represent @cite{F}.
18429 A warning is issued when a @cite{Value_Size} attribute
18430 definition clause forces biased representation. This
18431 warning can be turned off using @cite{-gnatw.B}.
18433 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
18434 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{26a}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{26b}
18435 @section Component_Size Clauses
18438 @geindex Component_Size Clause
18440 Normally, the value specified in a component size clause must be consistent
18441 with the subtype of the array component with regard to size and alignment.
18442 In other words, the value specified must be at least equal to the size
18443 of this subtype, and must be a multiple of the alignment value.
18445 In addition, component size clauses are allowed which cause the array
18446 to be packed, by specifying a smaller value.  A first case is for
18447 component size values in the range 1 through 63.  The value specified
18448 must not be smaller than the Size of the subtype.  GNAT will accurately
18449 honor all packing requests in this range.  For example, if we have:
18451 @example
18452 type r is array (1 .. 8) of Natural;
18453 for r'Component_Size use 31;
18454 @end example
18456 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
18457 Of course access to the components of such an array is considerably
18458 less efficient than if the natural component size of 32 is used.
18459 A second case is when the subtype of the component is a record type
18460 padded because of its default alignment.  For example, if we have:
18462 @example
18463 type r is record
18464   i : Integer;
18465   j : Integer;
18466   b : Boolean;
18467 end record;
18469 type a is array (1 .. 8) of r;
18470 for a'Component_Size use 72;
18471 @end example
18473 then the resulting array has a length of 72 bytes, instead of 96 bytes
18474 if the alignment of the record (4) was obeyed.
18476 Note that there is no point in giving both a component size clause
18477 and a pragma Pack for the same array type. if such duplicate
18478 clauses are given, the pragma Pack will be ignored.
18480 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
18481 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{26c}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{26d}
18482 @section Bit_Order Clauses
18485 @geindex Bit_Order Clause
18487 @geindex bit ordering
18489 @geindex ordering
18490 @geindex of bits
18492 For record subtypes, GNAT permits the specification of the @cite{Bit_Order}
18493 attribute.  The specification may either correspond to the default bit
18494 order for the target, in which case the specification has no effect and
18495 places no additional restrictions, or it may be for the non-standard
18496 setting (that is the opposite of the default).
18498 In the case where the non-standard value is specified, the effect is
18499 to renumber bits within each byte, but the ordering of bytes is not
18500 affected.  There are certain
18501 restrictions placed on component clauses as follows:
18504 @itemize *
18506 @item 
18507 Components fitting within a single storage unit.
18509 These are unrestricted, and the effect is merely to renumber bits.  For
18510 example if we are on a little-endian machine with @cite{Low_Order_First}
18511 being the default, then the following two declarations have exactly
18512 the same effect:
18514 @example
18515 type R1 is record
18516    A : Boolean;
18517    B : Integer range 1 .. 120;
18518 end record;
18520 for R1 use record
18521    A at 0 range 0 .. 0;
18522    B at 0 range 1 .. 7;
18523 end record;
18525 type R2 is record
18526    A : Boolean;
18527    B : Integer range 1 .. 120;
18528 end record;
18530 for R2'Bit_Order use High_Order_First;
18532 for R2 use record
18533    A at 0 range 7 .. 7;
18534    B at 0 range 0 .. 6;
18535 end record;
18536 @end example
18538 The useful application here is to write the second declaration with the
18539 @cite{Bit_Order} attribute definition clause, and know that it will be treated
18540 the same, regardless of whether the target is little-endian or big-endian.
18542 @item 
18543 Components occupying an integral number of bytes.
18545 These are components that exactly fit in two or more bytes.  Such component
18546 declarations are allowed, but have no effect, since it is important to realize
18547 that the @cite{Bit_Order} specification does not affect the ordering of bytes.
18548 In particular, the following attempt at getting an endian-independent integer
18549 does not work:
18551 @example
18552 type R2 is record
18553    A : Integer;
18554 end record;
18556 for R2'Bit_Order use High_Order_First;
18558 for R2 use record
18559    A at 0 range 0 .. 31;
18560 end record;
18561 @end example
18563 This declaration will result in a little-endian integer on a
18564 little-endian machine, and a big-endian integer on a big-endian machine.
18565 If byte flipping is required for interoperability between big- and
18566 little-endian machines, this must be explicitly programmed.  This capability
18567 is not provided by @cite{Bit_Order}.
18569 @item 
18570 Components that are positioned across byte boundaries.
18572 but do not occupy an integral number of bytes.  Given that bytes are not
18573 reordered, such fields would occupy a non-contiguous sequence of bits
18574 in memory, requiring non-trivial code to reassemble.  They are for this
18575 reason not permitted, and any component clause specifying such a layout
18576 will be flagged as illegal by GNAT.
18577 @end itemize
18579 Since the misconception that Bit_Order automatically deals with all
18580 endian-related incompatibilities is a common one, the specification of
18581 a component field that is an integral number of bytes will always
18582 generate a warning.  This warning may be suppressed using @cite{pragma Warnings (Off)}
18583 if desired.  The following section contains additional
18584 details regarding the issue of byte ordering.
18586 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
18587 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{26e}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{26f}
18588 @section Effect of Bit_Order on Byte Ordering
18591 @geindex byte ordering
18593 @geindex ordering
18594 @geindex of bytes
18596 In this section we will review the effect of the @cite{Bit_Order} attribute
18597 definition clause on byte ordering.  Briefly, it has no effect at all, but
18598 a detailed example will be helpful.  Before giving this
18599 example, let us review the precise
18600 definition of the effect of defining @cite{Bit_Order}.  The effect of a
18601 non-standard bit order is described in section 13.5.3 of the Ada
18602 Reference Manual:
18604 @quotation
18606 "2   A bit ordering is a method of interpreting the meaning of
18607 the storage place attributes."
18608 @end quotation
18610 To understand the precise definition of storage place attributes in
18611 this context, we visit section 13.5.1 of the manual:
18613 @quotation
18615 "13   A record_representation_clause (without the mod_clause)
18616 specifies the layout.  The storage place attributes (see 13.5.2)
18617 are taken from the values of the position, first_bit, and last_bit
18618 expressions after normalizing those values so that first_bit is
18619 less than Storage_Unit."
18620 @end quotation
18622 The critical point here is that storage places are taken from
18623 the values after normalization, not before.  So the @cite{Bit_Order}
18624 interpretation applies to normalized values.  The interpretation
18625 is described in the later part of the 13.5.3 paragraph:
18627 @quotation
18629 "2   A bit ordering is a method of interpreting the meaning of
18630 the storage place attributes.  High_Order_First (known in the
18631 vernacular as 'big endian') means that the first bit of a
18632 storage element (bit 0) is the most significant bit (interpreting
18633 the sequence of bits that represent a component as an unsigned
18634 integer value).  Low_Order_First (known in the vernacular as
18635 'little endian') means the opposite: the first bit is the
18636 least significant."
18637 @end quotation
18639 Note that the numbering is with respect to the bits of a storage
18640 unit.  In other words, the specification affects only the numbering
18641 of bits within a single storage unit.
18643 We can make the effect clearer by giving an example.
18645 Suppose that we have an external device which presents two bytes, the first
18646 byte presented, which is the first (low addressed byte) of the two byte
18647 record is called Master, and the second byte is called Slave.
18649 The left most (most significant bit is called Control for each byte, and
18650 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
18651 (least significant) bit.
18653 On a big-endian machine, we can write the following representation clause
18655 @example
18656 type Data is record
18657    Master_Control : Bit;
18658    Master_V1      : Bit;
18659    Master_V2      : Bit;
18660    Master_V3      : Bit;
18661    Master_V4      : Bit;
18662    Master_V5      : Bit;
18663    Master_V6      : Bit;
18664    Master_V7      : Bit;
18665    Slave_Control  : Bit;
18666    Slave_V1       : Bit;
18667    Slave_V2       : Bit;
18668    Slave_V3       : Bit;
18669    Slave_V4       : Bit;
18670    Slave_V5       : Bit;
18671    Slave_V6       : Bit;
18672    Slave_V7       : Bit;
18673 end record;
18675 for Data use record
18676    Master_Control at 0 range 0 .. 0;
18677    Master_V1      at 0 range 1 .. 1;
18678    Master_V2      at 0 range 2 .. 2;
18679    Master_V3      at 0 range 3 .. 3;
18680    Master_V4      at 0 range 4 .. 4;
18681    Master_V5      at 0 range 5 .. 5;
18682    Master_V6      at 0 range 6 .. 6;
18683    Master_V7      at 0 range 7 .. 7;
18684    Slave_Control  at 1 range 0 .. 0;
18685    Slave_V1       at 1 range 1 .. 1;
18686    Slave_V2       at 1 range 2 .. 2;
18687    Slave_V3       at 1 range 3 .. 3;
18688    Slave_V4       at 1 range 4 .. 4;
18689    Slave_V5       at 1 range 5 .. 5;
18690    Slave_V6       at 1 range 6 .. 6;
18691    Slave_V7       at 1 range 7 .. 7;
18692 end record;
18693 @end example
18695 Now if we move this to a little endian machine, then the bit ordering within
18696 the byte is backwards, so we have to rewrite the record rep clause as:
18698 @example
18699 for Data use record
18700    Master_Control at 0 range 7 .. 7;
18701    Master_V1      at 0 range 6 .. 6;
18702    Master_V2      at 0 range 5 .. 5;
18703    Master_V3      at 0 range 4 .. 4;
18704    Master_V4      at 0 range 3 .. 3;
18705    Master_V5      at 0 range 2 .. 2;
18706    Master_V6      at 0 range 1 .. 1;
18707    Master_V7      at 0 range 0 .. 0;
18708    Slave_Control  at 1 range 7 .. 7;
18709    Slave_V1       at 1 range 6 .. 6;
18710    Slave_V2       at 1 range 5 .. 5;
18711    Slave_V3       at 1 range 4 .. 4;
18712    Slave_V4       at 1 range 3 .. 3;
18713    Slave_V5       at 1 range 2 .. 2;
18714    Slave_V6       at 1 range 1 .. 1;
18715    Slave_V7       at 1 range 0 .. 0;
18716 end record;
18717 @end example
18719 It is a nuisance to have to rewrite the clause, especially if
18720 the code has to be maintained on both machines.  However,
18721 this is a case that we can handle with the
18722 @cite{Bit_Order} attribute if it is implemented.
18723 Note that the implementation is not required on byte addressed
18724 machines, but it is indeed implemented in GNAT.
18725 This means that we can simply use the
18726 first record clause, together with the declaration
18728 @example
18729 for Data'Bit_Order use High_Order_First;
18730 @end example
18732 and the effect is what is desired, namely the layout is exactly the same,
18733 independent of whether the code is compiled on a big-endian or little-endian
18734 machine.
18736 The important point to understand is that byte ordering is not affected.
18737 A @cite{Bit_Order} attribute definition never affects which byte a field
18738 ends up in, only where it ends up in that byte.
18739 To make this clear, let us rewrite the record rep clause of the previous
18740 example as:
18742 @example
18743 for Data'Bit_Order use High_Order_First;
18744 for Data use record
18745    Master_Control at 0 range  0 .. 0;
18746    Master_V1      at 0 range  1 .. 1;
18747    Master_V2      at 0 range  2 .. 2;
18748    Master_V3      at 0 range  3 .. 3;
18749    Master_V4      at 0 range  4 .. 4;
18750    Master_V5      at 0 range  5 .. 5;
18751    Master_V6      at 0 range  6 .. 6;
18752    Master_V7      at 0 range  7 .. 7;
18753    Slave_Control  at 0 range  8 .. 8;
18754    Slave_V1       at 0 range  9 .. 9;
18755    Slave_V2       at 0 range 10 .. 10;
18756    Slave_V3       at 0 range 11 .. 11;
18757    Slave_V4       at 0 range 12 .. 12;
18758    Slave_V5       at 0 range 13 .. 13;
18759    Slave_V6       at 0 range 14 .. 14;
18760    Slave_V7       at 0 range 15 .. 15;
18761 end record;
18762 @end example
18764 This is exactly equivalent to saying (a repeat of the first example):
18766 @example
18767 for Data'Bit_Order use High_Order_First;
18768 for Data use record
18769    Master_Control at 0 range 0 .. 0;
18770    Master_V1      at 0 range 1 .. 1;
18771    Master_V2      at 0 range 2 .. 2;
18772    Master_V3      at 0 range 3 .. 3;
18773    Master_V4      at 0 range 4 .. 4;
18774    Master_V5      at 0 range 5 .. 5;
18775    Master_V6      at 0 range 6 .. 6;
18776    Master_V7      at 0 range 7 .. 7;
18777    Slave_Control  at 1 range 0 .. 0;
18778    Slave_V1       at 1 range 1 .. 1;
18779    Slave_V2       at 1 range 2 .. 2;
18780    Slave_V3       at 1 range 3 .. 3;
18781    Slave_V4       at 1 range 4 .. 4;
18782    Slave_V5       at 1 range 5 .. 5;
18783    Slave_V6       at 1 range 6 .. 6;
18784    Slave_V7       at 1 range 7 .. 7;
18785 end record;
18786 @end example
18788 Why are they equivalent? Well take a specific field, the @cite{Slave_V2}
18789 field.  The storage place attributes are obtained by normalizing the
18790 values given so that the @cite{First_Bit} value is less than 8.  After
18791 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
18792 we specified in the other case.
18794 Now one might expect that the @cite{Bit_Order} attribute might affect
18795 bit numbering within the entire record component (two bytes in this
18796 case, thus affecting which byte fields end up in), but that is not
18797 the way this feature is defined, it only affects numbering of bits,
18798 not which byte they end up in.
18800 Consequently it never makes sense to specify a starting bit number
18801 greater than 7 (for a byte addressable field) if an attribute
18802 definition for @cite{Bit_Order} has been given, and indeed it
18803 may be actively confusing to specify such a value, so the compiler
18804 generates a warning for such usage.
18806 If you do need to control byte ordering then appropriate conditional
18807 values must be used.  If in our example, the slave byte came first on
18808 some machines we might write:
18810 @example
18811 Master_Byte_First constant Boolean := ...;
18813 Master_Byte : constant Natural :=
18814                 1 - Boolean'Pos (Master_Byte_First);
18815 Slave_Byte  : constant Natural :=
18816                 Boolean'Pos (Master_Byte_First);
18818 for Data'Bit_Order use High_Order_First;
18819 for Data use record
18820    Master_Control at Master_Byte range 0 .. 0;
18821    Master_V1      at Master_Byte range 1 .. 1;
18822    Master_V2      at Master_Byte range 2 .. 2;
18823    Master_V3      at Master_Byte range 3 .. 3;
18824    Master_V4      at Master_Byte range 4 .. 4;
18825    Master_V5      at Master_Byte range 5 .. 5;
18826    Master_V6      at Master_Byte range 6 .. 6;
18827    Master_V7      at Master_Byte range 7 .. 7;
18828    Slave_Control  at Slave_Byte  range 0 .. 0;
18829    Slave_V1       at Slave_Byte  range 1 .. 1;
18830    Slave_V2       at Slave_Byte  range 2 .. 2;
18831    Slave_V3       at Slave_Byte  range 3 .. 3;
18832    Slave_V4       at Slave_Byte  range 4 .. 4;
18833    Slave_V5       at Slave_Byte  range 5 .. 5;
18834    Slave_V6       at Slave_Byte  range 6 .. 6;
18835    Slave_V7       at Slave_Byte  range 7 .. 7;
18836 end record;
18837 @end example
18839 Now to switch between machines, all that is necessary is
18840 to set the boolean constant @cite{Master_Byte_First} in
18841 an appropriate manner.
18843 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
18844 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{270}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{271}
18845 @section Pragma Pack for Arrays
18848 @geindex Pragma Pack (for arrays)
18850 Pragma @cite{Pack} applied to an array has an effect that depends upon whether the
18851 component type is @emph{packable}.  For a component type to be @emph{packable}, it must
18852 be one of the following cases:
18855 @itemize *
18857 @item 
18858 Any elementary type.
18860 @item 
18861 Any small packed array type with a static size.
18863 @item 
18864 Any small simple record type with a static size.
18865 @end itemize
18867 For all these cases, if the component subtype size is in the range
18868 1 through 64, then the effect of the pragma @cite{Pack} is exactly as though a
18869 component size were specified giving the component subtype size.
18871 All other types are non-packable, they occupy an integral number of storage
18872 units and the only effect of pragma Pack is to remove alignment gaps.
18874 For example if we have:
18876 @example
18877 type r is range 0 .. 17;
18879 type ar is array (1 .. 8) of r;
18880 pragma Pack (ar);
18881 @end example
18883 Then the component size of @cite{ar} will be set to 5 (i.e., to @cite{r'size},
18884 and the size of the array @cite{ar} will be exactly 40 bits).
18886 Note that in some cases this rather fierce approach to packing can produce
18887 unexpected effects.  For example, in Ada 95 and Ada 2005,
18888 subtype @cite{Natural} typically has a size of 31, meaning that if you
18889 pack an array of @cite{Natural}, you get 31-bit
18890 close packing, which saves a few bits, but results in far less efficient
18891 access.  Since many other Ada compilers will ignore such a packing request,
18892 GNAT will generate a warning on some uses of pragma @cite{Pack} that it guesses
18893 might not be what is intended.  You can easily remove this warning by
18894 using an explicit @cite{Component_Size} setting instead, which never generates
18895 a warning, since the intention of the programmer is clear in this case.
18897 GNAT treats packed arrays in one of two ways.  If the size of the array is
18898 known at compile time and is less than 64 bits, then internally the array
18899 is represented as a single modular type, of exactly the appropriate number
18900 of bits.  If the length is greater than 63 bits, or is not known at compile
18901 time, then the packed array is represented as an array of bytes, and the
18902 length is always a multiple of 8 bits.
18904 Note that to represent a packed array as a modular type, the alignment must
18905 be suitable for the modular type involved. For example, on typical machines
18906 a 32-bit packed array will be represented by a 32-bit modular integer with
18907 an alignment of four bytes. If you explicitly override the default alignment
18908 with an alignment clause that is too small, the modular representation
18909 cannot be used. For example, consider the following set of declarations:
18911 @example
18912 type R is range 1 .. 3;
18913 type S is array (1 .. 31) of R;
18914 for S'Component_Size use 2;
18915 for S'Size use 62;
18916 for S'Alignment use 1;
18917 @end example
18919 If the alignment clause were not present, then a 62-bit modular
18920 representation would be chosen (typically with an alignment of 4 or 8
18921 bytes depending on the target). But the default alignment is overridden
18922 with the explicit alignment clause. This means that the modular
18923 representation cannot be used, and instead the array of bytes
18924 representation must be used, meaning that the length must be a multiple
18925 of 8. Thus the above set of declarations will result in a diagnostic
18926 rejecting the size clause and noting that the minimum size allowed is 64.
18928 @geindex Pragma Pack (for type Natural)
18930 @geindex Pragma Pack warning
18932 One special case that is worth noting occurs when the base type of the
18933 component size is 8/16/32 and the subtype is one bit less. Notably this
18934 occurs with subtype @cite{Natural}. Consider:
18936 @example
18937 type Arr is array (1 .. 32) of Natural;
18938 pragma Pack (Arr);
18939 @end example
18941 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
18942 since typically @cite{Natural'Size} is 32 in Ada 83, and in any case most
18943 Ada 83 compilers did not attempt 31 bit packing.
18945 In Ada 95 and Ada 2005, @cite{Natural'Size} is required to be 31. Furthermore,
18946 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
18947 substantial unintended performance penalty when porting legacy Ada 83 code.
18948 To help prevent this, GNAT generates a warning in such cases. If you really
18949 want 31 bit packing in a case like this, you can set the component size
18950 explicitly:
18952 @example
18953 type Arr is array (1 .. 32) of Natural;
18954 for Arr'Component_Size use 31;
18955 @end example
18957 Here 31-bit packing is achieved as required, and no warning is generated,
18958 since in this case the programmer intention is clear.
18960 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
18961 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{272}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{273}
18962 @section Pragma Pack for Records
18965 @geindex Pragma Pack (for records)
18967 Pragma @cite{Pack} applied to a record will pack the components to reduce
18968 wasted space from alignment gaps and by reducing the amount of space
18969 taken by components.  We distinguish between @emph{packable} components and
18970 @emph{non-packable} components.
18971 Components of the following types are considered packable:
18974 @itemize *
18976 @item 
18977 Components of an elementary type are packable unless they are aliased,
18978 independent, or of an atomic type.
18980 @item 
18981 Small packed arrays, where the size is statically known, are represented
18982 internally as modular integers, and so they are also packable.
18984 @item 
18985 Small simple records, where the size is statically known, are also packable.
18986 @end itemize
18988 For all these cases, if the 'Size value is in the range 1 through 64, the
18989 components occupy the exact number of bits corresponding to this value
18990 and are packed with no padding bits, i.e. they can start on an arbitrary
18991 bit boundary.
18993 All other types are non-packable, they occupy an integral number of storage
18994 units and the only effect of pragma Pack is to remove alignment gaps.
18996 For example, consider the record
18998 @example
18999 type Rb1 is array (1 .. 13) of Boolean;
19000 pragma Pack (Rb1);
19002 type Rb2 is array (1 .. 65) of Boolean;
19003 pragma Pack (Rb2);
19005 type AF is new Float with Atomic;
19007 type X2 is record
19008    L1 : Boolean;
19009    L2 : Duration;
19010    L3 : AF;
19011    L4 : Boolean;
19012    L5 : Rb1;
19013    L6 : Rb2;
19014 end record;
19015 pragma Pack (X2);
19016 @end example
19018 The representation for the record X2 is as follows:
19020 @example
19021 for X2'Size use 224;
19022 for X2 use record
19023    L1 at  0 range  0 .. 0;
19024    L2 at  0 range  1 .. 64;
19025    L3 at 12 range  0 .. 31;
19026    L4 at 16 range  0 .. 0;
19027    L5 at 16 range  1 .. 13;
19028    L6 at 18 range  0 .. 71;
19029 end record;
19030 @end example
19032 Studying this example, we see that the packable fields @cite{L1}
19033 and @cite{L2} are
19034 of length equal to their sizes, and placed at specific bit boundaries (and
19035 not byte boundaries) to
19036 eliminate padding.  But @cite{L3} is of a non-packable float type (because
19037 it is aliased), so it is on the next appropriate alignment boundary.
19039 The next two fields are fully packable, so @cite{L4} and @cite{L5} are
19040 minimally packed with no gaps.  However, type @cite{Rb2} is a packed
19041 array that is longer than 64 bits, so it is itself non-packable.  Thus
19042 the @cite{L6} field is aligned to the next byte boundary, and takes an
19043 integral number of bytes, i.e., 72 bits.
19045 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19046 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{274}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{275}
19047 @section Record Representation Clauses
19050 @geindex Record Representation Clause
19052 Record representation clauses may be given for all record types, including
19053 types obtained by record extension.  Component clauses are allowed for any
19054 static component.  The restrictions on component clauses depend on the type
19055 of the component.
19057 @geindex Component Clause
19059 For all components of an elementary type, the only restriction on component
19060 clauses is that the size must be at least the 'Size value of the type
19061 (actually the Value_Size).  There are no restrictions due to alignment,
19062 and such components may freely cross storage boundaries.
19064 Packed arrays with a size up to and including 64 bits are represented
19065 internally using a modular type with the appropriate number of bits, and
19066 thus the same lack of restriction applies.  For example, if you declare:
19068 @example
19069 type R is array (1 .. 49) of Boolean;
19070 pragma Pack (R);
19071 for R'Size use 49;
19072 @end example
19074 then a component clause for a component of type R may start on any
19075 specified bit boundary, and may specify a value of 49 bits or greater.
19077 For packed bit arrays that are longer than 64 bits, there are two
19078 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19079 including the important case of single bits or boolean values, then
19080 there are no limitations on placement of such components, and they
19081 may start and end at arbitrary bit boundaries.
19083 If the component size is not a power of 2 (e.g., 3 or 5), then
19084 an array of this type longer than 64 bits must always be placed on
19085 on a storage unit (byte) boundary and occupy an integral number
19086 of storage units (bytes). Any component clause that does not
19087 meet this requirement will be rejected.
19089 Any aliased component, or component of an aliased type, must
19090 have its normal alignment and size. A component clause that
19091 does not meet this requirement will be rejected.
19093 The tag field of a tagged type always occupies an address sized field at
19094 the start of the record.  No component clause may attempt to overlay this
19095 tag. When a tagged type appears as a component, the tag field must have
19096 proper alignment
19098 In the case of a record extension T1, of a type T, no component clause applied
19099 to the type T1 can specify a storage location that would overlap the first
19100 T'Size bytes of the record.
19102 For all other component types, including non-bit-packed arrays,
19103 the component can be placed at an arbitrary bit boundary,
19104 so for example, the following is permitted:
19106 @example
19107 type R is array (1 .. 10) of Boolean;
19108 for R'Size use 80;
19110 type Q is record
19111    G, H : Boolean;
19112    L, M : R;
19113 end record;
19115 for Q use record
19116    G at 0 range  0 ..   0;
19117    H at 0 range  1 ..   1;
19118    L at 0 range  2 ..  81;
19119    R at 0 range 82 .. 161;
19120 end record;
19121 @end example
19123 Note: the above rules apply to recent releases of GNAT 5.
19124 In GNAT 3, there are more severe restrictions on larger components.
19125 For composite types, including packed arrays with a size greater than
19126 64 bits, component clauses must respect the alignment requirement of the
19127 type, in particular, always starting on a byte boundary, and the length
19128 must be a multiple of the storage unit.
19130 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19131 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{276}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{277}
19132 @section Handling of Records with Holes
19135 @geindex Handling of Records with Holes
19137 As a result of alignment considerations, records may contain "holes"
19138 or gaps
19139 which do not correspond to the data bits of any of the components.
19140 Record representation clauses can also result in holes in records.
19142 GNAT does not attempt to clear these holes, so in record objects,
19143 they should be considered to hold undefined rubbish. The generated
19144 equality routine just tests components so does not access these
19145 undefined bits, and assignment and copy operations may or may not
19146 preserve the contents of these holes (for assignments, the holes
19147 in the target will in practice contain either the bits that are
19148 present in the holes in the source, or the bits that were present
19149 in the target before the assignment).
19151 If it is necessary to ensure that holes in records have all zero
19152 bits, then record objects for which this initialization is desired
19153 should be explicitly set to all zero values using Unchecked_Conversion
19154 or address overlays. For example
19156 @example
19157 type HRec is record
19158    C : Character;
19159    I : Integer;
19160 end record;
19161 @end example
19163 On typical machines, integers need to be aligned on a four-byte
19164 boundary, resulting in three bytes of undefined rubbish following
19165 the 8-bit field for C. To ensure that the hole in a variable of
19166 type HRec is set to all zero bits,
19167 you could for example do:
19169 @example
19170 type Base is record
19171    Dummy1, Dummy2 : Integer := 0;
19172 end record;
19174 BaseVar : Base;
19175 RealVar : Hrec;
19176 for RealVar'Address use BaseVar'Address;
19177 @end example
19179 Now the 8-bytes of the value of RealVar start out containing all zero
19180 bits. A safer approach is to just define dummy fields, avoiding the
19181 holes, as in:
19183 @example
19184 type HRec is record
19185    C      : Character;
19186    Dummy1 : Short_Short_Integer := 0;
19187    Dummy2 : Short_Short_Integer := 0;
19188    Dummy3 : Short_Short_Integer := 0;
19189    I      : Integer;
19190 end record;
19191 @end example
19193 And to make absolutely sure that the intent of this is followed, you
19194 can use representation clauses:
19196 @example
19197 for Hrec use record
19198    C      at 0 range 0 .. 7;
19199    Dummy1 at 1 range 0 .. 7;
19200    Dummy2 at 2 range 0 .. 7;
19201    Dummy3 at 3 range 0 .. 7;
19202    I      at 4 range 0 .. 31;
19203 end record;
19204 for Hrec'Size use 64;
19205 @end example
19207 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19208 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{279}
19209 @section Enumeration Clauses
19212 The only restriction on enumeration clauses is that the range of values
19213 must be representable.  For the signed case, if one or more of the
19214 representation values are negative, all values must be in the range:
19216 @example
19217 System.Min_Int .. System.Max_Int
19218 @end example
19220 For the unsigned case, where all values are nonnegative, the values must
19221 be in the range:
19223 @example
19224 0 .. System.Max_Binary_Modulus;
19225 @end example
19227 A @emph{confirming} representation clause is one in which the values range
19228 from 0 in sequence, i.e., a clause that confirms the default representation
19229 for an enumeration type.
19230 Such a confirming representation
19231 is permitted by these rules, and is specially recognized by the compiler so
19232 that no extra overhead results from the use of such a clause.
19234 If an array has an index type which is an enumeration type to which an
19235 enumeration clause has been applied, then the array is stored in a compact
19236 manner.  Consider the declarations:
19238 @example
19239 type r is (A, B, C);
19240 for r use (A => 1, B => 5, C => 10);
19241 type t is array (r) of Character;
19242 @end example
19244 The array type t corresponds to a vector with exactly three elements and
19245 has a default size equal to @cite{3*Character'Size}.  This ensures efficient
19246 use of space, but means that accesses to elements of the array will incur
19247 the overhead of converting representation values to the corresponding
19248 positional values, (i.e., the value delivered by the @cite{Pos} attribute).
19250 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19251 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{27b}
19252 @section Address Clauses
19255 @geindex Address Clause
19257 The reference manual allows a general restriction on representation clauses,
19258 as found in RM 13.1(22):
19260 @quotation
19262 "An implementation need not support representation
19263 items containing nonstatic expressions, except that
19264 an implementation should support a representation item
19265 for a given entity if each nonstatic expression in the
19266 representation item is a name that statically denotes
19267 a constant declared before the entity."
19268 @end quotation
19270 In practice this is applicable only to address clauses, since this is the
19271 only case in which a nonstatic expression is permitted by the syntax.  As
19272 the AARM notes in sections 13.1 (22.a-22.h):
19274 @quotation
19276 22.a   Reason: This is to avoid the following sort of thing:
19278 22.b        X : Integer := F(...);
19279 Y : Address := G(...);
19280 for X'Address use Y;
19282 22.c   In the above, we have to evaluate the
19283 initialization expression for X before we
19284 know where to put the result.  This seems
19285 like an unreasonable implementation burden.
19287 22.d   The above code should instead be written
19288 like this:
19290 22.e        Y : constant Address := G(...);
19291 X : Integer := F(...);
19292 for X'Address use Y;
19294 22.f   This allows the expression 'Y' to be safely
19295 evaluated before X is created.
19297 22.g   The constant could be a formal parameter of mode in.
19299 22.h   An implementation can support other nonstatic
19300 expressions if it wants to.  Expressions of type
19301 Address are hardly ever static, but their value
19302 might be known at compile time anyway in many
19303 cases.
19304 @end quotation
19306 GNAT does indeed permit many additional cases of nonstatic expressions.  In
19307 particular, if the type involved is elementary there are no restrictions
19308 (since in this case, holding a temporary copy of the initialization value,
19309 if one is present, is inexpensive).  In addition, if there is no implicit or
19310 explicit initialization, then there are no restrictions.  GNAT will reject
19311 only the case where all three of these conditions hold:
19314 @itemize *
19316 @item 
19317 The type of the item is non-elementary (e.g., a record or array).
19319 @item 
19320 There is explicit or implicit initialization required for the object.
19321 Note that access values are always implicitly initialized.
19323 @item 
19324 The address value is nonstatic.  Here GNAT is more permissive than the
19325 RM, and allows the address value to be the address of a previously declared
19326 stand-alone variable, as long as it does not itself have an address clause.
19328 @example
19329 Anchor  : Some_Initialized_Type;
19330 Overlay : Some_Initialized_Type;
19331 for Overlay'Address use Anchor'Address;
19332 @end example
19334 However, the prefix of the address clause cannot be an array component, or
19335 a component of a discriminated record.
19336 @end itemize
19338 As noted above in section 22.h, address values are typically nonstatic.  In
19339 particular the To_Address function, even if applied to a literal value, is
19340 a nonstatic function call.  To avoid this minor annoyance, GNAT provides
19341 the implementation defined attribute 'To_Address.  The following two
19342 expressions have identical values:
19344 @geindex Attribute
19346 @geindex To_Address
19348 @example
19349 To_Address (16#1234_0000#)
19350 System'To_Address (16#1234_0000#);
19351 @end example
19353 except that the second form is considered to be a static expression, and
19354 thus when used as an address clause value is always permitted.
19356 Additionally, GNAT treats as static an address clause that is an
19357 unchecked_conversion of a static integer value.  This simplifies the porting
19358 of legacy code, and provides a portable equivalent to the GNAT attribute
19359 @cite{To_Address}.
19361 Another issue with address clauses is the interaction with alignment
19362 requirements.  When an address clause is given for an object, the address
19363 value must be consistent with the alignment of the object (which is usually
19364 the same as the alignment of the type of the object).  If an address clause
19365 is given that specifies an inappropriately aligned address value, then the
19366 program execution is erroneous.
19368 Since this source of erroneous behavior can have unfortunate effects on
19369 machines with strict alignment requirements, GNAT
19370 checks (at compile time if possible, generating a warning, or at execution
19371 time with a run-time check) that the alignment is appropriate.  If the
19372 run-time check fails, then @cite{Program_Error} is raised.  This run-time
19373 check is suppressed if range checks are suppressed, or if the special GNAT
19374 check Alignment_Check is suppressed, or if
19375 @cite{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
19376 suppressed by default on non-strict alignment machines (such as the x86).
19378 Finally, GNAT does not permit overlaying of objects of controlled types or
19379 composite types containing a controlled component. In most cases, the compiler
19380 can detect an attempt at such overlays and will generate a warning at compile
19381 time and a Program_Error exception at run time.
19383 @geindex Export
19385 An address clause cannot be given for an exported object.  More
19386 understandably the real restriction is that objects with an address
19387 clause cannot be exported.  This is because such variables are not
19388 defined by the Ada program, so there is no external object to export.
19390 @geindex Import
19392 It is permissible to give an address clause and a pragma Import for the
19393 same object.  In this case, the variable is not really defined by the
19394 Ada program, so there is no external symbol to be linked.  The link name
19395 and the external name are ignored in this case.  The reason that we allow this
19396 combination is that it provides a useful idiom to avoid unwanted
19397 initializations on objects with address clauses.
19399 When an address clause is given for an object that has implicit or
19400 explicit initialization, then by default initialization takes place.  This
19401 means that the effect of the object declaration is to overwrite the
19402 memory at the specified address.  This is almost always not what the
19403 programmer wants, so GNAT will output a warning:
19405 @example
19406 with System;
19407 package G is
19408    type R is record
19409       M : Integer := 0;
19410    end record;
19412    Ext : R;
19413    for Ext'Address use System'To_Address (16#1234_1234#);
19414        |
19415 >>> warning: implicit initialization of "Ext" may
19416     modify overlaid storage
19417 >>> warning: use pragma Import for "Ext" to suppress
19418     initialization (RM B(24))
19420 end G;
19421 @end example
19423 As indicated by the warning message, the solution is to use a (dummy) pragma
19424 Import to suppress this initialization.  The pragma tell the compiler that the
19425 object is declared and initialized elsewhere.  The following package compiles
19426 without warnings (and the initialization is suppressed):
19428 @example
19429 with System;
19430 package G is
19431    type R is record
19432       M : Integer := 0;
19433    end record;
19435    Ext : R;
19436    for Ext'Address use System'To_Address (16#1234_1234#);
19437    pragma Import (Ada, Ext);
19438 end G;
19439 @end example
19441 A final issue with address clauses involves their use for overlaying
19442 variables, as in the following example:
19444 @geindex Overlaying of objects
19446 @example
19447 A : Integer;
19448 B : Integer;
19449 for B'Address use A'Address;
19450 @end example
19452 or alternatively, using the form recommended by the RM:
19454 @example
19455 A    : Integer;
19456 Addr : constant Address := A'Address;
19457 B    : Integer;
19458 for B'Address use Addr;
19459 @end example
19461 In both of these cases, @cite{A} and @cite{B} become aliased to one another
19462 via the address clause. This use of address clauses to overlay
19463 variables, achieving an effect similar to unchecked conversion
19464 was erroneous in Ada 83, but in Ada 95 and Ada 2005
19465 the effect is implementation defined. Furthermore, the
19466 Ada RM specifically recommends that in a situation
19467 like this, @cite{B} should be subject to the following
19468 implementation advice (RM 13.3(19)):
19470 @quotation
19472 "19  If the Address of an object is specified, or it is imported
19473 or exported, then the implementation should not perform
19474 optimizations based on assumptions of no aliases."
19475 @end quotation
19477 GNAT follows this recommendation, and goes further by also applying
19478 this recommendation to the overlaid variable (@cite{A} in the above example)
19479 in this case. This means that the overlay works "as expected", in that
19480 a modification to one of the variables will affect the value of the other.
19482 More generally, GNAT interprets this recommendation conservatively for
19483 address clauses: in the cases other than overlays, it considers that the
19484 object is effectively subject to pragma @cite{Volatile} and implements the
19485 associated semantics.
19487 Note that when address clause overlays are used in this way, there is an
19488 issue of unintentional initialization, as shown by this example:
19490 @example
19491 package Overwrite_Record is
19492    type R is record
19493       A : Character := 'C';
19494       B : Character := 'A';
19495    end record;
19496    X : Short_Integer := 3;
19497    Y : R;
19498    for Y'Address use X'Address;
19499        |
19500 >>> warning: default initialization of "Y" may
19501     modify "X", use pragma Import for "Y" to
19502     suppress initialization (RM B.1(24))
19504 end Overwrite_Record;
19505 @end example
19507 Here the default initialization of @cite{Y} will clobber the value
19508 of @cite{X}, which justifies the warning. The warning notes that
19509 this effect can be eliminated by adding a @cite{pragma Import}
19510 which suppresses the initialization:
19512 @example
19513 package Overwrite_Record is
19514    type R is record
19515       A : Character := 'C';
19516       B : Character := 'A';
19517    end record;
19518    X : Short_Integer := 3;
19519    Y : R;
19520    for Y'Address use X'Address;
19521    pragma Import (Ada, Y);
19522 end Overwrite_Record;
19523 @end example
19525 Note that the use of @cite{pragma Initialize_Scalars} may cause variables to
19526 be initialized when they would not otherwise have been in the absence
19527 of the use of this pragma. This may cause an overlay to have this
19528 unintended clobbering effect. The compiler avoids this for scalar
19529 types, but not for composite objects (where in general the effect
19530 of @cite{Initialize_Scalars} is part of the initialization routine
19531 for the composite object:
19533 @example
19534 pragma Initialize_Scalars;
19535 with Ada.Text_IO;  use Ada.Text_IO;
19536 procedure Overwrite_Array is
19537    type Arr is array (1 .. 5) of Integer;
19538    X : Arr := (others => 1);
19539    A : Arr;
19540    for A'Address use X'Address;
19541        |
19542 >>> warning: default initialization of "A" may
19543     modify "X", use pragma Import for "A" to
19544     suppress initialization (RM B.1(24))
19546 begin
19547    if X /= Arr'(others => 1) then
19548       Put_Line ("X was clobbered");
19549    else
19550       Put_Line ("X was not clobbered");
19551    end if;
19552 end Overwrite_Array;
19553 @end example
19555 The above program generates the warning as shown, and at execution
19556 time, prints @cite{X was clobbered}. If the @cite{pragma Import} is
19557 added as suggested:
19559 @example
19560 pragma Initialize_Scalars;
19561 with Ada.Text_IO;  use Ada.Text_IO;
19562 procedure Overwrite_Array is
19563    type Arr is array (1 .. 5) of Integer;
19564    X : Arr := (others => 1);
19565    A : Arr;
19566    for A'Address use X'Address;
19567    pragma Import (Ada, A);
19568 begin
19569    if X /= Arr'(others => 1) then
19570       Put_Line ("X was clobbered");
19571    else
19572       Put_Line ("X was not clobbered");
19573    end if;
19574 end Overwrite_Array;
19575 @end example
19577 then the program compiles without the warning and when run will generate
19578 the output @cite{X was not clobbered}.
19580 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
19581 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{27d}
19582 @section Use of Address Clauses for Memory-Mapped I/O
19585 @geindex Memory-mapped I/O
19587 A common pattern is to use an address clause to map an atomic variable to
19588 a location in memory that corresponds to a memory-mapped I/O operation or
19589 operations, for example:
19591 @example
19592 type Mem_Word is record
19593    A,B,C,D : Byte;
19594 end record;
19595 pragma Atomic (Mem_Word);
19596 for Mem_Word_Size use 32;
19598 Mem : Mem_Word;
19599 for Mem'Address use some-address;
19601 Temp := Mem;
19602 Temp.A := 32;
19603 Mem := Temp;
19604 @end example
19606 For a full access (reference or modification) of the variable (Mem) in this
19607 case, as in the above examples, GNAT guarantees that the entire atomic word
19608 will be accessed, in accordance with the RM C.6(15) clause.
19610 A problem arises with a component access such as:
19612 @example
19613 Mem.A := 32;
19614 @end example
19616 Note that the component A is not declared as atomic. This means that it is
19617 not clear what this assignment means. It could correspond to full word read
19618 and write as given in the first example, or on architectures that supported
19619 such an operation it might be a single byte store instruction. The RM does
19620 not have anything to say in this situation, and GNAT does not make any
19621 guarantee. The code generated may vary from target to target. GNAT will issue
19622 a warning in such a case:
19624 @example
19625 Mem.A := 32;
19627 >>> warning: access to non-atomic component of atomic array,
19628     may cause unexpected accesses to atomic object
19629 @end example
19631 It is best to be explicit in this situation, by either declaring the
19632 components to be atomic if you want the byte store, or explicitly writing
19633 the full word access sequence if that is what the hardware requires.
19634 Alternatively, if the full word access sequence is required, GNAT also
19635 provides the pragma @cite{Volatile_Full_Access} which can be used in lieu of
19636 pragma @cite{Atomic} and will give the additional guarantee.
19638 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
19639 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{27f}
19640 @section Effect of Convention on Representation
19643 @geindex Convention
19644 @geindex effect on representation
19646 Normally the specification of a foreign language convention for a type or
19647 an object has no effect on the chosen representation.  In particular, the
19648 representation chosen for data in GNAT generally meets the standard system
19649 conventions, and for example records are laid out in a manner that is
19650 consistent with C.  This means that specifying convention C (for example)
19651 has no effect.
19653 There are four exceptions to this general rule:
19656 @itemize *
19658 @item 
19659 @emph{Convention Fortran and array subtypes}.
19661 If pragma Convention Fortran is specified for an array subtype, then in
19662 accordance with the implementation advice in section 3.6.2(11) of the
19663 Ada Reference Manual, the array will be stored in a Fortran-compatible
19664 column-major manner, instead of the normal default row-major order.
19666 @item 
19667 @emph{Convention C and enumeration types}
19669 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
19670 to accommodate all values of the type.  For example, for the enumeration
19671 type declared by:
19673 @example
19674 type Color is (Red, Green, Blue);
19675 @end example
19677 8 bits is sufficient to store all values of the type, so by default, objects
19678 of type @cite{Color} will be represented using 8 bits.  However, normal C
19679 convention is to use 32 bits for all enum values in C, since enum values
19680 are essentially of type int.  If pragma @cite{Convention C} is specified for an
19681 Ada enumeration type, then the size is modified as necessary (usually to
19682 32 bits) to be consistent with the C convention for enum values.
19684 Note that this treatment applies only to types. If Convention C is given for
19685 an enumeration object, where the enumeration type is not Convention C, then
19686 Object_Size bits are allocated. For example, for a normal enumeration type,
19687 with less than 256 elements, only 8 bits will be allocated for the object.
19688 Since this may be a surprise in terms of what C expects, GNAT will issue a
19689 warning in this situation. The warning can be suppressed by giving an explicit
19690 size clause specifying the desired size.
19692 @item 
19693 @emph{Convention C/Fortran and Boolean types}
19695 In C, the usual convention for boolean values, that is values used for
19696 conditions, is that zero represents false, and nonzero values represent
19697 true.  In Ada, the normal convention is that two specific values, typically
19698 0/1, are used to represent false/true respectively.
19700 Fortran has a similar convention for @cite{LOGICAL} values (any nonzero
19701 value represents true).
19703 To accommodate the Fortran and C conventions, if a pragma Convention specifies
19704 C or Fortran convention for a derived Boolean, as in the following example:
19706 @example
19707 type C_Switch is new Boolean;
19708 pragma Convention (C, C_Switch);
19709 @end example
19711 then the GNAT generated code will treat any nonzero value as true.  For truth
19712 values generated by GNAT, the conventional value 1 will be used for True, but
19713 when one of these values is read, any nonzero value is treated as True.
19714 @end itemize
19716 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
19717 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{281}
19718 @section Conventions and Anonymous Access Types
19721 @geindex Anonymous access types
19723 @geindex Convention for anonymous access types
19725 The RM is not entirely clear on convention handling in a number of cases,
19726 and in particular, it is not clear on the convention to be given to
19727 anonymous access types in general, and in particular what is to be
19728 done for the case of anonymous access-to-subprogram.
19730 In GNAT, we decide that if an explicit Convention is applied
19731 to an object or component, and its type is such an anonymous type,
19732 then the convention will apply to this anonymous type as well. This
19733 seems to make sense since it is anomolous in any case to have a
19734 different convention for an object and its type, and there is clearly
19735 no way to explicitly specify a convention for an anonymous type, since
19736 it doesn't have a name to specify!
19738 Furthermore, we decide that if a convention is applied to a record type,
19739 then this convention is inherited by any of its components that are of an
19740 anonymous access type which do not have an explicitly specified convention.
19742 The following program shows these conventions in action:
19744 @example
19745 package ConvComp is
19746    type Foo is range 1 .. 10;
19747    type T1 is record
19748       A : access function (X : Foo) return Integer;
19749       B : Integer;
19750    end record;
19751    pragma Convention (C, T1);
19753    type T2 is record
19754       A : access function (X : Foo) return Integer;
19755       pragma Convention  (C, A);
19756       B : Integer;
19757    end record;
19758    pragma Convention (COBOL, T2);
19760    type T3 is record
19761       A : access function (X : Foo) return Integer;
19762       pragma Convention  (COBOL, A);
19763       B : Integer;
19764    end record;
19765    pragma Convention (C, T3);
19767    type T4 is record
19768       A : access function (X : Foo) return Integer;
19769       B : Integer;
19770    end record;
19771    pragma Convention (COBOL, T4);
19773    function F (X : Foo) return Integer;
19774    pragma Convention (C, F);
19776    function F (X : Foo) return Integer is (13);
19778    TV1 : T1 := (F'Access, 12);  -- OK
19779    TV2 : T2 := (F'Access, 13);  -- OK
19781    TV3 : T3 := (F'Access, 13);  -- ERROR
19782                 |
19783 >>> subprogram "F" has wrong convention
19784 >>> does not match access to subprogram declared at line 17
19785      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
19786                 |
19787 >>> subprogram "F" has wrong convention
19788 >>> does not match access to subprogram declared at line 24
19789      39. end ConvComp;
19790 @end example
19792 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
19793 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{283}
19794 @section Determining the Representations chosen by GNAT
19797 @geindex Representation
19798 @geindex determination of
19800 @geindex -gnatR (gcc)
19802 Although the descriptions in this section are intended to be complete, it is
19803 often easier to simply experiment to see what GNAT accepts and what the
19804 effect is on the layout of types and objects.
19806 As required by the Ada RM, if a representation clause is not accepted, then
19807 it must be rejected as illegal by the compiler.  However, when a
19808 representation clause or pragma is accepted, there can still be questions
19809 of what the compiler actually does.  For example, if a partial record
19810 representation clause specifies the location of some components and not
19811 others, then where are the non-specified components placed? Or if pragma
19812 @cite{Pack} is used on a record, then exactly where are the resulting
19813 fields placed? The section on pragma @cite{Pack} in this chapter can be
19814 used to answer the second question, but it is often easier to just see
19815 what the compiler does.
19817 For this purpose, GNAT provides the option @emph{-gnatR}.  If you compile
19818 with this option, then the compiler will output information on the actual
19819 representations chosen, in a format similar to source representation
19820 clauses.  For example, if we compile the package:
19822 @example
19823 package q is
19824    type r (x : boolean) is tagged record
19825       case x is
19826          when True => S : String (1 .. 100);
19827          when False => null;
19828       end case;
19829    end record;
19831    type r2 is new r (false) with record
19832       y2 : integer;
19833    end record;
19835    for r2 use record
19836       y2 at 16 range 0 .. 31;
19837    end record;
19839    type x is record
19840       y : character;
19841    end record;
19843    type x1 is array (1 .. 10) of x;
19844    for x1'component_size use 11;
19846    type ia is access integer;
19848    type Rb1 is array (1 .. 13) of Boolean;
19849    pragma Pack (rb1);
19851    type Rb2 is array (1 .. 65) of Boolean;
19852    pragma Pack (rb2);
19854    type x2 is record
19855       l1 : Boolean;
19856       l2 : Duration;
19857       l3 : Float;
19858       l4 : Boolean;
19859       l5 : Rb1;
19860       l6 : Rb2;
19861    end record;
19862    pragma Pack (x2);
19863 end q;
19864 @end example
19866 using the switch @emph{-gnatR} we obtain the following output:
19868 @example
19869 Representation information for unit q
19870 -------------------------------------
19872 for r'Size use ??;
19873 for r'Alignment use 4;
19874 for r use record
19875    x    at 4 range  0 .. 7;
19876    _tag at 0 range  0 .. 31;
19877    s    at 5 range  0 .. 799;
19878 end record;
19880 for r2'Size use 160;
19881 for r2'Alignment use 4;
19882 for r2 use record
19883    x       at  4 range  0 .. 7;
19884    _tag    at  0 range  0 .. 31;
19885    _parent at  0 range  0 .. 63;
19886    y2      at 16 range  0 .. 31;
19887 end record;
19889 for x'Size use 8;
19890 for x'Alignment use 1;
19891 for x use record
19892    y at 0 range  0 .. 7;
19893 end record;
19895 for x1'Size use 112;
19896 for x1'Alignment use 1;
19897 for x1'Component_Size use 11;
19899 for rb1'Size use 13;
19900 for rb1'Alignment use 2;
19901 for rb1'Component_Size use 1;
19903 for rb2'Size use 72;
19904 for rb2'Alignment use 1;
19905 for rb2'Component_Size use 1;
19907 for x2'Size use 224;
19908 for x2'Alignment use 4;
19909 for x2 use record
19910    l1 at  0 range  0 .. 0;
19911    l2 at  0 range  1 .. 64;
19912    l3 at 12 range  0 .. 31;
19913    l4 at 16 range  0 .. 0;
19914    l5 at 16 range  1 .. 13;
19915    l6 at 18 range  0 .. 71;
19916 end record;
19917 @end example
19919 The Size values are actually the Object_Size, i.e., the default size that
19920 will be allocated for objects of the type.
19921 The @code{??} size for type r indicates that we have a variant record, and the
19922 actual size of objects will depend on the discriminant value.
19924 The Alignment values show the actual alignment chosen by the compiler
19925 for each record or array type.
19927 The record representation clause for type r shows where all fields
19928 are placed, including the compiler generated tag field (whose location
19929 cannot be controlled by the programmer).
19931 The record representation clause for the type extension r2 shows all the
19932 fields present, including the parent field, which is a copy of the fields
19933 of the parent type of r2, i.e., r1.
19935 The component size and size clauses for types rb1 and rb2 show
19936 the exact effect of pragma @cite{Pack} on these arrays, and the record
19937 representation clause for type x2 shows how pragma @cite{Pack} affects
19938 this record type.
19940 In some cases, it may be useful to cut and paste the representation clauses
19941 generated by the compiler into the original source to fix and guarantee
19942 the actual representation to be used.
19944 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
19945 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{284}@anchor{gnat_rm/standard_library_routines id1}@anchor{285}
19946 @chapter Standard Library Routines
19949 The Ada Reference Manual contains in Annex A a full description of an
19950 extensive set of standard library routines that can be used in any Ada
19951 program, and which must be provided by all Ada compilers.  They are
19952 analogous to the standard C library used by C programs.
19954 GNAT implements all of the facilities described in annex A, and for most
19955 purposes the description in the Ada Reference Manual, or appropriate Ada
19956 text book, will be sufficient for making use of these facilities.
19958 In the case of the input-output facilities,
19959 @ref{f,,The Implementation of Standard I/O},
19960 gives details on exactly how GNAT interfaces to the
19961 file system.  For the remaining packages, the Ada Reference Manual
19962 should be sufficient.  The following is a list of the packages included,
19963 together with a brief description of the functionality that is provided.
19965 For completeness, references are included to other predefined library
19966 routines defined in other sections of the Ada Reference Manual (these are
19967 cross-indexed from Annex A). For further details see the relevant
19968 package declarations in the run-time library. In particular, a few units
19969 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
19970 and in this case the package declaration contains comments explaining why
19971 the unit is not implemented.
19974 @table @asis
19976 @item @code{Ada} @emph{(A.2)}
19978 This is a parent package for all the standard library packages.  It is
19979 usually included implicitly in your program, and itself contains no
19980 useful data or routines.
19982 @item @code{Ada.Assertions} @emph{(11.4.2)}
19984 @cite{Assertions} provides the @cite{Assert} subprograms, and also
19985 the declaration of the @cite{Assertion_Error} exception.
19987 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
19989 @cite{Asynchronous_Task_Control} provides low level facilities for task
19990 synchronization. It is typically not implemented. See package spec for details.
19992 @item @code{Ada.Calendar} @emph{(9.6)}
19994 @cite{Calendar} provides time of day access, and routines for
19995 manipulating times and durations.
19997 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
19999 This package provides additional arithmetic
20000 operations for @cite{Calendar}.
20002 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20004 This package provides formatting operations for @cite{Calendar}.
20006 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20008 This package provides additional @cite{Calendar} facilities
20009 for handling time zones.
20011 @item @code{Ada.Characters} @emph{(A.3.1)}
20013 This is a dummy parent package that contains no useful entities
20015 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20017 This package provides character conversion functions.
20019 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20021 This package provides some basic character handling capabilities,
20022 including classification functions for classes of characters (e.g., test
20023 for letters, or digits).
20025 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20027 This package includes a complete set of definitions of the characters
20028 that appear in type CHARACTER.  It is useful for writing programs that
20029 will run in international environments.  For example, if you want an
20030 upper case E with an acute accent in a string, it is often better to use
20031 the definition of @cite{UC_E_Acute} in this package.  Then your program
20032 will print in an understandable manner even if your environment does not
20033 support these extended characters.
20035 @item @code{Ada.Command_Line} @emph{(A.15)}
20037 This package provides access to the command line parameters and the name
20038 of the current program (analogous to the use of @cite{argc} and @cite{argv}
20039 in C), and also allows the exit status for the program to be set in a
20040 system-independent manner.
20042 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20044 This package provides text input and output of complex numbers.
20046 @item @code{Ada.Containers} @emph{(A.18.1)}
20048 A top level package providing a few basic definitions used by all the
20049 following specific child packages that provide specific kinds of
20050 containers.
20051 @end table
20053 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20055 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20057 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20059 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20061 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20063 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20065 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20067 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20069 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20071 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20073 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20075 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20077 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20079 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20081 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20083 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20085 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20087 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20089 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20091 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20093 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20095 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20097 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20100 @table @asis
20102 @item @code{Ada.Directories} @emph{(A.16)}
20104 This package provides operations on directories.
20106 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20108 This package provides additional directory operations handling
20109 hiearchical file names.
20111 @item @code{Ada.Directories.Information} @emph{(A.16)}
20113 This is an implementation defined package for additional directory
20114 operations, which is not implemented in GNAT.
20116 @item @code{Ada.Decimal} @emph{(F.2)}
20118 This package provides constants describing the range of decimal numbers
20119 implemented, and also a decimal divide routine (analogous to the COBOL
20120 verb DIVIDE ... GIVING ... REMAINDER ...)
20122 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20124 This package provides input-output using a model of a set of records of
20125 fixed-length, containing an arbitrary definite Ada type, indexed by an
20126 integer record number.
20128 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20130 A parent package containing definitions for task dispatching operations.
20132 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20134 Not implemented in GNAT.
20136 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20138 Not implemented in GNAT.
20140 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20142 Not implemented in GNAT.
20144 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20146 This package allows the priorities of a task to be adjusted dynamically
20147 as the task is running.
20149 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20151 This package provides facilities for accessing environment variables.
20153 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20155 This package provides additional information on exceptions, and also
20156 contains facilities for treating exceptions as data objects, and raising
20157 exceptions with associated messages.
20159 @item @code{Ada.Execution_Time} @emph{(D.14)}
20161 Not implemented in GNAT.
20163 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20165 Not implemented in GNAT.
20167 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20169 Not implemented in GNAT.
20171 @item @code{Ada.Finalization} @emph{(7.6)}
20173 This package contains the declarations and subprograms to support the
20174 use of controlled types, providing for automatic initialization and
20175 finalization (analogous to the constructors and destructors of C++).
20177 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20179 A library level instantiation of Text_IO.Float_IO for type Float.
20181 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20183 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20185 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20187 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20189 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20191 A library level instantiation of Text_IO.Integer_IO for type Integer.
20193 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20195 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20197 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20199 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20201 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20203 This package provides facilities for interfacing to interrupts, which
20204 includes the set of signals or conditions that can be raised and
20205 recognized as interrupts.
20207 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20209 This package provides the set of interrupt names (actually signal
20210 or condition names) that can be handled by GNAT.
20212 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20214 This package defines the set of exceptions that can be raised by use of
20215 the standard IO packages.
20217 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20219 This package provides a generic interface to generalized iterators.
20221 @item @code{Ada.Locales} @emph{(A.19)}
20223 This package provides declarations providing information (Language
20224 and Country) about the current locale.
20226 @item @code{Ada.Numerics}
20228 This package contains some standard constants and exceptions used
20229 throughout the numerics packages.  Note that the constants pi and e are
20230 defined here, and it is better to use these definitions than rolling
20231 your own.
20233 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20235 Provides operations on arrays of complex numbers.
20237 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20239 Provides the implementation of standard elementary functions (such as
20240 log and trigonometric functions) operating on complex numbers using the
20241 standard @cite{Float} and the @cite{Complex} and @cite{Imaginary} types
20242 created by the package @cite{Numerics.Complex_Types}.
20244 @item @code{Ada.Numerics.Complex_Types}
20246 This is a predefined instantiation of
20247 @cite{Numerics.Generic_Complex_Types} using @cite{Standard.Float} to
20248 build the type @cite{Complex} and @cite{Imaginary}.
20250 @item @code{Ada.Numerics.Discrete_Random}
20252 This generic package provides a random number generator suitable for generating
20253 uniformly distributed values of a specified discrete subtype.
20255 @item @code{Ada.Numerics.Float_Random}
20257 This package provides a random number generator suitable for generating
20258 uniformly distributed floating point values in the unit interval.
20260 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20262 This is a generic version of the package that provides the
20263 implementation of standard elementary functions (such as log and
20264 trigonometric functions) for an arbitrary complex type.
20266 The following predefined instantiations of this package are provided:
20269 @itemize *
20271 @item 
20272 @code{Short_Float}
20274 @cite{Ada.Numerics.Short_Complex_Elementary_Functions}
20276 @item 
20277 @code{Float}
20279 @cite{Ada.Numerics.Complex_Elementary_Functions}
20281 @item 
20282 @code{Long_Float}
20284 @cite{Ada.Numerics.Long_Complex_Elementary_Functions}
20285 @end itemize
20287 @item @code{Ada.Numerics.Generic_Complex_Types}
20289 This is a generic package that allows the creation of complex types,
20290 with associated complex arithmetic operations.
20292 The following predefined instantiations of this package exist
20295 @itemize *
20297 @item 
20298 @code{Short_Float}
20300 @cite{Ada.Numerics.Short_Complex_Complex_Types}
20302 @item 
20303 @code{Float}
20305 @cite{Ada.Numerics.Complex_Complex_Types}
20307 @item 
20308 @code{Long_Float}
20310 @cite{Ada.Numerics.Long_Complex_Complex_Types}
20311 @end itemize
20313 @item @code{Ada.Numerics.Generic_Elementary_Functions}
20315 This is a generic package that provides the implementation of standard
20316 elementary functions (such as log an trigonometric functions) for an
20317 arbitrary float type.
20319 The following predefined instantiations of this package exist
20322 @itemize *
20324 @item 
20325 @code{Short_Float}
20327 @cite{Ada.Numerics.Short_Elementary_Functions}
20329 @item 
20330 @code{Float}
20332 @cite{Ada.Numerics.Elementary_Functions}
20334 @item 
20335 @code{Long_Float}
20337 @cite{Ada.Numerics.Long_Elementary_Functions}
20338 @end itemize
20340 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
20342 Generic operations on arrays of reals
20344 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
20346 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
20348 @item @code{Ada.Real_Time} @emph{(D.8)}
20350 This package provides facilities similar to those of @cite{Calendar}, but
20351 operating with a finer clock suitable for real time control. Note that
20352 annex D requires that there be no backward clock jumps, and GNAT generally
20353 guarantees this behavior, but of course if the external clock on which
20354 the GNAT runtime depends is deliberately reset by some external event,
20355 then such a backward jump may occur.
20357 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
20359 Not implemented in GNAT.
20361 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
20363 This package provides input-output facilities for sequential files,
20364 which can contain a sequence of values of a single type, which can be
20365 any Ada type, including indefinite (unconstrained) types.
20367 @item @code{Ada.Storage_IO} @emph{(A.9)}
20369 This package provides a facility for mapping arbitrary Ada types to and
20370 from a storage buffer.  It is primarily intended for the creation of new
20371 IO packages.
20373 @item @code{Ada.Streams} @emph{(13.13.1)}
20375 This is a generic package that provides the basic support for the
20376 concept of streams as used by the stream attributes (@cite{Input},
20377 @cite{Output}, @cite{Read} and @cite{Write}).
20379 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
20381 This package is a specialization of the type @cite{Streams} defined in
20382 package @cite{Streams} together with a set of operations providing
20383 Stream_IO capability.  The Stream_IO model permits both random and
20384 sequential access to a file which can contain an arbitrary set of values
20385 of one or more Ada types.
20387 @item @code{Ada.Strings} @emph{(A.4.1)}
20389 This package provides some basic constants used by the string handling
20390 packages.
20392 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
20394 This package provides facilities for handling variable length
20395 strings.  The bounded model requires a maximum length.  It is thus
20396 somewhat more limited than the unbounded model, but avoids the use of
20397 dynamic allocation or finalization.
20399 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20401 Provides case-insensitive comparisons of bounded strings
20403 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
20405 This package provides a generic hash function for bounded strings
20407 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20409 This package provides a generic hash function for bounded strings that
20410 converts the string to be hashed to lower case.
20412 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
20414 This package provides a comparison function for bounded strings that works
20415 in a case insensitive manner by converting to lower case before the comparison.
20417 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
20419 This package provides facilities for handling fixed length strings.
20421 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
20423 This package provides an equality function for fixed strings that compares
20424 the strings after converting both to lower case.
20426 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
20428 This package provides a case insensitive hash function for fixed strings that
20429 converts the string to lower case before computing the hash.
20431 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
20433 This package provides a comparison function for fixed strings that works
20434 in a case insensitive manner by converting to lower case before the comparison.
20436 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
20438 This package provides a hash function for strings.
20440 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
20442 This package provides a hash function for strings that is case insensitive.
20443 The string is converted to lower case before computing the hash.
20445 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
20447 This package provides a comparison function for\strings that works
20448 in a case insensitive manner by converting to lower case before the comparison.
20450 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
20452 This package provides facilities for handling character mappings and
20453 arbitrarily defined subsets of characters.  For instance it is useful in
20454 defining specialized translation tables.
20456 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
20458 This package provides a standard set of predefined mappings and
20459 predefined character sets.  For example, the standard upper to lower case
20460 conversion table is found in this package.  Note that upper to lower case
20461 conversion is non-trivial if you want to take the entire set of
20462 characters, including extended characters like E with an acute accent,
20463 into account.  You should use the mappings in this package (rather than
20464 adding 32 yourself) to do case mappings.
20466 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
20468 This package provides facilities for handling variable length
20469 strings.  The unbounded model allows arbitrary length strings, but
20470 requires the use of dynamic allocation and finalization.
20472 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20474 Provides case-insensitive comparisons of unbounded strings
20476 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
20478 This package provides a generic hash function for unbounded strings
20480 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20482 This package provides a generic hash function for unbounded strings that
20483 converts the string to be hashed to lower case.
20485 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
20487 This package provides a comparison function for unbounded strings that works
20488 in a case insensitive manner by converting to lower case before the comparison.
20490 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
20492 This package provides basic definitions for dealing with UTF-encoded strings.
20494 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
20496 This package provides conversion functions for UTF-encoded strings.
20497 @end table
20499 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
20501 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
20504 @table @asis
20506 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
20508 These packages provide facilities for handling UTF encodings for
20509 Strings, Wide_Strings and Wide_Wide_Strings.
20510 @end table
20512 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
20514 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
20516 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
20519 @table @asis
20521 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
20523 These packages provide analogous capabilities to the corresponding
20524 packages without @code{Wide_} in the name, but operate with the types
20525 @cite{Wide_String} and @cite{Wide_Character} instead of @cite{String}
20526 and @cite{Character}. Versions of all the child packages are available.
20527 @end table
20529 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
20531 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
20533 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
20536 @table @asis
20538 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
20540 These packages provide analogous capabilities to the corresponding
20541 packages without @code{Wide_} in the name, but operate with the types
20542 @cite{Wide_Wide_String} and @cite{Wide_Wide_Character} instead
20543 of @cite{String} and @cite{Character}.
20545 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
20547 This package provides facilities for synchronizing tasks at a low level
20548 with barriers.
20550 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
20552 This package provides some standard facilities for controlling task
20553 communication in a synchronous manner.
20555 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
20557 Not implemented in GNAT.
20559 @item @code{Ada.Tags}
20561 This package contains definitions for manipulation of the tags of tagged
20562 values.
20564 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
20566 This package provides a way of constructing tagged class-wide values given
20567 only the tag value.
20569 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
20571 This package provides the capability of associating arbitrary
20572 task-specific data with separate tasks.
20574 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
20576 This package provides capabilities for task identification.
20578 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
20580 This package provides control over task termination.
20582 @item @code{Ada.Text_IO}
20584 This package provides basic text input-output capabilities for
20585 character, string and numeric data.  The subpackages of this
20586 package are listed next. Note that although these are defined
20587 as subpackages in the RM, they are actually transparently
20588 implemented as child packages in GNAT, meaning that they
20589 are only loaded if needed.
20591 @item @code{Ada.Text_IO.Decimal_IO}
20593 Provides input-output facilities for decimal fixed-point types
20595 @item @code{Ada.Text_IO.Enumeration_IO}
20597 Provides input-output facilities for enumeration types.
20599 @item @code{Ada.Text_IO.Fixed_IO}
20601 Provides input-output facilities for ordinary fixed-point types.
20603 @item @code{Ada.Text_IO.Float_IO}
20605 Provides input-output facilities for float types.  The following
20606 predefined instantiations of this generic package are available:
20609 @itemize *
20611 @item 
20612 @code{Short_Float}
20614 @cite{Short_Float_Text_IO}
20616 @item 
20617 @code{Float}
20619 @cite{Float_Text_IO}
20621 @item 
20622 @code{Long_Float}
20624 @cite{Long_Float_Text_IO}
20625 @end itemize
20627 @item @code{Ada.Text_IO.Integer_IO}
20629 Provides input-output facilities for integer types.  The following
20630 predefined instantiations of this generic package are available:
20633 @itemize *
20635 @item 
20636 @code{Short_Short_Integer}
20638 @cite{Ada.Short_Short_Integer_Text_IO}
20640 @item 
20641 @code{Short_Integer}
20643 @cite{Ada.Short_Integer_Text_IO}
20645 @item 
20646 @code{Integer}
20648 @cite{Ada.Integer_Text_IO}
20650 @item 
20651 @code{Long_Integer}
20653 @cite{Ada.Long_Integer_Text_IO}
20655 @item 
20656 @code{Long_Long_Integer}
20658 @cite{Ada.Long_Long_Integer_Text_IO}
20659 @end itemize
20661 @item @code{Ada.Text_IO.Modular_IO}
20663 Provides input-output facilities for modular (unsigned) types.
20665 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
20667 Provides input-output facilities for bounded strings.
20669 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
20671 This package provides basic text input-output capabilities for complex
20672 data.
20674 @item @code{Ada.Text_IO.Editing (F.3.3)}
20676 This package contains routines for edited output, analogous to the use
20677 of pictures in COBOL.  The picture formats used by this package are a
20678 close copy of the facility in COBOL.
20680 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
20682 This package provides a facility that allows Text_IO files to be treated
20683 as streams, so that the stream attributes can be used for writing
20684 arbitrary data, including binary data, to Text_IO files.
20686 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
20688 This package provides input-output facilities for unbounded strings.
20690 @item @code{Ada.Unchecked_Conversion (13.9)}
20692 This generic package allows arbitrary conversion from one type to
20693 another of the same size, providing for breaking the type safety in
20694 special circumstances.
20696 If the types have the same Size (more accurately the same Value_Size),
20697 then the effect is simply to transfer the bits from the source to the
20698 target type without any modification.  This usage is well defined, and
20699 for simple types whose representation is typically the same across
20700 all implementations, gives a portable method of performing such
20701 conversions.
20703 If the types do not have the same size, then the result is implementation
20704 defined, and thus may be non-portable.  The following describes how GNAT
20705 handles such unchecked conversion cases.
20707 If the types are of different sizes, and are both discrete types, then
20708 the effect is of a normal type conversion without any constraint checking.
20709 In particular if the result type has a larger size, the result will be
20710 zero or sign extended.  If the result type has a smaller size, the result
20711 will be truncated by ignoring high order bits.
20713 If the types are of different sizes, and are not both discrete types,
20714 then the conversion works as though pointers were created to the source
20715 and target, and the pointer value is converted.  The effect is that bits
20716 are copied from successive low order storage units and bits of the source
20717 up to the length of the target type.
20719 A warning is issued if the lengths differ, since the effect in this
20720 case is implementation dependent, and the above behavior may not match
20721 that of some other compiler.
20723 A pointer to one type may be converted to a pointer to another type using
20724 unchecked conversion.  The only case in which the effect is undefined is
20725 when one or both pointers are pointers to unconstrained array types.  In
20726 this case, the bounds information may get incorrectly transferred, and in
20727 particular, GNAT uses double size pointers for such types, and it is
20728 meaningless to convert between such pointer types.  GNAT will issue a
20729 warning if the alignment of the target designated type is more strict
20730 than the alignment of the source designated type (since the result may
20731 be unaligned in this case).
20733 A pointer other than a pointer to an unconstrained array type may be
20734 converted to and from System.Address.  Such usage is common in Ada 83
20735 programs, but note that Ada.Address_To_Access_Conversions is the
20736 preferred method of performing such conversions in Ada 95 and Ada 2005.
20737 Neither
20738 unchecked conversion nor Ada.Address_To_Access_Conversions should be
20739 used in conjunction with pointers to unconstrained objects, since
20740 the bounds information cannot be handled correctly in this case.
20742 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
20744 This generic package allows explicit freeing of storage previously
20745 allocated by use of an allocator.
20747 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
20749 This package is similar to @cite{Ada.Text_IO}, except that the external
20750 file supports wide character representations, and the internal types are
20751 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20752 and @cite{String}. The corresponding set of nested packages and child
20753 packages are defined.
20755 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
20757 This package is similar to @cite{Ada.Text_IO}, except that the external
20758 file supports wide character representations, and the internal types are
20759 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20760 and @cite{String}. The corresponding set of nested packages and child
20761 packages are defined.
20762 @end table
20764 For packages in Interfaces and System, all the RM defined packages are
20765 available in GNAT, see the Ada 2012 RM for full details.
20767 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
20768 @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{286}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{287}
20769 @chapter The Implementation of Standard I/O
20772 GNAT implements all the required input-output facilities described in
20773 A.6 through A.14.  These sections of the Ada Reference Manual describe the
20774 required behavior of these packages from the Ada point of view, and if
20775 you are writing a portable Ada program that does not need to know the
20776 exact manner in which Ada maps to the outside world when it comes to
20777 reading or writing external files, then you do not need to read this
20778 chapter.  As long as your files are all regular files (not pipes or
20779 devices), and as long as you write and read the files only from Ada, the
20780 description in the Ada Reference Manual is sufficient.
20782 However, if you want to do input-output to pipes or other devices, such
20783 as the keyboard or screen, or if the files you are dealing with are
20784 either generated by some other language, or to be read by some other
20785 language, then you need to know more about the details of how the GNAT
20786 implementation of these input-output facilities behaves.
20788 In this chapter we give a detailed description of exactly how GNAT
20789 interfaces to the file system.  As always, the sources of the system are
20790 available to you for answering questions at an even more detailed level,
20791 but for most purposes the information in this chapter will suffice.
20793 Another reason that you may need to know more about how input-output is
20794 implemented arises when you have a program written in mixed languages
20795 where, for example, files are shared between the C and Ada sections of
20796 the same program.  GNAT provides some additional facilities, in the form
20797 of additional child library packages, that facilitate this sharing, and
20798 these additional facilities are also described in this chapter.
20800 @menu
20801 * Standard I/O Packages:: 
20802 * FORM Strings:: 
20803 * Direct_IO:: 
20804 * Sequential_IO:: 
20805 * Text_IO:: 
20806 * Wide_Text_IO:: 
20807 * Wide_Wide_Text_IO:: 
20808 * Stream_IO:: 
20809 * Text Translation:: 
20810 * Shared Files:: 
20811 * Filenames encoding:: 
20812 * File content encoding:: 
20813 * Open Modes:: 
20814 * Operations on C Streams:: 
20815 * Interfacing to C Streams:: 
20817 @end menu
20819 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
20820 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{288}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{289}
20821 @section Standard I/O Packages
20824 The Standard I/O packages described in Annex A for
20827 @itemize *
20829 @item 
20830 Ada.Text_IO
20832 @item 
20833 Ada.Text_IO.Complex_IO
20835 @item 
20836 Ada.Text_IO.Text_Streams
20838 @item 
20839 Ada.Wide_Text_IO
20841 @item 
20842 Ada.Wide_Text_IO.Complex_IO
20844 @item 
20845 Ada.Wide_Text_IO.Text_Streams
20847 @item 
20848 Ada.Wide_Wide_Text_IO
20850 @item 
20851 Ada.Wide_Wide_Text_IO.Complex_IO
20853 @item 
20854 Ada.Wide_Wide_Text_IO.Text_Streams
20856 @item 
20857 Ada.Stream_IO
20859 @item 
20860 Ada.Sequential_IO
20862 @item 
20863 Ada.Direct_IO
20864 @end itemize
20866 are implemented using the C
20867 library streams facility; where
20870 @itemize *
20872 @item 
20873 All files are opened using @cite{fopen}.
20875 @item 
20876 All input/output operations use @cite{fread}/@cite{fwrite}.
20877 @end itemize
20879 There is no internal buffering of any kind at the Ada library level. The only
20880 buffering is that provided at the system level in the implementation of the
20881 library routines that support streams. This facilitates shared use of these
20882 streams by mixed language programs. Note though that system level buffering is
20883 explicitly enabled at elaboration of the standard I/O packages and that can
20884 have an impact on mixed language programs, in particular those using I/O before
20885 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
20886 the Ada elaboration routine before performing any I/O or when impractical,
20887 flush the common I/O streams and in particular Standard_Output before
20888 elaborating the Ada code.
20890 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
20891 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{28a}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{28b}
20892 @section FORM Strings
20895 The format of a FORM string in GNAT is:
20897 @example
20898 "keyword=value,keyword=value,...,keyword=value"
20899 @end example
20901 where letters may be in upper or lower case, and there are no spaces
20902 between values.  The order of the entries is not important.  Currently
20903 the following keywords defined.
20905 @example
20906 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
20907 SHARED=[YES|NO]
20908 WCEM=[n|h|u|s|e|8|b]
20909 ENCODING=[UTF8|8BITS]
20910 @end example
20912 The use of these parameters is described later in this section. If an
20913 unrecognized keyword appears in a form string, it is silently ignored
20914 and not considered invalid.
20916 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
20917 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{28c}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{28d}
20918 @section Direct_IO
20921 Direct_IO can only be instantiated for definite types.  This is a
20922 restriction of the Ada language, which means that the records are fixed
20923 length (the length being determined by @code{type'Size}, rounded
20924 up to the next storage unit boundary if necessary).
20926 The records of a Direct_IO file are simply written to the file in index
20927 sequence, with the first record starting at offset zero, and subsequent
20928 records following.  There is no control information of any kind.  For
20929 example, if 32-bit integers are being written, each record takes
20930 4-bytes, so the record at index @cite{K} starts at offset
20931 (@cite{K}-1)*4.
20933 There is no limit on the size of Direct_IO files, they are expanded as
20934 necessary to accommodate whatever records are written to the file.
20936 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
20937 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{28e}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{28f}
20938 @section Sequential_IO
20941 Sequential_IO may be instantiated with either a definite (constrained)
20942 or indefinite (unconstrained) type.
20944 For the definite type case, the elements written to the file are simply
20945 the memory images of the data values with no control information of any
20946 kind.  The resulting file should be read using the same type, no validity
20947 checking is performed on input.
20949 For the indefinite type case, the elements written consist of two
20950 parts.  First is the size of the data item, written as the memory image
20951 of a @cite{Interfaces.C.size_t} value, followed by the memory image of
20952 the data value.  The resulting file can only be read using the same
20953 (unconstrained) type.  Normal assignment checks are performed on these
20954 read operations, and if these checks fail, @cite{Data_Error} is
20955 raised.  In particular, in the array case, the lengths must match, and in
20956 the variant record case, if the variable for a particular read operation
20957 is constrained, the discriminants must match.
20959 Note that it is not possible to use Sequential_IO to write variable
20960 length array items, and then read the data back into different length
20961 arrays.  For example, the following will raise @cite{Data_Error}:
20963 @example
20964 package IO is new Sequential_IO (String);
20965 F : IO.File_Type;
20966 S : String (1..4);
20968 IO.Create (F)
20969 IO.Write (F, "hello!")
20970 IO.Reset (F, Mode=>In_File);
20971 IO.Read (F, S);
20972 Put_Line (S);
20973 @end example
20975 On some Ada implementations, this will print @cite{hell}, but the program is
20976 clearly incorrect, since there is only one element in the file, and that
20977 element is the string @cite{hello!}.
20979 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
20980 using Stream_IO, and this is the preferred mechanism.  In particular, the
20981 above program fragment rewritten to use Stream_IO will work correctly.
20983 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
20984 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{290}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{291}
20985 @section Text_IO
20988 Text_IO files consist of a stream of characters containing the following
20989 special control characters:
20991 @example
20992 LF (line feed, 16#0A#) Line Mark
20993 FF (form feed, 16#0C#) Page Mark
20994 @end example
20996 A canonical Text_IO file is defined as one in which the following
20997 conditions are met:
21000 @itemize *
21002 @item 
21003 The character @cite{LF} is used only as a line mark, i.e., to mark the end
21004 of the line.
21006 @item 
21007 The character @cite{FF} is used only as a page mark, i.e., to mark the
21008 end of a page and consequently can appear only immediately following a
21009 @cite{LF} (line mark) character.
21011 @item 
21012 The file ends with either @cite{LF} (line mark) or @cite{LF}-@cite{FF}
21013 (line mark, page mark).  In the former case, the page mark is implicitly
21014 assumed to be present.
21015 @end itemize
21017 A file written using Text_IO will be in canonical form provided that no
21018 explicit @cite{LF} or @cite{FF} characters are written using @cite{Put}
21019 or @cite{Put_Line}.  There will be no @cite{FF} character at the end of
21020 the file unless an explicit @cite{New_Page} operation was performed
21021 before closing the file.
21023 A canonical Text_IO file that is a regular file (i.e., not a device or a
21024 pipe) can be read using any of the routines in Text_IO.  The
21025 semantics in this case will be exactly as defined in the Ada Reference
21026 Manual, and all the routines in Text_IO are fully implemented.
21028 A text file that does not meet the requirements for a canonical Text_IO
21029 file has one of the following:
21032 @itemize *
21034 @item 
21035 The file contains @cite{FF} characters not immediately following a
21036 @cite{LF} character.
21038 @item 
21039 The file contains @cite{LF} or @cite{FF} characters written by
21040 @cite{Put} or @cite{Put_Line}, which are not logically considered to be
21041 line marks or page marks.
21043 @item 
21044 The file ends in a character other than @cite{LF} or @cite{FF},
21045 i.e., there is no explicit line mark or page mark at the end of the file.
21046 @end itemize
21048 Text_IO can be used to read such non-standard text files but subprograms
21049 to do with line or page numbers do not have defined meanings.  In
21050 particular, a @cite{FF} character that does not follow a @cite{LF}
21051 character may or may not be treated as a page mark from the point of
21052 view of page and line numbering.  Every @cite{LF} character is considered
21053 to end a line, and there is an implied @cite{LF} character at the end of
21054 the file.
21056 @menu
21057 * Stream Pointer Positioning:: 
21058 * Reading and Writing Non-Regular Files:: 
21059 * Get_Immediate:: 
21060 * Treating Text_IO Files as Streams:: 
21061 * Text_IO Extensions:: 
21062 * Text_IO Facilities for Unbounded Strings:: 
21064 @end menu
21066 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21067 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{292}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{293}
21068 @subsection Stream Pointer Positioning
21071 @cite{Ada.Text_IO} has a definition of current position for a file that
21072 is being read.  No internal buffering occurs in Text_IO, and usually the
21073 physical position in the stream used to implement the file corresponds
21074 to this logical position defined by Text_IO.  There are two exceptions:
21077 @itemize *
21079 @item 
21080 After a call to @cite{End_Of_Page} that returns @cite{True}, the stream
21081 is positioned past the @cite{LF} (line mark) that precedes the page
21082 mark.  Text_IO maintains an internal flag so that subsequent read
21083 operations properly handle the logical position which is unchanged by
21084 the @cite{End_Of_Page} call.
21086 @item 
21087 After a call to @cite{End_Of_File} that returns @cite{True}, if the
21088 Text_IO file was positioned before the line mark at the end of file
21089 before the call, then the logical position is unchanged, but the stream
21090 is physically positioned right at the end of file (past the line mark,
21091 and past a possible page mark following the line mark.  Again Text_IO
21092 maintains internal flags so that subsequent read operations properly
21093 handle the logical position.
21094 @end itemize
21096 These discrepancies have no effect on the observable behavior of
21097 Text_IO, but if a single Ada stream is shared between a C program and
21098 Ada program, or shared (using @code{shared=yes} in the form string)
21099 between two Ada files, then the difference may be observable in some
21100 situations.
21102 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21103 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{294}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{295}
21104 @subsection Reading and Writing Non-Regular Files
21107 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
21108 can be used for reading and writing.  Writing is not affected and the
21109 sequence of characters output is identical to the normal file case, but
21110 for reading, the behavior of Text_IO is modified to avoid undesirable
21111 look-ahead as follows:
21113 An input file that is not a regular file is considered to have no page
21114 marks.  Any @cite{Ascii.FF} characters (the character normally used for a
21115 page mark) appearing in the file are considered to be data
21116 characters.  In particular:
21119 @itemize *
21121 @item 
21122 @cite{Get_Line} and @cite{Skip_Line} do not test for a page mark
21123 following a line mark.  If a page mark appears, it will be treated as a
21124 data character.
21126 @item 
21127 This avoids the need to wait for an extra character to be typed or
21128 entered from the pipe to complete one of these operations.
21130 @item 
21131 @cite{End_Of_Page} always returns @cite{False}
21133 @item 
21134 @cite{End_Of_File} will return @cite{False} if there is a page mark at
21135 the end of the file.
21136 @end itemize
21138 Output to non-regular files is the same as for regular files.  Page marks
21139 may be written to non-regular files using @cite{New_Page}, but as noted
21140 above they will not be treated as page marks on input if the output is
21141 piped to another Ada program.
21143 Another important discrepancy when reading non-regular files is that the end
21144 of file indication is not 'sticky'.  If an end of file is entered, e.g., by
21145 pressing the @code{EOT} key,
21146 then end of file
21147 is signaled once (i.e., the test @cite{End_Of_File}
21148 will yield @cite{True}, or a read will
21149 raise @cite{End_Error}), but then reading can resume
21150 to read data past that end of
21151 file indication, until another end of file indication is entered.
21153 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21154 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{296}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{297}
21155 @subsection Get_Immediate
21158 @geindex Get_Immediate
21160 Get_Immediate returns the next character (including control characters)
21161 from the input file.  In particular, Get_Immediate will return LF or FF
21162 characters used as line marks or page marks.  Such operations leave the
21163 file positioned past the control character, and it is thus not treated
21164 as having its normal function.  This means that page, line and column
21165 counts after this kind of Get_Immediate call are set as though the mark
21166 did not occur.  In the case where a Get_Immediate leaves the file
21167 positioned between the line mark and page mark (which is not normally
21168 possible), it is undefined whether the FF character will be treated as a
21169 page mark.
21171 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21172 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{298}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{299}
21173 @subsection Treating Text_IO Files as Streams
21176 @geindex Stream files
21178 The package @cite{Text_IO.Streams} allows a Text_IO file to be treated
21179 as a stream.  Data written to a Text_IO file in this stream mode is
21180 binary data.  If this binary data contains bytes 16#0A# (@cite{LF}) or
21181 16#0C# (@cite{FF}), the resulting file may have non-standard
21182 format.  Similarly if read operations are used to read from a Text_IO
21183 file treated as a stream, then @cite{LF} and @cite{FF} characters may be
21184 skipped and the effect is similar to that described above for
21185 @cite{Get_Immediate}.
21187 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21188 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{29a}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{29b}
21189 @subsection Text_IO Extensions
21192 @geindex Text_IO extensions
21194 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21195 to the standard @cite{Text_IO} package:
21198 @itemize *
21200 @item 
21201 function File_Exists (Name : String) return Boolean;
21202 Determines if a file of the given name exists.
21204 @item 
21205 function Get_Line return String;
21206 Reads a string from the standard input file.  The value returned is exactly
21207 the length of the line that was read.
21209 @item 
21210 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21211 Similar, except that the parameter File specifies the file from which
21212 the string is to be read.
21213 @end itemize
21215 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21216 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{29c}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{29d}
21217 @subsection Text_IO Facilities for Unbounded Strings
21220 @geindex Text_IO for unbounded strings
21222 @geindex Unbounded_String
21223 @geindex Text_IO operations
21225 The package @cite{Ada.Strings.Unbounded.Text_IO}
21226 in library files @cite{a-suteio.ads/adb} contains some GNAT-specific
21227 subprograms useful for Text_IO operations on unbounded strings:
21230 @itemize *
21232 @item 
21233 function Get_Line (File : File_Type) return Unbounded_String;
21234 Reads a line from the specified file
21235 and returns the result as an unbounded string.
21237 @item 
21238 procedure Put (File : File_Type; U : Unbounded_String);
21239 Writes the value of the given unbounded string to the specified file
21240 Similar to the effect of
21241 @cite{Put (To_String (U))} except that an extra copy is avoided.
21243 @item 
21244 procedure Put_Line (File : File_Type; U : Unbounded_String);
21245 Writes the value of the given unbounded string to the specified file,
21246 followed by a @cite{New_Line}.
21247 Similar to the effect of @cite{Put_Line (To_String (U))} except
21248 that an extra copy is avoided.
21249 @end itemize
21251 In the above procedures, @cite{File} is of type @cite{Ada.Text_IO.File_Type}
21252 and is optional.  If the parameter is omitted, then the standard input or
21253 output file is referenced as appropriate.
21255 The package @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21256 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21257 @cite{Wide_Text_IO} functionality for unbounded wide strings.
21259 The package @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21260 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21261 @cite{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21263 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21264 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{29e}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{29f}
21265 @section Wide_Text_IO
21268 @cite{Wide_Text_IO} is similar in most respects to Text_IO, except that
21269 both input and output files may contain special sequences that represent
21270 wide character values.  The encoding scheme for a given file may be
21271 specified using a FORM parameter:
21273 @example
21274 WCEM=`x`
21275 @end example
21277 as part of the FORM string (WCEM = wide character encoding method),
21278 where @cite{x} is one of the following characters
21281 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21282 @headitem
21284 Character
21286 @tab
21288 Encoding
21290 @item
21292 @emph{h}
21294 @tab
21296 Hex ESC encoding
21298 @item
21300 @emph{u}
21302 @tab
21304 Upper half encoding
21306 @item
21308 @emph{s}
21310 @tab
21312 Shift-JIS encoding
21314 @item
21316 @emph{e}
21318 @tab
21320 EUC Encoding
21322 @item
21324 @emph{8}
21326 @tab
21328 UTF-8 encoding
21330 @item
21332 @emph{b}
21334 @tab
21336 Brackets encoding
21338 @end multitable
21341 The encoding methods match those that
21342 can be used in a source
21343 program, but there is no requirement that the encoding method used for
21344 the source program be the same as the encoding method used for files,
21345 and different files may use different encoding methods.
21347 The default encoding method for the standard files, and for opened files
21348 for which no WCEM parameter is given in the FORM string matches the
21349 wide character encoding specified for the main program (the default
21350 being brackets encoding if no coding method was specified with -gnatW).
21353 @table @asis
21355 @item @emph{Hex Coding}
21357 In this encoding, a wide character is represented by a five character
21358 sequence:
21359 @end table
21361 @example
21362 ESC a b c d
21363 @end example
21366 @quotation
21368 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
21369 characters (using upper case letters) of the wide character code.  For
21370 example, ESC A345 is used to represent the wide character with code
21371 16#A345#.  This scheme is compatible with use of the full
21372 @cite{Wide_Character} set.
21373 @end quotation
21376 @table @asis
21378 @item @emph{Upper Half Coding}
21380 The wide character with encoding 16#abcd#, where the upper bit is on
21381 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
21382 16#cd#.  The second byte may never be a format control character, but is
21383 not required to be in the upper half.  This method can be also used for
21384 shift-JIS or EUC where the internal coding matches the external coding.
21386 @item @emph{Shift JIS Coding}
21388 A wide character is represented by a two character sequence 16#ab# and
21389 16#cd#, with the restrictions described for upper half encoding as
21390 described above.  The internal character code is the corresponding JIS
21391 character according to the standard algorithm for Shift-JIS
21392 conversion.  Only characters defined in the JIS code set table can be
21393 used with this encoding method.
21395 @item @emph{EUC Coding}
21397 A wide character is represented by a two character sequence 16#ab# and
21398 16#cd#, with both characters being in the upper half.  The internal
21399 character code is the corresponding JIS character according to the EUC
21400 encoding algorithm.  Only characters defined in the JIS code set table
21401 can be used with this encoding method.
21403 @item @emph{UTF-8 Coding}
21405 A wide character is represented using
21406 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21407 10646-1/Am.2.  Depending on the character value, the representation
21408 is a one, two, or three byte sequence:
21409 @end table
21411 @example
21412 16#0000#-16#007f#: 2#0xxxxxxx#
21413 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
21414 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21415 @end example
21418 @quotation
21420 where the @cite{xxx} bits correspond to the left-padded bits of the
21421 16-bit character value.  Note that all lower half ASCII characters
21422 are represented as ASCII bytes and all upper half characters and
21423 other wide characters are represented as sequences of upper-half
21424 (The full UTF-8 scheme allows for encoding 31-bit characters as
21425 6-byte sequences, but in this implementation, all UTF-8 sequences
21426 of four or more bytes length will raise a Constraint_Error, as
21427 will all invalid UTF-8 sequences.)
21428 @end quotation
21431 @table @asis
21433 @item @emph{Brackets Coding}
21435 In this encoding, a wide character is represented by the following eight
21436 character sequence:
21437 @end table
21439 @example
21440 [ " a b c d " ]
21441 @end example
21444 @quotation
21446 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
21447 characters (using uppercase letters) of the wide character code.  For
21448 example, @cite{["A345"]} is used to represent the wide character with code
21449 @cite{16#A345#}.
21450 This scheme is compatible with use of the full Wide_Character set.
21451 On input, brackets coding can also be used for upper half characters,
21452 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21453 is only used for wide characters with a code greater than @cite{16#FF#}.
21455 Note that brackets coding is not normally used in the context of
21456 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
21457 a portable way of encoding source files. In the context of Wide_Text_IO
21458 or Wide_Wide_Text_IO, it can only be used if the file does not contain
21459 any instance of the left bracket character other than to encode wide
21460 character values using the brackets encoding method. In practice it is
21461 expected that some standard wide character encoding method such
21462 as UTF-8 will be used for text input output.
21464 If brackets notation is used, then any occurrence of a left bracket
21465 in the input file which is not the start of a valid wide character
21466 sequence will cause Constraint_Error to be raised. It is possible to
21467 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
21468 input will interpret this as a left bracket.
21470 However, when a left bracket is output, it will be output as a left bracket
21471 and not as ["5B"]. We make this decision because for normal use of
21472 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
21473 brackets. For example, if we write:
21475 @example
21476 Put_Line ("Start of output [first run]");
21477 @end example
21479 we really do not want to have the left bracket in this message clobbered so
21480 that the output reads:
21481 @end quotation
21483 @example
21484 Start of output ["5B"]first run]
21485 @end example
21488 @quotation
21490 In practice brackets encoding is reasonably useful for normal Put_Line use
21491 since we won't get confused between left brackets and wide character
21492 sequences in the output. But for input, or when files are written out
21493 and read back in, it really makes better sense to use one of the standard
21494 encoding methods such as UTF-8.
21495 @end quotation
21497 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
21498 not all wide character
21499 values can be represented.  An attempt to output a character that cannot
21500 be represented using the encoding scheme for the file causes
21501 Constraint_Error to be raised.  An invalid wide character sequence on
21502 input also causes Constraint_Error to be raised.
21504 @menu
21505 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
21506 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
21508 @end menu
21510 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
21511 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2a0}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2a1}
21512 @subsection Stream Pointer Positioning
21515 @cite{Ada.Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21516 of stream pointer positioning (@ref{291,,Text_IO}).  There is one additional
21517 case:
21519 If @cite{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
21520 normal lower ASCII set (i.e., a character in the range:
21522 @example
21523 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
21524 @end example
21526 then although the logical position of the file pointer is unchanged by
21527 the @cite{Look_Ahead} call, the stream is physically positioned past the
21528 wide character sequence.  Again this is to avoid the need for buffering
21529 or backup, and all @cite{Wide_Text_IO} routines check the internal
21530 indication that this situation has occurred so that this is not visible
21531 to a normal program using @cite{Wide_Text_IO}.  However, this discrepancy
21532 can be observed if the wide text file shares a stream with another file.
21534 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
21535 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2a2}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2a3}
21536 @subsection Reading and Writing Non-Regular Files
21539 As in the case of Text_IO, when a non-regular file is read, it is
21540 assumed that the file contains no page marks (any form characters are
21541 treated as data characters), and @cite{End_Of_Page} always returns
21542 @cite{False}.  Similarly, the end of file indication is not sticky, so
21543 it is possible to read beyond an end of file.
21545 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
21546 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2a5}
21547 @section Wide_Wide_Text_IO
21550 @cite{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
21551 both input and output files may contain special sequences that represent
21552 wide wide character values.  The encoding scheme for a given file may be
21553 specified using a FORM parameter:
21555 @example
21556 WCEM=`x`
21557 @end example
21559 as part of the FORM string (WCEM = wide character encoding method),
21560 where @cite{x} is one of the following characters
21563 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21564 @headitem
21566 Character
21568 @tab
21570 Encoding
21572 @item
21574 @emph{h}
21576 @tab
21578 Hex ESC encoding
21580 @item
21582 @emph{u}
21584 @tab
21586 Upper half encoding
21588 @item
21590 @emph{s}
21592 @tab
21594 Shift-JIS encoding
21596 @item
21598 @emph{e}
21600 @tab
21602 EUC Encoding
21604 @item
21606 @emph{8}
21608 @tab
21610 UTF-8 encoding
21612 @item
21614 @emph{b}
21616 @tab
21618 Brackets encoding
21620 @end multitable
21623 The encoding methods match those that
21624 can be used in a source
21625 program, but there is no requirement that the encoding method used for
21626 the source program be the same as the encoding method used for files,
21627 and different files may use different encoding methods.
21629 The default encoding method for the standard files, and for opened files
21630 for which no WCEM parameter is given in the FORM string matches the
21631 wide character encoding specified for the main program (the default
21632 being brackets encoding if no coding method was specified with -gnatW).
21635 @table @asis
21637 @item @emph{UTF-8 Coding}
21639 A wide character is represented using
21640 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21641 10646-1/Am.2.  Depending on the character value, the representation
21642 is a one, two, three, or four byte sequence:
21643 @end table
21645 @example
21646 16#000000#-16#00007f#: 2#0xxxxxxx#
21647 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
21648 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21649 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
21650 @end example
21653 @quotation
21655 where the @cite{xxx} bits correspond to the left-padded bits of the
21656 21-bit character value.  Note that all lower half ASCII characters
21657 are represented as ASCII bytes and all upper half characters and
21658 other wide characters are represented as sequences of upper-half
21659 characters.
21660 @end quotation
21663 @table @asis
21665 @item @emph{Brackets Coding}
21667 In this encoding, a wide wide character is represented by the following eight
21668 character sequence if is in wide character range
21669 @end table
21671 @example
21672 [ " a b c d " ]
21673 @end example
21676 @quotation
21678 and by the following ten character sequence if not
21679 @end quotation
21681 @example
21682 [ " a b c d e f " ]
21683 @end example
21686 @quotation
21688 where @cite{a}, @cite{b}, @cite{c}, @cite{d}, @cite{e}, and @cite{f}
21689 are the four or six hexadecimal
21690 characters (using uppercase letters) of the wide wide character code.  For
21691 example, @cite{["01A345"]} is used to represent the wide wide character
21692 with code @cite{16#01A345#}.
21694 This scheme is compatible with use of the full Wide_Wide_Character set.
21695 On input, brackets coding can also be used for upper half characters,
21696 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21697 is only used for wide characters with a code greater than @cite{16#FF#}.
21698 @end quotation
21700 If is also possible to use the other Wide_Character encoding methods,
21701 such as Shift-JIS, but the other schemes cannot support the full range
21702 of wide wide characters.
21703 An attempt to output a character that cannot
21704 be represented using the encoding scheme for the file causes
21705 Constraint_Error to be raised.  An invalid wide character sequence on
21706 input also causes Constraint_Error to be raised.
21708 @menu
21709 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
21710 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
21712 @end menu
21714 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
21715 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2a7}
21716 @subsection Stream Pointer Positioning
21719 @cite{Ada.Wide_Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21720 of stream pointer positioning (@ref{291,,Text_IO}).  There is one additional
21721 case:
21723 If @cite{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
21724 normal lower ASCII set (i.e., a character in the range:
21726 @example
21727 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
21728 @end example
21730 then although the logical position of the file pointer is unchanged by
21731 the @cite{Look_Ahead} call, the stream is physically positioned past the
21732 wide character sequence.  Again this is to avoid the need for buffering
21733 or backup, and all @cite{Wide_Wide_Text_IO} routines check the internal
21734 indication that this situation has occurred so that this is not visible
21735 to a normal program using @cite{Wide_Wide_Text_IO}.  However, this discrepancy
21736 can be observed if the wide text file shares a stream with another file.
21738 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
21739 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2a9}
21740 @subsection Reading and Writing Non-Regular Files
21743 As in the case of Text_IO, when a non-regular file is read, it is
21744 assumed that the file contains no page marks (any form characters are
21745 treated as data characters), and @cite{End_Of_Page} always returns
21746 @cite{False}.  Similarly, the end of file indication is not sticky, so
21747 it is possible to read beyond an end of file.
21749 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
21750 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2ab}
21751 @section Stream_IO
21754 A stream file is a sequence of bytes, where individual elements are
21755 written to the file as described in the Ada Reference Manual.  The type
21756 @cite{Stream_Element} is simply a byte.  There are two ways to read or
21757 write a stream file.
21760 @itemize *
21762 @item 
21763 The operations @cite{Read} and @cite{Write} directly read or write a
21764 sequence of stream elements with no control information.
21766 @item 
21767 The stream attributes applied to a stream file transfer data in the
21768 manner described for stream attributes.
21769 @end itemize
21771 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
21772 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2ad}
21773 @section Text Translation
21776 @code{Text_Translation=xxx} may be used as the Form parameter
21777 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
21778 has no effect on Unix systems. Possible values are:
21781 @itemize *
21783 @item 
21784 @code{Yes} or @code{Text} is the default, which means to
21785 translate LF to/from CR/LF on Windows systems.
21787 @code{No} disables this translation; i.e. it
21788 uses binary mode. For output files, @code{Text_Translation=No}
21789 may be used to create Unix-style files on
21790 Windows.
21792 @item 
21793 @code{wtext} translation enabled in Unicode mode.
21794 (corresponds to _O_WTEXT).
21796 @item 
21797 @code{u8text} translation enabled in Unicode UTF-8 mode.
21798 (corresponds to O_U8TEXT).
21800 @item 
21801 @code{u16text} translation enabled in Unicode UTF-16
21802 mode. (corresponds to_O_U16TEXT).
21803 @end itemize
21805 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
21806 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2af}
21807 @section Shared Files
21810 Section A.14 of the Ada Reference Manual allows implementations to
21811 provide a wide variety of behavior if an attempt is made to access the
21812 same external file with two or more internal files.
21814 To provide a full range of functionality, while at the same time
21815 minimizing the problems of portability caused by this implementation
21816 dependence, GNAT handles file sharing as follows:
21819 @itemize *
21821 @item 
21822 In the absence of a @code{shared=xxx} form parameter, an attempt
21823 to open two or more files with the same full name is considered an error
21824 and is not supported.  The exception @cite{Use_Error} will be
21825 raised.  Note that a file that is not explicitly closed by the program
21826 remains open until the program terminates.
21828 @item 
21829 If the form parameter @code{shared=no} appears in the form string, the
21830 file can be opened or created with its own separate stream identifier,
21831 regardless of whether other files sharing the same external file are
21832 opened.  The exact effect depends on how the C stream routines handle
21833 multiple accesses to the same external files using separate streams.
21835 @item 
21836 If the form parameter @code{shared=yes} appears in the form string for
21837 each of two or more files opened using the same full name, the same
21838 stream is shared between these files, and the semantics are as described
21839 in Ada Reference Manual, Section A.14.
21840 @end itemize
21842 When a program that opens multiple files with the same name is ported
21843 from another Ada compiler to GNAT, the effect will be that
21844 @cite{Use_Error} is raised.
21846 The documentation of the original compiler and the documentation of the
21847 program should then be examined to determine if file sharing was
21848 expected, and @code{shared=xxx} parameters added to @cite{Open}
21849 and @cite{Create} calls as required.
21851 When a program is ported from GNAT to some other Ada compiler, no
21852 special attention is required unless the @code{shared=xxx} form
21853 parameter is used in the program.  In this case, you must examine the
21854 documentation of the new compiler to see if it supports the required
21855 file sharing semantics, and form strings modified appropriately.  Of
21856 course it may be the case that the program cannot be ported if the
21857 target compiler does not support the required functionality.  The best
21858 approach in writing portable code is to avoid file sharing (and hence
21859 the use of the @code{shared=xxx} parameter in the form string)
21860 completely.
21862 One common use of file sharing in Ada 83 is the use of instantiations of
21863 Sequential_IO on the same file with different types, to achieve
21864 heterogeneous input-output.  Although this approach will work in GNAT if
21865 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
21866 for this purpose (using the stream attributes)
21868 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
21869 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2b1}
21870 @section Filenames encoding
21873 An encoding form parameter can be used to specify the filename
21874 encoding @code{encoding=xxx}.
21877 @itemize *
21879 @item 
21880 If the form parameter @code{encoding=utf8} appears in the form string, the
21881 filename must be encoded in UTF-8.
21883 @item 
21884 If the form parameter @code{encoding=8bits} appears in the form
21885 string, the filename must be a standard 8bits string.
21886 @end itemize
21888 In the absence of a @code{encoding=xxx} form parameter, the
21889 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
21890 variable. And if not set @code{utf8} is assumed.
21893 @table @asis
21895 @item @emph{CP_ACP}
21897 The current system Windows ANSI code page.
21899 @item @emph{CP_UTF8}
21901 UTF-8 encoding
21902 @end table
21904 This encoding form parameter is only supported on the Windows
21905 platform. On the other Operating Systems the run-time is supporting
21906 UTF-8 natively.
21908 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
21909 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2b3}
21910 @section File content encoding
21913 For text files it is possible to specify the encoding to use. This is
21914 controlled by the by the @code{GNAT_CCS_ENCODING} environment
21915 variable. And if not set @code{TEXT} is assumed.
21917 The possible values are those supported on Windows:
21920 @table @asis
21922 @item @emph{TEXT}
21924 Translated text mode
21926 @item @emph{WTEXT}
21928 Translated unicode encoding
21930 @item @emph{U16TEXT}
21932 Unicode 16-bit encoding
21934 @item @emph{U8TEXT}
21936 Unicode 8-bit encoding
21937 @end table
21939 This encoding is only supported on the Windows platform.
21941 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
21942 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2b5}
21943 @section Open Modes
21946 @cite{Open} and @cite{Create} calls result in a call to @cite{fopen}
21947 using the mode shown in the following table:
21950 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
21951 @headitem
21953 @cite{Open} and @cite{Create} Call Modes
21955 @tab
21957 @tab
21959 @item
21961 @tab
21963 @strong{OPEN}
21965 @tab
21967 @strong{CREATE}
21969 @item
21971 Append_File
21973 @tab
21975 "r+"
21977 @tab
21979 "w+"
21981 @item
21983 In_File
21985 @tab
21989 @tab
21991 "w+"
21993 @item
21995 Out_File (Direct_IO)
21997 @tab
21999 "r+"
22001 @tab
22005 @item
22007 Out_File (all other cases)
22009 @tab
22013 @tab
22017 @item
22019 Inout_File
22021 @tab
22023 "r+"
22025 @tab
22027 "w+"
22029 @end multitable
22032 If text file translation is required, then either @code{b} or @code{t}
22033 is added to the mode, depending on the setting of Text.  Text file
22034 translation refers to the mapping of CR/LF sequences in an external file
22035 to LF characters internally.  This mapping only occurs in DOS and
22036 DOS-like systems, and is not relevant to other systems.
22038 A special case occurs with Stream_IO.  As shown in the above table, the
22039 file is initially opened in @code{r} or @code{w} mode for the
22040 @cite{In_File} and @cite{Out_File} cases.  If a @cite{Set_Mode} operation
22041 subsequently requires switching from reading to writing or vice-versa,
22042 then the file is reopened in @code{r+} mode to permit the required operation.
22044 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22045 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2b7}
22046 @section Operations on C Streams
22049 The package @cite{Interfaces.C_Streams} provides an Ada program with direct
22050 access to the C library functions for operations on C streams:
22052 @example
22053 package Interfaces.C_Streams is
22054   -- Note: the reason we do not use the types that are in
22055   -- Interfaces.C is that we want to avoid dragging in the
22056   -- code in this unit if possible.
22057   subtype chars is System.Address;
22058   -- Pointer to null-terminated array of characters
22059   subtype FILEs is System.Address;
22060   -- Corresponds to the C type FILE*
22061   subtype voids is System.Address;
22062   -- Corresponds to the C type void*
22063   subtype int is Integer;
22064   subtype long is Long_Integer;
22065   -- Note: the above types are subtypes deliberately, and it
22066   -- is part of this spec that the above correspondences are
22067   -- guaranteed.  This means that it is legitimate to, for
22068   -- example, use Integer instead of int.  We provide these
22069   -- synonyms for clarity, but in some cases it may be
22070   -- convenient to use the underlying types (for example to
22071   -- avoid an unnecessary dependency of a spec on the spec
22072   -- of this unit).
22073   type size_t is mod 2 ** Standard'Address_Size;
22074   NULL_Stream : constant FILEs;
22075   -- Value returned (NULL in C) to indicate an
22076   -- fdopen/fopen/tmpfile error
22077   ----------------------------------
22078   -- Constants Defined in stdio.h --
22079   ----------------------------------
22080   EOF : constant int;
22081   -- Used by a number of routines to indicate error or
22082   -- end of file
22083   IOFBF : constant int;
22084   IOLBF : constant int;
22085   IONBF : constant int;
22086   -- Used to indicate buffering mode for setvbuf call
22087   SEEK_CUR : constant int;
22088   SEEK_END : constant int;
22089   SEEK_SET : constant int;
22090   -- Used to indicate origin for fseek call
22091   function stdin return FILEs;
22092   function stdout return FILEs;
22093   function stderr return FILEs;
22094   -- Streams associated with standard files
22095   --------------------------
22096   -- Standard C functions --
22097   --------------------------
22098   -- The functions selected below are ones that are
22099   -- available in UNIX (but not necessarily in ANSI C).
22100   -- These are very thin interfaces
22101   -- which copy exactly the C headers.  For more
22102   -- documentation on these functions, see the Microsoft C
22103   -- "Run-Time Library Reference" (Microsoft Press, 1990,
22104   -- ISBN 1-55615-225-6), which includes useful information
22105   -- on system compatibility.
22106   procedure clearerr (stream : FILEs);
22107   function fclose (stream : FILEs) return int;
22108   function fdopen (handle : int; mode : chars) return FILEs;
22109   function feof (stream : FILEs) return int;
22110   function ferror (stream : FILEs) return int;
22111   function fflush (stream : FILEs) return int;
22112   function fgetc (stream : FILEs) return int;
22113   function fgets (strng : chars; n : int; stream : FILEs)
22114       return chars;
22115   function fileno (stream : FILEs) return int;
22116   function fopen (filename : chars; Mode : chars)
22117       return FILEs;
22118   -- Note: to maintain target independence, use
22119   -- text_translation_required, a boolean variable defined in
22120   -- a-sysdep.c to deal with the target dependent text
22121   -- translation requirement.  If this variable is set,
22122   -- then  b/t should be appended to the standard mode
22123   -- argument to set the text translation mode off or on
22124   -- as required.
22125   function fputc (C : int; stream : FILEs) return int;
22126   function fputs (Strng : chars; Stream : FILEs) return int;
22127   function fread
22128      (buffer : voids;
22129       size : size_t;
22130       count : size_t;
22131       stream : FILEs)
22132       return size_t;
22133   function freopen
22134      (filename : chars;
22135       mode : chars;
22136       stream : FILEs)
22137       return FILEs;
22138   function fseek
22139      (stream : FILEs;
22140       offset : long;
22141       origin : int)
22142       return int;
22143   function ftell (stream : FILEs) return long;
22144   function fwrite
22145      (buffer : voids;
22146       size : size_t;
22147       count : size_t;
22148       stream : FILEs)
22149       return size_t;
22150   function isatty (handle : int) return int;
22151   procedure mktemp (template : chars);
22152   -- The return value (which is just a pointer to template)
22153   -- is discarded
22154   procedure rewind (stream : FILEs);
22155   function rmtmp return int;
22156   function setvbuf
22157      (stream : FILEs;
22158       buffer : chars;
22159       mode : int;
22160       size : size_t)
22161       return int;
22163   function tmpfile return FILEs;
22164   function ungetc (c : int; stream : FILEs) return int;
22165   function unlink (filename : chars) return int;
22166   ---------------------
22167   -- Extra functions --
22168   ---------------------
22169   -- These functions supply slightly thicker bindings than
22170   -- those above.  They are derived from functions in the
22171   -- C Run-Time Library, but may do a bit more work than
22172   -- just directly calling one of the Library functions.
22173   function is_regular_file (handle : int) return int;
22174   -- Tests if given handle is for a regular file (result 1)
22175   -- or for a non-regular file (pipe or device, result 0).
22176   ---------------------------------
22177   -- Control of Text/Binary Mode --
22178   ---------------------------------
22179   -- If text_translation_required is true, then the following
22180   -- functions may be used to dynamically switch a file from
22181   -- binary to text mode or vice versa.  These functions have
22182   -- no effect if text_translation_required is false (i.e., in
22183   -- normal UNIX mode).  Use fileno to get a stream handle.
22184   procedure set_binary_mode (handle : int);
22185   procedure set_text_mode (handle : int);
22186   ----------------------------
22187   -- Full Path Name support --
22188   ----------------------------
22189   procedure full_name (nam : chars; buffer : chars);
22190   -- Given a NUL terminated string representing a file
22191   -- name, returns in buffer a NUL terminated string
22192   -- representing the full path name for the file name.
22193   -- On systems where it is relevant the   drive is also
22194   -- part of the full path name.  It is the responsibility
22195   -- of the caller to pass an actual parameter for buffer
22196   -- that is big enough for any full path name.  Use
22197   -- max_path_len given below as the size of buffer.
22198   max_path_len : integer;
22199   -- Maximum length of an allowable full path name on the
22200   -- system, including a terminating NUL character.
22201 end Interfaces.C_Streams;
22202 @end example
22204 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22205 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2b9}
22206 @section Interfacing to C Streams
22209 The packages in this section permit interfacing Ada files to C Stream
22210 operations.
22212 @example
22213 with Interfaces.C_Streams;
22214 package Ada.Sequential_IO.C_Streams is
22215    function C_Stream (F : File_Type)
22216       return Interfaces.C_Streams.FILEs;
22217    procedure Open
22218      (File : in out File_Type;
22219       Mode : in File_Mode;
22220       C_Stream : in Interfaces.C_Streams.FILEs;
22221       Form : in String := "");
22222 end Ada.Sequential_IO.C_Streams;
22224  with Interfaces.C_Streams;
22225  package Ada.Direct_IO.C_Streams is
22226     function C_Stream (F : File_Type)
22227        return Interfaces.C_Streams.FILEs;
22228     procedure Open
22229       (File : in out File_Type;
22230        Mode : in File_Mode;
22231        C_Stream : in Interfaces.C_Streams.FILEs;
22232        Form : in String := "");
22233  end Ada.Direct_IO.C_Streams;
22235  with Interfaces.C_Streams;
22236  package Ada.Text_IO.C_Streams is
22237     function C_Stream (F : File_Type)
22238        return Interfaces.C_Streams.FILEs;
22239     procedure Open
22240       (File : in out File_Type;
22241        Mode : in File_Mode;
22242        C_Stream : in Interfaces.C_Streams.FILEs;
22243        Form : in String := "");
22244  end Ada.Text_IO.C_Streams;
22246  with Interfaces.C_Streams;
22247  package Ada.Wide_Text_IO.C_Streams is
22248     function C_Stream (F : File_Type)
22249        return Interfaces.C_Streams.FILEs;
22250     procedure Open
22251       (File : in out File_Type;
22252        Mode : in File_Mode;
22253        C_Stream : in Interfaces.C_Streams.FILEs;
22254        Form : in String := "");
22255 end Ada.Wide_Text_IO.C_Streams;
22257  with Interfaces.C_Streams;
22258  package Ada.Wide_Wide_Text_IO.C_Streams is
22259     function C_Stream (F : File_Type)
22260        return Interfaces.C_Streams.FILEs;
22261     procedure Open
22262       (File : in out File_Type;
22263        Mode : in File_Mode;
22264        C_Stream : in Interfaces.C_Streams.FILEs;
22265        Form : in String := "");
22266 end Ada.Wide_Wide_Text_IO.C_Streams;
22268 with Interfaces.C_Streams;
22269 package Ada.Stream_IO.C_Streams is
22270    function C_Stream (F : File_Type)
22271       return Interfaces.C_Streams.FILEs;
22272    procedure Open
22273      (File : in out File_Type;
22274       Mode : in File_Mode;
22275       C_Stream : in Interfaces.C_Streams.FILEs;
22276       Form : in String := "");
22277 end Ada.Stream_IO.C_Streams;
22278 @end example
22280 In each of these six packages, the @cite{C_Stream} function obtains the
22281 @cite{FILE} pointer from a currently opened Ada file.  It is then
22282 possible to use the @cite{Interfaces.C_Streams} package to operate on
22283 this stream, or the stream can be passed to a C program which can
22284 operate on it directly.  Of course the program is responsible for
22285 ensuring that only appropriate sequences of operations are executed.
22287 One particular use of relevance to an Ada program is that the
22288 @cite{setvbuf} function can be used to control the buffering of the
22289 stream used by an Ada file.  In the absence of such a call the standard
22290 default buffering is used.
22292 The @cite{Open} procedures in these packages open a file giving an
22293 existing C Stream instead of a file name.  Typically this stream is
22294 imported from a C program, allowing an Ada file to operate on an
22295 existing C file.
22297 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
22298 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{2ba}@anchor{gnat_rm/the_gnat_library id1}@anchor{2bb}
22299 @chapter The GNAT Library
22302 The GNAT library contains a number of general and special purpose packages.
22303 It represents functionality that the GNAT developers have found useful, and
22304 which is made available to GNAT users.  The packages described here are fully
22305 supported, and upwards compatibility will be maintained in future releases,
22306 so you can use these facilities with the confidence that the same functionality
22307 will be available in future releases.
22309 The chapter here simply gives a brief summary of the facilities available.
22310 The full documentation is found in the spec file for the package.  The full
22311 sources of these library packages, including both spec and body, are provided
22312 with all GNAT releases.  For example, to find out the full specifications of
22313 the SPITBOL pattern matching capability, including a full tutorial and
22314 extensive examples, look in the @code{g-spipat.ads} file in the library.
22316 For each entry here, the package name (as it would appear in a @cite{with}
22317 clause) is given, followed by the name of the corresponding spec file in
22318 parentheses.  The packages are children in four hierarchies, @cite{Ada},
22319 @cite{Interfaces}, @cite{System}, and @cite{GNAT}, the latter being a
22320 GNAT-specific hierarchy.
22322 Note that an application program should only use packages in one of these
22323 four hierarchies if the package is defined in the Ada Reference Manual,
22324 or is listed in this section of the GNAT Programmers Reference Manual.
22325 All other units should be considered internal implementation units and
22326 should not be directly @cite{with}'ed by application code.  The use of
22327 a @cite{with} statement that references one of these internal implementation
22328 units makes an application potentially dependent on changes in versions
22329 of GNAT, and will generate a warning message.
22331 @menu
22332 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
22333 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
22334 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
22335 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
22336 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
22337 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
22338 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
22339 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
22340 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
22341 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
22342 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
22343 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
22344 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
22345 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
22346 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
22347 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
22348 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
22349 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
22350 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
22351 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
22352 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
22353 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
22354 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
22355 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
22356 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
22357 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
22358 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
22359 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
22360 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
22361 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
22362 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
22363 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
22364 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
22365 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
22366 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
22367 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
22368 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
22369 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
22370 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
22371 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
22372 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
22373 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
22374 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
22375 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
22376 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
22377 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
22378 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
22379 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
22380 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
22381 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
22382 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
22383 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
22384 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
22385 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
22386 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
22387 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
22388 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
22389 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
22390 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
22391 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
22392 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
22393 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
22394 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
22395 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
22396 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
22397 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
22398 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
22399 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
22400 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
22401 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
22402 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
22403 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
22404 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
22405 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
22406 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
22407 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
22408 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
22409 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
22410 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
22411 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
22412 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
22413 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
22414 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
22415 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
22416 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
22417 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
22418 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
22419 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
22420 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
22421 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
22422 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
22423 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
22424 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
22425 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
22426 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
22427 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
22428 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
22429 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
22430 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
22431 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
22432 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
22433 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
22434 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
22435 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
22436 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
22437 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
22438 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
22439 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
22440 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
22441 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
22442 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
22443 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
22444 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
22445 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
22446 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
22447 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
22448 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
22449 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
22450 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
22451 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
22452 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
22453 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
22454 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
22455 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
22456 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
22457 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
22458 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
22459 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
22460 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
22461 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
22462 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
22463 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
22464 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
22465 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
22466 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
22467 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
22468 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
22469 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
22470 * System.Memory (s-memory.ads): System Memory s-memory ads. 
22471 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
22472 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
22473 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
22474 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
22475 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
22476 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
22477 * System.Rident (s-rident.ads): System Rident s-rident ads. 
22478 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
22479 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
22480 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
22481 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
22483 @end menu
22485 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
22486 @anchor{gnat_rm/the_gnat_library id2}@anchor{2bc}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2bd}
22487 @section @cite{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
22490 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
22492 @geindex Latin_9 constants for Character
22494 This child of @cite{Ada.Characters}
22495 provides a set of definitions corresponding to those in the
22496 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22497 few modifications required for @cite{Latin-9}
22498 The provision of such a package
22499 is specifically authorized by the Ada Reference Manual
22500 (RM A.3.3(27)).
22502 @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
22503 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2be}@anchor{gnat_rm/the_gnat_library id3}@anchor{2bf}
22504 @section @cite{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
22507 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
22509 @geindex Latin_1 constants for Wide_Character
22511 This child of @cite{Ada.Characters}
22512 provides a set of definitions corresponding to those in the
22513 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22514 types of the constants being @cite{Wide_Character}
22515 instead of @cite{Character}.  The provision of such a package
22516 is specifically authorized by the Ada Reference Manual
22517 (RM A.3.3(27)).
22519 @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
22520 @anchor{gnat_rm/the_gnat_library id4}@anchor{2c0}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2c1}
22521 @section @cite{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
22524 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
22526 @geindex Latin_9 constants for Wide_Character
22528 This child of @cite{Ada.Characters}
22529 provides a set of definitions corresponding to those in the
22530 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22531 types of the constants being @cite{Wide_Character}
22532 instead of @cite{Character}.  The provision of such a package
22533 is specifically authorized by the Ada Reference Manual
22534 (RM A.3.3(27)).
22536 @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
22537 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2c2}@anchor{gnat_rm/the_gnat_library id5}@anchor{2c3}
22538 @section @cite{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
22541 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
22543 @geindex Latin_1 constants for Wide_Wide_Character
22545 This child of @cite{Ada.Characters}
22546 provides a set of definitions corresponding to those in the
22547 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22548 types of the constants being @cite{Wide_Wide_Character}
22549 instead of @cite{Character}.  The provision of such a package
22550 is specifically authorized by the Ada Reference Manual
22551 (RM A.3.3(27)).
22553 @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
22554 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2c4}@anchor{gnat_rm/the_gnat_library id6}@anchor{2c5}
22555 @section @cite{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
22558 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
22560 @geindex Latin_9 constants for Wide_Wide_Character
22562 This child of @cite{Ada.Characters}
22563 provides a set of definitions corresponding to those in the
22564 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22565 types of the constants being @cite{Wide_Wide_Character}
22566 instead of @cite{Character}.  The provision of such a package
22567 is specifically authorized by the Ada Reference Manual
22568 (RM A.3.3(27)).
22570 @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
22571 @anchor{gnat_rm/the_gnat_library id7}@anchor{2c6}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2c7}
22572 @section @cite{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
22575 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
22577 @geindex Formal container for doubly linked lists
22579 This child of @cite{Ada.Containers} defines a modified version of the
22580 Ada 2005 container for doubly linked lists, meant to facilitate formal
22581 verification of code using such containers. The specification of this
22582 unit is compatible with SPARK 2014.
22584 Note that although this container was designed with formal verification
22585 in mind, it may well be generally useful in that it is a simplified more
22586 efficient version than the one defined in the standard. In particular it
22587 does not have the complex overhead required to detect cursor tampering.
22589 @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
22590 @anchor{gnat_rm/the_gnat_library id8}@anchor{2c8}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2c9}
22591 @section @cite{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
22594 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
22596 @geindex Formal container for hashed maps
22598 This child of @cite{Ada.Containers} defines a modified version of the
22599 Ada 2005 container for hashed maps, meant to facilitate formal
22600 verification of code using such containers. The specification of this
22601 unit is compatible with SPARK 2014.
22603 Note that although this container was designed with formal verification
22604 in mind, it may well be generally useful in that it is a simplified more
22605 efficient version than the one defined in the standard. In particular it
22606 does not have the complex overhead required to detect cursor tampering.
22608 @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
22609 @anchor{gnat_rm/the_gnat_library id9}@anchor{2ca}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2cb}
22610 @section @cite{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
22613 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
22615 @geindex Formal container for hashed sets
22617 This child of @cite{Ada.Containers} defines a modified version of the
22618 Ada 2005 container for hashed sets, meant to facilitate formal
22619 verification of code using such containers. The specification of this
22620 unit is compatible with SPARK 2014.
22622 Note that although this container was designed with formal verification
22623 in mind, it may well be generally useful in that it is a simplified more
22624 efficient version than the one defined in the standard. In particular it
22625 does not have the complex overhead required to detect cursor tampering.
22627 @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
22628 @anchor{gnat_rm/the_gnat_library id10}@anchor{2cc}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2cd}
22629 @section @cite{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
22632 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
22634 @geindex Formal container for ordered maps
22636 This child of @cite{Ada.Containers} defines a modified version of the
22637 Ada 2005 container for ordered maps, meant to facilitate formal
22638 verification of code using such containers. The specification of this
22639 unit is compatible with SPARK 2014.
22641 Note that although this container was designed with formal verification
22642 in mind, it may well be generally useful in that it is a simplified more
22643 efficient version than the one defined in the standard. In particular it
22644 does not have the complex overhead required to detect cursor tampering.
22646 @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
22647 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2ce}@anchor{gnat_rm/the_gnat_library id11}@anchor{2cf}
22648 @section @cite{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
22651 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
22653 @geindex Formal container for ordered sets
22655 This child of @cite{Ada.Containers} defines a modified version of the
22656 Ada 2005 container for ordered sets, meant to facilitate formal
22657 verification of code using such containers. The specification of this
22658 unit is compatible with SPARK 2014.
22660 Note that although this container was designed with formal verification
22661 in mind, it may well be generally useful in that it is a simplified more
22662 efficient version than the one defined in the standard. In particular it
22663 does not have the complex overhead required to detect cursor tampering.
22665 @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
22666 @anchor{gnat_rm/the_gnat_library id12}@anchor{2d0}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2d1}
22667 @section @cite{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
22670 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
22672 @geindex Formal container for vectors
22674 This child of @cite{Ada.Containers} defines a modified version of the
22675 Ada 2005 container for vectors, meant to facilitate formal
22676 verification of code using such containers. The specification of this
22677 unit is compatible with SPARK 2014.
22679 Note that although this container was designed with formal verification
22680 in mind, it may well be generally useful in that it is a simplified more
22681 efficient version than the one defined in the standard. In particular it
22682 does not have the complex overhead required to detect cursor tampering.
22684 @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
22685 @anchor{gnat_rm/the_gnat_library id13}@anchor{2d2}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2d3}
22686 @section @cite{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
22689 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
22691 @geindex Formal container for vectors
22693 This child of @cite{Ada.Containers} defines a modified version of the
22694 Ada 2005 container for vectors of indefinite elements, meant to
22695 facilitate formal verification of code using such containers. The
22696 specification of this unit is compatible with SPARK 2014.
22698 Note that although this container was designed with formal verification
22699 in mind, it may well be generally useful in that it is a simplified more
22700 efficient version than the one defined in the standard. In particular it
22701 does not have the complex overhead required to detect cursor tampering.
22703 @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
22704 @anchor{gnat_rm/the_gnat_library id14}@anchor{2d4}@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2d5}
22705 @section @cite{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
22708 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
22710 @geindex Formal container for vectors
22712 This child of @cite{Ada.Containers} defines a modified version of
22713 Indefinite_Holders that avoids heap allocation.
22715 @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
22716 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id15}@anchor{2d7}
22717 @section @cite{Ada.Command_Line.Environment} (@code{a-colien.ads})
22720 @geindex Ada.Command_Line.Environment (a-colien.ads)
22722 @geindex Environment entries
22724 This child of @cite{Ada.Command_Line}
22725 provides a mechanism for obtaining environment values on systems
22726 where this concept makes sense.
22728 @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
22729 @anchor{gnat_rm/the_gnat_library id16}@anchor{2d8}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2d9}
22730 @section @cite{Ada.Command_Line.Remove} (@code{a-colire.ads})
22733 @geindex Ada.Command_Line.Remove (a-colire.ads)
22735 @geindex Removing command line arguments
22737 @geindex Command line
22738 @geindex argument removal
22740 This child of @cite{Ada.Command_Line}
22741 provides a mechanism for logically removing
22742 arguments from the argument list.  Once removed, an argument is not visible
22743 to further calls on the subprograms in @cite{Ada.Command_Line} will not
22744 see the removed argument.
22746 @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
22747 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2da}@anchor{gnat_rm/the_gnat_library id17}@anchor{2db}
22748 @section @cite{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
22751 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
22753 @geindex Response file for command line
22755 @geindex Command line
22756 @geindex response file
22758 @geindex Command line
22759 @geindex handling long command lines
22761 This child of @cite{Ada.Command_Line} provides a mechanism facilities for
22762 getting command line arguments from a text file, called a "response file".
22763 Using a response file allow passing a set of arguments to an executable longer
22764 than the maximum allowed by the system on the command line.
22766 @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
22767 @anchor{gnat_rm/the_gnat_library id18}@anchor{2dc}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2dd}
22768 @section @cite{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
22771 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
22773 @geindex C Streams
22774 @geindex Interfacing with Direct_IO
22776 This package provides subprograms that allow interfacing between
22777 C streams and @cite{Direct_IO}.  The stream identifier can be
22778 extracted from a file opened on the Ada side, and an Ada file
22779 can be constructed from a stream opened on the C side.
22781 @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
22782 @anchor{gnat_rm/the_gnat_library id19}@anchor{2de}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2df}
22783 @section @cite{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
22786 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
22788 @geindex Null_Occurrence
22789 @geindex testing for
22791 This child subprogram provides a way of testing for the null
22792 exception occurrence (@cite{Null_Occurrence}) without raising
22793 an exception.
22795 @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
22796 @anchor{gnat_rm/the_gnat_library id20}@anchor{2e0}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2e1}
22797 @section @cite{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
22800 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
22802 @geindex Null_Occurrence
22803 @geindex testing for
22805 This child subprogram is used for handling otherwise unhandled
22806 exceptions (hence the name last chance), and perform clean ups before
22807 terminating the program. Note that this subprogram never returns.
22809 @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
22810 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2e2}@anchor{gnat_rm/the_gnat_library id21}@anchor{2e3}
22811 @section @cite{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
22814 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
22816 @geindex Traceback for Exception Occurrence
22818 This child package provides the subprogram (@cite{Tracebacks}) to
22819 give a traceback array of addresses based on an exception
22820 occurrence.
22822 @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
22823 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2e4}@anchor{gnat_rm/the_gnat_library id22}@anchor{2e5}
22824 @section @cite{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
22827 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
22829 @geindex C Streams
22830 @geindex Interfacing with Sequential_IO
22832 This package provides subprograms that allow interfacing between
22833 C streams and @cite{Sequential_IO}.  The stream identifier can be
22834 extracted from a file opened on the Ada side, and an Ada file
22835 can be constructed from a stream opened on the C side.
22837 @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
22838 @anchor{gnat_rm/the_gnat_library id23}@anchor{2e6}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2e7}
22839 @section @cite{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
22842 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
22844 @geindex C Streams
22845 @geindex Interfacing with Stream_IO
22847 This package provides subprograms that allow interfacing between
22848 C streams and @cite{Stream_IO}.  The stream identifier can be
22849 extracted from a file opened on the Ada side, and an Ada file
22850 can be constructed from a stream opened on the C side.
22852 @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
22853 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2e8}@anchor{gnat_rm/the_gnat_library id24}@anchor{2e9}
22854 @section @cite{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
22857 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
22859 @geindex Unbounded_String
22860 @geindex IO support
22862 @geindex Text_IO
22863 @geindex extensions for unbounded strings
22865 This package provides subprograms for Text_IO for unbounded
22866 strings, avoiding the necessity for an intermediate operation
22867 with ordinary strings.
22869 @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
22870 @anchor{gnat_rm/the_gnat_library id25}@anchor{2ea}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2eb}
22871 @section @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
22874 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
22876 @geindex Unbounded_Wide_String
22877 @geindex IO support
22879 @geindex Text_IO
22880 @geindex extensions for unbounded wide strings
22882 This package provides subprograms for Text_IO for unbounded
22883 wide strings, avoiding the necessity for an intermediate operation
22884 with ordinary wide strings.
22886 @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
22887 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2ec}@anchor{gnat_rm/the_gnat_library id26}@anchor{2ed}
22888 @section @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
22891 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
22893 @geindex Unbounded_Wide_Wide_String
22894 @geindex IO support
22896 @geindex Text_IO
22897 @geindex extensions for unbounded wide wide strings
22899 This package provides subprograms for Text_IO for unbounded
22900 wide wide strings, avoiding the necessity for an intermediate operation
22901 with ordinary wide wide strings.
22903 @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
22904 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id27}@anchor{2ef}
22905 @section @cite{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
22908 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
22910 @geindex C Streams
22911 @geindex Interfacing with `Text_IO`
22913 This package provides subprograms that allow interfacing between
22914 C streams and @cite{Text_IO}.  The stream identifier can be
22915 extracted from a file opened on the Ada side, and an Ada file
22916 can be constructed from a stream opened on the C side.
22918 @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
22919 @anchor{gnat_rm/the_gnat_library id28}@anchor{2f0}@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{2f1}
22920 @section @cite{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
22923 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
22925 @geindex Text_IO resetting standard files
22927 This procedure is used to reset the status of the standard files used
22928 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
22929 embedded application) where the status of the files may change during
22930 execution (for example a standard input file may be redefined to be
22931 interactive).
22933 @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
22934 @anchor{gnat_rm/the_gnat_library id29}@anchor{2f2}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{2f3}
22935 @section @cite{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
22938 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
22940 @geindex Unicode categorization
22941 @geindex Wide_Character
22943 This package provides subprograms that allow categorization of
22944 Wide_Character values according to Unicode categories.
22946 @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
22947 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{2f4}@anchor{gnat_rm/the_gnat_library id30}@anchor{2f5}
22948 @section @cite{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
22951 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
22953 @geindex C Streams
22954 @geindex Interfacing with `Wide_Text_IO`
22956 This package provides subprograms that allow interfacing between
22957 C streams and @cite{Wide_Text_IO}.  The stream identifier can be
22958 extracted from a file opened on the Ada side, and an Ada file
22959 can be constructed from a stream opened on the C side.
22961 @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
22962 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{2f6}@anchor{gnat_rm/the_gnat_library id31}@anchor{2f7}
22963 @section @cite{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
22966 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
22968 @geindex Wide_Text_IO resetting standard files
22970 This procedure is used to reset the status of the standard files used
22971 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
22972 embedded application) where the status of the files may change during
22973 execution (for example a standard input file may be redefined to be
22974 interactive).
22976 @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
22977 @anchor{gnat_rm/the_gnat_library id32}@anchor{2f8}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{2f9}
22978 @section @cite{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
22981 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
22983 @geindex Unicode categorization
22984 @geindex Wide_Wide_Character
22986 This package provides subprograms that allow categorization of
22987 Wide_Wide_Character values according to Unicode categories.
22989 @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
22990 @anchor{gnat_rm/the_gnat_library id33}@anchor{2fa}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{2fb}
22991 @section @cite{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
22994 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
22996 @geindex C Streams
22997 @geindex Interfacing with `Wide_Wide_Text_IO`
22999 This package provides subprograms that allow interfacing between
23000 C streams and @cite{Wide_Wide_Text_IO}.  The stream identifier can be
23001 extracted from a file opened on the Ada side, and an Ada file
23002 can be constructed from a stream opened on the C side.
23004 @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
23005 @anchor{gnat_rm/the_gnat_library id34}@anchor{2fc}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{2fd}
23006 @section @cite{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23009 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23011 @geindex Wide_Wide_Text_IO resetting standard files
23013 This procedure is used to reset the status of the standard files used
23014 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23015 restart in an embedded application) where the status of the files may
23016 change during execution (for example a standard input file may be
23017 redefined to be interactive).
23019 @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
23020 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{2fe}@anchor{gnat_rm/the_gnat_library id35}@anchor{2ff}
23021 @section @cite{GNAT.Altivec} (@code{g-altive.ads})
23024 @geindex GNAT.Altivec (g-altive.ads)
23026 @geindex AltiVec
23028 This is the root package of the GNAT AltiVec binding. It provides
23029 definitions of constants and types common to all the versions of the
23030 binding.
23032 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23033 @anchor{gnat_rm/the_gnat_library id36}@anchor{300}@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{301}
23034 @section @cite{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23037 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23039 @geindex AltiVec
23041 This package provides the Vector/View conversion routines.
23043 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23044 @anchor{gnat_rm/the_gnat_library id37}@anchor{302}@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{303}
23045 @section @cite{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23048 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23050 @geindex AltiVec
23052 This package exposes the Ada interface to the AltiVec operations on
23053 vector objects. A soft emulation is included by default in the GNAT
23054 library. The hard binding is provided as a separate package. This unit
23055 is common to both bindings.
23057 @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
23058 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{304}@anchor{gnat_rm/the_gnat_library id38}@anchor{305}
23059 @section @cite{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23062 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23064 @geindex AltiVec
23066 This package exposes the various vector types part of the Ada binding
23067 to AltiVec facilities.
23069 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23070 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{306}@anchor{gnat_rm/the_gnat_library id39}@anchor{307}
23071 @section @cite{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23074 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23076 @geindex AltiVec
23078 This package provides public 'View' data types from/to which private
23079 vector representations can be converted via
23080 GNAT.Altivec.Conversions. This allows convenient access to individual
23081 vector elements and provides a simple way to initialize vector
23082 objects.
23084 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23085 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{308}@anchor{gnat_rm/the_gnat_library id40}@anchor{309}
23086 @section @cite{GNAT.Array_Split} (@code{g-arrspl.ads})
23089 @geindex GNAT.Array_Split (g-arrspl.ads)
23091 @geindex Array splitter
23093 Useful array-manipulation routines: given a set of separators, split
23094 an array wherever the separators appear, and provide direct access
23095 to the resulting slices.
23097 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23098 @anchor{gnat_rm/the_gnat_library id41}@anchor{30a}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{30b}
23099 @section @cite{GNAT.AWK} (@code{g-awk.ads})
23102 @geindex GNAT.AWK (g-awk.ads)
23104 @geindex Parsing
23106 @geindex AWK
23108 Provides AWK-like parsing functions, with an easy interface for parsing one
23109 or more files containing formatted data.  The file is viewed as a database
23110 where each record is a line and a field is a data element in this line.
23112 @node GNAT Bind_Environment g-binenv ads,GNAT Bounded_Buffers g-boubuf ads,GNAT AWK g-awk ads,The GNAT Library
23113 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id42}@anchor{30d}
23114 @section @cite{GNAT.Bind_Environment} (@code{g-binenv.ads})
23117 @geindex GNAT.Bind_Environment (g-binenv.ads)
23119 @geindex Bind environment
23121 Provides access to key=value associations captured at bind time.
23122 These associations can be specified using the @cite{-V} binder command
23123 line switch.
23125 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23126 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{30e}@anchor{gnat_rm/the_gnat_library id43}@anchor{30f}
23127 @section @cite{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23130 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23132 @geindex Parsing
23134 @geindex Bounded Buffers
23136 Provides a concurrent generic bounded buffer abstraction.  Instances are
23137 useful directly or as parts of the implementations of other abstractions,
23138 such as mailboxes.
23140 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23141 @anchor{gnat_rm/the_gnat_library id44}@anchor{310}@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{311}
23142 @section @cite{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23145 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23147 @geindex Parsing
23149 @geindex Mailboxes
23151 Provides a thread-safe asynchronous intertask mailbox communication facility.
23153 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23154 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{312}@anchor{gnat_rm/the_gnat_library id45}@anchor{313}
23155 @section @cite{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23158 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23160 @geindex Sorting
23162 @geindex Bubble sort
23164 Provides a general implementation of bubble sort usable for sorting arbitrary
23165 data items.  Exchange and comparison procedures are provided by passing
23166 access-to-procedure values.
23168 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23169 @anchor{gnat_rm/the_gnat_library id46}@anchor{314}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{315}
23170 @section @cite{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23173 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23175 @geindex Sorting
23177 @geindex Bubble sort
23179 Provides a general implementation of bubble sort usable for sorting arbitrary
23180 data items.  Move and comparison procedures are provided by passing
23181 access-to-procedure values. This is an older version, retained for
23182 compatibility. Usually @cite{GNAT.Bubble_Sort} will be preferable.
23184 @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
23185 @anchor{gnat_rm/the_gnat_library id47}@anchor{316}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{317}
23186 @section @cite{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23189 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23191 @geindex Sorting
23193 @geindex Bubble sort
23195 Similar to @cite{Bubble_Sort_A} except that the move and sorting procedures
23196 are provided as generic parameters, this improves efficiency, especially
23197 if the procedures can be inlined, at the expense of duplicating code for
23198 multiple instantiations.
23200 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23201 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{318}@anchor{gnat_rm/the_gnat_library id48}@anchor{319}
23202 @section @cite{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23205 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23207 @geindex UTF-8 representation
23209 @geindex Wide characte representations
23211 Provides a routine which given a string, reads the start of the string to
23212 see whether it is one of the standard byte order marks (BOM's) which signal
23213 the encoding of the string. The routine includes detection of special XML
23214 sequences for various UCS input formats.
23216 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
23217 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id49}@anchor{31b}
23218 @section @cite{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
23221 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
23223 @geindex Byte swapping
23225 @geindex Endianness
23227 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
23228 Machine-specific implementations are available in some cases.
23230 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
23231 @anchor{gnat_rm/the_gnat_library id50}@anchor{31c}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{31d}
23232 @section @cite{GNAT.Calendar} (@code{g-calend.ads})
23235 @geindex GNAT.Calendar (g-calend.ads)
23237 @geindex Calendar
23239 Extends the facilities provided by @cite{Ada.Calendar} to include handling
23240 of days of the week, an extended @cite{Split} and @cite{Time_Of} capability.
23241 Also provides conversion of @cite{Ada.Calendar.Time} values to and from the
23242 C @cite{timeval} format.
23244 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
23245 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id51}@anchor{31f}
23246 @section @cite{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
23249 @geindex Calendar
23251 @geindex Time
23253 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
23255 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
23256 @anchor{gnat_rm/the_gnat_library id52}@anchor{320}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{321}
23257 @section @cite{GNAT.CRC32} (@code{g-crc32.ads})
23260 @geindex GNAT.CRC32 (g-crc32.ads)
23262 @geindex CRC32
23264 @geindex Cyclic Redundancy Check
23266 This package implements the CRC-32 algorithm.  For a full description
23267 of this algorithm see
23268 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
23269 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
23270 Aug. 1988.  Sarwate, D.V.
23272 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
23273 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id53}@anchor{323}
23274 @section @cite{GNAT.Case_Util} (@code{g-casuti.ads})
23277 @geindex GNAT.Case_Util (g-casuti.ads)
23279 @geindex Casing utilities
23281 @geindex Character handling (`GNAT.Case_Util`)
23283 A set of simple routines for handling upper and lower casing of strings
23284 without the overhead of the full casing tables
23285 in @cite{Ada.Characters.Handling}.
23287 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
23288 @anchor{gnat_rm/the_gnat_library id54}@anchor{324}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{325}
23289 @section @cite{GNAT.CGI} (@code{g-cgi.ads})
23292 @geindex GNAT.CGI (g-cgi.ads)
23294 @geindex CGI (Common Gateway Interface)
23296 This is a package for interfacing a GNAT program with a Web server via the
23297 Common Gateway Interface (CGI).  Basically this package parses the CGI
23298 parameters, which are a set of key/value pairs sent by the Web server.  It
23299 builds a table whose index is the key and provides some services to deal
23300 with this table.
23302 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
23303 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id55}@anchor{327}
23304 @section @cite{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
23307 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
23309 @geindex CGI (Common Gateway Interface) cookie support
23311 @geindex Cookie support in CGI
23313 This is a package to interface a GNAT program with a Web server via the
23314 Common Gateway Interface (CGI).  It exports services to deal with Web
23315 cookies (piece of information kept in the Web client software).
23317 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
23318 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{328}@anchor{gnat_rm/the_gnat_library id56}@anchor{329}
23319 @section @cite{GNAT.CGI.Debug} (@code{g-cgideb.ads})
23322 @geindex GNAT.CGI.Debug (g-cgideb.ads)
23324 @geindex CGI (Common Gateway Interface) debugging
23326 This is a package to help debugging CGI (Common Gateway Interface)
23327 programs written in Ada.
23329 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
23330 @anchor{gnat_rm/the_gnat_library id57}@anchor{32a}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{32b}
23331 @section @cite{GNAT.Command_Line} (@code{g-comlin.ads})
23334 @geindex GNAT.Command_Line (g-comlin.ads)
23336 @geindex Command line
23338 Provides a high level interface to @cite{Ada.Command_Line} facilities,
23339 including the ability to scan for named switches with optional parameters
23340 and expand file names using wild card notations.
23342 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
23343 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{32c}@anchor{gnat_rm/the_gnat_library id58}@anchor{32d}
23344 @section @cite{GNAT.Compiler_Version} (@code{g-comver.ads})
23347 @geindex GNAT.Compiler_Version (g-comver.ads)
23349 @geindex Compiler Version
23351 @geindex Version
23352 @geindex of compiler
23354 Provides a routine for obtaining the version of the compiler used to
23355 compile the program. More accurately this is the version of the binder
23356 used to bind the program (this will normally be the same as the version
23357 of the compiler if a consistent tool set is used to compile all units
23358 of a partition).
23360 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
23361 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{32e}@anchor{gnat_rm/the_gnat_library id59}@anchor{32f}
23362 @section @cite{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
23365 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
23367 @geindex Interrupt
23369 Provides a simple interface to handle Ctrl-C keyboard events.
23371 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
23372 @anchor{gnat_rm/the_gnat_library id60}@anchor{330}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{331}
23373 @section @cite{GNAT.Current_Exception} (@code{g-curexc.ads})
23376 @geindex GNAT.Current_Exception (g-curexc.ads)
23378 @geindex Current exception
23380 @geindex Exception retrieval
23382 Provides access to information on the current exception that has been raised
23383 without the need for using the Ada 95 / Ada 2005 exception choice parameter
23384 specification syntax.
23385 This is particularly useful in simulating typical facilities for
23386 obtaining information about exceptions provided by Ada 83 compilers.
23388 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
23389 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id61}@anchor{333}
23390 @section @cite{GNAT.Debug_Pools} (@code{g-debpoo.ads})
23393 @geindex GNAT.Debug_Pools (g-debpoo.ads)
23395 @geindex Debugging
23397 @geindex Debug pools
23399 @geindex Memory corruption debugging
23401 Provide a debugging storage pools that helps tracking memory corruption
23402 problems.
23403 See @cite{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
23405 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
23406 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{334}@anchor{gnat_rm/the_gnat_library id62}@anchor{335}
23407 @section @cite{GNAT.Debug_Utilities} (@code{g-debuti.ads})
23410 @geindex GNAT.Debug_Utilities (g-debuti.ads)
23412 @geindex Debugging
23414 Provides a few useful utilities for debugging purposes, including conversion
23415 to and from string images of address values. Supports both C and Ada formats
23416 for hexadecimal literals.
23418 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
23419 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id63}@anchor{337}
23420 @section @cite{GNAT.Decode_String} (@code{g-decstr.ads})
23423 @geindex GNAT.Decode_String (g-decstr.ads)
23425 @geindex Decoding strings
23427 @geindex String decoding
23429 @geindex Wide character encoding
23431 @geindex UTF-8
23433 @geindex Unicode
23435 A generic package providing routines for decoding wide character and wide wide
23436 character strings encoded as sequences of 8-bit characters using a specified
23437 encoding method. Includes validation routines, and also routines for stepping
23438 to next or previous encoded character in an encoded string.
23439 Useful in conjunction with Unicode character coding. Note there is a
23440 preinstantiation for UTF-8. See next entry.
23442 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
23443 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{338}@anchor{gnat_rm/the_gnat_library id64}@anchor{339}
23444 @section @cite{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
23447 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
23449 @geindex Decoding strings
23451 @geindex Decoding UTF-8 strings
23453 @geindex UTF-8 string decoding
23455 @geindex Wide character decoding
23457 @geindex UTF-8
23459 @geindex Unicode
23461 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
23463 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
23464 @anchor{gnat_rm/the_gnat_library id65}@anchor{33a}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{33b}
23465 @section @cite{GNAT.Directory_Operations} (@code{g-dirope.ads})
23468 @geindex GNAT.Directory_Operations (g-dirope.ads)
23470 @geindex Directory operations
23472 Provides a set of routines for manipulating directories, including changing
23473 the current directory, making new directories, and scanning the files in a
23474 directory.
23476 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
23477 @anchor{gnat_rm/the_gnat_library id66}@anchor{33c}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{33d}
23478 @section @cite{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
23481 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
23483 @geindex Directory operations iteration
23485 A child unit of GNAT.Directory_Operations providing additional operations
23486 for iterating through directories.
23488 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
23489 @anchor{gnat_rm/the_gnat_library id67}@anchor{33e}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{33f}
23490 @section @cite{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
23493 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
23495 @geindex Hash tables
23497 A generic implementation of hash tables that can be used to hash arbitrary
23498 data.  Provided in two forms, a simple form with built in hash functions,
23499 and a more complex form in which the hash function is supplied.
23501 This package provides a facility similar to that of @cite{GNAT.HTable},
23502 except that this package declares a type that can be used to define
23503 dynamic instances of the hash table, while an instantiation of
23504 @cite{GNAT.HTable} creates a single instance of the hash table.
23506 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
23507 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{340}@anchor{gnat_rm/the_gnat_library id68}@anchor{341}
23508 @section @cite{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
23511 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
23513 @geindex Table implementation
23515 @geindex Arrays
23516 @geindex extendable
23518 A generic package providing a single dimension array abstraction where the
23519 length of the array can be dynamically modified.
23521 This package provides a facility similar to that of @cite{GNAT.Table},
23522 except that this package declares a type that can be used to define
23523 dynamic instances of the table, while an instantiation of
23524 @cite{GNAT.Table} creates a single instance of the table type.
23526 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
23527 @anchor{gnat_rm/the_gnat_library id69}@anchor{342}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{343}
23528 @section @cite{GNAT.Encode_String} (@code{g-encstr.ads})
23531 @geindex GNAT.Encode_String (g-encstr.ads)
23533 @geindex Encoding strings
23535 @geindex String encoding
23537 @geindex Wide character encoding
23539 @geindex UTF-8
23541 @geindex Unicode
23543 A generic package providing routines for encoding wide character and wide
23544 wide character strings as sequences of 8-bit characters using a specified
23545 encoding method. Useful in conjunction with Unicode character coding.
23546 Note there is a preinstantiation for UTF-8. See next entry.
23548 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
23549 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{344}@anchor{gnat_rm/the_gnat_library id70}@anchor{345}
23550 @section @cite{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
23553 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
23555 @geindex Encoding strings
23557 @geindex Encoding UTF-8 strings
23559 @geindex UTF-8 string encoding
23561 @geindex Wide character encoding
23563 @geindex UTF-8
23565 @geindex Unicode
23567 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
23569 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
23570 @anchor{gnat_rm/the_gnat_library id71}@anchor{346}@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{347}
23571 @section @cite{GNAT.Exception_Actions} (@code{g-excact.ads})
23574 @geindex GNAT.Exception_Actions (g-excact.ads)
23576 @geindex Exception actions
23578 Provides callbacks when an exception is raised. Callbacks can be registered
23579 for specific exceptions, or when any exception is raised. This
23580 can be used for instance to force a core dump to ease debugging.
23582 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-expect ads,GNAT Exception_Actions g-excact ads,The GNAT Library
23583 @anchor{gnat_rm/the_gnat_library id72}@anchor{348}@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{349}
23584 @section @cite{GNAT.Exception_Traces} (@code{g-exctra.ads})
23587 @geindex GNAT.Exception_Traces (g-exctra.ads)
23589 @geindex Exception traces
23591 @geindex Debugging
23593 Provides an interface allowing to control automatic output upon exception
23594 occurrences.
23596 @node GNAT Exceptions g-expect ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
23597 @anchor{gnat_rm/the_gnat_library id73}@anchor{34a}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-expect-ads}@anchor{34b}
23598 @section @cite{GNAT.Exceptions} (@code{g-expect.ads})
23601 @geindex GNAT.Exceptions (g-expect.ads)
23603 @geindex Exceptions
23604 @geindex Pure
23606 @geindex Pure packages
23607 @geindex exceptions
23609 Normally it is not possible to raise an exception with
23610 a message from a subprogram in a pure package, since the
23611 necessary types and subprograms are in @cite{Ada.Exceptions}
23612 which is not a pure unit. @cite{GNAT.Exceptions} provides a
23613 facility for getting around this limitation for a few
23614 predefined exceptions, and for example allow raising
23615 @cite{Constraint_Error} with a message from a pure subprogram.
23617 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-expect ads,The GNAT Library
23618 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id74}@anchor{34d}
23619 @section @cite{GNAT.Expect} (@code{g-expect.ads})
23622 @geindex GNAT.Expect (g-expect.ads)
23624 Provides a set of subprograms similar to what is available
23625 with the standard Tcl Expect tool.
23626 It allows you to easily spawn and communicate with an external process.
23627 You can send commands or inputs to the process, and compare the output
23628 with some expected regular expression. Currently @cite{GNAT.Expect}
23629 is implemented on all native GNAT ports.
23630 It is not implemented for cross ports, and in particular is not
23631 implemented for VxWorks or LynxOS.
23633 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
23634 @anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id75}@anchor{34f}
23635 @section @cite{GNAT.Expect.TTY} (@code{g-exptty.ads})
23638 @geindex GNAT.Expect.TTY (g-exptty.ads)
23640 As GNAT.Expect but using pseudo-terminal.
23641 Currently @cite{GNAT.Expect.TTY} is implemented on all native GNAT
23642 ports. It is not implemented for cross ports, and
23643 in particular is not implemented for VxWorks or LynxOS.
23645 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
23646 @anchor{gnat_rm/the_gnat_library id76}@anchor{350}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{351}
23647 @section @cite{GNAT.Float_Control} (@code{g-flocon.ads})
23650 @geindex GNAT.Float_Control (g-flocon.ads)
23652 @geindex Floating-Point Processor
23654 Provides an interface for resetting the floating-point processor into the
23655 mode required for correct semantic operation in Ada.  Some third party
23656 library calls may cause this mode to be modified, and the Reset procedure
23657 in this package can be used to reestablish the required mode.
23659 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
23660 @anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{352}@anchor{gnat_rm/the_gnat_library id77}@anchor{353}
23661 @section @cite{GNAT.Formatted_String} (@code{g-forstr.ads})
23664 @geindex GNAT.Formatted_String (g-forstr.ads)
23666 @geindex Formatted String
23668 Provides support for C/C++ printf() formatted strings. The format is
23669 copied from the printf() routine and should therefore gives identical
23670 output. Some generic routines are provided to be able to use types
23671 derived from Integer, Float or enumerations as values for the
23672 formatted string.
23674 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
23675 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id78}@anchor{355}
23676 @section @cite{GNAT.Heap_Sort} (@code{g-heasor.ads})
23679 @geindex GNAT.Heap_Sort (g-heasor.ads)
23681 @geindex Sorting
23683 Provides a general implementation of heap sort usable for sorting arbitrary
23684 data items. Exchange and comparison procedures are provided by passing
23685 access-to-procedure values.  The algorithm used is a modified heap sort
23686 that performs approximately N*log(N) comparisons in the worst case.
23688 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
23689 @anchor{gnat_rm/the_gnat_library id79}@anchor{356}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{357}
23690 @section @cite{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
23693 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
23695 @geindex Sorting
23697 Provides a general implementation of heap sort usable for sorting arbitrary
23698 data items. Move and comparison procedures are provided by passing
23699 access-to-procedure values.  The algorithm used is a modified heap sort
23700 that performs approximately N*log(N) comparisons in the worst case.
23701 This differs from @cite{GNAT.Heap_Sort} in having a less convenient
23702 interface, but may be slightly more efficient.
23704 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
23705 @anchor{gnat_rm/the_gnat_library id80}@anchor{358}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{359}
23706 @section @cite{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
23709 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
23711 @geindex Sorting
23713 Similar to @cite{Heap_Sort_A} except that the move and sorting procedures
23714 are provided as generic parameters, this improves efficiency, especially
23715 if the procedures can be inlined, at the expense of duplicating code for
23716 multiple instantiations.
23718 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
23719 @anchor{gnat_rm/the_gnat_library id81}@anchor{35a}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{35b}
23720 @section @cite{GNAT.HTable} (@code{g-htable.ads})
23723 @geindex GNAT.HTable (g-htable.ads)
23725 @geindex Hash tables
23727 A generic implementation of hash tables that can be used to hash arbitrary
23728 data.  Provides two approaches, one a simple static approach, and the other
23729 allowing arbitrary dynamic hash tables.
23731 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
23732 @anchor{gnat_rm/the_gnat_library id82}@anchor{35c}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{35d}
23733 @section @cite{GNAT.IO} (@code{g-io.ads})
23736 @geindex GNAT.IO (g-io.ads)
23738 @geindex Simple I/O
23740 @geindex Input/Output facilities
23742 A simple preelaborable input-output package that provides a subset of
23743 simple Text_IO functions for reading characters and strings from
23744 Standard_Input, and writing characters, strings and integers to either
23745 Standard_Output or Standard_Error.
23747 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
23748 @anchor{gnat_rm/the_gnat_library id83}@anchor{35e}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{35f}
23749 @section @cite{GNAT.IO_Aux} (@code{g-io_aux.ads})
23752 @geindex GNAT.IO_Aux (g-io_aux.ads)
23754 @geindex Text_IO
23756 @geindex Input/Output facilities
23758 Provides some auxiliary functions for use with Text_IO, including a test
23759 for whether a file exists, and functions for reading a line of text.
23761 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
23762 @anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id84}@anchor{361}
23763 @section @cite{GNAT.Lock_Files} (@code{g-locfil.ads})
23766 @geindex GNAT.Lock_Files (g-locfil.ads)
23768 @geindex File locking
23770 @geindex Locking using files
23772 Provides a general interface for using files as locks.  Can be used for
23773 providing program level synchronization.
23775 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
23776 @anchor{gnat_rm/the_gnat_library id85}@anchor{362}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{363}
23777 @section @cite{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
23780 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
23782 @geindex Random number generation
23784 The original implementation of @cite{Ada.Numerics.Discrete_Random}.  Uses
23785 a modified version of the Blum-Blum-Shub generator.
23787 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
23788 @anchor{gnat_rm/the_gnat_library id86}@anchor{364}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{365}
23789 @section @cite{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
23792 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
23794 @geindex Random number generation
23796 The original implementation of @cite{Ada.Numerics.Float_Random}.  Uses
23797 a modified version of the Blum-Blum-Shub generator.
23799 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
23800 @anchor{gnat_rm/the_gnat_library id87}@anchor{366}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{367}
23801 @section @cite{GNAT.MD5} (@code{g-md5.ads})
23804 @geindex GNAT.MD5 (g-md5.ads)
23806 @geindex Message Digest MD5
23808 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
23809 the HMAC-MD5 message authentication function as described in RFC 2104 and
23810 FIPS PUB 198.
23812 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
23813 @anchor{gnat_rm/the_gnat_library id88}@anchor{368}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{369}
23814 @section @cite{GNAT.Memory_Dump} (@code{g-memdum.ads})
23817 @geindex GNAT.Memory_Dump (g-memdum.ads)
23819 @geindex Dump Memory
23821 Provides a convenient routine for dumping raw memory to either the
23822 standard output or standard error files. Uses GNAT.IO for actual
23823 output.
23825 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
23826 @anchor{gnat_rm/the_gnat_library id89}@anchor{36a}@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{36b}
23827 @section @cite{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
23830 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
23832 @geindex Exception
23833 @geindex obtaining most recent
23835 Provides access to the most recently raised exception.  Can be used for
23836 various logging purposes, including duplicating functionality of some
23837 Ada 83 implementation dependent extensions.
23839 @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
23840 @anchor{gnat_rm/the_gnat_library id90}@anchor{36c}@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{36d}
23841 @section @cite{GNAT.OS_Lib} (@code{g-os_lib.ads})
23844 @geindex GNAT.OS_Lib (g-os_lib.ads)
23846 @geindex Operating System interface
23848 @geindex Spawn capability
23850 Provides a range of target independent operating system interface functions,
23851 including time/date management, file operations, subprocess management,
23852 including a portable spawn procedure, and access to environment variables
23853 and error return codes.
23855 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
23856 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{36e}@anchor{gnat_rm/the_gnat_library id91}@anchor{36f}
23857 @section @cite{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
23860 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
23862 @geindex Hash functions
23864 Provides a generator of static minimal perfect hash functions. No
23865 collisions occur and each item can be retrieved from the table in one
23866 probe (perfect property). The hash table size corresponds to the exact
23867 size of the key set and no larger (minimal property). The key set has to
23868 be know in advance (static property). The hash functions are also order
23869 preserving. If w2 is inserted after w1 in the generator, their
23870 hashcode are in the same order. These hashing functions are very
23871 convenient for use with realtime applications.
23873 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
23874 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{370}@anchor{gnat_rm/the_gnat_library id92}@anchor{371}
23875 @section @cite{GNAT.Random_Numbers} (@code{g-rannum.ads})
23878 @geindex GNAT.Random_Numbers (g-rannum.ads)
23880 @geindex Random number generation
23882 Provides random number capabilities which extend those available in the
23883 standard Ada library and are more convenient to use.
23885 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
23886 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{243}@anchor{gnat_rm/the_gnat_library id93}@anchor{372}
23887 @section @cite{GNAT.Regexp} (@code{g-regexp.ads})
23890 @geindex GNAT.Regexp (g-regexp.ads)
23892 @geindex Regular expressions
23894 @geindex Pattern matching
23896 A simple implementation of regular expressions, using a subset of regular
23897 expression syntax copied from familiar Unix style utilities.  This is the
23898 simplest of the three pattern matching packages provided, and is particularly
23899 suitable for 'file globbing' applications.
23901 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
23902 @anchor{gnat_rm/the_gnat_library id94}@anchor{373}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{374}
23903 @section @cite{GNAT.Registry} (@code{g-regist.ads})
23906 @geindex GNAT.Registry (g-regist.ads)
23908 @geindex Windows Registry
23910 This is a high level binding to the Windows registry.  It is possible to
23911 do simple things like reading a key value, creating a new key.  For full
23912 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
23913 package provided with the Win32Ada binding
23915 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
23916 @anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{375}@anchor{gnat_rm/the_gnat_library id95}@anchor{376}
23917 @section @cite{GNAT.Regpat} (@code{g-regpat.ads})
23920 @geindex GNAT.Regpat (g-regpat.ads)
23922 @geindex Regular expressions
23924 @geindex Pattern matching
23926 A complete implementation of Unix-style regular expression matching, copied
23927 from the original V7 style regular expression library written in C by
23928 Henry Spencer (and binary compatible with this C library).
23930 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
23931 @anchor{gnat_rm/the_gnat_library id96}@anchor{377}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{378}
23932 @section @cite{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
23935 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
23937 @geindex Rewrite data
23939 A unit to rewrite on-the-fly string occurrences in a stream of
23940 data. The implementation has a very minimal memory footprint as the
23941 full content to be processed is not loaded into memory all at once. This makes
23942 this interface usable for large files or socket streams.
23944 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
23945 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id97}@anchor{37a}
23946 @section @cite{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
23949 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
23951 @geindex Secondary Stack Info
23953 Provide the capability to query the high water mark of the current task's
23954 secondary stack.
23956 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
23957 @anchor{gnat_rm/the_gnat_library id98}@anchor{37b}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{37c}
23958 @section @cite{GNAT.Semaphores} (@code{g-semaph.ads})
23961 @geindex GNAT.Semaphores (g-semaph.ads)
23963 @geindex Semaphores
23965 Provides classic counting and binary semaphores using protected types.
23967 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
23968 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{37d}@anchor{gnat_rm/the_gnat_library id99}@anchor{37e}
23969 @section @cite{GNAT.Serial_Communications} (@code{g-sercom.ads})
23972 @geindex GNAT.Serial_Communications (g-sercom.ads)
23974 @geindex Serial_Communications
23976 Provides a simple interface to send and receive data over a serial
23977 port. This is only supported on GNU/Linux and Windows.
23979 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
23980 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{37f}@anchor{gnat_rm/the_gnat_library id100}@anchor{380}
23981 @section @cite{GNAT.SHA1} (@code{g-sha1.ads})
23984 @geindex GNAT.SHA1 (g-sha1.ads)
23986 @geindex Secure Hash Algorithm SHA-1
23988 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
23989 and RFC 3174, and the HMAC-SHA1 message authentication function as described
23990 in RFC 2104 and FIPS PUB 198.
23992 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
23993 @anchor{gnat_rm/the_gnat_library id101}@anchor{381}@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{382}
23994 @section @cite{GNAT.SHA224} (@code{g-sha224.ads})
23997 @geindex GNAT.SHA224 (g-sha224.ads)
23999 @geindex Secure Hash Algorithm SHA-224
24001 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24002 and the HMAC-SHA224 message authentication function as described
24003 in RFC 2104 and FIPS PUB 198.
24005 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24006 @anchor{gnat_rm/the_gnat_library id102}@anchor{383}@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{384}
24007 @section @cite{GNAT.SHA256} (@code{g-sha256.ads})
24010 @geindex GNAT.SHA256 (g-sha256.ads)
24012 @geindex Secure Hash Algorithm SHA-256
24014 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24015 and the HMAC-SHA256 message authentication function as described
24016 in RFC 2104 and FIPS PUB 198.
24018 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24019 @anchor{gnat_rm/the_gnat_library id103}@anchor{385}@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{386}
24020 @section @cite{GNAT.SHA384} (@code{g-sha384.ads})
24023 @geindex GNAT.SHA384 (g-sha384.ads)
24025 @geindex Secure Hash Algorithm SHA-384
24027 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24028 and the HMAC-SHA384 message authentication function as described
24029 in RFC 2104 and FIPS PUB 198.
24031 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24032 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{387}@anchor{gnat_rm/the_gnat_library id104}@anchor{388}
24033 @section @cite{GNAT.SHA512} (@code{g-sha512.ads})
24036 @geindex GNAT.SHA512 (g-sha512.ads)
24038 @geindex Secure Hash Algorithm SHA-512
24040 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24041 and the HMAC-SHA512 message authentication function as described
24042 in RFC 2104 and FIPS PUB 198.
24044 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24045 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id105}@anchor{38a}
24046 @section @cite{GNAT.Signals} (@code{g-signal.ads})
24049 @geindex GNAT.Signals (g-signal.ads)
24051 @geindex Signals
24053 Provides the ability to manipulate the blocked status of signals on supported
24054 targets.
24056 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24057 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id106}@anchor{38c}
24058 @section @cite{GNAT.Sockets} (@code{g-socket.ads})
24061 @geindex GNAT.Sockets (g-socket.ads)
24063 @geindex Sockets
24065 A high level and portable interface to develop sockets based applications.
24066 This package is based on the sockets thin binding found in
24067 @cite{GNAT.Sockets.Thin}. Currently @cite{GNAT.Sockets} is implemented
24068 on all native GNAT ports and on VxWorks cross prots.  It is not implemented for
24069 the LynxOS cross port.
24071 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24072 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id107}@anchor{38e}
24073 @section @cite{GNAT.Source_Info} (@code{g-souinf.ads})
24076 @geindex GNAT.Source_Info (g-souinf.ads)
24078 @geindex Source Information
24080 Provides subprograms that give access to source code information known at
24081 compile time, such as the current file name and line number. Also provides
24082 subprograms yielding the date and time of the current compilation (like the
24083 C macros @cite{__DATE__} and @cite{__TIME__})
24085 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24086 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id108}@anchor{390}
24087 @section @cite{GNAT.Spelling_Checker} (@code{g-speche.ads})
24090 @geindex GNAT.Spelling_Checker (g-speche.ads)
24092 @geindex Spell checking
24094 Provides a function for determining whether one string is a plausible
24095 near misspelling of another string.
24097 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24098 @anchor{gnat_rm/the_gnat_library id109}@anchor{391}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{392}
24099 @section @cite{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24102 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24104 @geindex Spell checking
24106 Provides a generic function that can be instantiated with a string type for
24107 determining whether one string is a plausible near misspelling of another
24108 string.
24110 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24111 @anchor{gnat_rm/the_gnat_library id110}@anchor{393}@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{394}
24112 @section @cite{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24115 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24117 @geindex SPITBOL pattern matching
24119 @geindex Pattern matching
24121 A complete implementation of SNOBOL4 style pattern matching.  This is the
24122 most elaborate of the pattern matching packages provided.  It fully duplicates
24123 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24124 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24126 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24127 @anchor{gnat_rm/the_gnat_library id111}@anchor{395}@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{396}
24128 @section @cite{GNAT.Spitbol} (@code{g-spitbo.ads})
24131 @geindex GNAT.Spitbol (g-spitbo.ads)
24133 @geindex SPITBOL interface
24135 The top level package of the collection of SPITBOL-style functionality, this
24136 package provides basic SNOBOL4 string manipulation functions, such as
24137 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24138 useful for constructing arbitrary mappings from strings in the style of
24139 the SNOBOL4 TABLE function.
24141 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24142 @anchor{gnat_rm/the_gnat_library id112}@anchor{397}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{398}
24143 @section @cite{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24146 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24148 @geindex Sets of strings
24150 @geindex SPITBOL Tables
24152 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
24153 for type @cite{Standard.Boolean}, giving an implementation of sets of
24154 string values.
24156 @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
24157 @anchor{gnat_rm/the_gnat_library id113}@anchor{399}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{39a}
24158 @section @cite{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24161 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24163 @geindex Integer maps
24165 @geindex Maps
24167 @geindex SPITBOL Tables
24169 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
24170 for type @cite{Standard.Integer}, giving an implementation of maps
24171 from string to integer values.
24173 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24174 @anchor{gnat_rm/the_gnat_library id114}@anchor{39b}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{39c}
24175 @section @cite{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24178 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24180 @geindex String maps
24182 @geindex Maps
24184 @geindex SPITBOL Tables
24186 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table} for
24187 a variable length string type, giving an implementation of general
24188 maps from strings to strings.
24190 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24191 @anchor{gnat_rm/the_gnat_library id115}@anchor{39d}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{39e}
24192 @section @cite{GNAT.SSE} (@code{g-sse.ads})
24195 @geindex GNAT.SSE (g-sse.ads)
24197 Root of a set of units aimed at offering Ada bindings to a subset of
24198 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24199 targets.  It exposes vector component types together with a general
24200 introduction to the binding contents and use.
24202 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24203 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id116}@anchor{3a0}
24204 @section @cite{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
24207 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
24209 SSE vector types for use with SSE related intrinsics.
24211 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
24212 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id117}@anchor{3a2}
24213 @section @cite{GNAT.String_Hash} (@code{g-strhas.ads})
24216 @geindex GNAT.String_Hash (g-strhas.ads)
24218 @geindex Hash functions
24220 Provides a generic hash function working on arrays of scalars. Both the scalar
24221 type and the hash result type are parameters.
24223 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
24224 @anchor{gnat_rm/the_gnat_library id118}@anchor{3a3}@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3a4}
24225 @section @cite{GNAT.Strings} (@code{g-string.ads})
24228 @geindex GNAT.Strings (g-string.ads)
24230 Common String access types and related subprograms. Basically it
24231 defines a string access and an array of string access types.
24233 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
24234 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id119}@anchor{3a6}
24235 @section @cite{GNAT.String_Split} (@code{g-strspl.ads})
24238 @geindex GNAT.String_Split (g-strspl.ads)
24240 @geindex String splitter
24242 Useful string manipulation routines: given a set of separators, split
24243 a string wherever the separators appear, and provide direct access
24244 to the resulting slices. This package is instantiated from
24245 @cite{GNAT.Array_Split}.
24247 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
24248 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3a7}@anchor{gnat_rm/the_gnat_library id120}@anchor{3a8}
24249 @section @cite{GNAT.Table} (@code{g-table.ads})
24252 @geindex GNAT.Table (g-table.ads)
24254 @geindex Table implementation
24256 @geindex Arrays
24257 @geindex extendable
24259 A generic package providing a single dimension array abstraction where the
24260 length of the array can be dynamically modified.
24262 This package provides a facility similar to that of @cite{GNAT.Dynamic_Tables},
24263 except that this package declares a single instance of the table type,
24264 while an instantiation of @cite{GNAT.Dynamic_Tables} creates a type that can be
24265 used to define dynamic instances of the table.
24267 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
24268 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3a9}@anchor{gnat_rm/the_gnat_library id121}@anchor{3aa}
24269 @section @cite{GNAT.Task_Lock} (@code{g-tasloc.ads})
24272 @geindex GNAT.Task_Lock (g-tasloc.ads)
24274 @geindex Task synchronization
24276 @geindex Task locking
24278 @geindex Locking
24280 A very simple facility for locking and unlocking sections of code using a
24281 single global task lock.  Appropriate for use in situations where contention
24282 between tasks is very rarely expected.
24284 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
24285 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id122}@anchor{3ac}
24286 @section @cite{GNAT.Time_Stamp} (@code{g-timsta.ads})
24289 @geindex GNAT.Time_Stamp (g-timsta.ads)
24291 @geindex Time stamp
24293 @geindex Current time
24295 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
24296 represents the current date and time in ISO 8601 format. This is a very simple
24297 routine with minimal code and there are no dependencies on any other unit.
24299 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
24300 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id123}@anchor{3ae}
24301 @section @cite{GNAT.Threads} (@code{g-thread.ads})
24304 @geindex GNAT.Threads (g-thread.ads)
24306 @geindex Foreign threads
24308 @geindex Threads
24309 @geindex foreign
24311 Provides facilities for dealing with foreign threads which need to be known
24312 by the GNAT run-time system. Consult the documentation of this package for
24313 further details if your program has threads that are created by a non-Ada
24314 environment which then accesses Ada code.
24316 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
24317 @anchor{gnat_rm/the_gnat_library id124}@anchor{3af}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3b0}
24318 @section @cite{GNAT.Traceback} (@code{g-traceb.ads})
24321 @geindex GNAT.Traceback (g-traceb.ads)
24323 @geindex Trace back facilities
24325 Provides a facility for obtaining non-symbolic traceback information, useful
24326 in various debugging situations.
24328 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
24329 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id125}@anchor{3b2}
24330 @section @cite{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
24333 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
24335 @geindex Trace back facilities
24337 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
24338 @anchor{gnat_rm/the_gnat_library id126}@anchor{3b3}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3b4}
24339 @section @cite{GNAT.UTF_32} (@code{g-table.ads})
24342 @geindex GNAT.UTF_32 (g-table.ads)
24344 @geindex Wide character codes
24346 This is a package intended to be used in conjunction with the
24347 @cite{Wide_Character} type in Ada 95 and the
24348 @cite{Wide_Wide_Character} type in Ada 2005 (available
24349 in @cite{GNAT} in Ada 2005 mode). This package contains
24350 Unicode categorization routines, as well as lexical
24351 categorization routines corresponding to the Ada 2005
24352 lexical rules for identifiers and strings, and also a
24353 lower case to upper case fold routine corresponding to
24354 the Ada 2005 rules for identifier equivalence.
24356 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
24357 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id127}@anchor{3b6}
24358 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
24361 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
24363 @geindex Spell checking
24365 Provides a function for determining whether one wide wide string is a plausible
24366 near misspelling of another wide wide string, where the strings are represented
24367 using the UTF_32_String type defined in System.Wch_Cnv.
24369 @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
24370 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3b7}@anchor{gnat_rm/the_gnat_library id128}@anchor{3b8}
24371 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
24374 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
24376 @geindex Spell checking
24378 Provides a function for determining whether one wide string is a plausible
24379 near misspelling of another wide string.
24381 @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
24382 @anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id129}@anchor{3ba}
24383 @section @cite{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
24386 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
24388 @geindex Wide_String splitter
24390 Useful wide string manipulation routines: given a set of separators, split
24391 a wide string wherever the separators appear, and provide direct access
24392 to the resulting slices. This package is instantiated from
24393 @cite{GNAT.Array_Split}.
24395 @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
24396 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3bb}@anchor{gnat_rm/the_gnat_library id130}@anchor{3bc}
24397 @section @cite{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
24400 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
24402 @geindex Spell checking
24404 Provides a function for determining whether one wide wide string is a plausible
24405 near misspelling of another wide wide string.
24407 @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
24408 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3bd}@anchor{gnat_rm/the_gnat_library id131}@anchor{3be}
24409 @section @cite{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
24412 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
24414 @geindex Wide_Wide_String splitter
24416 Useful wide wide string manipulation routines: given a set of separators, split
24417 a wide wide string wherever the separators appear, and provide direct access
24418 to the resulting slices. This package is instantiated from
24419 @cite{GNAT.Array_Split}.
24421 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
24422 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id132}@anchor{3c0}
24423 @section @cite{Interfaces.C.Extensions} (@code{i-cexten.ads})
24426 @geindex Interfaces.C.Extensions (i-cexten.ads)
24428 This package contains additional C-related definitions, intended
24429 for use with either manually or automatically generated bindings
24430 to C libraries.
24432 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
24433 @anchor{gnat_rm/the_gnat_library id133}@anchor{3c1}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3c2}
24434 @section @cite{Interfaces.C.Streams} (@code{i-cstrea.ads})
24437 @geindex Interfaces.C.Streams (i-cstrea.ads)
24439 @geindex C streams
24440 @geindex interfacing
24442 This package is a binding for the most commonly used operations
24443 on C streams.
24445 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
24446 @anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id134}@anchor{3c4}
24447 @section @cite{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
24450 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
24452 @geindex IBM Packed Format
24454 @geindex Packed Decimal
24456 This package provides a set of routines for conversions to and
24457 from a packed decimal format compatible with that used on IBM
24458 mainframes.
24460 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
24461 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3c5}@anchor{gnat_rm/the_gnat_library id135}@anchor{3c6}
24462 @section @cite{Interfaces.VxWorks} (@code{i-vxwork.ads})
24465 @geindex Interfaces.VxWorks (i-vxwork.ads)
24467 @geindex Interfacing to VxWorks
24469 @geindex VxWorks
24470 @geindex interfacing
24472 This package provides a limited binding to the VxWorks API.
24473 In particular, it interfaces with the
24474 VxWorks hardware interrupt facilities.
24476 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
24477 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3c7}@anchor{gnat_rm/the_gnat_library id136}@anchor{3c8}
24478 @section @cite{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
24481 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
24483 @geindex Interfacing to VxWorks' I/O
24485 @geindex VxWorks
24486 @geindex I/O interfacing
24488 @geindex VxWorks
24489 @geindex Get_Immediate
24491 @geindex Get_Immediate
24492 @geindex VxWorks
24494 This package provides a binding to the ioctl (IO/Control)
24495 function of VxWorks, defining a set of option values and
24496 function codes. A particular use of this package is
24497 to enable the use of Get_Immediate under VxWorks.
24499 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
24500 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3c9}@anchor{gnat_rm/the_gnat_library id137}@anchor{3ca}
24501 @section @cite{System.Address_Image} (@code{s-addima.ads})
24504 @geindex System.Address_Image (s-addima.ads)
24506 @geindex Address image
24508 @geindex Image
24509 @geindex of an address
24511 This function provides a useful debugging
24512 function that gives an (implementation dependent)
24513 string which identifies an address.
24515 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
24516 @anchor{gnat_rm/the_gnat_library id138}@anchor{3cb}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3cc}
24517 @section @cite{System.Assertions} (@code{s-assert.ads})
24520 @geindex System.Assertions (s-assert.ads)
24522 @geindex Assertions
24524 @geindex Assert_Failure
24525 @geindex exception
24527 This package provides the declaration of the exception raised
24528 by an run-time assertion failure, as well as the routine that
24529 is used internally to raise this assertion.
24531 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
24532 @anchor{gnat_rm/the_gnat_library id139}@anchor{3cd}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3ce}
24533 @section @cite{System.Atomic_Counters} (@code{s-atocou.ads})
24536 @geindex System.Atomic_Counters (s-atocou.ads)
24538 This package provides the declaration of an atomic counter type,
24539 together with efficient routines (using hardware
24540 synchronization primitives) for incrementing, decrementing,
24541 and testing of these counters. This package is implemented
24542 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
24543 x86, and x86_64 platforms.
24545 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
24546 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3cf}@anchor{gnat_rm/the_gnat_library id140}@anchor{3d0}
24547 @section @cite{System.Memory} (@code{s-memory.ads})
24550 @geindex System.Memory (s-memory.ads)
24552 @geindex Memory allocation
24554 This package provides the interface to the low level routines used
24555 by the generated code for allocation and freeing storage for the
24556 default storage pool (analogous to the C routines malloc and free.
24557 It also provides a reallocation interface analogous to the C routine
24558 realloc. The body of this unit may be modified to provide alternative
24559 allocation mechanisms for the default pool, and in addition, direct
24560 calls to this unit may be made for low level allocation uses (for
24561 example see the body of @cite{GNAT.Tables}).
24563 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
24564 @anchor{gnat_rm/the_gnat_library id141}@anchor{3d1}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3d2}
24565 @section @cite{System.Multiprocessors} (@code{s-multip.ads})
24568 @geindex System.Multiprocessors (s-multip.ads)
24570 @geindex Multiprocessor interface
24572 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24573 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24574 technically an implementation-defined addition).
24576 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
24577 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3d3}@anchor{gnat_rm/the_gnat_library id142}@anchor{3d4}
24578 @section @cite{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
24581 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
24583 @geindex Multiprocessor interface
24585 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24586 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24587 technically an implementation-defined addition).
24589 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
24590 @anchor{gnat_rm/the_gnat_library id143}@anchor{3d5}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3d6}
24591 @section @cite{System.Partition_Interface} (@code{s-parint.ads})
24594 @geindex System.Partition_Interface (s-parint.ads)
24596 @geindex Partition interfacing functions
24598 This package provides facilities for partition interfacing.  It
24599 is used primarily in a distribution context when using Annex E
24600 with @cite{GLADE}.
24602 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
24603 @anchor{gnat_rm/the_gnat_library id144}@anchor{3d7}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3d8}
24604 @section @cite{System.Pool_Global} (@code{s-pooglo.ads})
24607 @geindex System.Pool_Global (s-pooglo.ads)
24609 @geindex Storage pool
24610 @geindex global
24612 @geindex Global storage pool
24614 This package provides a storage pool that is equivalent to the default
24615 storage pool used for access types for which no pool is specifically
24616 declared. It uses malloc/free to allocate/free and does not attempt to
24617 do any automatic reclamation.
24619 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
24620 @anchor{gnat_rm/the_gnat_library id145}@anchor{3d9}@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3da}
24621 @section @cite{System.Pool_Local} (@code{s-pooloc.ads})
24624 @geindex System.Pool_Local (s-pooloc.ads)
24626 @geindex Storage pool
24627 @geindex local
24629 @geindex Local storage pool
24631 This package provides a storage pool that is intended for use with locally
24632 defined access types. It uses malloc/free for allocate/free, and maintains
24633 a list of allocated blocks, so that all storage allocated for the pool can
24634 be freed automatically when the pool is finalized.
24636 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
24637 @anchor{gnat_rm/the_gnat_library id146}@anchor{3db}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3dc}
24638 @section @cite{System.Restrictions} (@code{s-restri.ads})
24641 @geindex System.Restrictions (s-restri.ads)
24643 @geindex Run-time restrictions access
24645 This package provides facilities for accessing at run time
24646 the status of restrictions specified at compile time for
24647 the partition. Information is available both with regard
24648 to actual restrictions specified, and with regard to
24649 compiler determined information on which restrictions
24650 are violated by one or more packages in the partition.
24652 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
24653 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3dd}@anchor{gnat_rm/the_gnat_library id147}@anchor{3de}
24654 @section @cite{System.Rident} (@code{s-rident.ads})
24657 @geindex System.Rident (s-rident.ads)
24659 @geindex Restrictions definitions
24661 This package provides definitions of the restrictions
24662 identifiers supported by GNAT, and also the format of
24663 the restrictions provided in package System.Restrictions.
24664 It is not normally necessary to @cite{with} this generic package
24665 since the necessary instantiation is included in
24666 package System.Restrictions.
24668 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
24669 @anchor{gnat_rm/the_gnat_library id148}@anchor{3df}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3e0}
24670 @section @cite{System.Strings.Stream_Ops} (@code{s-ststop.ads})
24673 @geindex System.Strings.Stream_Ops (s-ststop.ads)
24675 @geindex Stream operations
24677 @geindex String stream operations
24679 This package provides a set of stream subprograms for standard string types.
24680 It is intended primarily to support implicit use of such subprograms when
24681 stream attributes are applied to string types, but the subprograms in this
24682 package can be used directly by application programs.
24684 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
24685 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3e1}@anchor{gnat_rm/the_gnat_library id149}@anchor{3e2}
24686 @section @cite{System.Unsigned_Types} (@code{s-unstyp.ads})
24689 @geindex System.Unsigned_Types (s-unstyp.ads)
24691 This package contains definitions of standard unsigned types that
24692 correspond in size to the standard signed types declared in Standard,
24693 and (unlike the types in Interfaces) have corresponding names. It
24694 also contains some related definitions for other specialized types
24695 used by the compiler in connection with packed array types.
24697 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
24698 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{3e3}@anchor{gnat_rm/the_gnat_library id150}@anchor{3e4}
24699 @section @cite{System.Wch_Cnv} (@code{s-wchcnv.ads})
24702 @geindex System.Wch_Cnv (s-wchcnv.ads)
24704 @geindex Wide Character
24705 @geindex Representation
24707 @geindex Wide String
24708 @geindex Conversion
24710 @geindex Representation of wide characters
24712 This package provides routines for converting between
24713 wide and wide wide characters and a representation as a value of type
24714 @cite{Standard.String}, using a specified wide character
24715 encoding method.  It uses definitions in
24716 package @cite{System.Wch_Con}.
24718 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
24719 @anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{3e5}@anchor{gnat_rm/the_gnat_library id151}@anchor{3e6}
24720 @section @cite{System.Wch_Con} (@code{s-wchcon.ads})
24723 @geindex System.Wch_Con (s-wchcon.ads)
24725 This package provides definitions and descriptions of
24726 the various methods used for encoding wide characters
24727 in ordinary strings.  These definitions are used by
24728 the package @cite{System.Wch_Cnv}.
24730 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
24731 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{3e7}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{3e8}
24732 @chapter Interfacing to Other Languages
24735 The facilities in Annex B of the Ada Reference Manual are fully
24736 implemented in GNAT, and in addition, a full interface to C++ is
24737 provided.
24739 @menu
24740 * Interfacing to C:: 
24741 * Interfacing to C++:: 
24742 * Interfacing to COBOL:: 
24743 * Interfacing to Fortran:: 
24744 * Interfacing to non-GNAT Ada code:: 
24746 @end menu
24748 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
24749 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{3e9}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{3ea}
24750 @section Interfacing to C
24753 Interfacing to C with GNAT can use one of two approaches:
24756 @itemize *
24758 @item 
24759 The types in the package @cite{Interfaces.C} may be used.
24761 @item 
24762 Standard Ada types may be used directly.  This may be less portable to
24763 other compilers, but will work on all GNAT compilers, which guarantee
24764 correspondence between the C and Ada types.
24765 @end itemize
24767 Pragma @cite{Convention C} may be applied to Ada types, but mostly has no
24768 effect, since this is the default.  The following table shows the
24769 correspondence between Ada scalar types and the corresponding C types.
24772 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
24773 @headitem
24775 Ada Type
24777 @tab
24779 C Type
24781 @item
24783 @code{Integer}
24785 @tab
24787 @code{int}
24789 @item
24791 @code{Short_Integer}
24793 @tab
24795 @code{short}
24797 @item
24799 @code{Short_Short_Integer}
24801 @tab
24803 @code{signed char}
24805 @item
24807 @code{Long_Integer}
24809 @tab
24811 @code{long}
24813 @item
24815 @code{Long_Long_Integer}
24817 @tab
24819 @code{long long}
24821 @item
24823 @code{Short_Float}
24825 @tab
24827 @code{float}
24829 @item
24831 @code{Float}
24833 @tab
24835 @code{float}
24837 @item
24839 @code{Long_Float}
24841 @tab
24843 @code{double}
24845 @item
24847 @code{Long_Long_Float}
24849 @tab
24851 This is the longest floating-point type supported by the hardware.
24853 @end multitable
24856 Additionally, there are the following general correspondences between Ada
24857 and C types:
24860 @itemize *
24862 @item 
24863 Ada enumeration types map to C enumeration types directly if pragma
24864 @cite{Convention C} is specified, which causes them to have int
24865 length.  Without pragma @cite{Convention C}, Ada enumeration types map to
24866 8, 16, or 32 bits (i.e., C types @cite{signed char}, @cite{short},
24867 @cite{int}, respectively) depending on the number of values passed.
24868 This is the only case in which pragma @cite{Convention C} affects the
24869 representation of an Ada type.
24871 @item 
24872 Ada access types map to C pointers, except for the case of pointers to
24873 unconstrained types in Ada, which have no direct C equivalent.
24875 @item 
24876 Ada arrays map directly to C arrays.
24878 @item 
24879 Ada records map directly to C structures.
24881 @item 
24882 Packed Ada records map to C structures where all members are bit fields
24883 of the length corresponding to the @code{type'Size} value in Ada.
24884 @end itemize
24886 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
24887 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{3eb}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{45}
24888 @section Interfacing to C++
24891 The interface to C++ makes use of the following pragmas, which are
24892 primarily intended to be constructed automatically using a binding generator
24893 tool, although it is possible to construct them by hand.
24895 Using these pragmas it is possible to achieve complete
24896 inter-operability between Ada tagged types and C++ class definitions.
24897 See @ref{7,,Implementation Defined Pragmas}, for more details.
24900 @table @asis
24902 @item @emph{pragma CPP_Class ([Entity =>] `LOCAL_NAME`)}
24904 The argument denotes an entity in the current declarative region that is
24905 declared as a tagged or untagged record type. It indicates that the type
24906 corresponds to an externally declared C++ class type, and is to be laid
24907 out the same way that C++ would lay out the type.
24909 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
24910 for backward compatibility but its functionality is available
24911 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
24913 @item @emph{pragma CPP_Constructor ([Entity =>] `LOCAL_NAME`)}
24915 This pragma identifies an imported function (imported in the usual way
24916 with pragma @cite{Import}) as corresponding to a C++ constructor.
24917 @end table
24919 A few restrictions are placed on the use of the @cite{Access} attribute
24920 in conjunction with subprograms subject to convention @cite{CPP}: the
24921 attribute may be used neither on primitive operations of a tagged
24922 record type with convention @cite{CPP}, imported or not, nor on
24923 subprograms imported with pragma @cite{CPP_Constructor}.
24925 In addition, C++ exceptions are propagated and can be handled in an
24926 @cite{others} choice of an exception handler. The corresponding Ada
24927 occurrence has no message, and the simple name of the exception identity
24928 contains @code{Foreign_Exception}. Finalization and awaiting dependent
24929 tasks works properly when such foreign exceptions are propagated.
24931 It is also possible to import a C++ exception using the following syntax:
24933 @example
24934 LOCAL_NAME : exception;
24935 pragma Import (Cpp,
24936   [Entity =>] LOCAL_NAME,
24937   [External_Name =>] static_string_EXPRESSION);
24938 @end example
24940 The @cite{External_Name} is the name of the C++ RTTI symbol. You can then
24941 cover a specific C++ exception in an exception handler.
24943 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
24944 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{3ec}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{3ed}
24945 @section Interfacing to COBOL
24948 Interfacing to COBOL is achieved as described in section B.4 of
24949 the Ada Reference Manual.
24951 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
24952 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{3ee}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{3ef}
24953 @section Interfacing to Fortran
24956 Interfacing to Fortran is achieved as described in section B.5 of the
24957 Ada Reference Manual.  The pragma @cite{Convention Fortran}, applied to a
24958 multi-dimensional array causes the array to be stored in column-major
24959 order as required for convenient interface to Fortran.
24961 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
24962 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{3f0}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{3f1}
24963 @section Interfacing to non-GNAT Ada code
24966 It is possible to specify the convention @cite{Ada} in a pragma
24967 @cite{Import} or pragma @cite{Export}.  However this refers to
24968 the calling conventions used by GNAT, which may or may not be
24969 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
24970 compiler to allow interoperation.
24972 If arguments types are kept simple, and if the foreign compiler generally
24973 follows system calling conventions, then it may be possible to integrate
24974 files compiled by other Ada compilers, provided that the elaboration
24975 issues are adequately addressed (for example by eliminating the
24976 need for any load time elaboration).
24978 In particular, GNAT running on VMS is designed to
24979 be highly compatible with the DEC Ada 83 compiler, so this is one
24980 case in which it is possible to import foreign units of this type,
24981 provided that the data items passed are restricted to simple scalar
24982 values or simple record types without variants, or simple array
24983 types with fixed bounds.
24985 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
24986 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{3f2}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{3f3}
24987 @chapter Specialized Needs Annexes
24990 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
24991 required in all implementations.  However, as described in this chapter,
24992 GNAT implements all of these annexes:
24995 @table @asis
24997 @item @emph{Systems Programming (Annex C)}
24999 The Systems Programming Annex is fully implemented.
25001 @item @emph{Real-Time Systems (Annex D)}
25003 The Real-Time Systems Annex is fully implemented.
25005 @item @emph{Distributed Systems (Annex E)}
25007 Stub generation is fully implemented in the GNAT compiler.  In addition,
25008 a complete compatible PCS is available as part of the GLADE system,
25009 a separate product.  When the two
25010 products are used in conjunction, this annex is fully implemented.
25012 @item @emph{Information Systems (Annex F)}
25014 The Information Systems annex is fully implemented.
25016 @item @emph{Numerics (Annex G)}
25018 The Numerics Annex is fully implemented.
25020 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25022 The Safety and Security Annex (termed the High-Integrity Systems Annex
25023 in Ada 2005) is fully implemented.
25024 @end table
25026 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25027 @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{3f4}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{3f5}
25028 @chapter Implementation of Specific Ada Features
25031 This chapter describes the GNAT implementation of several Ada language
25032 facilities.
25034 @menu
25035 * Machine Code Insertions:: 
25036 * GNAT Implementation of Tasking:: 
25037 * GNAT Implementation of Shared Passive Packages:: 
25038 * Code Generation for Array Aggregates:: 
25039 * The Size of Discriminated Records with Default Discriminants:: 
25040 * Strict Conformance to the Ada Reference Manual:: 
25042 @end menu
25044 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25045 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{158}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{3f6}
25046 @section Machine Code Insertions
25049 @geindex Machine Code insertions
25051 Package @cite{Machine_Code} provides machine code support as described
25052 in the Ada Reference Manual in two separate forms:
25055 @itemize *
25057 @item 
25058 Machine code statements, consisting of qualified expressions that
25059 fit the requirements of RM section 13.8.
25061 @item 
25062 An intrinsic callable procedure, providing an alternative mechanism of
25063 including machine instructions in a subprogram.
25064 @end itemize
25066 The two features are similar, and both are closely related to the mechanism
25067 provided by the asm instruction in the GNU C compiler.  Full understanding
25068 and use of the facilities in this package requires understanding the asm
25069 instruction, see the section on Extended Asm in
25070 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25072 Calls to the function @cite{Asm} and the procedure @cite{Asm} have identical
25073 semantic restrictions and effects as described below.  Both are provided so
25074 that the procedure call can be used as a statement, and the function call
25075 can be used to form a code_statement.
25077 Consider this C @cite{asm} instruction:
25079 @example
25080 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25081 @end example
25083 The equivalent can be written for GNAT as:
25085 @example
25086 Asm ("fsinx %1 %0",
25087      My_Float'Asm_Output ("=f", result),
25088      My_Float'Asm_Input  ("f",  angle));
25089 @end example
25091 The first argument to @cite{Asm} is the assembler template, and is
25092 identical to what is used in GNU C.  This string must be a static
25093 expression.  The second argument is the output operand list.  It is
25094 either a single @cite{Asm_Output} attribute reference, or a list of such
25095 references enclosed in parentheses (technically an array aggregate of
25096 such references).
25098 The @cite{Asm_Output} attribute denotes a function that takes two
25099 parameters.  The first is a string, the second is the name of a variable
25100 of the type designated by the attribute prefix.  The first (string)
25101 argument is required to be a static expression and designates the
25102 constraint (see the section on Constraints in
25103 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25104 for the parameter; e.g., what kind of register is required.  The second
25105 argument is the variable to be written or updated with the
25106 result.  The possible values for constraint are the same as those used in
25107 the RTL, and are dependent on the configuration file used to build the
25108 GCC back end.  If there are no output operands, then this argument may
25109 either be omitted, or explicitly given as @cite{No_Output_Operands}.
25110 No support is provided for GNU C's symbolic names for output parameters.
25112 The second argument of @code{my_float'Asm_Output} functions as
25113 though it were an @cite{out} parameter, which is a little curious, but
25114 all names have the form of expressions, so there is no syntactic
25115 irregularity, even though normally functions would not be permitted
25116 @cite{out} parameters.  The third argument is the list of input
25117 operands.  It is either a single @cite{Asm_Input} attribute reference, or
25118 a list of such references enclosed in parentheses (technically an array
25119 aggregate of such references).
25121 The @cite{Asm_Input} attribute denotes a function that takes two
25122 parameters.  The first is a string, the second is an expression of the
25123 type designated by the prefix.  The first (string) argument is required
25124 to be a static expression, and is the constraint for the parameter,
25125 (e.g., what kind of register is required).  The second argument is the
25126 value to be used as the input argument.  The possible values for the
25127 constraint are the same as those used in the RTL, and are dependent on
25128 the configuration file used to built the GCC back end.
25129 No support is provided for GNU C's symbolic names for input parameters.
25131 If there are no input operands, this argument may either be omitted, or
25132 explicitly given as @cite{No_Input_Operands}.  The fourth argument, not
25133 present in the above example, is a list of register names, called the
25134 @emph{clobber} argument.  This argument, if given, must be a static string
25135 expression, and is a space or comma separated list of names of registers
25136 that must be considered destroyed as a result of the @cite{Asm} call.  If
25137 this argument is the null string (the default value), then the code
25138 generator assumes that no additional registers are destroyed.
25139 In addition to registers, the special clobbers @cite{memory} and
25140 @cite{cc} as described in the GNU C docs are both supported.
25142 The fifth argument, not present in the above example, called the
25143 @emph{volatile} argument, is by default @cite{False}.  It can be set to
25144 the literal value @cite{True} to indicate to the code generator that all
25145 optimizations with respect to the instruction specified should be
25146 suppressed, and in particular an instruction that has outputs
25147 will still be generated, even if none of the outputs are
25148 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25149 for the full description.
25150 Generally it is strongly advisable to use Volatile for any ASM statement
25151 that is missing either input or output operands or to avoid unwanted
25152 optimizations. A warning is generated if this advice is not followed.
25154 No support is provided for GNU C's @cite{asm goto} feature.
25156 The @cite{Asm} subprograms may be used in two ways.  First the procedure
25157 forms can be used anywhere a procedure call would be valid, and
25158 correspond to what the RM calls 'intrinsic' routines.  Such calls can
25159 be used to intersperse machine instructions with other Ada statements.
25160 Second, the function forms, which return a dummy value of the limited
25161 private type @cite{Asm_Insn}, can be used in code statements, and indeed
25162 this is the only context where such calls are allowed.  Code statements
25163 appear as aggregates of the form:
25165 @example
25166 Asm_Insn'(Asm (...));
25167 Asm_Insn'(Asm_Volatile (...));
25168 @end example
25170 In accordance with RM rules, such code statements are allowed only
25171 within subprograms whose entire body consists of such statements.  It is
25172 not permissible to intermix such statements with other Ada statements.
25174 Typically the form using intrinsic procedure calls is more convenient
25175 and more flexible.  The code statement form is provided to meet the RM
25176 suggestion that such a facility should be made available.  The following
25177 is the exact syntax of the call to @cite{Asm}. As usual, if named notation
25178 is used, the arguments may be given in arbitrary order, following the
25179 normal rules for use of positional and named arguments:
25181 @example
25182 ASM_CALL ::= Asm (
25183                  [Template =>] static_string_EXPRESSION
25184                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
25185                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
25186                [,[Clobber  =>] static_string_EXPRESSION ]
25187                [,[Volatile =>] static_boolean_EXPRESSION] )
25189 OUTPUT_OPERAND_LIST ::=
25190   [PREFIX.]No_Output_Operands
25191 | OUTPUT_OPERAND_ATTRIBUTE
25192 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
25194 OUTPUT_OPERAND_ATTRIBUTE ::=
25195   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
25197 INPUT_OPERAND_LIST ::=
25198   [PREFIX.]No_Input_Operands
25199 | INPUT_OPERAND_ATTRIBUTE
25200 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
25202 INPUT_OPERAND_ATTRIBUTE ::=
25203   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
25204 @end example
25206 The identifiers @cite{No_Input_Operands} and @cite{No_Output_Operands}
25207 are declared in the package @cite{Machine_Code} and must be referenced
25208 according to normal visibility rules. In particular if there is no
25209 @cite{use} clause for this package, then appropriate package name
25210 qualification is required.
25212 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
25213 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{3f7}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{3f8}
25214 @section GNAT Implementation of Tasking
25217 This chapter outlines the basic GNAT approach to tasking (in particular,
25218 a multi-layered library for portability) and discusses issues related
25219 to compliance with the Real-Time Systems Annex.
25221 @menu
25222 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
25223 * Ensuring Compliance with the Real-Time Annex:: 
25225 @end menu
25227 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
25228 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{3f9}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{3fa}
25229 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
25232 GNAT's run-time support comprises two layers:
25235 @itemize *
25237 @item 
25238 GNARL (GNAT Run-time Layer)
25240 @item 
25241 GNULL (GNAT Low-level Library)
25242 @end itemize
25244 In GNAT, Ada's tasking services rely on a platform and OS independent
25245 layer known as GNARL.  This code is responsible for implementing the
25246 correct semantics of Ada's task creation, rendezvous, protected
25247 operations etc.
25249 GNARL decomposes Ada's tasking semantics into simpler lower level
25250 operations such as create a thread, set the priority of a thread,
25251 yield, create a lock, lock/unlock, etc.  The spec for these low-level
25252 operations constitutes GNULLI, the GNULL Interface.  This interface is
25253 directly inspired from the POSIX real-time API.
25255 If the underlying executive or OS implements the POSIX standard
25256 faithfully, the GNULL Interface maps as is to the services offered by
25257 the underlying kernel.  Otherwise, some target dependent glue code maps
25258 the services offered by the underlying kernel to the semantics expected
25259 by GNARL.
25261 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
25262 key point is that each Ada task is mapped on a thread in the underlying
25263 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
25265 In addition Ada task priorities map onto the underlying thread priorities.
25266 Mapping Ada tasks onto the underlying kernel threads has several advantages:
25269 @itemize *
25271 @item 
25272 The underlying scheduler is used to schedule the Ada tasks.  This
25273 makes Ada tasks as efficient as kernel threads from a scheduling
25274 standpoint.
25276 @item 
25277 Interaction with code written in C containing threads is eased
25278 since at the lowest level Ada tasks and C threads map onto the same
25279 underlying kernel concept.
25281 @item 
25282 When an Ada task is blocked during I/O the remaining Ada tasks are
25283 able to proceed.
25285 @item 
25286 On multiprocessor systems Ada tasks can execute in parallel.
25287 @end itemize
25289 Some threads libraries offer a mechanism to fork a new process, with the
25290 child process duplicating the threads from the parent.
25291 GNAT does not
25292 support this functionality when the parent contains more than one task.
25294 @geindex Forking a new process
25296 @node Ensuring Compliance with the Real-Time Annex,,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
25297 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{3fb}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{3fc}
25298 @subsection Ensuring Compliance with the Real-Time Annex
25301 @geindex Real-Time Systems Annex compliance
25303 Although mapping Ada tasks onto
25304 the underlying threads has significant advantages, it does create some
25305 complications when it comes to respecting the scheduling semantics
25306 specified in the real-time annex (Annex D).
25308 For instance the Annex D requirement for the @cite{FIFO_Within_Priorities}
25309 scheduling policy states:
25311 @quotation
25313 @emph{When the active priority of a ready task that is not running
25314 changes, or the setting of its base priority takes effect, the
25315 task is removed from the ready queue for its old active priority
25316 and is added at the tail of the ready queue for its new active
25317 priority, except in the case where the active priority is lowered
25318 due to the loss of inherited priority, in which case the task is
25319 added at the head of the ready queue for its new active priority.}
25320 @end quotation
25322 While most kernels do put tasks at the end of the priority queue when
25323 a task changes its priority, (which respects the main
25324 FIFO_Within_Priorities requirement), almost none keep a thread at the
25325 beginning of its priority queue when its priority drops from the loss
25326 of inherited priority.
25328 As a result most vendors have provided incomplete Annex D implementations.
25330 The GNAT run-time, has a nice cooperative solution to this problem
25331 which ensures that accurate FIFO_Within_Priorities semantics are
25332 respected.
25334 The principle is as follows.  When an Ada task T is about to start
25335 running, it checks whether some other Ada task R with the same
25336 priority as T has been suspended due to the loss of priority
25337 inheritance.  If this is the case, T yields and is placed at the end of
25338 its priority queue.  When R arrives at the front of the queue it
25339 executes.
25341 Note that this simple scheme preserves the relative order of the tasks
25342 that were ready to execute in the priority queue where R has been
25343 placed at the end.
25345 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
25346 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{3fd}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{3fe}
25347 @section GNAT Implementation of Shared Passive Packages
25350 @geindex Shared passive packages
25352 GNAT fully implements the 
25353 @geindex pragma Shared_Passive
25354 pragma
25355 @cite{Shared_Passive} for
25356 the purpose of designating shared passive packages.
25357 This allows the use of passive partitions in the
25358 context described in the Ada Reference Manual; i.e., for communication
25359 between separate partitions of a distributed application using the
25360 features in Annex E.
25362 @geindex Annex E
25364 @geindex Distribution Systems Annex
25366 However, the implementation approach used by GNAT provides for more
25367 extensive usage as follows:
25370 @table @asis
25372 @item @emph{Communication between separate programs}
25374 This allows separate programs to access the data in passive
25375 partitions, using protected objects for synchronization where
25376 needed. The only requirement is that the two programs have a
25377 common shared file system. It is even possible for programs
25378 running on different machines with different architectures
25379 (e.g., different endianness) to communicate via the data in
25380 a passive partition.
25382 @item @emph{Persistence between program runs}
25384 The data in a passive package can persist from one run of a
25385 program to another, so that a later program sees the final
25386 values stored by a previous run of the same program.
25387 @end table
25389 The implementation approach used is to store the data in files. A
25390 separate stream file is created for each object in the package, and
25391 an access to an object causes the corresponding file to be read or
25392 written.
25394 @geindex SHARED_MEMORY_DIRECTORY environment variable
25396 The environment variable @cite{SHARED_MEMORY_DIRECTORY} should be
25397 set to the directory to be used for these files.
25398 The files in this directory
25399 have names that correspond to their fully qualified names. For
25400 example, if we have the package
25402 @example
25403 package X is
25404   pragma Shared_Passive (X);
25405   Y : Integer;
25406   Z : Float;
25407 end X;
25408 @end example
25410 and the environment variable is set to @cite{/stemp/}, then the files created
25411 will have the names:
25413 @example
25414 /stemp/x.y
25415 /stemp/x.z
25416 @end example
25418 These files are created when a value is initially written to the object, and
25419 the files are retained until manually deleted. This provides the persistence
25420 semantics. If no file exists, it means that no partition has assigned a value
25421 to the variable; in this case the initial value declared in the package
25422 will be used. This model ensures that there are no issues in synchronizing
25423 the elaboration process, since elaboration of passive packages elaborates the
25424 initial values, but does not create the files.
25426 The files are written using normal @cite{Stream_IO} access.
25427 If you want to be able
25428 to communicate between programs or partitions running on different
25429 architectures, then you should use the XDR versions of the stream attribute
25430 routines, since these are architecture independent.
25432 If active synchronization is required for access to the variables in the
25433 shared passive package, then as described in the Ada Reference Manual, the
25434 package may contain protected objects used for this purpose. In this case
25435 a lock file (whose name is @code{___lock} (three underscores)
25436 is created in the shared memory directory.
25438 @geindex ___lock file (for shared passive packages)
25440 This is used to provide the required locking
25441 semantics for proper protected object synchronization.
25443 GNAT supports shared passive packages on all platforms
25444 except for OpenVMS.
25446 @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
25447 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{3ff}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{400}
25448 @section Code Generation for Array Aggregates
25451 Aggregates have a rich syntax and allow the user to specify the values of
25452 complex data structures by means of a single construct.  As a result, the
25453 code generated for aggregates can be quite complex and involve loops, case
25454 statements and multiple assignments.  In the simplest cases, however, the
25455 compiler will recognize aggregates whose components and constraints are
25456 fully static, and in those cases the compiler will generate little or no
25457 executable code.  The following is an outline of the code that GNAT generates
25458 for various aggregate constructs.  For further details, you will find it
25459 useful to examine the output produced by the -gnatG flag to see the expanded
25460 source that is input to the code generator.  You may also want to examine
25461 the assembly code generated at various levels of optimization.
25463 The code generated for aggregates depends on the context, the component values,
25464 and the type.  In the context of an object declaration the code generated is
25465 generally simpler than in the case of an assignment.  As a general rule, static
25466 component values and static subtypes also lead to simpler code.
25468 @menu
25469 * Static constant aggregates with static bounds:: 
25470 * Constant aggregates with unconstrained nominal types:: 
25471 * Aggregates with static bounds:: 
25472 * Aggregates with nonstatic bounds:: 
25473 * Aggregates in assignment statements:: 
25475 @end menu
25477 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
25478 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{401}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{402}
25479 @subsection Static constant aggregates with static bounds
25482 For the declarations:
25484 @example
25485 type One_Dim is array (1..10) of integer;
25486 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
25487 @end example
25489 GNAT generates no executable code: the constant ar0 is placed in static memory.
25490 The same is true for constant aggregates with named associations:
25492 @example
25493 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
25494 Cr3 : constant One_Dim := (others => 7777);
25495 @end example
25497 The same is true for multidimensional constant arrays such as:
25499 @example
25500 type two_dim is array (1..3, 1..3) of integer;
25501 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
25502 @end example
25504 The same is true for arrays of one-dimensional arrays: the following are
25505 static:
25507 @example
25508 type ar1b  is array (1..3) of boolean;
25509 type ar_ar is array (1..3) of ar1b;
25510 None  : constant ar1b := (others => false);     --  fully static
25511 None2 : constant ar_ar := (1..3 => None);       --  fully static
25512 @end example
25514 However, for multidimensional aggregates with named associations, GNAT will
25515 generate assignments and loops, even if all associations are static.  The
25516 following two declarations generate a loop for the first dimension, and
25517 individual component assignments for the second dimension:
25519 @example
25520 Zero1: constant two_dim := (1..3 => (1..3 => 0));
25521 Zero2: constant two_dim := (others => (others => 0));
25522 @end example
25524 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
25525 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{403}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{404}
25526 @subsection Constant aggregates with unconstrained nominal types
25529 In such cases the aggregate itself establishes the subtype, so that
25530 associations with @cite{others} cannot be used.  GNAT determines the
25531 bounds for the actual subtype of the aggregate, and allocates the
25532 aggregate statically as well.  No code is generated for the following:
25534 @example
25535 type One_Unc is array (natural range <>) of integer;
25536 Cr_Unc : constant One_Unc := (12,24,36);
25537 @end example
25539 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
25540 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{405}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{406}
25541 @subsection Aggregates with static bounds
25544 In all previous examples the aggregate was the initial (and immutable) value
25545 of a constant.  If the aggregate initializes a variable, then code is generated
25546 for it as a combination of individual assignments and loops over the target
25547 object.  The declarations
25549 @example
25550 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
25551 Cr_Var2 : One_Dim := (others > -1);
25552 @end example
25554 generate the equivalent of
25556 @example
25557 Cr_Var1 (1) := 2;
25558 Cr_Var1 (2) := 3;
25559 Cr_Var1 (3) := 5;
25560 Cr_Var1 (4) := 11;
25562 for I in Cr_Var2'range loop
25563    Cr_Var2 (I) := -1;
25564 end loop;
25565 @end example
25567 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
25568 @anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{407}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{408}
25569 @subsection Aggregates with nonstatic bounds
25572 If the bounds of the aggregate are not statically compatible with the bounds
25573 of the nominal subtype  of the target, then constraint checks have to be
25574 generated on the bounds.  For a multidimensional array, constraint checks may
25575 have to be applied to sub-arrays individually, if they do not have statically
25576 compatible subtypes.
25578 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
25579 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{409}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{40a}
25580 @subsection Aggregates in assignment statements
25583 In general, aggregate assignment requires the construction of a temporary,
25584 and a copy from the temporary to the target of the assignment.  This is because
25585 it is not always possible to convert the assignment into a series of individual
25586 component assignments.  For example, consider the simple case:
25588 @example
25589 A := (A(2), A(1));
25590 @end example
25592 This cannot be converted into:
25594 @example
25595 A(1) := A(2);
25596 A(2) := A(1);
25597 @end example
25599 So the aggregate has to be built first in a separate location, and then
25600 copied into the target.  GNAT recognizes simple cases where this intermediate
25601 step is not required, and the assignments can be performed in place, directly
25602 into the target.  The following sufficient criteria are applied:
25605 @itemize *
25607 @item 
25608 The bounds of the aggregate are static, and the associations are static.
25610 @item 
25611 The components of the aggregate are static constants, names of
25612 simple variables that are not renamings, or expressions not involving
25613 indexed components whose operands obey these rules.
25614 @end itemize
25616 If any of these conditions are violated, the aggregate will be built in
25617 a temporary (created either by the front-end or the code generator) and then
25618 that temporary will be copied onto the target.
25620 @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
25621 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{40b}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{40c}
25622 @section The Size of Discriminated Records with Default Discriminants
25625 If a discriminated type @cite{T} has discriminants with default values, it is
25626 possible to declare an object of this type without providing an explicit
25627 constraint:
25629 @example
25630 type Size is range 1..100;
25632 type Rec (D : Size := 15) is record
25633    Name : String (1..D);
25634 end T;
25636 Word : Rec;
25637 @end example
25639 Such an object is said to be @emph{unconstrained}.
25640 The discriminant of the object
25641 can be modified by a full assignment to the object, as long as it preserves the
25642 relation between the value of the discriminant, and the value of the components
25643 that depend on it:
25645 @example
25646 Word := (3, "yes");
25648 Word := (5, "maybe");
25650 Word := (5, "no"); -- raises Constraint_Error
25651 @end example
25653 In order to support this behavior efficiently, an unconstrained object is
25654 given the maximum size that any value of the type requires. In the case
25655 above, @cite{Word} has storage for the discriminant and for
25656 a @cite{String} of length 100.
25657 It is important to note that unconstrained objects do not require dynamic
25658 allocation. It would be an improper implementation to place on the heap those
25659 components whose size depends on discriminants. (This improper implementation
25660 was used by some Ada83 compilers, where the @cite{Name} component above
25661 would have
25662 been stored as a pointer to a dynamic string). Following the principle that
25663 dynamic storage management should never be introduced implicitly,
25664 an Ada compiler should reserve the full size for an unconstrained declared
25665 object, and place it on the stack.
25667 This maximum size approach
25668 has been a source of surprise to some users, who expect the default
25669 values of the discriminants to determine the size reserved for an
25670 unconstrained object: "If the default is 15, why should the object occupy
25671 a larger size?"
25672 The answer, of course, is that the discriminant may be later modified,
25673 and its full range of values must be taken into account. This is why the
25674 declaration:
25676 @example
25677 type Rec (D : Positive := 15) is record
25678    Name : String (1..D);
25679 end record;
25681 Too_Large : Rec;
25682 @end example
25684 is flagged by the compiler with a warning:
25685 an attempt to create @cite{Too_Large} will raise @cite{Storage_Error},
25686 because the required size includes @cite{Positive'Last}
25687 bytes. As the first example indicates, the proper approach is to declare an
25688 index type of 'reasonable' range so that unconstrained objects are not too
25689 large.
25691 One final wrinkle: if the object is declared to be @cite{aliased}, or if it is
25692 created in the heap by means of an allocator, then it is @emph{not}
25693 unconstrained:
25694 it is constrained by the default values of the discriminants, and those values
25695 cannot be modified by full assignment. This is because in the presence of
25696 aliasing all views of the object (which may be manipulated by different tasks,
25697 say) must be consistent, so it is imperative that the object, once created,
25698 remain invariant.
25700 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
25701 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{40d}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{40e}
25702 @section Strict Conformance to the Ada Reference Manual
25705 The dynamic semantics defined by the Ada Reference Manual impose a set of
25706 run-time checks to be generated. By default, the GNAT compiler will insert many
25707 run-time checks into the compiled code, including most of those required by the
25708 Ada Reference Manual. However, there are two checks that are not enabled in
25709 the default mode for efficiency reasons: checks for access before elaboration
25710 on subprogram calls, and stack overflow checking (most operating systems do not
25711 perform this check by default).
25713 Strict conformance to the Ada Reference Manual can be achieved by adding two
25714 compiler options for dynamic checks for access-before-elaboration on subprogram
25715 calls and generic instantiations (@emph{-gnatE}), and stack overflow checking
25716 (@emph{-fstack-check}).
25718 Note that the result of a floating point arithmetic operation in overflow and
25719 invalid situations, when the @cite{Machine_Overflows} attribute of the result
25720 type is @cite{False}, is to generate IEEE NaN and infinite values. This is the
25721 case for machines compliant with the IEEE floating-point standard, but on
25722 machines that are not fully compliant with this standard, such as Alpha, the
25723 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
25724 behavior (although at the cost of a significant performance penalty), so
25725 infinite and NaN values are properly generated.
25727 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
25728 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{40f}@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{410}
25729 @chapter Implementation of Ada 2012 Features
25732 @geindex Ada 2012 implementation status
25734 @geindex -gnat12 option (gcc)
25736 @geindex pragma Ada_2012
25738 @geindex configuration pragma Ada_2012
25740 @geindex Ada_2012 configuration pragma
25742 This chapter contains a complete list of Ada 2012 features that have been
25743 implemented.
25744 Generally, these features are only
25745 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
25746 which is the default behavior,
25747 or if the configuration pragma @cite{Ada_2012} is used.
25749 However, new pragmas, attributes, and restrictions are
25750 unconditionally available, since the Ada 95 standard allows the addition of
25751 new pragmas, attributes, and restrictions (there are exceptions, which are
25752 documented in the individual descriptions), and also certain packages
25753 were made available in earlier versions of Ada.
25755 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
25756 This date shows the implementation date of the feature. Any wavefront
25757 subsequent to this date will contain the indicated feature, as will any
25758 subsequent releases. A date of 0000-00-00 means that GNAT has always
25759 implemented the feature, or implemented it as soon as it appeared as a
25760 binding interpretation.
25762 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
25763 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
25764 The features are ordered based on the relevant sections of the Ada
25765 Reference Manual ("RM").  When a given AI relates to multiple points
25766 in the RM, the earliest is used.
25768 A complete description of the AIs may be found in
25769 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
25771 @geindex AI-0176 (Ada 2012 feature)
25774 @itemize *
25776 @item 
25777 @emph{AI-0176 Quantified expressions (2010-09-29)}
25779 Both universally and existentially quantified expressions are implemented.
25780 They use the new syntax for iterators proposed in AI05-139-2, as well as
25781 the standard Ada loop syntax.
25783 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
25784 @end itemize
25786 @geindex AI-0079 (Ada 2012 feature)
25789 @itemize *
25791 @item 
25792 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
25794 Wide characters in the unicode category @emph{other_format} are now allowed in
25795 source programs between tokens, but not within a token such as an identifier.
25797 RM References:  2.01 (4/2)   2.02 (7)
25798 @end itemize
25800 @geindex AI-0091 (Ada 2012 feature)
25803 @itemize *
25805 @item 
25806 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
25808 Wide characters in the unicode category @emph{other_format} are not permitted
25809 within  an identifier, since this can be a security problem. The error
25810 message for this case has been improved to be more specific, but GNAT has
25811 never allowed such characters to appear in identifiers.
25813 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)
25814 @end itemize
25816 @geindex AI-0100 (Ada 2012 feature)
25819 @itemize *
25821 @item 
25822 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
25824 This AI is an earlier version of AI-163. It simplifies the rules
25825 for legal placement of pragmas. In the case of lists that allow pragmas, if
25826 the list may have no elements, then the list may consist solely of pragmas.
25828 RM References:  2.08 (7)
25829 @end itemize
25831 @geindex AI-0163 (Ada 2012 feature)
25834 @itemize *
25836 @item 
25837 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
25839 A statement sequence may be composed entirely of pragmas. It is no longer
25840 necessary to add a dummy @cite{null} statement to make the sequence legal.
25842 RM References:  2.08 (7)   2.08 (16)
25843 @end itemize
25845 @geindex AI-0080 (Ada 2012 feature)
25848 @itemize *
25850 @item 
25851 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
25853 This is an editorial change only, described as non-testable in the AI.
25855 RM References:  3.01 (7)
25856 @end itemize
25858 @geindex AI-0183 (Ada 2012 feature)
25861 @itemize *
25863 @item 
25864 @emph{AI-0183 Aspect specifications (2010-08-16)}
25866 Aspect specifications have been fully implemented except for pre and post-
25867 conditions, and type invariants, which have their own separate AI's. All
25868 forms of declarations listed in the AI are supported. The following is a
25869 list of the aspects supported (with GNAT implementation aspects marked)
25870 @end itemize
25873 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
25874 @headitem
25876 Supported Aspect
25878 @tab
25880 Source
25882 @item
25884 @cite{Ada_2005}
25886 @tab
25888 -- GNAT
25890 @item
25892 @cite{Ada_2012}
25894 @tab
25896 -- GNAT
25898 @item
25900 @cite{Address}
25902 @tab
25904 @item
25906 @cite{Alignment}
25908 @tab
25910 @item
25912 @cite{Atomic}
25914 @tab
25916 @item
25918 @cite{Atomic_Components}
25920 @tab
25922 @item
25924 @cite{Bit_Order}
25926 @tab
25928 @item
25930 @cite{Component_Size}
25932 @tab
25934 @item
25936 @cite{Contract_Cases}
25938 @tab
25940 -- GNAT
25942 @item
25944 @cite{Discard_Names}
25946 @tab
25948 @item
25950 @cite{External_Tag}
25952 @tab
25954 @item
25956 @cite{Favor_Top_Level}
25958 @tab
25960 -- GNAT
25962 @item
25964 @cite{Inline}
25966 @tab
25968 @item
25970 @cite{Inline_Always}
25972 @tab
25974 -- GNAT
25976 @item
25978 @cite{Invariant}
25980 @tab
25982 -- GNAT
25984 @item
25986 @cite{Machine_Radix}
25988 @tab
25990 @item
25992 @cite{No_Return}
25994 @tab
25996 @item
25998 @cite{Object_Size}
26000 @tab
26002 -- GNAT
26004 @item
26006 @cite{Pack}
26008 @tab
26010 @item
26012 @cite{Persistent_BSS}
26014 @tab
26016 -- GNAT
26018 @item
26020 @cite{Post}
26022 @tab
26024 @item
26026 @cite{Pre}
26028 @tab
26030 @item
26032 @cite{Predicate}
26034 @tab
26036 @item
26038 @cite{Preelaborable_Initialization}
26040 @tab
26042 @item
26044 @cite{Pure_Function}
26046 @tab
26048 -- GNAT
26050 @item
26052 @cite{Remote_Access_Type}
26054 @tab
26056 -- GNAT
26058 @item
26060 @cite{Shared}
26062 @tab
26064 -- GNAT
26066 @item
26068 @cite{Size}
26070 @tab
26072 @item
26074 @cite{Storage_Pool}
26076 @tab
26078 @item
26080 @cite{Storage_Size}
26082 @tab
26084 @item
26086 @cite{Stream_Size}
26088 @tab
26090 @item
26092 @cite{Suppress}
26094 @tab
26096 @item
26098 @cite{Suppress_Debug_Info}
26100 @tab
26102 -- GNAT
26104 @item
26106 @cite{Test_Case}
26108 @tab
26110 -- GNAT
26112 @item
26114 @cite{Thread_Local_Storage}
26116 @tab
26118 -- GNAT
26120 @item
26122 @cite{Type_Invariant}
26124 @tab
26126 @item
26128 @cite{Unchecked_Union}
26130 @tab
26132 @item
26134 @cite{Universal_Aliasing}
26136 @tab
26138 -- GNAT
26140 @item
26142 @cite{Unmodified}
26144 @tab
26146 -- GNAT
26148 @item
26150 @cite{Unreferenced}
26152 @tab
26154 -- GNAT
26156 @item
26158 @cite{Unreferenced_Objects}
26160 @tab
26162 -- GNAT
26164 @item
26166 @cite{Unsuppress}
26168 @tab
26170 @item
26172 @cite{Value_Size}
26174 @tab
26176 -- GNAT
26178 @item
26180 @cite{Volatile}
26182 @tab
26184 @item
26186 @cite{Volatile_Components}
26188 @tab
26190 @item
26192 @cite{Warnings}
26194 @tab
26196 -- GNAT
26198 @end multitable
26201 @quotation
26203 Note that for aspects with an expression, e.g. @cite{Size}, the expression is
26204 treated like a default expression (visibility is analyzed at the point of
26205 occurrence of the aspect, but evaluation of the expression occurs at the
26206 freeze point of the entity involved).
26208 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
26209 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
26210 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
26211 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
26212 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
26213 13.03.01 (0)
26214 @end quotation
26216 @geindex AI-0128 (Ada 2012 feature)
26219 @itemize *
26221 @item 
26222 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
26224 If an equality operator ("=") is declared for a type, then the implicitly
26225 declared inequality operator ("/=") is a primitive operation of the type.
26226 This is the only reasonable interpretation, and is the one always implemented
26227 by GNAT, but the RM was not entirely clear in making this point.
26229 RM References:  3.02.03 (6)   6.06 (6)
26230 @end itemize
26232 @geindex AI-0003 (Ada 2012 feature)
26235 @itemize *
26237 @item 
26238 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
26240 In Ada 2012, a qualified expression is considered to be syntactically a name,
26241 meaning that constructs such as @cite{A'(F(X)).B} are now legal. This is
26242 useful in disambiguating some cases of overloading.
26244 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
26245 5.04 (7)
26246 @end itemize
26248 @geindex AI-0120 (Ada 2012 feature)
26251 @itemize *
26253 @item 
26254 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
26256 This is an RM editorial change only. The section that lists objects that are
26257 constant failed to include the current instance of a protected object
26258 within a protected function. This has always been treated as a constant
26259 in GNAT.
26261 RM References:  3.03 (21)
26262 @end itemize
26264 @geindex AI-0008 (Ada 2012 feature)
26267 @itemize *
26269 @item 
26270 @emph{AI-0008 General access to constrained objects (0000-00-00)}
26272 The wording in the RM implied that if you have a general access to a
26273 constrained object, it could be used to modify the discriminants. This was
26274 obviously not intended. @cite{Constraint_Error} should be raised, and GNAT
26275 has always done so in this situation.
26277 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
26278 @end itemize
26280 @geindex AI-0093 (Ada 2012 feature)
26283 @itemize *
26285 @item 
26286 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
26288 This is an editorial change only, to make more widespread use of the Ada 2012
26289 'immutably limited'.
26291 RM References:  3.03 (23.4/3)
26292 @end itemize
26294 @geindex AI-0096 (Ada 2012 feature)
26297 @itemize *
26299 @item 
26300 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
26302 In general it is illegal for a type derived from a formal limited type to be
26303 nonlimited.  This AI makes an exception to this rule: derivation is legal
26304 if it appears in the private part of the generic, and the formal type is not
26305 tagged. If the type is tagged, the legality check must be applied to the
26306 private part of the package.
26308 RM References:  3.04 (5.1/2)   6.02 (7)
26309 @end itemize
26311 @geindex AI-0181 (Ada 2012 feature)
26314 @itemize *
26316 @item 
26317 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
26319 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
26320 means that it has a special name (@cite{SOFT_HYPHEN}) in conjunction with the
26321 @cite{Image} and @cite{Value} attributes for the character types. Strictly
26322 speaking this is an inconsistency with Ada 95, but in practice the use of
26323 these attributes is so obscure that it will not cause problems.
26325 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
26326 @end itemize
26328 @geindex AI-0182 (Ada 2012 feature)
26331 @itemize *
26333 @item 
26334 @emph{AI-0182 Additional forms for `Character'Value} (0000-00-00)`
26336 This AI allows @cite{Character'Value} to accept the string @cite{'?'} where
26337 @cite{?} is any character including non-graphic control characters. GNAT has
26338 always accepted such strings. It also allows strings such as
26339 @cite{HEX_00000041} to be accepted, but GNAT does not take advantage of this
26340 permission and raises @cite{Constraint_Error}, as is certainly still
26341 permitted.
26343 RM References:  3.05 (56/2)
26344 @end itemize
26346 @geindex AI-0214 (Ada 2012 feature)
26349 @itemize *
26351 @item 
26352 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
26354 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
26355 to have default expressions by allowing them when the type is limited. It
26356 is often useful to define a default value for a discriminant even though
26357 it can't be changed by assignment.
26359 RM References:  3.07 (9.1/2)   3.07.02 (3)
26360 @end itemize
26362 @geindex AI-0102 (Ada 2012 feature)
26365 @itemize *
26367 @item 
26368 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
26370 It is illegal to assign an anonymous access constant to an anonymous access
26371 variable. The RM did not have a clear rule to prevent this, but GNAT has
26372 always generated an error for this usage.
26374 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
26375 @end itemize
26377 @geindex AI-0158 (Ada 2012 feature)
26380 @itemize *
26382 @item 
26383 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
26385 This AI extends the syntax of membership tests to simplify complex conditions
26386 that can be expressed as membership in a subset of values of any type. It
26387 introduces syntax for a list of expressions that may be used in loop contexts
26388 as well.
26390 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
26391 @end itemize
26393 @geindex AI-0173 (Ada 2012 feature)
26396 @itemize *
26398 @item 
26399 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
26401 The function @cite{Ada.Tags.Type_Is_Abstract} returns @cite{True} if invoked
26402 with the tag of an abstract type, and @cite{False} otherwise.
26404 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
26405 @end itemize
26407 @geindex AI-0076 (Ada 2012 feature)
26410 @itemize *
26412 @item 
26413 @emph{AI-0076 function with controlling result (0000-00-00)}
26415 This is an editorial change only. The RM defines calls with controlling
26416 results, but uses the term 'function with controlling result' without an
26417 explicit definition.
26419 RM References:  3.09.02 (2/2)
26420 @end itemize
26422 @geindex AI-0126 (Ada 2012 feature)
26425 @itemize *
26427 @item 
26428 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
26430 This AI clarifies dispatching rules, and simply confirms that dispatching
26431 executes the operation of the parent type when there is no explicitly or
26432 implicitly declared operation for the descendant type. This has always been
26433 the case in all versions of GNAT.
26435 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
26436 @end itemize
26438 @geindex AI-0097 (Ada 2012 feature)
26441 @itemize *
26443 @item 
26444 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
26446 The RM as written implied that in some cases it was possible to create an
26447 object of an abstract type, by having an abstract extension inherit a non-
26448 abstract constructor from its parent type. This mistake has been corrected
26449 in GNAT and in the RM, and this construct is now illegal.
26451 RM References:  3.09.03 (4/2)
26452 @end itemize
26454 @geindex AI-0203 (Ada 2012 feature)
26457 @itemize *
26459 @item 
26460 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
26462 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
26463 permitted such usage.
26465 RM References:  3.09.03 (8/3)
26466 @end itemize
26468 @geindex AI-0198 (Ada 2012 feature)
26471 @itemize *
26473 @item 
26474 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
26476 This AI resolves a conflict between two rules involving inherited abstract
26477 operations and predefined operators. If a derived numeric type inherits
26478 an abstract operator, it overrides the predefined one. This interpretation
26479 was always the one implemented in GNAT.
26481 RM References:  3.09.03 (4/3)
26482 @end itemize
26484 @geindex AI-0073 (Ada 2012 feature)
26487 @itemize *
26489 @item 
26490 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
26492 This AI covers a number of issues regarding returning abstract types. In
26493 particular generic functions cannot have abstract result types or access
26494 result types designated an abstract type. There are some other cases which
26495 are detailed in the AI. Note that this binding interpretation has not been
26496 retrofitted to operate before Ada 2012 mode, since it caused a significant
26497 number of regressions.
26499 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
26500 @end itemize
26502 @geindex AI-0070 (Ada 2012 feature)
26505 @itemize *
26507 @item 
26508 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
26510 This is an editorial change only, there are no testable consequences short of
26511 checking for the absence of generated code for an interface declaration.
26513 RM References:  3.09.04 (18/2)
26514 @end itemize
26516 @geindex AI-0208 (Ada 2012 feature)
26519 @itemize *
26521 @item 
26522 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
26524 The wording in the Ada 2005 RM concerning characteristics of incomplete views
26525 was incorrect and implied that some programs intended to be legal were now
26526 illegal. GNAT had never considered such programs illegal, so it has always
26527 implemented the intent of this AI.
26529 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
26530 @end itemize
26532 @geindex AI-0162 (Ada 2012 feature)
26535 @itemize *
26537 @item 
26538 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
26540 Incomplete types are made more useful by allowing them to be completed by
26541 private types and private extensions.
26543 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
26544 @end itemize
26546 @geindex AI-0098 (Ada 2012 feature)
26549 @itemize *
26551 @item 
26552 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
26554 An unintentional omission in the RM implied some inconsistent restrictions on
26555 the use of anonymous access to subprogram values. These restrictions were not
26556 intentional, and have never been enforced by GNAT.
26558 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
26559 @end itemize
26561 @geindex AI-0199 (Ada 2012 feature)
26564 @itemize *
26566 @item 
26567 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
26569 A choice list in a record aggregate can include several components of
26570 (distinct) anonymous access types as long as they have matching designated
26571 subtypes.
26573 RM References:  4.03.01 (16)
26574 @end itemize
26576 @geindex AI-0220 (Ada 2012 feature)
26579 @itemize *
26581 @item 
26582 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
26584 This AI addresses a wording problem in the RM that appears to permit some
26585 complex cases of aggregates with nonstatic discriminants. GNAT has always
26586 implemented the intended semantics.
26588 RM References:  4.03.01 (17)
26589 @end itemize
26591 @geindex AI-0147 (Ada 2012 feature)
26594 @itemize *
26596 @item 
26597 @emph{AI-0147 Conditional expressions (2009-03-29)}
26599 Conditional expressions are permitted. The form of such an expression is:
26601 @example
26602 (if expr then expr @{elsif expr then expr@} [else expr])
26603 @end example
26605 The parentheses can be omitted in contexts where parentheses are present
26606 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
26607 clause is omitted, @strong{else} @emph{True} is assumed;
26608 thus @code{(if A then B)} is a way to conveniently represent
26609 @emph{(A implies B)} in standard logic.
26611 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
26612 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
26613 @end itemize
26615 @geindex AI-0037 (Ada 2012 feature)
26618 @itemize *
26620 @item 
26621 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
26623 This AI confirms that an association of the form @cite{Indx => <>} in an
26624 array aggregate must raise @cite{Constraint_Error} if @cite{Indx}
26625 is out of range. The RM specified a range check on other associations, but
26626 not when the value of the association was defaulted. GNAT has always inserted
26627 a constraint check on the index value.
26629 RM References:  4.03.03 (29)
26630 @end itemize
26632 @geindex AI-0123 (Ada 2012 feature)
26635 @itemize *
26637 @item 
26638 @emph{AI-0123 Composability of equality (2010-04-13)}
26640 Equality of untagged record composes, so that the predefined equality for a
26641 composite type that includes a component of some untagged record type
26642 @cite{R} uses the equality operation of @cite{R} (which may be user-defined
26643 or predefined). This makes the behavior of untagged records identical to that
26644 of tagged types in this respect.
26646 This change is an incompatibility with previous versions of Ada, but it
26647 corrects a non-uniformity that was often a source of confusion. Analysis of
26648 a large number of industrial programs indicates that in those rare cases
26649 where a composite type had an untagged record component with a user-defined
26650 equality, either there was no use of the composite equality, or else the code
26651 expected the same composability as for tagged types, and thus had a bug that
26652 would be fixed by this change.
26654 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
26655 8.05.04 (8)
26656 @end itemize
26658 @geindex AI-0088 (Ada 2012 feature)
26661 @itemize *
26663 @item 
26664 @emph{AI-0088 The value of exponentiation (0000-00-00)}
26666 This AI clarifies the equivalence rule given for the dynamic semantics of
26667 exponentiation: the value of the operation can be obtained by repeated
26668 multiplication, but the operation can be implemented otherwise (for example
26669 using the familiar divide-by-two-and-square algorithm, even if this is less
26670 accurate), and does not imply repeated reads of a volatile base.
26672 RM References:  4.05.06 (11)
26673 @end itemize
26675 @geindex AI-0188 (Ada 2012 feature)
26678 @itemize *
26680 @item 
26681 @emph{AI-0188 Case expressions (2010-01-09)}
26683 Case expressions are permitted. This allows use of constructs such as:
26685 @example
26686 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
26687 @end example
26689 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
26690 @end itemize
26692 @geindex AI-0104 (Ada 2012 feature)
26695 @itemize *
26697 @item 
26698 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
26700 The assignment @code{Ptr := new not null Some_Ptr;} will raise
26701 @code{Constraint_Error} because the default value of the allocated object is
26702 @strong{null}. This useless construct is illegal in Ada 2012.
26704 RM References:  4.08 (2)
26705 @end itemize
26707 @geindex AI-0157 (Ada 2012 feature)
26710 @itemize *
26712 @item 
26713 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
26715 Allocation and Deallocation from an empty storage pool (i.e. allocation or
26716 deallocation of a pointer for which a static storage size clause of zero
26717 has been given) is now illegal and is detected as such. GNAT
26718 previously gave a warning but not an error.
26720 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
26721 @end itemize
26723 @geindex AI-0179 (Ada 2012 feature)
26726 @itemize *
26728 @item 
26729 @emph{AI-0179 Statement not required after label (2010-04-10)}
26731 It is not necessary to have a statement following a label, so a label
26732 can appear at the end of a statement sequence without the need for putting a
26733 null statement afterwards, but it is not allowable to have only labels and
26734 no real statements in a statement sequence.
26736 RM References:  5.01 (2)
26737 @end itemize
26739 @geindex AI-0139-2 (Ada 2012 feature)
26742 @itemize *
26744 @item 
26745 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
26747 The new syntax for iterating over arrays and containers is now implemented.
26748 Iteration over containers is for now limited to read-only iterators. Only
26749 default iterators are supported, with the syntax:  @cite{for Elem of C}.
26751 RM References:  5.05
26752 @end itemize
26754 @geindex AI-0134 (Ada 2012 feature)
26757 @itemize *
26759 @item 
26760 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
26762 For full conformance, the profiles of anonymous-access-to-subprogram
26763 parameters must match. GNAT has always enforced this rule.
26765 RM References:  6.03.01 (18)
26766 @end itemize
26768 @geindex AI-0207 (Ada 2012 feature)
26771 @itemize *
26773 @item 
26774 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
26776 This AI confirms that access_to_constant indication must match for mode
26777 conformance. This was implemented in GNAT when the qualifier was originally
26778 introduced in Ada 2005.
26780 RM References:  6.03.01 (16/2)
26781 @end itemize
26783 @geindex AI-0046 (Ada 2012 feature)
26786 @itemize *
26788 @item 
26789 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
26791 For full conformance, in the case of access parameters, the null exclusion
26792 must match (either both or neither must have @code{not null}).
26794 RM References:  6.03.02 (18)
26795 @end itemize
26797 @geindex AI-0118 (Ada 2012 feature)
26800 @itemize *
26802 @item 
26803 @emph{AI-0118 The association of parameter associations (0000-00-00)}
26805 This AI clarifies the rules for named associations in subprogram calls and
26806 generic instantiations. The rules have been in place since Ada 83.
26808 RM References:  6.04.01 (2)   12.03 (9)
26809 @end itemize
26811 @geindex AI-0196 (Ada 2012 feature)
26814 @itemize *
26816 @item 
26817 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
26819 Null exclusion checks are not made for @cite{**out**} parameters when
26820 evaluating the actual parameters. GNAT has never generated these checks.
26822 RM References:  6.04.01 (13)
26823 @end itemize
26825 @geindex AI-0015 (Ada 2012 feature)
26828 @itemize *
26830 @item 
26831 @emph{AI-0015 Constant return objects (0000-00-00)}
26833 The return object declared in an @emph{extended_return_statement} may be
26834 declared constant. This was always intended, and GNAT has always allowed it.
26836 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
26837 6.05 (5.7/2)
26838 @end itemize
26840 @geindex AI-0032 (Ada 2012 feature)
26843 @itemize *
26845 @item 
26846 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
26848 If a function returns a class-wide type, the object of an extended return
26849 statement can be declared with a specific type that is covered by the class-
26850 wide type. This has been implemented in GNAT since the introduction of
26851 extended returns. Note AI-0103 complements this AI by imposing matching
26852 rules for constrained return types.
26854 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
26855 6.05 (8/2)
26856 @end itemize
26858 @geindex AI-0103 (Ada 2012 feature)
26861 @itemize *
26863 @item 
26864 @emph{AI-0103 Static matching for extended return (2010-07-23)}
26866 If the return subtype of a function is an elementary type or a constrained
26867 type, the subtype indication in an extended return statement must match
26868 statically this return subtype.
26870 RM References:  6.05 (5.2/2)
26871 @end itemize
26873 @geindex AI-0058 (Ada 2012 feature)
26876 @itemize *
26878 @item 
26879 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
26881 The RM had some incorrect wording implying wrong treatment of abnormal
26882 completion in an extended return. GNAT has always implemented the intended
26883 correct semantics as described by this AI.
26885 RM References:  6.05 (22/2)
26886 @end itemize
26888 @geindex AI-0050 (Ada 2012 feature)
26891 @itemize *
26893 @item 
26894 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
26896 The implementation permissions for raising @cite{Constraint_Error} early on a function call
26897 when it was clear an exception would be raised were over-permissive and allowed
26898 mishandling of discriminants in some cases. GNAT did
26899 not take advantage of these incorrect permissions in any case.
26901 RM References:  6.05 (24/2)
26902 @end itemize
26904 @geindex AI-0125 (Ada 2012 feature)
26907 @itemize *
26909 @item 
26910 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
26912 In Ada 2012, the declaration of a primitive operation of a type extension
26913 or private extension can also override an inherited primitive that is not
26914 visible at the point of this declaration.
26916 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
26917 @end itemize
26919 @geindex AI-0062 (Ada 2012 feature)
26922 @itemize *
26924 @item 
26925 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
26927 A full constant may have a null exclusion even if its associated deferred
26928 constant does not. GNAT has always allowed this.
26930 RM References:  7.04 (6/2)   7.04 (7.1/2)
26931 @end itemize
26933 @geindex AI-0178 (Ada 2012 feature)
26936 @itemize *
26938 @item 
26939 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
26941 This AI clarifies the role of incomplete views and plugs an omission in the
26942 RM. GNAT always correctly restricted the use of incomplete views and types.
26944 RM References:  7.05 (3/2)   7.05 (6/2)
26945 @end itemize
26947 @geindex AI-0087 (Ada 2012 feature)
26950 @itemize *
26952 @item 
26953 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
26955 The actual for a formal nonlimited derived type cannot be limited. In
26956 particular, a formal derived type that extends a limited interface but which
26957 is not explicitly limited cannot be instantiated with a limited type.
26959 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
26960 @end itemize
26962 @geindex AI-0099 (Ada 2012 feature)
26965 @itemize *
26967 @item 
26968 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
26970 This AI clarifies that 'needs finalization' is part of dynamic semantics,
26971 and therefore depends on the run-time characteristics of an object (i.e. its
26972 tag) and not on its nominal type. As the AI indicates: "we do not expect
26973 this to affect any implementation'@w{'}.
26975 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
26976 @end itemize
26978 @geindex AI-0064 (Ada 2012 feature)
26981 @itemize *
26983 @item 
26984 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
26986 This is an editorial change only. The intended behavior is already checked
26987 by an existing ACATS test, which GNAT has always executed correctly.
26989 RM References:  7.06.01 (17.1/1)
26990 @end itemize
26992 @geindex AI-0026 (Ada 2012 feature)
26995 @itemize *
26997 @item 
26998 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
27000 Record representation clauses concerning Unchecked_Union types cannot mention
27001 the discriminant of the type. The type of a component declared in the variant
27002 part of an Unchecked_Union cannot be controlled, have controlled components,
27003 nor have protected or task parts. If an Unchecked_Union type is declared
27004 within the body of a generic unit or its descendants, then the type of a
27005 component declared in the variant part cannot be a formal private type or a
27006 formal private extension declared within the same generic unit.
27008 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
27009 @end itemize
27011 @geindex AI-0205 (Ada 2012 feature)
27014 @itemize *
27016 @item 
27017 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27019 This AI corrects a simple omission in the RM. Return objects have always
27020 been visible within an extended return statement.
27022 RM References:  8.03 (17)
27023 @end itemize
27025 @geindex AI-0042 (Ada 2012 feature)
27028 @itemize *
27030 @item 
27031 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
27033 This AI fixes a wording gap in the RM. An operation of a synchronized
27034 interface can be implemented by a protected or task entry, but the abstract
27035 operation is not being overridden in the usual sense, and it must be stated
27036 separately that this implementation is legal. This has always been the case
27037 in GNAT.
27039 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
27040 @end itemize
27042 @geindex AI-0030 (Ada 2012 feature)
27045 @itemize *
27047 @item 
27048 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
27050 Requeue is permitted to a protected, synchronized or task interface primitive
27051 providing it is known that the overriding operation is an entry. Otherwise
27052 the requeue statement has the same effect as a procedure call. Use of pragma
27053 @cite{Implemented} provides a way to impose a static requirement on the
27054 overriding operation by adhering to one of the implementation kinds: entry,
27055 protected procedure or any of the above.
27057 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
27058 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
27059 @end itemize
27061 @geindex AI-0201 (Ada 2012 feature)
27064 @itemize *
27066 @item 
27067 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
27069 If an Atomic object has a pragma @cite{Pack} or a @cite{Component_Size}
27070 attribute, then individual components may not be addressable by independent
27071 tasks. However, if the representation clause has no effect (is confirming),
27072 then independence is not compromised. Furthermore, in GNAT, specification of
27073 other appropriately addressable component sizes (e.g. 16 for 8-bit
27074 characters) also preserves independence. GNAT now gives very clear warnings
27075 both for the declaration of such a type, and for any assignment to its components.
27077 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
27078 @end itemize
27080 @geindex AI-0009 (Ada 2012 feature)
27083 @itemize *
27085 @item 
27086 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
27088 This AI introduces the new pragmas @cite{Independent} and
27089 @cite{Independent_Components},
27090 which control guaranteeing independence of access to objects and components.
27091 The AI also requires independence not unaffected by confirming rep clauses.
27093 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
27094 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
27095 @end itemize
27097 @geindex AI-0072 (Ada 2012 feature)
27100 @itemize *
27102 @item 
27103 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
27105 This AI clarifies that task signalling for reading @cite{'Terminated} only
27106 occurs if the result is True. GNAT semantics has always been consistent with
27107 this notion of task signalling.
27109 RM References:  9.10 (6.1/1)
27110 @end itemize
27112 @geindex AI-0108 (Ada 2012 feature)
27115 @itemize *
27117 @item 
27118 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
27120 This AI confirms that an incomplete type from a limited view does not have
27121 discriminants. This has always been the case in GNAT.
27123 RM References:  10.01.01 (12.3/2)
27124 @end itemize
27126 @geindex AI-0129 (Ada 2012 feature)
27129 @itemize *
27131 @item 
27132 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
27134 This AI clarifies the description of limited views: a limited view of a
27135 package includes only one view of a type that has an incomplete declaration
27136 and a full declaration (there is no possible ambiguity in a client package).
27137 This AI also fixes an omission: a nested package in the private part has no
27138 limited view. GNAT always implemented this correctly.
27140 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
27141 @end itemize
27143 @geindex AI-0077 (Ada 2012 feature)
27146 @itemize *
27148 @item 
27149 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
27151 This AI clarifies that a declaration does not include a context clause,
27152 and confirms that it is illegal to have a context in which both a limited
27153 and a nonlimited view of a package are accessible. Such double visibility
27154 was always rejected by GNAT.
27156 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
27157 @end itemize
27159 @geindex AI-0122 (Ada 2012 feature)
27162 @itemize *
27164 @item 
27165 @emph{AI-0122 Private with and children of generics (0000-00-00)}
27167 This AI clarifies the visibility of private children of generic units within
27168 instantiations of a parent. GNAT has always handled this correctly.
27170 RM References:  10.01.02 (12/2)
27171 @end itemize
27173 @geindex AI-0040 (Ada 2012 feature)
27176 @itemize *
27178 @item 
27179 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
27181 This AI confirms that a limited with clause in a child unit cannot name
27182 an ancestor of the unit. This has always been checked in GNAT.
27184 RM References:  10.01.02 (20/2)
27185 @end itemize
27187 @geindex AI-0132 (Ada 2012 feature)
27190 @itemize *
27192 @item 
27193 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
27195 This AI fills a gap in the description of library unit pragmas. The pragma
27196 clearly must apply to a library unit, even if it does not carry the name
27197 of the enclosing unit. GNAT has always enforced the required check.
27199 RM References:  10.01.05 (7)
27200 @end itemize
27202 @geindex AI-0034 (Ada 2012 feature)
27205 @itemize *
27207 @item 
27208 @emph{AI-0034 Categorization of limited views (0000-00-00)}
27210 The RM makes certain limited with clauses illegal because of categorization
27211 considerations, when the corresponding normal with would be legal. This is
27212 not intended, and GNAT has always implemented the recommended behavior.
27214 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
27215 @end itemize
27217 @geindex AI-0035 (Ada 2012 feature)
27220 @itemize *
27222 @item 
27223 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
27225 This AI remedies some inconsistencies in the legality rules for Pure units.
27226 Derived access types are legal in a pure unit (on the assumption that the
27227 rule for a zero storage pool size has been enforced on the ancestor type).
27228 The rules are enforced in generic instances and in subunits. GNAT has always
27229 implemented the recommended behavior.
27231 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)
27232 @end itemize
27234 @geindex AI-0219 (Ada 2012 feature)
27237 @itemize *
27239 @item 
27240 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
27242 This AI refines the rules for the cases with limited parameters which do not
27243 allow the implementations to omit 'redundant'. GNAT now properly conforms
27244 to the requirements of this binding interpretation.
27246 RM References:  10.02.01 (18/2)
27247 @end itemize
27249 @geindex AI-0043 (Ada 2012 feature)
27252 @itemize *
27254 @item 
27255 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
27257 This AI covers various omissions in the RM regarding the raising of
27258 exceptions. GNAT has always implemented the intended semantics.
27260 RM References:  11.04.01 (10.1/2)   11 (2)
27261 @end itemize
27263 @geindex AI-0200 (Ada 2012 feature)
27266 @itemize *
27268 @item 
27269 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
27271 This AI plugs a gap in the RM which appeared to allow some obviously intended
27272 illegal instantiations. GNAT has never allowed these instantiations.
27274 RM References:  12.07 (16)
27275 @end itemize
27277 @geindex AI-0112 (Ada 2012 feature)
27280 @itemize *
27282 @item 
27283 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
27285 This AI concerns giving names to various representation aspects, but the
27286 practical effect is simply to make the use of duplicate
27287 @cite{Atomic[_Components]},
27288 @cite{Volatile[_Components]}, and
27289 @cite{Independent[_Components]} pragmas illegal, and GNAT
27290 now performs this required check.
27292 RM References:  13.01 (8)
27293 @end itemize
27295 @geindex AI-0106 (Ada 2012 feature)
27298 @itemize *
27300 @item 
27301 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
27303 The RM appeared to allow representation pragmas on generic formal parameters,
27304 but this was not intended, and GNAT has never permitted this usage.
27306 RM References:  13.01 (9.1/1)
27307 @end itemize
27309 @geindex AI-0012 (Ada 2012 feature)
27312 @itemize *
27314 @item 
27315 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
27317 It is now illegal to give an inappropriate component size or a pragma
27318 @cite{Pack} that attempts to change the component size in the case of atomic
27319 or aliased components. Previously GNAT ignored such an attempt with a
27320 warning.
27322 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
27323 @end itemize
27325 @geindex AI-0039 (Ada 2012 feature)
27328 @itemize *
27330 @item 
27331 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
27333 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
27334 for stream attributes, but these were never useful and are now illegal. GNAT
27335 has always regarded such expressions as illegal.
27337 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
27338 @end itemize
27340 @geindex AI-0095 (Ada 2012 feature)
27343 @itemize *
27345 @item 
27346 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
27348 The prefix of @cite{'Address} cannot statically denote a subprogram with
27349 convention @cite{Intrinsic}. The use of the @cite{Address} attribute raises
27350 @cite{Program_Error} if the prefix denotes a subprogram with convention
27351 @cite{Intrinsic}.
27353 RM References:  13.03 (11/1)
27354 @end itemize
27356 @geindex AI-0116 (Ada 2012 feature)
27359 @itemize *
27361 @item 
27362 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
27364 This AI requires that the alignment of a class-wide object be no greater
27365 than the alignment of any type in the class. GNAT has always followed this
27366 recommendation.
27368 RM References:  13.03 (29)   13.11 (16)
27369 @end itemize
27371 @geindex AI-0146 (Ada 2012 feature)
27374 @itemize *
27376 @item 
27377 @emph{AI-0146 Type invariants (2009-09-21)}
27379 Type invariants may be specified for private types using the aspect notation.
27380 Aspect @cite{Type_Invariant} may be specified for any private type,
27381 @cite{Type_Invariant'Class} can
27382 only be specified for tagged types, and is inherited by any descendent of the
27383 tagged types. The invariant is a boolean expression that is tested for being
27384 true in the following situations: conversions to the private type, object
27385 declarations for the private type that are default initialized, and
27386 [@strong{in}] @strong{out}
27387 parameters and returned result on return from any primitive operation for
27388 the type that is visible to a client.
27389 GNAT defines the synonyms @cite{Invariant} for @cite{Type_Invariant} and
27390 @cite{Invariant'Class} for @cite{Type_Invariant'Class}.
27392 RM References:  13.03.03 (00)
27393 @end itemize
27395 @geindex AI-0078 (Ada 2012 feature)
27398 @itemize *
27400 @item 
27401 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
27403 In Ada 2012, compilers are required to support unchecked conversion where the
27404 target alignment is a multiple of the source alignment. GNAT always supported
27405 this case (and indeed all cases of differing alignments, doing copies where
27406 required if the alignment was reduced).
27408 RM References:  13.09 (7)
27409 @end itemize
27411 @geindex AI-0195 (Ada 2012 feature)
27414 @itemize *
27416 @item 
27417 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
27419 The handling of invalid values is now designated to be implementation
27420 defined. This is a documentation change only, requiring Annex M in the GNAT
27421 Reference Manual to document this handling.
27422 In GNAT, checks for invalid values are made
27423 only when necessary to avoid erroneous behavior. Operations like assignments
27424 which cannot cause erroneous behavior ignore the possibility of invalid
27425 values and do not do a check. The date given above applies only to the
27426 documentation change, this behavior has always been implemented by GNAT.
27428 RM References:  13.09.01 (10)
27429 @end itemize
27431 @geindex AI-0193 (Ada 2012 feature)
27434 @itemize *
27436 @item 
27437 @emph{AI-0193 Alignment of allocators (2010-09-16)}
27439 This AI introduces a new attribute @cite{Max_Alignment_For_Allocation},
27440 analogous to @cite{Max_Size_In_Storage_Elements}, but for alignment instead
27441 of size.
27443 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
27444 13.11.01 (2)   13.11.01 (3)
27445 @end itemize
27447 @geindex AI-0177 (Ada 2012 feature)
27450 @itemize *
27452 @item 
27453 @emph{AI-0177 Parameterized expressions (2010-07-10)}
27455 The new Ada 2012 notion of parameterized expressions is implemented. The form
27458 @example
27459 function-specification is (expression)
27460 @end example
27462 This is exactly equivalent to the
27463 corresponding function body that returns the expression, but it can appear
27464 in a package spec. Note that the expression must be parenthesized.
27466 RM References:  13.11.01 (3/2)
27467 @end itemize
27469 @geindex AI-0033 (Ada 2012 feature)
27472 @itemize *
27474 @item 
27475 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
27477 Neither of these two pragmas may appear within a generic template, because
27478 the generic might be instantiated at other than the library level.
27480 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
27481 @end itemize
27483 @geindex AI-0161 (Ada 2012 feature)
27486 @itemize *
27488 @item 
27489 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
27491 A new restriction @cite{No_Default_Stream_Attributes} prevents the use of any
27492 of the default stream attributes for elementary types. If this restriction is
27493 in force, then it is necessary to provide explicit subprograms for any
27494 stream attributes used.
27496 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
27497 @end itemize
27499 @geindex AI-0194 (Ada 2012 feature)
27502 @itemize *
27504 @item 
27505 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
27507 The @cite{Stream_Size} attribute returns the default number of bits in the
27508 stream representation of the given type.
27509 This value is not affected by the presence
27510 of stream subprogram attributes for the type. GNAT has always implemented
27511 this interpretation.
27513 RM References:  13.13.02 (1.2/2)
27514 @end itemize
27516 @geindex AI-0109 (Ada 2012 feature)
27519 @itemize *
27521 @item 
27522 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
27524 This AI is an editorial change only. It removes the need for a tag check
27525 that can never fail.
27527 RM References:  13.13.02 (34/2)
27528 @end itemize
27530 @geindex AI-0007 (Ada 2012 feature)
27533 @itemize *
27535 @item 
27536 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
27538 The RM as written appeared to limit the possibilities of declaring read
27539 attribute procedures for private scalar types. This limitation was not
27540 intended, and has never been enforced by GNAT.
27542 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
27543 @end itemize
27545 @geindex AI-0065 (Ada 2012 feature)
27548 @itemize *
27550 @item 
27551 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
27553 This AI clarifies the fact that all remote access types support external
27554 streaming. This fixes an obvious oversight in the definition of the
27555 language, and GNAT always implemented the intended correct rules.
27557 RM References:  13.13.02 (52/2)
27558 @end itemize
27560 @geindex AI-0019 (Ada 2012 feature)
27563 @itemize *
27565 @item 
27566 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
27568 The RM suggests that primitive subprograms of a specific tagged type are
27569 frozen when the tagged type is frozen. This would be an incompatible change
27570 and is not intended. GNAT has never attempted this kind of freezing and its
27571 behavior is consistent with the recommendation of this AI.
27573 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)
27574 @end itemize
27576 @geindex AI-0017 (Ada 2012 feature)
27579 @itemize *
27581 @item 
27582 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
27584 So-called 'Taft-amendment types' (i.e., types that are completed in package
27585 bodies) are not frozen by the occurrence of bodies in the
27586 enclosing declarative part. GNAT always implemented this properly.
27588 RM References:  13.14 (3/1)
27589 @end itemize
27591 @geindex AI-0060 (Ada 2012 feature)
27594 @itemize *
27596 @item 
27597 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
27599 This AI extends the definition of remote access types to include access
27600 to limited, synchronized, protected or task class-wide interface types.
27601 GNAT already implemented this extension.
27603 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
27604 @end itemize
27606 @geindex AI-0114 (Ada 2012 feature)
27609 @itemize *
27611 @item 
27612 @emph{AI-0114 Classification of letters (0000-00-00)}
27614 The code points 170 (@cite{FEMININE ORDINAL INDICATOR}),
27615 181 (@cite{MICRO SIGN}), and
27616 186 (@cite{MASCULINE ORDINAL INDICATOR}) are technically considered
27617 lower case letters by Unicode.
27618 However, they are not allowed in identifiers, and they
27619 return @cite{False} to @cite{Ada.Characters.Handling.Is_Letter/Is_Lower}.
27620 This behavior is consistent with that defined in Ada 95.
27622 RM References:  A.03.02 (59)   A.04.06 (7)
27623 @end itemize
27625 @geindex AI-0185 (Ada 2012 feature)
27628 @itemize *
27630 @item 
27631 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
27633 Two new packages @cite{Ada.Wide_[Wide_]Characters.Handling} provide
27634 classification functions for @cite{Wide_Character} and
27635 @cite{Wide_Wide_Character}, as well as providing
27636 case folding routines for @cite{Wide_[Wide_]Character} and
27637 @cite{Wide_[Wide_]String}.
27639 RM References:  A.03.05 (0)   A.03.06 (0)
27640 @end itemize
27642 @geindex AI-0031 (Ada 2012 feature)
27645 @itemize *
27647 @item 
27648 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
27650 A new version of @cite{Find_Token} is added to all relevant string packages,
27651 with an extra parameter @cite{From}. Instead of starting at the first
27652 character of the string, the search for a matching Token starts at the
27653 character indexed by the value of @cite{From}.
27654 These procedures are available in all versions of Ada
27655 but if used in versions earlier than Ada 2012 they will generate a warning
27656 that an Ada 2012 subprogram is being used.
27658 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
27659 A.04.05 (46)
27660 @end itemize
27662 @geindex AI-0056 (Ada 2012 feature)
27665 @itemize *
27667 @item 
27668 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
27670 The wording in the Ada 2005 RM implied an incompatible handling of the
27671 @cite{Index} functions, resulting in raising an exception instead of
27672 returning zero in some situations.
27673 This was not intended and has been corrected.
27674 GNAT always returned zero, and is thus consistent with this AI.
27676 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
27677 @end itemize
27679 @geindex AI-0137 (Ada 2012 feature)
27682 @itemize *
27684 @item 
27685 @emph{AI-0137 String encoding package (2010-03-25)}
27687 The packages @cite{Ada.Strings.UTF_Encoding}, together with its child
27688 packages, @cite{Conversions}, @cite{Strings}, @cite{Wide_Strings},
27689 and @cite{Wide_Wide_Strings} have been
27690 implemented. These packages (whose documentation can be found in the spec
27691 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
27692 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
27693 @cite{String}, @cite{Wide_String}, and @cite{Wide_Wide_String}
27694 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
27695 UTF-16), as well as conversions between the different UTF encodings. With
27696 the exception of @cite{Wide_Wide_Strings}, these packages are available in
27697 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
27698 The @cite{Wide_Wide_Strings package}
27699 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
27700 mode since it uses @cite{Wide_Wide_Character}).
27702 RM References:  A.04.11
27703 @end itemize
27705 @geindex AI-0038 (Ada 2012 feature)
27708 @itemize *
27710 @item 
27711 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
27713 These are minor errors in the description on three points. The intent on
27714 all these points has always been clear, and GNAT has always implemented the
27715 correct intended semantics.
27717 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)
27718 @end itemize
27720 @geindex AI-0044 (Ada 2012 feature)
27723 @itemize *
27725 @item 
27726 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
27728 This AI places restrictions on allowed instantiations of generic containers.
27729 These restrictions are not checked by the compiler, so there is nothing to
27730 change in the implementation. This affects only the RM documentation.
27732 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)
27733 @end itemize
27735 @geindex AI-0127 (Ada 2012 feature)
27738 @itemize *
27740 @item 
27741 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
27743 This package provides an interface for identifying the current locale.
27745 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
27746 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
27747 @end itemize
27749 @geindex AI-0002 (Ada 2012 feature)
27752 @itemize *
27754 @item 
27755 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
27757 The compiler is not required to support exporting an Ada subprogram with
27758 convention C if there are parameters or a return type of an unconstrained
27759 array type (such as @cite{String}). GNAT allows such declarations but
27760 generates warnings. It is possible, but complicated, to write the
27761 corresponding C code and certainly such code would be specific to GNAT and
27762 non-portable.
27764 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
27765 @end itemize
27767 @geindex AI05-0216 (Ada 2012 feature)
27770 @itemize *
27772 @item 
27773 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
27775 It is clearly the intention that @cite{No_Task_Hierarchy} is intended to
27776 forbid tasks declared locally within subprograms, or functions returning task
27777 objects, and that is the implementation that GNAT has always provided.
27778 However the language in the RM was not sufficiently clear on this point.
27779 Thus this is a documentation change in the RM only.
27781 RM References:  D.07 (3/3)
27782 @end itemize
27784 @geindex AI-0211 (Ada 2012 feature)
27787 @itemize *
27789 @item 
27790 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
27792 The restriction @cite{No_Relative_Delays} forbids any calls to the subprogram
27793 @cite{Ada.Real_Time.Timing_Events.Set_Handler}.
27795 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
27796 @end itemize
27798 @geindex AI-0190 (Ada 2012 feature)
27801 @itemize *
27803 @item 
27804 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
27806 This AI introduces a new pragma @cite{Default_Storage_Pool}, which can be
27807 used to control storage pools globally.
27808 In particular, you can force every access
27809 type that is used for allocation (@strong{new}) to have an explicit storage pool,
27810 or you can declare a pool globally to be used for all access types that lack
27811 an explicit one.
27813 RM References:  D.07 (8)
27814 @end itemize
27816 @geindex AI-0189 (Ada 2012 feature)
27819 @itemize *
27821 @item 
27822 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
27824 This AI introduces a new restriction @cite{No_Allocators_After_Elaboration},
27825 which says that no dynamic allocation will occur once elaboration is
27826 completed.
27827 In general this requires a run-time check, which is not required, and which
27828 GNAT does not attempt. But the static cases of allocators in a task body or
27829 in the body of the main program are detected and flagged at compile or bind
27830 time.
27832 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
27833 @end itemize
27835 @geindex AI-0171 (Ada 2012 feature)
27838 @itemize *
27840 @item 
27841 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
27843 A new package @cite{System.Multiprocessors} is added, together with the
27844 definition of pragma @cite{CPU} for controlling task affinity. A new no
27845 dependence restriction, on @cite{System.Multiprocessors.Dispatching_Domains},
27846 is added to the Ravenscar profile.
27848 RM References:  D.13.01 (4/2)   D.16
27849 @end itemize
27851 @geindex AI-0210 (Ada 2012 feature)
27854 @itemize *
27856 @item 
27857 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
27859 This is a documentation only issue regarding wording of metric requirements,
27860 that does not affect the implementation of the compiler.
27862 RM References:  D.15 (24/2)
27863 @end itemize
27865 @geindex AI-0206 (Ada 2012 feature)
27868 @itemize *
27870 @item 
27871 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
27873 Remote types packages are now allowed to depend on preelaborated packages.
27874 This was formerly considered illegal.
27876 RM References:  E.02.02 (6)
27877 @end itemize
27879 @geindex AI-0152 (Ada 2012 feature)
27882 @itemize *
27884 @item 
27885 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
27887 Restriction @cite{No_Anonymous_Allocators} prevents the use of allocators
27888 where the type of the returned value is an anonymous access type.
27890 RM References:  H.04 (8/1)
27891 @end itemize
27893 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
27894 @anchor{gnat_rm/obsolescent_features id1}@anchor{411}@anchor{gnat_rm/obsolescent_features doc}@anchor{412}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
27895 @chapter Obsolescent Features
27898 This chapter describes features that are provided by GNAT, but are
27899 considered obsolescent since there are preferred ways of achieving
27900 the same effect. These features are provided solely for historical
27901 compatibility purposes.
27903 @menu
27904 * pragma No_Run_Time:: 
27905 * pragma Ravenscar:: 
27906 * pragma Restricted_Run_Time:: 
27907 * pragma Task_Info:: 
27908 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
27910 @end menu
27912 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
27913 @anchor{gnat_rm/obsolescent_features id2}@anchor{413}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{414}
27914 @section pragma No_Run_Time
27917 The pragma @cite{No_Run_Time} is used to achieve an affect similar
27918 to the use of the "Zero Foot Print" configurable run time, but without
27919 requiring a specially configured run time. The result of using this
27920 pragma, which must be used for all units in a partition, is to restrict
27921 the use of any language features requiring run-time support code. The
27922 preferred usage is to use an appropriately configured run-time that
27923 includes just those features that are to be made accessible.
27925 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
27926 @anchor{gnat_rm/obsolescent_features id3}@anchor{415}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{416}
27927 @section pragma Ravenscar
27930 The pragma @cite{Ravenscar} has exactly the same effect as pragma
27931 @cite{Profile (Ravenscar)}. The latter usage is preferred since it
27932 is part of the new Ada 2005 standard.
27934 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
27935 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{417}@anchor{gnat_rm/obsolescent_features id4}@anchor{418}
27936 @section pragma Restricted_Run_Time
27939 The pragma @cite{Restricted_Run_Time} has exactly the same effect as
27940 pragma @cite{Profile (Restricted)}. The latter usage is
27941 preferred since the Ada 2005 pragma @cite{Profile} is intended for
27942 this kind of implementation dependent addition.
27944 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
27945 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{419}@anchor{gnat_rm/obsolescent_features id5}@anchor{41a}
27946 @section pragma Task_Info
27949 The functionality provided by pragma @cite{Task_Info} is now part of the
27950 Ada language. The @cite{CPU} aspect and the package
27951 @cite{System.Multiprocessors} offer a less system-dependent way to specify
27952 task affinity or to query the number of processsors.
27954 Syntax
27956 @example
27957 pragma Task_Info (EXPRESSION);
27958 @end example
27960 This pragma appears within a task definition (like pragma
27961 @cite{Priority}) and applies to the task in which it appears.  The
27962 argument must be of type @cite{System.Task_Info.Task_Info_Type}.
27963 The @cite{Task_Info} pragma provides system dependent control over
27964 aspects of tasking implementation, for example, the ability to map
27965 tasks to specific processors.  For details on the facilities available
27966 for the version of GNAT that you are using, see the documentation
27967 in the spec of package System.Task_Info in the runtime
27968 library.
27970 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
27971 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{41b}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{41c}
27972 @section package System.Task_Info (@code{s-tasinf.ads})
27975 This package provides target dependent functionality that is used
27976 to support the @cite{Task_Info} pragma. The predefined Ada package
27977 @cite{System.Multiprocessors} and the @cite{CPU} aspect now provide a
27978 standard replacement for GNAT's @cite{Task_Info} functionality.
27980 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
27981 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{41d}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{41e}
27982 @chapter Compatibility and Porting Guide
27985 This chapter presents some guidelines for developing portable Ada code,
27986 describes the compatibility issues that may arise between
27987 GNAT and other Ada compilation systems (including those for Ada 83),
27988 and shows how GNAT can expedite porting
27989 applications developed in other Ada environments.
27991 @menu
27992 * Writing Portable Fixed-Point Declarations:: 
27993 * Compatibility with Ada 83:: 
27994 * Compatibility between Ada 95 and Ada 2005:: 
27995 * Implementation-dependent characteristics:: 
27996 * Compatibility with Other Ada Systems:: 
27997 * Representation Clauses:: 
27998 * Compatibility with HP Ada 83:: 
28000 @end menu
28002 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
28003 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{41f}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{420}
28004 @section Writing Portable Fixed-Point Declarations
28007 The Ada Reference Manual gives an implementation freedom to choose bounds
28008 that are narrower by @cite{Small} from the given bounds.
28009 For example, if we write
28011 @example
28012 type F1 is delta 1.0 range -128.0 .. +128.0;
28013 @end example
28015 then the implementation is allowed to choose -128.0 .. +127.0 if it
28016 likes, but is not required to do so.
28018 This leads to possible portability problems, so let's have a closer
28019 look at this, and figure out how to avoid these problems.
28021 First, why does this freedom exist, and why would an implementation
28022 take advantage of it? To answer this, take a closer look at the type
28023 declaration for @cite{F1} above. If the compiler uses the given bounds,
28024 it would need 9 bits to hold the largest positive value (and typically
28025 that means 16 bits on all machines). But if the implementation chooses
28026 the +127.0 bound then it can fit values of the type in 8 bits.
28028 Why not make the user write +127.0 if that's what is wanted?
28029 The rationale is that if you are thinking of fixed point
28030 as a kind of 'poor man's floating-point', then you don't want
28031 to be thinking about the scaled integers that are used in its
28032 representation. Let's take another example:
28034 @example
28035 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
28036 @end example
28038 Looking at this declaration, it seems casually as though
28039 it should fit in 16 bits, but again that extra positive value
28040 +1.0 has the scaled integer equivalent of 2**15 which is one too
28041 big for signed 16 bits. The implementation can treat this as:
28043 @example
28044 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
28045 @end example
28047 and the Ada language design team felt that this was too annoying
28048 to require. We don't need to debate this decision at this point,
28049 since it is well established (the rule about narrowing the ranges
28050 dates to Ada 83).
28052 But the important point is that an implementation is not required
28053 to do this narrowing, so we have a potential portability problem.
28054 We could imagine three types of implementation:
28057 @enumerate a
28059 @item 
28060 those that narrow the range automatically if they can figure
28061 out that the narrower range will allow storage in a smaller machine unit,
28063 @item 
28064 those that will narrow only if forced to by a @cite{'Size} clause, and
28066 @item 
28067 those that will never narrow.
28068 @end enumerate
28070 Now if we are language theoreticians, we can imagine a fourth
28071 approach: to narrow all the time, e.g. to treat
28073 @example
28074 type F3 is delta 1.0 range -10.0 .. +23.0;
28075 @end example
28077 as though it had been written:
28079 @example
28080 type F3 is delta 1.0 range -9.0 .. +22.0;
28081 @end example
28083 But although technically allowed, such a behavior would be hostile and silly,
28084 and no real compiler would do this. All real compilers will fall into one of
28085 the categories (a), (b) or (c) above.
28087 So, how do you get the compiler to do what you want? The answer is give the
28088 actual bounds you want, and then use a @cite{'Small} clause and a
28089 @cite{'Size} clause to absolutely pin down what the compiler does.
28090 E.g., for @cite{F2} above, we will write:
28092 @example
28093 My_Small : constant := 2.0**(-15);
28094 My_First : constant := -1.0;
28095 My_Last  : constant := +1.0 - My_Small;
28097 type F2 is delta My_Small range My_First .. My_Last;
28098 @end example
28100 and then add
28102 @example
28103 for F2'Small use my_Small;
28104 for F2'Size  use 16;
28105 @end example
28107 In practice all compilers will do the same thing here and will give you
28108 what you want, so the above declarations are fully portable. If you really
28109 want to play language lawyer and guard against ludicrous behavior by the
28110 compiler you could add
28112 @example
28113 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28114 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
28115 @end example
28117 One or other or both are allowed to be illegal if the compiler is
28118 behaving in a silly manner, but at least the silly compiler will not
28119 get away with silently messing with your (very clear) intentions.
28121 If you follow this scheme you will be guaranteed that your fixed-point
28122 types will be portable.
28124 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
28125 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{421}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{422}
28126 @section Compatibility with Ada 83
28129 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
28131 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
28132 are highly upwards compatible with Ada 83.  In
28133 particular, the design intention was that the difficulties associated
28134 with moving from Ada 83 to later versions of the standard should be no greater
28135 than those that occur when moving from one Ada 83 system to another.
28137 However, there are a number of points at which there are minor
28138 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
28139 full details of these issues as they relate to Ada 95,
28140 and should be consulted for a complete treatment.
28141 In practice the
28142 following subsections treat the most likely issues to be encountered.
28144 @menu
28145 * Legal Ada 83 programs that are illegal in Ada 95:: 
28146 * More deterministic semantics:: 
28147 * Changed semantics:: 
28148 * Other language compatibility issues:: 
28150 @end menu
28152 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
28153 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{423}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{424}
28154 @subsection Legal Ada 83 programs that are illegal in Ada 95
28157 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
28158 Ada 95 and later versions of the standard:
28161 @itemize *
28163 @item 
28164 @emph{Character literals}
28166 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
28167 @cite{Wide_Character} as a new predefined character type, some uses of
28168 character literals that were legal in Ada 83 are illegal in Ada 95.
28169 For example:
28171 @example
28172 for Char in 'A' .. 'Z' loop ... end loop;
28173 @end example
28175 The problem is that 'A' and 'Z' could be from either
28176 @cite{Character} or @cite{Wide_Character}.  The simplest correction
28177 is to make the type explicit; e.g.:
28179 @example
28180 for Char in Character range 'A' .. 'Z' loop ... end loop;
28181 @end example
28183 @item 
28184 @emph{New reserved words}
28186 The identifiers @cite{abstract}, @cite{aliased}, @cite{protected},
28187 @cite{requeue}, @cite{tagged}, and @cite{until} are reserved in Ada 95.
28188 Existing Ada 83 code using any of these identifiers must be edited to
28189 use some alternative name.
28191 @item 
28192 @emph{Freezing rules}
28194 The rules in Ada 95 are slightly different with regard to the point at
28195 which entities are frozen, and representation pragmas and clauses are
28196 not permitted past the freeze point.  This shows up most typically in
28197 the form of an error message complaining that a representation item
28198 appears too late, and the appropriate corrective action is to move
28199 the item nearer to the declaration of the entity to which it refers.
28201 A particular case is that representation pragmas
28202 cannot be applied to a subprogram body.  If necessary, a separate subprogram
28203 declaration must be introduced to which the pragma can be applied.
28205 @item 
28206 @emph{Optional bodies for library packages}
28208 In Ada 83, a package that did not require a package body was nevertheless
28209 allowed to have one.  This lead to certain surprises in compiling large
28210 systems (situations in which the body could be unexpectedly ignored by the
28211 binder).  In Ada 95, if a package does not require a body then it is not
28212 permitted to have a body.  To fix this problem, simply remove a redundant
28213 body if it is empty, or, if it is non-empty, introduce a dummy declaration
28214 into the spec that makes the body required.  One approach is to add a private
28215 part to the package declaration (if necessary), and define a parameterless
28216 procedure called @cite{Requires_Body}, which must then be given a dummy
28217 procedure body in the package body, which then becomes required.
28218 Another approach (assuming that this does not introduce elaboration
28219 circularities) is to add an @cite{Elaborate_Body} pragma to the package spec,
28220 since one effect of this pragma is to require the presence of a package body.
28222 @item 
28223 @emph{Numeric_Error is the same exception as Constraint_Error}
28225 In Ada 95, the exception @cite{Numeric_Error} is a renaming of @cite{Constraint_Error}.
28226 This means that it is illegal to have separate exception handlers for
28227 the two exceptions.  The fix is simply to remove the handler for the
28228 @cite{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
28229 @cite{Constraint_Error} in place of @cite{Numeric_Error} in all cases).
28231 @item 
28232 @emph{Indefinite subtypes in generics}
28234 In Ada 83, it was permissible to pass an indefinite type (e.g, @cite{String})
28235 as the actual for a generic formal private type, but then the instantiation
28236 would be illegal if there were any instances of declarations of variables
28237 of this type in the generic body.  In Ada 95, to avoid this clear violation
28238 of the methodological principle known as the 'contract model',
28239 the generic declaration explicitly indicates whether
28240 or not such instantiations are permitted.  If a generic formal parameter
28241 has explicit unknown discriminants, indicated by using @cite{(<>)} after the
28242 subtype name, then it can be instantiated with indefinite types, but no
28243 stand-alone variables can be declared of this type.  Any attempt to declare
28244 such a variable will result in an illegality at the time the generic is
28245 declared.  If the @cite{(<>)} notation is not used, then it is illegal
28246 to instantiate the generic with an indefinite type.
28247 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
28248 It will show up as a compile time error, and
28249 the fix is usually simply to add the @cite{(<>)} to the generic declaration.
28250 @end itemize
28252 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
28253 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{425}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{426}
28254 @subsection More deterministic semantics
28258 @itemize *
28260 @item 
28261 @emph{Conversions}
28263 Conversions from real types to integer types round away from 0.  In Ada 83
28264 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
28265 implementation freedom was intended to support unbiased rounding in
28266 statistical applications, but in practice it interfered with portability.
28267 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
28268 is required.  Numeric code may be affected by this change in semantics.
28269 Note, though, that this issue is no worse than already existed in Ada 83
28270 when porting code from one vendor to another.
28272 @item 
28273 @emph{Tasking}
28275 The Real-Time Annex introduces a set of policies that define the behavior of
28276 features that were implementation dependent in Ada 83, such as the order in
28277 which open select branches are executed.
28278 @end itemize
28280 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
28281 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{427}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{428}
28282 @subsection Changed semantics
28285 The worst kind of incompatibility is one where a program that is legal in
28286 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
28287 possible in Ada 83.  Fortunately this is extremely rare, but the one
28288 situation that you should be alert to is the change in the predefined type
28289 @cite{Character} from 7-bit ASCII to 8-bit Latin-1.
28291 @quotation
28293 @geindex Latin-1
28294 @end quotation
28297 @itemize *
28299 @item 
28300 @emph{Range of type `Character`}
28302 The range of @cite{Standard.Character} is now the full 256 characters
28303 of Latin-1, whereas in most Ada 83 implementations it was restricted
28304 to 128 characters. Although some of the effects of
28305 this change will be manifest in compile-time rejection of legal
28306 Ada 83 programs it is possible for a working Ada 83 program to have
28307 a different effect in Ada 95, one that was not permitted in Ada 83.
28308 As an example, the expression
28309 @cite{Character'Pos(Character'Last)} returned @cite{127} in Ada 83 and now
28310 delivers @cite{255} as its value.
28311 In general, you should look at the logic of any
28312 character-processing Ada 83 program and see whether it needs to be adapted
28313 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
28314 character handling package that may be relevant if code needs to be adapted
28315 to account for the additional Latin-1 elements.
28316 The desirable fix is to
28317 modify the program to accommodate the full character set, but in some cases
28318 it may be convenient to define a subtype or derived type of Character that
28319 covers only the restricted range.
28320 @end itemize
28322 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
28323 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{429}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{42a}
28324 @subsection Other language compatibility issues
28328 @itemize *
28330 @item 
28331 @emph{-gnat83} switch
28333 All implementations of GNAT provide a switch that causes GNAT to operate
28334 in Ada 83 mode.  In this mode, some but not all compatibility problems
28335 of the type described above are handled automatically.  For example, the
28336 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
28337 as identifiers as in Ada 83.  However,
28338 in practice, it is usually advisable to make the necessary modifications
28339 to the program to remove the need for using this switch.
28340 See the @cite{Compiling Different Versions of Ada} section in
28341 the @cite{GNAT User's Guide}.
28343 @item 
28344 Support for removed Ada 83 pragmas and attributes
28346 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
28347 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
28348 compilers are allowed, but not required, to implement these missing
28349 elements.  In contrast with some other compilers, GNAT implements all
28350 such pragmas and attributes, eliminating this compatibility concern.  These
28351 include @cite{pragma Interface} and the floating point type attributes
28352 (@cite{Emax}, @cite{Mantissa}, etc.), among other items.
28353 @end itemize
28355 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
28356 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{42b}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{42c}
28357 @section Compatibility between Ada 95 and Ada 2005
28360 @geindex Compatibility between Ada 95 and Ada 2005
28362 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
28363 a number of incompatibilities. Several are enumerated below;
28364 for a complete description please see the
28365 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
28366 @cite{Rationale for Ada 2005}.
28369 @itemize *
28371 @item 
28372 @emph{New reserved words.}
28374 The words @cite{interface}, @cite{overriding} and @cite{synchronized} are
28375 reserved in Ada 2005.
28376 A pre-Ada 2005 program that uses any of these as an identifier will be
28377 illegal.
28379 @item 
28380 @emph{New declarations in predefined packages.}
28382 A number of packages in the predefined environment contain new declarations:
28383 @cite{Ada.Exceptions}, @cite{Ada.Real_Time}, @cite{Ada.Strings},
28384 @cite{Ada.Strings.Fixed}, @cite{Ada.Strings.Bounded},
28385 @cite{Ada.Strings.Unbounded}, @cite{Ada.Strings.Wide_Fixed},
28386 @cite{Ada.Strings.Wide_Bounded}, @cite{Ada.Strings.Wide_Unbounded},
28387 @cite{Ada.Tags}, @cite{Ada.Text_IO}, and @cite{Interfaces.C}.
28388 If an Ada 95 program does a @cite{with} and @cite{use} of any of these
28389 packages, the new declarations may cause name clashes.
28391 @item 
28392 @emph{Access parameters.}
28394 A nondispatching subprogram with an access parameter cannot be renamed
28395 as a dispatching operation.  This was permitted in Ada 95.
28397 @item 
28398 @emph{Access types, discriminants, and constraints.}
28400 Rule changes in this area have led to some incompatibilities; for example,
28401 constrained subtypes of some access types are not permitted in Ada 2005.
28403 @item 
28404 @emph{Aggregates for limited types.}
28406 The allowance of aggregates for limited types in Ada 2005 raises the
28407 possibility of ambiguities in legal Ada 95 programs, since additional types
28408 now need to be considered in expression resolution.
28410 @item 
28411 @emph{Fixed-point multiplication and division.}
28413 Certain expressions involving '*' or '/' for a fixed-point type, which
28414 were legal in Ada 95 and invoked the predefined versions of these operations,
28415 are now ambiguous.
28416 The ambiguity may be resolved either by applying a type conversion to the
28417 expression, or by explicitly invoking the operation from package
28418 @cite{Standard}.
28420 @item 
28421 @emph{Return-by-reference types.}
28423 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
28424 can declare a function returning a value from an anonymous access type.
28425 @end itemize
28427 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
28428 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{42d}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{42e}
28429 @section Implementation-dependent characteristics
28432 Although the Ada language defines the semantics of each construct as
28433 precisely as practical, in some situations (for example for reasons of
28434 efficiency, or where the effect is heavily dependent on the host or target
28435 platform) the implementation is allowed some freedom.  In porting Ada 83
28436 code to GNAT, you need to be aware of whether / how the existing code
28437 exercised such implementation dependencies.  Such characteristics fall into
28438 several categories, and GNAT offers specific support in assisting the
28439 transition from certain Ada 83 compilers.
28441 @menu
28442 * Implementation-defined pragmas:: 
28443 * Implementation-defined attributes:: 
28444 * Libraries:: 
28445 * Elaboration order:: 
28446 * Target-specific aspects:: 
28448 @end menu
28450 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
28451 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{42f}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{430}
28452 @subsection Implementation-defined pragmas
28455 Ada compilers are allowed to supplement the language-defined pragmas, and
28456 these are a potential source of non-portability.  All GNAT-defined pragmas
28457 are described in the @cite{Implementation Defined Pragmas} chapter of the
28458 @cite{GNAT Reference Manual}, and these include several that are specifically
28459 intended to correspond to other vendors' Ada 83 pragmas.
28460 For migrating from VADS, the pragma @cite{Use_VADS_Size} may be useful.
28461 For compatibility with HP Ada 83, GNAT supplies the pragmas
28462 @cite{Extend_System}, @cite{Ident}, @cite{Inline_Generic},
28463 @cite{Interface_Name}, @cite{Passive}, @cite{Suppress_All},
28464 and @cite{Volatile}.
28465 Other relevant pragmas include @cite{External} and @cite{Link_With}.
28466 Some vendor-specific
28467 Ada 83 pragmas (@cite{Share_Generic}, @cite{Subtitle}, and @cite{Title}) are
28468 recognized, thus
28469 avoiding compiler rejection of units that contain such pragmas; they are not
28470 relevant in a GNAT context and hence are not otherwise implemented.
28472 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
28473 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{431}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{432}
28474 @subsection Implementation-defined attributes
28477 Analogous to pragmas, the set of attributes may be extended by an
28478 implementation.  All GNAT-defined attributes are described in
28479 @cite{Implementation Defined Attributes} section of the
28480 @cite{GNAT Reference Manual}, and these include several that are specifically intended
28481 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
28482 the attribute @cite{VADS_Size} may be useful.  For compatibility with HP
28483 Ada 83, GNAT supplies the attributes @cite{Bit}, @cite{Machine_Size} and
28484 @cite{Type_Class}.
28486 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
28487 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{433}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{434}
28488 @subsection Libraries
28491 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
28492 code uses vendor-specific libraries then there are several ways to manage
28493 this in Ada 95 and later versions of the standard:
28496 @itemize *
28498 @item 
28499 If the source code for the libraries (specs and bodies) are
28500 available, then the libraries can be migrated in the same way as the
28501 application.
28503 @item 
28504 If the source code for the specs but not the bodies are
28505 available, then you can reimplement the bodies.
28507 @item 
28508 Some features introduced by Ada 95 obviate the need for library support.  For
28509 example most Ada 83 vendors supplied a package for unsigned integers.  The
28510 Ada 95 modular type feature is the preferred way to handle this need, so
28511 instead of migrating or reimplementing the unsigned integer package it may
28512 be preferable to retrofit the application using modular types.
28513 @end itemize
28515 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
28516 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{435}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{436}
28517 @subsection Elaboration order
28520 The implementation can choose any elaboration order consistent with the unit
28521 dependency relationship.  This freedom means that some orders can result in
28522 Program_Error being raised due to an 'Access Before Elaboration': an attempt
28523 to invoke a subprogram before its body has been elaborated, or to instantiate
28524 a generic before the generic body has been elaborated.  By default GNAT
28525 attempts to choose a safe order (one that will not encounter access before
28526 elaboration problems) by implicitly inserting @cite{Elaborate} or
28527 @cite{Elaborate_All} pragmas where
28528 needed.  However, this can lead to the creation of elaboration circularities
28529 and a resulting rejection of the program by gnatbind.  This issue is
28530 thoroughly described in the @cite{Elaboration Order Handling in GNAT} appendix
28531 in the @cite{GNAT User's Guide}.
28532 In brief, there are several
28533 ways to deal with this situation:
28536 @itemize *
28538 @item 
28539 Modify the program to eliminate the circularities, e.g., by moving
28540 elaboration-time code into explicitly-invoked procedures
28542 @item 
28543 Constrain the elaboration order by including explicit @cite{Elaborate_Body} or
28544 @cite{Elaborate} pragmas, and then inhibit the generation of implicit
28545 @cite{Elaborate_All}
28546 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
28547 (by selectively suppressing elaboration checks via pragma
28548 @cite{Suppress(Elaboration_Check)} when it is safe to do so).
28549 @end itemize
28551 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
28552 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{437}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{438}
28553 @subsection Target-specific aspects
28556 Low-level applications need to deal with machine addresses, data
28557 representations, interfacing with assembler code, and similar issues.  If
28558 such an Ada 83 application is being ported to different target hardware (for
28559 example where the byte endianness has changed) then you will need to
28560 carefully examine the program logic; the porting effort will heavily depend
28561 on the robustness of the original design.  Moreover, Ada 95 (and thus
28562 Ada 2005 and Ada 2012) are sometimes
28563 incompatible with typical Ada 83 compiler practices regarding implicit
28564 packing, the meaning of the Size attribute, and the size of access values.
28565 GNAT's approach to these issues is described in @ref{439,,Representation Clauses}.
28567 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
28568 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{43a}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{43b}
28569 @section Compatibility with Other Ada Systems
28572 If programs avoid the use of implementation dependent and
28573 implementation defined features, as documented in the
28574 @cite{Ada Reference Manual}, there should be a high degree of portability between
28575 GNAT and other Ada systems.  The following are specific items which
28576 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
28577 compilers, but do not affect porting code to GNAT.
28578 (As of January 2007, GNAT is the only compiler available for Ada 2005;
28579 the following issues may or may not arise for Ada 2005 programs
28580 when other compilers appear.)
28583 @itemize *
28585 @item 
28586 @emph{Ada 83 Pragmas and Attributes}
28588 Ada 95 compilers are allowed, but not required, to implement the missing
28589 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
28590 GNAT implements all such pragmas and attributes, eliminating this as
28591 a compatibility concern, but some other Ada 95 compilers reject these
28592 pragmas and attributes.
28594 @item 
28595 @emph{Specialized Needs Annexes}
28597 GNAT implements the full set of special needs annexes.  At the
28598 current time, it is the only Ada 95 compiler to do so.  This means that
28599 programs making use of these features may not be portable to other Ada
28600 95 compilation systems.
28602 @item 
28603 @emph{Representation Clauses}
28605 Some other Ada 95 compilers implement only the minimal set of
28606 representation clauses required by the Ada 95 reference manual.  GNAT goes
28607 far beyond this minimal set, as described in the next section.
28608 @end itemize
28610 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
28611 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{439}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{43c}
28612 @section Representation Clauses
28615 The Ada 83 reference manual was quite vague in describing both the minimal
28616 required implementation of representation clauses, and also their precise
28617 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
28618 minimal set of capabilities required is still quite limited.
28620 GNAT implements the full required set of capabilities in
28621 Ada 95 and Ada 2005, but also goes much further, and in particular
28622 an effort has been made to be compatible with existing Ada 83 usage to the
28623 greatest extent possible.
28625 A few cases exist in which Ada 83 compiler behavior is incompatible with
28626 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
28627 intentional or accidental dependence on specific implementation dependent
28628 characteristics of these Ada 83 compilers.  The following is a list of
28629 the cases most likely to arise in existing Ada 83 code.
28632 @itemize *
28634 @item 
28635 @emph{Implicit Packing}
28637 Some Ada 83 compilers allowed a Size specification to cause implicit
28638 packing of an array or record.  This could cause expensive implicit
28639 conversions for change of representation in the presence of derived
28640 types, and the Ada design intends to avoid this possibility.
28641 Subsequent AI's were issued to make it clear that such implicit
28642 change of representation in response to a Size clause is inadvisable,
28643 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
28644 Reference Manuals as implementation advice that is followed by GNAT.
28645 The problem will show up as an error
28646 message rejecting the size clause.  The fix is simply to provide
28647 the explicit pragma @cite{Pack}, or for more fine tuned control, provide
28648 a Component_Size clause.
28650 @item 
28651 @emph{Meaning of Size Attribute}
28653 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
28654 the minimal number of bits required to hold values of the type.  For example,
28655 on a 32-bit machine, the size of @cite{Natural} will typically be 31 and not
28656 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
28657 some 32 in this situation.  This problem will usually show up as a compile
28658 time error, but not always.  It is a good idea to check all uses of the
28659 'Size attribute when porting Ada 83 code.  The GNAT specific attribute
28660 Object_Size can provide a useful way of duplicating the behavior of
28661 some Ada 83 compiler systems.
28663 @item 
28664 @emph{Size of Access Types}
28666 A common assumption in Ada 83 code is that an access type is in fact a pointer,
28667 and that therefore it will be the same size as a System.Address value.  This
28668 assumption is true for GNAT in most cases with one exception.  For the case of
28669 a pointer to an unconstrained array type (where the bounds may vary from one
28670 value of the access type to another), the default is to use a 'fat pointer',
28671 which is represented as two separate pointers, one to the bounds, and one to
28672 the array.  This representation has a number of advantages, including improved
28673 efficiency.  However, it may cause some difficulties in porting existing Ada 83
28674 code which makes the assumption that, for example, pointers fit in 32 bits on
28675 a machine with 32-bit addressing.
28677 To get around this problem, GNAT also permits the use of 'thin pointers' for
28678 access types in this case (where the designated type is an unconstrained array
28679 type).  These thin pointers are indeed the same size as a System.Address value.
28680 To specify a thin pointer, use a size clause for the type, for example:
28682 @example
28683 type X is access all String;
28684 for X'Size use Standard'Address_Size;
28685 @end example
28687 which will cause the type X to be represented using a single pointer.
28688 When using this representation, the bounds are right behind the array.
28689 This representation is slightly less efficient, and does not allow quite
28690 such flexibility in the use of foreign pointers or in using the
28691 Unrestricted_Access attribute to create pointers to non-aliased objects.
28692 But for any standard portable use of the access type it will work in
28693 a functionally correct manner and allow porting of existing code.
28694 Note that another way of forcing a thin pointer representation
28695 is to use a component size clause for the element size in an array,
28696 or a record representation clause for an access field in a record.
28698 See the documentation of Unrestricted_Access in the GNAT RM for a
28699 full discussion of possible problems using this attribute in conjunction
28700 with thin pointers.
28701 @end itemize
28703 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
28704 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{43d}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{43e}
28705 @section Compatibility with HP Ada 83
28708 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
28709 of them can sensibly be implemented.  The description of pragmas in
28710 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
28711 applicable to GNAT.
28714 @itemize *
28716 @item 
28717 @emph{Default floating-point representation}
28719 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
28720 it is VMS format.
28722 @item 
28723 @emph{System}
28725 the package System in GNAT exactly corresponds to the definition in the
28726 Ada 95 reference manual, which means that it excludes many of the
28727 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
28728 that contains the additional definitions, and a special pragma,
28729 Extend_System allows this package to be treated transparently as an
28730 extension of package System.
28731 @end itemize
28733 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
28734 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{43f}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{440}
28735 @chapter GNU Free Documentation License
28738 Version 1.3, 3 November 2008
28740 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
28741 @indicateurl{http://fsf.org/}
28743 Everyone is permitted to copy and distribute verbatim copies of this
28744 license document, but changing it is not allowed.
28746 @strong{Preamble}
28748 The purpose of this License is to make a manual, textbook, or other
28749 functional and useful document "free" in the sense of freedom: to
28750 assure everyone the effective freedom to copy and redistribute it,
28751 with or without modifying it, either commercially or noncommercially.
28752 Secondarily, this License preserves for the author and publisher a way
28753 to get credit for their work, while not being considered responsible
28754 for modifications made by others.
28756 This License is a kind of "copyleft", which means that derivative
28757 works of the document must themselves be free in the same sense.  It
28758 complements the GNU General Public License, which is a copyleft
28759 license designed for free software.
28761 We have designed this License in order to use it for manuals for free
28762 software, because free software needs free documentation: a free
28763 program should come with manuals providing the same freedoms that the
28764 software does.  But this License is not limited to software manuals;
28765 it can be used for any textual work, regardless of subject matter or
28766 whether it is published as a printed book.  We recommend this License
28767 principally for works whose purpose is instruction or reference.
28769 @strong{1. APPLICABILITY AND DEFINITIONS}
28771 This License applies to any manual or other work, in any medium, that
28772 contains a notice placed by the copyright holder saying it can be
28773 distributed under the terms of this License.  Such a notice grants a
28774 world-wide, royalty-free license, unlimited in duration, to use that
28775 work under the conditions stated herein.  The @strong{Document}, below,
28776 refers to any such manual or work.  Any member of the public is a
28777 licensee, and is addressed as "@strong{you}".  You accept the license if you
28778 copy, modify or distribute the work in a way requiring permission
28779 under copyright law.
28781 A "@strong{Modified Version}" of the Document means any work containing the
28782 Document or a portion of it, either copied verbatim, or with
28783 modifications and/or translated into another language.
28785 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
28786 the Document that deals exclusively with the relationship of the
28787 publishers or authors of the Document to the Document's overall subject
28788 (or to related matters) and contains nothing that could fall directly
28789 within that overall subject.  (Thus, if the Document is in part a
28790 textbook of mathematics, a Secondary Section may not explain any
28791 mathematics.)  The relationship could be a matter of historical
28792 connection with the subject or with related matters, or of legal,
28793 commercial, philosophical, ethical or political position regarding
28794 them.
28796 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
28797 are designated, as being those of Invariant Sections, in the notice
28798 that says that the Document is released under this License.  If a
28799 section does not fit the above definition of Secondary then it is not
28800 allowed to be designated as Invariant.  The Document may contain zero
28801 Invariant Sections.  If the Document does not identify any Invariant
28802 Sections then there are none.
28804 The "@strong{Cover Texts}" are certain short passages of text that are listed,
28805 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
28806 the Document is released under this License.  A Front-Cover Text may
28807 be at most 5 words, and a Back-Cover Text may be at most 25 words.
28809 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
28810 represented in a format whose specification is available to the
28811 general public, that is suitable for revising the document
28812 straightforwardly with generic text editors or (for images composed of
28813 pixels) generic paint programs or (for drawings) some widely available
28814 drawing editor, and that is suitable for input to text formatters or
28815 for automatic translation to a variety of formats suitable for input
28816 to text formatters.  A copy made in an otherwise Transparent file
28817 format whose markup, or absence of markup, has been arranged to thwart
28818 or discourage subsequent modification by readers is not Transparent.
28819 An image format is not Transparent if used for any substantial amount
28820 of text.  A copy that is not "Transparent" is called @strong{Opaque}.
28822 Examples of suitable formats for Transparent copies include plain
28823 ASCII without markup, Texinfo input format, LaTeX input format, SGML
28824 or XML using a publicly available DTD, and standard-conforming simple
28825 HTML, PostScript or PDF designed for human modification.  Examples of
28826 transparent image formats include PNG, XCF and JPG.  Opaque formats
28827 include proprietary formats that can be read and edited only by
28828 proprietary word processors, SGML or XML for which the DTD and/or
28829 processing tools are not generally available, and the
28830 machine-generated HTML, PostScript or PDF produced by some word
28831 processors for output purposes only.
28833 The "@strong{Title Page}" means, for a printed book, the title page itself,
28834 plus such following pages as are needed to hold, legibly, the material
28835 this License requires to appear in the title page.  For works in
28836 formats which do not have any title page as such, "Title Page" means
28837 the text near the most prominent appearance of the work's title,
28838 preceding the beginning of the body of the text.
28840 The "@strong{publisher}" means any person or entity that distributes
28841 copies of the Document to the public.
28843 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
28844 title either is precisely XYZ or contains XYZ in parentheses following
28845 text that translates XYZ in another language.  (Here XYZ stands for a
28846 specific section name mentioned below, such as "@strong{Acknowledgements}",
28847 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
28848 To "@strong{Preserve the Title}"
28849 of such a section when you modify the Document means that it remains a
28850 section "Entitled XYZ" according to this definition.
28852 The Document may include Warranty Disclaimers next to the notice which
28853 states that this License applies to the Document.  These Warranty
28854 Disclaimers are considered to be included by reference in this
28855 License, but only as regards disclaiming warranties: any other
28856 implication that these Warranty Disclaimers may have is void and has
28857 no effect on the meaning of this License.
28859 @strong{2. VERBATIM COPYING}
28861 You may copy and distribute the Document in any medium, either
28862 commercially or noncommercially, provided that this License, the
28863 copyright notices, and the license notice saying this License applies
28864 to the Document are reproduced in all copies, and that you add no other
28865 conditions whatsoever to those of this License.  You may not use
28866 technical measures to obstruct or control the reading or further
28867 copying of the copies you make or distribute.  However, you may accept
28868 compensation in exchange for copies.  If you distribute a large enough
28869 number of copies you must also follow the conditions in section 3.
28871 You may also lend copies, under the same conditions stated above, and
28872 you may publicly display copies.
28874 @strong{3. COPYING IN QUANTITY}
28876 If you publish printed copies (or copies in media that commonly have
28877 printed covers) of the Document, numbering more than 100, and the
28878 Document's license notice requires Cover Texts, you must enclose the
28879 copies in covers that carry, clearly and legibly, all these Cover
28880 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
28881 the back cover.  Both covers must also clearly and legibly identify
28882 you as the publisher of these copies.  The front cover must present
28883 the full title with all words of the title equally prominent and
28884 visible.  You may add other material on the covers in addition.
28885 Copying with changes limited to the covers, as long as they preserve
28886 the title of the Document and satisfy these conditions, can be treated
28887 as verbatim copying in other respects.
28889 If the required texts for either cover are too voluminous to fit
28890 legibly, you should put the first ones listed (as many as fit
28891 reasonably) on the actual cover, and continue the rest onto adjacent
28892 pages.
28894 If you publish or distribute Opaque copies of the Document numbering
28895 more than 100, you must either include a machine-readable Transparent
28896 copy along with each Opaque copy, or state in or with each Opaque copy
28897 a computer-network location from which the general network-using
28898 public has access to download using public-standard network protocols
28899 a complete Transparent copy of the Document, free of added material.
28900 If you use the latter option, you must take reasonably prudent steps,
28901 when you begin distribution of Opaque copies in quantity, to ensure
28902 that this Transparent copy will remain thus accessible at the stated
28903 location until at least one year after the last time you distribute an
28904 Opaque copy (directly or through your agents or retailers) of that
28905 edition to the public.
28907 It is requested, but not required, that you contact the authors of the
28908 Document well before redistributing any large number of copies, to give
28909 them a chance to provide you with an updated version of the Document.
28911 @strong{4. MODIFICATIONS}
28913 You may copy and distribute a Modified Version of the Document under
28914 the conditions of sections 2 and 3 above, provided that you release
28915 the Modified Version under precisely this License, with the Modified
28916 Version filling the role of the Document, thus licensing distribution
28917 and modification of the Modified Version to whoever possesses a copy
28918 of it.  In addition, you must do these things in the Modified Version:
28921 @enumerate A
28923 @item 
28924 Use in the Title Page (and on the covers, if any) a title distinct
28925 from that of the Document, and from those of previous versions
28926 (which should, if there were any, be listed in the History section
28927 of the Document).  You may use the same title as a previous version
28928 if the original publisher of that version gives permission.
28930 @item 
28931 List on the Title Page, as authors, one or more persons or entities
28932 responsible for authorship of the modifications in the Modified
28933 Version, together with at least five of the principal authors of the
28934 Document (all of its principal authors, if it has fewer than five),
28935 unless they release you from this requirement.
28937 @item 
28938 State on the Title page the name of the publisher of the
28939 Modified Version, as the publisher.
28941 @item 
28942 Preserve all the copyright notices of the Document.
28944 @item 
28945 Add an appropriate copyright notice for your modifications
28946 adjacent to the other copyright notices.
28948 @item 
28949 Include, immediately after the copyright notices, a license notice
28950 giving the public permission to use the Modified Version under the
28951 terms of this License, in the form shown in the Addendum below.
28953 @item 
28954 Preserve in that license notice the full lists of Invariant Sections
28955 and required Cover Texts given in the Document's license notice.
28957 @item 
28958 Include an unaltered copy of this License.
28960 @item 
28961 Preserve the section Entitled "History", Preserve its Title, and add
28962 to it an item stating at least the title, year, new authors, and
28963 publisher of the Modified Version as given on the Title Page.  If
28964 there is no section Entitled "History" in the Document, create one
28965 stating the title, year, authors, and publisher of the Document as
28966 given on its Title Page, then add an item describing the Modified
28967 Version as stated in the previous sentence.
28969 @item 
28970 Preserve the network location, if any, given in the Document for
28971 public access to a Transparent copy of the Document, and likewise
28972 the network locations given in the Document for previous versions
28973 it was based on.  These may be placed in the "History" section.
28974 You may omit a network location for a work that was published at
28975 least four years before the Document itself, or if the original
28976 publisher of the version it refers to gives permission.
28978 @item 
28979 For any section Entitled "Acknowledgements" or "Dedications",
28980 Preserve the Title of the section, and preserve in the section all
28981 the substance and tone of each of the contributor acknowledgements
28982 and/or dedications given therein.
28984 @item 
28985 Preserve all the Invariant Sections of the Document,
28986 unaltered in their text and in their titles.  Section numbers
28987 or the equivalent are not considered part of the section titles.
28989 @item 
28990 Delete any section Entitled "Endorsements".  Such a section
28991 may not be included in the Modified Version.
28993 @item 
28994 Do not retitle any existing section to be Entitled "Endorsements"
28995 or to conflict in title with any Invariant Section.
28997 @item 
28998 Preserve any Warranty Disclaimers.
28999 @end enumerate
29001 If the Modified Version includes new front-matter sections or
29002 appendices that qualify as Secondary Sections and contain no material
29003 copied from the Document, you may at your option designate some or all
29004 of these sections as invariant.  To do this, add their titles to the
29005 list of Invariant Sections in the Modified Version's license notice.
29006 These titles must be distinct from any other section titles.
29008 You may add a section Entitled "Endorsements", provided it contains
29009 nothing but endorsements of your Modified Version by various
29010 parties---for example, statements of peer review or that the text has
29011 been approved by an organization as the authoritative definition of a
29012 standard.
29014 You may add a passage of up to five words as a Front-Cover Text, and a
29015 passage of up to 25 words as a Back-Cover Text, to the end of the list
29016 of Cover Texts in the Modified Version.  Only one passage of
29017 Front-Cover Text and one of Back-Cover Text may be added by (or
29018 through arrangements made by) any one entity.  If the Document already
29019 includes a cover text for the same cover, previously added by you or
29020 by arrangement made by the same entity you are acting on behalf of,
29021 you may not add another; but you may replace the old one, on explicit
29022 permission from the previous publisher that added the old one.
29024 The author(s) and publisher(s) of the Document do not by this License
29025 give permission to use their names for publicity for or to assert or
29026 imply endorsement of any Modified Version.
29028 @strong{5. COMBINING DOCUMENTS}
29030 You may combine the Document with other documents released under this
29031 License, under the terms defined in section 4 above for modified
29032 versions, provided that you include in the combination all of the
29033 Invariant Sections of all of the original documents, unmodified, and
29034 list them all as Invariant Sections of your combined work in its
29035 license notice, and that you preserve all their Warranty Disclaimers.
29037 The combined work need only contain one copy of this License, and
29038 multiple identical Invariant Sections may be replaced with a single
29039 copy.  If there are multiple Invariant Sections with the same name but
29040 different contents, make the title of each such section unique by
29041 adding at the end of it, in parentheses, the name of the original
29042 author or publisher of that section if known, or else a unique number.
29043 Make the same adjustment to the section titles in the list of
29044 Invariant Sections in the license notice of the combined work.
29046 In the combination, you must combine any sections Entitled "History"
29047 in the various original documents, forming one section Entitled
29048 "History"; likewise combine any sections Entitled "Acknowledgements",
29049 and any sections Entitled "Dedications".  You must delete all sections
29050 Entitled "Endorsements".
29052 @strong{6. COLLECTIONS OF DOCUMENTS}
29054 You may make a collection consisting of the Document and other documents
29055 released under this License, and replace the individual copies of this
29056 License in the various documents with a single copy that is included in
29057 the collection, provided that you follow the rules of this License for
29058 verbatim copying of each of the documents in all other respects.
29060 You may extract a single document from such a collection, and distribute
29061 it individually under this License, provided you insert a copy of this
29062 License into the extracted document, and follow this License in all
29063 other respects regarding verbatim copying of that document.
29065 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
29067 A compilation of the Document or its derivatives with other separate
29068 and independent documents or works, in or on a volume of a storage or
29069 distribution medium, is called an "aggregate" if the copyright
29070 resulting from the compilation is not used to limit the legal rights
29071 of the compilation's users beyond what the individual works permit.
29072 When the Document is included in an aggregate, this License does not
29073 apply to the other works in the aggregate which are not themselves
29074 derivative works of the Document.
29076 If the Cover Text requirement of section 3 is applicable to these
29077 copies of the Document, then if the Document is less than one half of
29078 the entire aggregate, the Document's Cover Texts may be placed on
29079 covers that bracket the Document within the aggregate, or the
29080 electronic equivalent of covers if the Document is in electronic form.
29081 Otherwise they must appear on printed covers that bracket the whole
29082 aggregate.
29084 @strong{8. TRANSLATION}
29086 Translation is considered a kind of modification, so you may
29087 distribute translations of the Document under the terms of section 4.
29088 Replacing Invariant Sections with translations requires special
29089 permission from their copyright holders, but you may include
29090 translations of some or all Invariant Sections in addition to the
29091 original versions of these Invariant Sections.  You may include a
29092 translation of this License, and all the license notices in the
29093 Document, and any Warranty Disclaimers, provided that you also include
29094 the original English version of this License and the original versions
29095 of those notices and disclaimers.  In case of a disagreement between
29096 the translation and the original version of this License or a notice
29097 or disclaimer, the original version will prevail.
29099 If a section in the Document is Entitled "Acknowledgements",
29100 "Dedications", or "History", the requirement (section 4) to Preserve
29101 its Title (section 1) will typically require changing the actual
29102 title.
29104 @strong{9. TERMINATION}
29106 You may not copy, modify, sublicense, or distribute the Document
29107 except as expressly provided under this License.  Any attempt
29108 otherwise to copy, modify, sublicense, or distribute it is void, and
29109 will automatically terminate your rights under this License.
29111 However, if you cease all violation of this License, then your license
29112 from a particular copyright holder is reinstated (a) provisionally,
29113 unless and until the copyright holder explicitly and finally
29114 terminates your license, and (b) permanently, if the copyright holder
29115 fails to notify you of the violation by some reasonable means prior to
29116 60 days after the cessation.
29118 Moreover, your license from a particular copyright holder is
29119 reinstated permanently if the copyright holder notifies you of the
29120 violation by some reasonable means, this is the first time you have
29121 received notice of violation of this License (for any work) from that
29122 copyright holder, and you cure the violation prior to 30 days after
29123 your receipt of the notice.
29125 Termination of your rights under this section does not terminate the
29126 licenses of parties who have received copies or rights from you under
29127 this License.  If your rights have been terminated and not permanently
29128 reinstated, receipt of a copy of some or all of the same material does
29129 not give you any rights to use it.
29131 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
29133 The Free Software Foundation may publish new, revised versions
29134 of the GNU Free Documentation License from time to time.  Such new
29135 versions will be similar in spirit to the present version, but may
29136 differ in detail to address new problems or concerns.  See
29137 @indicateurl{http://www.gnu.org/copyleft/}.
29139 Each version of the License is given a distinguishing version number.
29140 If the Document specifies that a particular numbered version of this
29141 License "or any later version" applies to it, you have the option of
29142 following the terms and conditions either of that specified version or
29143 of any later version that has been published (not as a draft) by the
29144 Free Software Foundation.  If the Document does not specify a version
29145 number of this License, you may choose any version ever published (not
29146 as a draft) by the Free Software Foundation.  If the Document
29147 specifies that a proxy can decide which future versions of this
29148 License can be used, that proxy's public statement of acceptance of a
29149 version permanently authorizes you to choose that version for the
29150 Document.
29152 @strong{11. RELICENSING}
29154 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
29155 World Wide Web server that publishes copyrightable works and also
29156 provides prominent facilities for anybody to edit those works.  A
29157 public wiki that anybody can edit is an example of such a server.  A
29158 "Massive Multiauthor Collaboration" (or "MMC") contained in the
29159 site means any set of copyrightable works thus published on the MMC
29160 site.
29162 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
29163 license published by Creative Commons Corporation, a not-for-profit
29164 corporation with a principal place of business in San Francisco,
29165 California, as well as future copyleft versions of that license
29166 published by that same organization.
29168 "Incorporate" means to publish or republish a Document, in whole or
29169 in part, as part of another Document.
29171 An MMC is "eligible for relicensing" if it is licensed under this
29172 License, and if all works that were first published under this License
29173 somewhere other than this MMC, and subsequently incorporated in whole
29174 or in part into the MMC, (1) had no cover texts or invariant sections,
29175 and (2) were thus incorporated prior to November 1, 2008.
29177 The operator of an MMC Site may republish an MMC contained in the site
29178 under CC-BY-SA on the same site at any time before August 1, 2009,
29179 provided the MMC is eligible for relicensing.
29181 @strong{ADDENDUM: How to use this License for your documents}
29183 To use this License in a document you have written, include a copy of
29184 the License in the document and put the following copyright and
29185 license notices just after the title page:
29187 @quotation
29189 Copyright © YEAR  YOUR NAME.
29190 Permission is granted to copy, distribute and/or modify this document
29191 under the terms of the GNU Free Documentation License, Version 1.3
29192 or any later version published by the Free Software Foundation;
29193 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
29194 A copy of the license is included in the section entitled "GNU
29195 Free Documentation License".
29196 @end quotation
29198 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
29199 replace the "with ... Texts." line with this:
29201 @quotation
29203 with the Invariant Sections being LIST THEIR TITLES, with the
29204 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
29205 @end quotation
29207 If you have Invariant Sections without Cover Texts, or some other
29208 combination of the three, merge those two alternatives to suit the
29209 situation.
29211 If your document contains nontrivial examples of program code, we
29212 recommend releasing these examples in parallel under your choice of
29213 free software license, such as the GNU General Public License,
29214 to permit their use in free software.
29216 @node Index,,GNU Free Documentation License,Top
29217 @unnumbered Index
29220 @printindex ge
29223 @c %**end of body
29224 @bye