* config/sparc/driver-sparc.c (cpu_names): Add SPARC-T5 entry.
[official-gcc.git] / gcc / ada / gnat_rm.texi
blobace680e1f4aa5db6abb69e36c54d920ea56b1a94
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.4.6.@*
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 , Apr 25, 2017
26 AdaCore
28 Copyright @copyright{} 2008-2017, 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 Deadline_Floor:: 
139 * Pragma Default_Initial_Condition:: 
140 * Pragma Debug:: 
141 * Pragma Debug_Policy:: 
142 * Pragma Default_Scalar_Storage_Order:: 
143 * Pragma Default_Storage_Pool:: 
144 * Pragma Depends:: 
145 * Pragma Detect_Blocking:: 
146 * Pragma Disable_Atomic_Synchronization:: 
147 * Pragma Dispatching_Domain:: 
148 * Pragma Effective_Reads:: 
149 * Pragma Effective_Writes:: 
150 * Pragma Elaboration_Checks:: 
151 * Pragma Eliminate:: 
152 * Pragma Enable_Atomic_Synchronization:: 
153 * Pragma Export_Function:: 
154 * Pragma Export_Object:: 
155 * Pragma Export_Procedure:: 
156 * Pragma Export_Value:: 
157 * Pragma Export_Valued_Procedure:: 
158 * Pragma Extend_System:: 
159 * Pragma Extensions_Allowed:: 
160 * Pragma Extensions_Visible:: 
161 * Pragma External:: 
162 * Pragma External_Name_Casing:: 
163 * Pragma Fast_Math:: 
164 * Pragma Favor_Top_Level:: 
165 * Pragma Finalize_Storage_Only:: 
166 * Pragma Float_Representation:: 
167 * Pragma Ghost:: 
168 * Pragma Global:: 
169 * Pragma Ident:: 
170 * Pragma Ignore_Pragma:: 
171 * Pragma Implementation_Defined:: 
172 * Pragma Implemented:: 
173 * Pragma Implicit_Packing:: 
174 * Pragma Import_Function:: 
175 * Pragma Import_Object:: 
176 * Pragma Import_Procedure:: 
177 * Pragma Import_Valued_Procedure:: 
178 * Pragma Independent:: 
179 * Pragma Independent_Components:: 
180 * Pragma Initial_Condition:: 
181 * Pragma Initialize_Scalars:: 
182 * Pragma Initializes:: 
183 * Pragma Inline_Always:: 
184 * Pragma Inline_Generic:: 
185 * Pragma Interface:: 
186 * Pragma Interface_Name:: 
187 * Pragma Interrupt_Handler:: 
188 * Pragma Interrupt_State:: 
189 * Pragma Invariant:: 
190 * Pragma Keep_Names:: 
191 * Pragma License:: 
192 * Pragma Link_With:: 
193 * Pragma Linker_Alias:: 
194 * Pragma Linker_Constructor:: 
195 * Pragma Linker_Destructor:: 
196 * Pragma Linker_Section:: 
197 * Pragma Lock_Free:: 
198 * Pragma Loop_Invariant:: 
199 * Pragma Loop_Optimize:: 
200 * Pragma Loop_Variant:: 
201 * Pragma Machine_Attribute:: 
202 * Pragma Main:: 
203 * Pragma Main_Storage:: 
204 * Pragma Max_Queue_Length:: 
205 * Pragma No_Body:: 
206 * Pragma No_Elaboration_Code_All:: 
207 * Pragma No_Heap_Finalization:: 
208 * Pragma No_Inline:: 
209 * Pragma No_Return:: 
210 * Pragma No_Run_Time:: 
211 * Pragma No_Strict_Aliasing:: 
212 * Pragma No_Tagged_Streams:: 
213 * Pragma Normalize_Scalars:: 
214 * Pragma Obsolescent:: 
215 * Pragma Optimize_Alignment:: 
216 * Pragma Ordered:: 
217 * Pragma Overflow_Mode:: 
218 * Pragma Overriding_Renamings:: 
219 * Pragma Partition_Elaboration_Policy:: 
220 * Pragma Part_Of:: 
221 * Pragma Passive:: 
222 * Pragma Persistent_BSS:: 
223 * Pragma Polling:: 
224 * Pragma Post:: 
225 * Pragma Postcondition:: 
226 * Pragma Post_Class:: 
227 * Pragma Rename_Pragma:: 
228 * Pragma Pre:: 
229 * Pragma Precondition:: 
230 * Pragma Predicate:: 
231 * Pragma Predicate_Failure:: 
232 * Pragma Preelaborable_Initialization:: 
233 * Pragma Prefix_Exception_Messages:: 
234 * Pragma Pre_Class:: 
235 * Pragma Priority_Specific_Dispatching:: 
236 * Pragma Profile:: 
237 * Pragma Profile_Warnings:: 
238 * Pragma Propagate_Exceptions:: 
239 * Pragma Provide_Shift_Operators:: 
240 * Pragma Psect_Object:: 
241 * Pragma Pure_Function:: 
242 * Pragma Rational:: 
243 * Pragma Ravenscar:: 
244 * Pragma Refined_Depends:: 
245 * Pragma Refined_Global:: 
246 * Pragma Refined_Post:: 
247 * Pragma Refined_State:: 
248 * Pragma Relative_Deadline:: 
249 * Pragma Remote_Access_Type:: 
250 * Pragma Restricted_Run_Time:: 
251 * Pragma Restriction_Warnings:: 
252 * Pragma Reviewable:: 
253 * Pragma Secondary_Stack_Size:: 
254 * Pragma Share_Generic:: 
255 * Pragma Shared:: 
256 * Pragma Short_Circuit_And_Or:: 
257 * Pragma Short_Descriptors:: 
258 * Pragma Simple_Storage_Pool_Type:: 
259 * Pragma Source_File_Name:: 
260 * Pragma Source_File_Name_Project:: 
261 * Pragma Source_Reference:: 
262 * Pragma SPARK_Mode:: 
263 * Pragma Static_Elaboration_Desired:: 
264 * Pragma Stream_Convert:: 
265 * Pragma Style_Checks:: 
266 * Pragma Subtitle:: 
267 * Pragma Suppress:: 
268 * Pragma Suppress_All:: 
269 * Pragma Suppress_Debug_Info:: 
270 * Pragma Suppress_Exception_Locations:: 
271 * Pragma Suppress_Initialization:: 
272 * Pragma Task_Name:: 
273 * Pragma Task_Storage:: 
274 * Pragma Test_Case:: 
275 * Pragma Thread_Local_Storage:: 
276 * Pragma Time_Slice:: 
277 * Pragma Title:: 
278 * Pragma Type_Invariant:: 
279 * Pragma Type_Invariant_Class:: 
280 * Pragma Unchecked_Union:: 
281 * Pragma Unevaluated_Use_Of_Old:: 
282 * Pragma Unimplemented_Unit:: 
283 * Pragma Universal_Aliasing:: 
284 * Pragma Universal_Data:: 
285 * Pragma Unmodified:: 
286 * Pragma Unreferenced:: 
287 * Pragma Unreferenced_Objects:: 
288 * Pragma Unreserve_All_Interrupts:: 
289 * Pragma Unsuppress:: 
290 * Pragma Use_VADS_Size:: 
291 * Pragma Unused:: 
292 * Pragma Validity_Checks:: 
293 * Pragma Volatile:: 
294 * Pragma Volatile_Full_Access:: 
295 * Pragma Volatile_Function:: 
296 * Pragma Warning_As_Error:: 
297 * Pragma Warnings:: 
298 * Pragma Weak_External:: 
299 * Pragma Wide_Character_Encoding:: 
301 Implementation Defined Aspects
303 * Aspect Abstract_State:: 
304 * Aspect Annotate:: 
305 * Aspect Async_Readers:: 
306 * Aspect Async_Writers:: 
307 * Aspect Constant_After_Elaboration:: 
308 * Aspect Contract_Cases:: 
309 * Aspect Depends:: 
310 * Aspect Default_Initial_Condition:: 
311 * Aspect Dimension:: 
312 * Aspect Dimension_System:: 
313 * Aspect Disable_Controlled:: 
314 * Aspect Effective_Reads:: 
315 * Aspect Effective_Writes:: 
316 * Aspect Extensions_Visible:: 
317 * Aspect Favor_Top_Level:: 
318 * Aspect Ghost:: 
319 * Aspect Global:: 
320 * Aspect Initial_Condition:: 
321 * Aspect Initializes:: 
322 * Aspect Inline_Always:: 
323 * Aspect Invariant:: 
324 * Aspect Invariant'Class:: 
325 * Aspect Iterable:: 
326 * Aspect Linker_Section:: 
327 * Aspect Lock_Free:: 
328 * Aspect Max_Queue_Length:: 
329 * Aspect No_Elaboration_Code_All:: 
330 * Aspect No_Tagged_Streams:: 
331 * Aspect Object_Size:: 
332 * Aspect Obsolescent:: 
333 * Aspect Part_Of:: 
334 * Aspect Persistent_BSS:: 
335 * Aspect Predicate:: 
336 * Aspect Pure_Function:: 
337 * Aspect Refined_Depends:: 
338 * Aspect Refined_Global:: 
339 * Aspect Refined_Post:: 
340 * Aspect Refined_State:: 
341 * Aspect Remote_Access_Type:: 
342 * Aspect Secondary_Stack_Size:: 
343 * Aspect Scalar_Storage_Order:: 
344 * Aspect Shared:: 
345 * Aspect Simple_Storage_Pool:: 
346 * Aspect Simple_Storage_Pool_Type:: 
347 * Aspect SPARK_Mode:: 
348 * Aspect Suppress_Debug_Info:: 
349 * Aspect Suppress_Initialization:: 
350 * Aspect Test_Case:: 
351 * Aspect Thread_Local_Storage:: 
352 * Aspect Universal_Aliasing:: 
353 * Aspect Universal_Data:: 
354 * Aspect Unmodified:: 
355 * Aspect Unreferenced:: 
356 * Aspect Unreferenced_Objects:: 
357 * Aspect Value_Size:: 
358 * Aspect Volatile_Full_Access:: 
359 * Aspect Volatile_Function:: 
360 * Aspect Warnings:: 
362 Implementation Defined Attributes
364 * Attribute Abort_Signal:: 
365 * Attribute Address_Size:: 
366 * Attribute Asm_Input:: 
367 * Attribute Asm_Output:: 
368 * Attribute Atomic_Always_Lock_Free:: 
369 * Attribute Bit:: 
370 * Attribute Bit_Position:: 
371 * Attribute Code_Address:: 
372 * Attribute Compiler_Version:: 
373 * Attribute Constrained:: 
374 * Attribute Default_Bit_Order:: 
375 * Attribute Default_Scalar_Storage_Order:: 
376 * Attribute Deref:: 
377 * Attribute Descriptor_Size:: 
378 * Attribute Elaborated:: 
379 * Attribute Elab_Body:: 
380 * Attribute Elab_Spec:: 
381 * Attribute Elab_Subp_Body:: 
382 * Attribute Emax:: 
383 * Attribute Enabled:: 
384 * Attribute Enum_Rep:: 
385 * Attribute Enum_Val:: 
386 * Attribute Epsilon:: 
387 * Attribute Fast_Math:: 
388 * Attribute Finalization_Size:: 
389 * Attribute Fixed_Value:: 
390 * Attribute From_Any:: 
391 * Attribute Has_Access_Values:: 
392 * Attribute Has_Discriminants:: 
393 * Attribute Img:: 
394 * Attribute Integer_Value:: 
395 * Attribute Invalid_Value:: 
396 * Attribute Iterable:: 
397 * Attribute Large:: 
398 * Attribute Library_Level:: 
399 * Attribute Lock_Free:: 
400 * Attribute Loop_Entry:: 
401 * Attribute Machine_Size:: 
402 * Attribute Mantissa:: 
403 * Attribute Maximum_Alignment:: 
404 * Attribute Mechanism_Code:: 
405 * Attribute Null_Parameter:: 
406 * Attribute Object_Size:: 
407 * Attribute Old:: 
408 * Attribute Passed_By_Reference:: 
409 * Attribute Pool_Address:: 
410 * Attribute Range_Length:: 
411 * Attribute Restriction_Set:: 
412 * Attribute Result:: 
413 * Attribute Safe_Emax:: 
414 * Attribute Safe_Large:: 
415 * Attribute Safe_Small:: 
416 * Attribute Scalar_Storage_Order:: 
417 * Attribute Simple_Storage_Pool:: 
418 * Attribute Small:: 
419 * Attribute Storage_Unit:: 
420 * Attribute Stub_Type:: 
421 * Attribute System_Allocator_Alignment:: 
422 * Attribute Target_Name:: 
423 * Attribute To_Address:: 
424 * Attribute To_Any:: 
425 * Attribute Type_Class:: 
426 * Attribute Type_Key:: 
427 * Attribute TypeCode:: 
428 * Attribute Unconstrained_Array:: 
429 * Attribute Universal_Literal_String:: 
430 * Attribute Unrestricted_Access:: 
431 * Attribute Update:: 
432 * Attribute Valid_Scalars:: 
433 * Attribute VADS_Size:: 
434 * Attribute Value_Size:: 
435 * Attribute Wchar_T_Size:: 
436 * Attribute Word_Size:: 
438 Standard and Implementation Defined Restrictions
440 * Partition-Wide Restrictions:: 
441 * Program Unit Level Restrictions:: 
443 Partition-Wide Restrictions
445 * Immediate_Reclamation:: 
446 * Max_Asynchronous_Select_Nesting:: 
447 * Max_Entry_Queue_Length:: 
448 * Max_Protected_Entries:: 
449 * Max_Select_Alternatives:: 
450 * Max_Storage_At_Blocking:: 
451 * Max_Task_Entries:: 
452 * Max_Tasks:: 
453 * No_Abort_Statements:: 
454 * No_Access_Parameter_Allocators:: 
455 * No_Access_Subprograms:: 
456 * No_Allocators:: 
457 * No_Anonymous_Allocators:: 
458 * No_Asynchronous_Control:: 
459 * No_Calendar:: 
460 * No_Coextensions:: 
461 * No_Default_Initialization:: 
462 * No_Delay:: 
463 * No_Dependence:: 
464 * No_Direct_Boolean_Operators:: 
465 * No_Dispatch:: 
466 * No_Dispatching_Calls:: 
467 * No_Dynamic_Attachment:: 
468 * No_Dynamic_Priorities:: 
469 * No_Entry_Calls_In_Elaboration_Code:: 
470 * No_Enumeration_Maps:: 
471 * No_Exception_Handlers:: 
472 * No_Exception_Propagation:: 
473 * No_Exception_Registration:: 
474 * No_Exceptions:: 
475 * No_Finalization:: 
476 * No_Fixed_Point:: 
477 * No_Floating_Point:: 
478 * No_Implicit_Conditionals:: 
479 * No_Implicit_Dynamic_Code:: 
480 * No_Implicit_Heap_Allocations:: 
481 * No_Implicit_Protected_Object_Allocations:: 
482 * No_Implicit_Task_Allocations:: 
483 * No_Initialize_Scalars:: 
484 * No_IO:: 
485 * No_Local_Allocators:: 
486 * No_Local_Protected_Objects:: 
487 * No_Local_Timing_Events:: 
488 * No_Long_Long_Integers:: 
489 * No_Multiple_Elaboration:: 
490 * No_Nested_Finalization:: 
491 * No_Protected_Type_Allocators:: 
492 * No_Protected_Types:: 
493 * No_Recursion:: 
494 * No_Reentrancy:: 
495 * No_Relative_Delay:: 
496 * No_Requeue_Statements:: 
497 * No_Secondary_Stack:: 
498 * No_Select_Statements:: 
499 * No_Specific_Termination_Handlers:: 
500 * No_Specification_of_Aspect:: 
501 * No_Standard_Allocators_After_Elaboration:: 
502 * No_Standard_Storage_Pools:: 
503 * No_Stream_Optimizations:: 
504 * No_Streams:: 
505 * No_Task_Allocators:: 
506 * No_Task_At_Interrupt_Priority:: 
507 * No_Task_Attributes_Package:: 
508 * No_Task_Hierarchy:: 
509 * No_Task_Termination:: 
510 * No_Tasking:: 
511 * No_Terminate_Alternatives:: 
512 * No_Unchecked_Access:: 
513 * No_Unchecked_Conversion:: 
514 * No_Unchecked_Deallocation:: 
515 * No_Use_Of_Entity:: 
516 * Pure_Barriers:: 
517 * Simple_Barriers:: 
518 * Static_Priorities:: 
519 * Static_Storage_Size:: 
521 Program Unit Level Restrictions
523 * No_Elaboration_Code:: 
524 * No_Dynamic_Sized_Objects:: 
525 * No_Entry_Queue:: 
526 * No_Implementation_Aspect_Specifications:: 
527 * No_Implementation_Attributes:: 
528 * No_Implementation_Identifiers:: 
529 * No_Implementation_Pragmas:: 
530 * No_Implementation_Restrictions:: 
531 * No_Implementation_Units:: 
532 * No_Implicit_Aliasing:: 
533 * No_Implicit_Loops:: 
534 * No_Obsolescent_Features:: 
535 * No_Wide_Characters:: 
536 * SPARK_05:: 
538 Implementation Advice
540 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
541 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
542 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
543 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
544 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
545 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
546 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
547 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
548 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
549 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
550 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
551 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
552 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
553 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
554 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
555 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
556 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
557 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
558 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
559 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
560 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
561 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
562 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
563 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
564 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
565 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
566 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
567 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
568 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
569 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
570 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
571 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
572 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
573 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
574 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
575 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
576 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
577 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
578 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
579 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
580 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
581 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
582 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
583 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
584 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
585 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
586 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
587 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
588 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
589 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
590 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
591 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
592 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
593 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
594 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
595 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
596 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
597 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
598 * RM G; Numerics: RM G Numerics. 
599 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
600 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
601 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
602 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
603 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
605 Intrinsic Subprograms
607 * Intrinsic Operators:: 
608 * Compilation_Date:: 
609 * Compilation_Time:: 
610 * Enclosing_Entity:: 
611 * Exception_Information:: 
612 * Exception_Message:: 
613 * Exception_Name:: 
614 * File:: 
615 * Line:: 
616 * Shifts and Rotates:: 
617 * Source_Location:: 
619 Representation Clauses and Pragmas
621 * Alignment Clauses:: 
622 * Size Clauses:: 
623 * Storage_Size Clauses:: 
624 * Size of Variant Record Objects:: 
625 * Biased Representation:: 
626 * Value_Size and Object_Size Clauses:: 
627 * Component_Size Clauses:: 
628 * Bit_Order Clauses:: 
629 * Effect of Bit_Order on Byte Ordering:: 
630 * Pragma Pack for Arrays:: 
631 * Pragma Pack for Records:: 
632 * Record Representation Clauses:: 
633 * Handling of Records with Holes:: 
634 * Enumeration Clauses:: 
635 * Address Clauses:: 
636 * Use of Address Clauses for Memory-Mapped I/O:: 
637 * Effect of Convention on Representation:: 
638 * Conventions and Anonymous Access Types:: 
639 * Determining the Representations chosen by GNAT:: 
641 The Implementation of Standard I/O
643 * Standard I/O Packages:: 
644 * FORM Strings:: 
645 * Direct_IO:: 
646 * Sequential_IO:: 
647 * Text_IO:: 
648 * Wide_Text_IO:: 
649 * Wide_Wide_Text_IO:: 
650 * Stream_IO:: 
651 * Text Translation:: 
652 * Shared Files:: 
653 * Filenames encoding:: 
654 * File content encoding:: 
655 * Open Modes:: 
656 * Operations on C Streams:: 
657 * Interfacing to C Streams:: 
659 Text_IO
661 * Stream Pointer Positioning:: 
662 * Reading and Writing Non-Regular Files:: 
663 * Get_Immediate:: 
664 * Treating Text_IO Files as Streams:: 
665 * Text_IO Extensions:: 
666 * Text_IO Facilities for Unbounded Strings:: 
668 Wide_Text_IO
670 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
671 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
673 Wide_Wide_Text_IO
675 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
676 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
678 The GNAT Library
680 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
681 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
682 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
683 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
684 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
685 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
686 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
687 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
688 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
689 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
690 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
691 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
692 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
693 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
694 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
695 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
696 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
697 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
698 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
699 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
700 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
701 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
702 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
703 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
704 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
705 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
706 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
707 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
708 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
709 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
710 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
711 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
712 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
713 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
714 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
715 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
716 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
717 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
718 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
719 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
720 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
721 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
722 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
723 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
724 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
725 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
726 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
727 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
728 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
729 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
730 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
731 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
732 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
733 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
734 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
735 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
736 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
737 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
738 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
739 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
740 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
741 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
742 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
743 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
744 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
745 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
746 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
747 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
748 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
749 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
750 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
751 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
752 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
753 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
754 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
755 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
756 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
757 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
758 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
759 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
760 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
761 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
762 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
763 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
764 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
765 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
766 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
767 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
768 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
769 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
770 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
771 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
772 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
773 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
774 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
775 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
776 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
777 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
778 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
779 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
780 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
781 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
782 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
783 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
784 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
785 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
786 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
787 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
788 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
789 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
790 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
791 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
792 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
793 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
794 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
795 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
796 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
797 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
798 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
799 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
800 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
801 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
802 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
803 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
804 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
805 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
806 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
807 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
808 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
809 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
810 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
811 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
812 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
813 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
814 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
815 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
816 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
817 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
818 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
819 * System.Memory (s-memory.ads): System Memory s-memory ads. 
820 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
821 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
822 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
823 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
824 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
825 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
826 * System.Rident (s-rident.ads): System Rident s-rident ads. 
827 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
828 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
829 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
830 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
832 Interfacing to Other Languages
834 * Interfacing to C:: 
835 * Interfacing to C++:: 
836 * Interfacing to COBOL:: 
837 * Interfacing to Fortran:: 
838 * Interfacing to non-GNAT Ada code:: 
840 Implementation of Specific Ada Features
842 * Machine Code Insertions:: 
843 * GNAT Implementation of Tasking:: 
844 * GNAT Implementation of Shared Passive Packages:: 
845 * Code Generation for Array Aggregates:: 
846 * The Size of Discriminated Records with Default Discriminants:: 
847 * Strict Conformance to the Ada Reference Manual:: 
849 GNAT Implementation of Tasking
851 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
852 * Ensuring Compliance with the Real-Time Annex:: 
853 * Support for Locking Policies:: 
855 Code Generation for Array Aggregates
857 * Static constant aggregates with static bounds:: 
858 * Constant aggregates with unconstrained nominal types:: 
859 * Aggregates with static bounds:: 
860 * Aggregates with nonstatic bounds:: 
861 * Aggregates in assignment statements:: 
863 Obsolescent Features
865 * pragma No_Run_Time:: 
866 * pragma Ravenscar:: 
867 * pragma Restricted_Run_Time:: 
868 * pragma Task_Info:: 
869 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
871 Compatibility and Porting Guide
873 * Writing Portable Fixed-Point Declarations:: 
874 * Compatibility with Ada 83:: 
875 * Compatibility between Ada 95 and Ada 2005:: 
876 * Implementation-dependent characteristics:: 
877 * Compatibility with Other Ada Systems:: 
878 * Representation Clauses:: 
879 * Compatibility with HP Ada 83:: 
881 Compatibility with Ada 83
883 * Legal Ada 83 programs that are illegal in Ada 95:: 
884 * More deterministic semantics:: 
885 * Changed semantics:: 
886 * Other language compatibility issues:: 
888 Implementation-dependent characteristics
890 * Implementation-defined pragmas:: 
891 * Implementation-defined attributes:: 
892 * Libraries:: 
893 * Elaboration order:: 
894 * Target-specific aspects:: 
896 @end detailmenu
897 @end menu
899 @node About This Guide,Implementation Defined Pragmas,Top,Top
900 @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}
901 @chapter About This Guide
905 This manual contains useful information in writing programs using the
906 GNAT compiler.  It includes information on implementation dependent
907 characteristics of GNAT, including all the information required by
908 Annex M of the Ada language standard.
910 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
911 invoked in Ada 83 compatibility mode.
912 By default, GNAT assumes Ada 2012,
913 but you can override with a compiler switch
914 to explicitly specify the language version.
915 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
916 Throughout this manual, references to 'Ada' without a year suffix
917 apply to all the Ada versions of the language.
919 Ada is designed to be highly portable.
920 In general, a program will have the same effect even when compiled by
921 different compilers on different platforms.
922 However, since Ada is designed to be used in a
923 wide variety of applications, it also contains a number of system
924 dependent features to be used in interfacing to the external world.
926 @geindex Implementation-dependent features
928 @geindex Portability
930 Note: Any program that makes use of implementation-dependent features
931 may be non-portable.  You should follow good programming practice and
932 isolate and clearly document any sections of your program that make use
933 of these features in a non-portable manner.
935 @menu
936 * What This Reference Manual Contains:: 
937 * Conventions:: 
938 * Related Information:: 
940 @end menu
942 @node What This Reference Manual Contains,Conventions,,About This Guide
943 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
944 @section What This Reference Manual Contains
947 This reference manual contains the following chapters:
950 @itemize *
952 @item 
953 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
954 pragmas, which can be used to extend and enhance the functionality of the
955 compiler.
957 @item 
958 @ref{8,,Implementation Defined Attributes}, lists GNAT
959 implementation-dependent attributes, which can be used to extend and
960 enhance the functionality of the compiler.
962 @item 
963 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
964 implementation-dependent restrictions, which can be used to extend and
965 enhance the functionality of the compiler.
967 @item 
968 @ref{a,,Implementation Advice}, provides information on generally
969 desirable behavior which are not requirements that all compilers must
970 follow since it cannot be provided on all systems, or which may be
971 undesirable on some systems.
973 @item 
974 @ref{b,,Implementation Defined Characteristics}, provides a guide to
975 minimizing implementation dependent features.
977 @item 
978 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
979 implemented by GNAT, and how they can be imported into user
980 application programs.
982 @item 
983 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
984 way that GNAT represents data, and in particular the exact set
985 of representation clauses and pragmas that is accepted.
987 @item 
988 @ref{e,,Standard Library Routines}, provides a listing of packages and a
989 brief description of the functionality that is provided by Ada's
990 extensive set of standard library routines as implemented by GNAT.
992 @item 
993 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
994 implementation of the input-output facilities.
996 @item 
997 @ref{10,,The GNAT Library}, is a catalog of packages that complement
998 the Ada predefined library.
1000 @item 
1001 @ref{11,,Interfacing to Other Languages}, describes how programs
1002 written in Ada using GNAT can be interfaced to other programming
1003 languages.
1005 @item 
1006 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1007 of the specialized needs annexes.
1009 @item 
1010 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1011 to GNAT's implementation of machine code insertions, tasking, and several
1012 other features.
1014 @item 
1015 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1016 GNAT implementation of the Ada 2012 language standard.
1018 @item 
1019 @ref{15,,Obsolescent Features} documents implementation dependent features,
1020 including pragmas and attributes, which are considered obsolescent, since
1021 there are other preferred ways of achieving the same results. These
1022 obsolescent forms are retained for backwards compatibility.
1024 @item 
1025 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
1026 developing portable Ada code, describes the compatibility issues that
1027 may arise between GNAT and other Ada compilation systems (including those
1028 for Ada 83), and shows how GNAT can expedite porting applications
1029 developed in other Ada environments.
1031 @item 
1032 @ref{1,,GNU Free Documentation License} contains the license for this document.
1033 @end itemize
1035 @geindex Ada 95 Language Reference Manual
1037 @geindex Ada 2005 Language Reference Manual
1039 This reference manual assumes a basic familiarity with the Ada 95 language, as
1040 described in the
1041 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1042 It does not require knowledge of the new features introduced by Ada 2005 or
1043 Ada 2012.
1044 All three reference manuals are included in the GNAT documentation
1045 package.
1047 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1048 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1049 @section Conventions
1052 @geindex Conventions
1053 @geindex typographical
1055 @geindex Typographical conventions
1057 Following are examples of the typographical and graphic conventions used
1058 in this guide:
1061 @itemize *
1063 @item 
1064 @cite{Functions}, @cite{utility program names}, @cite{standard names},
1065 and @cite{classes}.
1067 @item 
1068 @cite{Option flags}
1070 @item 
1071 @code{File names}
1073 @item 
1074 @cite{Variables}
1076 @item 
1077 @emph{Emphasis}
1079 @item 
1080 [optional information or parameters]
1082 @item 
1083 Examples are described by text
1085 @example
1086 and then shown this way.
1087 @end example
1089 @item 
1090 Commands that are entered by the user are shown as preceded by a prompt string
1091 comprising the @code{$} character followed by a space.
1092 @end itemize
1094 @node Related Information,,Conventions,About This Guide
1095 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1096 @section Related Information
1099 See the following documents for further information on GNAT:
1102 @itemize *
1104 @item 
1105 @cite{GNAT User's Guide for Native Platforms},
1106 which provides information on how to use the
1107 GNAT development environment.
1109 @item 
1110 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1112 @item 
1113 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1114 of the Ada 95 standard.  The annotations describe
1115 detailed aspects of the design decision, and in particular contain useful
1116 sections on Ada 83 compatibility.
1118 @item 
1119 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1121 @item 
1122 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1123 of the Ada 2005 standard.  The annotations describe
1124 detailed aspects of the design decision.
1126 @item 
1127 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1129 @item 
1130 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1131 which contains specific information on compatibility between GNAT and
1132 DEC Ada 83 systems.
1134 @item 
1135 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1136 describes in detail the pragmas and attributes provided by the DEC Ada 83
1137 compiler system.
1138 @end itemize
1140 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1141 @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}
1142 @chapter Implementation Defined Pragmas
1145 Ada defines a set of pragmas that can be used to supply additional
1146 information to the compiler.  These language defined pragmas are
1147 implemented in GNAT and work as described in the Ada Reference Manual.
1149 In addition, Ada allows implementations to define additional pragmas
1150 whose meaning is defined by the implementation.  GNAT provides a number
1151 of these implementation-defined pragmas, which can be used to extend
1152 and enhance the functionality of the compiler.  This section of the GNAT
1153 Reference Manual describes these additional pragmas.
1155 Note that any program using these pragmas might not be portable to other
1156 compilers (although GNAT implements this set of pragmas on all
1157 platforms).  Therefore if portability to other compilers is an important
1158 consideration, the use of these pragmas should be minimized.
1160 @menu
1161 * Pragma Abort_Defer:: 
1162 * Pragma Abstract_State:: 
1163 * Pragma Ada_83:: 
1164 * Pragma Ada_95:: 
1165 * Pragma Ada_05:: 
1166 * Pragma Ada_2005:: 
1167 * Pragma Ada_12:: 
1168 * Pragma Ada_2012:: 
1169 * Pragma Allow_Integer_Address:: 
1170 * Pragma Annotate:: 
1171 * Pragma Assert:: 
1172 * Pragma Assert_And_Cut:: 
1173 * Pragma Assertion_Policy:: 
1174 * Pragma Assume:: 
1175 * Pragma Assume_No_Invalid_Values:: 
1176 * Pragma Async_Readers:: 
1177 * Pragma Async_Writers:: 
1178 * Pragma Attribute_Definition:: 
1179 * Pragma C_Pass_By_Copy:: 
1180 * Pragma Check:: 
1181 * Pragma Check_Float_Overflow:: 
1182 * Pragma Check_Name:: 
1183 * Pragma Check_Policy:: 
1184 * Pragma Comment:: 
1185 * Pragma Common_Object:: 
1186 * Pragma Compile_Time_Error:: 
1187 * Pragma Compile_Time_Warning:: 
1188 * Pragma Compiler_Unit:: 
1189 * Pragma Compiler_Unit_Warning:: 
1190 * Pragma Complete_Representation:: 
1191 * Pragma Complex_Representation:: 
1192 * Pragma Component_Alignment:: 
1193 * Pragma Constant_After_Elaboration:: 
1194 * Pragma Contract_Cases:: 
1195 * Pragma Convention_Identifier:: 
1196 * Pragma CPP_Class:: 
1197 * Pragma CPP_Constructor:: 
1198 * Pragma CPP_Virtual:: 
1199 * Pragma CPP_Vtable:: 
1200 * Pragma CPU:: 
1201 * Pragma Deadline_Floor:: 
1202 * Pragma Default_Initial_Condition:: 
1203 * Pragma Debug:: 
1204 * Pragma Debug_Policy:: 
1205 * Pragma Default_Scalar_Storage_Order:: 
1206 * Pragma Default_Storage_Pool:: 
1207 * Pragma Depends:: 
1208 * Pragma Detect_Blocking:: 
1209 * Pragma Disable_Atomic_Synchronization:: 
1210 * Pragma Dispatching_Domain:: 
1211 * Pragma Effective_Reads:: 
1212 * Pragma Effective_Writes:: 
1213 * Pragma Elaboration_Checks:: 
1214 * Pragma Eliminate:: 
1215 * Pragma Enable_Atomic_Synchronization:: 
1216 * Pragma Export_Function:: 
1217 * Pragma Export_Object:: 
1218 * Pragma Export_Procedure:: 
1219 * Pragma Export_Value:: 
1220 * Pragma Export_Valued_Procedure:: 
1221 * Pragma Extend_System:: 
1222 * Pragma Extensions_Allowed:: 
1223 * Pragma Extensions_Visible:: 
1224 * Pragma External:: 
1225 * Pragma External_Name_Casing:: 
1226 * Pragma Fast_Math:: 
1227 * Pragma Favor_Top_Level:: 
1228 * Pragma Finalize_Storage_Only:: 
1229 * Pragma Float_Representation:: 
1230 * Pragma Ghost:: 
1231 * Pragma Global:: 
1232 * Pragma Ident:: 
1233 * Pragma Ignore_Pragma:: 
1234 * Pragma Implementation_Defined:: 
1235 * Pragma Implemented:: 
1236 * Pragma Implicit_Packing:: 
1237 * Pragma Import_Function:: 
1238 * Pragma Import_Object:: 
1239 * Pragma Import_Procedure:: 
1240 * Pragma Import_Valued_Procedure:: 
1241 * Pragma Independent:: 
1242 * Pragma Independent_Components:: 
1243 * Pragma Initial_Condition:: 
1244 * Pragma Initialize_Scalars:: 
1245 * Pragma Initializes:: 
1246 * Pragma Inline_Always:: 
1247 * Pragma Inline_Generic:: 
1248 * Pragma Interface:: 
1249 * Pragma Interface_Name:: 
1250 * Pragma Interrupt_Handler:: 
1251 * Pragma Interrupt_State:: 
1252 * Pragma Invariant:: 
1253 * Pragma Keep_Names:: 
1254 * Pragma License:: 
1255 * Pragma Link_With:: 
1256 * Pragma Linker_Alias:: 
1257 * Pragma Linker_Constructor:: 
1258 * Pragma Linker_Destructor:: 
1259 * Pragma Linker_Section:: 
1260 * Pragma Lock_Free:: 
1261 * Pragma Loop_Invariant:: 
1262 * Pragma Loop_Optimize:: 
1263 * Pragma Loop_Variant:: 
1264 * Pragma Machine_Attribute:: 
1265 * Pragma Main:: 
1266 * Pragma Main_Storage:: 
1267 * Pragma Max_Queue_Length:: 
1268 * Pragma No_Body:: 
1269 * Pragma No_Elaboration_Code_All:: 
1270 * Pragma No_Heap_Finalization:: 
1271 * Pragma No_Inline:: 
1272 * Pragma No_Return:: 
1273 * Pragma No_Run_Time:: 
1274 * Pragma No_Strict_Aliasing:: 
1275 * Pragma No_Tagged_Streams:: 
1276 * Pragma Normalize_Scalars:: 
1277 * Pragma Obsolescent:: 
1278 * Pragma Optimize_Alignment:: 
1279 * Pragma Ordered:: 
1280 * Pragma Overflow_Mode:: 
1281 * Pragma Overriding_Renamings:: 
1282 * Pragma Partition_Elaboration_Policy:: 
1283 * Pragma Part_Of:: 
1284 * Pragma Passive:: 
1285 * Pragma Persistent_BSS:: 
1286 * Pragma Polling:: 
1287 * Pragma Post:: 
1288 * Pragma Postcondition:: 
1289 * Pragma Post_Class:: 
1290 * Pragma Rename_Pragma:: 
1291 * Pragma Pre:: 
1292 * Pragma Precondition:: 
1293 * Pragma Predicate:: 
1294 * Pragma Predicate_Failure:: 
1295 * Pragma Preelaborable_Initialization:: 
1296 * Pragma Prefix_Exception_Messages:: 
1297 * Pragma Pre_Class:: 
1298 * Pragma Priority_Specific_Dispatching:: 
1299 * Pragma Profile:: 
1300 * Pragma Profile_Warnings:: 
1301 * Pragma Propagate_Exceptions:: 
1302 * Pragma Provide_Shift_Operators:: 
1303 * Pragma Psect_Object:: 
1304 * Pragma Pure_Function:: 
1305 * Pragma Rational:: 
1306 * Pragma Ravenscar:: 
1307 * Pragma Refined_Depends:: 
1308 * Pragma Refined_Global:: 
1309 * Pragma Refined_Post:: 
1310 * Pragma Refined_State:: 
1311 * Pragma Relative_Deadline:: 
1312 * Pragma Remote_Access_Type:: 
1313 * Pragma Restricted_Run_Time:: 
1314 * Pragma Restriction_Warnings:: 
1315 * Pragma Reviewable:: 
1316 * Pragma Secondary_Stack_Size:: 
1317 * Pragma Share_Generic:: 
1318 * Pragma Shared:: 
1319 * Pragma Short_Circuit_And_Or:: 
1320 * Pragma Short_Descriptors:: 
1321 * Pragma Simple_Storage_Pool_Type:: 
1322 * Pragma Source_File_Name:: 
1323 * Pragma Source_File_Name_Project:: 
1324 * Pragma Source_Reference:: 
1325 * Pragma SPARK_Mode:: 
1326 * Pragma Static_Elaboration_Desired:: 
1327 * Pragma Stream_Convert:: 
1328 * Pragma Style_Checks:: 
1329 * Pragma Subtitle:: 
1330 * Pragma Suppress:: 
1331 * Pragma Suppress_All:: 
1332 * Pragma Suppress_Debug_Info:: 
1333 * Pragma Suppress_Exception_Locations:: 
1334 * Pragma Suppress_Initialization:: 
1335 * Pragma Task_Name:: 
1336 * Pragma Task_Storage:: 
1337 * Pragma Test_Case:: 
1338 * Pragma Thread_Local_Storage:: 
1339 * Pragma Time_Slice:: 
1340 * Pragma Title:: 
1341 * Pragma Type_Invariant:: 
1342 * Pragma Type_Invariant_Class:: 
1343 * Pragma Unchecked_Union:: 
1344 * Pragma Unevaluated_Use_Of_Old:: 
1345 * Pragma Unimplemented_Unit:: 
1346 * Pragma Universal_Aliasing:: 
1347 * Pragma Universal_Data:: 
1348 * Pragma Unmodified:: 
1349 * Pragma Unreferenced:: 
1350 * Pragma Unreferenced_Objects:: 
1351 * Pragma Unreserve_All_Interrupts:: 
1352 * Pragma Unsuppress:: 
1353 * Pragma Use_VADS_Size:: 
1354 * Pragma Unused:: 
1355 * Pragma Validity_Checks:: 
1356 * Pragma Volatile:: 
1357 * Pragma Volatile_Full_Access:: 
1358 * Pragma Volatile_Function:: 
1359 * Pragma Warning_As_Error:: 
1360 * Pragma Warnings:: 
1361 * Pragma Weak_External:: 
1362 * Pragma Wide_Character_Encoding:: 
1364 @end menu
1366 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1367 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1368 @section Pragma Abort_Defer
1371 @geindex Deferring aborts
1373 Syntax:
1375 @example
1376 pragma Abort_Defer;
1377 @end example
1379 This pragma must appear at the start of the statement sequence of a
1380 handled sequence of statements (right after the @cite{begin}).  It has
1381 the effect of deferring aborts for the sequence of statements (but not
1382 for the declarations or handlers, if any, associated with this statement
1383 sequence).
1385 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1386 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
1387 @section Pragma Abstract_State
1390 Syntax:
1392 @example
1393 pragma Abstract_State (ABSTRACT_STATE_LIST);
1395 ABSTRACT_STATE_LIST ::=
1396      null
1397   |  STATE_NAME_WITH_OPTIONS
1398   | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1400 STATE_NAME_WITH_OPTIONS ::=
1401      STATE_NAME
1402   | (STATE_NAME with OPTION_LIST)
1404 OPTION_LIST ::= OPTION @{, OPTION@}
1406 OPTION ::=
1407     SIMPLE_OPTION
1408   | NAME_VALUE_OPTION
1410 SIMPLE_OPTION ::= Ghost | Synchronous
1412 NAME_VALUE_OPTION ::=
1413     Part_Of => ABSTRACT_STATE
1414   | External [=> EXTERNAL_PROPERTY_LIST]
1416 EXTERNAL_PROPERTY_LIST ::=
1417      EXTERNAL_PROPERTY
1418   | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1420 EXTERNAL_PROPERTY ::=
1421     Async_Readers    [=> boolean_EXPRESSION]
1422   | Async_Writers    [=> boolean_EXPRESSION]
1423   | Effective_Reads  [=> boolean_EXPRESSION]
1424   | Effective_Writes [=> boolean_EXPRESSION]
1425     others            => boolean_EXPRESSION
1427 STATE_NAME ::= defining_identifier
1429 ABSTRACT_STATE ::= name
1430 @end example
1432 For the semantics of this pragma, see the entry for aspect @cite{Abstract_State} in
1433 the SPARK 2014 Reference Manual, section 7.1.4.
1435 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1436 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1e}
1437 @section Pragma Ada_83
1440 Syntax:
1442 @example
1443 pragma Ada_83;
1444 @end example
1446 A configuration pragma that establishes Ada 83 mode for the unit to
1447 which it applies, regardless of the mode set by the command line
1448 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1449 the syntax and semantics of Ada 83, as defined in the original Ada
1450 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1451 and Ada 2005 are not recognized, optional package bodies are allowed,
1452 and generics may name types with unknown discriminants without using
1453 the @cite{(<>)} notation.  In addition, some but not all of the additional
1454 restrictions of Ada 83 are enforced.
1456 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1457 Ada 83 code to be compiled and adapted to GNAT with less effort.
1458 Secondly, it aids in keeping code backwards compatible with Ada 83.
1459 However, there is no guarantee that code that is processed correctly
1460 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1461 83 compiler, since GNAT does not enforce all the additional checks
1462 required by Ada 83.
1464 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1465 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{1f}
1466 @section Pragma Ada_95
1469 Syntax:
1471 @example
1472 pragma Ada_95;
1473 @end example
1475 A configuration pragma that establishes Ada 95 mode for the unit to which
1476 it applies, regardless of the mode set by the command line switches.
1477 This mode is set automatically for the @cite{Ada} and @cite{System}
1478 packages and their children, so you need not specify it in these
1479 contexts.  This pragma is useful when writing a reusable component that
1480 itself uses Ada 95 features, but which is intended to be usable from
1481 either Ada 83 or Ada 95 programs.
1483 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1484 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{20}
1485 @section Pragma Ada_05
1488 Syntax:
1490 @example
1491 pragma Ada_05;
1492 pragma Ada_05 (local_NAME);
1493 @end example
1495 A configuration pragma that establishes Ada 2005 mode for the unit to which
1496 it applies, regardless of the mode set by the command line switches.
1497 This pragma is useful when writing a reusable component that
1498 itself uses Ada 2005 features, but which is intended to be usable from
1499 either Ada 83 or Ada 95 programs.
1501 The one argument form (which is not a configuration pragma)
1502 is used for managing the transition from
1503 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1504 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1505 mode will generate a warning. In addition, in Ada_83 or Ada_95
1506 mode, a preference rule is established which does not choose
1507 such an entity unless it is unambiguously specified. This avoids
1508 extra subprograms marked this way from generating ambiguities in
1509 otherwise legal pre-Ada_2005 programs. The one argument form is
1510 intended for exclusive use in the GNAT run-time library.
1512 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1513 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{21}
1514 @section Pragma Ada_2005
1517 Syntax:
1519 @example
1520 pragma Ada_2005;
1521 @end example
1523 This configuration pragma is a synonym for pragma Ada_05 and has the
1524 same syntax and effect.
1526 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1527 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{22}
1528 @section Pragma Ada_12
1531 Syntax:
1533 @example
1534 pragma Ada_12;
1535 pragma Ada_12 (local_NAME);
1536 @end example
1538 A configuration pragma that establishes Ada 2012 mode for the unit to which
1539 it applies, regardless of the mode set by the command line switches.
1540 This mode is set automatically for the @cite{Ada} and @cite{System}
1541 packages and their children, so you need not specify it in these
1542 contexts.  This pragma is useful when writing a reusable component that
1543 itself uses Ada 2012 features, but which is intended to be usable from
1544 Ada 83, Ada 95, or Ada 2005 programs.
1546 The one argument form, which is not a configuration pragma,
1547 is used for managing the transition from Ada
1548 2005 to Ada 2012 in the run-time library. If an entity is marked
1549 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1550 mode will generate a warning. In addition, in any pre-Ada_2012
1551 mode, a preference rule is established which does not choose
1552 such an entity unless it is unambiguously specified. This avoids
1553 extra subprograms marked this way from generating ambiguities in
1554 otherwise legal pre-Ada_2012 programs. The one argument form is
1555 intended for exclusive use in the GNAT run-time library.
1557 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1558 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{23}
1559 @section Pragma Ada_2012
1562 Syntax:
1564 @example
1565 pragma Ada_2012;
1566 @end example
1568 This configuration pragma is a synonym for pragma Ada_12 and has the
1569 same syntax and effect.
1571 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1572 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{24}
1573 @section Pragma Allow_Integer_Address
1576 Syntax:
1578 @example
1579 pragma Allow_Integer_Address;
1580 @end example
1582 In almost all versions of GNAT, @cite{System.Address} is a private
1583 type in accordance with the implementation advice in the RM. This
1584 means that integer values,
1585 in particular integer literals, are not allowed as address values.
1586 If the configuration pragma
1587 @cite{Allow_Integer_Address} is given, then integer expressions may
1588 be used anywhere a value of type @cite{System.Address} is required.
1589 The effect is to introduce an implicit unchecked conversion from the
1590 integer value to type @cite{System.Address}. The reverse case of using
1591 an address where an integer type is required is handled analogously.
1592 The following example compiles without errors:
1594 @example
1595 pragma Allow_Integer_Address;
1596 with System; use System;
1597 package AddrAsInt is
1598    X : Integer;
1599    Y : Integer;
1600    for X'Address use 16#1240#;
1601    for Y use at 16#3230#;
1602    m : Address := 16#4000#;
1603    n : constant Address := 4000;
1604    p : constant Address := Address (X + Y);
1605    v : Integer := y'Address;
1606    w : constant Integer := Integer (Y'Address);
1607    type R is new integer;
1608    RR : R := 1000;
1609    Z : Integer;
1610    for Z'Address use RR;
1611 end AddrAsInt;
1612 @end example
1614 Note that pragma @cite{Allow_Integer_Address} is ignored if @cite{System.Address}
1615 is not a private type. In implementations of @cite{GNAT} where
1616 System.Address is a visible integer type,
1617 this pragma serves no purpose but is ignored
1618 rather than rejected to allow common sets of sources to be used
1619 in the two situations.
1621 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1622 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{25}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{26}
1623 @section Pragma Annotate
1626 Syntax:
1628 @example
1629 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1631 ARG ::= NAME | EXPRESSION
1632 @end example
1634 This pragma is used to annotate programs.  @cite{identifier} identifies
1635 the type of annotation.  GNAT verifies that it is an identifier, but does
1636 not otherwise analyze it. The second optional identifier is also left
1637 unanalyzed, and by convention is used to control the action of the tool to
1638 which the annotation is addressed.  The remaining @cite{arg} arguments
1639 can be either string literals or more generally expressions.
1640 String literals are assumed to be either of type
1641 @cite{Standard.String} or else @cite{Wide_String} or @cite{Wide_Wide_String}
1642 depending on the character literals they contain.
1643 All other kinds of arguments are analyzed as expressions, and must be
1644 unambiguous. The last argument if present must have the identifier
1645 @cite{Entity} and GNAT verifies that a local name is given.
1647 The analyzed pragma is retained in the tree, but not otherwise processed
1648 by any part of the GNAT compiler, except to generate corresponding note
1649 lines in the generated ALI file. For the format of these note lines, see
1650 the compiler source file lib-writ.ads. This pragma is intended for use by
1651 external tools, including ASIS. The use of pragma Annotate does not
1652 affect the compilation process in any way. This pragma may be used as
1653 a configuration pragma.
1655 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1656 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{27}
1657 @section Pragma Assert
1660 Syntax:
1662 @example
1663 pragma Assert (
1664   boolean_EXPRESSION
1665   [, string_EXPRESSION]);
1666 @end example
1668 The effect of this pragma depends on whether the corresponding command
1669 line switch is set to activate assertions.  The pragma expands into code
1670 equivalent to the following:
1672 @example
1673 if assertions-enabled then
1674    if not boolean_EXPRESSION then
1675       System.Assertions.Raise_Assert_Failure
1676         (string_EXPRESSION);
1677    end if;
1678 end if;
1679 @end example
1681 The string argument, if given, is the message that will be associated
1682 with the exception occurrence if the exception is raised.  If no second
1683 argument is given, the default message is @cite{file}:@cite{nnn},
1684 where @cite{file} is the name of the source file containing the assert,
1685 and @cite{nnn} is the line number of the assert.
1687 Note that, as with the @cite{if} statement to which it is equivalent, the
1688 type of the expression is either @cite{Standard.Boolean}, or any type derived
1689 from this standard type.
1691 Assert checks can be either checked or ignored. By default they are ignored.
1692 They will be checked if either the command line switch @emph{-gnata} is
1693 used, or if an @cite{Assertion_Policy} or @cite{Check_Policy} pragma is used
1694 to enable @cite{Assert_Checks}.
1696 If assertions are ignored, then there
1697 is no run-time effect (and in particular, any side effects from the
1698 expression will not occur at run time).  (The expression is still
1699 analyzed at compile time, and may cause types to be frozen if they are
1700 mentioned here for the first time).
1702 If assertions are checked, then the given expression is tested, and if
1703 it is @cite{False} then @cite{System.Assertions.Raise_Assert_Failure} is called
1704 which results in the raising of @cite{Assert_Failure} with the given message.
1706 You should generally avoid side effects in the expression arguments of
1707 this pragma, because these side effects will turn on and off with the
1708 setting of the assertions mode, resulting in assertions that have an
1709 effect on the program.  However, the expressions are analyzed for
1710 semantic correctness whether or not assertions are enabled, so turning
1711 assertions on and off cannot affect the legality of a program.
1713 Note that the implementation defined policy @cite{DISABLE}, given in a
1714 pragma @cite{Assertion_Policy}, can be used to suppress this semantic analysis.
1716 Note: this is a standard language-defined pragma in versions
1717 of Ada from 2005 on. In GNAT, it is implemented in all versions
1718 of Ada, and the DISABLE policy is an implementation-defined
1719 addition.
1721 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1722 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{28}
1723 @section Pragma Assert_And_Cut
1726 Syntax:
1728 @example
1729 pragma Assert_And_Cut (
1730   boolean_EXPRESSION
1731   [, string_EXPRESSION]);
1732 @end example
1734 The effect of this pragma is identical to that of pragma @cite{Assert},
1735 except that in an @cite{Assertion_Policy} pragma, the identifier
1736 @cite{Assert_And_Cut} is used to control whether it is ignored or checked
1737 (or disabled).
1739 The intention is that this be used within a subprogram when the
1740 given test expresion sums up all the work done so far in the
1741 subprogram, so that the rest of the subprogram can be verified
1742 (informally or formally) using only the entry preconditions,
1743 and the expression in this pragma. This allows dividing up
1744 a subprogram into sections for the purposes of testing or
1745 formal verification. The pragma also serves as useful
1746 documentation.
1748 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1749 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{29}
1750 @section Pragma Assertion_Policy
1753 Syntax:
1755 @example
1756 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1758 pragma Assertion_Policy (
1759     ASSERTION_KIND => POLICY_IDENTIFIER
1760  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1762 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1764 RM_ASSERTION_KIND ::= Assert               |
1765                       Static_Predicate     |
1766                       Dynamic_Predicate    |
1767                       Pre                  |
1768                       Pre'Class            |
1769                       Post                 |
1770                       Post'Class           |
1771                       Type_Invariant       |
1772                       Type_Invariant'Class
1774 ID_ASSERTION_KIND ::= Assertions           |
1775                       Assert_And_Cut       |
1776                       Assume               |
1777                       Contract_Cases       |
1778                       Debug                |
1779                       Invariant            |
1780                       Invariant'Class      |
1781                       Loop_Invariant       |
1782                       Loop_Variant         |
1783                       Postcondition        |
1784                       Precondition         |
1785                       Predicate            |
1786                       Refined_Post         |
1787                       Statement_Assertions
1789 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1790 @end example
1792 This is a standard Ada 2012 pragma that is available as an
1793 implementation-defined pragma in earlier versions of Ada.
1794 The assertion kinds @cite{RM_ASSERTION_KIND} are those defined in
1795 the Ada standard. The assertion kinds @cite{ID_ASSERTION_KIND}
1796 are implementation defined additions recognized by the GNAT compiler.
1798 The pragma applies in both cases to pragmas and aspects with matching
1799 names, e.g. @cite{Pre} applies to the Pre aspect, and @cite{Precondition}
1800 applies to both the @cite{Precondition} pragma
1801 and the aspect @cite{Precondition}. Note that the identifiers for
1802 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1803 Pre_Class and Post_Class), since these pragmas are intended to be
1804 identical to the corresponding aspects).
1806 If the policy is @cite{CHECK}, then assertions are enabled, i.e.
1807 the corresponding pragma or aspect is activated.
1808 If the policy is @cite{IGNORE}, then assertions are ignored, i.e.
1809 the corresponding pragma or aspect is deactivated.
1810 This pragma overrides the effect of the @emph{-gnata} switch on the
1811 command line.
1812 If the policy is @cite{SUPPRESSIBLE}, then assertions are enabled by default,
1813 however, if the @emph{-gnatp} switch is specified all assertions are ignored.
1815 The implementation defined policy @cite{DISABLE} is like
1816 @cite{IGNORE} except that it completely disables semantic
1817 checking of the corresponding pragma or aspect. This is
1818 useful when the pragma or aspect argument references subprograms
1819 in a with'ed package which is replaced by a dummy package
1820 for the final build.
1822 The implementation defined assertion kind @cite{Assertions} applies to all
1823 assertion kinds. The form with no assertion kind given implies this
1824 choice, so it applies to all assertion kinds (RM defined, and
1825 implementation defined).
1827 The implementation defined assertion kind @cite{Statement_Assertions}
1828 applies to @cite{Assert}, @cite{Assert_And_Cut},
1829 @cite{Assume}, @cite{Loop_Invariant}, and @cite{Loop_Variant}.
1831 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1832 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2a}
1833 @section Pragma Assume
1836 Syntax:
1838 @example
1839 pragma Assume (
1840   boolean_EXPRESSION
1841   [, string_EXPRESSION]);
1842 @end example
1844 The effect of this pragma is identical to that of pragma @cite{Assert},
1845 except that in an @cite{Assertion_Policy} pragma, the identifier
1846 @cite{Assume} is used to control whether it is ignored or checked
1847 (or disabled).
1849 The intention is that this be used for assumptions about the
1850 external environment. So you cannot expect to verify formally
1851 or informally that the condition is met, this must be
1852 established by examining things outside the program itself.
1853 For example, we may have code that depends on the size of
1854 @cite{Long_Long_Integer} being at least 64. So we could write:
1856 @example
1857 pragma Assume (Long_Long_Integer'Size >= 64);
1858 @end example
1860 This assumption cannot be proved from the program itself,
1861 but it acts as a useful run-time check that the assumption
1862 is met, and documents the need to ensure that it is met by
1863 reference to information outside the program.
1865 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1866 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2b}
1867 @section Pragma Assume_No_Invalid_Values
1870 @geindex Invalid representations
1872 @geindex Invalid values
1874 Syntax:
1876 @example
1877 pragma Assume_No_Invalid_Values (On | Off);
1878 @end example
1880 This is a configuration pragma that controls the assumptions made by the
1881 compiler about the occurrence of invalid representations (invalid values)
1882 in the code.
1884 The default behavior (corresponding to an Off argument for this pragma), is
1885 to assume that values may in general be invalid unless the compiler can
1886 prove they are valid. Consider the following example:
1888 @example
1889 V1 : Integer range 1 .. 10;
1890 V2 : Integer range 11 .. 20;
1892 for J in V2 .. V1 loop
1893    ...
1894 end loop;
1895 @end example
1897 if V1 and V2 have valid values, then the loop is known at compile
1898 time not to execute since the lower bound must be greater than the
1899 upper bound. However in default mode, no such assumption is made,
1900 and the loop may execute. If @cite{Assume_No_Invalid_Values (On)}
1901 is given, the compiler will assume that any occurrence of a variable
1902 other than in an explicit @cite{'Valid} test always has a valid
1903 value, and the loop above will be optimized away.
1905 The use of @cite{Assume_No_Invalid_Values (On)} is appropriate if
1906 you know your code is free of uninitialized variables and other
1907 possible sources of invalid representations, and may result in
1908 more efficient code. A program that accesses an invalid representation
1909 with this pragma in effect is erroneous, so no guarantees can be made
1910 about its behavior.
1912 It is peculiar though permissible to use this pragma in conjunction
1913 with validity checking (-gnatVa). In such cases, accessing invalid
1914 values will generally give an exception, though formally the program
1915 is erroneous so there are no guarantees that this will always be the
1916 case, and it is recommended that these two options not be used together.
1918 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
1919 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{2c}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2d}
1920 @section Pragma Async_Readers
1923 Syntax:
1925 @example
1926 pragma Asynch_Readers [ (boolean_EXPRESSION) ];
1927 @end example
1929 For the semantics of this pragma, see the entry for aspect @cite{Async_Readers} in
1930 the SPARK 2014 Reference Manual, section 7.1.2.
1932 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
1933 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{2e}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{2f}
1934 @section Pragma Async_Writers
1937 Syntax:
1939 @example
1940 pragma Asynch_Writers [ (boolean_EXPRESSION) ];
1941 @end example
1943 For the semantics of this pragma, see the entry for aspect @cite{Async_Writers} in
1944 the SPARK 2014 Reference Manual, section 7.1.2.
1946 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
1947 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{30}
1948 @section Pragma Attribute_Definition
1951 Syntax:
1953 @example
1954 pragma Attribute_Definition
1955   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1956    [Entity     =>] LOCAL_NAME,
1957    [Expression =>] EXPRESSION | NAME);
1958 @end example
1960 If @cite{Attribute} is a known attribute name, this pragma is equivalent to
1961 the attribute definition clause:
1963 @example
1964 for Entity'Attribute use Expression;
1965 @end example
1967 If @cite{Attribute} is not a recognized attribute name, the pragma is
1968 ignored, and a warning is emitted. This allows source
1969 code to be written that takes advantage of some new attribute, while remaining
1970 compilable with earlier compilers.
1972 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
1973 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{31}
1974 @section Pragma C_Pass_By_Copy
1977 @geindex Passing by copy
1979 Syntax:
1981 @example
1982 pragma C_Pass_By_Copy
1983   ([Max_Size =>] static_integer_EXPRESSION);
1984 @end example
1986 Normally the default mechanism for passing C convention records to C
1987 convention subprograms is to pass them by reference, as suggested by RM
1988 B.3(69).  Use the configuration pragma @cite{C_Pass_By_Copy} to change
1989 this default, by requiring that record formal parameters be passed by
1990 copy if all of the following conditions are met:
1993 @itemize *
1995 @item 
1996 The size of the record type does not exceed the value specified for
1997 @cite{Max_Size}.
1999 @item 
2000 The record type has @cite{Convention C}.
2002 @item 
2003 The formal parameter has this record type, and the subprogram has a
2004 foreign (non-Ada) convention.
2005 @end itemize
2007 If these conditions are met the argument is passed by copy; i.e., in a
2008 manner consistent with what C expects if the corresponding formal in the
2009 C prototype is a struct (rather than a pointer to a struct).
2011 You can also pass records by copy by specifying the convention
2012 @cite{C_Pass_By_Copy} for the record type, or by using the extended
2013 @cite{Import} and @cite{Export} pragmas, which allow specification of
2014 passing mechanisms on a parameter by parameter basis.
2016 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2017 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{32}
2018 @section Pragma Check
2021 @geindex Assertions
2023 @geindex Named assertions
2025 Syntax:
2027 @example
2028 pragma Check (
2029      [Name    =>] CHECK_KIND,
2030      [Check   =>] Boolean_EXPRESSION
2031   [, [Message =>] string_EXPRESSION] );
2033 CHECK_KIND ::= IDENTIFIER           |
2034                Pre'Class            |
2035                Post'Class           |
2036                Type_Invariant'Class |
2037                Invariant'Class
2038 @end example
2040 This pragma is similar to the predefined pragma @cite{Assert} except that an
2041 extra identifier argument is present. In conjunction with pragma
2042 @cite{Check_Policy}, this can be used to define groups of assertions that can
2043 be independently controlled. The identifier @cite{Assertion} is special, it
2044 refers to the normal set of pragma @cite{Assert} statements.
2046 Checks introduced by this pragma are normally deactivated by default. They can
2047 be activated either by the command line option @emph{-gnata}, which turns on
2048 all checks, or individually controlled using pragma @cite{Check_Policy}.
2050 The identifiers @cite{Assertions} and @cite{Statement_Assertions} are not
2051 permitted as check kinds, since this would cause confusion with the use
2052 of these identifiers in @cite{Assertion_Policy} and @cite{Check_Policy}
2053 pragmas, where they are used to refer to sets of assertions.
2055 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2056 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{33}
2057 @section Pragma Check_Float_Overflow
2060 @geindex Floating-point overflow
2062 Syntax:
2064 @example
2065 pragma Check_Float_Overflow;
2066 @end example
2068 In Ada, the predefined floating-point types (@cite{Short_Float},
2069 @cite{Float}, @cite{Long_Float}, @cite{Long_Long_Float}) are
2070 defined to be @emph{unconstrained}. This means that even though each
2071 has a well-defined base range, an operation that delivers a result
2072 outside this base range is not required to raise an exception.
2073 This implementation permission accommodates the notion
2074 of infinities in IEEE floating-point, and corresponds to the
2075 efficient execution mode on most machines. GNAT will not raise
2076 overflow exceptions on these machines; instead it will generate
2077 infinities and NaN's as defined in the IEEE standard.
2079 Generating infinities, although efficient, is not always desirable.
2080 Often the preferable approach is to check for overflow, even at the
2081 (perhaps considerable) expense of run-time performance.
2082 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2083 range constraints -- and indeed such a subtype
2084 can have the same base range as its base type. For example:
2086 @example
2087 subtype My_Float is Float range Float'Range;
2088 @end example
2090 Here @cite{My_Float} has the same range as
2091 @cite{Float} but is constrained, so operations on
2092 @cite{My_Float} values will be checked for overflow
2093 against this range.
2095 This style will achieve the desired goal, but
2096 it is often more convenient to be able to simply use
2097 the standard predefined floating-point types as long
2098 as overflow checking could be guaranteed.
2099 The @cite{Check_Float_Overflow}
2100 configuration pragma achieves this effect. If a unit is compiled
2101 subject to this configuration pragma, then all operations
2102 on predefined floating-point types including operations on
2103 base types of these floating-point types will be treated as
2104 though those types were constrained, and overflow checks
2105 will be generated. The @cite{Constraint_Error}
2106 exception is raised if the result is out of range.
2108 This mode can also be set by use of the compiler
2109 switch @emph{-gnateF}.
2111 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2112 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{34}
2113 @section Pragma Check_Name
2116 @geindex Defining check names
2118 @geindex Check names
2119 @geindex defining
2121 Syntax:
2123 @example
2124 pragma Check_Name (check_name_IDENTIFIER);
2125 @end example
2127 This is a configuration pragma that defines a new implementation
2128 defined check name (unless IDENTIFIER matches one of the predefined
2129 check names, in which case the pragma has no effect). Check names
2130 are global to a partition, so if two or more configuration pragmas
2131 are present in a partition mentioning the same name, only one new
2132 check name is introduced.
2134 An implementation defined check name introduced with this pragma may
2135 be used in only three contexts: @cite{pragma Suppress},
2136 @cite{pragma Unsuppress},
2137 and as the prefix of a @cite{Check_Name'Enabled} attribute reference. For
2138 any of these three cases, the check name must be visible. A check
2139 name is visible if it is in the configuration pragmas applying to
2140 the current unit, or if it appears at the start of any unit that
2141 is part of the dependency set of the current unit (e.g., units that
2142 are mentioned in @cite{with} clauses).
2144 Check names introduced by this pragma are subject to control by compiler
2145 switches (in particular -gnatp) in the usual manner.
2147 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2148 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{35}
2149 @section Pragma Check_Policy
2152 @geindex Controlling assertions
2154 @geindex Assertions
2155 @geindex control
2157 @geindex Check pragma control
2159 @geindex Named assertions
2161 Syntax:
2163 @example
2164 pragma Check_Policy
2165  ([Name   =>] CHECK_KIND,
2166   [Policy =>] POLICY_IDENTIFIER);
2168 pragma Check_Policy (
2169     CHECK_KIND => POLICY_IDENTIFIER
2170  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2172 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2174 CHECK_KIND ::= IDENTIFIER           |
2175                Pre'Class            |
2176                Post'Class           |
2177                Type_Invariant'Class |
2178                Invariant'Class
2180 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2181 avoids confusion between the two possible syntax forms for this pragma.
2183 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2184 @end example
2186 This pragma is used to set the checking policy for assertions (specified
2187 by aspects or pragmas), the @cite{Debug} pragma, or additional checks
2188 to be checked using the @cite{Check} pragma. It may appear either as
2189 a configuration pragma, or within a declarative part of package. In the
2190 latter case, it applies from the point where it appears to the end of
2191 the declarative region (like pragma @cite{Suppress}).
2193 The @cite{Check_Policy} pragma is similar to the
2194 predefined @cite{Assertion_Policy} pragma,
2195 and if the check kind corresponds to one of the assertion kinds that
2196 are allowed by @cite{Assertion_Policy}, then the effect is identical.
2198 If the first argument is Debug, then the policy applies to Debug pragmas,
2199 disabling their effect if the policy is @cite{OFF}, @cite{DISABLE}, or
2200 @cite{IGNORE}, and allowing them to execute with normal semantics if
2201 the policy is @cite{ON} or @cite{CHECK}. In addition if the policy is
2202 @cite{DISABLE}, then the procedure call in @cite{Debug} pragmas will
2203 be totally ignored and not analyzed semantically.
2205 Finally the first argument may be some other identifier than the above
2206 possibilities, in which case it controls a set of named assertions
2207 that can be checked using pragma @cite{Check}. For example, if the pragma:
2209 @example
2210 pragma Check_Policy (Critical_Error, OFF);
2211 @end example
2213 is given, then subsequent @cite{Check} pragmas whose first argument is also
2214 @cite{Critical_Error} will be disabled.
2216 The check policy is @cite{OFF} to turn off corresponding checks, and @cite{ON}
2217 to turn on corresponding checks. The default for a set of checks for which no
2218 @cite{Check_Policy} is given is @cite{OFF} unless the compiler switch
2219 @emph{-gnata} is given, which turns on all checks by default.
2221 The check policy settings @cite{CHECK} and @cite{IGNORE} are recognized
2222 as synonyms for @cite{ON} and @cite{OFF}. These synonyms are provided for
2223 compatibility with the standard @cite{Assertion_Policy} pragma. The check
2224 policy setting @cite{DISABLE} causes the second argument of a corresponding
2225 @cite{Check} pragma to be completely ignored and not analyzed.
2227 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2228 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{36}
2229 @section Pragma Comment
2232 Syntax:
2234 @example
2235 pragma Comment (static_string_EXPRESSION);
2236 @end example
2238 This is almost identical in effect to pragma @cite{Ident}.  It allows the
2239 placement of a comment into the object file and hence into the
2240 executable file if the operating system permits such usage.  The
2241 difference is that @cite{Comment}, unlike @cite{Ident}, has
2242 no limitations on placement of the pragma (it can be placed
2243 anywhere in the main source unit), and if more than one pragma
2244 is used, all comments are retained.
2246 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2247 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{37}
2248 @section Pragma Common_Object
2251 Syntax:
2253 @example
2254 pragma Common_Object (
2255      [Internal =>] LOCAL_NAME
2256   [, [External =>] EXTERNAL_SYMBOL]
2257   [, [Size     =>] EXTERNAL_SYMBOL] );
2259 EXTERNAL_SYMBOL ::=
2260   IDENTIFIER
2261 | static_string_EXPRESSION
2262 @end example
2264 This pragma enables the shared use of variables stored in overlaid
2265 linker areas corresponding to the use of @cite{COMMON}
2266 in Fortran.  The single
2267 object @cite{LOCAL_NAME} is assigned to the area designated by
2268 the @cite{External} argument.
2269 You may define a record to correspond to a series
2270 of fields.  The @cite{Size} argument
2271 is syntax checked in GNAT, but otherwise ignored.
2273 @cite{Common_Object} is not supported on all platforms.  If no
2274 support is available, then the code generator will issue a message
2275 indicating that the necessary attribute for implementation of this
2276 pragma is not available.
2278 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2279 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{38}
2280 @section Pragma Compile_Time_Error
2283 Syntax:
2285 @example
2286 pragma Compile_Time_Error
2287          (boolean_EXPRESSION, static_string_EXPRESSION);
2288 @end example
2290 This pragma can be used to generate additional compile time
2291 error messages. It
2292 is particularly useful in generics, where errors can be issued for
2293 specific problematic instantiations. The first parameter is a boolean
2294 expression. The pragma is effective only if the value of this expression
2295 is known at compile time, and has the value True. The set of expressions
2296 whose values are known at compile time includes all static boolean
2297 expressions, and also other values which the compiler can determine
2298 at compile time (e.g., the size of a record type set by an explicit
2299 size representation clause, or the value of a variable which was
2300 initialized to a constant and is known not to have been modified).
2301 If these conditions are met, an error message is generated using
2302 the value given as the second argument. This string value may contain
2303 embedded ASCII.LF characters to break the message into multiple lines.
2305 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2306 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{39}
2307 @section Pragma Compile_Time_Warning
2310 Syntax:
2312 @example
2313 pragma Compile_Time_Warning
2314          (boolean_EXPRESSION, static_string_EXPRESSION);
2315 @end example
2317 Same as pragma Compile_Time_Error, except a warning is issued instead
2318 of an error message. Note that if this pragma is used in a package that
2319 is with'ed by a client, the client will get the warning even though it
2320 is issued by a with'ed package (normally warnings in with'ed units are
2321 suppressed, but this is a special exception to that rule).
2323 One typical use is within a generic where compile time known characteristics
2324 of formal parameters are tested, and warnings given appropriately. Another use
2325 with a first parameter of True is to warn a client about use of a package,
2326 for example that it is not fully implemented.
2328 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2329 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3a}
2330 @section Pragma Compiler_Unit
2333 Syntax:
2335 @example
2336 pragma Compiler_Unit;
2337 @end example
2339 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2340 retained so that old versions of the GNAT run-time that use this pragma can
2341 be compiled with newer versions of the compiler.
2343 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2344 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{3b}
2345 @section Pragma Compiler_Unit_Warning
2348 Syntax:
2350 @example
2351 pragma Compiler_Unit_Warning;
2352 @end example
2354 This pragma is intended only for internal use in the GNAT run-time library.
2355 It indicates that the unit is used as part of the compiler build. The effect
2356 is to generate warnings for the use of constructs (for example, conditional
2357 expressions) that would cause trouble when bootstrapping using an older
2358 version of GNAT. For the exact list of restrictions, see the compiler sources
2359 and references to Check_Compiler_Unit.
2361 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2362 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{3c}
2363 @section Pragma Complete_Representation
2366 Syntax:
2368 @example
2369 pragma Complete_Representation;
2370 @end example
2372 This pragma must appear immediately within a record representation
2373 clause. Typical placements are before the first component clause
2374 or after the last component clause. The effect is to give an error
2375 message if any component is missing a component clause. This pragma
2376 may be used to ensure that a record representation clause is
2377 complete, and that this invariant is maintained if fields are
2378 added to the record in the future.
2380 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2381 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3d}
2382 @section Pragma Complex_Representation
2385 Syntax:
2387 @example
2388 pragma Complex_Representation
2389         ([Entity =>] LOCAL_NAME);
2390 @end example
2392 The @cite{Entity} argument must be the name of a record type which has
2393 two fields of the same floating-point type.  The effect of this pragma is
2394 to force gcc to use the special internal complex representation form for
2395 this record, which may be more efficient.  Note that this may result in
2396 the code for this type not conforming to standard ABI (application
2397 binary interface) requirements for the handling of record types.  For
2398 example, in some environments, there is a requirement for passing
2399 records by pointer, and the use of this pragma may result in passing
2400 this type in floating-point registers.
2402 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2403 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{3e}
2404 @section Pragma Component_Alignment
2407 @geindex Alignments of components
2409 @geindex Pragma Component_Alignment
2411 Syntax:
2413 @example
2414 pragma Component_Alignment (
2415      [Form =>] ALIGNMENT_CHOICE
2416   [, [Name =>] type_LOCAL_NAME]);
2418 ALIGNMENT_CHOICE ::=
2419   Component_Size
2420 | Component_Size_4
2421 | Storage_Unit
2422 | Default
2423 @end example
2425 Specifies the alignment of components in array or record types.
2426 The meaning of the @cite{Form} argument is as follows:
2428 @quotation
2430 @geindex Component_Size (in pragma Component_Alignment)
2431 @end quotation
2434 @table @asis
2436 @item @emph{Component_Size}
2438 Aligns scalar components and subcomponents of the array or record type
2439 on boundaries appropriate to their inherent size (naturally
2440 aligned).  For example, 1-byte components are aligned on byte boundaries,
2441 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2442 integer components are aligned on 4-byte boundaries and so on.  These
2443 alignment rules correspond to the normal rules for C compilers on all
2444 machines except the VAX.
2446 @geindex Component_Size_4 (in pragma Component_Alignment)
2448 @item @emph{Component_Size_4}
2450 Naturally aligns components with a size of four or fewer
2451 bytes.  Components that are larger than 4 bytes are placed on the next
2452 4-byte boundary.
2454 @geindex Storage_Unit (in pragma Component_Alignment)
2456 @item @emph{Storage_Unit}
2458 Specifies that array or record components are byte aligned, i.e.,
2459 aligned on boundaries determined by the value of the constant
2460 @cite{System.Storage_Unit}.
2462 @geindex Default (in pragma Component_Alignment)
2464 @item @emph{Default}
2466 Specifies that array or record components are aligned on default
2467 boundaries, appropriate to the underlying hardware or operating system or
2468 both. The @cite{Default} choice is the same as @cite{Component_Size} (natural
2469 alignment).
2470 @end table
2472 If the @cite{Name} parameter is present, @cite{type_LOCAL_NAME} must
2473 refer to a local record or array type, and the specified alignment
2474 choice applies to the specified type.  The use of
2475 @cite{Component_Alignment} together with a pragma @cite{Pack} causes the
2476 @cite{Component_Alignment} pragma to be ignored.  The use of
2477 @cite{Component_Alignment} together with a record representation clause
2478 is only effective for fields not specified by the representation clause.
2480 If the @cite{Name} parameter is absent, the pragma can be used as either
2481 a configuration pragma, in which case it applies to one or more units in
2482 accordance with the normal rules for configuration pragmas, or it can be
2483 used within a declarative part, in which case it applies to types that
2484 are declared within this declarative part, or within any nested scope
2485 within this declarative part.  In either case it specifies the alignment
2486 to be applied to any record or array type which has otherwise standard
2487 representation.
2489 If the alignment for a record or array type is not specified (using
2490 pragma @cite{Pack}, pragma @cite{Component_Alignment}, or a record rep
2491 clause), the GNAT uses the default alignment as described previously.
2493 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2494 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{3f}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{40}
2495 @section Pragma Constant_After_Elaboration
2498 Syntax:
2500 @example
2501 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2502 @end example
2504 For the semantics of this pragma, see the entry for aspect
2505 @cite{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2507 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2508 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{41}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{42}
2509 @section Pragma Contract_Cases
2512 @geindex Contract cases
2514 Syntax:
2516 @example
2517 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2519 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2521 CASE_GUARD ::= boolean_EXPRESSION | others
2523 CONSEQUENCE ::= boolean_EXPRESSION
2524 @end example
2526 The @cite{Contract_Cases} pragma allows defining fine-grain specifications
2527 that can complement or replace the contract given by a precondition and a
2528 postcondition. Additionally, the @cite{Contract_Cases} pragma can be used
2529 by testing and formal verification tools. The compiler checks its validity and,
2530 depending on the assertion policy at the point of declaration of the pragma,
2531 it may insert a check in the executable. For code generation, the contract
2532 cases
2534 @example
2535 pragma Contract_Cases (
2536   Cond1 => Pred1,
2537   Cond2 => Pred2);
2538 @end example
2540 are equivalent to
2542 @example
2543 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2544 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2545 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2546 pragma Postcondition (if C1 then Pred1);
2547 pragma Postcondition (if C2 then Pred2);
2548 @end example
2550 The precondition ensures that one and only one of the conditions is
2551 satisfied on entry to the subprogram.
2552 The postcondition ensures that for the condition that was True on entry,
2553 the corrresponding consequence is True on exit. Other consequence expressions
2554 are not evaluated.
2556 A precondition @cite{P} and postcondition @cite{Q} can also be
2557 expressed as contract cases:
2559 @example
2560 pragma Contract_Cases (P => Q);
2561 @end example
2563 The placement and visibility rules for @cite{Contract_Cases} pragmas are
2564 identical to those described for preconditions and postconditions.
2566 The compiler checks that boolean expressions given in conditions and
2567 consequences are valid, where the rules for conditions are the same as
2568 the rule for an expression in @cite{Precondition} and the rules for
2569 consequences are the same as the rule for an expression in
2570 @cite{Postcondition}. In particular, attributes @cite{'Old} and
2571 @cite{'Result} can only be used within consequence expressions.
2572 The condition for the last contract case may be @cite{others}, to denote
2573 any case not captured by the previous cases. The
2574 following is an example of use within a package spec:
2576 @example
2577 package Math_Functions is
2578    ...
2579    function Sqrt (Arg : Float) return Float;
2580    pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2581                            Arg >= 100.0         => Sqrt'Result >= 10.0,
2582                            others               => Sqrt'Result = 0.0));
2583    ...
2584 end Math_Functions;
2585 @end example
2587 The meaning of contract cases is that only one case should apply at each
2588 call, as determined by the corresponding condition evaluating to True,
2589 and that the consequence for this case should hold when the subprogram
2590 returns.
2592 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2593 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{43}
2594 @section Pragma Convention_Identifier
2597 @geindex Conventions
2598 @geindex synonyms
2600 Syntax:
2602 @example
2603 pragma Convention_Identifier (
2604          [Name =>]       IDENTIFIER,
2605          [Convention =>] convention_IDENTIFIER);
2606 @end example
2608 This pragma provides a mechanism for supplying synonyms for existing
2609 convention identifiers. The @cite{Name} identifier can subsequently
2610 be used as a synonym for the given convention in other pragmas (including
2611 for example pragma @cite{Import} or another @cite{Convention_Identifier}
2612 pragma). As an example of the use of this, suppose you had legacy code
2613 which used Fortran77 as the identifier for Fortran. Then the pragma:
2615 @example
2616 pragma Convention_Identifier (Fortran77, Fortran);
2617 @end example
2619 would allow the use of the convention identifier @cite{Fortran77} in
2620 subsequent code, avoiding the need to modify the sources. As another
2621 example, you could use this to parameterize convention requirements
2622 according to systems. Suppose you needed to use @cite{Stdcall} on
2623 windows systems, and @cite{C} on some other system, then you could
2624 define a convention identifier @cite{Library} and use a single
2625 @cite{Convention_Identifier} pragma to specify which convention
2626 would be used system-wide.
2628 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2629 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{44}
2630 @section Pragma CPP_Class
2633 @geindex Interfacing with C++
2635 Syntax:
2637 @example
2638 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2639 @end example
2641 The argument denotes an entity in the current declarative region that is
2642 declared as a record type. It indicates that the type corresponds to an
2643 externally declared C++ class type, and is to be laid out the same way
2644 that C++ would lay out the type. If the C++ class has virtual primitives
2645 then the record must be declared as a tagged record type.
2647 Types for which @cite{CPP_Class} is specified do not have assignment or
2648 equality operators defined (such operations can be imported or declared
2649 as subprograms as required). Initialization is allowed only by constructor
2650 functions (see pragma @cite{CPP_Constructor}). Such types are implicitly
2651 limited if not explicitly declared as limited or derived from a limited
2652 type, and an error is issued in that case.
2654 See @ref{45,,Interfacing to C++} for related information.
2656 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
2657 for backward compatibility but its functionality is available
2658 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
2660 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2661 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{46}
2662 @section Pragma CPP_Constructor
2665 @geindex Interfacing with C++
2667 Syntax:
2669 @example
2670 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2671   [, [External_Name =>] static_string_EXPRESSION ]
2672   [, [Link_Name     =>] static_string_EXPRESSION ]);
2673 @end example
2675 This pragma identifies an imported function (imported in the usual way
2676 with pragma @cite{Import}) as corresponding to a C++ constructor. If
2677 @cite{External_Name} and @cite{Link_Name} are not specified then the
2678 @cite{Entity} argument is a name that must have been previously mentioned
2679 in a pragma @cite{Import} with @cite{Convention} = @cite{CPP}. Such name
2680 must be of one of the following forms:
2683 @itemize *
2685 @item 
2686 @strong{function} @cite{Fname} @strong{return} T`
2688 @item 
2689 @strong{function} @cite{Fname} @strong{return} T'Class
2691 @item 
2692 @strong{function} @cite{Fname} (...) @strong{return} T`
2694 @item 
2695 @strong{function} @cite{Fname} (...) @strong{return} T'Class
2696 @end itemize
2698 where @cite{T} is a limited record type imported from C++ with pragma
2699 @cite{Import} and @cite{Convention} = @cite{CPP}.
2701 The first two forms import the default constructor, used when an object
2702 of type @cite{T} is created on the Ada side with no explicit constructor.
2703 The latter two forms cover all the non-default constructors of the type.
2704 See the GNAT User's Guide for details.
2706 If no constructors are imported, it is impossible to create any objects
2707 on the Ada side and the type is implicitly declared abstract.
2709 Pragma @cite{CPP_Constructor} is intended primarily for automatic generation
2710 using an automatic binding generator tool (such as the @cite{-fdump-ada-spec}
2711 GCC switch).
2712 See @ref{45,,Interfacing to C++} for more related information.
2714 Note: The use of functions returning class-wide types for constructors is
2715 currently obsolete. They are supported for backward compatibility. The
2716 use of functions returning the type T leave the Ada sources more clear
2717 because the imported C++ constructors always return an object of type T;
2718 that is, they never return an object whose type is a descendant of type T.
2720 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2721 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{47}
2722 @section Pragma CPP_Virtual
2725 @geindex Interfacing to C++
2727 This pragma is now obsolete and, other than generating a warning if warnings
2728 on obsolescent features are enabled, is completely ignored.
2729 It is retained for compatibility
2730 purposes. It used to be required to ensure compoatibility with C++, but
2731 is no longer required for that purpose because GNAT generates
2732 the same object layout as the G++ compiler by default.
2734 See @ref{45,,Interfacing to C++} for related information.
2736 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2737 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{48}
2738 @section Pragma CPP_Vtable
2741 @geindex Interfacing with C++
2743 This pragma is now obsolete and, other than generating a warning if warnings
2744 on obsolescent features are enabled, is completely ignored.
2745 It used to be required to ensure compatibility with C++, but
2746 is no longer required for that purpose because GNAT generates
2747 the same object layout as the G++ compiler by default.
2749 See @ref{45,,Interfacing to C++} for related information.
2751 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2752 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{49}
2753 @section Pragma CPU
2756 Syntax:
2758 @example
2759 pragma CPU (EXPRESSION);
2760 @end example
2762 This pragma is standard in Ada 2012, but is available in all earlier
2763 versions of Ada as an implementation-defined pragma.
2764 See Ada 2012 Reference Manual for details.
2766 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2767 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4a}
2768 @section Pragma Deadline_Floor
2771 Syntax:
2773 @example
2774 pragma Deadline_Floor (time_span_EXPRESSION);
2775 @end example
2777 This pragma applies only to protected types and specifies the floor
2778 deadline inherited by a task when the task enters a protected object.
2779 It is effective only when the EDF scheduling policy is used.
2781 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2782 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4b}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{4c}
2783 @section Pragma Default_Initial_Condition
2786 Syntax:
2788 @example
2789 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2790 @end example
2792 For the semantics of this pragma, see the entry for aspect
2793 @cite{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2795 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2796 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4d}
2797 @section Pragma Debug
2800 Syntax:
2802 @example
2803 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2805 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2806   PROCEDURE_NAME
2807 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2808 @end example
2810 The procedure call argument has the syntactic form of an expression, meeting
2811 the syntactic requirements for pragmas.
2813 If debug pragmas are not enabled or if the condition is present and evaluates
2814 to False, this pragma has no effect. If debug pragmas are enabled, the
2815 semantics of the pragma is exactly equivalent to the procedure call statement
2816 corresponding to the argument with a terminating semicolon. Pragmas are
2817 permitted in sequences of declarations, so you can use pragma @cite{Debug} to
2818 intersperse calls to debug procedures in the middle of declarations. Debug
2819 pragmas can be enabled either by use of the command line switch @emph{-gnata}
2820 or by use of the pragma @cite{Check_Policy} with a first argument of
2821 @cite{Debug}.
2823 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2824 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{4e}
2825 @section Pragma Debug_Policy
2828 Syntax:
2830 @example
2831 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2832 @end example
2834 This pragma is equivalent to a corresponding @cite{Check_Policy} pragma
2835 with a first argument of @cite{Debug}. It is retained for historical
2836 compatibility reasons.
2838 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2839 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{4f}
2840 @section Pragma Default_Scalar_Storage_Order
2843 @geindex Default_Scalar_Storage_Order
2845 @geindex Scalar_Storage_Order
2847 Syntax:
2849 @example
2850 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2851 @end example
2853 Normally if no explicit @cite{Scalar_Storage_Order} is given for a record
2854 type or array type, then the scalar storage order defaults to the ordinary
2855 default for the target. But this default may be overridden using this pragma.
2856 The pragma may appear as a configuration pragma, or locally within a package
2857 spec or declarative part. In the latter case, it applies to all subsequent
2858 types declared within that package spec or declarative part.
2860 The following example shows the use of this pragma:
2862 @example
2863 pragma Default_Scalar_Storage_Order (High_Order_First);
2864 with System; use System;
2865 package DSSO1 is
2866    type H1 is record
2867       a : Integer;
2868    end record;
2870    type L2 is record
2871       a : Integer;
2872    end record;
2873    for L2'Scalar_Storage_Order use Low_Order_First;
2875    type L2a is new L2;
2877    package Inner is
2878       type H3 is record
2879          a : Integer;
2880       end record;
2882       pragma Default_Scalar_Storage_Order (Low_Order_First);
2884       type L4 is record
2885          a : Integer;
2886       end record;
2887    end Inner;
2889    type H4a is new Inner.L4;
2891    type H5 is record
2892       a : Integer;
2893    end record;
2894 end DSSO1;
2895 @end example
2897 In this example record types L.. have @cite{Low_Order_First} scalar
2898 storage order, and record types H.. have @cite{High_Order_First}.
2899 Note that in the case of @cite{H4a}, the order is not inherited
2900 from the parent type. Only an explicitly set @cite{Scalar_Storage_Order}
2901 gets inherited on type derivation.
2903 If this pragma is used as a configuration pragma which appears within a
2904 configuration pragma file (as opposed to appearing explicitly at the start
2905 of a single unit), then the binder will require that all units in a partition
2906 be compiled in a similar manner, other than run-time units, which are not
2907 affected by this pragma. Note that the use of this form is discouraged because
2908 it may significantly degrade the run-time performance of the software, instead
2909 the default scalar storage order ought to be changed only on a local basis.
2911 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2912 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{50}
2913 @section Pragma Default_Storage_Pool
2916 @geindex Default_Storage_Pool
2918 Syntax:
2920 @example
2921 pragma Default_Storage_Pool (storage_pool_NAME | null);
2922 @end example
2924 This pragma is standard in Ada 2012, but is available in all earlier
2925 versions of Ada as an implementation-defined pragma.
2926 See Ada 2012 Reference Manual for details.
2928 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
2929 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{51}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{52}
2930 @section Pragma Depends
2933 Syntax:
2935 @example
2936 pragma Depends (DEPENDENCY_RELATION);
2938 DEPENDENCY_RELATION ::=
2939      null
2940   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
2942 DEPENDENCY_CLAUSE ::=
2943     OUTPUT_LIST =>[+] INPUT_LIST
2944   | NULL_DEPENDENCY_CLAUSE
2946 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
2948 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
2950 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
2952 OUTPUT ::= NAME | FUNCTION_RESULT
2953 INPUT  ::= NAME
2955 where FUNCTION_RESULT is a function Result attribute_reference
2956 @end example
2958 For the semantics of this pragma, see the entry for aspect @cite{Depends} in the
2959 SPARK 2014 Reference Manual, section 6.1.5.
2961 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
2962 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{53}
2963 @section Pragma Detect_Blocking
2966 Syntax:
2968 @example
2969 pragma Detect_Blocking;
2970 @end example
2972 This is a standard pragma in Ada 2005, that is available in all earlier
2973 versions of Ada as an implementation-defined pragma.
2975 This is a configuration pragma that forces the detection of potentially
2976 blocking operations within a protected operation, and to raise Program_Error
2977 if that happens.
2979 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
2980 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{54}
2981 @section Pragma Disable_Atomic_Synchronization
2984 @geindex Atomic Synchronization
2986 Syntax:
2988 @example
2989 pragma Disable_Atomic_Synchronization [(Entity)];
2990 @end example
2992 Ada requires that accesses (reads or writes) of an atomic variable be
2993 regarded as synchronization points in the case of multiple tasks.
2994 Particularly in the case of multi-processors this may require special
2995 handling, e.g. the generation of memory barriers. This capability may
2996 be turned off using this pragma in cases where it is known not to be
2997 required.
2999 The placement and scope rules for this pragma are the same as those
3000 for @cite{pragma Suppress}. In particular it can be used as a
3001 configuration  pragma, or in a declaration sequence where it applies
3002 till the end of the scope. If an @cite{Entity} argument is present,
3003 the action applies only to that entity.
3005 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3006 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{55}
3007 @section Pragma Dispatching_Domain
3010 Syntax:
3012 @example
3013 pragma Dispatching_Domain (EXPRESSION);
3014 @end example
3016 This pragma is standard in Ada 2012, but is available in all earlier
3017 versions of Ada as an implementation-defined pragma.
3018 See Ada 2012 Reference Manual for details.
3020 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3021 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{56}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{57}
3022 @section Pragma Effective_Reads
3025 Syntax:
3027 @example
3028 pragma Effective_Reads [ (boolean_EXPRESSION) ];
3029 @end example
3031 For the semantics of this pragma, see the entry for aspect @cite{Effective_Reads} in
3032 the SPARK 2014 Reference Manual, section 7.1.2.
3034 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3035 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{58}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{59}
3036 @section Pragma Effective_Writes
3039 Syntax:
3041 @example
3042 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3043 @end example
3045 For the semantics of this pragma, see the entry for aspect @cite{Effective_Writes}
3046 in the SPARK 2014 Reference Manual, section 7.1.2.
3048 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3049 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5a}
3050 @section Pragma Elaboration_Checks
3053 @geindex Elaboration control
3055 Syntax:
3057 @example
3058 pragma Elaboration_Checks (Dynamic | Static);
3059 @end example
3061 This is a configuration pragma that provides control over the
3062 elaboration model used by the compilation affected by the
3063 pragma.  If the parameter is @cite{Dynamic},
3064 then the dynamic elaboration
3065 model described in the Ada Reference Manual is used, as though
3066 the @emph{-gnatE} switch had been specified on the command
3067 line.  If the parameter is @cite{Static}, then the default GNAT static
3068 model is used.  This configuration pragma overrides the setting
3069 of the command line.  For full details on the elaboration models
3070 used by the GNAT compiler, see the chapter on elaboration order handling
3071 in the @emph{GNAT User's Guide}.
3073 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3074 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5b}
3075 @section Pragma Eliminate
3078 @geindex Elimination of unused subprograms
3080 Syntax:
3082 @example
3083 pragma Eliminate ([Entity          =>] DEFINING_DESIGNATOR,
3084                   [Source_Location =>] STRING_LITERAL);
3085 @end example
3087 The string literal given for the source location is a string which
3088 specifies the line number of the occurrence of the entity, using
3089 the syntax for SOURCE_TRACE given below:
3091 @example
3092 SOURCE_TRACE     ::= SOURCE_REFERENCE [LBRACKET SOURCE_TRACE RBRACKET]
3094 LBRACKET         ::= [
3095 RBRACKET         ::= ]
3097 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3099 LINE_NUMBER      ::= DIGIT @{DIGIT@}
3100 @end example
3102 Spaces around the colon in a @cite{Source_Reference} are optional.
3104 The @cite{DEFINING_DESIGNATOR} matches the defining designator used in an
3105 explicit subprogram declaration, where the @cite{entity} name in this
3106 designator appears on the source line specified by the source location.
3108 The source trace that is given as the @cite{Source_Location} shall obey the
3109 following rules. The @cite{FILE_NAME} is the short name (with no directory
3110 information) of an Ada source file, given using exactly the required syntax
3111 for the underlying file system (e.g. case is important if the underlying
3112 operating system is case sensitive). @cite{LINE_NUMBER} gives the line
3113 number of the occurrence of the @cite{entity}
3114 as a decimal literal without an exponent or point. If an @cite{entity} is not
3115 declared in a generic instantiation (this includes generic subprogram
3116 instances), the source trace includes only one source reference. If an entity
3117 is declared inside a generic instantiation, its source trace (when parsing
3118 from left to right) starts with the source location of the declaration of the
3119 entity in the generic unit and ends with the source location of the
3120 instantiation (it is given in square brackets). This approach is recursively
3121 used in case of nested instantiations: the rightmost (nested most deeply in
3122 square brackets) element of the source trace is the location of the outermost
3123 instantiation, the next to left element is the location of the next (first
3124 nested) instantiation in the code of the corresponding generic unit, and so
3125 on, and the leftmost element (that is out of any square brackets) is the
3126 location of the declaration of the entity to eliminate in a generic unit.
3128 Note that the @cite{Source_Location} argument specifies which of a set of
3129 similarly named entities is being eliminated, dealing both with overloading,
3130 and also appearance of the same entity name in different scopes.
3132 This pragma indicates that the given entity is not used in the program to be
3133 compiled and built. The effect of the pragma is to allow the compiler to
3134 eliminate the code or data associated with the named entity. Any reference to
3135 an eliminated entity causes a compile-time or link-time error.
3137 The intention of pragma @cite{Eliminate} is to allow a program to be compiled
3138 in a system-independent manner, with unused entities eliminated, without
3139 needing to modify the source text. Normally the required set of
3140 @cite{Eliminate} pragmas is constructed automatically using the gnatelim tool.
3142 Any source file change that removes, splits, or
3143 adds lines may make the set of Eliminate pragmas invalid because their
3144 @cite{Source_Location} argument values may get out of date.
3146 Pragma @cite{Eliminate} may be used where the referenced entity is a dispatching
3147 operation. In this case all the subprograms to which the given operation can
3148 dispatch are considered to be unused (are never called as a result of a direct
3149 or a dispatching call).
3151 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3152 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{5c}
3153 @section Pragma Enable_Atomic_Synchronization
3156 @geindex Atomic Synchronization
3158 Syntax:
3160 @example
3161 pragma Enable_Atomic_Synchronization [(Entity)];
3162 @end example
3164 Ada requires that accesses (reads or writes) of an atomic variable be
3165 regarded as synchronization points in the case of multiple tasks.
3166 Particularly in the case of multi-processors this may require special
3167 handling, e.g. the generation of memory barriers. This synchronization
3168 is performed by default, but can be turned off using
3169 @cite{pragma Disable_Atomic_Synchronization}. The
3170 @cite{Enable_Atomic_Synchronization} pragma can be used to turn
3171 it back on.
3173 The placement and scope rules for this pragma are the same as those
3174 for @cite{pragma Unsuppress}. In particular it can be used as a
3175 configuration  pragma, or in a declaration sequence where it applies
3176 till the end of the scope. If an @cite{Entity} argument is present,
3177 the action applies only to that entity.
3179 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3180 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{5d}
3181 @section Pragma Export_Function
3184 @geindex Argument passing mechanisms
3186 Syntax:
3188 @example
3189 pragma Export_Function (
3190      [Internal         =>] LOCAL_NAME
3191   [, [External         =>] EXTERNAL_SYMBOL]
3192   [, [Parameter_Types  =>] PARAMETER_TYPES]
3193   [, [Result_Type      =>] result_SUBTYPE_MARK]
3194   [, [Mechanism        =>] MECHANISM]
3195   [, [Result_Mechanism =>] MECHANISM_NAME]);
3197 EXTERNAL_SYMBOL ::=
3198   IDENTIFIER
3199 | static_string_EXPRESSION
3200 | ""
3202 PARAMETER_TYPES ::=
3203   null
3204 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3206 TYPE_DESIGNATOR ::=
3207   subtype_NAME
3208 | subtype_Name ' Access
3210 MECHANISM ::=
3211   MECHANISM_NAME
3212 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3214 MECHANISM_ASSOCIATION ::=
3215   [formal_parameter_NAME =>] MECHANISM_NAME
3217 MECHANISM_NAME ::= Value | Reference
3218 @end example
3220 Use this pragma to make a function externally callable and optionally
3221 provide information on mechanisms to be used for passing parameter and
3222 result values.  We recommend, for the purposes of improving portability,
3223 this pragma always be used in conjunction with a separate pragma
3224 @cite{Export}, which must precede the pragma @cite{Export_Function}.
3225 GNAT does not require a separate pragma @cite{Export}, but if none is
3226 present, @cite{Convention Ada} is assumed, which is usually
3227 not what is wanted, so it is usually appropriate to use this
3228 pragma in conjunction with a @cite{Export} or @cite{Convention}
3229 pragma that specifies the desired foreign convention.
3230 Pragma @cite{Export_Function}
3231 (and @cite{Export}, if present) must appear in the same declarative
3232 region as the function to which they apply.
3234 @cite{internal_name} must uniquely designate the function to which the
3235 pragma applies.  If more than one function name exists of this name in
3236 the declarative part you must use the @cite{Parameter_Types} and
3237 @cite{Result_Type} parameters is mandatory to achieve the required
3238 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
3239 anonymous access parameter.
3241 @geindex Suppressing external name
3243 Special treatment is given if the EXTERNAL is an explicit null
3244 string or a static string expressions that evaluates to the null
3245 string. In this case, no external name is generated. This form
3246 still allows the specification of parameter mechanisms.
3248 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3249 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{5e}
3250 @section Pragma Export_Object
3253 Syntax:
3255 @example
3256 pragma Export_Object
3257       [Internal =>] LOCAL_NAME
3258    [, [External =>] EXTERNAL_SYMBOL]
3259    [, [Size     =>] EXTERNAL_SYMBOL]
3261 EXTERNAL_SYMBOL ::=
3262   IDENTIFIER
3263 | static_string_EXPRESSION
3264 @end example
3266 This pragma designates an object as exported, and apart from the
3267 extended rules for external symbols, is identical in effect to the use of
3268 the normal @cite{Export} pragma applied to an object.  You may use a
3269 separate Export pragma (and you probably should from the point of view
3270 of portability), but it is not required.  @cite{Size} is syntax checked,
3271 but otherwise ignored by GNAT.
3273 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3274 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{5f}
3275 @section Pragma Export_Procedure
3278 Syntax:
3280 @example
3281 pragma Export_Procedure (
3282      [Internal        =>] LOCAL_NAME
3283   [, [External        =>] EXTERNAL_SYMBOL]
3284   [, [Parameter_Types =>] PARAMETER_TYPES]
3285   [, [Mechanism       =>] MECHANISM]);
3287 EXTERNAL_SYMBOL ::=
3288   IDENTIFIER
3289 | static_string_EXPRESSION
3290 | ""
3292 PARAMETER_TYPES ::=
3293   null
3294 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3296 TYPE_DESIGNATOR ::=
3297   subtype_NAME
3298 | subtype_Name ' Access
3300 MECHANISM ::=
3301   MECHANISM_NAME
3302 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3304 MECHANISM_ASSOCIATION ::=
3305   [formal_parameter_NAME =>] MECHANISM_NAME
3307 MECHANISM_NAME ::= Value | Reference
3308 @end example
3310 This pragma is identical to @cite{Export_Function} except that it
3311 applies to a procedure rather than a function and the parameters
3312 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
3313 GNAT does not require a separate pragma @cite{Export}, but if none is
3314 present, @cite{Convention Ada} is assumed, which is usually
3315 not what is wanted, so it is usually appropriate to use this
3316 pragma in conjunction with a @cite{Export} or @cite{Convention}
3317 pragma that specifies the desired foreign convention.
3319 @geindex Suppressing external name
3321 Special treatment is given if the EXTERNAL is an explicit null
3322 string or a static string expressions that evaluates to the null
3323 string. In this case, no external name is generated. This form
3324 still allows the specification of parameter mechanisms.
3326 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3327 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{60}
3328 @section Pragma Export_Value
3331 Syntax:
3333 @example
3334 pragma Export_Value (
3335   [Value     =>] static_integer_EXPRESSION,
3336   [Link_Name =>] static_string_EXPRESSION);
3337 @end example
3339 This pragma serves to export a static integer value for external use.
3340 The first argument specifies the value to be exported. The Link_Name
3341 argument specifies the symbolic name to be associated with the integer
3342 value. This pragma is useful for defining a named static value in Ada
3343 that can be referenced in assembly language units to be linked with
3344 the application. This pragma is currently supported only for the
3345 AAMP target and is ignored for other targets.
3347 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3348 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{61}
3349 @section Pragma Export_Valued_Procedure
3352 Syntax:
3354 @example
3355 pragma Export_Valued_Procedure (
3356      [Internal        =>] LOCAL_NAME
3357   [, [External        =>] EXTERNAL_SYMBOL]
3358   [, [Parameter_Types =>] PARAMETER_TYPES]
3359   [, [Mechanism       =>] MECHANISM]);
3361 EXTERNAL_SYMBOL ::=
3362   IDENTIFIER
3363 | static_string_EXPRESSION
3364 | ""
3366 PARAMETER_TYPES ::=
3367   null
3368 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3370 TYPE_DESIGNATOR ::=
3371   subtype_NAME
3372 | subtype_Name ' Access
3374 MECHANISM ::=
3375   MECHANISM_NAME
3376 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3378 MECHANISM_ASSOCIATION ::=
3379   [formal_parameter_NAME =>] MECHANISM_NAME
3381 MECHANISM_NAME ::= Value | Reference
3382 @end example
3384 This pragma is identical to @cite{Export_Procedure} except that the
3385 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
3386 mode @cite{OUT}, and externally the subprogram is treated as a function
3387 with this parameter as the result of the function.  GNAT provides for
3388 this capability to allow the use of @cite{OUT} and @cite{IN OUT}
3389 parameters in interfacing to external functions (which are not permitted
3390 in Ada functions).
3391 GNAT does not require a separate pragma @cite{Export}, but if none is
3392 present, @cite{Convention Ada} is assumed, which is almost certainly
3393 not what is wanted since the whole point of this pragma is to interface
3394 with foreign language functions, so it is usually appropriate to use this
3395 pragma in conjunction with a @cite{Export} or @cite{Convention}
3396 pragma that specifies the desired foreign convention.
3398 @geindex Suppressing external name
3400 Special treatment is given if the EXTERNAL is an explicit null
3401 string or a static string expressions that evaluates to the null
3402 string. In this case, no external name is generated. This form
3403 still allows the specification of parameter mechanisms.
3405 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3406 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{62}
3407 @section Pragma Extend_System
3410 @geindex System
3411 @geindex extending
3413 @geindex DEC Ada 83
3415 Syntax:
3417 @example
3418 pragma Extend_System ([Name =>] IDENTIFIER);
3419 @end example
3421 This pragma is used to provide backwards compatibility with other
3422 implementations that extend the facilities of package @cite{System}.  In
3423 GNAT, @cite{System} contains only the definitions that are present in
3424 the Ada RM.  However, other implementations, notably the DEC Ada 83
3425 implementation, provide many extensions to package @cite{System}.
3427 For each such implementation accommodated by this pragma, GNAT provides a
3428 package @cite{Aux_`xxx`}, e.g., @cite{Aux_DEC} for the DEC Ada 83
3429 implementation, which provides the required additional definitions.  You
3430 can use this package in two ways.  You can @cite{with} it in the normal
3431 way and access entities either by selection or using a @cite{use}
3432 clause.  In this case no special processing is required.
3434 However, if existing code contains references such as
3435 @cite{System.`xxx`} where @cite{xxx} is an entity in the extended
3436 definitions provided in package @cite{System}, you may use this pragma
3437 to extend visibility in @cite{System} in a non-standard way that
3438 provides greater compatibility with the existing code.  Pragma
3439 @cite{Extend_System} is a configuration pragma whose single argument is
3440 the name of the package containing the extended definition
3441 (e.g., @cite{Aux_DEC} for the DEC Ada case).  A unit compiled under
3442 control of this pragma will be processed using special visibility
3443 processing that looks in package @cite{System.Aux_`xxx`} where
3444 @cite{Aux_`xxx`} is the pragma argument for any entity referenced in
3445 package @cite{System}, but not found in package @cite{System}.
3447 You can use this pragma either to access a predefined @cite{System}
3448 extension supplied with the compiler, for example @cite{Aux_DEC} or
3449 you can construct your own extension unit following the above
3450 definition.  Note that such a package is a child of @cite{System}
3451 and thus is considered part of the implementation.
3452 To compile it you will have to use the @emph{-gnatg} switch
3453 for compiling System units, as explained in the
3454 GNAT User's Guide.
3456 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3457 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{63}
3458 @section Pragma Extensions_Allowed
3461 @geindex Ada Extensions
3463 @geindex GNAT Extensions
3465 Syntax:
3467 @example
3468 pragma Extensions_Allowed (On | Off);
3469 @end example
3471 This configuration pragma enables or disables the implementation
3472 extension mode (the use of Off as a parameter cancels the effect
3473 of the @emph{-gnatX} command switch).
3475 In extension mode, the latest version of the Ada language is
3476 implemented (currently Ada 2012), and in addition a small number
3477 of GNAT specific extensions are recognized as follows:
3480 @table @asis
3482 @item @emph{Constrained attribute for generic objects}
3484 The @cite{Constrained} attribute is permitted for objects of
3485 generic types. The result indicates if the corresponding actual
3486 is constrained.
3487 @end table
3489 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3490 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{64}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{65}
3491 @section Pragma Extensions_Visible
3494 Syntax:
3496 @example
3497 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3498 @end example
3500 For the semantics of this pragma, see the entry for aspect @cite{Extensions_Visible}
3501 in the SPARK 2014 Reference Manual, section 6.1.7.
3503 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3504 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{66}
3505 @section Pragma External
3508 Syntax:
3510 @example
3511 pragma External (
3512   [   Convention    =>] convention_IDENTIFIER,
3513   [   Entity        =>] LOCAL_NAME
3514   [, [External_Name =>] static_string_EXPRESSION ]
3515   [, [Link_Name     =>] static_string_EXPRESSION ]);
3516 @end example
3518 This pragma is identical in syntax and semantics to pragma
3519 @cite{Export} as defined in the Ada Reference Manual.  It is
3520 provided for compatibility with some Ada 83 compilers that
3521 used this pragma for exactly the same purposes as pragma
3522 @cite{Export} before the latter was standardized.
3524 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3525 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{67}
3526 @section Pragma External_Name_Casing
3529 @geindex Dec Ada 83 casing compatibility
3531 @geindex External Names
3532 @geindex casing
3534 @geindex Casing of External names
3536 Syntax:
3538 @example
3539 pragma External_Name_Casing (
3540   Uppercase | Lowercase
3541   [, Uppercase | Lowercase | As_Is]);
3542 @end example
3544 This pragma provides control over the casing of external names associated
3545 with Import and Export pragmas.  There are two cases to consider:
3548 @itemize *
3550 @item 
3551 Implicit external names
3553 Implicit external names are derived from identifiers.  The most common case
3554 arises when a standard Ada Import or Export pragma is used with only two
3555 arguments, as in:
3557 @example
3558 pragma Import (C, C_Routine);
3559 @end example
3561 Since Ada is a case-insensitive language, the spelling of the identifier in
3562 the Ada source program does not provide any information on the desired
3563 casing of the external name, and so a convention is needed.  In GNAT the
3564 default treatment is that such names are converted to all lower case
3565 letters.  This corresponds to the normal C style in many environments.
3566 The first argument of pragma @cite{External_Name_Casing} can be used to
3567 control this treatment.  If @cite{Uppercase} is specified, then the name
3568 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3569 then the normal default of all lower case letters will be used.
3571 This same implicit treatment is also used in the case of extended DEC Ada 83
3572 compatible Import and Export pragmas where an external name is explicitly
3573 specified using an identifier rather than a string.
3575 @item 
3576 Explicit external names
3578 Explicit external names are given as string literals.  The most common case
3579 arises when a standard Ada Import or Export pragma is used with three
3580 arguments, as in:
3582 @example
3583 pragma Import (C, C_Routine, "C_routine");
3584 @end example
3586 In this case, the string literal normally provides the exact casing required
3587 for the external name.  The second argument of pragma
3588 @cite{External_Name_Casing} may be used to modify this behavior.
3589 If @cite{Uppercase} is specified, then the name
3590 will be forced to all uppercase letters.  If @cite{Lowercase} is specified,
3591 then the name will be forced to all lowercase letters.  A specification of
3592 @cite{As_Is} provides the normal default behavior in which the casing is
3593 taken from the string provided.
3594 @end itemize
3596 This pragma may appear anywhere that a pragma is valid.  In particular, it
3597 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3598 case it applies to all subsequent compilations, or it can be used as a program
3599 unit pragma, in which case it only applies to the current unit, or it can
3600 be used more locally to control individual Import/Export pragmas.
3602 It was primarily intended for use with OpenVMS systems, where many
3603 compilers convert all symbols to upper case by default.  For interfacing to
3604 such compilers (e.g., the DEC C compiler), it may be convenient to use
3605 the pragma:
3607 @example
3608 pragma External_Name_Casing (Uppercase, Uppercase);
3609 @end example
3611 to enforce the upper casing of all external symbols.
3613 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3614 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{68}
3615 @section Pragma Fast_Math
3618 Syntax:
3620 @example
3621 pragma Fast_Math;
3622 @end example
3624 This is a configuration pragma which activates a mode in which speed is
3625 considered more important for floating-point operations than absolutely
3626 accurate adherence to the requirements of the standard. Currently the
3627 following operations are affected:
3630 @table @asis
3632 @item @emph{Complex Multiplication}
3634 The normal simple formula for complex multiplication can result in intermediate
3635 overflows for numbers near the end of the range. The Ada standard requires that
3636 this situation be detected and corrected by scaling, but in Fast_Math mode such
3637 cases will simply result in overflow. Note that to take advantage of this you
3638 must instantiate your own version of @cite{Ada.Numerics.Generic_Complex_Types}
3639 under control of the pragma, rather than use the preinstantiated versions.
3640 @end table
3642 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3643 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{69}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6a}
3644 @section Pragma Favor_Top_Level
3647 Syntax:
3649 @example
3650 pragma Favor_Top_Level (type_NAME);
3651 @end example
3653 The argument of pragma @cite{Favor_Top_Level} must be a named access-to-subprogram
3654 type. This pragma is an efficiency hint to the compiler, regarding the use of
3655 @cite{'Access} or @cite{'Unrestricted_Access} on nested (non-library-level) subprograms.
3656 The pragma means that nested subprograms are not used with this type, or are
3657 rare, so that the generated code should be efficient in the top-level case.
3658 When this pragma is used, dynamically generated trampolines may be used on some
3659 targets for nested subprograms. See restriction @cite{No_Implicit_Dynamic_Code}.
3661 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3662 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6b}
3663 @section Pragma Finalize_Storage_Only
3666 Syntax:
3668 @example
3669 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3670 @end example
3672 The argument of pragma @cite{Finalize_Storage_Only} must denote a local type which
3673 is derived from @cite{Ada.Finalization.Controlled} or @cite{Limited_Controlled}. The
3674 pragma suppresses the call to @cite{Finalize} for declared library-level objects
3675 of the argument type. This is mostly useful for types where finalization is
3676 only used to deal with storage reclamation since in most environments it is
3677 not necessary to reclaim memory just before terminating execution, hence the
3678 name. Note that this pragma does not suppress Finalize calls for library-level
3679 heap-allocated objects (see pragma @cite{No_Heap_Finalization}).
3681 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3682 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{6c}
3683 @section Pragma Float_Representation
3686 Syntax:
3688 @example
3689 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3691 FLOAT_REP ::= VAX_Float | IEEE_Float
3692 @end example
3694 In the one argument form, this pragma is a configuration pragma which
3695 allows control over the internal representation chosen for the predefined
3696 floating point types declared in the packages @cite{Standard} and
3697 @cite{System}. This pragma is only provided for compatibility and has no effect.
3699 The two argument form specifies the representation to be used for
3700 the specified floating-point type. The argument must
3701 be @cite{IEEE_Float} to specify the use of IEEE format, as follows:
3704 @itemize *
3706 @item 
3707 For a digits value of 6, 32-bit IEEE short format will be used.
3709 @item 
3710 For a digits value of 15, 64-bit IEEE long format will be used.
3712 @item 
3713 No other value of digits is permitted.
3714 @end itemize
3716 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3717 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{6d}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6e}
3718 @section Pragma Ghost
3721 Syntax:
3723 @example
3724 pragma Ghost [ (boolean_EXPRESSION) ];
3725 @end example
3727 For the semantics of this pragma, see the entry for aspect @cite{Ghost} in the SPARK
3728 2014 Reference Manual, section 6.9.
3730 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
3731 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{6f}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{70}
3732 @section Pragma Global
3735 Syntax:
3737 @example
3738 pragma Global (GLOBAL_SPECIFICATION);
3740 GLOBAL_SPECIFICATION ::=
3741      null
3742   | (GLOBAL_LIST)
3743   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
3745 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
3747 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
3748 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
3749 GLOBAL_ITEM   ::= NAME
3750 @end example
3752 For the semantics of this pragma, see the entry for aspect @cite{Global} in the
3753 SPARK 2014 Reference Manual, section 6.1.4.
3755 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3756 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{71}
3757 @section Pragma Ident
3760 Syntax:
3762 @example
3763 pragma Ident (static_string_EXPRESSION);
3764 @end example
3766 This pragma is identical in effect to pragma @cite{Comment}. It is provided
3767 for compatibility with other Ada compilers providing this pragma.
3769 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3770 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{72}
3771 @section Pragma Ignore_Pragma
3774 Syntax:
3776 @example
3777 pragma Ignore_Pragma (pragma_IDENTIFIER);
3778 @end example
3780 This is a configuration pragma
3781 that takes a single argument that is a simple identifier. Any subsequent
3782 use of a pragma whose pragma identifier matches this argument will be
3783 silently ignored. This may be useful when legacy code or code intended
3784 for compilation with some other compiler contains pragmas that match the
3785 name, but not the exact implementation, of a @cite{GNAT} pragma. The use of this
3786 pragma allows such pragmas to be ignored, which may be useful in @cite{CodePeer}
3787 mode, or during porting of legacy code.
3789 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
3790 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{73}
3791 @section Pragma Implementation_Defined
3794 Syntax:
3796 @example
3797 pragma Implementation_Defined (local_NAME);
3798 @end example
3800 This pragma marks a previously declared entity as implementation-defined.
3801 For an overloaded entity, applies to the most recent homonym.
3803 @example
3804 pragma Implementation_Defined;
3805 @end example
3807 The form with no arguments appears anywhere within a scope, most
3808 typically a package spec, and indicates that all entities that are
3809 defined within the package spec are Implementation_Defined.
3811 This pragma is used within the GNAT runtime library to identify
3812 implementation-defined entities introduced in language-defined units,
3813 for the purpose of implementing the No_Implementation_Identifiers
3814 restriction.
3816 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3817 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{74}
3818 @section Pragma Implemented
3821 Syntax:
3823 @example
3824 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3826 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3827 @end example
3829 This is an Ada 2012 representation pragma which applies to protected, task
3830 and synchronized interface primitives. The use of pragma Implemented provides
3831 a way to impose a static requirement on the overriding operation by adhering
3832 to one of the three implementation kinds: entry, protected procedure or any of
3833 the above. This pragma is available in all earlier versions of Ada as an
3834 implementation-defined pragma.
3836 @example
3837 type Synch_Iface is synchronized interface;
3838 procedure Prim_Op (Obj : in out Iface) is abstract;
3839 pragma Implemented (Prim_Op, By_Protected_Procedure);
3841 protected type Prot_1 is new Synch_Iface with
3842    procedure Prim_Op;  --  Legal
3843 end Prot_1;
3845 protected type Prot_2 is new Synch_Iface with
3846    entry Prim_Op;      --  Illegal
3847 end Prot_2;
3849 task type Task_Typ is new Synch_Iface with
3850    entry Prim_Op;      --  Illegal
3851 end Task_Typ;
3852 @end example
3854 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3855 Implemented determines the runtime behavior of the requeue. Implementation kind
3856 By_Entry guarantees that the action of requeueing will proceed from an entry to
3857 another entry. Implementation kind By_Protected_Procedure transforms the
3858 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3859 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3860 the target's overriding subprogram kind.
3862 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
3863 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{75}
3864 @section Pragma Implicit_Packing
3867 @geindex Rational Profile
3869 Syntax:
3871 @example
3872 pragma Implicit_Packing;
3873 @end example
3875 This is a configuration pragma that requests implicit packing for packed
3876 arrays for which a size clause is given but no explicit pragma Pack or
3877 specification of Component_Size is present. It also applies to records
3878 where no record representation clause is present. Consider this example:
3880 @example
3881 type R is array (0 .. 7) of Boolean;
3882 for R'Size use 8;
3883 @end example
3885 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3886 does not change the layout of a composite object. So the Size clause in the
3887 above example is normally rejected, since the default layout of the array uses
3888 8-bit components, and thus the array requires a minimum of 64 bits.
3890 If this declaration is compiled in a region of code covered by an occurrence
3891 of the configuration pragma Implicit_Packing, then the Size clause in this
3892 and similar examples will cause implicit packing and thus be accepted. For
3893 this implicit packing to occur, the type in question must be an array of small
3894 components whose size is known at compile time, and the Size clause must
3895 specify the exact size that corresponds to the number of elements in the array
3896 multiplied by the size in bits of the component type (both single and
3897 multi-dimensioned arrays can be controlled with this pragma).
3899 @geindex Array packing
3901 Similarly, the following example shows the use in the record case
3903 @example
3904 type r is record
3905    a, b, c, d, e, f, g, h : boolean;
3906    chr                    : character;
3907 end record;
3908 for r'size use 16;
3909 @end example
3911 Without a pragma Pack, each Boolean field requires 8 bits, so the
3912 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
3913 sufficient. The use of pragma Implicit_Packing allows this record
3914 declaration to compile without an explicit pragma Pack.
3916 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
3917 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{76}
3918 @section Pragma Import_Function
3921 Syntax:
3923 @example
3924 pragma Import_Function (
3925      [Internal                 =>] LOCAL_NAME,
3926   [, [External                 =>] EXTERNAL_SYMBOL]
3927   [, [Parameter_Types          =>] PARAMETER_TYPES]
3928   [, [Result_Type              =>] SUBTYPE_MARK]
3929   [, [Mechanism                =>] MECHANISM]
3930   [, [Result_Mechanism         =>] MECHANISM_NAME]);
3932 EXTERNAL_SYMBOL ::=
3933   IDENTIFIER
3934 | static_string_EXPRESSION
3936 PARAMETER_TYPES ::=
3937   null
3938 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3940 TYPE_DESIGNATOR ::=
3941   subtype_NAME
3942 | subtype_Name ' Access
3944 MECHANISM ::=
3945   MECHANISM_NAME
3946 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3948 MECHANISM_ASSOCIATION ::=
3949   [formal_parameter_NAME =>] MECHANISM_NAME
3951 MECHANISM_NAME ::=
3952   Value
3953 | Reference
3954 @end example
3956 This pragma is used in conjunction with a pragma @cite{Import} to
3957 specify additional information for an imported function.  The pragma
3958 @cite{Import} (or equivalent pragma @cite{Interface}) must precede the
3959 @cite{Import_Function} pragma and both must appear in the same
3960 declarative part as the function specification.
3962 The @cite{Internal} argument must uniquely designate
3963 the function to which the
3964 pragma applies.  If more than one function name exists of this name in
3965 the declarative part you must use the @cite{Parameter_Types} and
3966 @cite{Result_Type} parameters to achieve the required unique
3967 designation.  Subtype marks in these parameters must exactly match the
3968 subtypes in the corresponding function specification, using positional
3969 notation to match parameters with subtype marks.
3970 The form with an @cite{'Access} attribute can be used to match an
3971 anonymous access parameter.
3973 You may optionally use the @cite{Mechanism} and @cite{Result_Mechanism}
3974 parameters to specify passing mechanisms for the
3975 parameters and result.  If you specify a single mechanism name, it
3976 applies to all parameters.  Otherwise you may specify a mechanism on a
3977 parameter by parameter basis using either positional or named
3978 notation.  If the mechanism is not specified, the default mechanism
3979 is used.
3981 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
3982 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{77}
3983 @section Pragma Import_Object
3986 Syntax:
3988 @example
3989 pragma Import_Object
3990      [Internal =>] LOCAL_NAME
3991   [, [External =>] EXTERNAL_SYMBOL]
3992   [, [Size     =>] EXTERNAL_SYMBOL]);
3994 EXTERNAL_SYMBOL ::=
3995   IDENTIFIER
3996 | static_string_EXPRESSION
3997 @end example
3999 This pragma designates an object as imported, and apart from the
4000 extended rules for external symbols, is identical in effect to the use of
4001 the normal @cite{Import} pragma applied to an object.  Unlike the
4002 subprogram case, you need not use a separate @cite{Import} pragma,
4003 although you may do so (and probably should do so from a portability
4004 point of view).  @cite{size} is syntax checked, but otherwise ignored by
4005 GNAT.
4007 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4008 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{78}
4009 @section Pragma Import_Procedure
4012 Syntax:
4014 @example
4015 pragma Import_Procedure (
4016      [Internal                 =>] LOCAL_NAME
4017   [, [External                 =>] EXTERNAL_SYMBOL]
4018   [, [Parameter_Types          =>] PARAMETER_TYPES]
4019   [, [Mechanism                =>] MECHANISM]);
4021 EXTERNAL_SYMBOL ::=
4022   IDENTIFIER
4023 | static_string_EXPRESSION
4025 PARAMETER_TYPES ::=
4026   null
4027 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4029 TYPE_DESIGNATOR ::=
4030   subtype_NAME
4031 | subtype_Name ' Access
4033 MECHANISM ::=
4034   MECHANISM_NAME
4035 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4037 MECHANISM_ASSOCIATION ::=
4038   [formal_parameter_NAME =>] MECHANISM_NAME
4040 MECHANISM_NAME ::= Value | Reference
4041 @end example
4043 This pragma is identical to @cite{Import_Function} except that it
4044 applies to a procedure rather than a function and the parameters
4045 @cite{Result_Type} and @cite{Result_Mechanism} are not permitted.
4047 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4048 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{79}
4049 @section Pragma Import_Valued_Procedure
4052 Syntax:
4054 @example
4055 pragma Import_Valued_Procedure (
4056      [Internal                 =>] LOCAL_NAME
4057   [, [External                 =>] EXTERNAL_SYMBOL]
4058   [, [Parameter_Types          =>] PARAMETER_TYPES]
4059   [, [Mechanism                =>] MECHANISM]);
4061 EXTERNAL_SYMBOL ::=
4062   IDENTIFIER
4063 | static_string_EXPRESSION
4065 PARAMETER_TYPES ::=
4066   null
4067 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4069 TYPE_DESIGNATOR ::=
4070   subtype_NAME
4071 | subtype_Name ' Access
4073 MECHANISM ::=
4074   MECHANISM_NAME
4075 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4077 MECHANISM_ASSOCIATION ::=
4078   [formal_parameter_NAME =>] MECHANISM_NAME
4080 MECHANISM_NAME ::= Value | Reference
4081 @end example
4083 This pragma is identical to @cite{Import_Procedure} except that the
4084 first parameter of @cite{LOCAL_NAME}, which must be present, must be of
4085 mode @cite{OUT}, and externally the subprogram is treated as a function
4086 with this parameter as the result of the function.  The purpose of this
4087 capability is to allow the use of @cite{OUT} and @cite{IN OUT}
4088 parameters in interfacing to external functions (which are not permitted
4089 in Ada functions).  You may optionally use the @cite{Mechanism}
4090 parameters to specify passing mechanisms for the parameters.
4091 If you specify a single mechanism name, it applies to all parameters.
4092 Otherwise you may specify a mechanism on a parameter by parameter
4093 basis using either positional or named notation.  If the mechanism is not
4094 specified, the default mechanism is used.
4096 Note that it is important to use this pragma in conjunction with a separate
4097 pragma Import that specifies the desired convention, since otherwise the
4098 default convention is Ada, which is almost certainly not what is required.
4100 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4101 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7a}
4102 @section Pragma Independent
4105 Syntax:
4107 @example
4108 pragma Independent (Local_NAME);
4109 @end example
4111 This pragma is standard in Ada 2012 mode (which also provides an aspect
4112 of the same name). It is also available as an implementation-defined
4113 pragma in all earlier versions. It specifies that the
4114 designated object or all objects of the designated type must be
4115 independently addressable. This means that separate tasks can safely
4116 manipulate such objects. For example, if two components of a record are
4117 independent, then two separate tasks may access these two components.
4118 This may place
4119 constraints on the representation of the object (for instance prohibiting
4120 tight packing).
4122 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4123 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7b}
4124 @section Pragma Independent_Components
4127 Syntax:
4129 @example
4130 pragma Independent_Components (Local_NAME);
4131 @end example
4133 This pragma is standard in Ada 2012 mode (which also provides an aspect
4134 of the same name). It is also available as an implementation-defined
4135 pragma in all earlier versions. It specifies that the components of the
4136 designated object, or the components of each object of the designated
4137 type, must be
4138 independently addressable. This means that separate tasks can safely
4139 manipulate separate components in the composite object. This may place
4140 constraints on the representation of the object (for instance prohibiting
4141 tight packing).
4143 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4144 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{7c}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{7d}
4145 @section Pragma Initial_Condition
4148 Syntax:
4150 @example
4151 pragma Initial_Condition (boolean_EXPRESSION);
4152 @end example
4154 For the semantics of this pragma, see the entry for aspect @cite{Initial_Condition}
4155 in the SPARK 2014 Reference Manual, section 7.1.6.
4157 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4158 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{7e}
4159 @section Pragma Initialize_Scalars
4162 @geindex debugging with Initialize_Scalars
4164 Syntax:
4166 @example
4167 pragma Initialize_Scalars;
4168 @end example
4170 This pragma is similar to @cite{Normalize_Scalars} conceptually but has
4171 two important differences.  First, there is no requirement for the pragma
4172 to be used uniformly in all units of a partition, in particular, it is fine
4173 to use this just for some or all of the application units of a partition,
4174 without needing to recompile the run-time library.
4176 In the case where some units are compiled with the pragma, and some without,
4177 then a declaration of a variable where the type is defined in package
4178 Standard or is locally declared will always be subject to initialization,
4179 as will any declaration of a scalar variable.  For composite variables,
4180 whether the variable is initialized may also depend on whether the package
4181 in which the type of the variable is declared is compiled with the pragma.
4183 The other important difference is that you can control the value used
4184 for initializing scalar objects.  At bind time, you can select several
4185 options for initialization. You can
4186 initialize with invalid values (similar to Normalize_Scalars, though for
4187 Initialize_Scalars it is not always possible to determine the invalid
4188 values in complex cases like signed component fields with non-standard
4189 sizes). You can also initialize with high or
4190 low values, or with a specified bit pattern.  See the GNAT
4191 User's Guide for binder options for specifying these cases.
4193 This means that you can compile a program, and then without having to
4194 recompile the program, you can run it with different values being used
4195 for initializing otherwise uninitialized values, to test if your program
4196 behavior depends on the choice.  Of course the behavior should not change,
4197 and if it does, then most likely you have an incorrect reference to an
4198 uninitialized value.
4200 It is even possible to change the value at execution time eliminating even
4201 the need to rebind with a different switch using an environment variable.
4202 See the GNAT User's Guide for details.
4204 Note that pragma @cite{Initialize_Scalars} is particularly useful in
4205 conjunction with the enhanced validity checking that is now provided
4206 in GNAT, which checks for invalid values under more conditions.
4207 Using this feature (see description of the @emph{-gnatV} flag in the
4208 GNAT User's Guide) in conjunction with
4209 pragma @cite{Initialize_Scalars}
4210 provides a powerful new tool to assist in the detection of problems
4211 caused by uninitialized variables.
4213 Note: the use of @cite{Initialize_Scalars} has a fairly extensive
4214 effect on the generated code. This may cause your code to be
4215 substantially larger. It may also cause an increase in the amount
4216 of stack required, so it is probably a good idea to turn on stack
4217 checking (see description of stack checking in the GNAT
4218 User's Guide) when using this pragma.
4220 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4221 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{7f}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{80}
4222 @section Pragma Initializes
4225 Syntax:
4227 @example
4228 pragma Initializes (INITIALIZATION_LIST);
4230 INITIALIZATION_LIST ::=
4231      null
4232   | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4234 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4236 INPUT_LIST ::=
4237      null
4238   |  INPUT
4239   | (INPUT @{, INPUT@})
4241 INPUT ::= name
4242 @end example
4244 For the semantics of this pragma, see the entry for aspect @cite{Initializes} in the
4245 SPARK 2014 Reference Manual, section 7.1.5.
4247 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4248 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{81}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{82}
4249 @section Pragma Inline_Always
4252 Syntax:
4254 @example
4255 pragma Inline_Always (NAME [, NAME]);
4256 @end example
4258 Similar to pragma @cite{Inline} except that inlining is unconditional.
4259 Inline_Always instructs the compiler to inline every direct call to the
4260 subprogram or else to emit a compilation error, independently of any
4261 option, in particular @emph{-gnatn} or @emph{-gnatN} or the optimization level.
4262 It is an error to take the address or access of @cite{NAME}. It is also an error to
4263 apply this pragma to a primitive operation of a tagged type. Thanks to such
4264 restrictions, the compiler is allowed to remove the out-of-line body of @cite{NAME}.
4266 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4267 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{83}
4268 @section Pragma Inline_Generic
4271 Syntax:
4273 @example
4274 pragma Inline_Generic (GNAME @{, GNAME@});
4276 GNAME ::= generic_unit_NAME | generic_instance_NAME
4277 @end example
4279 This pragma is provided for compatibility with Dec Ada 83. It has
4280 no effect in @cite{GNAT} (which always inlines generics), other
4281 than to check that the given names are all names of generic units or
4282 generic instances.
4284 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4285 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{84}
4286 @section Pragma Interface
4289 Syntax:
4291 @example
4292 pragma Interface (
4293      [Convention    =>] convention_identifier,
4294      [Entity        =>] local_NAME
4295   [, [External_Name =>] static_string_expression]
4296   [, [Link_Name     =>] static_string_expression]);
4297 @end example
4299 This pragma is identical in syntax and semantics to
4300 the standard Ada pragma @cite{Import}.  It is provided for compatibility
4301 with Ada 83.  The definition is upwards compatible both with pragma
4302 @cite{Interface} as defined in the Ada 83 Reference Manual, and also
4303 with some extended implementations of this pragma in certain Ada 83
4304 implementations.  The only difference between pragma @cite{Interface}
4305 and pragma @cite{Import} is that there is special circuitry to allow
4306 both pragmas to appear for the same subprogram entity (normally it
4307 is illegal to have multiple @cite{Import} pragmas. This is useful in
4308 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4309 Ada 83 compilers.
4311 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4312 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{85}
4313 @section Pragma Interface_Name
4316 Syntax:
4318 @example
4319 pragma Interface_Name (
4320      [Entity        =>] LOCAL_NAME
4321   [, [External_Name =>] static_string_EXPRESSION]
4322   [, [Link_Name     =>] static_string_EXPRESSION]);
4323 @end example
4325 This pragma provides an alternative way of specifying the interface name
4326 for an interfaced subprogram, and is provided for compatibility with Ada
4327 83 compilers that use the pragma for this purpose.  You must provide at
4328 least one of @cite{External_Name} or @cite{Link_Name}.
4330 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4331 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{86}
4332 @section Pragma Interrupt_Handler
4335 Syntax:
4337 @example
4338 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4339 @end example
4341 This program unit pragma is supported for parameterless protected procedures
4342 as described in Annex C of the Ada Reference Manual. On the AAMP target
4343 the pragma can also be specified for nonprotected parameterless procedures
4344 that are declared at the library level (which includes procedures
4345 declared at the top level of a library package). In the case of AAMP,
4346 when this pragma is applied to a nonprotected procedure, the instruction
4347 @cite{IERET} is generated for returns from the procedure, enabling
4348 maskable interrupts, in place of the normal return instruction.
4350 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4351 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{87}
4352 @section Pragma Interrupt_State
4355 Syntax:
4357 @example
4358 pragma Interrupt_State
4359  ([Name  =>] value,
4360   [State =>] SYSTEM | RUNTIME | USER);
4361 @end example
4363 Normally certain interrupts are reserved to the implementation.  Any attempt
4364 to attach an interrupt causes Program_Error to be raised, as described in
4365 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
4366 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4367 reserved to the implementation, so that @code{Ctrl-C} can be used to
4368 interrupt execution.  Additionally, signals such as @cite{SIGSEGV},
4369 @cite{SIGABRT}, @cite{SIGFPE} and @cite{SIGILL} are often mapped to specific
4370 Ada exceptions, or used to implement run-time functions such as the
4371 @cite{abort} statement and stack overflow checking.
4373 Pragma @cite{Interrupt_State} provides a general mechanism for overriding
4374 such uses of interrupts.  It subsumes the functionality of pragma
4375 @cite{Unreserve_All_Interrupts}.  Pragma @cite{Interrupt_State} is not
4376 available on Windows or VMS.  On all other platforms than VxWorks,
4377 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4378 and may be used to mark interrupts required by the board support package
4379 as reserved.
4381 Interrupts can be in one of three states:
4384 @itemize *
4386 @item 
4387 System
4389 The interrupt is reserved (no Ada handler can be installed), and the
4390 Ada run-time may not install a handler. As a result you are guaranteed
4391 standard system default action if this interrupt is raised. This also allows
4392 installing a low level handler via C APIs such as sigaction(), outside
4393 of Ada control.
4395 @item 
4396 Runtime
4398 The interrupt is reserved (no Ada handler can be installed). The run time
4399 is allowed to install a handler for internal control purposes, but is
4400 not required to do so.
4402 @item 
4403 User
4405 The interrupt is unreserved.  The user may install an Ada handler via
4406 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4407 some other action.
4408 @end itemize
4410 These states are the allowed values of the @cite{State} parameter of the
4411 pragma.  The @cite{Name} parameter is a value of the type
4412 @cite{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4413 @cite{Ada.Interrupts.Names}.
4415 This is a configuration pragma, and the binder will check that there
4416 are no inconsistencies between different units in a partition in how a
4417 given interrupt is specified. It may appear anywhere a pragma is legal.
4419 The effect is to move the interrupt to the specified state.
4421 By declaring interrupts to be SYSTEM, you guarantee the standard system
4422 action, such as a core dump.
4424 By declaring interrupts to be USER, you guarantee that you can install
4425 a handler.
4427 Note that certain signals on many operating systems cannot be caught and
4428 handled by applications.  In such cases, the pragma is ignored.  See the
4429 operating system documentation, or the value of the array @cite{Reserved}
4430 declared in the spec of package @cite{System.OS_Interface}.
4432 Overriding the default state of signals used by the Ada runtime may interfere
4433 with an application's runtime behavior in the cases of the synchronous signals,
4434 and in the case of the signal used to implement the @cite{abort} statement.
4436 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4437 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{88}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{89}
4438 @section Pragma Invariant
4441 Syntax:
4443 @example
4444 pragma Invariant
4445   ([Entity =>]    private_type_LOCAL_NAME,
4446    [Check  =>]    EXPRESSION
4447    [,[Message =>] String_Expression]);
4448 @end example
4450 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4451 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4452 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4453 requires the use of the aspect syntax, which is not available except in 2012
4454 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4455 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4456 note that the aspect Invariant is a synonym in GNAT for the aspect
4457 Type_Invariant, but there is no pragma Type_Invariant.
4459 The pragma must appear within the visible part of the package specification,
4460 after the type to which its Entity argument appears. As with the Invariant
4461 aspect, the Check expression is not analyzed until the end of the visible
4462 part of the package, so it may contain forward references. The Message
4463 argument, if present, provides the exception message used if the invariant
4464 is violated. If no Message parameter is provided, a default message that
4465 identifies the line on which the pragma appears is used.
4467 It is permissible to have multiple Invariants for the same type entity, in
4468 which case they are and'ed together. It is permissible to use this pragma
4469 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4470 invariant pragma for the same entity.
4472 For further details on the use of this pragma, see the Ada 2012 documentation
4473 of the Type_Invariant aspect.
4475 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4476 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8a}
4477 @section Pragma Keep_Names
4480 Syntax:
4482 @example
4483 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4484 @end example
4486 The @cite{LOCAL_NAME} argument
4487 must refer to an enumeration first subtype
4488 in the current declarative part. The effect is to retain the enumeration
4489 literal names for use by @cite{Image} and @cite{Value} even if a global
4490 @cite{Discard_Names} pragma applies. This is useful when you want to
4491 generally suppress enumeration literal names and for example you therefore
4492 use a @cite{Discard_Names} pragma in the @code{gnat.adc} file, but you
4493 want to retain the names for specific enumeration types.
4495 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4496 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8b}
4497 @section Pragma License
4500 @geindex License checking
4502 Syntax:
4504 @example
4505 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4506 @end example
4508 This pragma is provided to allow automated checking for appropriate license
4509 conditions with respect to the standard and modified GPL.  A pragma
4510 @cite{License}, which is a configuration pragma that typically appears at
4511 the start of a source file or in a separate @code{gnat.adc} file, specifies
4512 the licensing conditions of a unit as follows:
4515 @itemize *
4517 @item 
4518 Unrestricted
4519 This is used for a unit that can be freely used with no license restrictions.
4520 Examples of such units are public domain units, and units from the Ada
4521 Reference Manual.
4523 @item 
4525 This is used for a unit that is licensed under the unmodified GPL, and which
4526 therefore cannot be @cite{with}'ed by a restricted unit.
4528 @item 
4529 Modified_GPL
4530 This is used for a unit licensed under the GNAT modified GPL that includes
4531 a special exception paragraph that specifically permits the inclusion of
4532 the unit in programs without requiring the entire program to be released
4533 under the GPL.
4535 @item 
4536 Restricted
4537 This is used for a unit that is restricted in that it is not permitted to
4538 depend on units that are licensed under the GPL.  Typical examples are
4539 proprietary code that is to be released under more restrictive license
4540 conditions.  Note that restricted units are permitted to @cite{with} units
4541 which are licensed under the modified GPL (this is the whole point of the
4542 modified GPL).
4543 @end itemize
4545 Normally a unit with no @cite{License} pragma is considered to have an
4546 unknown license, and no checking is done.  However, standard GNAT headers
4547 are recognized, and license information is derived from them as follows.
4549 A GNAT license header starts with a line containing 78 hyphens.  The following
4550 comment text is searched for the appearance of any of the following strings.
4552 If the string 'GNU General Public License' is found, then the unit is assumed
4553 to have GPL license, unless the string 'As a special exception' follows, in
4554 which case the license is assumed to be modified GPL.
4556 If one of the strings
4557 'This specification is adapted from the Ada Semantic Interface' or
4558 'This specification is derived from the Ada Reference Manual' is found
4559 then the unit is assumed to be unrestricted.
4561 These default actions means that a program with a restricted license pragma
4562 will automatically get warnings if a GPL unit is inappropriately
4563 @cite{with}'ed.  For example, the program:
4565 @example
4566 with Sem_Ch3;
4567 with GNAT.Sockets;
4568 procedure Secret_Stuff is
4569   ...
4570 end Secret_Stuff
4571 @end example
4573 if compiled with pragma @cite{License} (@cite{Restricted}) in a
4574 @code{gnat.adc} file will generate the warning:
4576 @example
4577 1.  with Sem_Ch3;
4578         |
4579    >>> license of withed unit "Sem_Ch3" is incompatible
4581 2.  with GNAT.Sockets;
4582 3.  procedure Secret_Stuff is
4583 @end example
4585 Here we get a warning on @cite{Sem_Ch3} since it is part of the GNAT
4586 compiler and is licensed under the
4587 GPL, but no warning for @cite{GNAT.Sockets} which is part of the GNAT
4588 run time, and is therefore licensed under the modified GPL.
4590 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4591 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{8c}
4592 @section Pragma Link_With
4595 Syntax:
4597 @example
4598 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4599 @end example
4601 This pragma is provided for compatibility with certain Ada 83 compilers.
4602 It has exactly the same effect as pragma @cite{Linker_Options} except
4603 that spaces occurring within one of the string expressions are treated
4604 as separators. For example, in the following case:
4606 @example
4607 pragma Link_With ("-labc -ldef");
4608 @end example
4610 results in passing the strings @cite{-labc} and @cite{-ldef} as two
4611 separate arguments to the linker. In addition pragma Link_With allows
4612 multiple arguments, with the same effect as successive pragmas.
4614 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4615 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{8d}
4616 @section Pragma Linker_Alias
4619 Syntax:
4621 @example
4622 pragma Linker_Alias (
4623   [Entity =>] LOCAL_NAME,
4624   [Target =>] static_string_EXPRESSION);
4625 @end example
4627 @cite{LOCAL_NAME} must refer to an object that is declared at the library
4628 level. This pragma establishes the given entity as a linker alias for the
4629 given target. It is equivalent to @cite{__attribute__((alias))} in GNU C
4630 and causes @cite{LOCAL_NAME} to be emitted as an alias for the symbol
4631 @cite{static_string_EXPRESSION} in the object file, that is to say no space
4632 is reserved for @cite{LOCAL_NAME} by the assembler and it will be resolved
4633 to the same address as @cite{static_string_EXPRESSION} by the linker.
4635 The actual linker name for the target must be used (e.g., the fully
4636 encoded name with qualification in Ada, or the mangled name in C++),
4637 or it must be declared using the C convention with @cite{pragma Import}
4638 or @cite{pragma Export}.
4640 Not all target machines support this pragma. On some of them it is accepted
4641 only if @cite{pragma Weak_External} has been applied to @cite{LOCAL_NAME}.
4643 @example
4644 --  Example of the use of pragma Linker_Alias
4646 package p is
4647   i : Integer := 1;
4648   pragma Export (C, i);
4650   new_name_for_i : Integer;
4651   pragma Linker_Alias (new_name_for_i, "i");
4652 end p;
4653 @end example
4655 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4656 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{8e}
4657 @section Pragma Linker_Constructor
4660 Syntax:
4662 @example
4663 pragma Linker_Constructor (procedure_LOCAL_NAME);
4664 @end example
4666 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4667 is declared at the library level. A procedure to which this pragma is
4668 applied will be treated as an initialization routine by the linker.
4669 It is equivalent to @cite{__attribute__((constructor))} in GNU C and
4670 causes @cite{procedure_LOCAL_NAME} to be invoked before the entry point
4671 of the executable is called (or immediately after the shared library is
4672 loaded if the procedure is linked in a shared library), in particular
4673 before the Ada run-time environment is set up.
4675 Because of these specific contexts, the set of operations such a procedure
4676 can perform is very limited and the type of objects it can manipulate is
4677 essentially restricted to the elementary types. In particular, it must only
4678 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4680 This pragma is used by GNAT to implement auto-initialization of shared Stand
4681 Alone Libraries, which provides a related capability without the restrictions
4682 listed above. Where possible, the use of Stand Alone Libraries is preferable
4683 to the use of this pragma.
4685 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4686 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{8f}
4687 @section Pragma Linker_Destructor
4690 Syntax:
4692 @example
4693 pragma Linker_Destructor (procedure_LOCAL_NAME);
4694 @end example
4696 @cite{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4697 is declared at the library level. A procedure to which this pragma is
4698 applied will be treated as a finalization routine by the linker.
4699 It is equivalent to @cite{__attribute__((destructor))} in GNU C and
4700 causes @cite{procedure_LOCAL_NAME} to be invoked after the entry point
4701 of the executable has exited (or immediately before the shared library
4702 is unloaded if the procedure is linked in a shared library), in particular
4703 after the Ada run-time environment is shut down.
4705 See @cite{pragma Linker_Constructor} for the set of restrictions that apply
4706 because of these specific contexts.
4708 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4709 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{90}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{91}
4710 @section Pragma Linker_Section
4713 Syntax:
4715 @example
4716 pragma Linker_Section (
4717   [Entity  =>] LOCAL_NAME,
4718   [Section =>] static_string_EXPRESSION);
4719 @end example
4721 @cite{LOCAL_NAME} must refer to an object, type, or subprogram that is
4722 declared at the library level. This pragma specifies the name of the
4723 linker section for the given entity. It is equivalent to
4724 @cite{__attribute__((section))} in GNU C and causes @cite{LOCAL_NAME} to
4725 be placed in the @cite{static_string_EXPRESSION} section of the
4726 executable (assuming the linker doesn't rename the section).
4727 GNAT also provides an implementation defined aspect of the same name.
4729 In the case of specifying this aspect for a type, the effect is to
4730 specify the corresponding for all library level objects of the type which
4731 do not have an explicit linker section set. Note that this only applies to
4732 whole objects, not to components of composite objects.
4734 In the case of a subprogram, the linker section applies to all previously
4735 declared matching overloaded subprograms in the current declarative part
4736 which do not already have a linker section assigned. The linker section
4737 aspect is useful in this case for specifying different linker sections
4738 for different elements of such an overloaded set.
4740 Note that an empty string specifies that no linker section is specified.
4741 This is not quite the same as omitting the pragma or aspect, since it
4742 can be used to specify that one element of an overloaded set of subprograms
4743 has the default linker section, or that one object of a type for which a
4744 linker section is specified should has the default linker section.
4746 The compiler normally places library-level entities in standard sections
4747 depending on the class: procedures and functions generally go in the
4748 @cite{.text} section, initialized variables in the @cite{.data} section
4749 and uninitialized variables in the @cite{.bss} section.
4751 Other, special sections may exist on given target machines to map special
4752 hardware, for example I/O ports or flash memory. This pragma is a means to
4753 defer the final layout of the executable to the linker, thus fully working
4754 at the symbolic level with the compiler.
4756 Some file formats do not support arbitrary sections so not all target
4757 machines support this pragma. The use of this pragma may cause a program
4758 execution to be erroneous if it is used to place an entity into an
4759 inappropriate section (e.g., a modified variable into the @cite{.text}
4760 section). See also @cite{pragma Persistent_BSS}.
4762 @example
4763 --  Example of the use of pragma Linker_Section
4765 package IO_Card is
4766   Port_A : Integer;
4767   pragma Volatile (Port_A);
4768   pragma Linker_Section (Port_A, ".bss.port_a");
4770   Port_B : Integer;
4771   pragma Volatile (Port_B);
4772   pragma Linker_Section (Port_B, ".bss.port_b");
4774   type Port_Type is new Integer with Linker_Section => ".bss";
4775   PA : Port_Type with Linker_Section => ".bss.PA";
4776   PB : Port_Type; --  ends up in linker section ".bss"
4778   procedure Q with Linker_Section => "Qsection";
4779 end IO_Card;
4780 @end example
4782 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4783 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{92}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{93}
4784 @section Pragma Lock_Free
4787 Syntax:
4788 This pragma may be specified for protected types or objects. It specifies that
4789 the implementation of protected operations must be implemented without locks.
4790 Compilation fails if the compiler cannot generate lock-free code for the
4791 operations.
4793 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
4794 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{94}
4795 @section Pragma Loop_Invariant
4798 Syntax:
4800 @example
4801 pragma Loop_Invariant ( boolean_EXPRESSION );
4802 @end example
4804 The effect of this pragma is similar to that of pragma @cite{Assert},
4805 except that in an @cite{Assertion_Policy} pragma, the identifier
4806 @cite{Loop_Invariant} is used to control whether it is ignored or checked
4807 (or disabled).
4809 @cite{Loop_Invariant} can only appear as one of the items in the sequence
4810 of statements of a loop body, or nested inside block statements that
4811 appear in the sequence of statements of a loop body.
4812 The intention is that it be used to
4813 represent a "loop invariant" assertion, i.e. something that is true each
4814 time through the loop, and which can be used to show that the loop is
4815 achieving its purpose.
4817 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4818 apply to the same loop should be grouped in the same sequence of
4819 statements.
4821 To aid in writing such invariants, the special attribute @cite{Loop_Entry}
4822 may be used to refer to the value of an expression on entry to the loop. This
4823 attribute can only be used within the expression of a @cite{Loop_Invariant}
4824 pragma. For full details, see documentation of attribute @cite{Loop_Entry}.
4826 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
4827 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{95}
4828 @section Pragma Loop_Optimize
4831 Syntax:
4833 @example
4834 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4836 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
4837 @end example
4839 This pragma must appear immediately within a loop statement.  It allows the
4840 programmer to specify optimization hints for the enclosing loop.  The hints
4841 are not mutually exclusive and can be freely mixed, but not all combinations
4842 will yield a sensible outcome.
4844 There are five supported optimization hints for a loop:
4847 @itemize *
4849 @item 
4850 Ivdep
4852 The programmer asserts that there are no loop-carried dependencies
4853 which would prevent consecutive iterations of the loop from being
4854 executed simultaneously.
4856 @item 
4857 No_Unroll
4859 The loop must not be unrolled.  This is a strong hint: the compiler will not
4860 unroll a loop marked with this hint.
4862 @item 
4863 Unroll
4865 The loop should be unrolled.  This is a weak hint: the compiler will try to
4866 apply unrolling to this loop preferably to other optimizations, notably
4867 vectorization, but there is no guarantee that the loop will be unrolled.
4869 @item 
4870 No_Vector
4872 The loop must not be vectorized.  This is a strong hint: the compiler will not
4873 vectorize a loop marked with this hint.
4875 @item 
4876 Vector
4878 The loop should be vectorized.  This is a weak hint: the compiler will try to
4879 apply vectorization to this loop preferably to other optimizations, notably
4880 unrolling, but there is no guarantee that the loop will be vectorized.
4881 @end itemize
4883 These hints do not remove the need to pass the appropriate switches to the
4884 compiler in order to enable the relevant optimizations, that is to say
4885 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
4886 vectorization.
4888 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
4889 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{96}
4890 @section Pragma Loop_Variant
4893 Syntax:
4895 @example
4896 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
4897 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
4898 CHANGE_DIRECTION ::= Increases | Decreases
4899 @end example
4901 @cite{Loop_Variant} can only appear as one of the items in the sequence
4902 of statements of a loop body, or nested inside block statements that
4903 appear in the sequence of statements of a loop body.
4904 It allows the specification of quantities which must always
4905 decrease or increase in successive iterations of the loop. In its simplest
4906 form, just one expression is specified, whose value must increase or decrease
4907 on each iteration of the loop.
4909 In a more complex form, multiple arguments can be given which are intepreted
4910 in a nesting lexicographic manner. For example:
4912 @example
4913 pragma Loop_Variant (Increases => X, Decreases => Y);
4914 @end example
4916 specifies that each time through the loop either X increases, or X stays
4917 the same and Y decreases. A @cite{Loop_Variant} pragma ensures that the
4918 loop is making progress. It can be useful in helping to show informally
4919 or prove formally that the loop always terminates.
4921 @cite{Loop_Variant} is an assertion whose effect can be controlled using
4922 an @cite{Assertion_Policy} with a check name of @cite{Loop_Variant}. The
4923 policy can be @cite{Check} to enable the loop variant check, @cite{Ignore}
4924 to ignore the check (in which case the pragma has no effect on the program),
4925 or @cite{Disable} in which case the pragma is not even checked for correct
4926 syntax.
4928 Multiple @cite{Loop_Invariant} and @cite{Loop_Variant} pragmas that
4929 apply to the same loop should be grouped in the same sequence of
4930 statements.
4932 The @cite{Loop_Entry} attribute may be used within the expressions of the
4933 @cite{Loop_Variant} pragma to refer to values on entry to the loop.
4935 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
4936 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{97}
4937 @section Pragma Machine_Attribute
4940 Syntax:
4942 @example
4943 pragma Machine_Attribute (
4944      [Entity         =>] LOCAL_NAME,
4945      [Attribute_Name =>] static_string_EXPRESSION
4946   [, [Info           =>] static_EXPRESSION] );
4947 @end example
4949 Machine-dependent attributes can be specified for types and/or
4950 declarations.  This pragma is semantically equivalent to
4951 @cite{__attribute__((`attribute_name}))` (if @cite{info} is not
4952 specified) or @cite{__attribute__((`attribute_name`(`info})))
4953 in GNU C, where @code{attribute_name} is recognized by the
4954 compiler middle-end or the @cite{TARGET_ATTRIBUTE_TABLE} machine
4955 specific macro.  A string literal for the optional parameter @cite{info}
4956 is transformed into an identifier, which may make this pragma unusable
4957 for some attributes.
4958 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
4960 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
4961 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{98}
4962 @section Pragma Main
4965 Syntax:
4967 @example
4968 pragma Main
4969  (MAIN_OPTION [, MAIN_OPTION]);
4971 MAIN_OPTION ::=
4972   [Stack_Size              =>] static_integer_EXPRESSION
4973 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
4974 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
4975 @end example
4977 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4978 no effect in GNAT, other than being syntax checked.
4980 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
4981 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{99}
4982 @section Pragma Main_Storage
4985 Syntax:
4987 @example
4988 pragma Main_Storage
4989   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
4991 MAIN_STORAGE_OPTION ::=
4992   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
4993 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
4994 @end example
4996 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4997 no effect in GNAT, other than being syntax checked.
4999 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5000 @anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9a}
5001 @section Pragma Max_Queue_Length
5004 Syntax:
5006 @example
5007 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5008 @end example
5010 This pragma is used to specify the maximum callers per entry queue for
5011 individual protected entries and entry families. It accepts a single
5012 positive integer as a parameter and must appear after the declaration
5013 of an entry.
5015 @node Pragma No_Body,Pragma No_Elaboration_Code_All,Pragma Max_Queue_Length,Implementation Defined Pragmas
5016 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{9b}
5017 @section Pragma No_Body
5020 Syntax:
5022 @example
5023 pragma No_Body;
5024 @end example
5026 There are a number of cases in which a package spec does not require a body,
5027 and in fact a body is not permitted. GNAT will not permit the spec to be
5028 compiled if there is a body around. The pragma No_Body allows you to provide
5029 a body file, even in a case where no body is allowed. The body file must
5030 contain only comments and a single No_Body pragma. This is recognized by
5031 the compiler as indicating that no body is logically present.
5033 This is particularly useful during maintenance when a package is modified in
5034 such a way that a body needed before is no longer needed. The provision of a
5035 dummy body with a No_Body pragma ensures that there is no interference from
5036 earlier versions of the package body.
5038 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Body,Implementation Defined Pragmas
5039 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9c}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{9d}
5040 @section Pragma No_Elaboration_Code_All
5043 Syntax:
5045 @example
5046 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5047 @end example
5049 This is a program unit pragma (there is also an equivalent aspect of the
5050 same name) that establishes the restriction @cite{No_Elaboration_Code} for
5051 the current unit and any extended main source units (body and subunits).
5052 It also has the effect of enforcing a transitive application of this
5053 aspect, so that if any unit is implicitly or explicitly with'ed by the
5054 current unit, it must also have the No_Elaboration_Code_All aspect set.
5055 It may be applied to package or subprogram specs or their generic versions.
5057 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5058 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{9e}
5059 @section Pragma No_Heap_Finalization
5062 Syntax:
5064 @example
5065 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5066 @end example
5068 Pragma @cite{No_Heap_Finalization} may be used as a configuration pragma or as a
5069 type-specific pragma.
5071 In its configuration form, the pragma must appear within a configuration file
5072 such as gnat.adc, without an argument. The pragma suppresses the call to
5073 @cite{Finalize} for heap-allocated objects created through library-level named
5074 access-to-object types in cases where the designated type requires finalization
5075 actions.
5077 In its type-specific form, the argument of the pragma must denote a
5078 library-level named access-to-object type. The pragma suppresses the call to
5079 @cite{Finalize} for heap-allocated objects created through the specific access type
5080 in cases where the designated type requires finalization actions.
5082 It is still possible to finalize such heap-allocated objects by explicitly
5083 deallocating them.
5085 A library-level named access-to-object type declared within a generic unit will
5086 lose its @cite{No_Heap_Finalization} pragma when the corresponding instance does not
5087 appear at the library level.
5089 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5090 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{9f}
5091 @section Pragma No_Inline
5094 Syntax:
5096 @example
5097 pragma No_Inline (NAME @{, NAME@});
5098 @end example
5100 This pragma suppresses inlining for the callable entity or the instances of
5101 the generic subprogram designated by @cite{NAME}, including inlining that
5102 results from the use of pragma @cite{Inline}.  This pragma is always active,
5103 in particular it is not subject to the use of option @emph{-gnatn} or
5104 @emph{-gnatN}.  It is illegal to specify both pragma @cite{No_Inline} and
5105 pragma @cite{Inline_Always} for the same @cite{NAME}.
5107 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
5108 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a0}
5109 @section Pragma No_Return
5112 Syntax:
5114 @example
5115 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5116 @end example
5118 Each @cite{procedure_LOCAL_NAME} argument must refer to one or more procedure
5119 declarations in the current declarative part.  A procedure to which this
5120 pragma is applied may not contain any explicit @cite{return} statements.
5121 In addition, if the procedure contains any implicit returns from falling
5122 off the end of a statement sequence, then execution of that implicit
5123 return will cause Program_Error to be raised.
5125 One use of this pragma is to identify procedures whose only purpose is to raise
5126 an exception. Another use of this pragma is to suppress incorrect warnings
5127 about missing returns in functions, where the last statement of a function
5128 statement sequence is a call to such a procedure.
5130 Note that in Ada 2005 mode, this pragma is part of the language. It is
5131 available in all earlier versions of Ada as an implementation-defined
5132 pragma.
5134 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
5135 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{a1}
5136 @section Pragma No_Run_Time
5139 Syntax:
5141 @example
5142 pragma No_Run_Time;
5143 @end example
5145 This is an obsolete configuration pragma that historically was used to
5146 set up a runtime library with no object code. It is now used only for
5147 internal testing. The pragma has been superseded by the reconfigurable
5148 runtime capability of @cite{GNAT}.
5150 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
5151 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{a2}
5152 @section Pragma No_Strict_Aliasing
5155 Syntax:
5157 @example
5158 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5159 @end example
5161 @cite{type_LOCAL_NAME} must refer to an access type
5162 declaration in the current declarative part.  The effect is to inhibit
5163 strict aliasing optimization for the given type.  The form with no
5164 arguments is a configuration pragma which applies to all access types
5165 declared in units to which the pragma applies. For a detailed
5166 description of the strict aliasing optimization, and the situations
5167 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5168 in the @cite{GNAT User's Guide}.
5170 This pragma currently has no effects on access to unconstrained array types.
5172 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5173 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{a3}@anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{a4}
5174 @section Pragma No_Tagged_Streams
5177 Syntax:
5179 @example
5180 pragma No_Tagged_Streams;
5181 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5182 @end example
5184 Normally when a tagged type is introduced using a full type declaration,
5185 part of the processing includes generating stream access routines to be
5186 used by stream attributes referencing the type (or one of its subtypes
5187 or derived types). This can involve the generation of significant amounts
5188 of code which is wasted space if stream routines are not needed for the
5189 type in question.
5191 The @cite{No_Tagged_Streams} pragma causes the generation of these stream
5192 routines to be skipped, and any attempt to use stream operations on
5193 types subject to this pragma will be statically rejected as illegal.
5195 There are two forms of the pragma. The form with no arguments must appear
5196 in a declarative sequence or in the declarations of a package spec. This
5197 pragma affects all subsequent root tagged types declared in the declaration
5198 sequence, and specifies that no stream routines be generated. The form with
5199 an argument (for which there is also a corresponding aspect) specifies a
5200 single root tagged type for which stream routines are not to be generated.
5202 Once the pragma has been given for a particular root tagged type, all subtypes
5203 and derived types of this type inherit the pragma automatically, so the effect
5204 applies to a complete hierarchy (this is necessary to deal with the class-wide
5205 dispatching versions of the stream routines).
5207 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5208 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{a5}
5209 @section Pragma Normalize_Scalars
5212 Syntax:
5214 @example
5215 pragma Normalize_Scalars;
5216 @end example
5218 This is a language defined pragma which is fully implemented in GNAT.  The
5219 effect is to cause all scalar objects that are not otherwise initialized
5220 to be initialized.  The initial values are implementation dependent and
5221 are as follows:
5224 @table @asis
5226 @item @emph{Standard.Character}
5228 Objects whose root type is Standard.Character are initialized to
5229 Character'Last unless the subtype range excludes NUL (in which case
5230 NUL is used). This choice will always generate an invalid value if
5231 one exists.
5233 @item @emph{Standard.Wide_Character}
5235 Objects whose root type is Standard.Wide_Character are initialized to
5236 Wide_Character'Last unless the subtype range excludes NUL (in which case
5237 NUL is used). This choice will always generate an invalid value if
5238 one exists.
5240 @item @emph{Standard.Wide_Wide_Character}
5242 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5243 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5244 which case NUL is used). This choice will always generate an invalid value if
5245 one exists.
5247 @item @emph{Integer types}
5249 Objects of an integer type are treated differently depending on whether
5250 negative values are present in the subtype. If no negative values are
5251 present, then all one bits is used as the initial value except in the
5252 special case where zero is excluded from the subtype, in which case
5253 all zero bits are used. This choice will always generate an invalid
5254 value if one exists.
5256 For subtypes with negative values present, the largest negative number
5257 is used, except in the unusual case where this largest negative number
5258 is in the subtype, and the largest positive number is not, in which case
5259 the largest positive value is used. This choice will always generate
5260 an invalid value if one exists.
5262 @item @emph{Floating-Point Types}
5264 Objects of all floating-point types are initialized to all 1-bits. For
5265 standard IEEE format, this corresponds to a NaN (not a number) which is
5266 indeed an invalid value.
5268 @item @emph{Fixed-Point Types}
5270 Objects of all fixed-point types are treated as described above for integers,
5271 with the rules applying to the underlying integer value used to represent
5272 the fixed-point value.
5274 @item @emph{Modular types}
5276 Objects of a modular type are initialized to all one bits, except in
5277 the special case where zero is excluded from the subtype, in which
5278 case all zero bits are used. This choice will always generate an
5279 invalid value if one exists.
5281 @item @emph{Enumeration types}
5283 Objects of an enumeration type are initialized to all one-bits, i.e., to
5284 the value @cite{2 ** typ'Size - 1} unless the subtype excludes the literal
5285 whose Pos value is zero, in which case a code of zero is used. This choice
5286 will always generate an invalid value if one exists.
5287 @end table
5289 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5290 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{a6}@anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a7}
5291 @section Pragma Obsolescent
5294 Syntax:
5296 @example
5297 pragma Obsolescent;
5299 pragma Obsolescent (
5300   [Message =>] static_string_EXPRESSION
5301 [,[Version =>] Ada_05]]);
5303 pragma Obsolescent (
5304   [Entity  =>] NAME
5305 [,[Message =>] static_string_EXPRESSION
5306 [,[Version =>] Ada_05]] );
5307 @end example
5309 This pragma can occur immediately following a declaration of an entity,
5310 including the case of a record component. If no Entity argument is present,
5311 then this declaration is the one to which the pragma applies. If an Entity
5312 parameter is present, it must either match the name of the entity in this
5313 declaration, or alternatively, the pragma can immediately follow an enumeration
5314 type declaration, where the Entity argument names one of the enumeration
5315 literals.
5317 This pragma is used to indicate that the named entity
5318 is considered obsolescent and should not be used. Typically this is
5319 used when an API must be modified by eventually removing or modifying
5320 existing subprograms or other entities. The pragma can be used at an
5321 intermediate stage when the entity is still present, but will be
5322 removed later.
5324 The effect of this pragma is to output a warning message on a reference to
5325 an entity thus marked that the subprogram is obsolescent if the appropriate
5326 warning option in the compiler is activated. If the Message parameter is
5327 present, then a second warning message is given containing this text. In
5328 addition, a reference to the entity is considered to be a violation of pragma
5329 Restrictions (No_Obsolescent_Features).
5331 This pragma can also be used as a program unit pragma for a package,
5332 in which case the entity name is the name of the package, and the
5333 pragma indicates that the entire package is considered
5334 obsolescent. In this case a client @cite{with}'ing such a package
5335 violates the restriction, and the @cite{with} statement is
5336 flagged with warnings if the warning option is set.
5338 If the Version parameter is present (which must be exactly
5339 the identifier Ada_05, no other argument is allowed), then the
5340 indication of obsolescence applies only when compiling in Ada 2005
5341 mode. This is primarily intended for dealing with the situations
5342 in the predefined library where subprograms or packages
5343 have become defined as obsolescent in Ada 2005
5344 (e.g., in Ada.Characters.Handling), but may be used anywhere.
5346 The following examples show typical uses of this pragma:
5348 @example
5349 package p is
5350    pragma Obsolescent (p, Message => "use pp instead of p");
5351 end p;
5353 package q is
5354    procedure q2;
5355    pragma Obsolescent ("use q2new instead");
5357    type R is new integer;
5358    pragma Obsolescent
5359      (Entity  => R,
5360       Message => "use RR in Ada 2005",
5361       Version => Ada_05);
5363    type M is record
5364       F1 : Integer;
5365       F2 : Integer;
5366       pragma Obsolescent;
5367       F3 : Integer;
5368    end record;
5370    type E is (a, bc, 'd', quack);
5371    pragma Obsolescent (Entity => bc)
5372    pragma Obsolescent (Entity => 'd')
5374    function "+"
5375      (a, b : character) return character;
5376    pragma Obsolescent (Entity => "+");
5377 end;
5378 @end example
5380 Note that, as for all pragmas, if you use a pragma argument identifier,
5381 then all subsequent parameters must also use a pragma argument identifier.
5382 So if you specify "Entity =>" for the Entity argument, and a Message
5383 argument is present, it must be preceded by "Message =>".
5385 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5386 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{a8}
5387 @section Pragma Optimize_Alignment
5390 @geindex Alignment
5391 @geindex default settings
5393 Syntax:
5395 @example
5396 pragma Optimize_Alignment (TIME | SPACE | OFF);
5397 @end example
5399 This is a configuration pragma which affects the choice of default alignments
5400 for types and objects where no alignment is explicitly specified. There is a
5401 time/space trade-off in the selection of these values. Large alignments result
5402 in more efficient code, at the expense of larger data space, since sizes have
5403 to be increased to match these alignments. Smaller alignments save space, but
5404 the access code is slower. The normal choice of default alignments for types
5405 and individual alignment promotions for objects (which is what you get if you
5406 do not use this pragma, or if you use an argument of OFF), tries to balance
5407 these two requirements.
5409 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5410 First any packed record is given an alignment of 1. Second, if a size is given
5411 for the type, then the alignment is chosen to avoid increasing this size. For
5412 example, consider:
5414 @example
5415 type R is record
5416    X : Integer;
5417    Y : Character;
5418 end record;
5420 for R'Size use 5*8;
5421 @end example
5423 In the default mode, this type gets an alignment of 4, so that access to the
5424 Integer field X are efficient. But this means that objects of the type end up
5425 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5426 allowed to be bigger than the size of the type, but it can waste space if for
5427 example fields of type R appear in an enclosing record. If the above type is
5428 compiled in @cite{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5430 However, there is one case in which SPACE is ignored. If a variable length
5431 record (that is a discriminated record with a component which is an array
5432 whose length depends on a discriminant), has a pragma Pack, then it is not
5433 in general possible to set the alignment of such a record to one, so the
5434 pragma is ignored in this case (with a warning).
5436 Specifying SPACE also disables alignment promotions for standalone objects,
5437 which occur when the compiler increases the alignment of a specific object
5438 without changing the alignment of its type.
5440 Specifying TIME causes larger default alignments to be chosen in the case of
5441 small types with sizes that are not a power of 2. For example, consider:
5443 @example
5444 type R is record
5445    A : Character;
5446    B : Character;
5447    C : Boolean;
5448 end record;
5450 pragma Pack (R);
5451 for R'Size use 17;
5452 @end example
5454 The default alignment for this record is normally 1, but if this type is
5455 compiled in @cite{Optimize_Alignment (Time)} mode, then the alignment is set
5456 to 4, which wastes space for objects of the type, since they are now 4 bytes
5457 long, but results in more efficient access when the whole record is referenced.
5459 As noted above, this is a configuration pragma, and there is a requirement
5460 that all units in a partition be compiled with a consistent setting of the
5461 optimization setting. This would normally be achieved by use of a configuration
5462 pragma file containing the appropriate setting. The exception to this rule is
5463 that units with an explicit configuration pragma in the same file as the source
5464 unit are excluded from the consistency check, as are all predefined units. The
5465 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5466 pragma appears at the start of the file.
5468 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5469 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{a9}
5470 @section Pragma Ordered
5473 Syntax:
5475 @example
5476 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5477 @end example
5479 Most enumeration types are from a conceptual point of view unordered.
5480 For example, consider:
5482 @example
5483 type Color is (Red, Blue, Green, Yellow);
5484 @end example
5486 By Ada semantics @cite{Blue > Red} and @cite{Green > Blue},
5487 but really these relations make no sense; the enumeration type merely
5488 specifies a set of possible colors, and the order is unimportant.
5490 For unordered enumeration types, it is generally a good idea if
5491 clients avoid comparisons (other than equality or inequality) and
5492 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5493 other than the unit where the type is declared, its body, and its subunits.)
5494 For example, if code buried in some client says:
5496 @example
5497 if Current_Color < Yellow then ...
5498 if Current_Color in Blue .. Green then ...
5499 @end example
5501 then the client code is relying on the order, which is undesirable.
5502 It makes the code hard to read and creates maintenance difficulties if
5503 entries have to be added to the enumeration type. Instead,
5504 the code in the client should list the possibilities, or an
5505 appropriate subtype should be declared in the unit that declares
5506 the original enumeration type. E.g., the following subtype could
5507 be declared along with the type @cite{Color}:
5509 @example
5510 subtype RBG is Color range Red .. Green;
5511 @end example
5513 and then the client could write:
5515 @example
5516 if Current_Color in RBG then ...
5517 if Current_Color = Blue or Current_Color = Green then ...
5518 @end example
5520 However, some enumeration types are legitimately ordered from a conceptual
5521 point of view. For example, if you declare:
5523 @example
5524 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5525 @end example
5527 then the ordering imposed by the language is reasonable, and
5528 clients can depend on it, writing for example:
5530 @example
5531 if D in Mon .. Fri then ...
5532 if D < Wed then ...
5533 @end example
5535 The pragma @emph{Ordered} is provided to mark enumeration types that
5536 are conceptually ordered, alerting the reader that clients may depend
5537 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5538 rather than one to mark them as unordered, since in our experience,
5539 the great majority of enumeration types are conceptually unordered.
5541 The types @cite{Boolean}, @cite{Character}, @cite{Wide_Character},
5542 and @cite{Wide_Wide_Character}
5543 are considered to be ordered types, so each is declared with a
5544 pragma @cite{Ordered} in package @cite{Standard}.
5546 Normally pragma @cite{Ordered} serves only as documentation and a guide for
5547 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5548 requests warnings for inappropriate uses (comparisons and explicit
5549 subranges) for unordered types. If this switch is used, then any
5550 enumeration type not marked with pragma @cite{Ordered} will be considered
5551 as unordered, and will generate warnings for inappropriate uses.
5553 Note that generic types are not considered ordered or unordered (since the
5554 template can be instantiated for both cases), so we never generate warnings
5555 for the case of generic enumerated types.
5557 For additional information please refer to the description of the
5558 @emph{-gnatw.u} switch in the GNAT User's Guide.
5560 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5561 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{aa}
5562 @section Pragma Overflow_Mode
5565 Syntax:
5567 @example
5568 pragma Overflow_Mode
5569  (  [General    =>] MODE
5570   [,[Assertions =>] MODE]);
5572 MODE ::= STRICT | MINIMIZED | ELIMINATED
5573 @end example
5575 This pragma sets the current overflow mode to the given setting. For details
5576 of the meaning of these modes, please refer to the
5577 'Overflow Check Handling in GNAT' appendix in the
5578 GNAT User's Guide. If only the @cite{General} parameter is present,
5579 the given mode applies to all expressions. If both parameters are present,
5580 the @cite{General} mode applies to expressions outside assertions, and
5581 the @cite{Eliminated} mode applies to expressions within assertions.
5583 The case of the @cite{MODE} parameter is ignored,
5584 so @cite{MINIMIZED}, @cite{Minimized} and
5585 @cite{minimized} all have the same effect.
5587 The @cite{Overflow_Mode} pragma has the same scoping and placement
5588 rules as pragma @cite{Suppress}, so it can occur either as a
5589 configuration pragma, specifying a default for the whole
5590 program, or in a declarative scope, where it applies to the
5591 remaining declarations and statements in that scope.
5593 The pragma @cite{Suppress (Overflow_Check)} suppresses
5594 overflow checking, but does not affect the overflow mode.
5596 The pragma @cite{Unsuppress (Overflow_Check)} unsuppresses (enables)
5597 overflow checking, but does not affect the overflow mode.
5599 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5600 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{ab}
5601 @section Pragma Overriding_Renamings
5604 @geindex Rational profile
5606 @geindex Rational compatibility
5608 Syntax:
5610 @example
5611 pragma Overriding_Renamings;
5612 @end example
5614 This is a GNAT configuration pragma to simplify porting
5615 legacy code accepted by the Rational
5616 Ada compiler. In the presence of this pragma, a renaming declaration that
5617 renames an inherited operation declared in the same scope is legal if selected
5618 notation is used as in:
5620 @example
5621 pragma Overriding_Renamings;
5623 package R is
5624   function F (..);
5625   ...
5626   function F (..) renames R.F;
5627 end R;
5628 @end example
5630 even though
5631 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5632 declaration of the overriding operation.
5634 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5635 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{ac}
5636 @section Pragma Partition_Elaboration_Policy
5639 Syntax:
5641 @example
5642 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5644 POLICY_IDENTIFIER ::= Concurrent | Sequential
5645 @end example
5647 This pragma is standard in Ada 2005, but is available in all earlier
5648 versions of Ada as an implementation-defined pragma.
5649 See Ada 2012 Reference Manual for details.
5651 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5652 @anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{ad}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{ae}
5653 @section Pragma Part_Of
5656 Syntax:
5658 @example
5659 pragma Part_Of (ABSTRACT_STATE);
5661 ABSTRACT_STATE ::= NAME
5662 @end example
5664 For the semantics of this pragma, see the entry for aspect @cite{Part_Of} in the
5665 SPARK 2014 Reference Manual, section 7.2.6.
5667 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
5668 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{af}
5669 @section Pragma Passive
5672 Syntax:
5674 @example
5675 pragma Passive [(Semaphore | No)];
5676 @end example
5678 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5679 compatibility with DEC Ada 83 implementations, where it is used within a
5680 task definition to request that a task be made passive.  If the argument
5681 @cite{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5682 treats the pragma as an assertion that the containing task is passive
5683 and that optimization of context switch with this task is permitted and
5684 desired.  If the argument @cite{No} is present, the task must not be
5685 optimized.  GNAT does not attempt to optimize any tasks in this manner
5686 (since protected objects are available in place of passive tasks).
5688 For more information on the subject of passive tasks, see the section
5689 'Passive Task Optimization' in the GNAT Users Guide.
5691 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
5692 @anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b0}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{b1}
5693 @section Pragma Persistent_BSS
5696 Syntax:
5698 @example
5699 pragma Persistent_BSS [(LOCAL_NAME)]
5700 @end example
5702 This pragma allows selected objects to be placed in the @cite{.persistent_bss}
5703 section. On some targets the linker and loader provide for special
5704 treatment of this section, allowing a program to be reloaded without
5705 affecting the contents of this data (hence the name persistent).
5707 There are two forms of usage. If an argument is given, it must be the
5708 local name of a library level object, with no explicit initialization
5709 and whose type is potentially persistent. If no argument is given, then
5710 the pragma is a configuration pragma, and applies to all library level
5711 objects with no explicit initialization of potentially persistent types.
5713 A potentially persistent type is a scalar type, or an untagged,
5714 non-discriminated record, all of whose components have no explicit
5715 initialization and are themselves of a potentially persistent type,
5716 or an array, all of whose constraints are static, and whose component
5717 type is potentially persistent.
5719 If this pragma is used on a target where this feature is not supported,
5720 then the pragma will be ignored. See also @cite{pragma Linker_Section}.
5722 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
5723 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{b2}
5724 @section Pragma Polling
5727 Syntax:
5729 @example
5730 pragma Polling (ON | OFF);
5731 @end example
5733 This pragma controls the generation of polling code.  This is normally off.
5734 If @cite{pragma Polling (ON)} is used then periodic calls are generated to
5735 the routine @cite{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5736 runtime library, and can be found in file @code{a-excpol.adb}.
5738 Pragma @cite{Polling} can appear as a configuration pragma (for example it
5739 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
5740 can be used in the statement or declaration sequence to control polling
5741 more locally.
5743 A call to the polling routine is generated at the start of every loop and
5744 at the start of every subprogram call.  This guarantees that the @cite{Poll}
5745 routine is called frequently, and places an upper bound (determined by
5746 the complexity of the code) on the period between two @cite{Poll} calls.
5748 The primary purpose of the polling interface is to enable asynchronous
5749 aborts on targets that cannot otherwise support it (for example Windows
5750 NT), but it may be used for any other purpose requiring periodic polling.
5751 The standard version is null, and can be replaced by a user program.  This
5752 will require re-compilation of the @cite{Ada.Exceptions} package that can
5753 be found in files @code{a-except.ads} and @code{a-except.adb}.
5755 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
5756 distribution) is used to enable the asynchronous abort capability on
5757 targets that do not normally support the capability.  The version of
5758 @cite{Poll} in this file makes a call to the appropriate runtime routine
5759 to test for an abort condition.
5761 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
5762 See the section on switches for gcc in the @cite{GNAT User's Guide}.
5764 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
5765 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b3}
5766 @section Pragma Post
5769 @geindex Post
5771 @geindex Checks
5772 @geindex postconditions
5774 Syntax:
5776 @example
5777 pragma Post (Boolean_Expression);
5778 @end example
5780 The @cite{Post} pragma is intended to be an exact replacement for
5781 the language-defined
5782 @cite{Post} aspect, and shares its restrictions and semantics.
5783 It must appear either immediately following the corresponding
5784 subprogram declaration (only other pragmas may intervene), or
5785 if there is no separate subprogram declaration, then it can
5786 appear at the start of the declarations in a subprogram body
5787 (preceded only by other pragmas).
5789 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
5790 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{b4}
5791 @section Pragma Postcondition
5794 @geindex Postcondition
5796 @geindex Checks
5797 @geindex postconditions
5799 Syntax:
5801 @example
5802 pragma Postcondition (
5803    [Check   =>] Boolean_Expression
5804  [,[Message =>] String_Expression]);
5805 @end example
5807 The @cite{Postcondition} pragma allows specification of automatic
5808 postcondition checks for subprograms. These checks are similar to
5809 assertions, but are automatically inserted just prior to the return
5810 statements of the subprogram with which they are associated (including
5811 implicit returns at the end of procedure bodies and associated
5812 exception handlers).
5814 In addition, the boolean expression which is the condition which
5815 must be true may contain references to function'Result in the case
5816 of a function to refer to the returned value.
5818 @cite{Postcondition} pragmas may appear either immediately following the
5819 (separate) declaration of a subprogram, or at the start of the
5820 declarations of a subprogram body. Only other pragmas may intervene
5821 (that is appear between the subprogram declaration and its
5822 postconditions, or appear before the postcondition in the
5823 declaration sequence in a subprogram body). In the case of a
5824 postcondition appearing after a subprogram declaration, the
5825 formal arguments of the subprogram are visible, and can be
5826 referenced in the postcondition expressions.
5828 The postconditions are collected and automatically tested just
5829 before any return (implicit or explicit) in the subprogram body.
5830 A postcondition is only recognized if postconditions are active
5831 at the time the pragma is encountered. The compiler switch @emph{gnata}
5832 turns on all postconditions by default, and pragma @cite{Check_Policy}
5833 with an identifier of @cite{Postcondition} can also be used to
5834 control whether postconditions are active.
5836 The general approach is that postconditions are placed in the spec
5837 if they represent functional aspects which make sense to the client.
5838 For example we might have:
5840 @example
5841 function Direction return Integer;
5842 pragma Postcondition
5843  (Direction'Result = +1
5844     or else
5845   Direction'Result = -1);
5846 @end example
5848 which serves to document that the result must be +1 or -1, and
5849 will test that this is the case at run time if postcondition
5850 checking is active.
5852 Postconditions within the subprogram body can be used to
5853 check that some internal aspect of the implementation,
5854 not visible to the client, is operating as expected.
5855 For instance if a square root routine keeps an internal
5856 counter of the number of times it is called, then we
5857 might have the following postcondition:
5859 @example
5860 Sqrt_Calls : Natural := 0;
5862 function Sqrt (Arg : Float) return Float is
5863   pragma Postcondition
5864     (Sqrt_Calls = Sqrt_Calls'Old + 1);
5865   ...
5866 end Sqrt
5867 @end example
5869 As this example, shows, the use of the @cite{Old} attribute
5870 is often useful in postconditions to refer to the state on
5871 entry to the subprogram.
5873 Note that postconditions are only checked on normal returns
5874 from the subprogram. If an abnormal return results from
5875 raising an exception, then the postconditions are not checked.
5877 If a postcondition fails, then the exception
5878 @cite{System.Assertions.Assert_Failure} is raised. If
5879 a message argument was supplied, then the given string
5880 will be used as the exception message. If no message
5881 argument was supplied, then the default message has
5882 the form "Postcondition failed at file_name:line". The
5883 exception is raised in the context of the subprogram
5884 body, so it is possible to catch postcondition failures
5885 within the subprogram body itself.
5887 Within a package spec, normal visibility rules
5888 in Ada would prevent forward references within a
5889 postcondition pragma to functions defined later in
5890 the same package. This would introduce undesirable
5891 ordering constraints. To avoid this problem, all
5892 postcondition pragmas are analyzed at the end of
5893 the package spec, allowing forward references.
5895 The following example shows that this even allows
5896 mutually recursive postconditions as in:
5898 @example
5899 package Parity_Functions is
5900    function Odd  (X : Natural) return Boolean;
5901    pragma Postcondition
5902      (Odd'Result =
5903         (x = 1
5904           or else
5905         (x /= 0 and then Even (X - 1))));
5907    function Even (X : Natural) return Boolean;
5908    pragma Postcondition
5909      (Even'Result =
5910         (x = 0
5911           or else
5912         (x /= 1 and then Odd (X - 1))));
5914 end Parity_Functions;
5915 @end example
5917 There are no restrictions on the complexity or form of
5918 conditions used within @cite{Postcondition} pragmas.
5919 The following example shows that it is even possible
5920 to verify performance behavior.
5922 @example
5923 package Sort is
5925    Performance : constant Float;
5926    --  Performance constant set by implementation
5927    --  to match target architecture behavior.
5929    procedure Treesort (Arg : String);
5930    --  Sorts characters of argument using N*logN sort
5931    pragma Postcondition
5932      (Float (Clock - Clock'Old) <=
5933         Float (Arg'Length) *
5934         log (Float (Arg'Length)) *
5935         Performance);
5936 end Sort;
5937 @end example
5939 Note: postcondition pragmas associated with subprograms that are
5940 marked as Inline_Always, or those marked as Inline with front-end
5941 inlining (-gnatN option set) are accepted and legality-checked
5942 by the compiler, but are ignored at run-time even if postcondition
5943 checking is enabled.
5945 Note that pragma @cite{Postcondition} differs from the language-defined
5946 @cite{Post} aspect (and corresponding @cite{Post} pragma) in allowing
5947 multiple occurrences, allowing occurences in the body even if there
5948 is a separate spec, and allowing a second string parameter, and the
5949 use of the pragma identifier @cite{Check}. Historically, pragma
5950 @cite{Postcondition} was implemented prior to the development of
5951 Ada 2012, and has been retained in its original form for
5952 compatibility purposes.
5954 @node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
5955 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{b5}
5956 @section Pragma Post_Class
5959 @geindex Post
5961 @geindex Checks
5962 @geindex postconditions
5964 Syntax:
5966 @example
5967 pragma Post_Class (Boolean_Expression);
5968 @end example
5970 The @cite{Post_Class} pragma is intended to be an exact replacement for
5971 the language-defined
5972 @cite{Post'Class} aspect, and shares its restrictions and semantics.
5973 It must appear either immediately following the corresponding
5974 subprogram declaration (only other pragmas may intervene), or
5975 if there is no separate subprogram declaration, then it can
5976 appear at the start of the declarations in a subprogram body
5977 (preceded only by other pragmas).
5979 Note: This pragma is called @cite{Post_Class} rather than
5980 @cite{Post'Class} because the latter would not be strictly
5981 conforming to the allowed syntax for pragmas. The motivation
5982 for provinding pragmas equivalent to the aspects is to allow a program
5983 to be written using the pragmas, and then compiled if necessary
5984 using an Ada compiler that does not recognize the pragmas or
5985 aspects, but is prepared to ignore the pragmas. The assertion
5986 policy that controls this pragma is @cite{Post'Class}, not
5987 @cite{Post_Class}.
5989 @node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
5990 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{b6}
5991 @section Pragma Rename_Pragma
5994 @geindex Pragmas
5995 @geindex synonyms
5997 Syntax:
5999 @example
6000 pragma Rename_Pragma (
6001          [New_Name =>] IDENTIFIER,
6002          [Renamed  =>] pragma_IDENTIFIER);
6003 @end example
6005 This pragma provides a mechanism for supplying new names for existing
6006 pragmas. The @cite{New_Name} identifier can subsequently be used as a synonym for
6007 the Renamed pragma. For example, suppose you have code that was originally
6008 developed on a compiler that supports Inline_Only as an implementation defined
6009 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
6010 least very similar to) the GNAT implementation defined pragma
6011 Inline_Always. You could globally replace Inline_Only with Inline_Always.
6013 However, to avoid that source modification, you could instead add a
6014 configuration pragma:
6016 @example
6017 pragma Rename_Pragma (
6018          New_Name => Inline_Only,
6019          Renamed  => Inline_Always);
6020 @end example
6022 Then GNAT will treat "pragma Inline_Only ..." as if you had written
6023 "pragma Inline_Always ...".
6025 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
6026 compiler; it's up to you to make sure the semantics are close enough.
6028 @node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
6029 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{b7}
6030 @section Pragma Pre
6033 @geindex Pre
6035 @geindex Checks
6036 @geindex preconditions
6038 Syntax:
6040 @example
6041 pragma Pre (Boolean_Expression);
6042 @end example
6044 The @cite{Pre} pragma is intended to be an exact replacement for
6045 the language-defined
6046 @cite{Pre} aspect, and shares its restrictions and semantics.
6047 It must appear either immediately following the corresponding
6048 subprogram declaration (only other pragmas may intervene), or
6049 if there is no separate subprogram declaration, then it can
6050 appear at the start of the declarations in a subprogram body
6051 (preceded only by other pragmas).
6053 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6054 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{b8}
6055 @section Pragma Precondition
6058 @geindex Preconditions
6060 @geindex Checks
6061 @geindex preconditions
6063 Syntax:
6065 @example
6066 pragma Precondition (
6067    [Check   =>] Boolean_Expression
6068  [,[Message =>] String_Expression]);
6069 @end example
6071 The @cite{Precondition} pragma is similar to @cite{Postcondition}
6072 except that the corresponding checks take place immediately upon
6073 entry to the subprogram, and if a precondition fails, the exception
6074 is raised in the context of the caller, and the attribute 'Result
6075 cannot be used within the precondition expression.
6077 Otherwise, the placement and visibility rules are identical to those
6078 described for postconditions. The following is an example of use
6079 within a package spec:
6081 @example
6082 package Math_Functions is
6083    ...
6084    function Sqrt (Arg : Float) return Float;
6085    pragma Precondition (Arg >= 0.0)
6086    ...
6087 end Math_Functions;
6088 @end example
6090 @cite{Precondition} pragmas may appear either immediately following the
6091 (separate) declaration of a subprogram, or at the start of the
6092 declarations of a subprogram body. Only other pragmas may intervene
6093 (that is appear between the subprogram declaration and its
6094 postconditions, or appear before the postcondition in the
6095 declaration sequence in a subprogram body).
6097 Note: precondition pragmas associated with subprograms that are
6098 marked as Inline_Always, or those marked as Inline with front-end
6099 inlining (-gnatN option set) are accepted and legality-checked
6100 by the compiler, but are ignored at run-time even if precondition
6101 checking is enabled.
6103 Note that pragma @cite{Precondition} differs from the language-defined
6104 @cite{Pre} aspect (and corresponding @cite{Pre} pragma) in allowing
6105 multiple occurrences, allowing occurences in the body even if there
6106 is a separate spec, and allowing a second string parameter, and the
6107 use of the pragma identifier @cite{Check}. Historically, pragma
6108 @cite{Precondition} was implemented prior to the development of
6109 Ada 2012, and has been retained in its original form for
6110 compatibility purposes.
6112 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6113 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{b9}@anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{ba}
6114 @section Pragma Predicate
6117 Syntax:
6119 @example
6120 pragma Predicate
6121   ([Entity =>] type_LOCAL_NAME,
6122    [Check  =>] EXPRESSION);
6123 @end example
6125 This pragma (available in all versions of Ada in GNAT) encompasses both
6126 the @cite{Static_Predicate} and @cite{Dynamic_Predicate} aspects in
6127 Ada 2012. A predicate is regarded as static if it has an allowed form
6128 for @cite{Static_Predicate} and is otherwise treated as a
6129 @cite{Dynamic_Predicate}. Otherwise, predicates specified by this
6130 pragma behave exactly as described in the Ada 2012 reference manual.
6131 For example, if we have
6133 @example
6134 type R is range 1 .. 10;
6135 subtype S is R;
6136 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6137 subtype Q is R
6138 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6139 @end example
6141 the effect is identical to the following Ada 2012 code:
6143 @example
6144 type R is range 1 .. 10;
6145 subtype S is R with
6146   Static_Predicate => S not in 4 .. 6;
6147 subtype Q is R with
6148   Dynamic_Predicate => F(Q) or G(Q);
6149 @end example
6151 Note that there are no pragmas @cite{Dynamic_Predicate}
6152 or @cite{Static_Predicate}. That is
6153 because these pragmas would affect legality and semantics of
6154 the program and thus do not have a neutral effect if ignored.
6155 The motivation behind providing pragmas equivalent to
6156 corresponding aspects is to allow a program to be written
6157 using the pragmas, and then compiled with a compiler that
6158 will ignore the pragmas. That doesn't work in the case of
6159 static and dynamic predicates, since if the corresponding
6160 pragmas are ignored, then the behavior of the program is
6161 fundamentally changed (for example a membership test
6162 @cite{A in B} would not take into account a predicate
6163 defined for subtype B). When following this approach, the
6164 use of predicates should be avoided.
6166 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6167 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{bb}
6168 @section Pragma Predicate_Failure
6171 Syntax:
6173 @example
6174 pragma Predicate_Failure
6175   ([Entity  =>] type_LOCAL_NAME,
6176    [Message =>] String_Expression);
6177 @end example
6179 The @cite{Predicate_Failure} pragma is intended to be an exact replacement for
6180 the language-defined
6181 @cite{Predicate_Failure} aspect, and shares its restrictions and semantics.
6183 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6184 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{bc}
6185 @section Pragma Preelaborable_Initialization
6188 Syntax:
6190 @example
6191 pragma Preelaborable_Initialization (DIRECT_NAME);
6192 @end example
6194 This pragma is standard in Ada 2005, but is available in all earlier
6195 versions of Ada as an implementation-defined pragma.
6196 See Ada 2012 Reference Manual for details.
6198 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6199 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{bd}
6200 @section Pragma Prefix_Exception_Messages
6203 @geindex Prefix_Exception_Messages
6205 @geindex exception
6207 @geindex Exception_Message
6209 Syntax:
6211 @example
6212 pragma Prefix_Exception_Messages;
6213 @end example
6215 This is an implementation-defined configuration pragma that affects the
6216 behavior of raise statements with a message given as a static string
6217 constant (typically a string literal). In such cases, the string will
6218 be automatically prefixed by the name of the enclosing entity (giving
6219 the package and subprogram containing the raise statement). This helps
6220 to identify where messages are coming from, and this mode is automatic
6221 for the run-time library.
6223 The pragma has no effect if the message is computed with an expression other
6224 than a static string constant, since the assumption in this case is that
6225 the program computes exactly the string it wants. If you still want the
6226 prefixing in this case, you can always call
6227 @cite{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6229 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6230 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{be}
6231 @section Pragma Pre_Class
6234 @geindex Pre_Class
6236 @geindex Checks
6237 @geindex preconditions
6239 Syntax:
6241 @example
6242 pragma Pre_Class (Boolean_Expression);
6243 @end example
6245 The @cite{Pre_Class} pragma is intended to be an exact replacement for
6246 the language-defined
6247 @cite{Pre'Class} aspect, and shares its restrictions and semantics.
6248 It must appear either immediately following the corresponding
6249 subprogram declaration (only other pragmas may intervene), or
6250 if there is no separate subprogram declaration, then it can
6251 appear at the start of the declarations in a subprogram body
6252 (preceded only by other pragmas).
6254 Note: This pragma is called @cite{Pre_Class} rather than
6255 @cite{Pre'Class} because the latter would not be strictly
6256 conforming to the allowed syntax for pragmas. The motivation
6257 for providing pragmas equivalent to the aspects is to allow a program
6258 to be written using the pragmas, and then compiled if necessary
6259 using an Ada compiler that does not recognize the pragmas or
6260 aspects, but is prepared to ignore the pragmas. The assertion
6261 policy that controls this pragma is @cite{Pre'Class}, not
6262 @cite{Pre_Class}.
6264 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6265 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{bf}
6266 @section Pragma Priority_Specific_Dispatching
6269 Syntax:
6271 @example
6272 pragma Priority_Specific_Dispatching (
6273    POLICY_IDENTIFIER,
6274    first_priority_EXPRESSION,
6275    last_priority_EXPRESSION)
6277 POLICY_IDENTIFIER ::=
6278    EDF_Across_Priorities            |
6279    FIFO_Within_Priorities           |
6280    Non_Preemptive_Within_Priorities |
6281    Round_Robin_Within_Priorities
6282 @end example
6284 This pragma is standard in Ada 2005, but is available in all earlier
6285 versions of Ada as an implementation-defined pragma.
6286 See Ada 2012 Reference Manual for details.
6288 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6289 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c0}
6290 @section Pragma Profile
6293 Syntax:
6295 @example
6296 pragma Profile (Ravenscar | Restricted | Rational |
6297                 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6298 @end example
6300 This pragma is standard in Ada 2005, but is available in all earlier
6301 versions of Ada as an implementation-defined pragma. This is a
6302 configuration pragma that establishes a set of configuration pragmas
6303 that depend on the argument. @cite{Ravenscar} is standard in Ada 2005.
6304 The other possibilities (@cite{Restricted}, @cite{Rational},
6305 @cite{GNAT_Extended_Ravenscar}, @cite{GNAT_Ravenscar_EDF})
6306 are implementation-defined. The set of configuration pragmas
6307 is defined in the following sections.
6310 @itemize *
6312 @item 
6313 Pragma Profile (Ravenscar)
6315 The @cite{Ravenscar} profile is standard in Ada 2005,
6316 but is available in all earlier
6317 versions of Ada as an implementation-defined pragma. This profile
6318 establishes the following set of configuration pragmas:
6321 @itemize *
6323 @item 
6324 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6326 [RM D.2.2] Tasks are dispatched following a preemptive
6327 priority-ordered scheduling policy.
6329 @item 
6330 @code{Locking_Policy (Ceiling_Locking)}
6332 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6333 the ceiling priority of the corresponding protected object.
6335 @item 
6336 @code{Detect_Blocking}
6338 This pragma forces the detection of potentially blocking operations within a
6339 protected operation, and to raise Program_Error if that happens.
6340 @end itemize
6342 plus the following set of restrictions:
6345 @itemize *
6347 @item 
6348 @code{Max_Entry_Queue_Length => 1}
6350 No task can be queued on a protected entry.
6352 @item 
6353 @code{Max_Protected_Entries => 1}
6355 @item 
6356 @code{Max_Task_Entries => 0}
6358 No rendezvous statements are allowed.
6360 @item 
6361 @code{No_Abort_Statements}
6363 @item 
6364 @code{No_Dynamic_Attachment}
6366 @item 
6367 @code{No_Dynamic_Priorities}
6369 @item 
6370 @code{No_Implicit_Heap_Allocations}
6372 @item 
6373 @code{No_Local_Protected_Objects}
6375 @item 
6376 @code{No_Local_Timing_Events}
6378 @item 
6379 @code{No_Protected_Type_Allocators}
6381 @item 
6382 @code{No_Relative_Delay}
6384 @item 
6385 @code{No_Requeue_Statements}
6387 @item 
6388 @code{No_Select_Statements}
6390 @item 
6391 @code{No_Specific_Termination_Handlers}
6393 @item 
6394 @code{No_Task_Allocators}
6396 @item 
6397 @code{No_Task_Hierarchy}
6399 @item 
6400 @code{No_Task_Termination}
6402 @item 
6403 @code{Simple_Barriers}
6404 @end itemize
6406 The Ravenscar profile also includes the following restrictions that specify
6407 that there are no semantic dependences on the corresponding predefined
6408 packages:
6411 @itemize *
6413 @item 
6414 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6416 @item 
6417 @code{No_Dependence => Ada.Calendar}
6419 @item 
6420 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6422 @item 
6423 @code{No_Dependence => Ada.Execution_Time.Timers}
6425 @item 
6426 @code{No_Dependence => Ada.Task_Attributes}
6428 @item 
6429 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6430 @end itemize
6432 This set of configuration pragmas and restrictions correspond to the
6433 definition of the 'Ravenscar Profile' for limited tasking, devised and
6434 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6435 A description is also available at
6436 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6438 The original definition of the profile was revised at subsequent IRTAW
6439 meetings. It has been included in the ISO
6440 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6441 and was made part of the Ada 2005 standard.
6442 The formal definition given by
6443 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6444 AI-305) available at
6445 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6446 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6448 The above set is a superset of the restrictions provided by pragma
6449 @code{Profile (Restricted)}, it includes six additional restrictions
6450 (@code{Simple_Barriers}, @code{No_Select_Statements},
6451 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6452 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6453 that pragma @code{Profile (Ravenscar)}, like the pragma
6454 @code{Profile (Restricted)},
6455 automatically causes the use of a simplified,
6456 more efficient version of the tasking run-time library.
6458 @item 
6459 Pragma Profile (GNAT_Extended_Ravenscar)
6461 This profile corresponds to a GNAT specific extension of the
6462 Ravenscar profile. The profile may change in the future although
6463 only in a compatible way: some restrictions may be removed or
6464 relaxed. It is defined as a variation of the Ravenscar profile.
6466 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6467 by @code{No_Implicit_Task_Allocations} and
6468 @code{No_Implicit_Protected_Object_Allocations}.
6470 The @code{Simple_Barriers} restriction has been replaced by
6471 @code{Pure_Barriers}.
6473 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6474 @code{No_Relative_Delay} restrictions have been removed.
6476 @item 
6477 Pragma Profile (GNAT_Ravenscar_EDF)
6479 This profile corresponds to the Ravenscar profile but using
6480 EDF_Across_Priority as the Task_Scheduling_Policy.
6482 @item 
6483 Pragma Profile (Restricted)
6485 This profile corresponds to the GNAT restricted run time. It
6486 establishes the following set of restrictions:
6489 @itemize *
6491 @item 
6492 @code{No_Abort_Statements}
6494 @item 
6495 @code{No_Entry_Queue}
6497 @item 
6498 @code{No_Task_Hierarchy}
6500 @item 
6501 @code{No_Task_Allocators}
6503 @item 
6504 @code{No_Dynamic_Priorities}
6506 @item 
6507 @code{No_Terminate_Alternatives}
6509 @item 
6510 @code{No_Dynamic_Attachment}
6512 @item 
6513 @code{No_Protected_Type_Allocators}
6515 @item 
6516 @code{No_Local_Protected_Objects}
6518 @item 
6519 @code{No_Requeue_Statements}
6521 @item 
6522 @code{No_Task_Attributes_Package}
6524 @item 
6525 @code{Max_Asynchronous_Select_Nesting =  0}
6527 @item 
6528 @code{Max_Task_Entries =  0}
6530 @item 
6531 @code{Max_Protected_Entries = 1}
6533 @item 
6534 @code{Max_Select_Alternatives = 0}
6535 @end itemize
6537 This set of restrictions causes the automatic selection of a simplified
6538 version of the run time that provides improved performance for the
6539 limited set of tasking functionality permitted by this set of restrictions.
6541 @item 
6542 Pragma Profile (Rational)
6544 The Rational profile is intended to facilitate porting legacy code that
6545 compiles with the Rational APEX compiler, even when the code includes non-
6546 conforming Ada constructs.  The profile enables the following three pragmas:
6549 @itemize *
6551 @item 
6552 @code{pragma Implicit_Packing}
6554 @item 
6555 @code{pragma Overriding_Renamings}
6557 @item 
6558 @code{pragma Use_VADS_Size}
6559 @end itemize
6560 @end itemize
6562 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6563 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c1}
6564 @section Pragma Profile_Warnings
6567 Syntax:
6569 @example
6570 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6571 @end example
6573 This is an implementation-defined pragma that is similar in
6574 effect to @cite{pragma Profile} except that instead of
6575 generating @cite{Restrictions} pragmas, it generates
6576 @cite{Restriction_Warnings} pragmas. The result is that
6577 violations of the profile generate warning messages instead
6578 of error messages.
6580 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6581 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c2}
6582 @section Pragma Propagate_Exceptions
6585 @geindex Interfacing to C++
6587 Syntax:
6589 @example
6590 pragma Propagate_Exceptions;
6591 @end example
6593 This pragma is now obsolete and, other than generating a warning if warnings
6594 on obsolescent features are enabled, is ignored.
6595 It is retained for compatibility
6596 purposes. It used to be used in connection with optimization of
6597 a now-obsolete mechanism for implementation of exceptions.
6599 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6600 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c3}
6601 @section Pragma Provide_Shift_Operators
6604 @geindex Shift operators
6606 Syntax:
6608 @example
6609 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6610 @end example
6612 This pragma can be applied to a first subtype local name that specifies
6613 either an unsigned or signed type. It has the effect of providing the
6614 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6615 Rotate_Left and Rotate_Right) for the given type. It is similar to
6616 including the function declarations for these five operators, together
6617 with the pragma Import (Intrinsic, ...) statements.
6619 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6620 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{c4}
6621 @section Pragma Psect_Object
6624 Syntax:
6626 @example
6627 pragma Psect_Object (
6628      [Internal =>] LOCAL_NAME,
6629   [, [External =>] EXTERNAL_SYMBOL]
6630   [, [Size     =>] EXTERNAL_SYMBOL]);
6632 EXTERNAL_SYMBOL ::=
6633   IDENTIFIER
6634 | static_string_EXPRESSION
6635 @end example
6637 This pragma is identical in effect to pragma @cite{Common_Object}.
6639 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6640 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{c5}@anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{c6}
6641 @section Pragma Pure_Function
6644 Syntax:
6646 @example
6647 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6648 @end example
6650 This pragma appears in the same declarative part as a function
6651 declaration (or a set of function declarations if more than one
6652 overloaded declaration exists, in which case the pragma applies
6653 to all entities).  It specifies that the function @cite{Entity} is
6654 to be considered pure for the purposes of code generation.  This means
6655 that the compiler can assume that there are no side effects, and
6656 in particular that two calls with identical arguments produce the
6657 same result.  It also means that the function can be used in an
6658 address clause.
6660 Note that, quite deliberately, there are no static checks to try
6661 to ensure that this promise is met, so @cite{Pure_Function} can be used
6662 with functions that are conceptually pure, even if they do modify
6663 global variables.  For example, a square root function that is
6664 instrumented to count the number of times it is called is still
6665 conceptually pure, and can still be optimized, even though it
6666 modifies a global variable (the count).  Memo functions are another
6667 example (where a table of previous calls is kept and consulted to
6668 avoid re-computation).
6670 Note also that the normal rules excluding optimization of subprograms
6671 in pure units (when parameter types are descended from System.Address,
6672 or when the full view of a parameter type is limited), do not apply
6673 for the Pure_Function case. If you explicitly specify Pure_Function,
6674 the compiler may optimize away calls with identical arguments, and
6675 if that results in unexpected behavior, the proper action is not to
6676 use the pragma for subprograms that are not (conceptually) pure.
6678 Note: Most functions in a @cite{Pure} package are automatically pure, and
6679 there is no need to use pragma @cite{Pure_Function} for such functions.  One
6680 exception is any function that has at least one formal of type
6681 @cite{System.Address} or a type derived from it.  Such functions are not
6682 considered pure by default, since the compiler assumes that the
6683 @cite{Address} parameter may be functioning as a pointer and that the
6684 referenced data may change even if the address value does not.
6685 Similarly, imported functions are not considered to be pure by default,
6686 since there is no way of checking that they are in fact pure.  The use
6687 of pragma @cite{Pure_Function} for such a function will override these default
6688 assumption, and cause the compiler to treat a designated subprogram as pure
6689 in these cases.
6691 Note: If pragma @cite{Pure_Function} is applied to a renamed function, it
6692 applies to the underlying renamed function.  This can be used to
6693 disambiguate cases of overloading where some but not all functions
6694 in a set of overloaded functions are to be designated as pure.
6696 If pragma @cite{Pure_Function} is applied to a library level function, the
6697 function is also considered pure from an optimization point of view, but the
6698 unit is not a Pure unit in the categorization sense. So for example, a function
6699 thus marked is free to @cite{with} non-pure units.
6701 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6702 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{c7}
6703 @section Pragma Rational
6706 Syntax:
6708 @example
6709 pragma Rational;
6710 @end example
6712 This pragma is considered obsolescent, but is retained for
6713 compatibility purposes. It is equivalent to:
6715 @example
6716 pragma Profile (Rational);
6717 @end example
6719 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6720 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{c8}
6721 @section Pragma Ravenscar
6724 Syntax:
6726 @example
6727 pragma Ravenscar;
6728 @end example
6730 This pragma is considered obsolescent, but is retained for
6731 compatibility purposes. It is equivalent to:
6733 @example
6734 pragma Profile (Ravenscar);
6735 @end example
6737 which is the preferred method of setting the @cite{Ravenscar} profile.
6739 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6740 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{c9}@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{ca}
6741 @section Pragma Refined_Depends
6744 Syntax:
6746 @example
6747 pragma Refined_Depends (DEPENDENCY_RELATION);
6749 DEPENDENCY_RELATION ::=
6750      null
6751   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
6753 DEPENDENCY_CLAUSE ::=
6754     OUTPUT_LIST =>[+] INPUT_LIST
6755   | NULL_DEPENDENCY_CLAUSE
6757 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
6759 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
6761 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
6763 OUTPUT ::= NAME | FUNCTION_RESULT
6764 INPUT  ::= NAME
6766 where FUNCTION_RESULT is a function Result attribute_reference
6767 @end example
6769 For the semantics of this pragma, see the entry for aspect @cite{Refined_Depends} in
6770 the SPARK 2014 Reference Manual, section 6.1.5.
6772 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6773 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{cb}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{cc}
6774 @section Pragma Refined_Global
6777 Syntax:
6779 @example
6780 pragma Refined_Global (GLOBAL_SPECIFICATION);
6782 GLOBAL_SPECIFICATION ::=
6783      null
6784   | (GLOBAL_LIST)
6785   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
6787 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
6789 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
6790 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
6791 GLOBAL_ITEM   ::= NAME
6792 @end example
6794 For the semantics of this pragma, see the entry for aspect @cite{Refined_Global} in
6795 the SPARK 2014 Reference Manual, section 6.1.4.
6797 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
6798 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{cd}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{ce}
6799 @section Pragma Refined_Post
6802 Syntax:
6804 @example
6805 pragma Refined_Post (boolean_EXPRESSION);
6806 @end example
6808 For the semantics of this pragma, see the entry for aspect @cite{Refined_Post} in
6809 the SPARK 2014 Reference Manual, section 7.2.7.
6811 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
6812 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{cf}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{d0}
6813 @section Pragma Refined_State
6816 Syntax:
6818 @example
6819 pragma Refined_State (REFINEMENT_LIST);
6821 REFINEMENT_LIST ::=
6822   (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
6824 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
6826 CONSTITUENT_LIST ::=
6827      null
6828   |  CONSTITUENT
6829   | (CONSTITUENT @{, CONSTITUENT@})
6831 CONSTITUENT ::= object_NAME | state_NAME
6832 @end example
6834 For the semantics of this pragma, see the entry for aspect @cite{Refined_State} in
6835 the SPARK 2014 Reference Manual, section 7.2.2.
6837 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
6838 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d1}
6839 @section Pragma Relative_Deadline
6842 Syntax:
6844 @example
6845 pragma Relative_Deadline (time_span_EXPRESSION);
6846 @end example
6848 This pragma is standard in Ada 2005, but is available in all earlier
6849 versions of Ada as an implementation-defined pragma.
6850 See Ada 2012 Reference Manual for details.
6852 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
6853 @anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d3}
6854 @section Pragma Remote_Access_Type
6857 Syntax:
6859 @example
6860 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
6861 @end example
6863 This pragma appears in the formal part of a generic declaration.
6864 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
6865 the use of a remote access to class-wide type as actual for a formal
6866 access type.
6868 When this pragma applies to a formal access type @cite{Entity}, that
6869 type is treated as a remote access to class-wide type in the generic.
6870 It must be a formal general access type, and its designated type must
6871 be the class-wide type of a formal tagged limited private type from the
6872 same generic declaration.
6874 In the generic unit, the formal type is subject to all restrictions
6875 pertaining to remote access to class-wide types. At instantiation, the
6876 actual type must be a remote access to class-wide type.
6878 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
6879 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{d4}
6880 @section Pragma Restricted_Run_Time
6883 Syntax:
6885 @example
6886 pragma Restricted_Run_Time;
6887 @end example
6889 This pragma is considered obsolescent, but is retained for
6890 compatibility purposes. It is equivalent to:
6892 @example
6893 pragma Profile (Restricted);
6894 @end example
6896 which is the preferred method of setting the restricted run time
6897 profile.
6899 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
6900 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{d5}
6901 @section Pragma Restriction_Warnings
6904 Syntax:
6906 @example
6907 pragma Restriction_Warnings
6908   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
6909 @end example
6911 This pragma allows a series of restriction identifiers to be
6912 specified (the list of allowed identifiers is the same as for
6913 pragma @cite{Restrictions}). For each of these identifiers
6914 the compiler checks for violations of the restriction, but
6915 generates a warning message rather than an error message
6916 if the restriction is violated.
6918 One use of this is in situations where you want to know
6919 about violations of a restriction, but you want to ignore some of
6920 these violations. Consider this example, where you want to set
6921 Ada_95 mode and enable style checks, but you want to know about
6922 any other use of implementation pragmas:
6924 @example
6925 pragma Restriction_Warnings (No_Implementation_Pragmas);
6926 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
6927 pragma Ada_95;
6928 pragma Style_Checks ("2bfhkM160");
6929 pragma Warnings (On, "violation of No_Implementation_Pragmas");
6930 @end example
6932 By including the above lines in a configuration pragmas file,
6933 the Ada_95 and Style_Checks pragmas are accepted without
6934 generating a warning, but any other use of implementation
6935 defined pragmas will cause a warning to be generated.
6937 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
6938 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{d6}
6939 @section Pragma Reviewable
6942 Syntax:
6944 @example
6945 pragma Reviewable;
6946 @end example
6948 This pragma is an RM-defined standard pragma, but has no effect on the
6949 program being compiled, or on the code generated for the program.
6951 To obtain the required output specified in RM H.3.1, the compiler must be
6952 run with various special switches as follows:
6955 @itemize *
6957 @item 
6958 @emph{Where compiler-generated run-time checks remain}
6960 The switch @emph{-gnatGL}
6961 may be used to list the expanded code in pseudo-Ada form.
6962 Runtime checks show up in the listing either as explicit
6963 checks or operators marked with @{@} to indicate a check is present.
6965 @item 
6966 @emph{An identification of known exceptions at compile time}
6968 If the program is compiled with @emph{-gnatwa},
6969 the compiler warning messages will indicate all cases where the compiler
6970 detects that an exception is certain to occur at run time.
6972 @item 
6973 @emph{Possible reads of uninitialized variables}
6975 The compiler warns of many such cases, but its output is incomplete.
6976 @end itemize
6979 A supplemental static analysis tool
6980 may be used to obtain a comprehensive list of all
6981 possible points at which uninitialized data may be read.
6984 @itemize *
6986 @item 
6987 @emph{Where run-time support routines are implicitly invoked}
6989 In the output from @emph{-gnatGL},
6990 run-time calls are explicitly listed as calls to the relevant
6991 run-time routine.
6993 @item 
6994 @emph{Object code listing}
6996 This may be obtained either by using the @emph{-S} switch,
6997 or the objdump utility.
6999 @item 
7000 @emph{Constructs known to be erroneous at compile time}
7002 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
7004 @item 
7005 @emph{Stack usage information}
7007 Static stack usage data (maximum per-subprogram) can be obtained via the
7008 @emph{-fstack-usage} switch to the compiler.
7009 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
7010 to gnatbind
7011 @end itemize
7015 @itemize *
7017 @item 
7018 @emph{Object code listing of entire partition}
7020 This can be obtained by compiling the partition with @emph{-S},
7021 or by applying objdump
7022 to all the object files that are part of the partition.
7024 @item 
7025 @emph{A description of the run-time model}
7027 The full sources of the run-time are available, and the documentation of
7028 these routines describes how these run-time routines interface to the
7029 underlying operating system facilities.
7031 @item 
7032 @emph{Control and data-flow information}
7033 @end itemize
7036 A supplemental static analysis tool
7037 may be used to obtain complete control and data-flow information, as well as
7038 comprehensive messages identifying possible problems based on this
7039 information.
7041 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7042 @anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d7}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{d8}
7043 @section Pragma Secondary_Stack_Size
7046 Syntax:
7048 @example
7049 pragma Secondary_Stack_Size (integer_EXPRESSION);
7050 @end example
7052 This pragma appears within the task definition of a single task declaration
7053 or a task type declaration (like pragma @cite{Storage_Size}) and applies to all
7054 task objects of that type. The argument specifies the size of the secondary
7055 stack to be used by these task objects, and must be of an integer type. The
7056 secondary stack is used to handle functions that return a variable-sized
7057 result, for example a function returning an unconstrained String.
7059 Note this pragma only applies to targets using fixed secondary stacks, like
7060 VxWorks 653 and bare board targets, where a fixed block for the
7061 secondary stack is allocated from the primary stack of the task. By default,
7062 these targets assign a percentage of the primary stack for the secondary stack,
7063 as defined by @cite{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7064 an @cite{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7066 For most targets, the pragma does not apply as the secondary stack grows on
7067 demand: allocated as a chain of blocks in the heap. The default size of these
7068 blocks can be modified via the @cite{-D} binder option as described in
7069 @cite{GNAT User's Guide}.
7071 Note that no check is made to see if the secondary stack can fit inside the
7072 primary stack.
7074 Note the pragma cannot appear when the restriction @cite{No_Secondary_Stack}
7075 is in effect.
7077 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7078 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{d9}
7079 @section Pragma Share_Generic
7082 Syntax:
7084 @example
7085 pragma Share_Generic (GNAME @{, GNAME@});
7087 GNAME ::= generic_unit_NAME | generic_instance_NAME
7088 @end example
7090 This pragma is provided for compatibility with Dec Ada 83. It has
7091 no effect in @cite{GNAT} (which does not implement shared generics), other
7092 than to check that the given names are all names of generic units or
7093 generic instances.
7095 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7096 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{da}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{db}
7097 @section Pragma Shared
7100 This pragma is provided for compatibility with Ada 83. The syntax and
7101 semantics are identical to pragma Atomic.
7103 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7104 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{dc}
7105 @section Pragma Short_Circuit_And_Or
7108 Syntax:
7110 @example
7111 pragma Short_Circuit_And_Or;
7112 @end example
7114 This configuration pragma causes any occurrence of the AND operator applied to
7115 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7116 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7117 may be useful in the context of certification protocols requiring the use of
7118 short-circuited logical operators. If this configuration pragma occurs locally
7119 within the file being compiled, it applies only to the file being compiled.
7120 There is no requirement that all units in a partition use this option.
7122 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7123 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{dd}
7124 @section Pragma Short_Descriptors
7127 Syntax:
7129 @example
7130 pragma Short_Descriptors
7131 @end example
7133 This pragma is provided for compatibility with other Ada implementations. It
7134 is recognized but ignored by all current versions of GNAT.
7136 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7137 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{de}@anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{df}
7138 @section Pragma Simple_Storage_Pool_Type
7141 @geindex Storage pool
7142 @geindex simple
7144 @geindex Simple storage pool
7146 Syntax:
7148 @example
7149 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7150 @end example
7152 A type can be established as a 'simple storage pool type' by applying
7153 the representation pragma @cite{Simple_Storage_Pool_Type} to the type.
7154 A type named in the pragma must be a library-level immutably limited record
7155 type or limited tagged type declared immediately within a package declaration.
7156 The type can also be a limited private type whose full type is allowed as
7157 a simple storage pool type.
7159 For a simple storage pool type @cite{SSP}, nonabstract primitive subprograms
7160 @cite{Allocate}, @cite{Deallocate}, and @cite{Storage_Size} can be declared that
7161 are subtype conformant with the following subprogram declarations:
7163 @example
7164 procedure Allocate
7165   (Pool                     : in out SSP;
7166    Storage_Address          : out System.Address;
7167    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7168    Alignment                : System.Storage_Elements.Storage_Count);
7170 procedure Deallocate
7171   (Pool : in out SSP;
7172    Storage_Address          : System.Address;
7173    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7174    Alignment                : System.Storage_Elements.Storage_Count);
7176 function Storage_Size (Pool : SSP)
7177   return System.Storage_Elements.Storage_Count;
7178 @end example
7180 Procedure @cite{Allocate} must be declared, whereas @cite{Deallocate} and
7181 @cite{Storage_Size} are optional. If @cite{Deallocate} is not declared, then
7182 applying an unchecked deallocation has no effect other than to set its actual
7183 parameter to null. If @cite{Storage_Size} is not declared, then the
7184 @cite{Storage_Size} attribute applied to an access type associated with
7185 a pool object of type SSP returns zero. Additional operations can be declared
7186 for a simple storage pool type (such as for supporting a mark/release
7187 storage-management discipline).
7189 An object of a simple storage pool type can be associated with an access
7190 type by specifying the attribute
7191 @ref{e0,,Simple_Storage_Pool}. For example:
7193 @example
7194 My_Pool : My_Simple_Storage_Pool_Type;
7196 type Acc is access My_Data_Type;
7198 for Acc'Simple_Storage_Pool use My_Pool;
7199 @end example
7201 See attribute @ref{e0,,Simple_Storage_Pool}
7202 for further details.
7204 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7205 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{e1}@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e2}
7206 @section Pragma Source_File_Name
7209 Syntax:
7211 @example
7212 pragma Source_File_Name (
7213   [Unit_Name   =>] unit_NAME,
7214   Spec_File_Name =>  STRING_LITERAL,
7215   [Index => INTEGER_LITERAL]);
7217 pragma Source_File_Name (
7218   [Unit_Name   =>] unit_NAME,
7219   Body_File_Name =>  STRING_LITERAL,
7220   [Index => INTEGER_LITERAL]);
7221 @end example
7223 Use this to override the normal naming convention.  It is a configuration
7224 pragma, and so has the usual applicability of configuration pragmas
7225 (i.e., it applies to either an entire partition, or to all units in a
7226 compilation, or to a single unit, depending on how it is used.
7227 @cite{unit_name} is mapped to @cite{file_name_literal}.  The identifier for
7228 the second argument is required, and indicates whether this is the file
7229 name for the spec or for the body.
7231 The optional Index argument should be used when a file contains multiple
7232 units, and when you do not want to use @cite{gnatchop} to separate then
7233 into multiple files (which is the recommended procedure to limit the
7234 number of recompilations that are needed when some sources change).
7235 For instance, if the source file @code{source.ada} contains
7237 @example
7238 package B is
7240 end B;
7242 with B;
7243 procedure A is
7244 begin
7245    ..
7246 end A;
7247 @end example
7249 you could use the following configuration pragmas:
7251 @example
7252 pragma Source_File_Name
7253   (B, Spec_File_Name => "source.ada", Index => 1);
7254 pragma Source_File_Name
7255   (A, Body_File_Name => "source.ada", Index => 2);
7256 @end example
7258 Note that the @cite{gnatname} utility can also be used to generate those
7259 configuration pragmas.
7261 Another form of the @cite{Source_File_Name} pragma allows
7262 the specification of patterns defining alternative file naming schemes
7263 to apply to all files.
7265 @example
7266 pragma Source_File_Name
7267   (  [Spec_File_Name  =>] STRING_LITERAL
7268    [,[Casing          =>] CASING_SPEC]
7269    [,[Dot_Replacement =>] STRING_LITERAL]);
7271 pragma Source_File_Name
7272   (  [Body_File_Name  =>] STRING_LITERAL
7273    [,[Casing          =>] CASING_SPEC]
7274    [,[Dot_Replacement =>] STRING_LITERAL]);
7276 pragma Source_File_Name
7277   (  [Subunit_File_Name =>] STRING_LITERAL
7278    [,[Casing            =>] CASING_SPEC]
7279    [,[Dot_Replacement   =>] STRING_LITERAL]);
7281 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7282 @end example
7284 The first argument is a pattern that contains a single asterisk indicating
7285 the point at which the unit name is to be inserted in the pattern string
7286 to form the file name.  The second argument is optional.  If present it
7287 specifies the casing of the unit name in the resulting file name string.
7288 The default is lower case.  Finally the third argument allows for systematic
7289 replacement of any dots in the unit name by the specified string literal.
7291 Note that Source_File_Name pragmas should not be used if you are using
7292 project files. The reason for this rule is that the project manager is not
7293 aware of these pragmas, and so other tools that use the projet file would not
7294 be aware of the intended naming conventions. If you are using project files,
7295 file naming is controlled by Source_File_Name_Project pragmas, which are
7296 usually supplied automatically by the project manager. A pragma
7297 Source_File_Name cannot appear after a @ref{e3,,Pragma Source_File_Name_Project}.
7299 For more details on the use of the @cite{Source_File_Name} pragma, see the
7300 sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7302 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7303 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{e3}@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e4}
7304 @section Pragma Source_File_Name_Project
7307 This pragma has the same syntax and semantics as pragma Source_File_Name.
7308 It is only allowed as a stand-alone configuration pragma.
7309 It cannot appear after a @ref{e2,,Pragma Source_File_Name}, and
7310 most importantly, once pragma Source_File_Name_Project appears,
7311 no further Source_File_Name pragmas are allowed.
7313 The intention is that Source_File_Name_Project pragmas are always
7314 generated by the Project Manager in a manner consistent with the naming
7315 specified in a project file, and when naming is controlled in this manner,
7316 it is not permissible to attempt to modify this naming scheme using
7317 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7318 known to the project manager).
7320 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7321 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{e5}
7322 @section Pragma Source_Reference
7325 Syntax:
7327 @example
7328 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7329 @end example
7331 This pragma must appear as the first line of a source file.
7332 @cite{integer_literal} is the logical line number of the line following
7333 the pragma line (for use in error messages and debugging
7334 information).  @cite{string_literal} is a static string constant that
7335 specifies the file name to be used in error messages and debugging
7336 information.  This is most notably used for the output of @cite{gnatchop}
7337 with the @emph{-r} switch, to make sure that the original unchopped
7338 source file is the one referred to.
7340 The second argument must be a string literal, it cannot be a static
7341 string expression other than a string literal.  This is because its value
7342 is needed for error messages issued by all phases of the compiler.
7344 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7345 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{e6}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e7}
7346 @section Pragma SPARK_Mode
7349 Syntax:
7351 @example
7352 pragma SPARK_Mode [(On | Off)] ;
7353 @end example
7355 In general a program can have some parts that are in SPARK 2014 (and
7356 follow all the rules in the SPARK Reference Manual), and some parts
7357 that are full Ada 2012.
7359 The SPARK_Mode pragma is used to identify which parts are in SPARK
7360 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7361 be used in the following places:
7364 @itemize *
7366 @item 
7367 As a configuration pragma, in which case it sets the default mode for
7368 all units compiled with this pragma.
7370 @item 
7371 Immediately following a library-level subprogram spec
7373 @item 
7374 Immediately within a library-level package body
7376 @item 
7377 Immediately following the @cite{private} keyword of a library-level
7378 package spec
7380 @item 
7381 Immediately following the @cite{begin} keyword of a library-level
7382 package body
7384 @item 
7385 Immediately within a library-level subprogram body
7386 @end itemize
7388 Normally a subprogram or package spec/body inherits the current mode
7389 that is active at the point it is declared. But this can be overridden
7390 by pragma within the spec or body as above.
7392 The basic consistency rule is that you can't turn SPARK_Mode back
7393 @cite{On}, once you have explicitly (with a pragma) turned if
7394 @cite{Off}. So the following rules apply:
7396 If a subprogram spec has SPARK_Mode @cite{Off}, then the body must
7397 also have SPARK_Mode @cite{Off}.
7399 For a package, we have four parts:
7402 @itemize *
7404 @item 
7405 the package public declarations
7407 @item 
7408 the package private part
7410 @item 
7411 the body of the package
7413 @item 
7414 the elaboration code after @cite{begin}
7415 @end itemize
7417 For a package, the rule is that if you explicitly turn SPARK_Mode
7418 @cite{Off} for any part, then all the following parts must have
7419 SPARK_Mode @cite{Off}. Note that this may require repeating a pragma
7420 SPARK_Mode (@cite{Off}) in the body. For example, if we have a
7421 configuration pragma SPARK_Mode (@cite{On}) that turns the mode on by
7422 default everywhere, and one particular package spec has pragma
7423 SPARK_Mode (@cite{Off}), then that pragma will need to be repeated in
7424 the package body.
7426 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7427 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{e8}
7428 @section Pragma Static_Elaboration_Desired
7431 Syntax:
7433 @example
7434 pragma Static_Elaboration_Desired;
7435 @end example
7437 This pragma is used to indicate that the compiler should attempt to initialize
7438 statically the objects declared in the library unit to which the pragma applies,
7439 when these objects are initialized (explicitly or implicitly) by an aggregate.
7440 In the absence of this pragma, aggregates in object declarations are expanded
7441 into assignments and loops, even when the aggregate components are static
7442 constants. When the aggregate is present the compiler builds a static expression
7443 that requires no run-time code, so that the initialized object can be placed in
7444 read-only data space. If the components are not static, or the aggregate has
7445 more that 100 components, the compiler emits a warning that the pragma cannot
7446 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7447 construction of larger aggregates with static components that include an others
7448 choice.)
7450 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7451 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{e9}
7452 @section Pragma Stream_Convert
7455 Syntax:
7457 @example
7458 pragma Stream_Convert (
7459   [Entity =>] type_LOCAL_NAME,
7460   [Read   =>] function_NAME,
7461   [Write  =>] function_NAME);
7462 @end example
7464 This pragma provides an efficient way of providing user-defined stream
7465 attributes.  Not only is it simpler to use than specifying the attributes
7466 directly, but more importantly, it allows the specification to be made in such
7467 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7468 needed (i.e. unless the stream attributes are actually used); the use of
7469 the Stream_Convert pragma adds no overhead at all, unless the stream
7470 attributes are actually used on the designated type.
7472 The first argument specifies the type for which stream functions are
7473 provided.  The second parameter provides a function used to read values
7474 of this type.  It must name a function whose argument type may be any
7475 subtype, and whose returned type must be the type given as the first
7476 argument to the pragma.
7478 The meaning of the @cite{Read} parameter is that if a stream attribute directly
7479 or indirectly specifies reading of the type given as the first parameter,
7480 then a value of the type given as the argument to the Read function is
7481 read from the stream, and then the Read function is used to convert this
7482 to the required target type.
7484 Similarly the @cite{Write} parameter specifies how to treat write attributes
7485 that directly or indirectly apply to the type given as the first parameter.
7486 It must have an input parameter of the type specified by the first parameter,
7487 and the return type must be the same as the input type of the Read function.
7488 The effect is to first call the Write function to convert to the given stream
7489 type, and then write the result type to the stream.
7491 The Read and Write functions must not be overloaded subprograms.  If necessary
7492 renamings can be supplied to meet this requirement.
7493 The usage of this attribute is best illustrated by a simple example, taken
7494 from the GNAT implementation of package Ada.Strings.Unbounded:
7496 @example
7497 function To_Unbounded (S : String) return Unbounded_String
7498   renames To_Unbounded_String;
7500 pragma Stream_Convert
7501   (Unbounded_String, To_Unbounded, To_String);
7502 @end example
7504 The specifications of the referenced functions, as given in the Ada
7505 Reference Manual are:
7507 @example
7508 function To_Unbounded_String (Source : String)
7509   return Unbounded_String;
7511 function To_String (Source : Unbounded_String)
7512   return String;
7513 @end example
7515 The effect is that if the value of an unbounded string is written to a stream,
7516 then the representation of the item in the stream is in the same format that
7517 would be used for @cite{Standard.String'Output}, and this same representation
7518 is expected when a value of this type is read from the stream. Note that the
7519 value written always includes the bounds, even for Unbounded_String'Write,
7520 since Unbounded_String is not an array type.
7522 Note that the @cite{Stream_Convert} pragma is not effective in the case of
7523 a derived type of a non-limited tagged type. If such a type is specified then
7524 the pragma is silently ignored, and the default implementation of the stream
7525 attributes is used instead.
7527 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7528 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{ea}
7529 @section Pragma Style_Checks
7532 Syntax:
7534 @example
7535 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7536                      On | Off [, LOCAL_NAME]);
7537 @end example
7539 This pragma is used in conjunction with compiler switches to control the
7540 built in style checking provided by GNAT.  The compiler switches, if set,
7541 provide an initial setting for the switches, and this pragma may be used
7542 to modify these settings, or the settings may be provided entirely by
7543 the use of the pragma.  This pragma can be used anywhere that a pragma
7544 is legal, including use as a configuration pragma (including use in
7545 the @code{gnat.adc} file).
7547 The form with a string literal specifies which style options are to be
7548 activated.  These are additive, so they apply in addition to any previously
7549 set style check options.  The codes for the options are the same as those
7550 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7551 For example the following two methods can be used to enable
7552 layout checking:
7555 @itemize *
7557 @item 
7558 @example
7559 pragma Style_Checks ("l");
7560 @end example
7562 @item 
7563 @example
7564 gcc -c -gnatyl ...
7565 @end example
7566 @end itemize
7568 The form ALL_CHECKS activates all standard checks (its use is equivalent
7569 to the use of the @cite{gnaty} switch with no options.
7570 See the @cite{GNAT User's Guide} for details.)
7572 Note: the behavior is slightly different in GNAT mode (@emph{-gnatg} used).
7573 In this case, ALL_CHECKS implies the standard set of GNAT mode style check
7574 options (i.e. equivalent to @emph{-gnatyg}).
7576 The forms with @cite{Off} and @cite{On}
7577 can be used to temporarily disable style checks
7578 as shown in the following example:
7580 @example
7581 pragma Style_Checks ("k"); -- requires keywords in lower case
7582 pragma Style_Checks (Off); -- turn off style checks
7583 NULL;                      -- this will not generate an error message
7584 pragma Style_Checks (On);  -- turn style checks back on
7585 NULL;                      -- this will generate an error message
7586 @end example
7588 Finally the two argument form is allowed only if the first argument is
7589 @cite{On} or @cite{Off}.  The effect is to turn of semantic style checks
7590 for the specified entity, as shown in the following example:
7592 @example
7593 pragma Style_Checks ("r"); -- require consistency of identifier casing
7594 Arg : Integer;
7595 Rf1 : Integer := ARG;      -- incorrect, wrong case
7596 pragma Style_Checks (Off, Arg);
7597 Rf2 : Integer := ARG;      -- OK, no error
7598 @end example
7600 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7601 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{eb}
7602 @section Pragma Subtitle
7605 Syntax:
7607 @example
7608 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7609 @end example
7611 This pragma is recognized for compatibility with other Ada compilers
7612 but is ignored by GNAT.
7614 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7615 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{ec}
7616 @section Pragma Suppress
7619 Syntax:
7621 @example
7622 pragma Suppress (Identifier [, [On =>] Name]);
7623 @end example
7625 This is a standard pragma, and supports all the check names required in
7626 the RM. It is included here because GNAT recognizes some additional check
7627 names that are implementation defined (as permitted by the RM):
7630 @itemize *
7632 @item 
7633 @cite{Alignment_Check} can be used to suppress alignment checks
7634 on addresses used in address clauses. Such checks can also be suppressed
7635 by suppressing range checks, but the specific use of @cite{Alignment_Check}
7636 allows suppression of alignment checks without suppressing other range checks.
7637 Note that @cite{Alignment_Check} is suppressed by default on machines (such as
7638 the x86) with non-strict alignment.
7640 @item 
7641 @cite{Atomic_Synchronization} can be used to suppress the special memory
7642 synchronization instructions that are normally generated for access to
7643 @cite{Atomic} variables to ensure correct synchronization between tasks
7644 that use such variables for synchronization purposes.
7646 @item 
7647 @cite{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7648 for a duplicated tag value when a tagged type is declared.
7650 @item 
7651 @cite{Container_Checks} Can be used to suppress all checks within Ada.Containers
7652 and instances of its children, including Tampering_Check.
7654 @item 
7655 @cite{Tampering_Check} Can be used to suppress tampering check in the containers.
7657 @item 
7658 @cite{Predicate_Check} can be used to control whether predicate checks are
7659 active. It is applicable only to predicates for which the policy is
7660 @cite{Check}. Unlike @cite{Assertion_Policy}, which determines if a given
7661 predicate is ignored or checked for the whole program, the use of
7662 @cite{Suppress} and @cite{Unsuppress} with this check name allows a given
7663 predicate to be turned on and off at specific points in the program.
7665 @item 
7666 @cite{Validity_Check} can be used specifically to control validity checks.
7667 If @cite{Suppress} is used to suppress validity checks, then no validity
7668 checks are performed, including those specified by the appropriate compiler
7669 switch or the @cite{Validity_Checks} pragma.
7671 @item 
7672 Additional check names previously introduced by use of the @cite{Check_Name}
7673 pragma are also allowed.
7674 @end itemize
7676 Note that pragma Suppress gives the compiler permission to omit
7677 checks, but does not require the compiler to omit checks. The compiler
7678 will generate checks if they are essentially free, even when they are
7679 suppressed. In particular, if the compiler can prove that a certain
7680 check will necessarily fail, it will generate code to do an
7681 unconditional 'raise', even if checks are suppressed. The compiler
7682 warns in this case.
7684 Of course, run-time checks are omitted whenever the compiler can prove
7685 that they will not fail, whether or not checks are suppressed.
7687 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7688 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{ed}
7689 @section Pragma Suppress_All
7692 Syntax:
7694 @example
7695 pragma Suppress_All;
7696 @end example
7698 This pragma can appear anywhere within a unit.
7699 The effect is to apply @cite{Suppress (All_Checks)} to the unit
7700 in which it appears.  This pragma is implemented for compatibility with DEC
7701 Ada 83 usage where it appears at the end of a unit, and for compatibility
7702 with Rational Ada, where it appears as a program unit pragma.
7703 The use of the standard Ada pragma @cite{Suppress (All_Checks)}
7704 as a normal configuration pragma is the preferred usage in GNAT.
7706 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7707 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{ee}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{ef}
7708 @section Pragma Suppress_Debug_Info
7711 Syntax:
7713 @example
7714 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7715 @end example
7717 This pragma can be used to suppress generation of debug information
7718 for the specified entity. It is intended primarily for use in debugging
7719 the debugger, and navigating around debugger problems.
7721 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7722 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f0}
7723 @section Pragma Suppress_Exception_Locations
7726 Syntax:
7728 @example
7729 pragma Suppress_Exception_Locations;
7730 @end example
7732 In normal mode, a raise statement for an exception by default generates
7733 an exception message giving the file name and line number for the location
7734 of the raise. This is useful for debugging and logging purposes, but this
7735 entails extra space for the strings for the messages. The configuration
7736 pragma @cite{Suppress_Exception_Locations} can be used to suppress the
7737 generation of these strings, with the result that space is saved, but the
7738 exception message for such raises is null. This configuration pragma may
7739 appear in a global configuration pragma file, or in a specific unit as
7740 usual. It is not required that this pragma be used consistently within
7741 a partition, so it is fine to have some units within a partition compiled
7742 with this pragma and others compiled in normal mode without it.
7744 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7745 @anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{f1}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f2}
7746 @section Pragma Suppress_Initialization
7749 @geindex Suppressing initialization
7751 @geindex Initialization
7752 @geindex suppression of
7754 Syntax:
7756 @example
7757 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
7758 @end example
7760 Here variable_or_subtype_Name is the name introduced by a type declaration
7761 or subtype declaration or the name of a variable introduced by an
7762 object declaration.
7764 In the case of a type or subtype
7765 this pragma suppresses any implicit or explicit initialization
7766 for all variables of the given type or subtype,
7767 including initialization resulting from the use of pragmas
7768 Normalize_Scalars or Initialize_Scalars.
7770 This is considered a representation item, so it cannot be given after
7771 the type is frozen. It applies to all subsequent object declarations,
7772 and also any allocator that creates objects of the type.
7774 If the pragma is given for the first subtype, then it is considered
7775 to apply to the base type and all its subtypes. If the pragma is given
7776 for other than a first subtype, then it applies only to the given subtype.
7777 The pragma may not be given after the type is frozen.
7779 Note that this includes eliminating initialization of discriminants
7780 for discriminated types, and tags for tagged types. In these cases,
7781 you will have to use some non-portable mechanism (e.g. address
7782 overlays or unchecked conversion) to achieve required initialization
7783 of these fields before accessing any object of the corresponding type.
7785 For the variable case, implicit initialization for the named variable
7786 is suppressed, just as though its subtype had been given in a pragma
7787 Suppress_Initialization, as described above.
7789 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
7790 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{f3}
7791 @section Pragma Task_Name
7794 Syntax
7796 @example
7797 pragma Task_Name (string_EXPRESSION);
7798 @end example
7800 This pragma appears within a task definition (like pragma
7801 @cite{Priority}) and applies to the task in which it appears.  The
7802 argument must be of type String, and provides a name to be used for
7803 the task instance when the task is created.  Note that this expression
7804 is not required to be static, and in particular, it can contain
7805 references to task discriminants.  This facility can be used to
7806 provide different names for different tasks as they are created,
7807 as illustrated in the example below.
7809 The task name is recorded internally in the run-time structures
7810 and is accessible to tools like the debugger.  In addition the
7811 routine @cite{Ada.Task_Identification.Image} will return this
7812 string, with a unique task address appended.
7814 @example
7815 --  Example of the use of pragma Task_Name
7817 with Ada.Task_Identification;
7818 use Ada.Task_Identification;
7819 with Text_IO; use Text_IO;
7820 procedure t3 is
7822    type Astring is access String;
7824    task type Task_Typ (Name : access String) is
7825       pragma Task_Name (Name.all);
7826    end Task_Typ;
7828    task body Task_Typ is
7829       Nam : constant String := Image (Current_Task);
7830    begin
7831       Put_Line ("-->" & Nam (1 .. 14) & "<--");
7832    end Task_Typ;
7834    type Ptr_Task is access Task_Typ;
7835    Task_Var : Ptr_Task;
7837 begin
7838    Task_Var :=
7839      new Task_Typ (new String'("This is task 1"));
7840    Task_Var :=
7841      new Task_Typ (new String'("This is task 2"));
7842 end;
7843 @end example
7845 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
7846 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{f4}
7847 @section Pragma Task_Storage
7850 Syntax:
7852 @example
7853 pragma Task_Storage (
7854   [Task_Type =>] LOCAL_NAME,
7855   [Top_Guard =>] static_integer_EXPRESSION);
7856 @end example
7858 This pragma specifies the length of the guard area for tasks.  The guard
7859 area is an additional storage area allocated to a task.  A value of zero
7860 means that either no guard area is created or a minimal guard area is
7861 created, depending on the target.  This pragma can appear anywhere a
7862 @cite{Storage_Size} attribute definition clause is allowed for a task
7863 type.
7865 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
7866 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{f5}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f6}
7867 @section Pragma Test_Case
7870 @geindex Test cases
7872 Syntax:
7874 @example
7875 pragma Test_Case (
7876    [Name     =>] static_string_Expression
7877   ,[Mode     =>] (Nominal | Robustness)
7878  [, Requires =>  Boolean_Expression]
7879  [, Ensures  =>  Boolean_Expression]);
7880 @end example
7882 The @cite{Test_Case} pragma allows defining fine-grain specifications
7883 for use by testing tools.
7884 The compiler checks the validity of the @cite{Test_Case} pragma, but its
7885 presence does not lead to any modification of the code generated by the
7886 compiler.
7888 @cite{Test_Case} pragmas may only appear immediately following the
7889 (separate) declaration of a subprogram in a package declaration, inside
7890 a package spec unit. Only other pragmas may intervene (that is appear
7891 between the subprogram declaration and a test case).
7893 The compiler checks that boolean expressions given in @cite{Requires} and
7894 @cite{Ensures} are valid, where the rules for @cite{Requires} are the
7895 same as the rule for an expression in @cite{Precondition} and the rules
7896 for @cite{Ensures} are the same as the rule for an expression in
7897 @cite{Postcondition}. In particular, attributes @cite{'Old} and
7898 @cite{'Result} can only be used within the @cite{Ensures}
7899 expression. The following is an example of use within a package spec:
7901 @example
7902 package Math_Functions is
7903    ...
7904    function Sqrt (Arg : Float) return Float;
7905    pragma Test_Case (Name     => "Test 1",
7906                      Mode     => Nominal,
7907                      Requires => Arg < 10000,
7908                      Ensures  => Sqrt'Result < 10);
7909    ...
7910 end Math_Functions;
7911 @end example
7913 The meaning of a test case is that there is at least one context where
7914 @cite{Requires} holds such that, if the associated subprogram is executed in
7915 that context, then @cite{Ensures} holds when the subprogram returns.
7916 Mode @cite{Nominal} indicates that the input context should also satisfy the
7917 precondition of the subprogram, and the output context should also satisfy its
7918 postcondition. Mode @cite{Robustness} indicates that the precondition and
7919 postcondition of the subprogram should be ignored for this test case.
7921 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
7922 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{f7}@anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f8}
7923 @section Pragma Thread_Local_Storage
7926 @geindex Task specific storage
7928 @geindex TLS (Thread Local Storage)
7930 @geindex Task_Attributes
7932 Syntax:
7934 @example
7935 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
7936 @end example
7938 This pragma specifies that the specified entity, which must be
7939 a variable declared in a library level package, is to be marked as
7940 "Thread Local Storage" (@cite{TLS}). On systems supporting this (which
7941 include Windows, Solaris, GNU/Linux and VxWorks 6), this causes each
7942 thread (and hence each Ada task) to see a distinct copy of the variable.
7944 The variable may not have default initialization, and if there is
7945 an explicit initialization, it must be either @cite{null} for an
7946 access variable, or a static expression for a scalar variable.
7947 This provides a low level mechanism similar to that provided by
7948 the @cite{Ada.Task_Attributes} package, but much more efficient
7949 and is also useful in writing interface code that will interact
7950 with foreign threads.
7952 If this pragma is used on a system where @cite{TLS} is not supported,
7953 then an error message will be generated and the program will be rejected.
7955 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
7956 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{f9}
7957 @section Pragma Time_Slice
7960 Syntax:
7962 @example
7963 pragma Time_Slice (static_duration_EXPRESSION);
7964 @end example
7966 For implementations of GNAT on operating systems where it is possible
7967 to supply a time slice value, this pragma may be used for this purpose.
7968 It is ignored if it is used in a system that does not allow this control,
7969 or if it appears in other than the main program unit.
7971 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
7972 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{fa}
7973 @section Pragma Title
7976 Syntax:
7978 @example
7979 pragma Title (TITLING_OPTION [, TITLING OPTION]);
7981 TITLING_OPTION ::=
7982   [Title    =>] STRING_LITERAL,
7983 | [Subtitle =>] STRING_LITERAL
7984 @end example
7986 Syntax checked but otherwise ignored by GNAT.  This is a listing control
7987 pragma used in DEC Ada 83 implementations to provide a title and/or
7988 subtitle for the program listing.  The program listing generated by GNAT
7989 does not have titles or subtitles.
7991 Unlike other pragmas, the full flexibility of named notation is allowed
7992 for this pragma, i.e., the parameters may be given in any order if named
7993 notation is used, and named and positional notation can be mixed
7994 following the normal rules for procedure calls in Ada.
7996 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
7997 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{fb}
7998 @section Pragma Type_Invariant
8001 Syntax:
8003 @example
8004 pragma Type_Invariant
8005   ([Entity =>] type_LOCAL_NAME,
8006    [Check  =>] EXPRESSION);
8007 @end example
8009 The @cite{Type_Invariant} pragma is intended to be an exact
8010 replacement for the language-defined @cite{Type_Invariant}
8011 aspect, and shares its restrictions and semantics. It differs
8012 from the language defined @cite{Invariant} pragma in that it
8013 does not permit a string parameter, and it is
8014 controlled by the assertion identifier @cite{Type_Invariant}
8015 rather than @cite{Invariant}.
8017 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8018 @anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{fc}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{fd}
8019 @section Pragma Type_Invariant_Class
8022 Syntax:
8024 @example
8025 pragma Type_Invariant_Class
8026   ([Entity =>] type_LOCAL_NAME,
8027    [Check  =>] EXPRESSION);
8028 @end example
8030 The @cite{Type_Invariant_Class} pragma is intended to be an exact
8031 replacement for the language-defined @cite{Type_Invariant'Class}
8032 aspect, and shares its restrictions and semantics.
8034 Note: This pragma is called @cite{Type_Invariant_Class} rather than
8035 @cite{Type_Invariant'Class} because the latter would not be strictly
8036 conforming to the allowed syntax for pragmas. The motivation
8037 for providing pragmas equivalent to the aspects is to allow a program
8038 to be written using the pragmas, and then compiled if necessary
8039 using an Ada compiler that does not recognize the pragmas or
8040 aspects, but is prepared to ignore the pragmas. The assertion
8041 policy that controls this pragma is @cite{Type_Invariant'Class},
8042 not @cite{Type_Invariant_Class}.
8044 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8045 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{fe}
8046 @section Pragma Unchecked_Union
8049 @geindex Unions in C
8051 Syntax:
8053 @example
8054 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8055 @end example
8057 This pragma is used to specify a representation of a record type that is
8058 equivalent to a C union. It was introduced as a GNAT implementation defined
8059 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8060 pragma, making it language defined, and GNAT fully implements this extended
8061 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8062 details, consult the Ada 2012 Reference Manual, section B.3.3.
8064 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8065 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{ff}
8066 @section Pragma Unevaluated_Use_Of_Old
8069 @geindex Attribute Old
8071 @geindex Attribute Loop_Entry
8073 @geindex Unevaluated_Use_Of_Old
8075 Syntax:
8077 @example
8078 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8079 @end example
8081 This pragma controls the processing of attributes Old and Loop_Entry.
8082 If either of these attributes is used in a potentially unevaluated
8083 expression  (e.g. the then or else parts of an if expression), then
8084 normally this usage is considered illegal if the prefix of the attribute
8085 is other than an entity name. The language requires this
8086 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8088 The reason for this rule is that otherwise, we can have a situation
8089 where we save the Old value, and this results in an exception, even
8090 though we might not evaluate the attribute. Consider this example:
8092 @example
8093 package UnevalOld is
8094    K : Character;
8095    procedure U (A : String; C : Boolean)  -- ERROR
8096      with Post => (if C then A(1)'Old = K else True);
8097 end;
8098 @end example
8100 If procedure U is called with a string with a lower bound of 2, and
8101 C false, then an exception would be raised trying to evaluate A(1)
8102 on entry even though the value would not be actually used.
8104 Although the rule guarantees against this possibility, it is sometimes
8105 too restrictive. For example if we know that the string has a lower
8106 bound of 1, then we will never raise an exception.
8107 The pragma @cite{Unevaluated_Use_Of_Old} can be
8108 used to modify this behavior. If the argument is @cite{Error} then an
8109 error is given (this is the default RM behavior). If the argument is
8110 @cite{Warn} then the usage is allowed as legal but with a warning
8111 that an exception might be raised. If the argument is @cite{Allow}
8112 then the usage is allowed as legal without generating a warning.
8114 This pragma may appear as a configuration pragma, or in a declarative
8115 part or package specification. In the latter case it applies to
8116 uses up to the end of the corresponding statement sequence or
8117 sequence of package declarations.
8119 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8120 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{100}
8121 @section Pragma Unimplemented_Unit
8124 Syntax:
8126 @example
8127 pragma Unimplemented_Unit;
8128 @end example
8130 If this pragma occurs in a unit that is processed by the compiler, GNAT
8131 aborts with the message @code{xxx not implemented}, where
8132 @cite{xxx} is the name of the current compilation unit.  This pragma is
8133 intended to allow the compiler to handle unimplemented library units in
8134 a clean manner.
8136 The abort only happens if code is being generated.  Thus you can use
8137 specs of unimplemented packages in syntax or semantic checking mode.
8139 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8140 @anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{101}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{102}
8141 @section Pragma Universal_Aliasing
8144 Syntax:
8146 @example
8147 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8148 @end example
8150 @cite{type_LOCAL_NAME} must refer to a type declaration in the current
8151 declarative part.  The effect is to inhibit strict type-based aliasing
8152 optimization for the given type.  In other words, the effect is as though
8153 access types designating this type were subject to pragma No_Strict_Aliasing.
8154 For a detailed description of the strict aliasing optimization, and the
8155 situations in which it must be suppressed, see the section on
8156 @cite{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
8158 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
8159 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{103}@anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{104}
8160 @section Pragma Universal_Data
8163 Syntax:
8165 @example
8166 pragma Universal_Data [(library_unit_Name)];
8167 @end example
8169 This pragma is supported only for the AAMP target and is ignored for
8170 other targets. The pragma specifies that all library-level objects
8171 (Counter 0 data) associated with the library unit are to be accessed
8172 and updated using universal addressing (24-bit addresses for AAMP5)
8173 rather than the default of 16-bit Data Environment (DENV) addressing.
8174 Use of this pragma will generally result in less efficient code for
8175 references to global data associated with the library unit, but
8176 allows such data to be located anywhere in memory. This pragma is
8177 a library unit pragma, but can also be used as a configuration pragma
8178 (including use in the @code{gnat.adc} file). The functionality
8179 of this pragma is also available by applying the -univ switch on the
8180 compilations of units where universal addressing of the data is desired.
8182 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8183 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{105}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{106}
8184 @section Pragma Unmodified
8187 @geindex Warnings
8188 @geindex unmodified
8190 Syntax:
8192 @example
8193 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8194 @end example
8196 This pragma signals that the assignable entities (variables,
8197 @cite{out} parameters, @cite{in out} parameters) whose names are listed are
8198 deliberately not assigned in the current source unit. This
8199 suppresses warnings about the
8200 entities being referenced but not assigned, and in addition a warning will be
8201 generated if one of these entities is in fact assigned in the
8202 same unit as the pragma (or in the corresponding body, or one
8203 of its subunits).
8205 This is particularly useful for clearly signaling that a particular
8206 parameter is not modified, even though the spec suggests that it might
8209 For the variable case, warnings are never given for unreferenced variables
8210 whose name contains one of the substrings
8211 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8212 are typically to be used in cases where such warnings are expected.
8213 Thus it is never necessary to use @cite{pragma Unmodified} for such
8214 variables, though it is harmless to do so.
8216 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8217 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{107}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{108}
8218 @section Pragma Unreferenced
8221 @geindex Warnings
8222 @geindex unreferenced
8224 Syntax:
8226 @example
8227 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8228 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8229 @end example
8231 This pragma signals that the entities whose names are listed are
8232 deliberately not referenced in the current source unit after the
8233 occurrence of the pragma. This
8234 suppresses warnings about the
8235 entities being unreferenced, and in addition a warning will be
8236 generated if one of these entities is in fact subsequently referenced in the
8237 same unit as the pragma (or in the corresponding body, or one
8238 of its subunits).
8240 This is particularly useful for clearly signaling that a particular
8241 parameter is not referenced in some particular subprogram implementation
8242 and that this is deliberate. It can also be useful in the case of
8243 objects declared only for their initialization or finalization side
8244 effects.
8246 If @cite{LOCAL_NAME} identifies more than one matching homonym in the
8247 current scope, then the entity most recently declared is the one to which
8248 the pragma applies. Note that in the case of accept formals, the pragma
8249 Unreferenced may appear immediately after the keyword @cite{do} which
8250 allows the indication of whether or not accept formals are referenced
8251 or not to be given individually for each accept statement.
8253 The left hand side of an assignment does not count as a reference for the
8254 purpose of this pragma. Thus it is fine to assign to an entity for which
8255 pragma Unreferenced is given.
8257 Note that if a warning is desired for all calls to a given subprogram,
8258 regardless of whether they occur in the same unit as the subprogram
8259 declaration, then this pragma should not be used (calls from another
8260 unit would not be flagged); pragma Obsolescent can be used instead
8261 for this purpose, see @ref{a6,,Pragma Obsolescent}.
8263 The second form of pragma @cite{Unreferenced} is used within a context
8264 clause. In this case the arguments must be unit names of units previously
8265 mentioned in @cite{with} clauses (similar to the usage of pragma
8266 @cite{Elaborate_All}. The effect is to suppress warnings about unreferenced
8267 units and unreferenced entities within these units.
8269 For the variable case, warnings are never given for unreferenced variables
8270 whose name contains one of the substrings
8271 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8272 are typically to be used in cases where such warnings are expected.
8273 Thus it is never necessary to use @cite{pragma Unreferenced} for such
8274 variables, though it is harmless to do so.
8276 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8277 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{109}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{10a}
8278 @section Pragma Unreferenced_Objects
8281 @geindex Warnings
8282 @geindex unreferenced
8284 Syntax:
8286 @example
8287 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8288 @end example
8290 This pragma signals that for the types or subtypes whose names are
8291 listed, objects which are declared with one of these types or subtypes may
8292 not be referenced, and if no references appear, no warnings are given.
8294 This is particularly useful for objects which are declared solely for their
8295 initialization and finalization effect. Such variables are sometimes referred
8296 to as RAII variables (Resource Acquisition Is Initialization). Using this
8297 pragma on the relevant type (most typically a limited controlled type), the
8298 compiler will automatically suppress unwanted warnings about these variables
8299 not being referenced.
8301 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8302 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{10b}
8303 @section Pragma Unreserve_All_Interrupts
8306 Syntax:
8308 @example
8309 pragma Unreserve_All_Interrupts;
8310 @end example
8312 Normally certain interrupts are reserved to the implementation.  Any attempt
8313 to attach an interrupt causes Program_Error to be raised, as described in
8314 RM C.3.2(22).  A typical example is the @cite{SIGINT} interrupt used in
8315 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
8316 reserved to the implementation, so that @code{Ctrl-C} can be used to
8317 interrupt execution.
8319 If the pragma @cite{Unreserve_All_Interrupts} appears anywhere in any unit in
8320 a program, then all such interrupts are unreserved.  This allows the
8321 program to handle these interrupts, but disables their standard
8322 functions.  For example, if this pragma is used, then pressing
8323 @code{Ctrl-C} will not automatically interrupt execution.  However,
8324 a program can then handle the @cite{SIGINT} interrupt as it chooses.
8326 For a full list of the interrupts handled in a specific implementation,
8327 see the source code for the spec of @cite{Ada.Interrupts.Names} in
8328 file @code{a-intnam.ads}.  This is a target dependent file that contains the
8329 list of interrupts recognized for a given target.  The documentation in
8330 this file also specifies what interrupts are affected by the use of
8331 the @cite{Unreserve_All_Interrupts} pragma.
8333 For a more general facility for controlling what interrupts can be
8334 handled, see pragma @cite{Interrupt_State}, which subsumes the functionality
8335 of the @cite{Unreserve_All_Interrupts} pragma.
8337 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8338 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{10c}
8339 @section Pragma Unsuppress
8342 Syntax:
8344 @example
8345 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8346 @end example
8348 This pragma undoes the effect of a previous pragma @cite{Suppress}.  If
8349 there is no corresponding pragma @cite{Suppress} in effect, it has no
8350 effect.  The range of the effect is the same as for pragma
8351 @cite{Suppress}.  The meaning of the arguments is identical to that used
8352 in pragma @cite{Suppress}.
8354 One important application is to ensure that checks are on in cases where
8355 code depends on the checks for its correct functioning, so that the code
8356 will compile correctly even if the compiler switches are set to suppress
8357 checks. For example, in a program that depends on external names of tagged
8358 types and wants to ensure that the duplicated tag check occurs even if all
8359 run-time checks are suppressed by a compiler switch, the following
8360 configuration pragma will ensure this test is not suppressed:
8362 @example
8363 pragma Unsuppress (Duplicated_Tag_Check);
8364 @end example
8366 This pragma is standard in Ada 2005. It is available in all earlier versions
8367 of Ada as an implementation-defined pragma.
8369 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8370 number of implementation-defined check names. See the description of pragma
8371 @cite{Suppress} for full details.
8373 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8374 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{10d}
8375 @section Pragma Use_VADS_Size
8378 @geindex Size
8379 @geindex VADS compatibility
8381 @geindex Rational profile
8383 Syntax:
8385 @example
8386 pragma Use_VADS_Size;
8387 @end example
8389 This is a configuration pragma.  In a unit to which it applies, any use
8390 of the 'Size attribute is automatically interpreted as a use of the
8391 'VADS_Size attribute.  Note that this may result in incorrect semantic
8392 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
8393 the handling of existing code which depends on the interpretation of Size
8394 as implemented in the VADS compiler.  See description of the VADS_Size
8395 attribute for further details.
8397 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8398 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10f}
8399 @section Pragma Unused
8402 @geindex Warnings
8403 @geindex unused
8405 Syntax:
8407 @example
8408 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8409 @end example
8411 This pragma signals that the assignable entities (variables,
8412 @cite{out} parameters, and @cite{in out} parameters) whose names are listed
8413 deliberately do not get assigned or referenced in the current source unit
8414 after the occurrence of the pragma in the current source unit. This
8415 suppresses warnings about the entities that are unreferenced and/or not
8416 assigned, and, in addition, a warning will be generated if one of these
8417 entities gets assigned or subsequently referenced in the same unit as the
8418 pragma (in the corresponding body or one of its subunits).
8420 This is particularly useful for clearly signaling that a particular
8421 parameter is not modified or referenced, even though the spec suggests
8422 that it might be.
8424 For the variable case, warnings are never given for unreferenced
8425 variables whose name contains one of the substrings
8426 @cite{DISCARD@comma{} DUMMY@comma{} IGNORE@comma{} JUNK@comma{} UNUSED} in any casing. Such names
8427 are typically to be used in cases where such warnings are expected.
8428 Thus it is never necessary to use @cite{pragma Unmodified} for such
8429 variables, though it is harmless to do so.
8431 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8432 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{110}
8433 @section Pragma Validity_Checks
8436 Syntax:
8438 @example
8439 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8440 @end example
8442 This pragma is used in conjunction with compiler switches to control the
8443 built-in validity checking provided by GNAT.  The compiler switches, if set
8444 provide an initial setting for the switches, and this pragma may be used
8445 to modify these settings, or the settings may be provided entirely by
8446 the use of the pragma.  This pragma can be used anywhere that a pragma
8447 is legal, including use as a configuration pragma (including use in
8448 the @code{gnat.adc} file).
8450 The form with a string literal specifies which validity options are to be
8451 activated.  The validity checks are first set to include only the default
8452 reference manual settings, and then a string of letters in the string
8453 specifies the exact set of options required.  The form of this string
8454 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8455 GNAT User's Guide for details).  For example the following two
8456 methods can be used to enable validity checking for mode @cite{in} and
8457 @cite{in out} subprogram parameters:
8460 @itemize *
8462 @item 
8463 @example
8464 pragma Validity_Checks ("im");
8465 @end example
8467 @item 
8468 @example
8469 $ gcc -c -gnatVim ...
8470 @end example
8471 @end itemize
8473 The form ALL_CHECKS activates all standard checks (its use is equivalent
8474 to the use of the @cite{gnatva} switch.
8476 The forms with @cite{Off} and @cite{On}
8477 can be used to temporarily disable validity checks
8478 as shown in the following example:
8480 @example
8481 pragma Validity_Checks ("c"); -- validity checks for copies
8482 pragma Validity_Checks (Off); -- turn off validity checks
8483 A := B;                       -- B will not be validity checked
8484 pragma Validity_Checks (On);  -- turn validity checks back on
8485 A := C;                       -- C will be validity checked
8486 @end example
8488 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8489 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{111}
8490 @section Pragma Volatile
8493 Syntax:
8495 @example
8496 pragma Volatile (LOCAL_NAME);
8497 @end example
8499 This pragma is defined by the Ada Reference Manual, and the GNAT
8500 implementation is fully conformant with this definition.  The reason it
8501 is mentioned in this section is that a pragma of the same name was supplied
8502 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8503 implementation of pragma Volatile is upwards compatible with the
8504 implementation in DEC Ada 83.
8506 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8507 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{112}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{113}
8508 @section Pragma Volatile_Full_Access
8511 Syntax:
8513 @example
8514 pragma Volatile_Full_Access (LOCAL_NAME);
8515 @end example
8517 This is similar in effect to pragma Volatile, except that any reference to the
8518 object is guaranteed to be done only with instructions that read or write all
8519 the bits of the object. Furthermore, if the object is of a composite type,
8520 then any reference to a component of the object is guaranteed to read and/or
8521 write all the bits of the object.
8523 The intention is that this be suitable for use with memory-mapped I/O devices
8524 on some machines. Note that there are two important respects in which this is
8525 different from @cite{pragma Atomic}. First a reference to a @cite{Volatile_Full_Access}
8526 object is not a sequential action in the RM 9.10 sense and, therefore, does
8527 not create a synchronization point. Second, in the case of @cite{pragma Atomic},
8528 there is no guarantee that all the bits will be accessed if the reference
8529 is not to the whole object; the compiler is allowed (and generally will)
8530 access only part of the object in this case.
8532 It is not permissible to specify @cite{Atomic} and @cite{Volatile_Full_Access} for
8533 the same object.
8535 It is not permissible to specify @cite{Volatile_Full_Access} for a composite
8536 (record or array) type or object that has at least one @cite{Aliased} component.
8538 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8539 @anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{114}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{115}
8540 @section Pragma Volatile_Function
8543 Syntax:
8545 @example
8546 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8547 @end example
8549 For the semantics of this pragma, see the entry for aspect @cite{Volatile_Function}
8550 in the SPARK 2014 Reference Manual, section 7.1.2.
8552 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8553 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{116}
8554 @section Pragma Warning_As_Error
8557 Syntax:
8559 @example
8560 pragma Warning_As_Error (static_string_EXPRESSION);
8561 @end example
8563 This configuration pragma allows the programmer to specify a set
8564 of warnings that will be treated as errors. Any warning which
8565 matches the pattern given by the pragma argument will be treated
8566 as an error. This gives much more precise control that -gnatwe
8567 which treats all warnings as errors.
8569 The pattern may contain asterisks, which match zero or more characters in
8570 the message. For example, you can use
8571 @cite{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8572 message @cite{warning: 960 bits of "a" unused} as an error. No other regular
8573 expression notations are permitted. All characters other than asterisk in
8574 these three specific cases are treated as literal characters in the match.
8575 The match is case insensitive, for example XYZ matches xyz.
8577 Note that the pattern matches if it occurs anywhere within the warning
8578 message string (it is not necessary to put an asterisk at the start and
8579 the end of the message, since this is implied).
8581 Another possibility for the static_string_EXPRESSION which works whether
8582 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8583 @emph{-gnatw} tag string, enclosed in brackets,
8584 as shown in the example below, to treat a class of warnings as errors.
8586 The above use of patterns to match the message applies only to warning
8587 messages generated by the front end. This pragma can also be applied to
8588 warnings provided by the back end and mentioned in @ref{117,,Pragma Warnings}.
8589 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8590 can also be treated as errors.
8592 The pragma can appear either in a global configuration pragma file
8593 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8594 configuration pragma file containing:
8596 @example
8597 pragma Warning_As_Error ("[-gnatwj]");
8598 @end example
8600 which will treat all obsolescent feature warnings as errors, the
8601 following program compiles as shown (compile options here are
8602 @emph{-gnatwa.d -gnatl -gnatj55}).
8604 @example
8605     1. pragma Warning_As_Error ("*never assigned*");
8606     2. function Warnerr return String is
8607     3.    X : Integer;
8608           |
8609        >>> error: variable "X" is never read and
8610            never assigned [-gnatwv] [warning-as-error]
8612     4.    Y : Integer;
8613           |
8614        >>> warning: variable "Y" is assigned but
8615            never read [-gnatwu]
8617     5. begin
8618     6.    Y := 0;
8619     7.    return %ABC%;
8620                  |
8621        >>> error: use of "%" is an obsolescent
8622            feature (RM J.2(4)), use """ instead
8623            [-gnatwj] [warning-as-error]
8625     8. end;
8627 8 lines: No errors, 3 warnings (2 treated as errors)
8628 @end example
8630 Note that this pragma does not affect the set of warnings issued in
8631 any way, it merely changes the effect of a matching warning if one
8632 is produced as a result of other warnings options. As shown in this
8633 example, if the pragma results in a warning being treated as an error,
8634 the tag is changed from "warning:" to "error:" and the string
8635 "[warning-as-error]" is appended to the end of the message.
8637 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8638 @anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{118}
8639 @section Pragma Warnings
8642 Syntax:
8644 @example
8645 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8647 DETAILS ::= On | Off
8648 DETAILS ::= On | Off, local_NAME
8649 DETAILS ::= static_string_EXPRESSION
8650 DETAILS ::= On | Off, static_string_EXPRESSION
8652 TOOL_NAME ::= GNAT | GNATProve
8654 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8655 @end example
8657 Note: in Ada 83 mode, a string literal may be used in place of a static string
8658 expression (which does not exist in Ada 83).
8660 Note if the second argument of @cite{DETAILS} is a @cite{local_NAME} then the
8661 second form is always understood. If the intention is to use
8662 the fourth form, then you can write @cite{NAME & ""} to force the
8663 intepretation as a @cite{static_string_EXPRESSION}.
8665 Note: if the first argument is a valid @cite{TOOL_NAME}, it will be interpreted
8666 that way. The use of the @cite{TOOL_NAME} argument is relevant only to users
8667 of SPARK and GNATprove, see last part of this section for details.
8669 Normally warnings are enabled, with the output being controlled by
8670 the command line switch.  Warnings (@cite{Off}) turns off generation of
8671 warnings until a Warnings (@cite{On}) is encountered or the end of the
8672 current unit.  If generation of warnings is turned off using this
8673 pragma, then some or all of the warning messages are suppressed,
8674 regardless of the setting of the command line switches.
8676 The @cite{Reason} parameter may optionally appear as the last argument
8677 in any of the forms of this pragma. It is intended purely for the
8678 purposes of documenting the reason for the @cite{Warnings} pragma.
8679 The compiler will check that the argument is a static string but
8680 otherwise ignore this argument. Other tools may provide specialized
8681 processing for this string.
8683 The form with a single argument (or two arguments if Reason present),
8684 where the first argument is @cite{ON} or @cite{OFF}
8685 may be used as a configuration pragma.
8687 If the @cite{LOCAL_NAME} parameter is present, warnings are suppressed for
8688 the specified entity.  This suppression is effective from the point where
8689 it occurs till the end of the extended scope of the variable (similar to
8690 the scope of @cite{Suppress}). This form cannot be used as a configuration
8691 pragma.
8693 In the case where the first argument is other than @cite{ON} or
8694 @cite{OFF},
8695 the third form with a single static_string_EXPRESSION argument (and possible
8696 reason) provides more precise
8697 control over which warnings are active. The string is a list of letters
8698 specifying which warnings are to be activated and which deactivated. The
8699 code for these letters is the same as the string used in the command
8700 line switch controlling warnings. For a brief summary, use the gnatmake
8701 command with no arguments, which will generate usage information containing
8702 the list of warnings switches supported. For
8703 full details see the section on @cite{Warning Message Control} in the
8704 @cite{GNAT User's Guide}.
8705 This form can also be used as a configuration pragma.
8707 The warnings controlled by the @emph{-gnatw} switch are generated by the
8708 front end of the compiler. The GCC back end can provide additional warnings
8709 and they are controlled by the @emph{-W} switch. Such warnings can be
8710 identified by the appearance of a string of the form @cite{[-Wxxx]} in the
8711 message which designates the @emph{-Wxxx} switch that controls the message.
8712 The form with a single static_string_EXPRESSION argument also works for these
8713 warnings, but the string must be a single full @emph{-Wxxx} switch in this
8714 case. The above reference lists a few examples of these additional warnings.
8716 The specified warnings will be in effect until the end of the program
8717 or another pragma Warnings is encountered. The effect of the pragma is
8718 cumulative. Initially the set of warnings is the standard default set
8719 as possibly modified by compiler switches. Then each pragma Warning
8720 modifies this set of warnings as specified. This form of the pragma may
8721 also be used as a configuration pragma.
8723 The fourth form, with an @cite{On|Off} parameter and a string, is used to
8724 control individual messages, based on their text. The string argument
8725 is a pattern that is used to match against the text of individual
8726 warning messages (not including the initial "warning: " tag).
8728 The pattern may contain asterisks, which match zero or more characters in
8729 the message. For example, you can use
8730 @cite{pragma Warnings (Off@comma{} "bits of*unused")} to suppress the warning
8731 message @cite{warning: 960 bits of "a" unused}. No other regular
8732 expression notations are permitted. All characters other than asterisk in
8733 these three specific cases are treated as literal characters in the match.
8734 The match is case insensitive, for example XYZ matches xyz.
8736 Note that the pattern matches if it occurs anywhere within the warning
8737 message string (it is not necessary to put an asterisk at the start and
8738 the end of the message, since this is implied).
8740 The above use of patterns to match the message applies only to warning
8741 messages generated by the front end. This form of the pragma with a string
8742 argument can also be used to control warnings provided by the back end and
8743 mentioned above. By using a single full @emph{-Wxxx} switch in the pragma,
8744 such warnings can be turned on and off.
8746 There are two ways to use the pragma in this form. The OFF form can be used
8747 as a configuration pragma. The effect is to suppress all warnings (if any)
8748 that match the pattern string throughout the compilation (or match the
8749 -W switch in the back end case).
8751 The second usage is to suppress a warning locally, and in this case, two
8752 pragmas must appear in sequence:
8754 @example
8755 pragma Warnings (Off, Pattern);
8756 ... code where given warning is to be suppressed
8757 pragma Warnings (On, Pattern);
8758 @end example
8760 In this usage, the pattern string must match in the Off and On
8761 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
8762 warning must be suppressed.
8764 Note: to write a string that will match any warning, use the string
8765 @cite{"***"}. It will not work to use a single asterisk or two
8766 asterisks since this looks like an operator name. This form with three
8767 asterisks is similar in effect to specifying @cite{pragma Warnings (Off)} except (if @emph{-gnatw.w} is given) that a matching
8768 @cite{pragma Warnings (On@comma{} "***")} will be required. This can be
8769 helpful in avoiding forgetting to turn warnings back on.
8771 Note: the debug flag -gnatd.i (@cite{/NOWARNINGS_PRAGMAS} in VMS) can be
8772 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
8773 be useful in checking whether obsolete pragmas in existing programs are hiding
8774 real problems.
8776 Note: pragma Warnings does not affect the processing of style messages. See
8777 separate entry for pragma Style_Checks for control of style messages.
8779 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
8780 use the version of the pragma with a @cite{TOOL_NAME} parameter.
8782 If present, @cite{TOOL_NAME} is the name of a tool, currently either @cite{GNAT} for the
8783 compiler or @cite{GNATprove} for the formal verification tool. A given tool only
8784 takes into account pragma Warnings that do not specify a tool name, or that
8785 specify the matching tool name. This makes it possible to disable warnings
8786 selectively for each tool, and as a consequence to detect useless pragma
8787 Warnings with switch @cite{-gnatw.w}.
8789 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
8790 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{119}
8791 @section Pragma Weak_External
8794 Syntax:
8796 @example
8797 pragma Weak_External ([Entity =>] LOCAL_NAME);
8798 @end example
8800 @cite{LOCAL_NAME} must refer to an object that is declared at the library
8801 level. This pragma specifies that the given entity should be marked as a
8802 weak symbol for the linker. It is equivalent to @cite{__attribute__((weak))}
8803 in GNU C and causes @cite{LOCAL_NAME} to be emitted as a weak symbol instead
8804 of a regular symbol, that is to say a symbol that does not have to be
8805 resolved by the linker if used in conjunction with a pragma Import.
8807 When a weak symbol is not resolved by the linker, its address is set to
8808 zero. This is useful in writing interfaces to external modules that may
8809 or may not be linked in the final executable, for example depending on
8810 configuration settings.
8812 If a program references at run time an entity to which this pragma has been
8813 applied, and the corresponding symbol was not resolved at link time, then
8814 the execution of the program is erroneous. It is not erroneous to take the
8815 Address of such an entity, for example to guard potential references,
8816 as shown in the example below.
8818 Some file formats do not support weak symbols so not all target machines
8819 support this pragma.
8821 @example
8822 --  Example of the use of pragma Weak_External
8824 package External_Module is
8825   key : Integer;
8826   pragma Import (C, key);
8827   pragma Weak_External (key);
8828   function Present return boolean;
8829 end External_Module;
8831 with System; use System;
8832 package body External_Module is
8833   function Present return boolean is
8834   begin
8835     return key'Address /= System.Null_Address;
8836   end Present;
8837 end External_Module;
8838 @end example
8840 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
8841 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{11a}
8842 @section Pragma Wide_Character_Encoding
8845 Syntax:
8847 @example
8848 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
8849 @end example
8851 This pragma specifies the wide character encoding to be used in program
8852 source text appearing subsequently. It is a configuration pragma, but may
8853 also be used at any point that a pragma is allowed, and it is permissible
8854 to have more than one such pragma in a file, allowing multiple encodings
8855 to appear within the same file.
8857 However, note that the pragma cannot immediately precede the relevant
8858 wide character, because then the previous encoding will still be in
8859 effect, causing "illegal character" errors.
8861 The argument can be an identifier or a character literal. In the identifier
8862 case, it is one of @cite{HEX}, @cite{UPPER}, @cite{SHIFT_JIS},
8863 @cite{EUC}, @cite{UTF8}, or @cite{BRACKETS}. In the character literal
8864 case it is correspondingly one of the characters @code{h}, @code{u},
8865 @code{s}, @code{e}, @code{8}, or @code{b}.
8867 Note that when the pragma is used within a file, it affects only the
8868 encoding within that file, and does not affect withed units, specs,
8869 or subunits.
8871 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
8872 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{11b}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{11c}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{11d}
8873 @chapter Implementation Defined Aspects
8876 Ada defines (throughout the Ada 2012 reference manual, summarized
8877 in Annex K) a set of aspects that can be specified for certain entities.
8878 These language defined aspects are implemented in GNAT in Ada 2012 mode
8879 and work as described in the Ada 2012 Reference Manual.
8881 In addition, Ada 2012 allows implementations to define additional aspects
8882 whose meaning is defined by the implementation.  GNAT provides
8883 a number of these implementation-defined aspects which can be used
8884 to extend and enhance the functionality of the compiler.  This section of
8885 the GNAT reference manual describes these additional aspects.
8887 Note that any program using these aspects may not be portable to
8888 other compilers (although GNAT implements this set of aspects on all
8889 platforms).  Therefore if portability to other compilers is an important
8890 consideration, you should minimize the use of these aspects.
8892 Note that for many of these aspects, the effect is essentially similar
8893 to the use of a pragma or attribute specification with the same name
8894 applied to the entity. For example, if we write:
8896 @example
8897 type R is range 1 .. 100
8898   with Value_Size => 10;
8899 @end example
8901 then the effect is the same as:
8903 @example
8904 type R is range 1 .. 100;
8905 for R'Value_Size use 10;
8906 @end example
8908 and if we write:
8910 @example
8911 type R is new Integer
8912   with Shared => True;
8913 @end example
8915 then the effect is the same as:
8917 @example
8918 type R is new Integer;
8919 pragma Shared (R);
8920 @end example
8922 In the documentation below, such cases are simply marked
8923 as being boolean aspects equivalent to the corresponding pragma
8924 or attribute definition clause.
8926 @menu
8927 * Aspect Abstract_State:: 
8928 * Aspect Annotate:: 
8929 * Aspect Async_Readers:: 
8930 * Aspect Async_Writers:: 
8931 * Aspect Constant_After_Elaboration:: 
8932 * Aspect Contract_Cases:: 
8933 * Aspect Depends:: 
8934 * Aspect Default_Initial_Condition:: 
8935 * Aspect Dimension:: 
8936 * Aspect Dimension_System:: 
8937 * Aspect Disable_Controlled:: 
8938 * Aspect Effective_Reads:: 
8939 * Aspect Effective_Writes:: 
8940 * Aspect Extensions_Visible:: 
8941 * Aspect Favor_Top_Level:: 
8942 * Aspect Ghost:: 
8943 * Aspect Global:: 
8944 * Aspect Initial_Condition:: 
8945 * Aspect Initializes:: 
8946 * Aspect Inline_Always:: 
8947 * Aspect Invariant:: 
8948 * Aspect Invariant'Class:: 
8949 * Aspect Iterable:: 
8950 * Aspect Linker_Section:: 
8951 * Aspect Lock_Free:: 
8952 * Aspect Max_Queue_Length:: 
8953 * Aspect No_Elaboration_Code_All:: 
8954 * Aspect No_Tagged_Streams:: 
8955 * Aspect Object_Size:: 
8956 * Aspect Obsolescent:: 
8957 * Aspect Part_Of:: 
8958 * Aspect Persistent_BSS:: 
8959 * Aspect Predicate:: 
8960 * Aspect Pure_Function:: 
8961 * Aspect Refined_Depends:: 
8962 * Aspect Refined_Global:: 
8963 * Aspect Refined_Post:: 
8964 * Aspect Refined_State:: 
8965 * Aspect Remote_Access_Type:: 
8966 * Aspect Secondary_Stack_Size:: 
8967 * Aspect Scalar_Storage_Order:: 
8968 * Aspect Shared:: 
8969 * Aspect Simple_Storage_Pool:: 
8970 * Aspect Simple_Storage_Pool_Type:: 
8971 * Aspect SPARK_Mode:: 
8972 * Aspect Suppress_Debug_Info:: 
8973 * Aspect Suppress_Initialization:: 
8974 * Aspect Test_Case:: 
8975 * Aspect Thread_Local_Storage:: 
8976 * Aspect Universal_Aliasing:: 
8977 * Aspect Universal_Data:: 
8978 * Aspect Unmodified:: 
8979 * Aspect Unreferenced:: 
8980 * Aspect Unreferenced_Objects:: 
8981 * Aspect Value_Size:: 
8982 * Aspect Volatile_Full_Access:: 
8983 * Aspect Volatile_Function:: 
8984 * Aspect Warnings:: 
8986 @end menu
8988 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
8989 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{11e}
8990 @section Aspect Abstract_State
8993 @geindex Abstract_State
8995 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
8997 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
8998 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{11f}
8999 @section Aspect Annotate
9002 @geindex Annotate
9004 There are three forms of this aspect (where ID is an identifier,
9005 and ARG is a general expression),
9006 corresponding to @ref{25,,pragma Annotate}.
9009 @table @asis
9011 @item @emph{Annotate => ID}
9013 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
9015 @item @emph{Annotate => (ID)}
9017 Equivalent to @cite{pragma Annotate (ID@comma{} Entity => Name);}
9019 @item @emph{Annotate => (ID ,ID @{, ARG@})}
9021 Equivalent to @cite{pragma Annotate (ID@comma{} ID @{@comma{} ARG@}@comma{} Entity => Name);}
9022 @end table
9024 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9025 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{120}
9026 @section Aspect Async_Readers
9029 @geindex Async_Readers
9031 This boolean aspect is equivalent to @ref{2c,,pragma Async_Readers}.
9033 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9034 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{121}
9035 @section Aspect Async_Writers
9038 @geindex Async_Writers
9040 This boolean aspect is equivalent to @ref{2f,,pragma Async_Writers}.
9042 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9043 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{122}
9044 @section Aspect Constant_After_Elaboration
9047 @geindex Constant_After_Elaboration
9049 This aspect is equivalent to @ref{40,,pragma Constant_After_Elaboration}.
9051 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9052 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{123}
9053 @section Aspect Contract_Cases
9056 @geindex Contract_Cases
9058 This aspect is equivalent to @ref{42,,pragma Contract_Cases}, the sequence
9059 of clauses being enclosed in parentheses so that syntactically it is an
9060 aggregate.
9062 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9063 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{124}
9064 @section Aspect Depends
9067 @geindex Depends
9069 This aspect is equivalent to @ref{51,,pragma Depends}.
9071 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9072 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{125}
9073 @section Aspect Default_Initial_Condition
9076 @geindex Default_Initial_Condition
9078 This aspect is equivalent to @ref{4c,,pragma Default_Initial_Condition}.
9080 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9081 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{126}
9082 @section Aspect Dimension
9085 @geindex Dimension
9087 The @cite{Dimension} aspect is used to specify the dimensions of a given
9088 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9089 used when doing formatted output of dimensioned quantities. The syntax is:
9091 @example
9092 with Dimension =>
9093   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9095 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9097 DIMENSION_VALUE ::=
9098   RATIONAL
9099 | others               => RATIONAL
9100 | DISCRETE_CHOICE_LIST => RATIONAL
9102 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9103 @end example
9105 This aspect can only be applied to a subtype whose parent type has
9106 a @cite{Dimension_System} aspect. The aspect must specify values for
9107 all dimensions of the system. The rational values are the powers of the
9108 corresponding dimensions that are used by the compiler to verify that
9109 physical (numeric) computations are dimensionally consistent. For example,
9110 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9111 For further examples of the usage
9112 of this aspect, see package @cite{System.Dim.Mks}.
9113 Note that when the dimensioned type is an integer type, then any
9114 dimension value must be an integer literal.
9116 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9117 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{127}
9118 @section Aspect Dimension_System
9121 @geindex Dimension_System
9123 The @cite{Dimension_System} aspect is used to define a system of
9124 dimensions that will be used in subsequent subtype declarations with
9125 @cite{Dimension} aspects that reference this system. The syntax is:
9127 @example
9128 with Dimension_System => (DIMENSION @{, DIMENSION@});
9130 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
9131                [Unit_Symbol =>] SYMBOL,
9132                [Dim_Symbol  =>] SYMBOL)
9134 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9135 @end example
9137 This aspect is applied to a type, which must be a numeric derived type
9138 (typically a floating-point type), that
9139 will represent values within the dimension system. Each @cite{DIMENSION}
9140 corresponds to one particular dimension. A maximum of 7 dimensions may
9141 be specified. @cite{Unit_Name} is the name of the dimension (for example
9142 @cite{Meter}). @cite{Unit_Symbol} is the shorthand used for quantities
9143 of this dimension (for example @cite{m} for @cite{Meter}).
9144 @cite{Dim_Symbol} gives
9145 the identification within the dimension system (typically this is a
9146 single letter, e.g. @cite{L} standing for length for unit name @cite{Meter}).
9147 The @cite{Unit_Symbol} is used in formatted output of dimensioned quantities.
9148 The @cite{Dim_Symbol} is used in error messages when numeric operations have
9149 inconsistent dimensions.
9151 GNAT provides the standard definition of the International MKS system in
9152 the run-time package @cite{System.Dim.Mks}. You can easily define
9153 similar packages for cgs units or British units, and define conversion factors
9154 between values in different systems. The MKS system is characterized by the
9155 following aspect:
9157 @example
9158 type Mks_Type is new Long_Long_Float with
9159   Dimension_System => (
9160     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
9161     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
9162     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
9163     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
9164     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
9165     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
9166     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
9167 @end example
9169 Note that in the above type definition, we use the @cite{at} symbol (@code{@@}) to
9170 represent a theta character (avoiding the use of extended Latin-1
9171 characters in this context).
9173 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
9174 Guide for detailed examples of use of the dimension system.
9176 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9177 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{128}
9178 @section Aspect Disable_Controlled
9181 @geindex Disable_Controlled
9183 The aspect  @cite{Disable_Controlled} is defined for controlled record types. If
9184 active, this aspect causes suppression of all related calls to @cite{Initialize},
9185 @cite{Adjust}, and @cite{Finalize}. The intended use is for conditional compilation,
9186 where for example you might want a record to be controlled or not depending on
9187 whether some run-time check is enabled or suppressed.
9189 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9190 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{129}
9191 @section Aspect Effective_Reads
9194 @geindex Effective_Reads
9196 This aspect is equivalent to @ref{57,,pragma Effective_Reads}.
9198 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9199 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{12a}
9200 @section Aspect Effective_Writes
9203 @geindex Effective_Writes
9205 This aspect is equivalent to @ref{59,,pragma Effective_Writes}.
9207 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9208 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{12b}
9209 @section Aspect Extensions_Visible
9212 @geindex Extensions_Visible
9214 This aspect is equivalent to @ref{65,,pragma Extensions_Visible}.
9216 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9217 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{12c}
9218 @section Aspect Favor_Top_Level
9221 @geindex Favor_Top_Level
9223 This boolean aspect is equivalent to @ref{6a,,pragma Favor_Top_Level}.
9225 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9226 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{12d}
9227 @section Aspect Ghost
9230 @geindex Ghost
9232 This aspect is equivalent to @ref{6d,,pragma Ghost}.
9234 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9235 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{12e}
9236 @section Aspect Global
9239 @geindex Global
9241 This aspect is equivalent to @ref{6f,,pragma Global}.
9243 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9244 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{12f}
9245 @section Aspect Initial_Condition
9248 @geindex Initial_Condition
9250 This aspect is equivalent to @ref{7d,,pragma Initial_Condition}.
9252 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9253 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{130}
9254 @section Aspect Initializes
9257 @geindex Initializes
9259 This aspect is equivalent to @ref{7f,,pragma Initializes}.
9261 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9262 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{131}
9263 @section Aspect Inline_Always
9266 @geindex Inline_Always
9268 This boolean aspect is equivalent to @ref{82,,pragma Inline_Always}.
9270 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9271 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{132}
9272 @section Aspect Invariant
9275 @geindex Invariant
9277 This aspect is equivalent to @ref{89,,pragma Invariant}. It is a
9278 synonym for the language defined aspect @cite{Type_Invariant} except
9279 that it is separately controllable using pragma @cite{Assertion_Policy}.
9281 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9282 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{133}
9283 @section Aspect Invariant'Class
9286 @geindex Invariant'Class
9288 This aspect is equivalent to @ref{fd,,pragma Type_Invariant_Class}. It is a
9289 synonym for the language defined aspect @cite{Type_Invariant'Class} except
9290 that it is separately controllable using pragma @cite{Assertion_Policy}.
9292 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9293 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{134}
9294 @section Aspect Iterable
9297 @geindex Iterable
9299 This aspect provides a light-weight mechanism for loops and quantified
9300 expressions over container types, without the overhead imposed by the tampering
9301 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9302 with four named components: @cite{First}, @cite{Next}, @cite{Has_Element}, and @cite{Element} (the
9303 last one being optional). When only 3 components are specified, only the
9304 @cite{for .. in} form of iteration over cursors is available. When all 4 components
9305 are specified, both this form and the @cite{for .. of} form of iteration over
9306 elements are available. The following is a typical example of use:
9308 @example
9309 type List is private with
9310     Iterable => (First        => First_Cursor,
9311                  Next         => Advance,
9312                  Has_Element  => Cursor_Has_Element,
9313                 [Element      => Get_Element]);
9314 @end example
9317 @itemize *
9319 @item 
9320 The value denoted by @cite{First} must denote a primitive operation of the
9321 container type that returns a @cite{Cursor}, which must a be a type declared in
9322 the container package or visible from it. For example:
9323 @end itemize
9325 @example
9326 function First_Cursor (Cont : Container) return Cursor;
9327 @end example
9330 @itemize *
9332 @item 
9333 The value of @cite{Next} is a primitive operation of the container type that takes
9334 both a container and a cursor and yields a cursor. For example:
9335 @end itemize
9337 @example
9338 function Advance (Cont : Container; Position : Cursor) return Cursor;
9339 @end example
9342 @itemize *
9344 @item 
9345 The value of @cite{Has_Element} is a primitive operation of the container type
9346 that takes both a container and a cursor and yields a boolean. For example:
9347 @end itemize
9349 @example
9350 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9351 @end example
9354 @itemize *
9356 @item 
9357 The value of @cite{Element} is a primitive operation of the container type that
9358 takes both a container and a cursor and yields an @cite{Element_Type}, which must
9359 be a type declared in the container package or visible from it. For example:
9360 @end itemize
9362 @example
9363 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9364 @end example
9366 This aspect is used in the GNAT-defined formal container packages.
9368 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9369 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{135}
9370 @section Aspect Linker_Section
9373 @geindex Linker_Section
9375 This aspect is equivalent to @ref{91,,pragma Linker_Section}.
9377 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9378 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{136}
9379 @section Aspect Lock_Free
9382 @geindex Lock_Free
9384 This boolean aspect is equivalent to @ref{93,,pragma Lock_Free}.
9386 @node Aspect Max_Queue_Length,Aspect No_Elaboration_Code_All,Aspect Lock_Free,Implementation Defined Aspects
9387 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{137}
9388 @section Aspect Max_Queue_Length
9391 @geindex Max_Queue_Length
9393 This aspect is equivalent to pragma Max_Queue_Length.
9395 @node Aspect No_Elaboration_Code_All,Aspect No_Tagged_Streams,Aspect Max_Queue_Length,Implementation Defined Aspects
9396 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{138}
9397 @section Aspect No_Elaboration_Code_All
9400 @geindex No_Elaboration_Code_All
9402 This aspect is equivalent to @ref{9d,,pragma No_Elaboration_Code_All}
9403 for a program unit.
9405 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9406 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{139}
9407 @section Aspect No_Tagged_Streams
9410 @geindex No_Tagged_Streams
9412 This aspect is equivalent to @ref{a3,,pragma No_Tagged_Streams} with an
9413 argument specifying a root tagged type (thus this aspect can only be
9414 applied to such a type).
9416 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9417 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{13a}
9418 @section Aspect Object_Size
9421 @geindex Object_Size
9423 This aspect is equivalent to @ref{13b,,attribute Object_Size}.
9425 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9426 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{13c}
9427 @section Aspect Obsolescent
9430 @geindex Obsolsecent
9432 This aspect is equivalent to @ref{a6,,pragma Obsolescent}. Note that the
9433 evaluation of this aspect happens at the point of occurrence, it is not
9434 delayed until the freeze point.
9436 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9437 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{13d}
9438 @section Aspect Part_Of
9441 @geindex Part_Of
9443 This aspect is equivalent to @ref{ae,,pragma Part_Of}.
9445 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9446 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{13e}
9447 @section Aspect Persistent_BSS
9450 @geindex Persistent_BSS
9452 This boolean aspect is equivalent to @ref{b0,,pragma Persistent_BSS}.
9454 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9455 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{13f}
9456 @section Aspect Predicate
9459 @geindex Predicate
9461 This aspect is equivalent to @ref{b9,,pragma Predicate}. It is thus
9462 similar to the language defined aspects @cite{Dynamic_Predicate}
9463 and @cite{Static_Predicate} except that whether the resulting
9464 predicate is static or dynamic is controlled by the form of the
9465 expression. It is also separately controllable using pragma
9466 @cite{Assertion_Policy}.
9468 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9469 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{140}
9470 @section Aspect Pure_Function
9473 @geindex Pure_Function
9475 This boolean aspect is equivalent to @ref{c5,,pragma Pure_Function}.
9477 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9478 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{141}
9479 @section Aspect Refined_Depends
9482 @geindex Refined_Depends
9484 This aspect is equivalent to @ref{ca,,pragma Refined_Depends}.
9486 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9487 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{142}
9488 @section Aspect Refined_Global
9491 @geindex Refined_Global
9493 This aspect is equivalent to @ref{cb,,pragma Refined_Global}.
9495 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9496 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{143}
9497 @section Aspect Refined_Post
9500 @geindex Refined_Post
9502 This aspect is equivalent to @ref{cd,,pragma Refined_Post}.
9504 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9505 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{144}
9506 @section Aspect Refined_State
9509 @geindex Refined_State
9511 This aspect is equivalent to @ref{cf,,pragma Refined_State}.
9513 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Refined_State,Implementation Defined Aspects
9514 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{145}
9515 @section Aspect Remote_Access_Type
9518 @geindex Remote_Access_Type
9520 This aspect is equivalent to @ref{d3,,pragma Remote_Access_Type}.
9522 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9523 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{146}
9524 @section Aspect Secondary_Stack_Size
9527 @geindex Secondary_Stack_Size
9529 This aspect is equivalent to @ref{d8,,pragma Secondary_Stack_Size}.
9531 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9532 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{147}
9533 @section Aspect Scalar_Storage_Order
9536 @geindex Scalar_Storage_Order
9538 This aspect is equivalent to a @ref{148,,attribute Scalar_Storage_Order}.
9540 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9541 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{149}
9542 @section Aspect Shared
9545 @geindex Shared
9547 This boolean aspect is equivalent to @ref{db,,pragma Shared}
9548 and is thus a synonym for aspect @cite{Atomic}.
9550 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9551 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{14a}
9552 @section Aspect Simple_Storage_Pool
9555 @geindex Simple_Storage_Pool
9557 This aspect is equivalent to @ref{e0,,attribute Simple_Storage_Pool}.
9559 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9560 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{14b}
9561 @section Aspect Simple_Storage_Pool_Type
9564 @geindex Simple_Storage_Pool_Type
9566 This boolean aspect is equivalent to @ref{de,,pragma Simple_Storage_Pool_Type}.
9568 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9569 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{14c}
9570 @section Aspect SPARK_Mode
9573 @geindex SPARK_Mode
9575 This aspect is equivalent to @ref{e6,,pragma SPARK_Mode} and
9576 may be specified for either or both of the specification and body
9577 of a subprogram or package.
9579 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9580 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{14d}
9581 @section Aspect Suppress_Debug_Info
9584 @geindex Suppress_Debug_Info
9586 This boolean aspect is equivalent to @ref{ee,,pragma Suppress_Debug_Info}.
9588 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9589 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{14e}
9590 @section Aspect Suppress_Initialization
9593 @geindex Suppress_Initialization
9595 This boolean aspect is equivalent to @ref{f2,,pragma Suppress_Initialization}.
9597 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9598 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{14f}
9599 @section Aspect Test_Case
9602 @geindex Test_Case
9604 This aspect is equivalent to @ref{f5,,pragma Test_Case}.
9606 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9607 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{150}
9608 @section Aspect Thread_Local_Storage
9611 @geindex Thread_Local_Storage
9613 This boolean aspect is equivalent to @ref{f7,,pragma Thread_Local_Storage}.
9615 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
9616 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{151}
9617 @section Aspect Universal_Aliasing
9620 @geindex Universal_Aliasing
9622 This boolean aspect is equivalent to @ref{102,,pragma Universal_Aliasing}.
9624 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
9625 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{152}
9626 @section Aspect Universal_Data
9629 @geindex Universal_Data
9631 This aspect is equivalent to @ref{103,,pragma Universal_Data}.
9633 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
9634 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{153}
9635 @section Aspect Unmodified
9638 @geindex Unmodified
9640 This boolean aspect is equivalent to @ref{106,,pragma Unmodified}.
9642 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9643 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{154}
9644 @section Aspect Unreferenced
9647 @geindex Unreferenced
9649 This boolean aspect is equivalent to @ref{107,,pragma Unreferenced}. Note that
9650 in the case of formal parameters, it is not permitted to have aspects for
9651 a formal parameter, so in this case the pragma form must be used.
9653 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9654 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{155}
9655 @section Aspect Unreferenced_Objects
9658 @geindex Unreferenced_Objects
9660 This boolean aspect is equivalent to @ref{109,,pragma Unreferenced_Objects}.
9662 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
9663 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{156}
9664 @section Aspect Value_Size
9667 @geindex Value_Size
9669 This aspect is equivalent to @ref{157,,attribute Value_Size}.
9671 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
9672 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{158}
9673 @section Aspect Volatile_Full_Access
9676 @geindex Volatile_Full_Access
9678 This boolean aspect is equivalent to @ref{112,,pragma Volatile_Full_Access}.
9680 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
9681 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{159}
9682 @section Aspect Volatile_Function
9685 @geindex Volatile_Function
9687 This boolean aspect is equivalent to @ref{115,,pragma Volatile_Function}.
9689 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
9690 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{15a}
9691 @section Aspect Warnings
9694 @geindex Warnings
9696 This aspect is equivalent to the two argument form of @ref{117,,pragma Warnings},
9697 where the first argument is @cite{ON} or @cite{OFF} and the second argument
9698 is the entity.
9700 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9701 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{15b}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{15c}
9702 @chapter Implementation Defined Attributes
9705 Ada defines (throughout the Ada reference manual,
9706 summarized in Annex K),
9707 a set of attributes that provide useful additional functionality in all
9708 areas of the language.  These language defined attributes are implemented
9709 in GNAT and work as described in the Ada Reference Manual.
9711 In addition, Ada allows implementations to define additional
9712 attributes whose meaning is defined by the implementation.  GNAT provides
9713 a number of these implementation-dependent attributes which can be used
9714 to extend and enhance the functionality of the compiler.  This section of
9715 the GNAT reference manual describes these additional attributes.  It also
9716 describes additional implementation-dependent features of standard
9717 language-defined attributes.
9719 Note that any program using these attributes may not be portable to
9720 other compilers (although GNAT implements this set of attributes on all
9721 platforms).  Therefore if portability to other compilers is an important
9722 consideration, you should minimize the use of these attributes.
9724 @menu
9725 * Attribute Abort_Signal:: 
9726 * Attribute Address_Size:: 
9727 * Attribute Asm_Input:: 
9728 * Attribute Asm_Output:: 
9729 * Attribute Atomic_Always_Lock_Free:: 
9730 * Attribute Bit:: 
9731 * Attribute Bit_Position:: 
9732 * Attribute Code_Address:: 
9733 * Attribute Compiler_Version:: 
9734 * Attribute Constrained:: 
9735 * Attribute Default_Bit_Order:: 
9736 * Attribute Default_Scalar_Storage_Order:: 
9737 * Attribute Deref:: 
9738 * Attribute Descriptor_Size:: 
9739 * Attribute Elaborated:: 
9740 * Attribute Elab_Body:: 
9741 * Attribute Elab_Spec:: 
9742 * Attribute Elab_Subp_Body:: 
9743 * Attribute Emax:: 
9744 * Attribute Enabled:: 
9745 * Attribute Enum_Rep:: 
9746 * Attribute Enum_Val:: 
9747 * Attribute Epsilon:: 
9748 * Attribute Fast_Math:: 
9749 * Attribute Finalization_Size:: 
9750 * Attribute Fixed_Value:: 
9751 * Attribute From_Any:: 
9752 * Attribute Has_Access_Values:: 
9753 * Attribute Has_Discriminants:: 
9754 * Attribute Img:: 
9755 * Attribute Integer_Value:: 
9756 * Attribute Invalid_Value:: 
9757 * Attribute Iterable:: 
9758 * Attribute Large:: 
9759 * Attribute Library_Level:: 
9760 * Attribute Lock_Free:: 
9761 * Attribute Loop_Entry:: 
9762 * Attribute Machine_Size:: 
9763 * Attribute Mantissa:: 
9764 * Attribute Maximum_Alignment:: 
9765 * Attribute Mechanism_Code:: 
9766 * Attribute Null_Parameter:: 
9767 * Attribute Object_Size:: 
9768 * Attribute Old:: 
9769 * Attribute Passed_By_Reference:: 
9770 * Attribute Pool_Address:: 
9771 * Attribute Range_Length:: 
9772 * Attribute Restriction_Set:: 
9773 * Attribute Result:: 
9774 * Attribute Safe_Emax:: 
9775 * Attribute Safe_Large:: 
9776 * Attribute Safe_Small:: 
9777 * Attribute Scalar_Storage_Order:: 
9778 * Attribute Simple_Storage_Pool:: 
9779 * Attribute Small:: 
9780 * Attribute Storage_Unit:: 
9781 * Attribute Stub_Type:: 
9782 * Attribute System_Allocator_Alignment:: 
9783 * Attribute Target_Name:: 
9784 * Attribute To_Address:: 
9785 * Attribute To_Any:: 
9786 * Attribute Type_Class:: 
9787 * Attribute Type_Key:: 
9788 * Attribute TypeCode:: 
9789 * Attribute Unconstrained_Array:: 
9790 * Attribute Universal_Literal_String:: 
9791 * Attribute Unrestricted_Access:: 
9792 * Attribute Update:: 
9793 * Attribute Valid_Scalars:: 
9794 * Attribute VADS_Size:: 
9795 * Attribute Value_Size:: 
9796 * Attribute Wchar_T_Size:: 
9797 * Attribute Word_Size:: 
9799 @end menu
9801 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
9802 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{15d}
9803 @section Attribute Abort_Signal
9806 @geindex Abort_Signal
9808 @cite{Standard'Abort_Signal} (@cite{Standard} is the only allowed
9809 prefix) provides the entity for the special exception used to signal
9810 task abort or asynchronous transfer of control.  Normally this attribute
9811 should only be used in the tasking runtime (it is highly peculiar, and
9812 completely outside the normal semantics of Ada, for a user program to
9813 intercept the abort exception).
9815 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
9816 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{15e}
9817 @section Attribute Address_Size
9820 @geindex Size of `Address`
9822 @geindex Address_Size
9824 @cite{Standard'Address_Size} (@cite{Standard} is the only allowed
9825 prefix) is a static constant giving the number of bits in an
9826 @cite{Address}. It is the same value as System.Address'Size,
9827 but has the advantage of being static, while a direct
9828 reference to System.Address'Size is nonstatic because Address
9829 is a private type.
9831 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
9832 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{15f}
9833 @section Attribute Asm_Input
9836 @geindex Asm_Input
9838 The @cite{Asm_Input} attribute denotes a function that takes two
9839 parameters.  The first is a string, the second is an expression of the
9840 type designated by the prefix.  The first (string) argument is required
9841 to be a static expression, and is the constraint for the parameter,
9842 (e.g., what kind of register is required).  The second argument is the
9843 value to be used as the input argument.  The possible values for the
9844 constant are the same as those used in the RTL, and are dependent on
9845 the configuration file used to built the GCC back end.
9846 @ref{160,,Machine Code Insertions}
9848 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
9849 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{161}
9850 @section Attribute Asm_Output
9853 @geindex Asm_Output
9855 The @cite{Asm_Output} attribute denotes a function that takes two
9856 parameters.  The first is a string, the second is the name of a variable
9857 of the type designated by the attribute prefix.  The first (string)
9858 argument is required to be a static expression and designates the
9859 constraint for the parameter (e.g., what kind of register is
9860 required).  The second argument is the variable to be updated with the
9861 result.  The possible values for constraint are the same as those used in
9862 the RTL, and are dependent on the configuration file used to build the
9863 GCC back end.  If there are no output operands, then this argument may
9864 either be omitted, or explicitly given as @cite{No_Output_Operands}.
9865 @ref{160,,Machine Code Insertions}
9867 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
9868 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{162}
9869 @section Attribute Atomic_Always_Lock_Free
9872 @geindex Atomic_Always_Lock_Free
9874 The prefix of the @cite{Atomic_Always_Lock_Free} attribute is a type.
9875 The result is a Boolean value which is True if the type has discriminants,
9876 and False otherwise.  The result indicate whether atomic operations are
9877 supported by the target for the given type.
9879 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
9880 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{163}
9881 @section Attribute Bit
9884 @geindex Bit
9886 @code{obj'Bit}, where @cite{obj} is any object, yields the bit
9887 offset within the storage unit (byte) that contains the first bit of
9888 storage allocated for the object.  The value of this attribute is of the
9889 type @cite{Universal_Integer}, and is always a non-negative number not
9890 exceeding the value of @cite{System.Storage_Unit}.
9892 For an object that is a variable or a constant allocated in a register,
9893 the value is zero.  (The use of this attribute does not force the
9894 allocation of a variable to memory).
9896 For an object that is a formal parameter, this attribute applies
9897 to either the matching actual parameter or to a copy of the
9898 matching actual parameter.
9900 For an access object the value is zero.  Note that
9901 @code{obj.all'Bit} is subject to an @cite{Access_Check} for the
9902 designated object.  Similarly for a record component
9903 @code{X.C'Bit} is subject to a discriminant check and
9904 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
9905 are subject to index checks.
9907 This attribute is designed to be compatible with the DEC Ada 83 definition
9908 and implementation of the @cite{Bit} attribute.
9910 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
9911 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{164}
9912 @section Attribute Bit_Position
9915 @geindex Bit_Position
9917 @code{R.C'Bit_Position}, where @cite{R} is a record object and @cite{C} is one
9918 of the fields of the record type, yields the bit
9919 offset within the record contains the first bit of
9920 storage allocated for the object.  The value of this attribute is of the
9921 type @cite{Universal_Integer}.  The value depends only on the field
9922 @cite{C} and is independent of the alignment of
9923 the containing record @cite{R}.
9925 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
9926 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{165}
9927 @section Attribute Code_Address
9930 @geindex Code_Address
9932 @geindex Subprogram address
9934 @geindex Address of subprogram code
9936 The @cite{'Address}
9937 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
9938 intended effect seems to be to provide
9939 an address value which can be used to call the subprogram by means of
9940 an address clause as in the following example:
9942 @example
9943 procedure K is ...
9945 procedure L;
9946 for L'Address use K'Address;
9947 pragma Import (Ada, L);
9948 @end example
9950 A call to @cite{L} is then expected to result in a call to @cite{K}.
9951 In Ada 83, where there were no access-to-subprogram values, this was
9952 a common work-around for getting the effect of an indirect call.
9953 GNAT implements the above use of @cite{Address} and the technique
9954 illustrated by the example code works correctly.
9956 However, for some purposes, it is useful to have the address of the start
9957 of the generated code for the subprogram.  On some architectures, this is
9958 not necessarily the same as the @cite{Address} value described above.
9959 For example, the @cite{Address} value may reference a subprogram
9960 descriptor rather than the subprogram itself.
9962 The @cite{'Code_Address} attribute, which can only be applied to
9963 subprogram entities, always returns the address of the start of the
9964 generated code of the specified subprogram, which may or may not be
9965 the same value as is returned by the corresponding @cite{'Address}
9966 attribute.
9968 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
9969 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{166}
9970 @section Attribute Compiler_Version
9973 @geindex Compiler_Version
9975 @cite{Standard'Compiler_Version} (@cite{Standard} is the only allowed
9976 prefix) yields a static string identifying the version of the compiler
9977 being used to compile the unit containing the attribute reference.
9979 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
9980 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{167}
9981 @section Attribute Constrained
9984 @geindex Constrained
9986 In addition to the usage of this attribute in the Ada RM, @cite{GNAT}
9987 also permits the use of the @cite{'Constrained} attribute
9988 in a generic template
9989 for any type, including types without discriminants. The value of this
9990 attribute in the generic instance when applied to a scalar type or a
9991 record type without discriminants is always @cite{True}. This usage is
9992 compatible with older Ada compilers, including notably DEC Ada.
9994 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
9995 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{168}
9996 @section Attribute Default_Bit_Order
9999 @geindex Big endian
10001 @geindex Little endian
10003 @geindex Default_Bit_Order
10005 @cite{Standard'Default_Bit_Order} (@cite{Standard} is the only
10006 permissible prefix), provides the value @cite{System.Default_Bit_Order}
10007 as a @cite{Pos} value (0 for @cite{High_Order_First}, 1 for
10008 @cite{Low_Order_First}).  This is used to construct the definition of
10009 @cite{Default_Bit_Order} in package @cite{System}.
10011 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10012 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{169}
10013 @section Attribute Default_Scalar_Storage_Order
10016 @geindex Big endian
10018 @geindex Little endian
10020 @geindex Default_Scalar_Storage_Order
10022 @cite{Standard'Default_Scalar_Storage_Order} (@cite{Standard} is the only
10023 permissible prefix), provides the current value of the default scalar storage
10024 order (as specified using pragma @cite{Default_Scalar_Storage_Order}, or
10025 equal to @cite{Default_Bit_Order} if unspecified) as a
10026 @cite{System.Bit_Order} value. This is a static attribute.
10028 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10029 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{16a}
10030 @section Attribute Deref
10033 @geindex Deref
10035 The attribute @cite{typ'Deref(expr)} where @cite{expr} is of type @cite{System.Address} yields
10036 the variable of type @cite{typ} that is located at the given address. It is similar
10037 to @cite{(totyp (expr).all)}, where @cite{totyp} is an unchecked conversion from address to
10038 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10039 used on the left side of an assignment.
10041 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10042 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{16b}
10043 @section Attribute Descriptor_Size
10046 @geindex Descriptor
10048 @geindex Dope vector
10050 @geindex Descriptor_Size
10052 Nonstatic attribute @cite{Descriptor_Size} returns the size in bits of the
10053 descriptor allocated for a type.  The result is non-zero only for unconstrained
10054 array types and the returned value is of type universal integer.  In GNAT, an
10055 array descriptor contains bounds information and is located immediately before
10056 the first element of the array.
10058 @example
10059 type Unconstr_Array is array (Positive range <>) of Boolean;
10060 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10061 @end example
10063 The attribute takes into account any additional padding due to type alignment.
10064 In the example above, the descriptor contains two values of type
10065 @cite{Positive} representing the low and high bound.  Since @cite{Positive} has
10066 a size of 31 bits and an alignment of 4, the descriptor size is @cite{2 * Positive'Size + 2} or 64 bits.
10068 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10069 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{16c}
10070 @section Attribute Elaborated
10073 @geindex Elaborated
10075 The prefix of the @cite{'Elaborated} attribute must be a unit name.  The
10076 value is a Boolean which indicates whether or not the given unit has been
10077 elaborated.  This attribute is primarily intended for internal use by the
10078 generated code for dynamic elaboration checking, but it can also be used
10079 in user programs.  The value will always be True once elaboration of all
10080 units has been completed.  An exception is for units which need no
10081 elaboration, the value is always False for such units.
10083 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10084 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{16d}
10085 @section Attribute Elab_Body
10088 @geindex Elab_Body
10090 This attribute can only be applied to a program unit name.  It returns
10091 the entity for the corresponding elaboration procedure for elaborating
10092 the body of the referenced unit.  This is used in the main generated
10093 elaboration procedure by the binder and is not normally used in any
10094 other context.  However, there may be specialized situations in which it
10095 is useful to be able to call this elaboration procedure from Ada code,
10096 e.g., if it is necessary to do selective re-elaboration to fix some
10097 error.
10099 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10100 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{16e}
10101 @section Attribute Elab_Spec
10104 @geindex Elab_Spec
10106 This attribute can only be applied to a program unit name.  It returns
10107 the entity for the corresponding elaboration procedure for elaborating
10108 the spec of the referenced unit.  This is used in the main
10109 generated elaboration procedure by the binder and is not normally used
10110 in any other context.  However, there may be specialized situations in
10111 which it is useful to be able to call this elaboration procedure from
10112 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10113 some error.
10115 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10116 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{16f}
10117 @section Attribute Elab_Subp_Body
10120 @geindex Elab_Subp_Body
10122 This attribute can only be applied to a library level subprogram
10123 name and is only allowed in CodePeer mode. It returns the entity
10124 for the corresponding elaboration procedure for elaborating the body
10125 of the referenced subprogram unit. This is used in the main generated
10126 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10127 otherwise.
10129 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10130 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{170}
10131 @section Attribute Emax
10134 @geindex Ada 83 attributes
10136 @geindex Emax
10138 The @cite{Emax} attribute is provided for compatibility with Ada 83.  See
10139 the Ada 83 reference manual for an exact description of the semantics of
10140 this attribute.
10142 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10143 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{171}
10144 @section Attribute Enabled
10147 @geindex Enabled
10149 The @cite{Enabled} attribute allows an application program to check at compile
10150 time to see if the designated check is currently enabled. The prefix is a
10151 simple identifier, referencing any predefined check name (other than
10152 @cite{All_Checks}) or a check name introduced by pragma Check_Name. If
10153 no argument is given for the attribute, the check is for the general state
10154 of the check, if an argument is given, then it is an entity name, and the
10155 check indicates whether an @cite{Suppress} or @cite{Unsuppress} has been
10156 given naming the entity (if not, then the argument is ignored).
10158 Note that instantiations inherit the check status at the point of the
10159 instantiation, so a useful idiom is to have a library package that
10160 introduces a check name with @cite{pragma Check_Name}, and then contains
10161 generic packages or subprograms which use the @cite{Enabled} attribute
10162 to see if the check is enabled. A user of this package can then issue
10163 a @cite{pragma Suppress} or @cite{pragma Unsuppress} before instantiating
10164 the package or subprogram, controlling whether the check will be present.
10166 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10167 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{172}
10168 @section Attribute Enum_Rep
10171 @geindex Representation of enums
10173 @geindex Enum_Rep
10175 For every enumeration subtype @cite{S}, @code{S'Enum_Rep} denotes a
10176 function with the following spec:
10178 @example
10179 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10180 @end example
10182 It is also allowable to apply @cite{Enum_Rep} directly to an object of an
10183 enumeration type or to a non-overloaded enumeration
10184 literal.  In this case @code{S'Enum_Rep} is equivalent to
10185 @code{typ'Enum_Rep(S)} where @cite{typ} is the type of the
10186 enumeration literal or object.
10188 The function returns the representation value for the given enumeration
10189 value.  This will be equal to value of the @cite{Pos} attribute in the
10190 absence of an enumeration representation clause.  This is a static
10191 attribute (i.e.,:the result is static if the argument is static).
10193 @code{S'Enum_Rep} can also be used with integer types and objects,
10194 in which case it simply returns the integer value.  The reason for this
10195 is to allow it to be used for @cite{(<>)} discrete formal arguments in
10196 a generic unit that can be instantiated with either enumeration types
10197 or integer types.  Note that if @cite{Enum_Rep} is used on a modular
10198 type whose upper bound exceeds the upper bound of the largest signed
10199 integer type, and the argument is a variable, so that the universal
10200 integer calculation is done at run time, then the call to @cite{Enum_Rep}
10201 may raise @cite{Constraint_Error}.
10203 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10204 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{173}
10205 @section Attribute Enum_Val
10208 @geindex Representation of enums
10210 @geindex Enum_Val
10212 For every enumeration subtype @cite{S}, @code{S'Enum_Val} denotes a
10213 function with the following spec:
10215 @example
10216 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10217 @end example
10219 The function returns the enumeration value whose representation matches the
10220 argument, or raises Constraint_Error if no enumeration literal of the type
10221 has the matching value.
10222 This will be equal to value of the @cite{Val} attribute in the
10223 absence of an enumeration representation clause.  This is a static
10224 attribute (i.e., the result is static if the argument is static).
10226 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10227 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{174}
10228 @section Attribute Epsilon
10231 @geindex Ada 83 attributes
10233 @geindex Epsilon
10235 The @cite{Epsilon} attribute is provided for compatibility with Ada 83.  See
10236 the Ada 83 reference manual for an exact description of the semantics of
10237 this attribute.
10239 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10240 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{175}
10241 @section Attribute Fast_Math
10244 @geindex Fast_Math
10246 @cite{Standard'Fast_Math} (@cite{Standard} is the only allowed
10247 prefix) yields a static Boolean value that is True if pragma
10248 @cite{Fast_Math} is active, and False otherwise.
10250 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10251 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{176}
10252 @section Attribute Finalization_Size
10255 @geindex Finalization_Size
10257 The prefix of attribute @cite{Finalization_Size} must be an object or
10258 a non-class-wide type. This attribute returns the size of any hidden data
10259 reserved by the compiler to handle finalization-related actions. The type of
10260 the attribute is @cite{universal_integer}.
10262 @cite{Finalization_Size} yields a value of zero for a type with no controlled
10263 parts, an object whose type has no controlled parts, or an object of a
10264 class-wide type whose tag denotes a type with no controlled parts.
10266 Note that only heap-allocated objects contain finalization data.
10268 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10269 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{177}
10270 @section Attribute Fixed_Value
10273 @geindex Fixed_Value
10275 For every fixed-point type @cite{S}, @code{S'Fixed_Value} denotes a
10276 function with the following specification:
10278 @example
10279 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10280 @end example
10282 The value returned is the fixed-point value @cite{V} such that:
10284 @example
10285 V = Arg * S'Small
10286 @end example
10288 The effect is thus similar to first converting the argument to the
10289 integer type used to represent @cite{S}, and then doing an unchecked
10290 conversion to the fixed-point type.  The difference is
10291 that there are full range checks, to ensure that the result is in range.
10292 This attribute is primarily intended for use in implementation of the
10293 input-output functions for fixed-point values.
10295 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10296 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{178}
10297 @section Attribute From_Any
10300 @geindex From_Any
10302 This internal attribute is used for the generation of remote subprogram
10303 stubs in the context of the Distributed Systems Annex.
10305 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10306 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{179}
10307 @section Attribute Has_Access_Values
10310 @geindex Access values
10311 @geindex testing for
10313 @geindex Has_Access_Values
10315 The prefix of the @cite{Has_Access_Values} attribute is a type.  The result
10316 is a Boolean value which is True if the is an access type, or is a composite
10317 type with a component (at any nesting depth) that is an access type, and is
10318 False otherwise.
10319 The intended use of this attribute is in conjunction with generic
10320 definitions.  If the attribute is applied to a generic private type, it
10321 indicates whether or not the corresponding actual type has access values.
10323 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10324 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{17a}
10325 @section Attribute Has_Discriminants
10328 @geindex Discriminants
10329 @geindex testing for
10331 @geindex Has_Discriminants
10333 The prefix of the @cite{Has_Discriminants} attribute is a type.  The result
10334 is a Boolean value which is True if the type has discriminants, and False
10335 otherwise.  The intended use of this attribute is in conjunction with generic
10336 definitions.  If the attribute is applied to a generic private type, it
10337 indicates whether or not the corresponding actual type has discriminants.
10339 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10340 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{17b}
10341 @section Attribute Img
10344 @geindex Img
10346 The @cite{Img} attribute differs from @cite{Image} in that it is applied
10347 directly to an object, and yields the same result as
10348 @cite{Image} for the subtype of the object.  This is convenient for
10349 debugging:
10351 @example
10352 Put_Line ("X = " & X'Img);
10353 @end example
10355 has the same meaning as the more verbose:
10357 @example
10358 Put_Line ("X = " & T'Image (X));
10359 @end example
10361 where @cite{T} is the (sub)type of the object @cite{X}.
10363 Note that technically, in analogy to @cite{Image},
10364 @cite{X'Img} returns a parameterless function
10365 that returns the appropriate string when called. This means that
10366 @cite{X'Img} can be renamed as a function-returning-string, or used
10367 in an instantiation as a function parameter.
10369 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10370 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{17c}
10371 @section Attribute Integer_Value
10374 @geindex Integer_Value
10376 For every integer type @cite{S}, @code{S'Integer_Value} denotes a
10377 function with the following spec:
10379 @example
10380 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10381 @end example
10383 The value returned is the integer value @cite{V}, such that:
10385 @example
10386 Arg = V * T'Small
10387 @end example
10389 where @cite{T} is the type of @cite{Arg}.
10390 The effect is thus similar to first doing an unchecked conversion from
10391 the fixed-point type to its corresponding implementation type, and then
10392 converting the result to the target integer type.  The difference is
10393 that there are full range checks, to ensure that the result is in range.
10394 This attribute is primarily intended for use in implementation of the
10395 standard input-output functions for fixed-point values.
10397 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10398 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{17d}
10399 @section Attribute Invalid_Value
10402 @geindex Invalid_Value
10404 For every scalar type S, S'Invalid_Value returns an undefined value of the
10405 type. If possible this value is an invalid representation for the type. The
10406 value returned is identical to the value used to initialize an otherwise
10407 uninitialized value of the type if pragma Initialize_Scalars is used,
10408 including the ability to modify the value with the binder -Sxx flag and
10409 relevant environment variables at run time.
10411 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10412 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{17e}
10413 @section Attribute Iterable
10416 @geindex Iterable
10418 Equivalent to Aspect Iterable.
10420 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10421 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{17f}
10422 @section Attribute Large
10425 @geindex Ada 83 attributes
10427 @geindex Large
10429 The @cite{Large} attribute is provided for compatibility with Ada 83.  See
10430 the Ada 83 reference manual for an exact description of the semantics of
10431 this attribute.
10433 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10434 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{180}
10435 @section Attribute Library_Level
10438 @geindex Library_Level
10440 @cite{P'Library_Level}, where P is an entity name,
10441 returns a Boolean value which is True if the entity is declared
10442 at the library level, and False otherwise. Note that within a
10443 generic instantition, the name of the generic unit denotes the
10444 instance, which means that this attribute can be used to test
10445 if a generic is instantiated at the library level, as shown
10446 in this example:
10448 @example
10449 generic
10450   ...
10451 package Gen is
10452   pragma Compile_Time_Error
10453     (not Gen'Library_Level,
10454      "Gen can only be instantiated at library level");
10455   ...
10456 end Gen;
10457 @end example
10459 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10460 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{181}
10461 @section Attribute Lock_Free
10464 @geindex Lock_Free
10466 @cite{P'Lock_Free}, where P is a protected object, returns True if a
10467 pragma @cite{Lock_Free} applies to P.
10469 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10470 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{182}
10471 @section Attribute Loop_Entry
10474 @geindex Loop_Entry
10476 Syntax:
10478 @example
10479 X'Loop_Entry [(loop_name)]
10480 @end example
10482 The @cite{Loop_Entry} attribute is used to refer to the value that an
10483 expression had upon entry to a given loop in much the same way that the
10484 @cite{Old} attribute in a subprogram postcondition can be used to refer
10485 to the value an expression had upon entry to the subprogram. The
10486 relevant loop is either identified by the given loop name, or it is the
10487 innermost enclosing loop when no loop name is given.
10489 A @cite{Loop_Entry} attribute can only occur within a
10490 @cite{Loop_Variant} or @cite{Loop_Invariant} pragma. A common use of
10491 @cite{Loop_Entry} is to compare the current value of objects with their
10492 initial value at loop entry, in a @cite{Loop_Invariant} pragma.
10494 The effect of using @cite{X'Loop_Entry} is the same as declaring
10495 a constant initialized with the initial value of @cite{X} at loop
10496 entry. This copy is not performed if the loop is not entered, or if the
10497 corresponding pragmas are ignored or disabled.
10499 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10500 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{183}
10501 @section Attribute Machine_Size
10504 @geindex Machine_Size
10506 This attribute is identical to the @cite{Object_Size} attribute.  It is
10507 provided for compatibility with the DEC Ada 83 attribute of this name.
10509 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10510 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{184}
10511 @section Attribute Mantissa
10514 @geindex Ada 83 attributes
10516 @geindex Mantissa
10518 The @cite{Mantissa} attribute is provided for compatibility with Ada 83.  See
10519 the Ada 83 reference manual for an exact description of the semantics of
10520 this attribute.
10522 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10523 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{185}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{186}
10524 @section Attribute Maximum_Alignment
10527 @geindex Alignment
10528 @geindex maximum
10530 @geindex Maximum_Alignment
10532 @cite{Standard'Maximum_Alignment} (@cite{Standard} is the only
10533 permissible prefix) provides the maximum useful alignment value for the
10534 target.  This is a static value that can be used to specify the alignment
10535 for an object, guaranteeing that it is properly aligned in all
10536 cases.
10538 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10539 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{187}
10540 @section Attribute Mechanism_Code
10543 @geindex Return values
10544 @geindex passing mechanism
10546 @geindex Parameters
10547 @geindex passing mechanism
10549 @geindex Mechanism_Code
10551 @code{function'Mechanism_Code} yields an integer code for the
10552 mechanism used for the result of function, and
10553 @code{subprogram'Mechanism_Code (n)} yields the mechanism
10554 used for formal parameter number @cite{n} (a static integer value with 1
10555 meaning the first parameter) of @cite{subprogram}.  The code returned is:
10558 @table @asis
10560 @item @emph{1}
10562 by copy (value)
10564 @item @emph{2}
10566 by reference
10567 @end table
10569 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
10570 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{188}
10571 @section Attribute Null_Parameter
10574 @geindex Zero address
10575 @geindex passing
10577 @geindex Null_Parameter
10579 A reference @code{T'Null_Parameter} denotes an imaginary object of
10580 type or subtype @cite{T} allocated at machine address zero.  The attribute
10581 is allowed only as the default expression of a formal parameter, or as
10582 an actual expression of a subprogram call.  In either case, the
10583 subprogram must be imported.
10585 The identity of the object is represented by the address zero in the
10586 argument list, independent of the passing mechanism (explicit or
10587 default).
10589 This capability is needed to specify that a zero address should be
10590 passed for a record or other composite object passed by reference.
10591 There is no way of indicating this without the @cite{Null_Parameter}
10592 attribute.
10594 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10595 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{13b}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{189}
10596 @section Attribute Object_Size
10599 @geindex Size
10600 @geindex used for objects
10602 @geindex Object_Size
10604 The size of an object is not necessarily the same as the size of the type
10605 of an object.  This is because by default object sizes are increased to be
10606 a multiple of the alignment of the object.  For example,
10607 @cite{Natural'Size} is
10608 31, but by default objects of type @cite{Natural} will have a size of 32 bits.
10609 Similarly, a record containing an integer and a character:
10611 @example
10612 type Rec is record
10613    I : Integer;
10614    C : Character;
10615 end record;
10616 @end example
10618 will have a size of 40 (that is @cite{Rec'Size} will be 40).  The
10619 alignment will be 4, because of the
10620 integer field, and so the default size of record objects for this type
10621 will be 64 (8 bytes).
10623 If the alignment of the above record is specified to be 1, then the
10624 object size will be 40 (5 bytes). This is true by default, and also
10625 an object size of 40 can be explicitly specified in this case.
10627 A consequence of this capability is that different object sizes can be
10628 given to subtypes that would otherwise be considered in Ada to be
10629 statically matching.  But it makes no sense to consider such subtypes
10630 as statically matching.  Consequently, in @cite{GNAT} we add a rule
10631 to the static matching rules that requires object sizes to match.
10632 Consider this example:
10634 @example
10635  1. procedure BadAVConvert is
10636  2.    type R is new Integer;
10637  3.    subtype R1 is R range 1 .. 10;
10638  4.    subtype R2 is R range 1 .. 10;
10639  5.    for R1'Object_Size use 8;
10640  6.    for R2'Object_Size use 16;
10641  7.    type R1P is access all R1;
10642  8.    type R2P is access all R2;
10643  9.    R1PV : R1P := new R1'(4);
10644 10.    R2PV : R2P;
10645 11. begin
10646 12.    R2PV := R2P (R1PV);
10647                |
10648        >>> target designated subtype not compatible with
10649            type "R1" defined at line 3
10651 13. end;
10652 @end example
10654 In the absence of lines 5 and 6,
10655 types @cite{R1} and @cite{R2} statically match and
10656 hence the conversion on line 12 is legal. But since lines 5 and 6
10657 cause the object sizes to differ, @cite{GNAT} considers that types
10658 @cite{R1} and @cite{R2} are not statically matching, and line 12
10659 generates the diagnostic shown above.
10661 Similar additional checks are performed in other contexts requiring
10662 statically matching subtypes.
10664 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
10665 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{18a}
10666 @section Attribute Old
10669 @geindex Old
10671 In addition to the usage of @cite{Old} defined in the Ada 2012 RM (usage
10672 within @cite{Post} aspect), GNAT also permits the use of this attribute
10673 in implementation defined pragmas @cite{Postcondition},
10674 @cite{Contract_Cases} and @cite{Test_Case}. Also usages of
10675 @cite{Old} which would be illegal according to the Ada 2012 RM
10676 definition are allowed under control of
10677 implementation defined pragma @cite{Unevaluated_Use_Of_Old}.
10679 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
10680 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{18b}
10681 @section Attribute Passed_By_Reference
10684 @geindex Parameters
10685 @geindex when passed by reference
10687 @geindex Passed_By_Reference
10689 @code{type'Passed_By_Reference} for any subtype @cite{type} returns
10690 a value of type @cite{Boolean} value that is @cite{True} if the type is
10691 normally passed by reference and @cite{False} if the type is normally
10692 passed by copy in calls.  For scalar types, the result is always @cite{False}
10693 and is static.  For non-scalar types, the result is nonstatic.
10695 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
10696 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{18c}
10697 @section Attribute Pool_Address
10700 @geindex Parameters
10701 @geindex when passed by reference
10703 @geindex Pool_Address
10705 @code{X'Pool_Address} for any object @cite{X} returns the address
10706 of X within its storage pool. This is the same as
10707 @code{X'Address}, except that for an unconstrained array whose
10708 bounds are allocated just before the first component,
10709 @code{X'Pool_Address} returns the address of those bounds,
10710 whereas @code{X'Address} returns the address of the first
10711 component.
10713 Here, we are interpreting 'storage pool' broadly to mean
10714 @code{wherever the object is allocated}, which could be a
10715 user-defined storage pool,
10716 the global heap, on the stack, or in a static memory area.
10717 For an object created by @cite{new}, @code{Ptr.all'Pool_Address} is
10718 what is passed to @cite{Allocate} and returned from @cite{Deallocate}.
10720 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
10721 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{18d}
10722 @section Attribute Range_Length
10725 @geindex Range_Length
10727 @code{type'Range_Length} for any discrete type @cite{type} yields
10728 the number of values represented by the subtype (zero for a null
10729 range).  The result is static for static subtypes.  @cite{Range_Length}
10730 applied to the index subtype of a one dimensional array always gives the
10731 same result as @cite{Length} applied to the array itself.
10733 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
10734 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{18e}
10735 @section Attribute Restriction_Set
10738 @geindex Restriction_Set
10740 @geindex Restrictions
10742 This attribute allows compile time testing of restrictions that
10743 are currently in effect. It is primarily intended for specializing
10744 code in the run-time based on restrictions that are active (e.g.
10745 don't need to save fpt registers if restriction No_Floating_Point
10746 is known to be in effect), but can be used anywhere.
10748 There are two forms:
10750 @example
10751 System'Restriction_Set (partition_boolean_restriction_NAME)
10752 System'Restriction_Set (No_Dependence => library_unit_NAME);
10753 @end example
10755 In the case of the first form, the only restriction names
10756 allowed are parameterless restrictions that are checked
10757 for consistency at bind time. For a complete list see the
10758 subtype @cite{System.Rident.Partition_Boolean_Restrictions}.
10760 The result returned is True if the restriction is known to
10761 be in effect, and False if the restriction is known not to
10762 be in effect. An important guarantee is that the value of
10763 a Restriction_Set attribute is known to be consistent throughout
10764 all the code of a partition.
10766 This is trivially achieved if the entire partition is compiled
10767 with a consistent set of restriction pragmas. However, the
10768 compilation model does not require this. It is possible to
10769 compile one set of units with one set of pragmas, and another
10770 set of units with another set of pragmas. It is even possible
10771 to compile a spec with one set of pragmas, and then WITH the
10772 same spec with a different set of pragmas. Inconsistencies
10773 in the actual use of the restriction are checked at bind time.
10775 In order to achieve the guarantee of consistency for the
10776 Restriction_Set pragma, we consider that a use of the pragma
10777 that yields False is equivalent to a violation of the
10778 restriction.
10780 So for example if you write
10782 @example
10783 if System'Restriction_Set (No_Floating_Point) then
10784    ...
10785 else
10786    ...
10787 end if;
10788 @end example
10790 And the result is False, so that the else branch is executed,
10791 you can assume that this restriction is not set for any unit
10792 in the partition. This is checked by considering this use of
10793 the restriction pragma to be a violation of the restriction
10794 No_Floating_Point. This means that no other unit can attempt
10795 to set this restriction (if some unit does attempt to set it,
10796 the binder will refuse to bind the partition).
10798 Technical note: The restriction name and the unit name are
10799 intepreted entirely syntactically, as in the corresponding
10800 Restrictions pragma, they are not analyzed semantically,
10801 so they do not have a type.
10803 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
10804 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{18f}
10805 @section Attribute Result
10808 @geindex Result
10810 @code{function'Result} can only be used with in a Postcondition pragma
10811 for a function. The prefix must be the name of the corresponding function. This
10812 is used to refer to the result of the function in the postcondition expression.
10813 For a further discussion of the use of this attribute and examples of its use,
10814 see the description of pragma Postcondition.
10816 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
10817 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{190}
10818 @section Attribute Safe_Emax
10821 @geindex Ada 83 attributes
10823 @geindex Safe_Emax
10825 The @cite{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
10826 the Ada 83 reference manual for an exact description of the semantics of
10827 this attribute.
10829 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
10830 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{191}
10831 @section Attribute Safe_Large
10834 @geindex Ada 83 attributes
10836 @geindex Safe_Large
10838 The @cite{Safe_Large} attribute is provided for compatibility with Ada 83.  See
10839 the Ada 83 reference manual for an exact description of the semantics of
10840 this attribute.
10842 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
10843 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{192}
10844 @section Attribute Safe_Small
10847 @geindex Ada 83 attributes
10849 @geindex Safe_Small
10851 The @cite{Safe_Small} attribute is provided for compatibility with Ada 83.  See
10852 the Ada 83 reference manual for an exact description of the semantics of
10853 this attribute.
10855 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
10856 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{193}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{148}
10857 @section Attribute Scalar_Storage_Order
10860 @geindex Endianness
10862 @geindex Scalar storage order
10864 @geindex Scalar_Storage_Order
10866 For every array or record type @cite{S}, the representation attribute
10867 @cite{Scalar_Storage_Order} denotes the order in which storage elements
10868 that make up scalar components are ordered within S. The value given must
10869 be a static expression of type System.Bit_Order. The following is an example
10870 of the use of this feature:
10872 @example
10873 --  Component type definitions
10875 subtype Yr_Type is Natural range 0 .. 127;
10876 subtype Mo_Type is Natural range 1 .. 12;
10877 subtype Da_Type is Natural range 1 .. 31;
10879 --  Record declaration
10881 type Date is record
10882    Years_Since_1980 : Yr_Type;
10883    Month            : Mo_Type;
10884    Day_Of_Month     : Da_Type;
10885 end record;
10887 --  Record representation clause
10889 for Date use record
10890    Years_Since_1980 at 0 range 0  ..  6;
10891    Month            at 0 range 7  .. 10;
10892    Day_Of_Month     at 0 range 11 .. 15;
10893 end record;
10895 --  Attribute definition clauses
10897 for Date'Bit_Order use System.High_Order_First;
10898 for Date'Scalar_Storage_Order use System.High_Order_First;
10899 --  If Scalar_Storage_Order is specified, it must be consistent with
10900 --  Bit_Order, so it's best to always define the latter explicitly if
10901 --  the former is used.
10902 @end example
10904 Other properties are as for standard representation attribute @cite{Bit_Order},
10905 as defined by Ada RM 13.5.3(4). The default is @cite{System.Default_Bit_Order}.
10907 For a record type @cite{T}, if @code{T'Scalar_Storage_Order} is
10908 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
10909 this means that if a @cite{Scalar_Storage_Order} attribute definition
10910 clause is not confirming, then the type's @cite{Bit_Order} shall be
10911 specified explicitly and set to the same value.
10913 Derived types inherit an explicitly set scalar storage order from their parent
10914 types. This may be overridden for the derived type by giving an explicit scalar
10915 storage order for the derived type. For a record extension, the derived type
10916 must have the same scalar storage order as the parent type.
10918 A component of a record or array type that is a bit-packed array, or that
10919 does not start on a byte boundary, must have the same scalar storage order
10920 as the enclosing record or array type.
10922 No component of a type that has an explicit @cite{Scalar_Storage_Order}
10923 attribute definition may be aliased.
10925 A confirming @cite{Scalar_Storage_Order} attribute definition clause (i.e.
10926 with a value equal to @cite{System.Default_Bit_Order}) has no effect.
10928 If the opposite storage order is specified, then whenever the value of
10929 a scalar component of an object of type @cite{S} is read, the storage
10930 elements of the enclosing machine scalar are first reversed (before
10931 retrieving the component value, possibly applying some shift and mask
10932 operatings on the enclosing machine scalar), and the opposite operation
10933 is done for writes.
10935 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
10936 are relaxed. Instead, the following rules apply:
10939 @itemize *
10941 @item 
10942 the underlying storage elements are those at positions
10943 @cite{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
10945 @item 
10946 the sequence of underlying storage elements shall have
10947 a size no greater than the largest machine scalar
10949 @item 
10950 the enclosing machine scalar is defined as the smallest machine
10951 scalar starting at a position no greater than
10952 @cite{position + first_bit / storage_element_size} and covering
10953 storage elements at least up to @cite{position + (last_bit + storage_element_size - 1) / storage_element_size}
10955 @item 
10956 the position of the component is interpreted relative to that machine
10957 scalar.
10958 @end itemize
10960 If no scalar storage order is specified for a type (either directly, or by
10961 inheritance in the case of a derived type), then the default is normally
10962 the native ordering of the target, but this default can be overridden using
10963 pragma @cite{Default_Scalar_Storage_Order}.
10965 Note that if a component of @cite{T} is itself of a record or array type,
10966 the specfied @cite{Scalar_Storage_Order} does @emph{not} apply to that nested type:
10967 an explicit attribute definition clause must be provided for the component
10968 type as well if desired.
10970 Note that the scalar storage order only affects the in-memory data
10971 representation. It has no effect on the representation used by stream
10972 attributes.
10974 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
10975 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e0}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{194}
10976 @section Attribute Simple_Storage_Pool
10979 @geindex Storage pool
10980 @geindex simple
10982 @geindex Simple storage pool
10984 @geindex Simple_Storage_Pool
10986 For every nonformal, nonderived access-to-object type @cite{Acc}, the
10987 representation attribute @cite{Simple_Storage_Pool} may be specified
10988 via an attribute_definition_clause (or by specifying the equivalent aspect):
10990 @example
10991 My_Pool : My_Simple_Storage_Pool_Type;
10993 type Acc is access My_Data_Type;
10995 for Acc'Simple_Storage_Pool use My_Pool;
10996 @end example
10998 The name given in an attribute_definition_clause for the
10999 @cite{Simple_Storage_Pool} attribute shall denote a variable of
11000 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
11002 The use of this attribute is only allowed for a prefix denoting a type
11003 for which it has been specified. The type of the attribute is the type
11004 of the variable specified as the simple storage pool of the access type,
11005 and the attribute denotes that variable.
11007 It is illegal to specify both @cite{Storage_Pool} and @cite{Simple_Storage_Pool}
11008 for the same access type.
11010 If the @cite{Simple_Storage_Pool} attribute has been specified for an access
11011 type, then applying the @cite{Storage_Pool} attribute to the type is flagged
11012 with a warning and its evaluation raises the exception @cite{Program_Error}.
11014 If the Simple_Storage_Pool attribute has been specified for an access
11015 type @cite{S}, then the evaluation of the attribute @code{S'Storage_Size}
11016 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11017 which is intended to indicate the number of storage elements reserved for
11018 the simple storage pool. If the Storage_Size function has not been defined
11019 for the simple storage pool type, then this attribute returns zero.
11021 If an access type @cite{S} has a specified simple storage pool of type
11022 @cite{SSP}, then the evaluation of an allocator for that access type calls
11023 the primitive @cite{Allocate} procedure for type @cite{SSP}, passing
11024 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11025 semantics of such allocators is the same as those defined for allocators
11026 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11027 @cite{simple storage pool} substituted for @cite{storage pool}.
11029 If an access type @cite{S} has a specified simple storage pool of type
11030 @cite{SSP}, then a call to an instance of the @cite{Ada.Unchecked_Deallocation}
11031 for that access type invokes the primitive @cite{Deallocate} procedure
11032 for type @cite{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11033 parameter. The detailed semantics of such unchecked deallocations is the same
11034 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11035 term 'simple storage pool' is substituted for 'storage pool'.
11037 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11038 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{195}
11039 @section Attribute Small
11042 @geindex Ada 83 attributes
11044 @geindex Small
11046 The @cite{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11047 fixed-point types.
11048 GNAT also allows this attribute to be applied to floating-point types
11049 for compatibility with Ada 83.  See
11050 the Ada 83 reference manual for an exact description of the semantics of
11051 this attribute when applied to floating-point types.
11053 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
11054 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{196}
11055 @section Attribute Storage_Unit
11058 @geindex Storage_Unit
11060 @cite{Standard'Storage_Unit} (@cite{Standard} is the only permissible
11061 prefix) provides the same value as @cite{System.Storage_Unit}.
11063 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11064 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{197}
11065 @section Attribute Stub_Type
11068 @geindex Stub_Type
11070 The GNAT implementation of remote access-to-classwide types is
11071 organized as described in AARM section E.4 (20.t): a value of an RACW type
11072 (designating a remote object) is represented as a normal access
11073 value, pointing to a "stub" object which in turn contains the
11074 necessary information to contact the designated remote object. A
11075 call on any dispatching operation of such a stub object does the
11076 remote call, if necessary, using the information in the stub object
11077 to locate the target partition, etc.
11079 For a prefix @cite{T} that denotes a remote access-to-classwide type,
11080 @cite{T'Stub_Type} denotes the type of the corresponding stub objects.
11082 By construction, the layout of @cite{T'Stub_Type} is identical to that of
11083 type @cite{RACW_Stub_Type} declared in the internal implementation-defined
11084 unit @cite{System.Partition_Interface}. Use of this attribute will create
11085 an implicit dependency on this unit.
11087 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11088 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{198}
11089 @section Attribute System_Allocator_Alignment
11092 @geindex Alignment
11093 @geindex allocator
11095 @geindex System_Allocator_Alignment
11097 @cite{Standard'System_Allocator_Alignment} (@cite{Standard} is the only
11098 permissible prefix) provides the observable guaranted to be honored by
11099 the system allocator (malloc). This is a static value that can be used
11100 in user storage pools based on malloc either to reject allocation
11101 with alignment too large or to enable a realignment circuitry if the
11102 alignment request is larger than this value.
11104 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11105 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{199}
11106 @section Attribute Target_Name
11109 @geindex Target_Name
11111 @cite{Standard'Target_Name} (@cite{Standard} is the only permissible
11112 prefix) provides a static string value that identifies the target
11113 for the current compilation. For GCC implementations, this is the
11114 standard gcc target name without the terminating slash (for
11115 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
11117 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11118 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{19a}
11119 @section Attribute To_Address
11122 @geindex To_Address
11124 The @cite{System'To_Address}
11125 (@cite{System} is the only permissible prefix)
11126 denotes a function identical to
11127 @cite{System.Storage_Elements.To_Address} except that
11128 it is a static attribute.  This means that if its argument is
11129 a static expression, then the result of the attribute is a
11130 static expression.  This means that such an expression can be
11131 used in contexts (e.g., preelaborable packages) which require a
11132 static expression and where the function call could not be used
11133 (since the function call is always nonstatic, even if its
11134 argument is static). The argument must be in the range
11135 -(2**(m-1)) .. 2**m-1, where m is the memory size
11136 (typically 32 or 64). Negative values are intepreted in a
11137 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11138 a 32 bits machine).
11140 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11141 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{19b}
11142 @section Attribute To_Any
11145 @geindex To_Any
11147 This internal attribute is used for the generation of remote subprogram
11148 stubs in the context of the Distributed Systems Annex.
11150 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11151 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{19c}
11152 @section Attribute Type_Class
11155 @geindex Type_Class
11157 @code{type'Type_Class} for any type or subtype @cite{type} yields
11158 the value of the type class for the full type of @cite{type}.  If
11159 @cite{type} is a generic formal type, the value is the value for the
11160 corresponding actual subtype.  The value of this attribute is of type
11161 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11163 @example
11164 type Type_Class is
11165   (Type_Class_Enumeration,
11166    Type_Class_Integer,
11167    Type_Class_Fixed_Point,
11168    Type_Class_Floating_Point,
11169    Type_Class_Array,
11170    Type_Class_Record,
11171    Type_Class_Access,
11172    Type_Class_Task,
11173    Type_Class_Address);
11174 @end example
11176 Protected types yield the value @cite{Type_Class_Task}, which thus
11177 applies to all concurrent types.  This attribute is designed to
11178 be compatible with the DEC Ada 83 attribute of the same name.
11180 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11181 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{19d}
11182 @section Attribute Type_Key
11185 @geindex Type_Key
11187 The @cite{Type_Key} attribute is applicable to a type or subtype and
11188 yields a value of type Standard.String containing encoded information
11189 about the type or subtype. This provides improved compatibility with
11190 other implementations that support this attribute.
11192 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11193 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{19e}
11194 @section Attribute TypeCode
11197 @geindex TypeCode
11199 This internal attribute is used for the generation of remote subprogram
11200 stubs in the context of the Distributed Systems Annex.
11202 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11203 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{19f}
11204 @section Attribute Unconstrained_Array
11207 @geindex Unconstrained_Array
11209 The @cite{Unconstrained_Array} attribute can be used with a prefix that
11210 denotes any type or subtype. It is a static attribute that yields
11211 @cite{True} if the prefix designates an unconstrained array,
11212 and @cite{False} otherwise. In a generic instance, the result is
11213 still static, and yields the result of applying this test to the
11214 generic actual.
11216 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11217 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1a0}
11218 @section Attribute Universal_Literal_String
11221 @geindex Named numbers
11222 @geindex representation of
11224 @geindex Universal_Literal_String
11226 The prefix of @cite{Universal_Literal_String} must be a named
11227 number.  The static result is the string consisting of the characters of
11228 the number as defined in the original source.  This allows the user
11229 program to access the actual text of named numbers without intermediate
11230 conversions and without the need to enclose the strings in quotes (which
11231 would preclude their use as numbers).
11233 For example, the following program prints the first 50 digits of pi:
11235 @example
11236 with Text_IO; use Text_IO;
11237 with Ada.Numerics;
11238 procedure Pi is
11239 begin
11240    Put (Ada.Numerics.Pi'Universal_Literal_String);
11241 end;
11242 @end example
11244 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11245 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1a1}
11246 @section Attribute Unrestricted_Access
11249 @geindex Access
11250 @geindex unrestricted
11252 @geindex Unrestricted_Access
11254 The @cite{Unrestricted_Access} attribute is similar to @cite{Access}
11255 except that all accessibility and aliased view checks are omitted.  This
11256 is a user-beware attribute.
11258 For objects, it is similar to @cite{Address}, for which it is a
11259 desirable replacement where the value desired is an access type.
11260 In other words, its effect is similar to first applying the
11261 @cite{Address} attribute and then doing an unchecked conversion to a
11262 desired access type.
11264 For subprograms, @cite{P'Unrestricted_Access} may be used where
11265 @cite{P'Access} would be illegal, to construct a value of a
11266 less-nested named access type that designates a more-nested
11267 subprogram. This value may be used in indirect calls, so long as the
11268 more-nested subprogram still exists; once the subprogram containing it
11269 has returned, such calls are erroneous. For example:
11271 @example
11272 package body P is
11274    type Less_Nested is not null access procedure;
11275    Global : Less_Nested;
11277    procedure P1 is
11278    begin
11279       Global.all;
11280    end P1;
11282    procedure P2 is
11283       Local_Var : Integer;
11285       procedure More_Nested is
11286       begin
11287          ... Local_Var ...
11288       end More_Nested;
11289    begin
11290       Global := More_Nested'Unrestricted_Access;
11291       P1;
11292    end P2;
11294 end P;
11295 @end example
11297 When P1 is called from P2, the call via Global is OK, but if P1 were
11298 called after P2 returns, it would be an erroneous use of a dangling
11299 pointer.
11301 For objects, it is possible to use @cite{Unrestricted_Access} for any
11302 type. However, if the result is of an access-to-unconstrained array
11303 subtype, then the resulting pointer has the same scope as the context
11304 of the attribute, and must not be returned to some enclosing scope.
11305 For instance, if a function uses @cite{Unrestricted_Access} to create
11306 an access-to-unconstrained-array and returns that value to the caller,
11307 the result will involve dangling pointers. In addition, it is only
11308 valid to create pointers to unconstrained arrays using this attribute
11309 if the pointer has the normal default 'fat' representation where a
11310 pointer has two components, one points to the array and one points to
11311 the bounds. If a size clause is used to force 'thin' representation
11312 for a pointer to unconstrained where there is only space for a single
11313 pointer, then the resulting pointer is not usable.
11315 In the simple case where a direct use of Unrestricted_Access attempts
11316 to make a thin pointer for a non-aliased object, the compiler will
11317 reject the use as illegal, as shown in the following example:
11319 @example
11320 with System; use System;
11321 procedure SliceUA2 is
11322    type A is access all String;
11323    for A'Size use Standard'Address_Size;
11325    procedure P (Arg : A) is
11326    begin
11327       null;
11328    end P;
11330    X : String := "hello world!";
11331    X2 : aliased String := "hello world!";
11333    AV : A := X'Unrestricted_Access;    -- ERROR
11334              |
11335 >>> illegal use of Unrestricted_Access attribute
11336 >>> attempt to generate thin pointer to unaliased object
11338 begin
11339    P (X'Unrestricted_Access);          -- ERROR
11340       |
11341 >>> illegal use of Unrestricted_Access attribute
11342 >>> attempt to generate thin pointer to unaliased object
11344    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11345       |
11346 >>> illegal use of Unrestricted_Access attribute
11347 >>> attempt to generate thin pointer to unaliased object
11349    P (X2'Unrestricted_Access);         -- OK
11350 end;
11351 @end example
11353 but other cases cannot be detected by the compiler, and are
11354 considered to be erroneous. Consider the following example:
11356 @example
11357 with System; use System;
11358 with System; use System;
11359 procedure SliceUA is
11360    type AF is access all String;
11362    type A is access all String;
11363    for A'Size use Standard'Address_Size;
11365    procedure P (Arg : A) is
11366    begin
11367       if Arg'Length /= 6 then
11368          raise Program_Error;
11369       end if;
11370    end P;
11372    X : String := "hello world!";
11373    Y : AF := X (7 .. 12)'Unrestricted_Access;
11375 begin
11376    P (A (Y));
11377 end;
11378 @end example
11380 A normal unconstrained array value
11381 or a constrained array object marked as aliased has the bounds in memory
11382 just before the array, so a thin pointer can retrieve both the data and
11383 the bounds.  But in this case, the non-aliased object @cite{X} does not have the
11384 bounds before the string.  If the size clause for type @cite{A}
11385 were not present, then the pointer
11386 would be a fat pointer, where one component is a pointer to the bounds,
11387 and all would be well.  But with the size clause present, the conversion from
11388 fat pointer to thin pointer in the call loses the bounds, and so this
11389 is erroneous, and the program likely raises a @cite{Program_Error} exception.
11391 In general, it is advisable to completely
11392 avoid mixing the use of thin pointers and the use of
11393 @cite{Unrestricted_Access} where the designated type is an
11394 unconstrained array.  The use of thin pointers should be restricted to
11395 cases of porting legacy code that implicitly assumes the size of pointers,
11396 and such code should not in any case be using this attribute.
11398 Another erroneous situation arises if the attribute is
11399 applied to a constant. The resulting pointer can be used to access the
11400 constant, but the effect of trying to modify a constant in this manner
11401 is not well-defined. Consider this example:
11403 @example
11404 P : constant Integer := 4;
11405 type R is access all Integer;
11406 RV : R := P'Unrestricted_Access;
11408 RV.all := 3;
11409 @end example
11411 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11412 or may not notice this attempt, and subsequent references to P may yield
11413 either the value 3 or the value 4 or the assignment may blow up if the
11414 compiler decides to put P in read-only memory. One particular case where
11415 @cite{Unrestricted_Access} can be used in this way is to modify the
11416 value of an @cite{IN} parameter:
11418 @example
11419 procedure K (S : in String) is
11420    type R is access all Character;
11421    RV : R := S (3)'Unrestricted_Access;
11422 begin
11423    RV.all := 'a';
11424 end;
11425 @end example
11427 In general this is a risky approach. It may appear to "work" but such uses of
11428 @cite{Unrestricted_Access} are potentially non-portable, even from one version
11429 of @cite{GNAT} to another, so are best avoided if possible.
11431 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11432 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1a2}
11433 @section Attribute Update
11436 @geindex Update
11438 The @cite{Update} attribute creates a copy of an array or record value
11439 with one or more modified components. The syntax is:
11441 @example
11442 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11443 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11444 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11445                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11447 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11448 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11449 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
11450 @end example
11452 where @cite{PREFIX} is the name of an array or record object, the
11453 association list in parentheses does not contain an @cite{others}
11454 choice and the box symbol @cite{<>} may not appear in any
11455 expression. The effect is to yield a copy of the array or record value
11456 which is unchanged apart from the components mentioned in the
11457 association list, which are changed to the indicated value. The
11458 original value of the array or record value is not affected. For
11459 example:
11461 @example
11462 type Arr is Array (1 .. 5) of Integer;
11464 Avar1 : Arr := (1,2,3,4,5);
11465 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11466 @end example
11468 yields a value for @cite{Avar2} of 1,10,20,20,5 with @cite{Avar1}
11469 begin unmodified. Similarly:
11471 @example
11472 type Rec is A, B, C : Integer;
11474 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11475 Rvar2 : Rec := Rvar1'Update (B => 20);
11476 @end example
11478 yields a value for @cite{Rvar2} of (A => 1, B => 20, C => 3),
11479 with @cite{Rvar1} being unmodifed.
11480 Note that the value of the attribute reference is computed
11481 completely before it is used. This means that if you write:
11483 @example
11484 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11485 @end example
11487 then the value of @cite{Avar1} is not modified if @cite{Function_Call}
11488 raises an exception, unlike the effect of a series of direct assignments
11489 to elements of @cite{Avar1}. In general this requires that
11490 two extra complete copies of the object are required, which should be
11491 kept in mind when considering efficiency.
11493 The @cite{Update} attribute cannot be applied to prefixes of a limited
11494 type, and cannot reference discriminants in the case of a record type.
11495 The accessibility level of an Update attribute result object is defined
11496 as for an aggregate.
11498 In the record case, no component can be mentioned more than once. In
11499 the array case, two overlapping ranges can appear in the association list,
11500 in which case the modifications are processed left to right.
11502 Multi-dimensional arrays can be modified, as shown by this example:
11504 @example
11505 A : array (1 .. 10, 1 .. 10) of Integer;
11507 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11508 @end example
11510 which changes element (1,2) to 20 and (3,4) to 30.
11512 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11513 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1a3}
11514 @section Attribute Valid_Scalars
11517 @geindex Valid_Scalars
11519 The @cite{'Valid_Scalars} attribute is intended to make it easier to
11520 check the validity of scalar subcomponents of composite objects. It
11521 is defined for any prefix @cite{X} that denotes an object.
11522 The value of this attribute is of the predefined type Boolean.
11523 @cite{X'Valid_Scalars} yields True if and only if evaluation of
11524 @cite{P'Valid} yields True for every scalar part P of X or if X has
11525 no scalar parts. It is not specified in what order the scalar parts
11526 are checked, nor whether any more are checked after any one of them
11527 is determined to be invalid. If the prefix @cite{X} is of a class-wide
11528 type @cite{T'Class} (where @cite{T} is the associated specific type),
11529 or if the prefix @cite{X} is of a specific tagged type @cite{T}, then
11530 only the scalar parts of components of @cite{T} are traversed; in other
11531 words, components of extensions of @cite{T} are not traversed even if
11532 @cite{T'Class (X)'Tag /= T'Tag} . The compiler will issue a warning if it can
11533 be determined at compile time that the prefix of the attribute has no
11534 scalar parts (e.g., if the prefix is of an access type, an interface type,
11535 an undiscriminated task type, or an undiscriminated protected type).
11537 For scalar types, @cite{Valid_Scalars} is equivalent to @cite{Valid}. The use
11538 of this attribute is not permitted for @cite{Unchecked_Union} types for which
11539 in general it is not possible to determine the values of the discriminants.
11541 Note: @cite{Valid_Scalars} can generate a lot of code, especially in the case
11542 of a large variant record. If the attribute is called in many places in the
11543 same program applied to objects of the same type, it can reduce program size
11544 to write a function with a single use of the attribute, and then call that
11545 function from multiple places.
11547 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11548 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1a4}
11549 @section Attribute VADS_Size
11552 @geindex Size
11553 @geindex VADS compatibility
11555 @geindex VADS_Size
11557 The @cite{'VADS_Size} attribute is intended to make it easier to port
11558 legacy code which relies on the semantics of @cite{'Size} as implemented
11559 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
11560 same semantic interpretation.  In particular, @cite{'VADS_Size} applied
11561 to a predefined or other primitive type with no Size clause yields the
11562 Object_Size (for example, @cite{Natural'Size} is 32 rather than 31 on
11563 typical machines).  In addition @cite{'VADS_Size} applied to an object
11564 gives the result that would be obtained by applying the attribute to
11565 the corresponding type.
11567 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11568 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1a5}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{157}
11569 @section Attribute Value_Size
11572 @geindex Size
11573 @geindex setting for not-first subtype
11575 @geindex Value_Size
11577 @code{type'Value_Size} is the number of bits required to represent
11578 a value of the given subtype.  It is the same as @code{type'Size},
11579 but, unlike @cite{Size}, may be set for non-first subtypes.
11581 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11582 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1a6}
11583 @section Attribute Wchar_T_Size
11586 @geindex Wchar_T_Size
11588 @cite{Standard'Wchar_T_Size} (@cite{Standard} is the only permissible
11589 prefix) provides the size in bits of the C @cite{wchar_t} type
11590 primarily for constructing the definition of this type in
11591 package @cite{Interfaces.C}. The result is a static constant.
11593 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
11594 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1a7}
11595 @section Attribute Word_Size
11598 @geindex Word_Size
11600 @cite{Standard'Word_Size} (@cite{Standard} is the only permissible
11601 prefix) provides the value @cite{System.Word_Size}. The result is
11602 a static constant.
11604 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
11605 @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{1a8}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1a9}
11606 @chapter Standard and Implementation Defined Restrictions
11609 All Ada Reference Manual-defined Restriction identifiers are implemented:
11612 @itemize *
11614 @item 
11615 language-defined restrictions (see 13.12.1)
11617 @item 
11618 tasking restrictions (see D.7)
11620 @item 
11621 high integrity restrictions (see H.4)
11622 @end itemize
11624 GNAT implements additional restriction identifiers. All restrictions, whether
11625 language defined or GNAT-specific, are listed in the following.
11627 @menu
11628 * Partition-Wide Restrictions:: 
11629 * Program Unit Level Restrictions:: 
11631 @end menu
11633 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
11634 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1aa}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1ab}
11635 @section Partition-Wide Restrictions
11638 There are two separate lists of restriction identifiers. The first
11639 set requires consistency throughout a partition (in other words, if the
11640 restriction identifier is used for any compilation unit in the partition,
11641 then all compilation units in the partition must obey the restriction).
11643 @menu
11644 * Immediate_Reclamation:: 
11645 * Max_Asynchronous_Select_Nesting:: 
11646 * Max_Entry_Queue_Length:: 
11647 * Max_Protected_Entries:: 
11648 * Max_Select_Alternatives:: 
11649 * Max_Storage_At_Blocking:: 
11650 * Max_Task_Entries:: 
11651 * Max_Tasks:: 
11652 * No_Abort_Statements:: 
11653 * No_Access_Parameter_Allocators:: 
11654 * No_Access_Subprograms:: 
11655 * No_Allocators:: 
11656 * No_Anonymous_Allocators:: 
11657 * No_Asynchronous_Control:: 
11658 * No_Calendar:: 
11659 * No_Coextensions:: 
11660 * No_Default_Initialization:: 
11661 * No_Delay:: 
11662 * No_Dependence:: 
11663 * No_Direct_Boolean_Operators:: 
11664 * No_Dispatch:: 
11665 * No_Dispatching_Calls:: 
11666 * No_Dynamic_Attachment:: 
11667 * No_Dynamic_Priorities:: 
11668 * No_Entry_Calls_In_Elaboration_Code:: 
11669 * No_Enumeration_Maps:: 
11670 * No_Exception_Handlers:: 
11671 * No_Exception_Propagation:: 
11672 * No_Exception_Registration:: 
11673 * No_Exceptions:: 
11674 * No_Finalization:: 
11675 * No_Fixed_Point:: 
11676 * No_Floating_Point:: 
11677 * No_Implicit_Conditionals:: 
11678 * No_Implicit_Dynamic_Code:: 
11679 * No_Implicit_Heap_Allocations:: 
11680 * No_Implicit_Protected_Object_Allocations:: 
11681 * No_Implicit_Task_Allocations:: 
11682 * No_Initialize_Scalars:: 
11683 * No_IO:: 
11684 * No_Local_Allocators:: 
11685 * No_Local_Protected_Objects:: 
11686 * No_Local_Timing_Events:: 
11687 * No_Long_Long_Integers:: 
11688 * No_Multiple_Elaboration:: 
11689 * No_Nested_Finalization:: 
11690 * No_Protected_Type_Allocators:: 
11691 * No_Protected_Types:: 
11692 * No_Recursion:: 
11693 * No_Reentrancy:: 
11694 * No_Relative_Delay:: 
11695 * No_Requeue_Statements:: 
11696 * No_Secondary_Stack:: 
11697 * No_Select_Statements:: 
11698 * No_Specific_Termination_Handlers:: 
11699 * No_Specification_of_Aspect:: 
11700 * No_Standard_Allocators_After_Elaboration:: 
11701 * No_Standard_Storage_Pools:: 
11702 * No_Stream_Optimizations:: 
11703 * No_Streams:: 
11704 * No_Task_Allocators:: 
11705 * No_Task_At_Interrupt_Priority:: 
11706 * No_Task_Attributes_Package:: 
11707 * No_Task_Hierarchy:: 
11708 * No_Task_Termination:: 
11709 * No_Tasking:: 
11710 * No_Terminate_Alternatives:: 
11711 * No_Unchecked_Access:: 
11712 * No_Unchecked_Conversion:: 
11713 * No_Unchecked_Deallocation:: 
11714 * No_Use_Of_Entity:: 
11715 * Pure_Barriers:: 
11716 * Simple_Barriers:: 
11717 * Static_Priorities:: 
11718 * Static_Storage_Size:: 
11720 @end menu
11722 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
11723 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1ac}
11724 @subsection Immediate_Reclamation
11727 @geindex Immediate_Reclamation
11729 [RM H.4] This restriction ensures that, except for storage occupied by
11730 objects created by allocators and not deallocated via unchecked
11731 deallocation, any storage reserved at run time for an object is
11732 immediately reclaimed when the object no longer exists.
11734 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
11735 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1ad}
11736 @subsection Max_Asynchronous_Select_Nesting
11739 @geindex Max_Asynchronous_Select_Nesting
11741 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
11742 selects. Violations of this restriction with a value of zero are
11743 detected at compile time. Violations of this restriction with values
11744 other than zero cause Storage_Error to be raised.
11746 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
11747 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1ae}
11748 @subsection Max_Entry_Queue_Length
11751 @geindex Max_Entry_Queue_Length
11753 [RM D.7] This restriction is a declaration that any protected entry compiled in
11754 the scope of the restriction has at most the specified number of
11755 tasks waiting on the entry at any one time, and so no queue is required.
11756 Note that this restriction is checked at run time. Violation of this
11757 restriction results in the raising of Program_Error exception at the point of
11758 the call.
11760 @geindex Max_Entry_Queue_Depth
11762 The restriction @cite{Max_Entry_Queue_Depth} is recognized as a
11763 synonym for @cite{Max_Entry_Queue_Length}. This is retained for historical
11764 compatibility purposes (and a warning will be generated for its use if
11765 warnings on obsolescent features are activated).
11767 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
11768 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1af}
11769 @subsection Max_Protected_Entries
11772 @geindex Max_Protected_Entries
11774 [RM D.7] Specifies the maximum number of entries per protected type. The
11775 bounds of every entry family of a protected unit shall be static, or shall be
11776 defined by a discriminant of a subtype whose corresponding bound is static.
11778 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
11779 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1b0}
11780 @subsection Max_Select_Alternatives
11783 @geindex Max_Select_Alternatives
11785 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
11787 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
11788 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1b1}
11789 @subsection Max_Storage_At_Blocking
11792 @geindex Max_Storage_At_Blocking
11794 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
11795 Storage_Size that can be retained by a blocked task. A violation of this
11796 restriction causes Storage_Error to be raised.
11798 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
11799 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1b2}
11800 @subsection Max_Task_Entries
11803 @geindex Max_Task_Entries
11805 [RM D.7] Specifies the maximum number of entries
11806 per task.  The bounds of every entry family
11807 of a task unit shall be static, or shall be
11808 defined by a discriminant of a subtype whose
11809 corresponding bound is static.
11811 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
11812 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1b3}
11813 @subsection Max_Tasks
11816 @geindex Max_Tasks
11818 [RM D.7] Specifies the maximum number of task that may be created, not
11819 counting the creation of the environment task.  Violations of this
11820 restriction with a value of zero are detected at compile
11821 time. Violations of this restriction with values other than zero cause
11822 Storage_Error to be raised.
11824 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
11825 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1b4}
11826 @subsection No_Abort_Statements
11829 @geindex No_Abort_Statements
11831 [RM D.7] There are no abort_statements, and there are
11832 no calls to Task_Identification.Abort_Task.
11834 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
11835 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1b5}
11836 @subsection No_Access_Parameter_Allocators
11839 @geindex No_Access_Parameter_Allocators
11841 [RM H.4] This restriction ensures at compile time that there are no
11842 occurrences of an allocator as the actual parameter to an access
11843 parameter.
11845 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
11846 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1b6}
11847 @subsection No_Access_Subprograms
11850 @geindex No_Access_Subprograms
11852 [RM H.4] This restriction ensures at compile time that there are no
11853 declarations of access-to-subprogram types.
11855 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
11856 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1b7}
11857 @subsection No_Allocators
11860 @geindex No_Allocators
11862 [RM H.4] This restriction ensures at compile time that there are no
11863 occurrences of an allocator.
11865 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
11866 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1b8}
11867 @subsection No_Anonymous_Allocators
11870 @geindex No_Anonymous_Allocators
11872 [RM H.4] This restriction ensures at compile time that there are no
11873 occurrences of an allocator of anonymous access type.
11875 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
11876 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1b9}
11877 @subsection No_Asynchronous_Control
11880 @geindex No_Asynchronous_Control
11882 [RM J.13] This restriction ensures at compile time that there are no semantic
11883 dependences on the predefined package Asynchronous_Task_Control.
11885 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
11886 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1ba}
11887 @subsection No_Calendar
11890 @geindex No_Calendar
11892 [GNAT] This restriction ensures at compile time that there are no semantic
11893 dependences on package Calendar.
11895 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
11896 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1bb}
11897 @subsection No_Coextensions
11900 @geindex No_Coextensions
11902 [RM H.4] This restriction ensures at compile time that there are no
11903 coextensions. See 3.10.2.
11905 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
11906 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1bc}
11907 @subsection No_Default_Initialization
11910 @geindex No_Default_Initialization
11912 [GNAT] This restriction prohibits any instance of default initialization
11913 of variables.  The binder implements a consistency rule which prevents
11914 any unit compiled without the restriction from with'ing a unit with the
11915 restriction (this allows the generation of initialization procedures to
11916 be skipped, since you can be sure that no call is ever generated to an
11917 initialization procedure in a unit with the restriction active). If used
11918 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
11919 is to prohibit all cases of variables declared without a specific
11920 initializer (including the case of OUT scalar parameters).
11922 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
11923 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1bd}
11924 @subsection No_Delay
11927 @geindex No_Delay
11929 [RM H.4] This restriction ensures at compile time that there are no
11930 delay statements and no semantic dependences on package Calendar.
11932 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
11933 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1be}
11934 @subsection No_Dependence
11937 @geindex No_Dependence
11939 [RM 13.12.1] This restriction ensures at compile time that there are no
11940 dependences on a library unit.
11942 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
11943 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1bf}
11944 @subsection No_Direct_Boolean_Operators
11947 @geindex No_Direct_Boolean_Operators
11949 [GNAT] This restriction ensures that no logical operators (and/or/xor)
11950 are used on operands of type Boolean (or any type derived from Boolean).
11951 This is intended for use in safety critical programs where the certification
11952 protocol requires the use of short-circuit (and then, or else) forms for all
11953 composite boolean operations.
11955 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
11956 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1c0}
11957 @subsection No_Dispatch
11960 @geindex No_Dispatch
11962 [RM H.4] This restriction ensures at compile time that there are no
11963 occurrences of @cite{T'Class}, for any (tagged) subtype @cite{T}.
11965 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
11966 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1c1}
11967 @subsection No_Dispatching_Calls
11970 @geindex No_Dispatching_Calls
11972 [GNAT] This restriction ensures at compile time that the code generated by the
11973 compiler involves no dispatching calls. The use of this restriction allows the
11974 safe use of record extensions, classwide membership tests and other classwide
11975 features not involving implicit dispatching. This restriction ensures that
11976 the code contains no indirect calls through a dispatching mechanism. Note that
11977 this includes internally-generated calls created by the compiler, for example
11978 in the implementation of class-wide objects assignments. The
11979 membership test is allowed in the presence of this restriction, because its
11980 implementation requires no dispatching.
11981 This restriction is comparable to the official Ada restriction
11982 @cite{No_Dispatch} except that it is a bit less restrictive in that it allows
11983 all classwide constructs that do not imply dispatching.
11984 The following example indicates constructs that violate this restriction.
11986 @example
11987 package Pkg is
11988   type T is tagged record
11989     Data : Natural;
11990   end record;
11991   procedure P (X : T);
11993   type DT is new T with record
11994     More_Data : Natural;
11995   end record;
11996   procedure Q (X : DT);
11997 end Pkg;
11999 with Pkg; use Pkg;
12000 procedure Example is
12001   procedure Test (O : T'Class) is
12002     N : Natural  := O'Size;--  Error: Dispatching call
12003     C : T'Class := O;      --  Error: implicit Dispatching Call
12004   begin
12005     if O in DT'Class then  --  OK   : Membership test
12006        Q (DT (O));         --  OK   : Type conversion plus direct call
12007     else
12008        P (O);              --  Error: Dispatching call
12009     end if;
12010   end Test;
12012   Obj : DT;
12013 begin
12014   P (Obj);                 --  OK   : Direct call
12015   P (T (Obj));             --  OK   : Type conversion plus direct call
12016   P (T'Class (Obj));       --  Error: Dispatching call
12018   Test (Obj);              --  OK   : Type conversion
12020   if Obj in T'Class then   --  OK   : Membership test
12021      null;
12022   end if;
12023 end Example;
12024 @end example
12026 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12027 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1c2}
12028 @subsection No_Dynamic_Attachment
12031 @geindex No_Dynamic_Attachment
12033 [RM D.7] This restriction ensures that there is no call to any of the
12034 operations defined in package Ada.Interrupts
12035 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12036 Detach_Handler, and Reference).
12038 @geindex No_Dynamic_Interrupts
12040 The restriction @cite{No_Dynamic_Interrupts} is recognized as a
12041 synonym for @cite{No_Dynamic_Attachment}. This is retained for historical
12042 compatibility purposes (and a warning will be generated for its use if
12043 warnings on obsolescent features are activated).
12045 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12046 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1c3}
12047 @subsection No_Dynamic_Priorities
12050 @geindex No_Dynamic_Priorities
12052 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12054 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12055 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1c4}
12056 @subsection No_Entry_Calls_In_Elaboration_Code
12059 @geindex No_Entry_Calls_In_Elaboration_Code
12061 [GNAT] This restriction ensures at compile time that no task or protected entry
12062 calls are made during elaboration code.  As a result of the use of this
12063 restriction, the compiler can assume that no code past an accept statement
12064 in a task can be executed at elaboration time.
12066 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12067 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1c5}
12068 @subsection No_Enumeration_Maps
12071 @geindex No_Enumeration_Maps
12073 [GNAT] This restriction ensures at compile time that no operations requiring
12074 enumeration maps are used (that is Image and Value attributes applied
12075 to enumeration types).
12077 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12078 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1c6}
12079 @subsection No_Exception_Handlers
12082 @geindex No_Exception_Handlers
12084 [GNAT] This restriction ensures at compile time that there are no explicit
12085 exception handlers. It also indicates that no exception propagation will
12086 be provided. In this mode, exceptions may be raised but will result in
12087 an immediate call to the last chance handler, a routine that the user
12088 must define with the following profile:
12090 @example
12091 procedure Last_Chance_Handler
12092   (Source_Location : System.Address; Line : Integer);
12093 pragma Export (C, Last_Chance_Handler,
12094                "__gnat_last_chance_handler");
12095 @end example
12097 The parameter is a C null-terminated string representing a message to be
12098 associated with the exception (typically the source location of the raise
12099 statement generated by the compiler). The Line parameter when nonzero
12100 represents the line number in the source program where the raise occurs.
12102 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12103 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1c7}
12104 @subsection No_Exception_Propagation
12107 @geindex No_Exception_Propagation
12109 [GNAT] This restriction guarantees that exceptions are never propagated
12110 to an outer subprogram scope. The only case in which an exception may
12111 be raised is when the handler is statically in the same subprogram, so
12112 that the effect of a raise is essentially like a goto statement. Any
12113 other raise statement (implicit or explicit) will be considered
12114 unhandled. Exception handlers are allowed, but may not contain an
12115 exception occurrence identifier (exception choice). In addition, use of
12116 the package GNAT.Current_Exception is not permitted, and reraise
12117 statements (raise with no operand) are not permitted.
12119 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12120 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1c8}
12121 @subsection No_Exception_Registration
12124 @geindex No_Exception_Registration
12126 [GNAT] This restriction ensures at compile time that no stream operations for
12127 types Exception_Id or Exception_Occurrence are used. This also makes it
12128 impossible to pass exceptions to or from a partition with this restriction
12129 in a distributed environment. If this restriction is active, the generated
12130 code is simplified by omitting the otherwise-required global registration
12131 of exceptions when they are declared.
12133 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12134 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1c9}
12135 @subsection No_Exceptions
12138 @geindex No_Exceptions
12140 [RM H.4] This restriction ensures at compile time that there are no
12141 raise statements and no exception handlers.
12143 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12144 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1ca}
12145 @subsection No_Finalization
12148 @geindex No_Finalization
12150 [GNAT] This restriction disables the language features described in
12151 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12152 performed by the compiler to support these features. The following types
12153 are no longer considered controlled when this restriction is in effect:
12156 @itemize *
12158 @item 
12159 @cite{Ada.Finalization.Controlled}
12161 @item 
12162 @cite{Ada.Finalization.Limited_Controlled}
12164 @item 
12165 Derivations from @cite{Controlled} or @cite{Limited_Controlled}
12167 @item 
12168 Class-wide types
12170 @item 
12171 Protected types
12173 @item 
12174 Task types
12176 @item 
12177 Array and record types with controlled components
12178 @end itemize
12180 The compiler no longer generates code to initialize, finalize or adjust an
12181 object or a nested component, either declared on the stack or on the heap. The
12182 deallocation of a controlled object no longer finalizes its contents.
12184 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12185 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1cb}
12186 @subsection No_Fixed_Point
12189 @geindex No_Fixed_Point
12191 [RM H.4] This restriction ensures at compile time that there are no
12192 occurrences of fixed point types and operations.
12194 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12195 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1cc}
12196 @subsection No_Floating_Point
12199 @geindex No_Floating_Point
12201 [RM H.4] This restriction ensures at compile time that there are no
12202 occurrences of floating point types and operations.
12204 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12205 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1cd}
12206 @subsection No_Implicit_Conditionals
12209 @geindex No_Implicit_Conditionals
12211 [GNAT] This restriction ensures that the generated code does not contain any
12212 implicit conditionals, either by modifying the generated code where possible,
12213 or by rejecting any construct that would otherwise generate an implicit
12214 conditional. Note that this check does not include run time constraint
12215 checks, which on some targets may generate implicit conditionals as
12216 well. To control the latter, constraint checks can be suppressed in the
12217 normal manner. Constructs generating implicit conditionals include comparisons
12218 of composite objects and the Max/Min attributes.
12220 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12221 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1ce}
12222 @subsection No_Implicit_Dynamic_Code
12225 @geindex No_Implicit_Dynamic_Code
12227 @geindex trampoline
12229 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12230 This is a structure that is built on the stack and contains dynamic
12231 code to be executed at run time. On some targets, a trampoline is
12232 built for the following features: @cite{Access},
12233 @cite{Unrestricted_Access}, or @cite{Address} of a nested subprogram;
12234 nested task bodies; primitive operations of nested tagged types.
12235 Trampolines do not work on machines that prevent execution of stack
12236 data. For example, on windows systems, enabling DEP (data execution
12237 protection) will cause trampolines to raise an exception.
12238 Trampolines are also quite slow at run time.
12240 On many targets, trampolines have been largely eliminated. Look at the
12241 version of system.ads for your target --- if it has
12242 Always_Compatible_Rep equal to False, then trampolines are largely
12243 eliminated. In particular, a trampoline is built for the following
12244 features: @cite{Address} of a nested subprogram;
12245 @cite{Access} or @cite{Unrestricted_Access} of a nested subprogram,
12246 but only if pragma Favor_Top_Level applies, or the access type has a
12247 foreign-language convention; primitive operations of nested tagged
12248 types.
12250 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12251 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1cf}
12252 @subsection No_Implicit_Heap_Allocations
12255 @geindex No_Implicit_Heap_Allocations
12257 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12259 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12260 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1d0}
12261 @subsection No_Implicit_Protected_Object_Allocations
12264 @geindex No_Implicit_Protected_Object_Allocations
12266 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12267 protected object.
12269 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12270 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1d1}
12271 @subsection No_Implicit_Task_Allocations
12274 @geindex No_Implicit_Task_Allocations
12276 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12278 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12279 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1d2}
12280 @subsection No_Initialize_Scalars
12283 @geindex No_Initialize_Scalars
12285 [GNAT] This restriction ensures that no unit in the partition is compiled with
12286 pragma Initialize_Scalars. This allows the generation of more efficient
12287 code, and in particular eliminates dummy null initialization routines that
12288 are otherwise generated for some record and array types.
12290 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12291 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1d3}
12292 @subsection No_IO
12295 @geindex No_IO
12297 [RM H.4] This restriction ensures at compile time that there are no
12298 dependences on any of the library units Sequential_IO, Direct_IO,
12299 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12301 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12302 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1d4}
12303 @subsection No_Local_Allocators
12306 @geindex No_Local_Allocators
12308 [RM H.4] This restriction ensures at compile time that there are no
12309 occurrences of an allocator in subprograms, generic subprograms, tasks,
12310 and entry bodies.
12312 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12313 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1d5}
12314 @subsection No_Local_Protected_Objects
12317 @geindex No_Local_Protected_Objects
12319 [RM D.7] This restriction ensures at compile time that protected objects are
12320 only declared at the library level.
12322 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12323 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1d6}
12324 @subsection No_Local_Timing_Events
12327 @geindex No_Local_Timing_Events
12329 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12330 declared at the library level.
12332 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12333 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1d7}
12334 @subsection No_Long_Long_Integers
12337 @geindex No_Long_Long_Integers
12339 [GNAT] This partition-wide restriction forbids any explicit reference to
12340 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12341 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12342 Long_Integer'Size.
12344 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12345 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1d8}
12346 @subsection No_Multiple_Elaboration
12349 @geindex No_Multiple_Elaboration
12351 [GNAT] When this restriction is active, we are not requesting control-flow
12352 preservation with -fpreserve-control-flow, and the static elaboration model is
12353 used, the compiler is allowed to suppress the elaboration counter normally
12354 associated with the unit, even if the unit has elaboration code. This counter
12355 is typically used to check for access before elaboration and to control
12356 multiple elaboration attempts. If the restriction is used, then the
12357 situations in which multiple elaboration is possible, including non-Ada main
12358 programs and Stand Alone libraries, are not permitted and will be diagnosed
12359 by the binder.
12361 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12362 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1d9}
12363 @subsection No_Nested_Finalization
12366 @geindex No_Nested_Finalization
12368 [RM D.7] All objects requiring finalization are declared at the library level.
12370 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12371 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1da}
12372 @subsection No_Protected_Type_Allocators
12375 @geindex No_Protected_Type_Allocators
12377 [RM D.7] This restriction ensures at compile time that there are no allocator
12378 expressions that attempt to allocate protected objects.
12380 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12381 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1db}
12382 @subsection No_Protected_Types
12385 @geindex No_Protected_Types
12387 [RM H.4] This restriction ensures at compile time that there are no
12388 declarations of protected types or protected objects.
12390 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12391 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1dc}
12392 @subsection No_Recursion
12395 @geindex No_Recursion
12397 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12398 part of its execution.
12400 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12401 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1dd}
12402 @subsection No_Reentrancy
12405 @geindex No_Reentrancy
12407 [RM H.4] A program execution is erroneous if a subprogram is executed by
12408 two tasks at the same time.
12410 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12411 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1de}
12412 @subsection No_Relative_Delay
12415 @geindex No_Relative_Delay
12417 [RM D.7] This restriction ensures at compile time that there are no delay
12418 relative statements and prevents expressions such as @cite{delay 1.23;} from
12419 appearing in source code.
12421 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12422 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1df}
12423 @subsection No_Requeue_Statements
12426 @geindex No_Requeue_Statements
12428 [RM D.7] This restriction ensures at compile time that no requeue statements
12429 are permitted and prevents keyword @cite{requeue} from being used in source
12430 code.
12432 @geindex No_Requeue
12434 The restriction @cite{No_Requeue} is recognized as a
12435 synonym for @cite{No_Requeue_Statements}. This is retained for historical
12436 compatibility purposes (and a warning will be generated for its use if
12437 warnings on oNobsolescent features are activated).
12439 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12440 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1e0}
12441 @subsection No_Secondary_Stack
12444 @geindex No_Secondary_Stack
12446 [GNAT] This restriction ensures at compile time that the generated code
12447 does not contain any reference to the secondary stack.  The secondary
12448 stack is used to implement functions returning unconstrained objects
12449 (arrays or records) on some targets. Suppresses the allocation of
12450 secondary stacks for tasks (excluding the environment task) at run time.
12452 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12453 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1e1}
12454 @subsection No_Select_Statements
12457 @geindex No_Select_Statements
12459 [RM D.7] This restriction ensures at compile time no select statements of any
12460 kind are permitted, that is the keyword @cite{select} may not appear.
12462 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12463 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1e2}
12464 @subsection No_Specific_Termination_Handlers
12467 @geindex No_Specific_Termination_Handlers
12469 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12470 or to Ada.Task_Termination.Specific_Handler.
12472 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12473 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1e3}
12474 @subsection No_Specification_of_Aspect
12477 @geindex No_Specification_of_Aspect
12479 [RM 13.12.1] This restriction checks at compile time that no aspect
12480 specification, attribute definition clause, or pragma is given for a
12481 given aspect.
12483 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12484 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1e4}
12485 @subsection No_Standard_Allocators_After_Elaboration
12488 @geindex No_Standard_Allocators_After_Elaboration
12490 [RM D.7] Specifies that an allocator using a standard storage pool
12491 should never be evaluated at run time after the elaboration of the
12492 library items of the partition has completed. Otherwise, Storage_Error
12493 is raised.
12495 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12496 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1e5}
12497 @subsection No_Standard_Storage_Pools
12500 @geindex No_Standard_Storage_Pools
12502 [GNAT] This restriction ensures at compile time that no access types
12503 use the standard default storage pool.  Any access type declared must
12504 have an explicit Storage_Pool attribute defined specifying a
12505 user-defined storage pool.
12507 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12508 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1e6}
12509 @subsection No_Stream_Optimizations
12512 @geindex No_Stream_Optimizations
12514 [GNAT] This restriction affects the performance of stream operations on types
12515 @cite{String}, @cite{Wide_String} and @cite{Wide_Wide_String}. By default, the
12516 compiler uses block reads and writes when manipulating @cite{String} objects
12517 due to their supperior performance. When this restriction is in effect, the
12518 compiler performs all IO operations on a per-character basis.
12520 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12521 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1e7}
12522 @subsection No_Streams
12525 @geindex No_Streams
12527 [GNAT] This restriction ensures at compile/bind time that there are no
12528 stream objects created and no use of stream attributes.
12529 This restriction does not forbid dependences on the package
12530 @cite{Ada.Streams}. So it is permissible to with
12531 @cite{Ada.Streams} (or another package that does so itself)
12532 as long as no actual stream objects are created and no
12533 stream attributes are used.
12535 Note that the use of restriction allows optimization of tagged types,
12536 since they do not need to worry about dispatching stream operations.
12537 To take maximum advantage of this space-saving optimization, any
12538 unit declaring a tagged type should be compiled with the restriction,
12539 though this is not required.
12541 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12542 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1e8}
12543 @subsection No_Task_Allocators
12546 @geindex No_Task_Allocators
12548 [RM D.7] There are no allocators for task types
12549 or types containing task subcomponents.
12551 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
12552 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1e9}
12553 @subsection No_Task_At_Interrupt_Priority
12556 @geindex No_Task_At_Interrupt_Priority
12558 [GNAT] This restriction ensures at compile time that there is no
12559 Interrupt_Priority aspect or pragma for a task or a task type. As
12560 a consequence, the tasks are always created with a priority below
12561 that an interrupt priority.
12563 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
12564 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1ea}
12565 @subsection No_Task_Attributes_Package
12568 @geindex No_Task_Attributes_Package
12570 [GNAT] This restriction ensures at compile time that there are no implicit or
12571 explicit dependencies on the package @cite{Ada.Task_Attributes}.
12573 @geindex No_Task_Attributes
12575 The restriction @cite{No_Task_Attributes} is recognized as a synonym
12576 for @cite{No_Task_Attributes_Package}. This is retained for historical
12577 compatibility purposes (and a warning will be generated for its use if
12578 warnings on obsolescent features are activated).
12580 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
12581 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1eb}
12582 @subsection No_Task_Hierarchy
12585 @geindex No_Task_Hierarchy
12587 [RM D.7] All (non-environment) tasks depend
12588 directly on the environment task of the partition.
12590 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
12591 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1ec}
12592 @subsection No_Task_Termination
12595 @geindex No_Task_Termination
12597 [RM D.7] Tasks that terminate are erroneous.
12599 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
12600 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1ed}
12601 @subsection No_Tasking
12604 @geindex No_Tasking
12606 [GNAT] This restriction prevents the declaration of tasks or task types
12607 throughout the partition.  It is similar in effect to the use of
12608 @cite{Max_Tasks => 0} except that violations are caught at compile time
12609 and cause an error message to be output either by the compiler or
12610 binder.
12612 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
12613 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1ee}
12614 @subsection No_Terminate_Alternatives
12617 @geindex No_Terminate_Alternatives
12619 [RM D.7] There are no selective accepts with terminate alternatives.
12621 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
12622 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1ef}
12623 @subsection No_Unchecked_Access
12626 @geindex No_Unchecked_Access
12628 [RM H.4] This restriction ensures at compile time that there are no
12629 occurrences of the Unchecked_Access attribute.
12631 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
12632 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1f0}
12633 @subsection No_Unchecked_Conversion
12636 @geindex No_Unchecked_Conversion
12638 [RM J.13] This restriction ensures at compile time that there are no semantic
12639 dependences on the predefined generic function Unchecked_Conversion.
12641 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
12642 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1f1}
12643 @subsection No_Unchecked_Deallocation
12646 @geindex No_Unchecked_Deallocation
12648 [RM J.13] This restriction ensures at compile time that there are no semantic
12649 dependences on the predefined generic procedure Unchecked_Deallocation.
12651 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
12652 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1f2}
12653 @subsection No_Use_Of_Entity
12656 @geindex No_Use_Of_Entity
12658 [GNAT] This restriction ensures at compile time that there are no references
12659 to the entity given in the form
12661 @example
12662 No_Use_Of_Entity => Name
12663 @end example
12665 where @code{Name} is the fully qualified entity, for example
12667 @example
12668 No_Use_Of_Entity => Ada.Text_IO.Put_Line
12669 @end example
12671 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
12672 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1f3}
12673 @subsection Pure_Barriers
12676 @geindex Pure_Barriers
12678 [GNAT] This restriction ensures at compile time that protected entry
12679 barriers are restricted to:
12682 @itemize *
12684 @item 
12685 simple variables defined in the private part of the
12686 protected type/object,
12688 @item 
12689 constant declarations,
12691 @item 
12692 named numbers,
12694 @item 
12695 enumeration literals,
12697 @item 
12698 integer literals,
12700 @item 
12701 real literals,
12703 @item 
12704 character literals,
12706 @item 
12707 implicitly defined comparison operators,
12709 @item 
12710 uses of the Standard."not" operator,
12712 @item 
12713 short-circuit operator
12714 @end itemize
12716 This restriction is a relaxation of the Simple_Barriers restriction,
12717 but still ensures absence of side effects, exceptions, and recursion
12718 during the evaluation of the barriers.
12720 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
12721 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1f4}
12722 @subsection Simple_Barriers
12725 @geindex Simple_Barriers
12727 [RM D.7] This restriction ensures at compile time that barriers in entry
12728 declarations for protected types are restricted to either static boolean
12729 expressions or references to simple boolean variables defined in the private
12730 part of the protected type.  No other form of entry barriers is permitted.
12732 @geindex Boolean_Entry_Barriers
12734 The restriction @cite{Boolean_Entry_Barriers} is recognized as a
12735 synonym for @cite{Simple_Barriers}. This is retained for historical
12736 compatibility purposes (and a warning will be generated for its use if
12737 warnings on obsolescent features are activated).
12739 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
12740 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1f5}
12741 @subsection Static_Priorities
12744 @geindex Static_Priorities
12746 [GNAT] This restriction ensures at compile time that all priority expressions
12747 are static, and that there are no dependences on the package
12748 @cite{Ada.Dynamic_Priorities}.
12750 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
12751 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1f6}
12752 @subsection Static_Storage_Size
12755 @geindex Static_Storage_Size
12757 [GNAT] This restriction ensures at compile time that any expression appearing
12758 in a Storage_Size pragma or attribute definition clause is static.
12760 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
12761 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1f7}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{1f8}
12762 @section Program Unit Level Restrictions
12765 The second set of restriction identifiers
12766 does not require partition-wide consistency.
12767 The restriction may be enforced for a single
12768 compilation unit without any effect on any of the
12769 other compilation units in the partition.
12771 @menu
12772 * No_Elaboration_Code:: 
12773 * No_Dynamic_Sized_Objects:: 
12774 * No_Entry_Queue:: 
12775 * No_Implementation_Aspect_Specifications:: 
12776 * No_Implementation_Attributes:: 
12777 * No_Implementation_Identifiers:: 
12778 * No_Implementation_Pragmas:: 
12779 * No_Implementation_Restrictions:: 
12780 * No_Implementation_Units:: 
12781 * No_Implicit_Aliasing:: 
12782 * No_Implicit_Loops:: 
12783 * No_Obsolescent_Features:: 
12784 * No_Wide_Characters:: 
12785 * SPARK_05:: 
12787 @end menu
12789 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
12790 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{1f9}
12791 @subsection No_Elaboration_Code
12794 @geindex No_Elaboration_Code
12796 [GNAT] This restriction ensures at compile time that no elaboration code is
12797 generated.  Note that this is not the same condition as is enforced
12798 by pragma @cite{Preelaborate}.  There are cases in which pragma
12799 @cite{Preelaborate} still permits code to be generated (e.g., code
12800 to initialize a large array to all zeroes), and there are cases of units
12801 which do not meet the requirements for pragma @cite{Preelaborate},
12802 but for which no elaboration code is generated.  Generally, it is
12803 the case that preelaborable units will meet the restrictions, with
12804 the exception of large aggregates initialized with an others_clause,
12805 and exception declarations (which generate calls to a run-time
12806 registry procedure).  This restriction is enforced on
12807 a unit by unit basis, it need not be obeyed consistently
12808 throughout a partition.
12810 In the case of aggregates with others, if the aggregate has a dynamic
12811 size, there is no way to eliminate the elaboration code (such dynamic
12812 bounds would be incompatible with @cite{Preelaborate} in any case). If
12813 the bounds are static, then use of this restriction actually modifies
12814 the code choice of the compiler to avoid generating a loop, and instead
12815 generate the aggregate statically if possible, no matter how many times
12816 the data for the others clause must be repeatedly generated.
12818 It is not possible to precisely document
12819 the constructs which are compatible with this restriction, since,
12820 unlike most other restrictions, this is not a restriction on the
12821 source code, but a restriction on the generated object code. For
12822 example, if the source contains a declaration:
12824 @example
12825 Val : constant Integer := X;
12826 @end example
12828 where X is not a static constant, it may be possible, depending
12829 on complex optimization circuitry, for the compiler to figure
12830 out the value of X at compile time, in which case this initialization
12831 can be done by the loader, and requires no initialization code. It
12832 is not possible to document the precise conditions under which the
12833 optimizer can figure this out.
12835 Note that this the implementation of this restriction requires full
12836 code generation. If it is used in conjunction with "semantics only"
12837 checking, then some cases of violations may be missed.
12839 When this restriction is active, we are not requesting control-flow
12840 preservation with -fpreserve-control-flow, and the static elaboration model is
12841 used, the compiler is allowed to suppress the elaboration counter normally
12842 associated with the unit. This counter is typically used to check for access
12843 before elaboration and to control multiple elaboration attempts.
12845 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
12846 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{1fa}
12847 @subsection No_Dynamic_Sized_Objects
12850 @geindex No_Dynamic_Sized_Objects
12852 [GNAT] This restriction disallows certain constructs that might lead to the
12853 creation of dynamic-sized composite objects (or array or discriminated type).
12854 An array subtype indication is illegal if the bounds are not static
12855 or references to discriminants of an enclosing type.
12856 A discriminated subtype indication is illegal if the type has
12857 discriminant-dependent array components or a variant part, and the
12858 discriminants are not static. In addition, array and record aggregates are
12859 illegal in corresponding cases. Note that this restriction does not forbid
12860 access discriminants. It is often a good idea to combine this restriction
12861 with No_Secondary_Stack.
12863 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
12864 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{1fb}
12865 @subsection No_Entry_Queue
12868 @geindex No_Entry_Queue
12870 [GNAT] This restriction is a declaration that any protected entry compiled in
12871 the scope of the restriction has at most one task waiting on the entry
12872 at any one time, and so no queue is required.  This restriction is not
12873 checked at compile time.  A program execution is erroneous if an attempt
12874 is made to queue a second task on such an entry.
12876 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
12877 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{1fc}
12878 @subsection No_Implementation_Aspect_Specifications
12881 @geindex No_Implementation_Aspect_Specifications
12883 [RM 13.12.1] This restriction checks at compile time that no
12884 GNAT-defined aspects are present.  With this restriction, the only
12885 aspects that can be used are those defined in the Ada Reference Manual.
12887 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
12888 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{1fd}
12889 @subsection No_Implementation_Attributes
12892 @geindex No_Implementation_Attributes
12894 [RM 13.12.1] This restriction checks at compile time that no
12895 GNAT-defined attributes are present.  With this restriction, the only
12896 attributes that can be used are those defined in the Ada Reference
12897 Manual.
12899 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
12900 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{1fe}
12901 @subsection No_Implementation_Identifiers
12904 @geindex No_Implementation_Identifiers
12906 [RM 13.12.1] This restriction checks at compile time that no
12907 implementation-defined identifiers (marked with pragma Implementation_Defined)
12908 occur within language-defined packages.
12910 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
12911 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{1ff}
12912 @subsection No_Implementation_Pragmas
12915 @geindex No_Implementation_Pragmas
12917 [RM 13.12.1] This restriction checks at compile time that no
12918 GNAT-defined pragmas are present.  With this restriction, the only
12919 pragmas that can be used are those defined in the Ada Reference Manual.
12921 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
12922 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{200}
12923 @subsection No_Implementation_Restrictions
12926 @geindex No_Implementation_Restrictions
12928 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
12929 identifiers (other than @cite{No_Implementation_Restrictions} itself)
12930 are present.  With this restriction, the only other restriction identifiers
12931 that can be used are those defined in the Ada Reference Manual.
12933 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
12934 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{201}
12935 @subsection No_Implementation_Units
12938 @geindex No_Implementation_Units
12940 [RM 13.12.1] This restriction checks at compile time that there is no
12941 mention in the context clause of any implementation-defined descendants
12942 of packages Ada, Interfaces, or System.
12944 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
12945 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{202}
12946 @subsection No_Implicit_Aliasing
12949 @geindex No_Implicit_Aliasing
12951 [GNAT] This restriction, which is not required to be partition-wide consistent,
12952 requires an explicit aliased keyword for an object to which 'Access,
12953 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
12954 the 'Unrestricted_Access attribute for objects. Note: the reason that
12955 Unrestricted_Access is forbidden is that it would require the prefix
12956 to be aliased, and in such cases, it can always be replaced by
12957 the standard attribute Unchecked_Access which is preferable.
12959 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
12960 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{203}
12961 @subsection No_Implicit_Loops
12964 @geindex No_Implicit_Loops
12966 [GNAT] This restriction ensures that the generated code of the unit marked
12967 with this restriction does not contain any implicit @cite{for} loops, either by
12968 modifying the generated code where possible, or by rejecting any construct
12969 that would otherwise generate an implicit @cite{for} loop. If this restriction is
12970 active, it is possible to build large array aggregates with all static
12971 components without generating an intermediate temporary, and without generating
12972 a loop to initialize individual components. Otherwise, a loop is created for
12973 arrays larger than about 5000 scalar components. Note that if this restriction
12974 is set in the spec of a package, it will not apply to its body.
12976 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
12977 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{204}
12978 @subsection No_Obsolescent_Features
12981 @geindex No_Obsolescent_Features
12983 [RM 13.12.1] This restriction checks at compile time that no obsolescent
12984 features are used, as defined in Annex J of the Ada Reference Manual.
12986 @node No_Wide_Characters,SPARK_05,No_Obsolescent_Features,Program Unit Level Restrictions
12987 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{205}
12988 @subsection No_Wide_Characters
12991 @geindex No_Wide_Characters
12993 [GNAT] This restriction ensures at compile time that no uses of the types
12994 @cite{Wide_Character} or @cite{Wide_String} or corresponding wide
12995 wide types
12996 appear, and that no wide or wide wide string or character literals
12997 appear in the program (that is literals representing characters not in
12998 type @cite{Character}).
13000 @node SPARK_05,,No_Wide_Characters,Program Unit Level Restrictions
13001 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{206}
13002 @subsection SPARK_05
13005 @geindex SPARK_05
13007 [GNAT] This restriction checks at compile time that some constructs
13008 forbidden in SPARK 2005 are not present. Error messages related to
13009 SPARK restriction have the form:
13011 @example
13012 violation of restriction "SPARK_05" at <source-location>
13013  <error message>
13014 @end example
13016 @geindex SPARK
13018 The restriction @cite{SPARK} is recognized as a
13019 synonym for @cite{SPARK_05}. This is retained for historical
13020 compatibility purposes (and an unconditional warning will be generated
13021 for its use, advising replacement by @cite{SPARK}).
13023 This is not a replacement for the semantic checks performed by the
13024 SPARK Examiner tool, as the compiler currently only deals with code,
13025 not SPARK 2005 annotations, and does not guarantee catching all
13026 cases of constructs forbidden by SPARK 2005.
13028 Thus it may well be the case that code which passes the compiler with
13029 the SPARK restriction is rejected by the SPARK Examiner, e.g. due to
13030 the different visibility rules of the Examiner based on SPARK 2005
13031 @cite{inherit} annotations.
13033 This restriction can be useful in providing an initial filter for code
13034 developed using SPARK 2005, or in examining legacy code to see how far
13035 it is from meeting SPARK restrictions.
13037 The list below summarizes the checks that are performed when this
13038 restriction is in force:
13041 @itemize *
13043 @item 
13044 No block statements
13046 @item 
13047 No case statements with only an others clause
13049 @item 
13050 Exit statements in loops must respect the SPARK 2005 language restrictions
13052 @item 
13053 No goto statements
13055 @item 
13056 Return can only appear as last statement in function
13058 @item 
13059 Function must have return statement
13061 @item 
13062 Loop parameter specification must include subtype mark
13064 @item 
13065 Prefix of expanded name cannot be a loop statement
13067 @item 
13068 Abstract subprogram not allowed
13070 @item 
13071 User-defined operators not allowed
13073 @item 
13074 Access type parameters not allowed
13076 @item 
13077 Default expressions for parameters not allowed
13079 @item 
13080 Default expressions for record fields not allowed
13082 @item 
13083 No tasking constructs allowed
13085 @item 
13086 Label needed at end of subprograms and packages
13088 @item 
13089 No mixing of positional and named parameter association
13091 @item 
13092 No access types as result type
13094 @item 
13095 No unconstrained arrays as result types
13097 @item 
13098 No null procedures
13100 @item 
13101 Initial and later declarations must be in correct order (declaration can't come after body)
13103 @item 
13104 No attributes on private types if full declaration not visible
13106 @item 
13107 No package declaration within package specification
13109 @item 
13110 No controlled types
13112 @item 
13113 No discriminant types
13115 @item 
13116 No overloading
13118 @item 
13119 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
13121 @item 
13122 Access attribute not allowed
13124 @item 
13125 Allocator not allowed
13127 @item 
13128 Result of catenation must be String
13130 @item 
13131 Operands of catenation must be string literal, static char or another catenation
13133 @item 
13134 No conditional expressions
13136 @item 
13137 No explicit dereference
13139 @item 
13140 Quantified expression not allowed
13142 @item 
13143 Slicing not allowed
13145 @item 
13146 No exception renaming
13148 @item 
13149 No generic renaming
13151 @item 
13152 No object renaming
13154 @item 
13155 No use clause
13157 @item 
13158 Aggregates must be qualified
13160 @item 
13161 Nonstatic choice in array aggregates not allowed
13163 @item 
13164 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
13166 @item 
13167 No mixing of positional and named association in aggregate, no multi choice
13169 @item 
13170 AND, OR and XOR for arrays only allowed when operands have same static bounds
13172 @item 
13173 Fixed point operands to * or / must be qualified or converted
13175 @item 
13176 Comparison operators not allowed for Booleans or arrays (except strings)
13178 @item 
13179 Equality not allowed for arrays with non-matching static bounds (except strings)
13181 @item 
13182 Conversion / qualification not allowed for arrays with non-matching static bounds
13184 @item 
13185 Subprogram declaration only allowed in package spec (unless followed by import)
13187 @item 
13188 Access types not allowed
13190 @item 
13191 Incomplete type declaration not allowed
13193 @item 
13194 Object and subtype declarations must respect SPARK restrictions
13196 @item 
13197 Digits or delta constraint not allowed
13199 @item 
13200 Decimal fixed point type not allowed
13202 @item 
13203 Aliasing of objects not allowed
13205 @item 
13206 Modular type modulus must be power of 2
13208 @item 
13209 Base not allowed on subtype mark
13211 @item 
13212 Unary operators not allowed on modular types (except not)
13214 @item 
13215 Untagged record cannot be null
13217 @item 
13218 No class-wide operations
13220 @item 
13221 Initialization expressions must respect SPARK restrictions
13223 @item 
13224 Nonstatic ranges not allowed except in iteration schemes
13226 @item 
13227 String subtypes must have lower bound of 1
13229 @item 
13230 Subtype of Boolean cannot have constraint
13232 @item 
13233 At most one tagged type or extension per package
13235 @item 
13236 Interface is not allowed
13238 @item 
13239 Character literal cannot be prefixed (selector name cannot be character literal)
13241 @item 
13242 Record aggregate cannot contain 'others'
13244 @item 
13245 Component association in record aggregate must contain a single choice
13247 @item 
13248 Ancestor part cannot be a type mark
13250 @item 
13251 Attributes 'Image, 'Width and 'Value not allowed
13253 @item 
13254 Functions may not update globals
13256 @item 
13257 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13259 @item 
13260 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13261 @end itemize
13263 The following restrictions are enforced, but note that they are actually more
13264 strict that the latest SPARK 2005 language definition:
13267 @itemize *
13269 @item 
13270 No derived types other than tagged type extensions
13272 @item 
13273 Subtype of unconstrained array must have constraint
13274 @end itemize
13276 This list summarises the main SPARK 2005 language rules that are not
13277 currently checked by the SPARK_05 restriction:
13280 @itemize *
13282 @item 
13283 SPARK annotations are treated as comments so are not checked at all
13285 @item 
13286 Based real literals not allowed
13288 @item 
13289 Objects cannot be initialized at declaration by calls to user-defined functions
13291 @item 
13292 Objects cannot be initialized at declaration by assignments from variables
13294 @item 
13295 Objects cannot be initialized at declaration by assignments from indexed/selected components
13297 @item 
13298 Ranges shall not be null
13300 @item 
13301 A fixed point delta expression must be a simple expression
13303 @item 
13304 Restrictions on where renaming declarations may be placed
13306 @item 
13307 Externals of mode 'out' cannot be referenced
13309 @item 
13310 Externals of mode 'in' cannot be updated
13312 @item 
13313 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13315 @item 
13316 Subprogram cannot have parent unit name
13318 @item 
13319 SPARK 2005 inherited subprogram must be prefixed with overriding
13321 @item 
13322 External variables (or functions that reference them) may not be passed as actual parameters
13324 @item 
13325 Globals must be explicitly mentioned in contract
13327 @item 
13328 Deferred constants cannot be completed by pragma Import
13330 @item 
13331 Package initialization cannot read/write variables from other packages
13333 @item 
13334 Prefix not allowed for entities that are directly visible
13336 @item 
13337 Identifier declaration can't override inherited package name
13339 @item 
13340 Cannot use Standard or other predefined packages as identifiers
13342 @item 
13343 After renaming, cannot use the original name
13345 @item 
13346 Subprograms can only be renamed to remove package prefix
13348 @item 
13349 Pragma import must be immediately after entity it names
13351 @item 
13352 No mutual recursion between multiple units (this can be checked with gnatcheck)
13353 @end itemize
13355 Note that if a unit is compiled in Ada 95 mode with the SPARK restriction,
13356 violations will be reported for constructs forbidden in SPARK 95,
13357 instead of SPARK 2005.
13359 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13360 @anchor{gnat_rm/implementation_advice doc}@anchor{207}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{208}
13361 @chapter Implementation Advice
13364 The main text of the Ada Reference Manual describes the required
13365 behavior of all Ada compilers, and the GNAT compiler conforms to
13366 these requirements.
13368 In addition, there are sections throughout the Ada Reference Manual headed
13369 by the phrase 'Implementation advice'.  These sections are not normative,
13370 i.e., they do not specify requirements that all compilers must
13371 follow.  Rather they provide advice on generally desirable behavior.
13372 They are not requirements, because they describe behavior that cannot
13373 be provided on all systems, or may be undesirable on some systems.
13375 As far as practical, GNAT follows the implementation advice in
13376 the Ada Reference Manual.  Each such RM section corresponds to a section
13377 in this chapter whose title specifies the
13378 RM section number and paragraph number and the subject of
13379 the advice.  The contents of each section consists of the RM text within
13380 quotation marks,
13381 followed by the GNAT interpretation of the advice.  Most often, this simply says
13382 'followed', which means that GNAT follows the advice.  However, in a
13383 number of cases, GNAT deliberately deviates from this advice, in which
13384 case the text describes what GNAT does and why.
13386 @geindex Error detection
13388 @menu
13389 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
13390 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
13391 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
13392 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
13393 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
13394 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
13395 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
13396 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
13397 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
13398 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
13399 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
13400 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
13401 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
13402 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
13403 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
13404 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
13405 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
13406 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
13407 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
13408 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
13409 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
13410 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
13411 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
13412 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
13413 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
13414 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
13415 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
13416 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
13417 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
13418 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
13419 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
13420 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
13421 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
13422 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
13423 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
13424 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
13425 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
13426 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
13427 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
13428 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
13429 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
13430 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
13431 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
13432 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
13433 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
13434 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
13435 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
13436 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
13437 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
13438 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
13439 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
13440 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
13441 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
13442 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
13443 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
13444 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
13445 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
13446 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
13447 * RM G; Numerics: RM G Numerics. 
13448 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
13449 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
13450 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
13451 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
13452 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
13454 @end menu
13456 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13457 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{209}
13458 @section RM 1.1.3(20): Error Detection
13461 @quotation
13463 "If an implementation detects the use of an unsupported Specialized Needs
13464 Annex feature at run time, it should raise @cite{Program_Error} if
13465 feasible."
13466 @end quotation
13468 Not relevant.  All specialized needs annex features are either supported,
13469 or diagnosed at compile time.
13471 @geindex Child Units
13473 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13474 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{20a}
13475 @section RM 1.1.3(31): Child Units
13478 @quotation
13480 "If an implementation wishes to provide implementation-defined
13481 extensions to the functionality of a language-defined library unit, it
13482 should normally do so by adding children to the library unit."
13483 @end quotation
13485 Followed.
13487 @geindex Bounded errors
13489 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13490 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{20b}
13491 @section RM 1.1.5(12): Bounded Errors
13494 @quotation
13496 "If an implementation detects a bounded error or erroneous
13497 execution, it should raise @cite{Program_Error}."
13498 @end quotation
13500 Followed in all cases in which the implementation detects a bounded
13501 error or erroneous execution.  Not all such situations are detected at
13502 runtime.
13504 @geindex Pragmas
13506 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13507 @anchor{gnat_rm/implementation_advice id2}@anchor{20c}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{20d}
13508 @section RM 2.8(16): Pragmas
13511 @quotation
13513 "Normally, implementation-defined pragmas should have no semantic effect
13514 for error-free programs; that is, if the implementation-defined pragmas
13515 are removed from a working program, the program should still be legal,
13516 and should still have the same semantics."
13517 @end quotation
13519 The following implementation defined pragmas are exceptions to this
13520 rule:
13523 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
13524 @headitem
13526 Pragma
13528 @tab
13530 Explanation
13532 @item
13534 @emph{Abort_Defer}
13536 @tab
13538 Affects semantics
13540 @item
13542 @emph{Ada_83}
13544 @tab
13546 Affects legality
13548 @item
13550 @emph{Assert}
13552 @tab
13554 Affects semantics
13556 @item
13558 @emph{CPP_Class}
13560 @tab
13562 Affects semantics
13564 @item
13566 @emph{CPP_Constructor}
13568 @tab
13570 Affects semantics
13572 @item
13574 @emph{Debug}
13576 @tab
13578 Affects semantics
13580 @item
13582 @emph{Interface_Name}
13584 @tab
13586 Affects semantics
13588 @item
13590 @emph{Machine_Attribute}
13592 @tab
13594 Affects semantics
13596 @item
13598 @emph{Unimplemented_Unit}
13600 @tab
13602 Affects legality
13604 @item
13606 @emph{Unchecked_Union}
13608 @tab
13610 Affects semantics
13612 @end multitable
13615 In each of the above cases, it is essential to the purpose of the pragma
13616 that this advice not be followed.  For details see
13617 @ref{7,,Implementation Defined Pragmas}.
13619 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
13620 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{20e}
13621 @section RM 2.8(17-19): Pragmas
13624 @quotation
13626 "Normally, an implementation should not define pragmas that can
13627 make an illegal program legal, except as follows:
13630 @itemize *
13632 @item 
13633 A pragma used to complete a declaration, such as a pragma @cite{Import};
13635 @item 
13636 A pragma used to configure the environment by adding, removing, or
13637 replacing @cite{library_items}."
13638 @end itemize
13639 @end quotation
13641 See @ref{20d,,RM 2.8(16); Pragmas}.
13643 @geindex Character Sets
13645 @geindex Alternative Character Sets
13647 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
13648 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{20f}
13649 @section RM 3.5.2(5): Alternative Character Sets
13652 @quotation
13654 "If an implementation supports a mode with alternative interpretations
13655 for @cite{Character} and @cite{Wide_Character}, the set of graphic
13656 characters of @cite{Character} should nevertheless remain a proper
13657 subset of the set of graphic characters of @cite{Wide_Character}.  Any
13658 character set 'localizations' should be reflected in the results of
13659 the subprograms defined in the language-defined package
13660 @cite{Characters.Handling} (see A.3) available in such a mode.  In a mode with
13661 an alternative interpretation of @cite{Character}, the implementation should
13662 also support a corresponding change in what is a legal
13663 @cite{identifier_letter}."
13664 @end quotation
13666 Not all wide character modes follow this advice, in particular the JIS
13667 and IEC modes reflect standard usage in Japan, and in these encoding,
13668 the upper half of the Latin-1 set is not part of the wide-character
13669 subset, since the most significant bit is used for wide character
13670 encoding.  However, this only applies to the external forms.  Internally
13671 there is no such restriction.
13673 @geindex Integer types
13675 @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
13676 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{210}
13677 @section RM 3.5.4(28): Integer Types
13680 @quotation
13682 "An implementation should support @cite{Long_Integer} in addition to
13683 @cite{Integer} if the target machine supports 32-bit (or longer)
13684 arithmetic.  No other named integer subtypes are recommended for package
13685 @cite{Standard}.  Instead, appropriate named integer subtypes should be
13686 provided in the library package @cite{Interfaces} (see B.2)."
13687 @end quotation
13689 @cite{Long_Integer} is supported.  Other standard integer types are supported
13690 so this advice is not fully followed.  These types
13691 are supported for convenient interface to C, and so that all hardware
13692 types of the machine are easily available.
13694 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
13695 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{211}
13696 @section RM 3.5.4(29): Integer Types
13699 @quotation
13701 "An implementation for a two's complement machine should support
13702 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
13703 implementation should support a non-binary modules up to @cite{Integer'Last}."
13704 @end quotation
13706 Followed.
13708 @geindex Enumeration values
13710 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
13711 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{212}
13712 @section RM 3.5.5(8): Enumeration Values
13715 @quotation
13717 "For the evaluation of a call on @code{S'Pos} for an enumeration
13718 subtype, if the value of the operand does not correspond to the internal
13719 code for any enumeration literal of its type (perhaps due to an
13720 un-initialized variable), then the implementation should raise
13721 @cite{Program_Error}.  This is particularly important for enumeration
13722 types with noncontiguous internal codes specified by an
13723 enumeration_representation_clause."
13724 @end quotation
13726 Followed.
13728 @geindex Float types
13730 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
13731 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{213}
13732 @section RM 3.5.7(17): Float Types
13735 @quotation
13737 "An implementation should support @cite{Long_Float} in addition to
13738 @cite{Float} if the target machine supports 11 or more digits of
13739 precision.  No other named floating point subtypes are recommended for
13740 package @cite{Standard}.  Instead, appropriate named floating point subtypes
13741 should be provided in the library package @cite{Interfaces} (see B.2)."
13742 @end quotation
13744 @cite{Short_Float} and @cite{Long_Long_Float} are also provided.  The
13745 former provides improved compatibility with other implementations
13746 supporting this type.  The latter corresponds to the highest precision
13747 floating-point type supported by the hardware.  On most machines, this
13748 will be the same as @cite{Long_Float}, but on some machines, it will
13749 correspond to the IEEE extended form.  The notable case is all ia32
13750 (x86) implementations, where @cite{Long_Long_Float} corresponds to
13751 the 80-bit extended precision format supported in hardware on this
13752 processor.  Note that the 128-bit format on SPARC is not supported,
13753 since this is a software rather than a hardware format.
13755 @geindex Multidimensional arrays
13757 @geindex Arrays
13758 @geindex multidimensional
13760 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
13761 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{214}
13762 @section RM 3.6.2(11): Multidimensional Arrays
13765 @quotation
13767 "An implementation should normally represent multidimensional arrays in
13768 row-major order, consistent with the notation used for multidimensional
13769 array aggregates (see 4.3.3).  However, if a pragma @cite{Convention}
13770 (@cite{Fortran}, ...) applies to a multidimensional array type, then
13771 column-major order should be used instead (see B.5, @cite{Interfacing with Fortran})."
13772 @end quotation
13774 Followed.
13776 @geindex Duration'Small
13778 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
13779 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{215}
13780 @section RM 9.6(30-31): Duration'Small
13783 @quotation
13785 "Whenever possible in an implementation, the value of @cite{Duration'Small}
13786 should be no greater than 100 microseconds."
13787 @end quotation
13789 Followed.  (@cite{Duration'Small} = 10**(-9)).
13791 @quotation
13793 "The time base for @cite{delay_relative_statements} should be monotonic;
13794 it need not be the same time base as used for @cite{Calendar.Clock}."
13795 @end quotation
13797 Followed.
13799 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
13800 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{216}
13801 @section RM 10.2.1(12): Consistent Representation
13804 @quotation
13806 "In an implementation, a type declared in a pre-elaborated package should
13807 have the same representation in every elaboration of a given version of
13808 the package, whether the elaborations occur in distinct executions of
13809 the same program, or in executions of distinct programs or partitions
13810 that include the given version."
13811 @end quotation
13813 Followed, except in the case of tagged types.  Tagged types involve
13814 implicit pointers to a local copy of a dispatch table, and these pointers
13815 have representations which thus depend on a particular elaboration of the
13816 package.  It is not easy to see how it would be possible to follow this
13817 advice without severely impacting efficiency of execution.
13819 @geindex Exception information
13821 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
13822 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{217}
13823 @section RM 11.4.1(19): Exception Information
13826 @quotation
13828 "@cite{Exception_Message} by default and @cite{Exception_Information}
13829 should produce information useful for
13830 debugging.  @cite{Exception_Message} should be short, about one
13831 line.  @cite{Exception_Information} can be long.  @cite{Exception_Message}
13832 should not include the
13833 @cite{Exception_Name}.  @cite{Exception_Information} should include both
13834 the @cite{Exception_Name} and the @cite{Exception_Message}."
13835 @end quotation
13837 Followed.  For each exception that doesn't have a specified
13838 @cite{Exception_Message}, the compiler generates one containing the location
13839 of the raise statement.  This location has the form 'file_name:line', where
13840 file_name is the short file name (without path information) and line is the line
13841 number in the file.  Note that in the case of the Zero Cost Exception
13842 mechanism, these messages become redundant with the Exception_Information that
13843 contains a full backtrace of the calling sequence, so they are disabled.
13844 To disable explicitly the generation of the source location message, use the
13845 Pragma @cite{Discard_Names}.
13847 @geindex Suppression of checks
13849 @geindex Checks
13850 @geindex suppression of
13852 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
13853 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{218}
13854 @section RM 11.5(28): Suppression of Checks
13857 @quotation
13859 "The implementation should minimize the code executed for checks that
13860 have been suppressed."
13861 @end quotation
13863 Followed.
13865 @geindex Representation clauses
13867 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
13868 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{219}
13869 @section RM 13.1 (21-24): Representation Clauses
13872 @quotation
13874 "The recommended level of support for all representation items is
13875 qualified as follows:
13877 An implementation need not support representation items containing
13878 nonstatic expressions, except that an implementation should support a
13879 representation item for a given entity if each nonstatic expression in
13880 the representation item is a name that statically denotes a constant
13881 declared before the entity."
13882 @end quotation
13884 Followed.  In fact, GNAT goes beyond the recommended level of support
13885 by allowing nonstatic expressions in some representation clauses even
13886 without the need to declare constants initialized with the values of
13887 such expressions.
13888 For example:
13890 @example
13891   X : Integer;
13892   Y : Float;
13893   for Y'Address use X'Address;>>
13896 "An implementation need not support a specification for the `Size`
13897 for a given composite subtype, nor the size or storage place for an
13898 object (including a component) of a given composite subtype, unless the
13899 constraints on the subtype and its composite subcomponents (if any) are
13900 all static constraints."
13901 @end example
13903 Followed.  Size Clauses are not permitted on nonstatic components, as
13904 described above.
13906 @quotation
13908 "An aliased component, or a component whose type is by-reference, should
13909 always be allocated at an addressable location."
13910 @end quotation
13912 Followed.
13914 @geindex Packed types
13916 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
13917 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{21a}
13918 @section RM 13.2(6-8): Packed Types
13921 @quotation
13923 "If a type is packed, then the implementation should try to minimize
13924 storage allocated to objects of the type, possibly at the expense of
13925 speed of accessing components, subject to reasonable complexity in
13926 addressing calculations.
13928 The recommended level of support pragma @cite{Pack} is:
13930 For a packed record type, the components should be packed as tightly as
13931 possible subject to the Sizes of the component subtypes, and subject to
13932 any @cite{record_representation_clause} that applies to the type; the
13933 implementation may, but need not, reorder components or cross aligned
13934 word boundaries to improve the packing.  A component whose @cite{Size} is
13935 greater than the word size may be allocated an integral number of words."
13936 @end quotation
13938 Followed.  Tight packing of arrays is supported for all component sizes
13939 up to 64-bits. If the array component size is 1 (that is to say, if
13940 the component is a boolean type or an enumeration type with two values)
13941 then values of the type are implicitly initialized to zero. This
13942 happens both for objects of the packed type, and for objects that have a
13943 subcomponent of the packed type.
13945 @quotation
13947 "An implementation should support Address clauses for imported
13948 subprograms."
13949 @end quotation
13951 Followed.
13953 @geindex Address clauses
13955 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
13956 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{21b}
13957 @section RM 13.3(14-19): Address Clauses
13960 @quotation
13962 "For an array @cite{X}, @code{X'Address} should point at the first
13963 component of the array, and not at the array bounds."
13964 @end quotation
13966 Followed.
13968 @quotation
13970 "The recommended level of support for the @cite{Address} attribute is:
13972 @code{X'Address} should produce a useful result if @cite{X} is an
13973 object that is aliased or of a by-reference type, or is an entity whose
13974 @cite{Address} has been specified."
13975 @end quotation
13977 Followed.  A valid address will be produced even if none of those
13978 conditions have been met.  If necessary, the object is forced into
13979 memory to ensure the address is valid.
13981 @quotation
13983 "An implementation should support @cite{Address} clauses for imported
13984 subprograms."
13985 @end quotation
13987 Followed.
13989 @quotation
13991 "Objects (including subcomponents) that are aliased or of a by-reference
13992 type should be allocated on storage element boundaries."
13993 @end quotation
13995 Followed.
13997 @quotation
13999 "If the @cite{Address} of an object is specified, or it is imported or exported,
14000 then the implementation should not perform optimizations based on
14001 assumptions of no aliases."
14002 @end quotation
14004 Followed.
14006 @geindex Alignment clauses
14008 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14009 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{21c}
14010 @section RM 13.3(29-35): Alignment Clauses
14013 @quotation
14015 "The recommended level of support for the @cite{Alignment} attribute for
14016 subtypes is:
14018 An implementation should support specified Alignments that are factors
14019 and multiples of the number of storage elements per word, subject to the
14020 following:"
14021 @end quotation
14023 Followed.
14025 @quotation
14027 "An implementation need not support specified Alignments for
14028 combinations of Sizes and Alignments that cannot be easily
14029 loaded and stored by available machine instructions."
14030 @end quotation
14032 Followed.
14034 @quotation
14036 "An implementation need not support specified Alignments that are
14037 greater than the maximum @cite{Alignment} the implementation ever returns by
14038 default."
14039 @end quotation
14041 Followed.
14043 @quotation
14045 "The recommended level of support for the @cite{Alignment} attribute for
14046 objects is:
14048 Same as above, for subtypes, but in addition:"
14049 @end quotation
14051 Followed.
14053 @quotation
14055 "For stand-alone library-level objects of statically constrained
14056 subtypes, the implementation should support all alignments
14057 supported by the target linker.  For example, page alignment is likely to
14058 be supported for such objects, but not for subtypes."
14059 @end quotation
14061 Followed.
14063 @geindex Size clauses
14065 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14066 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{21d}
14067 @section RM 13.3(42-43): Size Clauses
14070 @quotation
14072 "The recommended level of support for the @cite{Size} attribute of
14073 objects is:
14075 A @cite{Size} clause should be supported for an object if the specified
14076 @cite{Size} is at least as large as its subtype's @cite{Size}, and
14077 corresponds to a size in storage elements that is a multiple of the
14078 object's @cite{Alignment} (if the @cite{Alignment} is nonzero)."
14079 @end quotation
14081 Followed.
14083 @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
14084 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{21e}
14085 @section RM 13.3(50-56): Size Clauses
14088 @quotation
14090 "If the @cite{Size} of a subtype is specified, and allows for efficient
14091 independent addressability (see 9.10) on the target architecture, then
14092 the @cite{Size} of the following objects of the subtype should equal the
14093 @cite{Size} of the subtype:
14095 Aliased objects (including components)."
14096 @end quotation
14098 Followed.
14100 @quotation
14102 "@cite{Size} clause on a composite subtype should not affect the
14103 internal layout of components."
14104 @end quotation
14106 Followed. But note that this can be overridden by use of the implementation
14107 pragma Implicit_Packing in the case of packed arrays.
14109 @quotation
14111 "The recommended level of support for the @cite{Size} attribute of subtypes is:
14113 The @cite{Size} (if not specified) of a static discrete or fixed point
14114 subtype should be the number of bits needed to represent each value
14115 belonging to the subtype using an unbiased representation, leaving space
14116 for a sign bit only if the subtype contains negative values.  If such a
14117 subtype is a first subtype, then an implementation should support a
14118 specified @cite{Size} for it that reflects this representation."
14119 @end quotation
14121 Followed.
14123 @quotation
14125 "For a subtype implemented with levels of indirection, the @cite{Size}
14126 should include the size of the pointers, but not the size of what they
14127 point at."
14128 @end quotation
14130 Followed.
14132 @geindex Component_Size clauses
14134 @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
14135 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{21f}
14136 @section RM 13.3(71-73): Component Size Clauses
14139 @quotation
14141 "The recommended level of support for the @cite{Component_Size}
14142 attribute is:
14144 An implementation need not support specified @cite{Component_Sizes} that are
14145 less than the @cite{Size} of the component subtype."
14146 @end quotation
14148 Followed.
14150 @quotation
14152 "An implementation should support specified Component_Sizes that
14153 are factors and multiples of the word size.  For such
14154 Component_Sizes, the array should contain no gaps between
14155 components.  For other Component_Sizes (if supported), the array
14156 should contain no gaps between components when packing is also
14157 specified; the implementation should forbid this combination in cases
14158 where it cannot support a no-gaps representation."
14159 @end quotation
14161 Followed.
14163 @geindex Enumeration representation clauses
14165 @geindex Representation clauses
14166 @geindex enumeration
14168 @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
14169 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{220}
14170 @section RM 13.4(9-10): Enumeration Representation Clauses
14173 @quotation
14175 "The recommended level of support for enumeration representation clauses
14178 An implementation need not support enumeration representation clauses
14179 for boolean types, but should at minimum support the internal codes in
14180 the range @cite{System.Min_Int .. System.Max_Int}."
14181 @end quotation
14183 Followed.
14185 @geindex Record representation clauses
14187 @geindex Representation clauses
14188 @geindex records
14190 @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
14191 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{221}
14192 @section RM 13.5.1(17-22): Record Representation Clauses
14195 @quotation
14197 "The recommended level of support for
14198 @cite{record_representation_clauses} is:
14200 An implementation should support storage places that can be extracted
14201 with a load, mask, shift sequence of machine code, and set with a load,
14202 shift, mask, store sequence, given the available machine instructions
14203 and run-time model."
14204 @end quotation
14206 Followed.
14208 @quotation
14210 "A storage place should be supported if its size is equal to the
14211 @cite{Size} of the component subtype, and it starts and ends on a
14212 boundary that obeys the @cite{Alignment} of the component subtype."
14213 @end quotation
14215 Followed.
14217 @quotation
14219 "If the default bit ordering applies to the declaration of a given type,
14220 then for a component whose subtype's @cite{Size} is less than the word
14221 size, any storage place that does not cross an aligned word boundary
14222 should be supported."
14223 @end quotation
14225 Followed.
14227 @quotation
14229 "An implementation may reserve a storage place for the tag field of a
14230 tagged type, and disallow other components from overlapping that place."
14231 @end quotation
14233 Followed.  The storage place for the tag field is the beginning of the tagged
14234 record, and its size is Address'Size.  GNAT will reject an explicit component
14235 clause for the tag field.
14237 @quotation
14239 "An implementation need not support a @cite{component_clause} for a
14240 component of an extension part if the storage place is not after the
14241 storage places of all components of the parent type, whether or not
14242 those storage places had been specified."
14243 @end quotation
14245 Followed.  The above advice on record representation clauses is followed,
14246 and all mentioned features are implemented.
14248 @geindex Storage place attributes
14250 @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
14251 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{222}
14252 @section RM 13.5.2(5): Storage Place Attributes
14255 @quotation
14257 "If a component is represented using some form of pointer (such as an
14258 offset) to the actual data of the component, and this data is contiguous
14259 with the rest of the object, then the storage place attributes should
14260 reflect the place of the actual data, not the pointer.  If a component is
14261 allocated discontinuously from the rest of the object, then a warning
14262 should be generated upon reference to one of its storage place
14263 attributes."
14264 @end quotation
14266 Followed.  There are no such components in GNAT.
14268 @geindex Bit ordering
14270 @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
14271 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{223}
14272 @section RM 13.5.3(7-8): Bit Ordering
14275 @quotation
14277 "The recommended level of support for the non-default bit ordering is:
14279 If @cite{Word_Size} = @cite{Storage_Unit}, then the implementation
14280 should support the non-default bit ordering in addition to the default
14281 bit ordering."
14282 @end quotation
14284 Followed.  Word size does not equal storage size in this implementation.
14285 Thus non-default bit ordering is not supported.
14287 @geindex Address
14288 @geindex as private type
14290 @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
14291 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{224}
14292 @section RM 13.7(37): Address as Private
14295 @quotation
14297 "@cite{Address} should be of a private type."
14298 @end quotation
14300 Followed.
14302 @geindex Operations
14303 @geindex on `Address`
14305 @geindex Address
14306 @geindex operations of
14308 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14309 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{225}
14310 @section RM 13.7.1(16): Address Operations
14313 @quotation
14315 "Operations in @cite{System} and its children should reflect the target
14316 environment semantics as closely as is reasonable.  For example, on most
14317 machines, it makes sense for address arithmetic to 'wrap around'.
14318 Operations that do not make sense should raise @cite{Program_Error}."
14319 @end quotation
14321 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
14322 operation raises @cite{Program_Error}, since all operations make sense.
14324 @geindex Unchecked conversion
14326 @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
14327 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{226}
14328 @section RM 13.9(14-17): Unchecked Conversion
14331 @quotation
14333 "The @cite{Size} of an array object should not include its bounds; hence,
14334 the bounds should not be part of the converted data."
14335 @end quotation
14337 Followed.
14339 @quotation
14341 "The implementation should not generate unnecessary run-time checks to
14342 ensure that the representation of @cite{S} is a representation of the
14343 target type.  It should take advantage of the permission to return by
14344 reference when possible.  Restrictions on unchecked conversions should be
14345 avoided unless required by the target environment."
14346 @end quotation
14348 Followed.  There are no restrictions on unchecked conversion.  A warning is
14349 generated if the source and target types do not have the same size since
14350 the semantics in this case may be target dependent.
14352 @quotation
14354 "The recommended level of support for unchecked conversions is:
14356 Unchecked conversions should be supported and should be reversible in
14357 the cases where this clause defines the result.  To enable meaningful use
14358 of unchecked conversion, a contiguous representation should be used for
14359 elementary subtypes, for statically constrained array subtypes whose
14360 component subtype is one of the subtypes described in this paragraph,
14361 and for record subtypes without discriminants whose component subtypes
14362 are described in this paragraph."
14363 @end quotation
14365 Followed.
14367 @geindex Heap usage
14368 @geindex implicit
14370 @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
14371 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{227}
14372 @section RM 13.11(23-25): Implicit Heap Usage
14375 @quotation
14377 "An implementation should document any cases in which it dynamically
14378 allocates heap storage for a purpose other than the evaluation of an
14379 allocator."
14380 @end quotation
14382 Followed, the only other points at which heap storage is dynamically
14383 allocated are as follows:
14386 @itemize *
14388 @item 
14389 At initial elaboration time, to allocate dynamically sized global
14390 objects.
14392 @item 
14393 To allocate space for a task when a task is created.
14395 @item 
14396 To extend the secondary stack dynamically when needed.  The secondary
14397 stack is used for returning variable length results.
14398 @end itemize
14401 @quotation
14403 "A default (implementation-provided) storage pool for an
14404 access-to-constant type should not have overhead to support deallocation of
14405 individual objects."
14406 @end quotation
14408 Followed.
14410 @quotation
14412 "A storage pool for an anonymous access type should be created at the
14413 point of an allocator for the type, and be reclaimed when the designated
14414 object becomes inaccessible."
14415 @end quotation
14417 Followed.
14419 @geindex Unchecked deallocation
14421 @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
14422 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{228}
14423 @section RM 13.11.2(17): Unchecked Deallocation
14426 @quotation
14428 "For a standard storage pool, @cite{Free} should actually reclaim the
14429 storage."
14430 @end quotation
14432 Followed.
14434 @geindex Stream oriented attributes
14436 @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
14437 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{229}
14438 @section RM 13.13.2(17): Stream Oriented Attributes
14441 @quotation
14443 "If a stream element is the same size as a storage element, then the
14444 normal in-memory representation should be used by @cite{Read} and
14445 @cite{Write} for scalar objects.  Otherwise, @cite{Read} and @cite{Write}
14446 should use the smallest number of stream elements needed to represent
14447 all values in the base range of the scalar type."
14448 @end quotation
14450 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
14451 which specifies using the size of the first subtype.
14452 However, such an implementation is based on direct binary
14453 representations and is therefore target- and endianness-dependent.
14454 To address this issue, GNAT also supplies an alternate implementation
14455 of the stream attributes @cite{Read} and @cite{Write},
14456 which uses the target-independent XDR standard representation
14457 for scalar types.
14459 @geindex XDR representation
14461 @geindex Read attribute
14463 @geindex Write attribute
14465 @geindex Stream oriented attributes
14467 The XDR implementation is provided as an alternative body of the
14468 @cite{System.Stream_Attributes} package, in the file
14469 @code{s-stratt-xdr.adb} in the GNAT library.
14470 There is no @code{s-stratt-xdr.ads} file.
14471 In order to install the XDR implementation, do the following:
14474 @itemize *
14476 @item 
14477 Replace the default implementation of the
14478 @cite{System.Stream_Attributes} package with the XDR implementation.
14479 For example on a Unix platform issue the commands:
14481 @example
14482 $ mv s-stratt.adb s-stratt-default.adb
14483 $ mv s-stratt-xdr.adb s-stratt.adb
14484 @end example
14486 @item 
14487 Rebuild the GNAT run-time library as documented in
14488 the @cite{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14489 @end itemize
14491 @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
14492 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{22a}
14493 @section RM A.1(52): Names of Predefined Numeric Types
14496 @quotation
14498 "If an implementation provides additional named predefined integer types,
14499 then the names should end with @code{Integer} as in
14500 @code{Long_Integer}.  If an implementation provides additional named
14501 predefined floating point types, then the names should end with
14502 @code{Float} as in @code{Long_Float}."
14503 @end quotation
14505 Followed.
14507 @geindex Ada.Characters.Handling
14509 @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
14510 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{22b}
14511 @section RM A.3.2(49): @cite{Ada.Characters.Handling}
14514 @quotation
14516 "If an implementation provides a localized definition of @cite{Character}
14517 or @cite{Wide_Character}, then the effects of the subprograms in
14518 @cite{Characters.Handling} should reflect the localizations.
14519 See also 3.5.2."
14520 @end quotation
14522 Followed.  GNAT provides no such localized definitions.
14524 @geindex Bounded-length strings
14526 @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
14527 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{22c}
14528 @section RM A.4.4(106): Bounded-Length String Handling
14531 @quotation
14533 "Bounded string objects should not be implemented by implicit pointers
14534 and dynamic allocation."
14535 @end quotation
14537 Followed.  No implicit pointers or dynamic allocation are used.
14539 @geindex Random number generation
14541 @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
14542 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{22d}
14543 @section RM A.5.2(46-47): Random Number Generation
14546 @quotation
14548 "Any storage associated with an object of type @cite{Generator} should be
14549 reclaimed on exit from the scope of the object."
14550 @end quotation
14552 Followed.
14554 @quotation
14556 "If the generator period is sufficiently long in relation to the number
14557 of distinct initiator values, then each possible value of
14558 @cite{Initiator} passed to @cite{Reset} should initiate a sequence of
14559 random numbers that does not, in a practical sense, overlap the sequence
14560 initiated by any other value.  If this is not possible, then the mapping
14561 between initiator values and generator states should be a rapidly
14562 varying function of the initiator value."
14563 @end quotation
14565 Followed.  The generator period is sufficiently long for the first
14566 condition here to hold true.
14568 @geindex Get_Immediate
14570 @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
14571 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{22e}
14572 @section RM A.10.7(23): @cite{Get_Immediate}
14575 @quotation
14577 "The @cite{Get_Immediate} procedures should be implemented with
14578 unbuffered input.  For a device such as a keyboard, input should be
14579 available if a key has already been typed, whereas for a disk
14580 file, input should always be available except at end of file.  For a file
14581 associated with a keyboard-like device, any line-editing features of the
14582 underlying operating system should be disabled during the execution of
14583 @cite{Get_Immediate}."
14584 @end quotation
14586 Followed on all targets except VxWorks. For VxWorks, there is no way to
14587 provide this functionality that does not result in the input buffer being
14588 flushed before the @cite{Get_Immediate} call. A special unit
14589 @cite{Interfaces.Vxworks.IO} is provided that contains routines to enable
14590 this functionality.
14592 @geindex Export
14594 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
14595 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{22f}
14596 @section RM B.1(39-41): Pragma @cite{Export}
14599 @quotation
14601 "If an implementation supports pragma @cite{Export} to a given language,
14602 then it should also allow the main subprogram to be written in that
14603 language.  It should support some mechanism for invoking the elaboration
14604 of the Ada library units included in the system, and for invoking the
14605 finalization of the environment task.  On typical systems, the
14606 recommended mechanism is to provide two subprograms whose link names are
14607 @cite{adainit} and @cite{adafinal}.  @cite{adainit} should contain the
14608 elaboration code for library units.  @cite{adafinal} should contain the
14609 finalization code.  These subprograms should have no effect the second
14610 and subsequent time they are called."
14611 @end quotation
14613 Followed.
14615 @quotation
14617 "Automatic elaboration of pre-elaborated packages should be
14618 provided when pragma @cite{Export} is supported."
14619 @end quotation
14621 Followed when the main program is in Ada.  If the main program is in a
14622 foreign language, then
14623 @cite{adainit} must be called to elaborate pre-elaborated
14624 packages.
14626 @quotation
14628 "For each supported convention @cite{L} other than @cite{Intrinsic}, an
14629 implementation should support @cite{Import} and @cite{Export} pragmas
14630 for objects of @cite{L}-compatible types and for subprograms, and pragma
14631 @cite{Convention} for @cite{L}-eligible types and for subprograms,
14632 presuming the other language has corresponding features.  Pragma
14633 @cite{Convention} need not be supported for scalar types."
14634 @end quotation
14636 Followed.
14638 @geindex Package Interfaces
14640 @geindex Interfaces
14642 @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
14643 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{230}
14644 @section RM B.2(12-13): Package @cite{Interfaces}
14647 @quotation
14649 "For each implementation-defined convention identifier, there should be a
14650 child package of package Interfaces with the corresponding name.  This
14651 package should contain any declarations that would be useful for
14652 interfacing to the language (implementation) represented by the
14653 convention.  Any declarations useful for interfacing to any language on
14654 the given hardware architecture should be provided directly in
14655 @cite{Interfaces}."
14656 @end quotation
14658 Followed.
14660 @quotation
14662 "An implementation supporting an interface to C, COBOL, or Fortran should
14663 provide the corresponding package or packages described in the following
14664 clauses."
14665 @end quotation
14667 Followed.  GNAT provides all the packages described in this section.
14669 @geindex C
14670 @geindex interfacing with
14672 @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
14673 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{231}
14674 @section RM B.3(63-71): Interfacing with C
14677 @quotation
14679 "An implementation should support the following interface correspondences
14680 between Ada and C."
14681 @end quotation
14683 Followed.
14685 @quotation
14687 "An Ada procedure corresponds to a void-returning C function."
14688 @end quotation
14690 Followed.
14692 @quotation
14694 "An Ada function corresponds to a non-void C function."
14695 @end quotation
14697 Followed.
14699 @quotation
14701 "An Ada @cite{in} scalar parameter is passed as a scalar argument to a C
14702 function."
14703 @end quotation
14705 Followed.
14707 @quotation
14709 "An Ada @cite{in} parameter of an access-to-object type with designated
14710 type @cite{T} is passed as a @code{t*} argument to a C function,
14711 where @code{t} is the C type corresponding to the Ada type @cite{T}."
14712 @end quotation
14714 Followed.
14716 @quotation
14718 "An Ada access @cite{T} parameter, or an Ada @cite{out} or @cite{in out}
14719 parameter of an elementary type @cite{T}, is passed as a @code{t*}
14720 argument to a C function, where @code{t} is the C type corresponding to
14721 the Ada type @cite{T}.  In the case of an elementary @cite{out} or
14722 @cite{in out} parameter, a pointer to a temporary copy is used to
14723 preserve by-copy semantics."
14724 @end quotation
14726 Followed.
14728 @quotation
14730 "An Ada parameter of a record type @cite{T}, of any mode, is passed as a
14731 @code{t*} argument to a C function, where @code{t} is the C
14732 structure corresponding to the Ada type @cite{T}."
14733 @end quotation
14735 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
14736 pragma, or Convention, or by explicitly specifying the mechanism for a given
14737 call using an extended import or export pragma.
14739 @quotation
14741 "An Ada parameter of an array type with component type @cite{T}, of any
14742 mode, is passed as a @code{t*} argument to a C function, where
14743 @code{t} is the C type corresponding to the Ada type @cite{T}."
14744 @end quotation
14746 Followed.
14748 @quotation
14750 "An Ada parameter of an access-to-subprogram type is passed as a pointer
14751 to a C function whose prototype corresponds to the designated
14752 subprogram's specification."
14753 @end quotation
14755 Followed.
14757 @geindex COBOL
14758 @geindex interfacing with
14760 @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
14761 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{232}
14762 @section RM B.4(95-98): Interfacing with COBOL
14765 @quotation
14767 "An Ada implementation should support the following interface
14768 correspondences between Ada and COBOL."
14769 @end quotation
14771 Followed.
14773 @quotation
14775 "An Ada access @cite{T} parameter is passed as a @code{BY REFERENCE} data item of
14776 the COBOL type corresponding to @cite{T}."
14777 @end quotation
14779 Followed.
14781 @quotation
14783 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
14784 the corresponding COBOL type."
14785 @end quotation
14787 Followed.
14789 @quotation
14791 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
14792 COBOL type corresponding to the Ada parameter type; for scalars, a local
14793 copy is used if necessary to ensure by-copy semantics."
14794 @end quotation
14796 Followed.
14798 @geindex Fortran
14799 @geindex interfacing with
14801 @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
14802 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{233}
14803 @section RM B.5(22-26): Interfacing with Fortran
14806 @quotation
14808 "An Ada implementation should support the following interface
14809 correspondences between Ada and Fortran:"
14810 @end quotation
14812 Followed.
14814 @quotation
14816 "An Ada procedure corresponds to a Fortran subroutine."
14817 @end quotation
14819 Followed.
14821 @quotation
14823 "An Ada function corresponds to a Fortran function."
14824 @end quotation
14826 Followed.
14828 @quotation
14830 "An Ada parameter of an elementary, array, or record type @cite{T} is
14831 passed as a @cite{T} argument to a Fortran procedure, where @cite{T} is
14832 the Fortran type corresponding to the Ada type @cite{T}, and where the
14833 INTENT attribute of the corresponding dummy argument matches the Ada
14834 formal parameter mode; the Fortran implementation's parameter passing
14835 conventions are used.  For elementary types, a local copy is used if
14836 necessary to ensure by-copy semantics."
14837 @end quotation
14839 Followed.
14841 @quotation
14843 "An Ada parameter of an access-to-subprogram type is passed as a
14844 reference to a Fortran procedure whose interface corresponds to the
14845 designated subprogram's specification."
14846 @end quotation
14848 Followed.
14850 @geindex Machine operations
14852 @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
14853 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{234}
14854 @section RM C.1(3-5): Access to Machine Operations
14857 @quotation
14859 "The machine code or intrinsic support should allow access to all
14860 operations normally available to assembly language programmers for the
14861 target environment, including privileged instructions, if any."
14862 @end quotation
14864 Followed.
14866 @quotation
14868 "The interfacing pragmas (see Annex B) should support interface to
14869 assembler; the default assembler should be associated with the
14870 convention identifier @cite{Assembler}."
14871 @end quotation
14873 Followed.
14875 @quotation
14877 "If an entity is exported to assembly language, then the implementation
14878 should allocate it at an addressable location, and should ensure that it
14879 is retained by the linking process, even if not otherwise referenced
14880 from the Ada code.  The implementation should assume that any call to a
14881 machine code or assembler subprogram is allowed to read or update every
14882 object that is specified as exported."
14883 @end quotation
14885 Followed.
14887 @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
14888 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{235}
14889 @section RM C.1(10-16): Access to Machine Operations
14892 @quotation
14894 "The implementation should ensure that little or no overhead is
14895 associated with calling intrinsic and machine-code subprograms."
14896 @end quotation
14898 Followed for both intrinsics and machine-code subprograms.
14900 @quotation
14902 "It is recommended that intrinsic subprograms be provided for convenient
14903 access to any machine operations that provide special capabilities or
14904 efficiency and that are not otherwise available through the language
14905 constructs."
14906 @end quotation
14908 Followed.  A full set of machine operation intrinsic subprograms is provided.
14910 @quotation
14912 "Atomic read-modify-write operations---e.g., test and set, compare and
14913 swap, decrement and test, enqueue/dequeue."
14914 @end quotation
14916 Followed on any target supporting such operations.
14918 @quotation
14920 "Standard numeric functions---e.g.:, sin, log."
14921 @end quotation
14923 Followed on any target supporting such operations.
14925 @quotation
14927 "String manipulation operations---e.g.:, translate and test."
14928 @end quotation
14930 Followed on any target supporting such operations.
14932 @quotation
14934 "Vector operations---e.g.:, compare vector against thresholds."
14935 @end quotation
14937 Followed on any target supporting such operations.
14939 @quotation
14941 "Direct operations on I/O ports."
14942 @end quotation
14944 Followed on any target supporting such operations.
14946 @geindex Interrupt support
14948 @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
14949 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{236}
14950 @section RM C.3(28): Interrupt Support
14953 @quotation
14955 "If the @cite{Ceiling_Locking} policy is not in effect, the
14956 implementation should provide means for the application to specify which
14957 interrupts are to be blocked during protected actions, if the underlying
14958 system allows for a finer-grain control of interrupt blocking."
14959 @end quotation
14961 Followed.  The underlying system does not allow for finer-grain control
14962 of interrupt blocking.
14964 @geindex Protected procedure handlers
14966 @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
14967 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{237}
14968 @section RM C.3.1(20-21): Protected Procedure Handlers
14971 @quotation
14973 "Whenever possible, the implementation should allow interrupt handlers to
14974 be called directly by the hardware."
14975 @end quotation
14977 Followed on any target where the underlying operating system permits
14978 such direct calls.
14980 @quotation
14982 "Whenever practical, violations of any
14983 implementation-defined restrictions should be detected before run time."
14984 @end quotation
14986 Followed.  Compile time warnings are given when possible.
14988 @geindex Package `Interrupts`
14990 @geindex Interrupts
14992 @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
14993 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{238}
14994 @section RM C.3.2(25): Package @cite{Interrupts}
14997 @quotation
14999 "If implementation-defined forms of interrupt handler procedures are
15000 supported, such as protected procedures with parameters, then for each
15001 such form of a handler, a type analogous to @cite{Parameterless_Handler}
15002 should be specified in a child package of @cite{Interrupts}, with the
15003 same operations as in the predefined package Interrupts."
15004 @end quotation
15006 Followed.
15008 @geindex Pre-elaboration requirements
15010 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15011 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{239}
15012 @section RM C.4(14): Pre-elaboration Requirements
15015 @quotation
15017 "It is recommended that pre-elaborated packages be implemented in such a
15018 way that there should be little or no code executed at run time for the
15019 elaboration of entities not already covered by the Implementation
15020 Requirements."
15021 @end quotation
15023 Followed.  Executable code is generated in some cases, e.g., loops
15024 to initialize large arrays.
15026 @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
15027 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{23a}
15028 @section RM C.5(8): Pragma @cite{Discard_Names}
15031 @quotation
15033 "If the pragma applies to an entity, then the implementation should
15034 reduce the amount of storage used for storing names associated with that
15035 entity."
15036 @end quotation
15038 Followed.
15040 @geindex Package Task_Attributes
15042 @geindex Task_Attributes
15044 @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
15045 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{23b}
15046 @section RM C.7.2(30): The Package Task_Attributes
15049 @quotation
15051 "Some implementations are targeted to domains in which memory use at run
15052 time must be completely deterministic.  For such implementations, it is
15053 recommended that the storage for task attributes will be pre-allocated
15054 statically and not from the heap.  This can be accomplished by either
15055 placing restrictions on the number and the size of the task's
15056 attributes, or by using the pre-allocated storage for the first @cite{N}
15057 attribute objects, and the heap for the others.  In the latter case,
15058 @cite{N} should be documented."
15059 @end quotation
15061 Not followed.  This implementation is not targeted to such a domain.
15063 @geindex Locking Policies
15065 @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
15066 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{23c}
15067 @section RM D.3(17): Locking Policies
15070 @quotation
15072 "The implementation should use names that end with @code{_Locking} for
15073 locking policies defined by the implementation."
15074 @end quotation
15076 Followed.  Two implementation-defined locking policies are defined,
15077 whose names (@cite{Inheritance_Locking} and
15078 @cite{Concurrent_Readers_Locking}) follow this suggestion.
15080 @geindex Entry queuing policies
15082 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15083 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{23d}
15084 @section RM D.4(16): Entry Queuing Policies
15087 @quotation
15089 "Names that end with @code{_Queuing} should be used
15090 for all implementation-defined queuing policies."
15091 @end quotation
15093 Followed.  No such implementation-defined queuing policies exist.
15095 @geindex Preemptive abort
15097 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15098 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{23e}
15099 @section RM D.6(9-10): Preemptive Abort
15102 @quotation
15104 "Even though the @cite{abort_statement} is included in the list of
15105 potentially blocking operations (see 9.5.1), it is recommended that this
15106 statement be implemented in a way that never requires the task executing
15107 the @cite{abort_statement} to block."
15108 @end quotation
15110 Followed.
15112 @quotation
15114 "On a multi-processor, the delay associated with aborting a task on
15115 another processor should be bounded; the implementation should use
15116 periodic polling, if necessary, to achieve this."
15117 @end quotation
15119 Followed.
15121 @geindex Tasking restrictions
15123 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15124 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{23f}
15125 @section RM D.7(21): Tasking Restrictions
15128 @quotation
15130 "When feasible, the implementation should take advantage of the specified
15131 restrictions to produce a more efficient implementation."
15132 @end quotation
15134 GNAT currently takes advantage of these restrictions by providing an optimized
15135 run time when the Ravenscar profile and the GNAT restricted run time set
15136 of restrictions are specified.  See pragma @cite{Profile (Ravenscar)} and
15137 pragma @cite{Profile (Restricted)} for more details.
15139 @geindex Time
15140 @geindex monotonic
15142 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15143 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{240}
15144 @section RM D.8(47-49): Monotonic Time
15147 @quotation
15149 "When appropriate, implementations should provide configuration
15150 mechanisms to change the value of @cite{Tick}."
15151 @end quotation
15153 Such configuration mechanisms are not appropriate to this implementation
15154 and are thus not supported.
15156 @quotation
15158 "It is recommended that @cite{Calendar.Clock} and @cite{Real_Time.Clock}
15159 be implemented as transformations of the same time base."
15160 @end quotation
15162 Followed.
15164 @quotation
15166 "It is recommended that the best time base which exists in
15167 the underlying system be available to the application through
15168 @cite{Clock}.  @cite{Best} may mean highest accuracy or largest range."
15169 @end quotation
15171 Followed.
15173 @geindex Partition communication subsystem
15175 @geindex PCS
15177 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15178 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{241}
15179 @section RM E.5(28-29): Partition Communication Subsystem
15182 @quotation
15184 "Whenever possible, the PCS on the called partition should allow for
15185 multiple tasks to call the RPC-receiver with different messages and
15186 should allow them to block until the corresponding subprogram body
15187 returns."
15188 @end quotation
15190 Followed by GLADE, a separately supplied PCS that can be used with
15191 GNAT.
15193 @quotation
15195 "The @cite{Write} operation on a stream of type @cite{Params_Stream_Type}
15196 should raise @cite{Storage_Error} if it runs out of space trying to
15197 write the @cite{Item} into the stream."
15198 @end quotation
15200 Followed by GLADE, a separately supplied PCS that can be used with
15201 GNAT.
15203 @geindex COBOL support
15205 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15206 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{242}
15207 @section RM F(7): COBOL Support
15210 @quotation
15212 "If COBOL (respectively, C) is widely supported in the target
15213 environment, implementations supporting the Information Systems Annex
15214 should provide the child package @cite{Interfaces.COBOL} (respectively,
15215 @cite{Interfaces.C}) specified in Annex B and should support a
15216 @cite{convention_identifier} of COBOL (respectively, C) in the interfacing
15217 pragmas (see Annex B), thus allowing Ada programs to interface with
15218 programs written in that language."
15219 @end quotation
15221 Followed.
15223 @geindex Decimal radix support
15225 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15226 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{243}
15227 @section RM F.1(2): Decimal Radix Support
15230 @quotation
15232 "Packed decimal should be used as the internal representation for objects
15233 of subtype @cite{S} when @cite{S}'Machine_Radix = 10."
15234 @end quotation
15236 Not followed.  GNAT ignores @cite{S}'Machine_Radix and always uses binary
15237 representations.
15239 @geindex Numerics
15241 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15242 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{244}
15243 @section RM G: Numerics
15246 @quotation
15248 "If Fortran (respectively, C) is widely supported in the target
15249 environment, implementations supporting the Numerics Annex
15250 should provide the child package @cite{Interfaces.Fortran} (respectively,
15251 @cite{Interfaces.C}) specified in Annex B and should support a
15252 @cite{convention_identifier} of Fortran (respectively, C) in the interfacing
15253 pragmas (see Annex B), thus allowing Ada programs to interface with
15254 programs written in that language."
15255 @end quotation
15257 Followed.
15259 @geindex Complex types
15261 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15262 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{245}
15263 @section RM G.1.1(56-58): Complex Types
15266 @quotation
15268 "Because the usual mathematical meaning of multiplication of a complex
15269 operand and a real operand is that of the scaling of both components of
15270 the former by the latter, an implementation should not perform this
15271 operation by first promoting the real operand to complex type and then
15272 performing a full complex multiplication.  In systems that, in the
15273 future, support an Ada binding to IEC 559:1989, the latter technique
15274 will not generate the required result when one of the components of the
15275 complex operand is infinite.  (Explicit multiplication of the infinite
15276 component by the zero component obtained during promotion yields a NaN
15277 that propagates into the final result.) Analogous advice applies in the
15278 case of multiplication of a complex operand and a pure-imaginary
15279 operand, and in the case of division of a complex operand by a real or
15280 pure-imaginary operand."
15281 @end quotation
15283 Not followed.
15285 @quotation
15287 "Similarly, because the usual mathematical meaning of addition of a
15288 complex operand and a real operand is that the imaginary operand remains
15289 unchanged, an implementation should not perform this operation by first
15290 promoting the real operand to complex type and then performing a full
15291 complex addition.  In implementations in which the @cite{Signed_Zeros}
15292 attribute of the component type is @cite{True} (and which therefore
15293 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15294 predefined arithmetic operations), the latter technique will not
15295 generate the required result when the imaginary component of the complex
15296 operand is a negatively signed zero.  (Explicit addition of the negative
15297 zero to the zero obtained during promotion yields a positive zero.)
15298 Analogous advice applies in the case of addition of a complex operand
15299 and a pure-imaginary operand, and in the case of subtraction of a
15300 complex operand and a real or pure-imaginary operand."
15301 @end quotation
15303 Not followed.
15305 @quotation
15307 "Implementations in which @cite{Real'Signed_Zeros} is @cite{True} should
15308 attempt to provide a rational treatment of the signs of zero results and
15309 result components.  As one example, the result of the @cite{Argument}
15310 function should have the sign of the imaginary component of the
15311 parameter @cite{X} when the point represented by that parameter lies on
15312 the positive real axis; as another, the sign of the imaginary component
15313 of the @cite{Compose_From_Polar} function should be the same as
15314 (respectively, the opposite of) that of the @cite{Argument} parameter when that
15315 parameter has a value of zero and the @cite{Modulus} parameter has a
15316 nonnegative (respectively, negative) value."
15317 @end quotation
15319 Followed.
15321 @geindex Complex elementary functions
15323 @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
15324 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{246}
15325 @section RM G.1.2(49): Complex Elementary Functions
15328 @quotation
15330 "Implementations in which @cite{Complex_Types.Real'Signed_Zeros} is
15331 @cite{True} should attempt to provide a rational treatment of the signs
15332 of zero results and result components.  For example, many of the complex
15333 elementary functions have components that are odd functions of one of
15334 the parameter components; in these cases, the result component should
15335 have the sign of the parameter component at the origin.  Other complex
15336 elementary functions have zero components whose sign is opposite that of
15337 a parameter component at the origin, or is always positive or always
15338 negative."
15339 @end quotation
15341 Followed.
15343 @geindex Accuracy requirements
15345 @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
15346 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{247}
15347 @section RM G.2.4(19): Accuracy Requirements
15350 @quotation
15352 "The versions of the forward trigonometric functions without a
15353 @cite{Cycle} parameter should not be implemented by calling the
15354 corresponding version with a @cite{Cycle} parameter of
15355 @cite{2.0*Numerics.Pi}, since this will not provide the required
15356 accuracy in some portions of the domain.  For the same reason, the
15357 version of @cite{Log} without a @cite{Base} parameter should not be
15358 implemented by calling the corresponding version with a @cite{Base}
15359 parameter of @cite{Numerics.e}."
15360 @end quotation
15362 Followed.
15364 @geindex Complex arithmetic accuracy
15366 @geindex Accuracy
15367 @geindex complex arithmetic
15369 @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
15370 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{248}
15371 @section RM G.2.6(15): Complex Arithmetic Accuracy
15374 @quotation
15376 "The version of the @cite{Compose_From_Polar} function without a
15377 @cite{Cycle} parameter should not be implemented by calling the
15378 corresponding version with a @cite{Cycle} parameter of
15379 @cite{2.0*Numerics.Pi}, since this will not provide the required
15380 accuracy in some portions of the domain."
15381 @end quotation
15383 Followed.
15385 @geindex Sequential elaboration policy
15387 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15388 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{249}
15389 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15392 @quotation
15394 "If the partition elaboration policy is @cite{Sequential} and the
15395 Environment task becomes permanently blocked during elaboration then the
15396 partition is deadlocked and it is recommended that the partition be
15397 immediately terminated."
15398 @end quotation
15400 Not followed.
15402 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15403 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{24a}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{24b}
15404 @chapter Implementation Defined Characteristics
15407 In addition to the implementation dependent pragmas and attributes, and the
15408 implementation advice, there are a number of other Ada features that are
15409 potentially implementation dependent and are designated as
15410 implementation-defined. These are mentioned throughout the Ada Reference
15411 Manual, and are summarized in Annex M.
15413 A requirement for conforming Ada compilers is that they provide
15414 documentation describing how the implementation deals with each of these
15415 issues.  In this chapter you will find each point in Annex M listed,
15416 followed by a description of how GNAT
15417 handles the implementation dependence.
15419 You can use this chapter as a guide to minimizing implementation
15420 dependent features in your programs if portability to other compilers
15421 and other operating systems is an important consideration.  The numbers
15422 in each entry below correspond to the paragraph numbers in the Ada
15423 Reference Manual.
15426 @itemize *
15428 @item 
15429 "Whether or not each recommendation given in Implementation
15430 Advice is followed.  See 1.1.2(37)."
15431 @end itemize
15433 See @ref{a,,Implementation Advice}.
15436 @itemize *
15438 @item 
15439 "Capacity limitations of the implementation.  See 1.1.3(3)."
15440 @end itemize
15442 The complexity of programs that can be processed is limited only by the
15443 total amount of available virtual memory, and disk space for the
15444 generated object files.
15447 @itemize *
15449 @item 
15450 "Variations from the standard that are impractical to avoid
15451 given the implementation's execution environment.  See 1.1.3(6)."
15452 @end itemize
15454 There are no variations from the standard.
15457 @itemize *
15459 @item 
15460 "Which code_statements cause external
15461 interactions.  See 1.1.3(10)."
15462 @end itemize
15464 Any @cite{code_statement} can potentially cause external interactions.
15467 @itemize *
15469 @item 
15470 "The coded representation for the text of an Ada
15471 program.  See 2.1(4)."
15472 @end itemize
15474 See separate section on source representation.
15477 @itemize *
15479 @item 
15480 "The control functions allowed in comments.  See 2.1(14)."
15481 @end itemize
15483 See separate section on source representation.
15486 @itemize *
15488 @item 
15489 "The representation for an end of line.  See 2.2(2)."
15490 @end itemize
15492 See separate section on source representation.
15495 @itemize *
15497 @item 
15498 "Maximum supported line length and lexical element
15499 length.  See 2.2(15)."
15500 @end itemize
15502 The maximum line length is 255 characters and the maximum length of
15503 a lexical element is also 255 characters. This is the default setting
15504 if not overridden by the use of compiler switch @emph{-gnaty} (which
15505 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15506 line length to be specified to be any value up to 32767. The maximum
15507 length of a lexical element is the same as the maximum line length.
15510 @itemize *
15512 @item 
15513 "Implementation defined pragmas.  See 2.8(14)."
15514 @end itemize
15516 See @ref{7,,Implementation Defined Pragmas}.
15519 @itemize *
15521 @item 
15522 "Effect of pragma @cite{Optimize}.  See 2.8(27)."
15523 @end itemize
15525 Pragma @cite{Optimize}, if given with a @cite{Time} or @cite{Space}
15526 parameter, checks that the optimization flag is set, and aborts if it is
15527 not.
15530 @itemize *
15532 @item 
15533 "The sequence of characters of the value returned by
15534 @code{S'Image} when some of the graphic characters of
15535 @code{S'Wide_Image} are not defined in @cite{Character}.  See
15536 3.5(37)."
15537 @end itemize
15539 The sequence of characters is as defined by the wide character encoding
15540 method used for the source.  See section on source representation for
15541 further details.
15544 @itemize *
15546 @item 
15547 "The predefined integer types declared in
15548 @cite{Standard}.  See 3.5.4(25)."
15549 @end itemize
15552 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15553 @headitem
15555 Type
15557 @tab
15559 Representation
15561 @item
15563 @emph{Short_Short_Integer}
15565 @tab
15567 8 bit signed
15569 @item
15571 @emph{Short_Integer}
15573 @tab
15575 (Short) 16 bit signed
15577 @item
15579 @emph{Integer}
15581 @tab
15583 32 bit signed
15585 @item
15587 @emph{Long_Integer}
15589 @tab
15591 64 bit signed (on most 64 bit targets,
15592 depending on the C definition of long).
15593 32 bit signed (all other targets)
15595 @item
15597 @emph{Long_Long_Integer}
15599 @tab
15601 64 bit signed
15603 @end multitable
15607 @itemize *
15609 @item 
15610 "Any nonstandard integer types and the operators defined
15611 for them.  See 3.5.4(26)."
15612 @end itemize
15614 There are no nonstandard integer types.
15617 @itemize *
15619 @item 
15620 "Any nonstandard real types and the operators defined for
15621 them.  See 3.5.6(8)."
15622 @end itemize
15624 There are no nonstandard real types.
15627 @itemize *
15629 @item 
15630 "What combinations of requested decimal precision and range
15631 are supported for floating point types.  See 3.5.7(7)."
15632 @end itemize
15634 The precision and range is as defined by the IEEE standard.
15637 @itemize *
15639 @item 
15640 "The predefined floating point types declared in
15641 @cite{Standard}.  See 3.5.7(16)."
15642 @end itemize
15645 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15646 @headitem
15648 Type
15650 @tab
15652 Representation
15654 @item
15656 @emph{Short_Float}
15658 @tab
15660 32 bit IEEE short
15662 @item
15664 @emph{Float}
15666 @tab
15668 (Short) 32 bit IEEE short
15670 @item
15672 @emph{Long_Float}
15674 @tab
15676 64 bit IEEE long
15678 @item
15680 @emph{Long_Long_Float}
15682 @tab
15684 64 bit IEEE long (80 bit IEEE long on x86 processors)
15686 @end multitable
15690 @itemize *
15692 @item 
15693 "The small of an ordinary fixed point type.  See 3.5.9(8)."
15694 @end itemize
15696 @cite{Fine_Delta} is 2**(-63)
15699 @itemize *
15701 @item 
15702 "What combinations of small, range, and digits are
15703 supported for fixed point types.  See 3.5.9(10)."
15704 @end itemize
15706 Any combinations are permitted that do not result in a small less than
15707 @cite{Fine_Delta} and do not result in a mantissa larger than 63 bits.
15708 If the mantissa is larger than 53 bits on machines where Long_Long_Float
15709 is 64 bits (true of all architectures except ia32), then the output from
15710 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
15711 is because floating-point conversions are used to convert fixed point.
15714 @itemize *
15716 @item 
15717 "The result of @cite{Tags.Expanded_Name} for types declared
15718 within an unnamed @cite{block_statement}.  See 3.9(10)."
15719 @end itemize
15721 Block numbers of the form @cite{B`nnn`}, where @cite{nnn} is a
15722 decimal integer are allocated.
15725 @itemize *
15727 @item 
15728 "Implementation-defined attributes.  See 4.1.4(12)."
15729 @end itemize
15731 See @ref{8,,Implementation Defined Attributes}.
15734 @itemize *
15736 @item 
15737 "Any implementation-defined time types.  See 9.6(6)."
15738 @end itemize
15740 There are no implementation-defined time types.
15743 @itemize *
15745 @item 
15746 "The time base associated with relative delays."
15747 @end itemize
15749 See 9.6(20).  The time base used is that provided by the C library
15750 function @cite{gettimeofday}.
15753 @itemize *
15755 @item 
15756 "The time base of the type @cite{Calendar.Time}.  See
15757 9.6(23)."
15758 @end itemize
15760 The time base used is that provided by the C library function
15761 @cite{gettimeofday}.
15764 @itemize *
15766 @item 
15767 "The time zone used for package @cite{Calendar}
15768 operations.  See 9.6(24)."
15769 @end itemize
15771 The time zone used by package @cite{Calendar} is the current system time zone
15772 setting for local time, as accessed by the C library function
15773 @cite{localtime}.
15776 @itemize *
15778 @item 
15779 "Any limit on @cite{delay_until_statements} of
15780 @cite{select_statements}.  See 9.6(29)."
15781 @end itemize
15783 There are no such limits.
15786 @itemize *
15788 @item 
15789 "Whether or not two non-overlapping parts of a composite
15790 object are independently addressable, in the case where packing, record
15791 layout, or @cite{Component_Size} is specified for the object.  See
15792 9.10(1)."
15793 @end itemize
15795 Separate components are independently addressable if they do not share
15796 overlapping storage units.
15799 @itemize *
15801 @item 
15802 "The representation for a compilation.  See 10.1(2)."
15803 @end itemize
15805 A compilation is represented by a sequence of files presented to the
15806 compiler in a single invocation of the @emph{gcc} command.
15809 @itemize *
15811 @item 
15812 "Any restrictions on compilations that contain multiple
15813 compilation_units.  See 10.1(4)."
15814 @end itemize
15816 No single file can contain more than one compilation unit, but any
15817 sequence of files can be presented to the compiler as a single
15818 compilation.
15821 @itemize *
15823 @item 
15824 "The mechanisms for creating an environment and for adding
15825 and replacing compilation units.  See 10.1.4(3)."
15826 @end itemize
15828 See separate section on compilation model.
15831 @itemize *
15833 @item 
15834 "The manner of explicitly assigning library units to a
15835 partition.  See 10.2(2)."
15836 @end itemize
15838 If a unit contains an Ada main program, then the Ada units for the partition
15839 are determined by recursive application of the rules in the Ada Reference
15840 Manual section 10.2(2-6).  In other words, the Ada units will be those that
15841 are needed by the main program, and then this definition of need is applied
15842 recursively to those units, and the partition contains the transitive
15843 closure determined by this relationship.  In short, all the necessary units
15844 are included, with no need to explicitly specify the list.  If additional
15845 units are required, e.g., by foreign language units, then all units must be
15846 mentioned in the context clause of one of the needed Ada units.
15848 If the partition contains no main program, or if the main program is in
15849 a language other than Ada, then GNAT
15850 provides the binder options @emph{-z} and @emph{-n} respectively, and in
15851 this case a list of units can be explicitly supplied to the binder for
15852 inclusion in the partition (all units needed by these units will also
15853 be included automatically).  For full details on the use of these
15854 options, refer to the @cite{GNAT Make Program gnatmake} in the
15855 @cite{GNAT User's Guide}.
15858 @itemize *
15860 @item 
15861 "The implementation-defined means, if any, of specifying
15862 which compilation units are needed by a given compilation unit.  See
15863 10.2(2)."
15864 @end itemize
15866 The units needed by a given compilation unit are as defined in
15867 the Ada Reference Manual section 10.2(2-6).  There are no
15868 implementation-defined pragmas or other implementation-defined
15869 means for specifying needed units.
15872 @itemize *
15874 @item 
15875 "The manner of designating the main subprogram of a
15876 partition.  See 10.2(7)."
15877 @end itemize
15879 The main program is designated by providing the name of the
15880 corresponding @code{ALI} file as the input parameter to the binder.
15883 @itemize *
15885 @item 
15886 "The order of elaboration of @cite{library_items}.  See
15887 10.2(18)."
15888 @end itemize
15890 The first constraint on ordering is that it meets the requirements of
15891 Chapter 10 of the Ada Reference Manual.  This still leaves some
15892 implementation dependent choices, which are resolved by first
15893 elaborating bodies as early as possible (i.e., in preference to specs
15894 where there is a choice), and second by evaluating the immediate with
15895 clauses of a unit to determine the probably best choice, and
15896 third by elaborating in alphabetical order of unit names
15897 where a choice still remains.
15900 @itemize *
15902 @item 
15903 "Parameter passing and function return for the main
15904 subprogram.  See 10.2(21)."
15905 @end itemize
15907 The main program has no parameters.  It may be a procedure, or a function
15908 returning an integer type.  In the latter case, the returned integer
15909 value is the return code of the program (overriding any value that
15910 may have been set by a call to @cite{Ada.Command_Line.Set_Exit_Status}).
15913 @itemize *
15915 @item 
15916 "The mechanisms for building and running partitions.  See
15917 10.2(24)."
15918 @end itemize
15920 GNAT itself supports programs with only a single partition.  The GNATDIST
15921 tool provided with the GLADE package (which also includes an implementation
15922 of the PCS) provides a completely flexible method for building and running
15923 programs consisting of multiple partitions.  See the separate GLADE manual
15924 for details.
15927 @itemize *
15929 @item 
15930 "The details of program execution, including program
15931 termination.  See 10.2(25)."
15932 @end itemize
15934 See separate section on compilation model.
15937 @itemize *
15939 @item 
15940 "The semantics of any non-active partitions supported by the
15941 implementation.  See 10.2(28)."
15942 @end itemize
15944 Passive partitions are supported on targets where shared memory is
15945 provided by the operating system.  See the GLADE reference manual for
15946 further details.
15949 @itemize *
15951 @item 
15952 "The information returned by @cite{Exception_Message}.  See
15953 11.4.1(10)."
15954 @end itemize
15956 Exception message returns the null string unless a specific message has
15957 been passed by the program.
15960 @itemize *
15962 @item 
15963 "The result of @cite{Exceptions.Exception_Name} for types
15964 declared within an unnamed @cite{block_statement}.  See 11.4.1(12)."
15965 @end itemize
15967 Blocks have implementation defined names of the form @cite{B`nnn`}
15968 where @cite{nnn} is an integer.
15971 @itemize *
15973 @item 
15974 "The information returned by
15975 @cite{Exception_Information}.  See 11.4.1(13)."
15976 @end itemize
15978 @cite{Exception_Information} returns a string in the following format:
15980 @example
15981 *Exception_Name:* nnnnn
15982 *Message:* mmmmm
15983 *PID:* ppp
15984 *Load address:* 0xhhhh
15985 *Call stack traceback locations:*
15986 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
15987 @end example
15989 where
15991 @quotation
15994 @itemize *
15996 @item 
15997 @cite{nnnn} is the fully qualified name of the exception in all upper
15998 case letters. This line is always present.
16000 @item 
16001 @cite{mmmm} is the message (this line present only if message is non-null)
16003 @item 
16004 @cite{ppp} is the Process Id value as a decimal integer (this line is
16005 present only if the Process Id is nonzero). Currently we are
16006 not making use of this field.
16008 @item 
16009 The Load address line, the Call stack traceback locations line and the
16010 following values are present only if at least one traceback location was
16011 recorded. The Load address indicates the address at which the main executable
16012 was loaded; this line may not be present if operating system hasn't relocated
16013 the main executable. The values are given in C style format, with lower case
16014 letters for a-f, and only as many digits present as are necessary.
16015 The line terminator sequence at the end of each line, including
16016 the last line is a single @cite{LF} character (@cite{16#0A#}).
16017 @end itemize
16018 @end quotation
16021 @itemize *
16023 @item 
16024 "Implementation-defined check names.  See 11.5(27)."
16025 @end itemize
16027 The implementation defined check names include Alignment_Check,
16028 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16029 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16030 program can add implementation-defined check names by means of the pragma
16031 Check_Name. See the description of pragma @cite{Suppress} for full details.
16034 @itemize *
16036 @item 
16037 "The interpretation of each aspect of representation.  See
16038 13.1(20)."
16039 @end itemize
16041 See separate section on data representations.
16044 @itemize *
16046 @item 
16047 "Any restrictions placed upon representation items.  See
16048 13.1(20)."
16049 @end itemize
16051 See separate section on data representations.
16054 @itemize *
16056 @item 
16057 "The meaning of @cite{Size} for indefinite subtypes.  See
16058 13.3(48)."
16059 @end itemize
16061 Size for an indefinite subtype is the maximum possible size, except that
16062 for the case of a subprogram parameter, the size of the parameter object
16063 is the actual size.
16066 @itemize *
16068 @item 
16069 "The default external representation for a type tag.  See
16070 13.3(75)."
16071 @end itemize
16073 The default external representation for a type tag is the fully expanded
16074 name of the type in upper case letters.
16077 @itemize *
16079 @item 
16080 "What determines whether a compilation unit is the same in
16081 two different partitions.  See 13.3(76)."
16082 @end itemize
16084 A compilation unit is the same in two different partitions if and only
16085 if it derives from the same source file.
16088 @itemize *
16090 @item 
16091 "Implementation-defined components.  See 13.5.1(15)."
16092 @end itemize
16094 The only implementation defined component is the tag for a tagged type,
16095 which contains a pointer to the dispatching table.
16098 @itemize *
16100 @item 
16101 "If @cite{Word_Size} = @cite{Storage_Unit}, the default bit
16102 ordering.  See 13.5.3(5)."
16103 @end itemize
16105 @cite{Word_Size} (32) is not the same as @cite{Storage_Unit} (8) for this
16106 implementation, so no non-default bit ordering is supported.  The default
16107 bit ordering corresponds to the natural endianness of the target architecture.
16110 @itemize *
16112 @item 
16113 "The contents of the visible part of package @cite{System}
16114 and its language-defined children.  See 13.7(2)."
16115 @end itemize
16117 See the definition of these packages in files @code{system.ads} and
16118 @code{s-stoele.ads}. Note that two declarations are added to package
16119 System.
16121 @example
16122 Max_Priority           : constant Positive := Priority'Last;
16123 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16124 @end example
16127 @itemize *
16129 @item 
16130 "The contents of the visible part of package
16131 @cite{System.Machine_Code}, and the meaning of
16132 @cite{code_statements}.  See 13.8(7)."
16133 @end itemize
16135 See the definition and documentation in file @code{s-maccod.ads}.
16138 @itemize *
16140 @item 
16141 "The effect of unchecked conversion.  See 13.9(11)."
16142 @end itemize
16144 Unchecked conversion between types of the same size
16145 results in an uninterpreted transmission of the bits from one type
16146 to the other.  If the types are of unequal sizes, then in the case of
16147 discrete types, a shorter source is first zero or sign extended as
16148 necessary, and a shorter target is simply truncated on the left.
16149 For all non-discrete types, the source is first copied if necessary
16150 to ensure that the alignment requirements of the target are met, then
16151 a pointer is constructed to the source value, and the result is obtained
16152 by dereferencing this pointer after converting it to be a pointer to the
16153 target type. Unchecked conversions where the target subtype is an
16154 unconstrained array are not permitted. If the target alignment is
16155 greater than the source alignment, then a copy of the result is
16156 made with appropriate alignment
16159 @itemize *
16161 @item 
16162 "The semantics of operations on invalid representations.
16163 See 13.9.2(10-11)."
16164 @end itemize
16166 For assignments and other operations where the use of invalid values cannot
16167 result in erroneous behavior, the compiler ignores the possibility of invalid
16168 values. An exception is raised at the point where an invalid value would
16169 result in erroneous behavior. For example executing:
16171 @example
16172 procedure invalidvals is
16173   X : Integer := -1;
16174   Y : Natural range 1 .. 10;
16175   for Y'Address use X'Address;
16176   Z : Natural range 1 .. 10;
16177   A : array (Natural range 1 .. 10) of Integer;
16178 begin
16179   Z := Y;     -- no exception
16180   A (Z) := 3; -- exception raised;
16181 end;
16182 @end example
16184 As indicated, an exception is raised on the array assignment, but not
16185 on the simple assignment of the invalid negative value from Y to Z.
16188 @itemize *
16190 @item 
16191 "The manner of choosing a storage pool for an access type
16192 when @cite{Storage_Pool} is not specified for the type.  See 13.11(17)."
16193 @end itemize
16195 There are 3 different standard pools used by the compiler when
16196 @cite{Storage_Pool} is not specified depending whether the type is local
16197 to a subprogram or defined at the library level and whether
16198 @cite{Storage_Size`is specified or not. See documentation in the runtime library units `System.Pool_Global}, @cite{System.Pool_Size} and
16199 @cite{System.Pool_Local} in files @code{s-poosiz.ads},
16200 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16201 default pools used.
16204 @itemize *
16206 @item 
16207 "Whether or not the implementation provides user-accessible
16208 names for the standard pool type(s).  See 13.11(17)."
16209 @end itemize
16211 See documentation in the sources of the run time mentioned in the previous
16212 paragraph.  All these pools are accessible by means of @cite{with}'ing
16213 these units.
16216 @itemize *
16218 @item 
16219 "The meaning of @cite{Storage_Size}.  See 13.11(18)."
16220 @end itemize
16222 @cite{Storage_Size} is measured in storage units, and refers to the
16223 total space available for an access type collection, or to the primary
16224 stack space for a task.
16227 @itemize *
16229 @item 
16230 "Implementation-defined aspects of storage pools.  See
16231 13.11(22)."
16232 @end itemize
16234 See documentation in the sources of the run time mentioned in the
16235 paragraph about standard storage pools above
16236 for details on GNAT-defined aspects of storage pools.
16239 @itemize *
16241 @item 
16242 "The set of restrictions allowed in a pragma
16243 @cite{Restrictions}.  See 13.12(7)."
16244 @end itemize
16246 See @ref{9,,Standard and Implementation Defined Restrictions}.
16249 @itemize *
16251 @item 
16252 "The consequences of violating limitations on
16253 @cite{Restrictions} pragmas.  See 13.12(9)."
16254 @end itemize
16256 Restrictions that can be checked at compile time result in illegalities
16257 if violated.  Currently there are no other consequences of violating
16258 restrictions.
16261 @itemize *
16263 @item 
16264 "The representation used by the @cite{Read} and
16265 @cite{Write} attributes of elementary types in terms of stream
16266 elements.  See 13.13.2(9)."
16267 @end itemize
16269 The representation is the in-memory representation of the base type of
16270 the type, using the number of bits corresponding to the
16271 @code{type'Size} value, and the natural ordering of the machine.
16274 @itemize *
16276 @item 
16277 "The names and characteristics of the numeric subtypes
16278 declared in the visible part of package @cite{Standard}.  See A.1(3)."
16279 @end itemize
16281 See items describing the integer and floating-point types supported.
16284 @itemize *
16286 @item 
16287 "The string returned by @cite{Character_Set_Version}.
16288 See A.3.5(3)."
16289 @end itemize
16291 @cite{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16292 the string "Unicode 4.0", referring to version 4.0 of the
16293 Unicode specification.
16296 @itemize *
16298 @item 
16299 "The accuracy actually achieved by the elementary
16300 functions.  See A.5.1(1)."
16301 @end itemize
16303 The elementary functions correspond to the functions available in the C
16304 library.  Only fast math mode is implemented.
16307 @itemize *
16309 @item 
16310 "The sign of a zero result from some of the operators or
16311 functions in @cite{Numerics.Generic_Elementary_Functions}, when
16312 @cite{Float_Type'Signed_Zeros} is @cite{True}.  See A.5.1(46)."
16313 @end itemize
16315 The sign of zeroes follows the requirements of the IEEE 754 standard on
16316 floating-point.
16319 @itemize *
16321 @item 
16322 "The value of
16323 @cite{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27)."
16324 @end itemize
16326 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16329 @itemize *
16331 @item 
16332 "The value of
16333 @cite{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27)."
16334 @end itemize
16336 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16339 @itemize *
16341 @item 
16342 "The algorithms for random number generation.  See
16343 A.5.2(32)."
16344 @end itemize
16346 The algorithm is the Mersenne Twister, as documented in the source file
16347 @code{s-rannum.adb}. This version of the algorithm has a period of
16348 2**19937-1.
16351 @itemize *
16353 @item 
16354 "The string representation of a random number generator's
16355 state.  See A.5.2(38)."
16356 @end itemize
16358 The value returned by the Image function is the concatenation of
16359 the fixed-width decimal representations of the 624 32-bit integers
16360 of the state vector.
16363 @itemize *
16365 @item 
16366 "The minimum time interval between calls to the
16367 time-dependent Reset procedure that are guaranteed to initiate different
16368 random number sequences.  See A.5.2(45)."
16369 @end itemize
16371 The minimum period between reset calls to guarantee distinct series of
16372 random numbers is one microsecond.
16375 @itemize *
16377 @item 
16378 "The values of the @cite{Model_Mantissa},
16379 @cite{Model_Emin}, @cite{Model_Epsilon}, @cite{Model},
16380 @cite{Safe_First}, and @cite{Safe_Last} attributes, if the Numerics
16381 Annex is not supported.  See A.5.3(72)."
16382 @end itemize
16384 Run the compiler with @emph{-gnatS} to produce a listing of package
16385 @cite{Standard}, has the values of all numeric attributes.
16388 @itemize *
16390 @item 
16391 "Any implementation-defined characteristics of the
16392 input-output packages.  See A.7(14)."
16393 @end itemize
16395 There are no special implementation defined characteristics for these
16396 packages.
16399 @itemize *
16401 @item 
16402 "The value of @cite{Buffer_Size} in @cite{Storage_IO}.  See
16403 A.9(10)."
16404 @end itemize
16406 All type representations are contiguous, and the @cite{Buffer_Size} is
16407 the value of @code{type'Size} rounded up to the next storage unit
16408 boundary.
16411 @itemize *
16413 @item 
16414 "External files for standard input, standard output, and
16415 standard error See A.10(5)."
16416 @end itemize
16418 These files are mapped onto the files provided by the C streams
16419 libraries.  See source file @code{i-cstrea.ads} for further details.
16422 @itemize *
16424 @item 
16425 "The accuracy of the value produced by @cite{Put}.  See
16426 A.10.9(36)."
16427 @end itemize
16429 If more digits are requested in the output than are represented by the
16430 precision of the value, zeroes are output in the corresponding least
16431 significant digit positions.
16434 @itemize *
16436 @item 
16437 "The meaning of @cite{Argument_Count}, @cite{Argument}, and
16438 @cite{Command_Name}.  See A.15(1)."
16439 @end itemize
16441 These are mapped onto the @cite{argv} and @cite{argc} parameters of the
16442 main program in the natural manner.
16445 @itemize *
16447 @item 
16448 "The interpretation of the @cite{Form} parameter in procedure
16449 @cite{Create_Directory}.  See A.16(56)."
16450 @end itemize
16452 The @cite{Form} parameter is not used.
16455 @itemize *
16457 @item 
16458 "The interpretation of the @cite{Form} parameter in procedure
16459 @cite{Create_Path}.  See A.16(60)."
16460 @end itemize
16462 The @cite{Form} parameter is not used.
16465 @itemize *
16467 @item 
16468 "The interpretation of the @cite{Form} parameter in procedure
16469 @cite{Copy_File}.  See A.16(68)."
16470 @end itemize
16472 The @cite{Form} parameter is case-insensitive.
16473 Two fields are recognized in the @cite{Form} parameter:
16475 @example
16476 *preserve=<value>*
16477 *mode=<value>*
16478 @end example
16480 <value> starts immediately after the character '=' and ends with the
16481 character immediately preceding the next comma (',') or with the last
16482 character of the parameter.
16484 The only possible values for preserve= are:
16487 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16488 @headitem
16490 Value
16492 @tab
16494 Meaning
16496 @item
16498 @emph{no_attributes}
16500 @tab
16502 Do not try to preserve any file attributes. This is the
16503 default if no preserve= is found in Form.
16505 @item
16507 @emph{all_attributes}
16509 @tab
16511 Try to preserve all file attributes (timestamps, access rights).
16513 @item
16515 @emph{timestamps}
16517 @tab
16519 Preserve the timestamp of the copied file, but not the other
16520 file attributes.
16522 @end multitable
16525 The only possible values for mode= are:
16528 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16529 @headitem
16531 Value
16533 @tab
16535 Meaning
16537 @item
16539 @emph{copy}
16541 @tab
16543 Only do the copy if the destination file does not already exist.
16544 If it already exists, Copy_File fails.
16546 @item
16548 @emph{overwrite}
16550 @tab
16552 Copy the file in all cases. Overwrite an already existing destination file.
16554 @item
16556 @emph{append}
16558 @tab
16560 Append the original file to the destination file. If the destination file
16561 does not exist, the destination file is a copy of the source file.
16562 When mode=append, the field preserve=, if it exists, is not taken into account.
16564 @end multitable
16567 If the Form parameter includes one or both of the fields and the value or
16568 values are incorrect, Copy_file fails with Use_Error.
16570 Examples of correct Forms:
16572 @example
16573 Form => "preserve=no_attributes,mode=overwrite" (the default)
16574 Form => "mode=append"
16575 Form => "mode=copy, preserve=all_attributes"
16576 @end example
16578 Examples of incorrect Forms:
16580 @example
16581 Form => "preserve=junk"
16582 Form => "mode=internal, preserve=timestamps"
16583 @end example
16586 @itemize *
16588 @item 
16589 "The interpretation of the @cite{Pattern} parameter, when not the null string,
16590 in the @cite{Start_Search} and @cite{Search} procedures.
16591 See A.16(104) and A.16(112)."
16592 @end itemize
16594 When the @cite{Pattern} parameter is not the null string, it is interpreted
16595 according to the syntax of regular expressions as defined in the
16596 @cite{GNAT.Regexp} package.
16598 See @ref{24c,,GNAT.Regexp (g-regexp.ads)}.
16601 @itemize *
16603 @item 
16604 "Implementation-defined convention names.  See B.1(11)."
16605 @end itemize
16607 The following convention names are supported
16610 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16611 @headitem
16613 Convention Name
16615 @tab
16617 Interpretation
16619 @item
16621 @emph{Ada}
16623 @tab
16627 @item
16629 @emph{Ada_Pass_By_Copy}
16631 @tab
16633 Allowed for any types except by-reference types such as limited
16634 records. Compatible with convention Ada, but causes any parameters
16635 with this convention to be passed by copy.
16637 @item
16639 @emph{Ada_Pass_By_Reference}
16641 @tab
16643 Allowed for any types except by-copy types such as scalars.
16644 Compatible with convention Ada, but causes any parameters
16645 with this convention to be passed by reference.
16647 @item
16649 @emph{Assembler}
16651 @tab
16653 Assembly language
16655 @item
16657 @emph{Asm}
16659 @tab
16661 Synonym for Assembler
16663 @item
16665 @emph{Assembly}
16667 @tab
16669 Synonym for Assembler
16671 @item
16673 @emph{C}
16675 @tab
16679 @item
16681 @emph{C_Pass_By_Copy}
16683 @tab
16685 Allowed only for record types, like C, but also notes that record
16686 is to be passed by copy rather than reference.
16688 @item
16690 @emph{COBOL}
16692 @tab
16694 COBOL
16696 @item
16698 @emph{C_Plus_Plus (or CPP)}
16700 @tab
16704 @item
16706 @emph{Default}
16708 @tab
16710 Treated the same as C
16712 @item
16714 @emph{External}
16716 @tab
16718 Treated the same as C
16720 @item
16722 @emph{Fortran}
16724 @tab
16726 Fortran
16728 @item
16730 @emph{Intrinsic}
16732 @tab
16734 For support of pragma @cite{Import} with convention Intrinsic, see
16735 separate section on Intrinsic Subprograms.
16737 @item
16739 @emph{Stdcall}
16741 @tab
16743 Stdcall (used for Windows implementations only).  This convention correspond
16744 to the WINAPI (previously called Pascal convention) C/C++ convention under
16745 Windows.  A routine with this convention cleans the stack before
16746 exit. This pragma cannot be applied to a dispatching call.
16748 @item
16750 @emph{DLL}
16752 @tab
16754 Synonym for Stdcall
16756 @item
16758 @emph{Win32}
16760 @tab
16762 Synonym for Stdcall
16764 @item
16766 @emph{Stubbed}
16768 @tab
16770 Stubbed is a special convention used to indicate that the body of the
16771 subprogram will be entirely ignored.  Any call to the subprogram
16772 is converted into a raise of the @cite{Program_Error} exception.  If a
16773 pragma @cite{Import} specifies convention @cite{stubbed} then no body need
16774 be present at all.  This convention is useful during development for the
16775 inclusion of subprograms whose body has not yet been written.
16776 In addition, all otherwise unrecognized convention names are also
16777 treated as being synonymous with convention C.  In all implementations
16778 except for VMS, use of such other names results in a warning.  In VMS
16779 implementations, these names are accepted silently.
16781 @end multitable
16785 @itemize *
16787 @item 
16788 "The meaning of link names.  See B.1(36)."
16789 @end itemize
16791 Link names are the actual names used by the linker.
16794 @itemize *
16796 @item 
16797 "The manner of choosing link names when neither the link
16798 name nor the address of an imported or exported entity is specified.  See
16799 B.1(36)."
16800 @end itemize
16802 The default linker name is that which would be assigned by the relevant
16803 external language, interpreting the Ada name as being in all lower case
16804 letters.
16807 @itemize *
16809 @item 
16810 "The effect of pragma @cite{Linker_Options}.  See B.1(37)."
16811 @end itemize
16813 The string passed to @cite{Linker_Options} is presented uninterpreted as
16814 an argument to the link command, unless it contains ASCII.NUL characters.
16815 NUL characters if they appear act as argument separators, so for example
16817 @example
16818 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
16819 @end example
16821 causes two separate arguments @cite{-labc} and @cite{-ldef} to be passed to the
16822 linker. The order of linker options is preserved for a given unit. The final
16823 list of options passed to the linker is in reverse order of the elaboration
16824 order. For example, linker options for a body always appear before the options
16825 from the corresponding package spec.
16828 @itemize *
16830 @item 
16831 "The contents of the visible part of package
16832 @cite{Interfaces} and its language-defined descendants.  See B.2(1)."
16833 @end itemize
16835 See files with prefix @code{i-} in the distributed library.
16838 @itemize *
16840 @item 
16841 "Implementation-defined children of package
16842 @cite{Interfaces}.  The contents of the visible part of package
16843 @cite{Interfaces}.  See B.2(11)."
16844 @end itemize
16846 See files with prefix @code{i-} in the distributed library.
16849 @itemize *
16851 @item 
16852 "The types @cite{Floating}, @cite{Long_Floating},
16853 @cite{Binary}, @cite{Long_Binary}, @cite{Decimal_ Element}, and
16854 @cite{COBOL_Character}; and the initialization of the variables
16855 @cite{Ada_To_COBOL} and @cite{COBOL_To_Ada}, in
16856 @cite{Interfaces.COBOL}.  See B.4(50)."
16857 @end itemize
16860 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16861 @headitem
16863 COBOL
16865 @tab
16869 @item
16871 @emph{Floating}
16873 @tab
16875 Float
16877 @item
16879 @emph{Long_Floating}
16881 @tab
16883 (Floating) Long_Float
16885 @item
16887 @emph{Binary}
16889 @tab
16891 Integer
16893 @item
16895 @emph{Long_Binary}
16897 @tab
16899 Long_Long_Integer
16901 @item
16903 @emph{Decimal_Element}
16905 @tab
16907 Character
16909 @item
16911 @emph{COBOL_Character}
16913 @tab
16915 Character
16917 @end multitable
16920 For initialization, see the file @code{i-cobol.ads} in the distributed library.
16923 @itemize *
16925 @item 
16926 "Support for access to machine instructions.  See C.1(1)."
16927 @end itemize
16929 See documentation in file @code{s-maccod.ads} in the distributed library.
16932 @itemize *
16934 @item 
16935 "Implementation-defined aspects of access to machine
16936 operations.  See C.1(9)."
16937 @end itemize
16939 See documentation in file @code{s-maccod.ads} in the distributed library.
16942 @itemize *
16944 @item 
16945 "Implementation-defined aspects of interrupts.  See C.3(2)."
16946 @end itemize
16948 Interrupts are mapped to signals or conditions as appropriate.  See
16949 definition of unit
16950 @cite{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
16951 on the interrupts supported on a particular target.
16954 @itemize *
16956 @item 
16957 "Implementation-defined aspects of pre-elaboration.  See
16958 C.4(13)."
16959 @end itemize
16961 GNAT does not permit a partition to be restarted without reloading,
16962 except under control of the debugger.
16965 @itemize *
16967 @item 
16968 "The semantics of pragma @cite{Discard_Names}.  See C.5(7)."
16969 @end itemize
16971 Pragma @cite{Discard_Names} causes names of enumeration literals to
16972 be suppressed.  In the presence of this pragma, the Image attribute
16973 provides the image of the Pos of the literal, and Value accepts
16974 Pos values.
16977 @itemize *
16979 @item 
16980 "The result of the @cite{Task_Identification.Image}
16981 attribute.  See C.7.1(7)."
16982 @end itemize
16984 The result of this attribute is a string that identifies
16985 the object or component that denotes a given task. If a variable @cite{Var}
16986 has a task type, the image for this task will have the form @cite{Var_`XXXXXXXX`},
16987 where the suffix
16988 is the hexadecimal representation of the virtual address of the corresponding
16989 task control block. If the variable is an array of tasks, the image of each
16990 task will have the form of an indexed component indicating the position of a
16991 given task in the array, e.g., @cite{Group(5)_`XXXXXXX`}. If the task is a
16992 component of a record, the image of the task will have the form of a selected
16993 component. These rules are fully recursive, so that the image of a task that
16994 is a subcomponent of a composite object corresponds to the expression that
16995 designates this task.
16997 If a task is created by an allocator, its image depends on the context. If the
16998 allocator is part of an object declaration, the rules described above are used
16999 to construct its image, and this image is not affected by subsequent
17000 assignments. If the allocator appears within an expression, the image
17001 includes only the name of the task type.
17003 If the configuration pragma Discard_Names is present, or if the restriction
17004 No_Implicit_Heap_Allocation is in effect,  the image reduces to
17005 the numeric suffix, that is to say the hexadecimal representation of the
17006 virtual address of the control block of the task.
17009 @itemize *
17011 @item 
17012 "The value of @cite{Current_Task} when in a protected entry
17013 or interrupt handler.  See C.7.1(17)."
17014 @end itemize
17016 Protected entries or interrupt handlers can be executed by any
17017 convenient thread, so the value of @cite{Current_Task} is undefined.
17020 @itemize *
17022 @item 
17023 "The effect of calling @cite{Current_Task} from an entry
17024 body or interrupt handler.  See C.7.1(19)."
17025 @end itemize
17027 The effect of calling @cite{Current_Task} from an entry body or
17028 interrupt handler is to return the identification of the task currently
17029 executing the code.
17032 @itemize *
17034 @item 
17035 "Implementation-defined aspects of
17036 @cite{Task_Attributes}.  See C.7.2(19)."
17037 @end itemize
17039 There are no implementation-defined aspects of @cite{Task_Attributes}.
17042 @itemize *
17044 @item 
17045 "Values of all @cite{Metrics}.  See D(2)."
17046 @end itemize
17048 The metrics information for GNAT depends on the performance of the
17049 underlying operating system.  The sources of the run-time for tasking
17050 implementation, together with the output from @emph{-gnatG} can be
17051 used to determine the exact sequence of operating systems calls made
17052 to implement various tasking constructs.  Together with appropriate
17053 information on the performance of the underlying operating system,
17054 on the exact target in use, this information can be used to determine
17055 the required metrics.
17058 @itemize *
17060 @item 
17061 "The declarations of @cite{Any_Priority} and
17062 @cite{Priority}.  See D.1(11)."
17063 @end itemize
17065 See declarations in file @code{system.ads}.
17068 @itemize *
17070 @item 
17071 "Implementation-defined execution resources.  See D.1(15)."
17072 @end itemize
17074 There are no implementation-defined execution resources.
17077 @itemize *
17079 @item 
17080 "Whether, on a multiprocessor, a task that is waiting for
17081 access to a protected object keeps its processor busy.  See D.2.1(3)."
17082 @end itemize
17084 On a multi-processor, a task that is waiting for access to a protected
17085 object does not keep its processor busy.
17088 @itemize *
17090 @item 
17091 "The affect of implementation defined execution resources
17092 on task dispatching.  See D.2.1(9)."
17093 @end itemize
17095 Tasks map to threads in the threads package used by GNAT.  Where possible
17096 and appropriate, these threads correspond to native threads of the
17097 underlying operating system.
17100 @itemize *
17102 @item 
17103 "Implementation-defined @cite{policy_identifiers} allowed
17104 in a pragma @cite{Task_Dispatching_Policy}.  See D.2.2(3)."
17105 @end itemize
17107 There are no implementation-defined policy-identifiers allowed in this
17108 pragma.
17111 @itemize *
17113 @item 
17114 "Implementation-defined aspects of priority inversion.  See
17115 D.2.2(16)."
17116 @end itemize
17118 Execution of a task cannot be preempted by the implementation processing
17119 of delay expirations for lower priority tasks.
17122 @itemize *
17124 @item 
17125 "Implementation-defined task dispatching.  See D.2.2(18)."
17126 @end itemize
17128 The policy is the same as that of the underlying threads implementation.
17131 @itemize *
17133 @item 
17134 "Implementation-defined @cite{policy_identifiers} allowed
17135 in a pragma @cite{Locking_Policy}.  See D.3(4)."
17136 @end itemize
17138 The two implementation defined policies permitted in GNAT are
17139 @cite{Inheritance_Locking} and  @cite{Concurrent_Readers_Locking}. On
17140 targets that support the @cite{Inheritance_Locking} policy, locking is
17141 implemented by inheritance, i.e., the task owning the lock operates
17142 at a priority equal to the highest priority of any task currently
17143 requesting the lock. On targets that support the
17144 @cite{Concurrent_Readers_Locking} policy, locking is implemented with a
17145 read/write lock allowing multiple protected object functions to enter
17146 concurrently.
17149 @itemize *
17151 @item 
17152 "Default ceiling priorities.  See D.3(10)."
17153 @end itemize
17155 The ceiling priority of protected objects of the type
17156 @cite{System.Interrupt_Priority'Last} as described in the Ada
17157 Reference Manual D.3(10),
17160 @itemize *
17162 @item 
17163 "The ceiling of any protected object used internally by
17164 the implementation.  See D.3(16)."
17165 @end itemize
17167 The ceiling priority of internal protected objects is
17168 @cite{System.Priority'Last}.
17171 @itemize *
17173 @item 
17174 "Implementation-defined queuing policies.  See D.4(1)."
17175 @end itemize
17177 There are no implementation-defined queuing policies.
17180 @itemize *
17182 @item 
17183 "On a multiprocessor, any conditions that cause the
17184 completion of an aborted construct to be delayed later than what is
17185 specified for a single processor.  See D.6(3)."
17186 @end itemize
17188 The semantics for abort on a multi-processor is the same as on a single
17189 processor, there are no further delays.
17192 @itemize *
17194 @item 
17195 "Any operations that implicitly require heap storage
17196 allocation.  See D.7(8)."
17197 @end itemize
17199 The only operation that implicitly requires heap storage allocation is
17200 task creation.
17203 @itemize *
17205 @item 
17206 "What happens when a task terminates in the presence of
17207 pragma @cite{No_Task_Termination}. See D.7(15)."
17208 @end itemize
17210 Execution is erroneous in that case.
17213 @itemize *
17215 @item 
17216 "Implementation-defined aspects of pragma
17217 @cite{Restrictions}.  See D.7(20)."
17218 @end itemize
17220 There are no such implementation-defined aspects.
17223 @itemize *
17225 @item 
17226 "Implementation-defined aspects of package
17227 @cite{Real_Time}.  See D.8(17)."
17228 @end itemize
17230 There are no implementation defined aspects of package @cite{Real_Time}.
17233 @itemize *
17235 @item 
17236 "Implementation-defined aspects of
17237 @cite{delay_statements}.  See D.9(8)."
17238 @end itemize
17240 Any difference greater than one microsecond will cause the task to be
17241 delayed (see D.9(7)).
17244 @itemize *
17246 @item 
17247 "The upper bound on the duration of interrupt blocking
17248 caused by the implementation.  See D.12(5)."
17249 @end itemize
17251 The upper bound is determined by the underlying operating system.  In
17252 no cases is it more than 10 milliseconds.
17255 @itemize *
17257 @item 
17258 "The means for creating and executing distributed
17259 programs.  See E(5)."
17260 @end itemize
17262 The GLADE package provides a utility GNATDIST for creating and executing
17263 distributed programs.  See the GLADE reference manual for further details.
17266 @itemize *
17268 @item 
17269 "Any events that can result in a partition becoming
17270 inaccessible.  See E.1(7)."
17271 @end itemize
17273 See the GLADE reference manual for full details on such events.
17276 @itemize *
17278 @item 
17279 "The scheduling policies, treatment of priorities, and
17280 management of shared resources between partitions in certain cases.  See
17281 E.1(11)."
17282 @end itemize
17284 See the GLADE reference manual for full details on these aspects of
17285 multi-partition execution.
17288 @itemize *
17290 @item 
17291 "Events that cause the version of a compilation unit to
17292 change.  See E.3(5)."
17293 @end itemize
17295 Editing the source file of a compilation unit, or the source files of
17296 any units on which it is dependent in a significant way cause the version
17297 to change.  No other actions cause the version number to change.  All changes
17298 are significant except those which affect only layout, capitalization or
17299 comments.
17302 @itemize *
17304 @item 
17305 "Whether the execution of the remote subprogram is
17306 immediately aborted as a result of cancellation.  See E.4(13)."
17307 @end itemize
17309 See the GLADE reference manual for details on the effect of abort in
17310 a distributed application.
17313 @itemize *
17315 @item 
17316 "Implementation-defined aspects of the PCS.  See E.5(25)."
17317 @end itemize
17319 See the GLADE reference manual for a full description of all implementation
17320 defined aspects of the PCS.
17323 @itemize *
17325 @item 
17326 "Implementation-defined interfaces in the PCS.  See
17327 E.5(26)."
17328 @end itemize
17330 See the GLADE reference manual for a full description of all
17331 implementation defined interfaces.
17334 @itemize *
17336 @item 
17337 "The values of named numbers in the package
17338 @cite{Decimal}.  See F.2(7)."
17339 @end itemize
17342 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
17343 @headitem
17345 Named Number
17347 @tab
17349 Value
17351 @item
17353 @emph{Max_Scale}
17355 @tab
17359 @item
17361 @emph{Min_Scale}
17363 @tab
17367 @item
17369 @emph{Min_Delta}
17371 @tab
17373 1.0E-18
17375 @item
17377 @emph{Max_Delta}
17379 @tab
17381 1.0E+18
17383 @item
17385 @emph{Max_Decimal_Digits}
17387 @tab
17391 @end multitable
17395 @itemize *
17397 @item 
17398 "The value of @cite{Max_Picture_Length} in the package
17399 @cite{Text_IO.Editing}.  See F.3.3(16)."
17400 @end itemize
17405 @itemize *
17407 @item 
17408 "The value of @cite{Max_Picture_Length} in the package
17409 @cite{Wide_Text_IO.Editing}.  See F.3.4(5)."
17410 @end itemize
17415 @itemize *
17417 @item 
17418 "The accuracy actually achieved by the complex elementary
17419 functions and by other complex arithmetic operations.  See G.1(1)."
17420 @end itemize
17422 Standard library functions are used for the complex arithmetic
17423 operations.  Only fast math mode is currently supported.
17426 @itemize *
17428 @item 
17429 "The sign of a zero result (or a component thereof) from
17430 any operator or function in @cite{Numerics.Generic_Complex_Types}, when
17431 @cite{Real'Signed_Zeros} is True.  See G.1.1(53)."
17432 @end itemize
17434 The signs of zero values are as recommended by the relevant
17435 implementation advice.
17438 @itemize *
17440 @item 
17441 "The sign of a zero result (or a component thereof) from
17442 any operator or function in
17443 @cite{Numerics.Generic_Complex_Elementary_Functions}, when
17444 @cite{Real'Signed_Zeros} is @cite{True}.  See G.1.2(45)."
17445 @end itemize
17447 The signs of zero values are as recommended by the relevant
17448 implementation advice.
17451 @itemize *
17453 @item 
17454 "Whether the strict mode or the relaxed mode is the
17455 default.  See G.2(2)."
17456 @end itemize
17458 The strict mode is the default.  There is no separate relaxed mode.  GNAT
17459 provides a highly efficient implementation of strict mode.
17462 @itemize *
17464 @item 
17465 "The result interval in certain cases of fixed-to-float
17466 conversion.  See G.2.1(10)."
17467 @end itemize
17469 For cases where the result interval is implementation dependent, the
17470 accuracy is that provided by performing all operations in 64-bit IEEE
17471 floating-point format.
17474 @itemize *
17476 @item 
17477 "The result of a floating point arithmetic operation in
17478 overflow situations, when the @cite{Machine_Overflows} attribute of the
17479 result type is @cite{False}.  See G.2.1(13)."
17480 @end itemize
17482 Infinite and NaN values are produced as dictated by the IEEE
17483 floating-point standard.
17484 Note that on machines that are not fully compliant with the IEEE
17485 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17486 must be used for achieving IEEE conforming behavior (although at the cost
17487 of a significant performance penalty), so infinite and NaN values are
17488 properly generated.
17491 @itemize *
17493 @item 
17494 "The result interval for division (or exponentiation by a
17495 negative exponent), when the floating point hardware implements division
17496 as multiplication by a reciprocal.  See G.2.1(16)."
17497 @end itemize
17499 Not relevant, division is IEEE exact.
17502 @itemize *
17504 @item 
17505 "The definition of close result set, which determines the
17506 accuracy of certain fixed point multiplications and divisions.  See
17507 G.2.3(5)."
17508 @end itemize
17510 Operations in the close result set are performed using IEEE long format
17511 floating-point arithmetic.  The input operands are converted to
17512 floating-point, the operation is done in floating-point, and the result
17513 is converted to the target type.
17516 @itemize *
17518 @item 
17519 "Conditions on a @cite{universal_real} operand of a fixed
17520 point multiplication or division for which the result shall be in the
17521 perfect result set.  See G.2.3(22)."
17522 @end itemize
17524 The result is only defined to be in the perfect result set if the result
17525 can be computed by a single scaling operation involving a scale factor
17526 representable in 64-bits.
17529 @itemize *
17531 @item 
17532 "The result of a fixed point arithmetic operation in
17533 overflow situations, when the @cite{Machine_Overflows} attribute of the
17534 result type is @cite{False}.  See G.2.3(27)."
17535 @end itemize
17537 Not relevant, @cite{Machine_Overflows} is @cite{True} for fixed-point
17538 types.
17541 @itemize *
17543 @item 
17544 "The result of an elementary function reference in
17545 overflow situations, when the @cite{Machine_Overflows} attribute of the
17546 result type is @cite{False}.  See G.2.4(4)."
17547 @end itemize
17549 IEEE infinite and Nan values are produced as appropriate.
17552 @itemize *
17554 @item 
17555 "The value of the angle threshold, within which certain
17556 elementary functions, complex arithmetic operations, and complex
17557 elementary functions yield results conforming to a maximum relative
17558 error bound.  See G.2.4(10)."
17559 @end itemize
17561 Information on this subject is not yet available.
17564 @itemize *
17566 @item 
17567 "The accuracy of certain elementary functions for
17568 parameters beyond the angle threshold.  See G.2.4(10)."
17569 @end itemize
17571 Information on this subject is not yet available.
17574 @itemize *
17576 @item 
17577 "The result of a complex arithmetic operation or complex
17578 elementary function reference in overflow situations, when the
17579 @cite{Machine_Overflows} attribute of the corresponding real type is
17580 @cite{False}.  See G.2.6(5)."
17581 @end itemize
17583 IEEE infinite and Nan values are produced as appropriate.
17586 @itemize *
17588 @item 
17589 "The accuracy of certain complex arithmetic operations and
17590 certain complex elementary functions for parameters (or components
17591 thereof) beyond the angle threshold.  See G.2.6(8)."
17592 @end itemize
17594 Information on those subjects is not yet available.
17597 @itemize *
17599 @item 
17600 "Information regarding bounded errors and erroneous
17601 execution.  See H.2(1)."
17602 @end itemize
17604 Information on this subject is not yet available.
17607 @itemize *
17609 @item 
17610 "Implementation-defined aspects of pragma
17611 @cite{Inspection_Point}.  See H.3.2(8)."
17612 @end itemize
17614 Pragma @cite{Inspection_Point} ensures that the variable is live and can
17615 be examined by the debugger at the inspection point.
17618 @itemize *
17620 @item 
17621 "Implementation-defined aspects of pragma
17622 @cite{Restrictions}.  See H.4(25)."
17623 @end itemize
17625 There are no implementation-defined aspects of pragma @cite{Restrictions}.  The
17626 use of pragma @cite{Restrictions [No_Exceptions]} has no effect on the
17627 generated code.  Checks must suppressed by use of pragma @cite{Suppress}.
17630 @itemize *
17632 @item 
17633 "Any restrictions on pragma @cite{Restrictions}.  See
17634 H.4(27)."
17635 @end itemize
17637 There are no restrictions on pragma @cite{Restrictions}.
17639 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
17640 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{24d}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{24e}
17641 @chapter Intrinsic Subprograms
17644 @geindex Intrinsic Subprograms
17646 GNAT allows a user application program to write the declaration:
17648 @example
17649 pragma Import (Intrinsic, name);
17650 @end example
17652 providing that the name corresponds to one of the implemented intrinsic
17653 subprograms in GNAT, and that the parameter profile of the referenced
17654 subprogram meets the requirements.  This chapter describes the set of
17655 implemented intrinsic subprograms, and the requirements on parameter profiles.
17656 Note that no body is supplied; as with other uses of pragma Import, the
17657 body is supplied elsewhere (in this case by the compiler itself).  Note
17658 that any use of this feature is potentially non-portable, since the
17659 Ada standard does not require Ada compilers to implement this feature.
17661 @menu
17662 * Intrinsic Operators:: 
17663 * Compilation_Date:: 
17664 * Compilation_Time:: 
17665 * Enclosing_Entity:: 
17666 * Exception_Information:: 
17667 * Exception_Message:: 
17668 * Exception_Name:: 
17669 * File:: 
17670 * Line:: 
17671 * Shifts and Rotates:: 
17672 * Source_Location:: 
17674 @end menu
17676 @node Intrinsic Operators,Compilation_Date,,Intrinsic Subprograms
17677 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{24f}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{250}
17678 @section Intrinsic Operators
17681 @geindex Intrinsic operator
17683 All the predefined numeric operators in package Standard
17684 in @cite{pragma Import (Intrinsic@comma{}..)}
17685 declarations.  In the binary operator case, the operands must have the same
17686 size.  The operand or operands must also be appropriate for
17687 the operator.  For example, for addition, the operands must
17688 both be floating-point or both be fixed-point, and the
17689 right operand for @cite{"**"} must have a root type of
17690 @cite{Standard.Integer'Base}.
17691 You can use an intrinsic operator declaration as in the following example:
17693 @example
17694 type Int1 is new Integer;
17695 type Int2 is new Integer;
17697 function "+" (X1 : Int1; X2 : Int2) return Int1;
17698 function "+" (X1 : Int1; X2 : Int2) return Int2;
17699 pragma Import (Intrinsic, "+");
17700 @end example
17702 This declaration would permit 'mixed mode' arithmetic on items
17703 of the differing types @cite{Int1} and @cite{Int2}.
17704 It is also possible to specify such operators for private types, if the
17705 full views are appropriate arithmetic types.
17707 @node Compilation_Date,Compilation_Time,Intrinsic Operators,Intrinsic Subprograms
17708 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{251}@anchor{gnat_rm/intrinsic_subprograms id3}@anchor{252}
17709 @section Compilation_Date
17712 @geindex Compilation_Date
17714 This intrinsic subprogram is used in the implementation of the
17715 library package @cite{GNAT.Source_Info}.  The only useful use of the
17716 intrinsic import in this case is the one in this unit, so an
17717 application program should simply call the function
17718 @cite{GNAT.Source_Info.Compilation_Date} to obtain the date of
17719 the current compilation (in local time format MMM DD YYYY).
17721 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
17722 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{253}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{254}
17723 @section Compilation_Time
17726 @geindex Compilation_Time
17728 This intrinsic subprogram is used in the implementation of the
17729 library package @cite{GNAT.Source_Info}.  The only useful use of the
17730 intrinsic import in this case is the one in this unit, so an
17731 application program should simply call the function
17732 @cite{GNAT.Source_Info.Compilation_Time} to obtain the time of
17733 the current compilation (in local time format HH:MM:SS).
17735 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
17736 @anchor{gnat_rm/intrinsic_subprograms id5}@anchor{255}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{256}
17737 @section Enclosing_Entity
17740 @geindex Enclosing_Entity
17742 This intrinsic subprogram is used in the implementation of the
17743 library package @cite{GNAT.Source_Info}.  The only useful use of the
17744 intrinsic import in this case is the one in this unit, so an
17745 application program should simply call the function
17746 @cite{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
17747 the current subprogram, package, task, entry, or protected subprogram.
17749 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
17750 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{257}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{258}
17751 @section Exception_Information
17754 @geindex Exception_Information'
17756 This intrinsic subprogram is used in the implementation of the
17757 library package @cite{GNAT.Current_Exception}.  The only useful
17758 use of the intrinsic import in this case is the one in this unit,
17759 so an application program should simply call the function
17760 @cite{GNAT.Current_Exception.Exception_Information} to obtain
17761 the exception information associated with the current exception.
17763 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
17764 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{259}@anchor{gnat_rm/intrinsic_subprograms id7}@anchor{25a}
17765 @section Exception_Message
17768 @geindex Exception_Message
17770 This intrinsic subprogram is used in the implementation of the
17771 library package @cite{GNAT.Current_Exception}.  The only useful
17772 use of the intrinsic import in this case is the one in this unit,
17773 so an application program should simply call the function
17774 @cite{GNAT.Current_Exception.Exception_Message} to obtain
17775 the message associated with the current exception.
17777 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
17778 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{25b}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{25c}
17779 @section Exception_Name
17782 @geindex Exception_Name
17784 This intrinsic subprogram is used in the implementation of the
17785 library package @cite{GNAT.Current_Exception}.  The only useful
17786 use of the intrinsic import in this case is the one in this unit,
17787 so an application program should simply call the function
17788 @cite{GNAT.Current_Exception.Exception_Name} to obtain
17789 the name of the current exception.
17791 @node File,Line,Exception_Name,Intrinsic Subprograms
17792 @anchor{gnat_rm/intrinsic_subprograms file}@anchor{25d}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{25e}
17793 @section File
17796 @geindex File
17798 This intrinsic subprogram is used in the implementation of the
17799 library package @cite{GNAT.Source_Info}.  The only useful use of the
17800 intrinsic import in this case is the one in this unit, so an
17801 application program should simply call the function
17802 @cite{GNAT.Source_Info.File} to obtain the name of the current
17803 file.
17805 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
17806 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{25f}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{260}
17807 @section Line
17810 @geindex Line
17812 This intrinsic subprogram is used in the implementation of the
17813 library package @cite{GNAT.Source_Info}.  The only useful use of the
17814 intrinsic import in this case is the one in this unit, so an
17815 application program should simply call the function
17816 @cite{GNAT.Source_Info.Line} to obtain the number of the current
17817 source line.
17819 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
17820 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{261}@anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{262}
17821 @section Shifts and Rotates
17824 @geindex Shift_Left
17826 @geindex Shift_Right
17828 @geindex Shift_Right_Arithmetic
17830 @geindex Rotate_Left
17832 @geindex Rotate_Right
17834 In standard Ada, the shift and rotate functions are available only
17835 for the predefined modular types in package @cite{Interfaces}.  However, in
17836 GNAT it is possible to define these functions for any integer
17837 type (signed or modular), as in this example:
17839 @example
17840 function Shift_Left
17841   (Value  : T;
17842    Amount : Natural) return T;
17843 @end example
17845 The function name must be one of
17846 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
17847 Rotate_Right. T must be an integer type. T'Size must be
17848 8, 16, 32 or 64 bits; if T is modular, the modulus
17849 must be 2**8, 2**16, 2**32 or 2**64.
17850 The result type must be the same as the type of @cite{Value}.
17851 The shift amount must be Natural.
17852 The formal parameter names can be anything.
17854 A more convenient way of providing these shift operators is to use
17855 the Provide_Shift_Operators pragma, which provides the function declarations
17856 and corresponding pragma Import's for all five shift functions.
17858 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
17859 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{263}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{264}
17860 @section Source_Location
17863 @geindex Source_Location
17865 This intrinsic subprogram is used in the implementation of the
17866 library routine @cite{GNAT.Source_Info}.  The only useful use of the
17867 intrinsic import in this case is the one in this unit, so an
17868 application program should simply call the function
17869 @cite{GNAT.Source_Info.Source_Location} to obtain the current
17870 source file location.
17872 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
17873 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{265}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{266}
17874 @chapter Representation Clauses and Pragmas
17877 @geindex Representation Clauses
17879 @geindex Representation Clause
17881 @geindex Representation Pragma
17883 @geindex Pragma
17884 @geindex representation
17886 This section describes the representation clauses accepted by GNAT, and
17887 their effect on the representation of corresponding data objects.
17889 GNAT fully implements Annex C (Systems Programming).  This means that all
17890 the implementation advice sections in chapter 13 are fully implemented.
17891 However, these sections only require a minimal level of support for
17892 representation clauses.  GNAT provides much more extensive capabilities,
17893 and this section describes the additional capabilities provided.
17895 @menu
17896 * Alignment Clauses:: 
17897 * Size Clauses:: 
17898 * Storage_Size Clauses:: 
17899 * Size of Variant Record Objects:: 
17900 * Biased Representation:: 
17901 * Value_Size and Object_Size Clauses:: 
17902 * Component_Size Clauses:: 
17903 * Bit_Order Clauses:: 
17904 * Effect of Bit_Order on Byte Ordering:: 
17905 * Pragma Pack for Arrays:: 
17906 * Pragma Pack for Records:: 
17907 * Record Representation Clauses:: 
17908 * Handling of Records with Holes:: 
17909 * Enumeration Clauses:: 
17910 * Address Clauses:: 
17911 * Use of Address Clauses for Memory-Mapped I/O:: 
17912 * Effect of Convention on Representation:: 
17913 * Conventions and Anonymous Access Types:: 
17914 * Determining the Representations chosen by GNAT:: 
17916 @end menu
17918 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
17919 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{267}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{268}
17920 @section Alignment Clauses
17923 @geindex Alignment Clause
17925 GNAT requires that all alignment clauses specify a power of 2, and all
17926 default alignments are always a power of 2.  The default alignment
17927 values are as follows:
17930 @itemize *
17932 @item 
17933 @emph{Elementary Types}.
17935 For elementary types, the alignment is the minimum of the actual size of
17936 objects of the type divided by @cite{Storage_Unit},
17937 and the maximum alignment supported by the target.
17938 (This maximum alignment is given by the GNAT-specific attribute
17939 @cite{Standard'Maximum_Alignment}; see @ref{185,,Attribute Maximum_Alignment}.)
17941 @geindex Maximum_Alignment attribute
17943 For example, for type @cite{Long_Float}, the object size is 8 bytes, and the
17944 default alignment will be 8 on any target that supports alignments
17945 this large, but on some targets, the maximum alignment may be smaller
17946 than 8, in which case objects of type @cite{Long_Float} will be maximally
17947 aligned.
17949 @item 
17950 @emph{Arrays}.
17952 For arrays, the alignment is equal to the alignment of the component type
17953 for the normal case where no packing or component size is given.  If the
17954 array is packed, and the packing is effective (see separate section on
17955 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
17956 arrays or arrays whose length is not known at compile time, depending on
17957 whether the component size is divisible by 4, 2, or is odd.  For short packed
17958 arrays, which are handled internally as modular types, the alignment
17959 will be as described for elementary types, e.g. a packed array of length
17960 31 bits will have an object size of four bytes, and an alignment of 4.
17962 @item 
17963 @emph{Records}.
17965 For the normal non-packed case, the alignment of a record is equal to
17966 the maximum alignment of any of its components.  For tagged records, this
17967 includes the implicit access type used for the tag.  If a pragma @cite{Pack}
17968 is used and all components are packable (see separate section on pragma
17969 @cite{Pack}), then the resulting alignment is 1, unless the layout of the
17970 record makes it profitable to increase it.
17972 A special case is when:
17975 @itemize *
17977 @item 
17978 the size of the record is given explicitly, or a
17979 full record representation clause is given, and
17981 @item 
17982 the size of the record is 2, 4, or 8 bytes.
17983 @end itemize
17985 In this case, an alignment is chosen to match the
17986 size of the record. For example, if we have:
17988 @example
17989 type Small is record
17990    A, B : Character;
17991 end record;
17992 for Small'Size use 16;
17993 @end example
17995 then the default alignment of the record type @cite{Small} is 2, not 1. This
17996 leads to more efficient code when the record is treated as a unit, and also
17997 allows the type to specified as @cite{Atomic} on architectures requiring
17998 strict alignment.
17999 @end itemize
18001 An alignment clause may specify a larger alignment than the default value
18002 up to some maximum value dependent on the target (obtainable by using the
18003 attribute reference @cite{Standard'Maximum_Alignment}). It may also specify
18004 a smaller alignment than the default value for enumeration, integer and
18005 fixed point types, as well as for record types, for example
18007 @example
18008 type V is record
18009    A : Integer;
18010 end record;
18012 for V'alignment use 1;
18013 @end example
18015 @geindex Alignment
18016 @geindex default
18018 The default alignment for the type @cite{V} is 4, as a result of the
18019 Integer field in the record, but it is permissible, as shown, to
18020 override the default alignment of the record with a smaller value.
18022 @geindex Alignment
18023 @geindex subtypes
18025 Note that according to the Ada standard, an alignment clause applies only
18026 to the first named subtype. If additional subtypes are declared, then the
18027 compiler is allowed to choose any alignment it likes, and there is no way
18028 to control this choice. Consider:
18030 @example
18031 type R is range 1 .. 10_000;
18032 for R'Alignment use 1;
18033 subtype RS is R range 1 .. 1000;
18034 @end example
18036 The alignment clause specifies an alignment of 1 for the first named subtype
18037 @cite{R} but this does not necessarily apply to @cite{RS}. When writing
18038 portable Ada code, you should avoid writing code that explicitly or
18039 implicitly relies on the alignment of such subtypes.
18041 For the GNAT compiler, if an explicit alignment clause is given, this
18042 value is also used for any subsequent subtypes. So for GNAT, in the
18043 above example, you can count on the alignment of @cite{RS} being 1. But this
18044 assumption is non-portable, and other compilers may choose different
18045 alignments for the subtype @cite{RS}.
18047 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18048 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{269}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{26a}
18049 @section Size Clauses
18052 @geindex Size Clause
18054 The default size for a type @cite{T} is obtainable through the
18055 language-defined attribute @cite{T'Size} and also through the
18056 equivalent GNAT-defined attribute @cite{T'Value_Size}.
18057 For objects of type @cite{T}, GNAT will generally increase the type size
18058 so that the object size (obtainable through the GNAT-defined attribute
18059 @cite{T'Object_Size})
18060 is a multiple of @cite{T'Alignment * Storage_Unit}.
18062 For example:
18064 @example
18065 type Smallint is range 1 .. 6;
18067 type Rec is record
18068    Y1 : integer;
18069    Y2 : boolean;
18070 end record;
18071 @end example
18073 In this example, @cite{Smallint'Size} = @cite{Smallint'Value_Size} = 3,
18074 as specified by the RM rules,
18075 but objects of this type will have a size of 8
18076 (@cite{Smallint'Object_Size} = 8),
18077 since objects by default occupy an integral number
18078 of storage units.  On some targets, notably older
18079 versions of the Digital Alpha, the size of stand
18080 alone objects of this type may be 32, reflecting
18081 the inability of the hardware to do byte load/stores.
18083 Similarly, the size of type @cite{Rec} is 40 bits
18084 (@cite{Rec'Size} = @cite{Rec'Value_Size} = 40), but
18085 the alignment is 4, so objects of this type will have
18086 their size increased to 64 bits so that it is a multiple
18087 of the alignment (in bits).  This decision is
18088 in accordance with the specific Implementation Advice in RM 13.3(43):
18090 @quotation
18092 "A @cite{Size} clause should be supported for an object if the specified
18093 @cite{Size} is at least as large as its subtype's @cite{Size}, and corresponds
18094 to a size in storage elements that is a multiple of the object's
18095 @cite{Alignment} (if the @cite{Alignment} is nonzero)."
18096 @end quotation
18098 An explicit size clause may be used to override the default size by
18099 increasing it.  For example, if we have:
18101 @example
18102 type My_Boolean is new Boolean;
18103 for My_Boolean'Size use 32;
18104 @end example
18106 then values of this type will always be 32 bits long.  In the case of
18107 discrete types, the size can be increased up to 64 bits, with the effect
18108 that the entire specified field is used to hold the value, sign- or
18109 zero-extended as appropriate.  If more than 64 bits is specified, then
18110 padding space is allocated after the value, and a warning is issued that
18111 there are unused bits.
18113 Similarly the size of records and arrays may be increased, and the effect
18114 is to add padding bits after the value.  This also causes a warning message
18115 to be generated.
18117 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
18118 Size in bits, this corresponds to an object of size 256 megabytes (minus
18119 one).  This limitation is true on all targets.  The reason for this
18120 limitation is that it improves the quality of the code in many cases
18121 if it is known that a Size value can be accommodated in an object of
18122 type Integer.
18124 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18125 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{26b}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{26c}
18126 @section Storage_Size Clauses
18129 @geindex Storage_Size Clause
18131 For tasks, the @cite{Storage_Size} clause specifies the amount of space
18132 to be allocated for the task stack.  This cannot be extended, and if the
18133 stack is exhausted, then @cite{Storage_Error} will be raised (if stack
18134 checking is enabled).  Use a @cite{Storage_Size} attribute definition clause,
18135 or a @cite{Storage_Size} pragma in the task definition to set the
18136 appropriate required size.  A useful technique is to include in every
18137 task definition a pragma of the form:
18139 @example
18140 pragma Storage_Size (Default_Stack_Size);
18141 @end example
18143 Then @cite{Default_Stack_Size} can be defined in a global package, and
18144 modified as required. Any tasks requiring stack sizes different from the
18145 default can have an appropriate alternative reference in the pragma.
18147 You can also use the @emph{-d} binder switch to modify the default stack
18148 size.
18150 For access types, the @cite{Storage_Size} clause specifies the maximum
18151 space available for allocation of objects of the type.  If this space is
18152 exceeded then @cite{Storage_Error} will be raised by an allocation attempt.
18153 In the case where the access type is declared local to a subprogram, the
18154 use of a @cite{Storage_Size} clause triggers automatic use of a special
18155 predefined storage pool (@cite{System.Pool_Size}) that ensures that all
18156 space for the pool is automatically reclaimed on exit from the scope in
18157 which the type is declared.
18159 A special case recognized by the compiler is the specification of a
18160 @cite{Storage_Size} of zero for an access type.  This means that no
18161 items can be allocated from the pool, and this is recognized at compile
18162 time, and all the overhead normally associated with maintaining a fixed
18163 size storage pool is eliminated.  Consider the following example:
18165 @example
18166 procedure p is
18167    type R is array (Natural) of Character;
18168    type P is access all R;
18169    for P'Storage_Size use 0;
18170    --  Above access type intended only for interfacing purposes
18172    y : P;
18174    procedure g (m : P);
18175    pragma Import (C, g);
18177    --  ...
18179 begin
18180    --  ...
18181    y := new R;
18182 end;
18183 @end example
18185 As indicated in this example, these dummy storage pools are often useful in
18186 connection with interfacing where no object will ever be allocated.  If you
18187 compile the above example, you get the warning:
18189 @example
18190 p.adb:16:09: warning: allocation from empty storage pool
18191 p.adb:16:09: warning: Storage_Error will be raised at run time
18192 @end example
18194 Of course in practice, there will not be any explicit allocators in the
18195 case of such an access declaration.
18197 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18198 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{26d}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{26e}
18199 @section Size of Variant Record Objects
18202 @geindex Size
18203 @geindex variant record objects
18205 @geindex Variant record objects
18206 @geindex size
18208 In the case of variant record objects, there is a question whether Size gives
18209 information about a particular variant, or the maximum size required
18210 for any variant.  Consider the following program
18212 @example
18213 with Text_IO; use Text_IO;
18214 procedure q is
18215    type R1 (A : Boolean := False) is record
18216      case A is
18217        when True  => X : Character;
18218        when False => null;
18219      end case;
18220    end record;
18222    V1 : R1 (False);
18223    V2 : R1;
18225 begin
18226    Put_Line (Integer'Image (V1'Size));
18227    Put_Line (Integer'Image (V2'Size));
18228 end q;
18229 @end example
18231 Here we are dealing with a variant record, where the True variant
18232 requires 16 bits, and the False variant requires 8 bits.
18233 In the above example, both V1 and V2 contain the False variant,
18234 which is only 8 bits long.  However, the result of running the
18235 program is:
18237 @example
18240 @end example
18242 The reason for the difference here is that the discriminant value of
18243 V1 is fixed, and will always be False.  It is not possible to assign
18244 a True variant value to V1, therefore 8 bits is sufficient.  On the
18245 other hand, in the case of V2, the initial discriminant value is
18246 False (from the default), but it is possible to assign a True
18247 variant value to V2, therefore 16 bits must be allocated for V2
18248 in the general case, even fewer bits may be needed at any particular
18249 point during the program execution.
18251 As can be seen from the output of this program, the @cite{'Size}
18252 attribute applied to such an object in GNAT gives the actual allocated
18253 size of the variable, which is the largest size of any of the variants.
18254 The Ada Reference Manual is not completely clear on what choice should
18255 be made here, but the GNAT behavior seems most consistent with the
18256 language in the RM.
18258 In some cases, it may be desirable to obtain the size of the current
18259 variant, rather than the size of the largest variant.  This can be
18260 achieved in GNAT by making use of the fact that in the case of a
18261 subprogram parameter, GNAT does indeed return the size of the current
18262 variant (because a subprogram has no way of knowing how much space
18263 is actually allocated for the actual).
18265 Consider the following modified version of the above program:
18267 @example
18268 with Text_IO; use Text_IO;
18269 procedure q is
18270    type R1 (A : Boolean := False) is record
18271      case A is
18272        when True  => X : Character;
18273        when False => null;
18274      end case;
18275    end record;
18277    V2 : R1;
18279    function Size (V : R1) return Integer is
18280    begin
18281       return V'Size;
18282    end Size;
18284 begin
18285    Put_Line (Integer'Image (V2'Size));
18286    Put_Line (Integer'Image (Size (V2)));
18287    V2 := (True, 'x');
18288    Put_Line (Integer'Image (V2'Size));
18289    Put_Line (Integer'Image (Size (V2)));
18290 end q;
18291 @end example
18293 The output from this program is
18295 @example
18300 @end example
18302 Here we see that while the @cite{'Size} attribute always returns
18303 the maximum size, regardless of the current variant value, the
18304 @cite{Size} function does indeed return the size of the current
18305 variant value.
18307 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18308 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{26f}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{270}
18309 @section Biased Representation
18312 @geindex Size for biased representation
18314 @geindex Biased representation
18316 In the case of scalars with a range starting at other than zero, it is
18317 possible in some cases to specify a size smaller than the default minimum
18318 value, and in such cases, GNAT uses an unsigned biased representation,
18319 in which zero is used to represent the lower bound, and successive values
18320 represent successive values of the type.
18322 For example, suppose we have the declaration:
18324 @example
18325 type Small is range -7 .. -4;
18326 for Small'Size use 2;
18327 @end example
18329 Although the default size of type @cite{Small} is 4, the @cite{Size}
18330 clause is accepted by GNAT and results in the following representation
18331 scheme:
18333 @example
18334 -7 is represented as 2#00#
18335 -6 is represented as 2#01#
18336 -5 is represented as 2#10#
18337 -4 is represented as 2#11#
18338 @end example
18340 Biased representation is only used if the specified @cite{Size} clause
18341 cannot be accepted in any other manner.  These reduced sizes that force
18342 biased representation can be used for all discrete types except for
18343 enumeration types for which a representation clause is given.
18345 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18346 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{271}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{272}
18347 @section Value_Size and Object_Size Clauses
18350 @geindex Value_Size
18352 @geindex Object_Size
18354 @geindex Size
18355 @geindex of objects
18357 In Ada 95 and Ada 2005, @cite{T'Size} for a type @cite{T} is the minimum
18358 number of bits required to hold values of type @cite{T}.
18359 Although this interpretation was allowed in Ada 83, it was not required,
18360 and this requirement in practice can cause some significant difficulties.
18361 For example, in most Ada 83 compilers, @cite{Natural'Size} was 32.
18362 However, in Ada 95 and Ada 2005,
18363 @cite{Natural'Size} is
18364 typically 31.  This means that code may change in behavior when moving
18365 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
18367 @example
18368 type Rec is record;
18369    A : Natural;
18370    B : Natural;
18371 end record;
18373 for Rec use record
18374    at 0  range 0 .. Natural'Size - 1;
18375    at 0  range Natural'Size .. 2 * Natural'Size - 1;
18376 end record;
18377 @end example
18379 In the above code, since the typical size of @cite{Natural} objects
18380 is 32 bits and @cite{Natural'Size} is 31, the above code can cause
18381 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18382 there are cases where the fact that the object size can exceed the
18383 size of the type causes surprises.
18385 To help get around this problem GNAT provides two implementation
18386 defined attributes, @cite{Value_Size} and @cite{Object_Size}.  When
18387 applied to a type, these attributes yield the size of the type
18388 (corresponding to the RM defined size attribute), and the size of
18389 objects of the type respectively.
18391 The @cite{Object_Size} is used for determining the default size of
18392 objects and components.  This size value can be referred to using the
18393 @cite{Object_Size} attribute.  The phrase 'is used' here means that it is
18394 the basis of the determination of the size.  The backend is free to
18395 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18396 character might be stored in 32 bits on a machine with no efficient
18397 byte access instructions such as the Alpha.
18399 The default rules for the value of @cite{Object_Size} for
18400 discrete types are as follows:
18403 @itemize *
18405 @item 
18406 The @cite{Object_Size} for base subtypes reflect the natural hardware
18407 size in bits (run the compiler with @emph{-gnatS} to find those values
18408 for numeric types). Enumeration types and fixed-point base subtypes have
18409 8, 16, 32, or 64 bits for this size, depending on the range of values
18410 to be stored.
18412 @item 
18413 The @cite{Object_Size} of a subtype is the same as the
18414 @cite{Object_Size} of
18415 the type from which it is obtained.
18417 @item 
18418 The @cite{Object_Size} of a derived base type is copied from the parent
18419 base type, and the @cite{Object_Size} of a derived first subtype is copied
18420 from the parent first subtype.
18421 @end itemize
18423 The @cite{Value_Size} attribute
18424 is the (minimum) number of bits required to store a value
18425 of the type.
18426 This value is used to determine how tightly to pack
18427 records or arrays with components of this type, and also affects
18428 the semantics of unchecked conversion (unchecked conversions where
18429 the @cite{Value_Size} values differ generate a warning, and are potentially
18430 target dependent).
18432 The default rules for the value of @cite{Value_Size} are as follows:
18435 @itemize *
18437 @item 
18438 The @cite{Value_Size} for a base subtype is the minimum number of bits
18439 required to store all values of the type (including the sign bit
18440 only if negative values are possible).
18442 @item 
18443 If a subtype statically matches the first subtype of a given type, then it has
18444 by default the same @cite{Value_Size} as the first subtype.  This is a
18445 consequence of RM 13.1(14): "if two subtypes statically match,
18446 then their subtype-specific aspects are the same".)
18448 @item 
18449 All other subtypes have a @cite{Value_Size} corresponding to the minimum
18450 number of bits required to store all values of the subtype.  For
18451 dynamic bounds, it is assumed that the value can range down or up
18452 to the corresponding bound of the ancestor
18453 @end itemize
18455 The RM defined attribute @cite{Size} corresponds to the
18456 @cite{Value_Size} attribute.
18458 The @cite{Size} attribute may be defined for a first-named subtype.  This sets
18459 the @cite{Value_Size} of
18460 the first-named subtype to the given value, and the
18461 @cite{Object_Size} of this first-named subtype to the given value padded up
18462 to an appropriate boundary.  It is a consequence of the default rules
18463 above that this @cite{Object_Size} will apply to all further subtypes.  On the
18464 other hand, @cite{Value_Size} is affected only for the first subtype, any
18465 dynamic subtypes obtained from it directly, and any statically matching
18466 subtypes.  The @cite{Value_Size} of any other static subtypes is not affected.
18468 @cite{Value_Size} and
18469 @cite{Object_Size} may be explicitly set for any subtype using
18470 an attribute definition clause.  Note that the use of these attributes
18471 can cause the RM 13.1(14) rule to be violated.  If two access types
18472 reference aliased objects whose subtypes have differing @cite{Object_Size}
18473 values as a result of explicit attribute definition clauses, then it
18474 is illegal to convert from one access subtype to the other. For a more
18475 complete description of this additional legality rule, see the
18476 description of the @cite{Object_Size} attribute.
18478 To get a feel for the difference, consider the following examples (note
18479 that in each case the base is @cite{Short_Short_Integer} with a size of 8):
18482 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
18483 @headitem
18485 Type or subtype declaration
18487 @tab
18489 Object_Size
18491 @tab
18493 Value_Size
18495 @item
18497 @code{type x1 is range 0 .. 5;}
18499 @tab
18503 @tab
18507 @item
18509 @code{type x2 is range 0 .. 5;}
18510 @code{for x2'size use 12;}
18512 @tab
18516 @tab
18520 @item
18522 @code{subtype x3 is x2 range 0 .. 3;}
18524 @tab
18528 @tab
18532 @item
18534 @code{subtype x4 is x2'base range 0 .. 10;}
18536 @tab
18540 @tab
18544 @item
18546 @code{dynamic : x2'Base range -64 .. +63;}
18548 @tab
18550 @tab
18552 @item
18554 @code{subtype x5 is x2 range 0 .. dynamic;}
18556 @tab
18560 @tab
18564 @item
18566 @code{subtype x6 is x2'base range 0 .. dynamic;}
18568 @tab
18572 @tab
18576 @end multitable
18579 Note: the entries marked '*' are not actually specified by the Ada
18580 Reference Manual, which has nothing to say about size in the dynamic
18581 case. What GNAT does is to allocate sufficient bits to accomodate any
18582 possible dynamic values for the bounds at run-time.
18584 So far, so good, but GNAT has to obey the RM rules, so the question is
18585 under what conditions must the RM @cite{Size} be used.
18586 The following is a list
18587 of the occasions on which the RM @cite{Size} must be used:
18590 @itemize *
18592 @item 
18593 Component size for packed arrays or records
18595 @item 
18596 Value of the attribute @cite{Size} for a type
18598 @item 
18599 Warning about sizes not matching for unchecked conversion
18600 @end itemize
18602 For record types, the @cite{Object_Size} is always a multiple of the
18603 alignment of the type (this is true for all types). In some cases the
18604 @cite{Value_Size} can be smaller. Consider:
18606 @example
18607 type R is record
18608   X : Integer;
18609   Y : Character;
18610 end record;
18611 @end example
18613 On a typical 32-bit architecture, the X component will be four bytes, and
18614 require four-byte alignment, and the Y component will be one byte. In this
18615 case @cite{R'Value_Size} will be 40 (bits) since this is the minimum size
18616 required to store a value of this type, and for example, it is permissible
18617 to have a component of type R in an outer array whose component size is
18618 specified to be 48 bits. However, @cite{R'Object_Size} will be 64 (bits),
18619 since it must be rounded up so that this value is a multiple of the
18620 alignment (4 bytes = 32 bits).
18622 For all other types, the @cite{Object_Size}
18623 and @cite{Value_Size} are the same (and equivalent to the RM attribute @cite{Size}).
18624 Only @cite{Size} may be specified for such types.
18626 Note that @cite{Value_Size} can be used to force biased representation
18627 for a particular subtype. Consider this example:
18629 @example
18630 type R is (A, B, C, D, E, F);
18631 subtype RAB is R range A .. B;
18632 subtype REF is R range E .. F;
18633 @end example
18635 By default, @cite{RAB}
18636 has a size of 1 (sufficient to accommodate the representation
18637 of @cite{A} and @cite{B}, 0 and 1), and @cite{REF}
18638 has a size of 3 (sufficient to accommodate the representation
18639 of @cite{E} and @cite{F}, 4 and 5). But if we add the
18640 following @cite{Value_Size} attribute definition clause:
18642 @example
18643 for REF'Value_Size use 1;
18644 @end example
18646 then biased representation is forced for @cite{REF},
18647 and 0 will represent @cite{E} and 1 will represent @cite{F}.
18648 A warning is issued when a @cite{Value_Size} attribute
18649 definition clause forces biased representation. This
18650 warning can be turned off using @cite{-gnatw.B}.
18652 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
18653 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{273}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{274}
18654 @section Component_Size Clauses
18657 @geindex Component_Size Clause
18659 Normally, the value specified in a component size clause must be consistent
18660 with the subtype of the array component with regard to size and alignment.
18661 In other words, the value specified must be at least equal to the size
18662 of this subtype, and must be a multiple of the alignment value.
18664 In addition, component size clauses are allowed which cause the array
18665 to be packed, by specifying a smaller value.  A first case is for
18666 component size values in the range 1 through 63.  The value specified
18667 must not be smaller than the Size of the subtype.  GNAT will accurately
18668 honor all packing requests in this range.  For example, if we have:
18670 @example
18671 type r is array (1 .. 8) of Natural;
18672 for r'Component_Size use 31;
18673 @end example
18675 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
18676 Of course access to the components of such an array is considerably
18677 less efficient than if the natural component size of 32 is used.
18678 A second case is when the subtype of the component is a record type
18679 padded because of its default alignment.  For example, if we have:
18681 @example
18682 type r is record
18683   i : Integer;
18684   j : Integer;
18685   b : Boolean;
18686 end record;
18688 type a is array (1 .. 8) of r;
18689 for a'Component_Size use 72;
18690 @end example
18692 then the resulting array has a length of 72 bytes, instead of 96 bytes
18693 if the alignment of the record (4) was obeyed.
18695 Note that there is no point in giving both a component size clause
18696 and a pragma Pack for the same array type. if such duplicate
18697 clauses are given, the pragma Pack will be ignored.
18699 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
18700 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{275}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{276}
18701 @section Bit_Order Clauses
18704 @geindex Bit_Order Clause
18706 @geindex bit ordering
18708 @geindex ordering
18709 @geindex of bits
18711 For record subtypes, GNAT permits the specification of the @cite{Bit_Order}
18712 attribute.  The specification may either correspond to the default bit
18713 order for the target, in which case the specification has no effect and
18714 places no additional restrictions, or it may be for the non-standard
18715 setting (that is the opposite of the default).
18717 In the case where the non-standard value is specified, the effect is
18718 to renumber bits within each byte, but the ordering of bytes is not
18719 affected.  There are certain
18720 restrictions placed on component clauses as follows:
18723 @itemize *
18725 @item 
18726 Components fitting within a single storage unit.
18728 These are unrestricted, and the effect is merely to renumber bits.  For
18729 example if we are on a little-endian machine with @cite{Low_Order_First}
18730 being the default, then the following two declarations have exactly
18731 the same effect:
18733 @example
18734 type R1 is record
18735    A : Boolean;
18736    B : Integer range 1 .. 120;
18737 end record;
18739 for R1 use record
18740    A at 0 range 0 .. 0;
18741    B at 0 range 1 .. 7;
18742 end record;
18744 type R2 is record
18745    A : Boolean;
18746    B : Integer range 1 .. 120;
18747 end record;
18749 for R2'Bit_Order use High_Order_First;
18751 for R2 use record
18752    A at 0 range 7 .. 7;
18753    B at 0 range 0 .. 6;
18754 end record;
18755 @end example
18757 The useful application here is to write the second declaration with the
18758 @cite{Bit_Order} attribute definition clause, and know that it will be treated
18759 the same, regardless of whether the target is little-endian or big-endian.
18761 @item 
18762 Components occupying an integral number of bytes.
18764 These are components that exactly fit in two or more bytes.  Such component
18765 declarations are allowed, but have no effect, since it is important to realize
18766 that the @cite{Bit_Order} specification does not affect the ordering of bytes.
18767 In particular, the following attempt at getting an endian-independent integer
18768 does not work:
18770 @example
18771 type R2 is record
18772    A : Integer;
18773 end record;
18775 for R2'Bit_Order use High_Order_First;
18777 for R2 use record
18778    A at 0 range 0 .. 31;
18779 end record;
18780 @end example
18782 This declaration will result in a little-endian integer on a
18783 little-endian machine, and a big-endian integer on a big-endian machine.
18784 If byte flipping is required for interoperability between big- and
18785 little-endian machines, this must be explicitly programmed.  This capability
18786 is not provided by @cite{Bit_Order}.
18788 @item 
18789 Components that are positioned across byte boundaries.
18791 but do not occupy an integral number of bytes.  Given that bytes are not
18792 reordered, such fields would occupy a non-contiguous sequence of bits
18793 in memory, requiring non-trivial code to reassemble.  They are for this
18794 reason not permitted, and any component clause specifying such a layout
18795 will be flagged as illegal by GNAT.
18796 @end itemize
18798 Since the misconception that Bit_Order automatically deals with all
18799 endian-related incompatibilities is a common one, the specification of
18800 a component field that is an integral number of bytes will always
18801 generate a warning.  This warning may be suppressed using @cite{pragma Warnings (Off)}
18802 if desired.  The following section contains additional
18803 details regarding the issue of byte ordering.
18805 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
18806 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{277}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{278}
18807 @section Effect of Bit_Order on Byte Ordering
18810 @geindex byte ordering
18812 @geindex ordering
18813 @geindex of bytes
18815 In this section we will review the effect of the @cite{Bit_Order} attribute
18816 definition clause on byte ordering.  Briefly, it has no effect at all, but
18817 a detailed example will be helpful.  Before giving this
18818 example, let us review the precise
18819 definition of the effect of defining @cite{Bit_Order}.  The effect of a
18820 non-standard bit order is described in section 13.5.3 of the Ada
18821 Reference Manual:
18823 @quotation
18825 "2   A bit ordering is a method of interpreting the meaning of
18826 the storage place attributes."
18827 @end quotation
18829 To understand the precise definition of storage place attributes in
18830 this context, we visit section 13.5.1 of the manual:
18832 @quotation
18834 "13   A record_representation_clause (without the mod_clause)
18835 specifies the layout.  The storage place attributes (see 13.5.2)
18836 are taken from the values of the position, first_bit, and last_bit
18837 expressions after normalizing those values so that first_bit is
18838 less than Storage_Unit."
18839 @end quotation
18841 The critical point here is that storage places are taken from
18842 the values after normalization, not before.  So the @cite{Bit_Order}
18843 interpretation applies to normalized values.  The interpretation
18844 is described in the later part of the 13.5.3 paragraph:
18846 @quotation
18848 "2   A bit ordering is a method of interpreting the meaning of
18849 the storage place attributes.  High_Order_First (known in the
18850 vernacular as 'big endian') means that the first bit of a
18851 storage element (bit 0) is the most significant bit (interpreting
18852 the sequence of bits that represent a component as an unsigned
18853 integer value).  Low_Order_First (known in the vernacular as
18854 'little endian') means the opposite: the first bit is the
18855 least significant."
18856 @end quotation
18858 Note that the numbering is with respect to the bits of a storage
18859 unit.  In other words, the specification affects only the numbering
18860 of bits within a single storage unit.
18862 We can make the effect clearer by giving an example.
18864 Suppose that we have an external device which presents two bytes, the first
18865 byte presented, which is the first (low addressed byte) of the two byte
18866 record is called Master, and the second byte is called Slave.
18868 The left most (most significant bit is called Control for each byte, and
18869 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
18870 (least significant) bit.
18872 On a big-endian machine, we can write the following representation clause
18874 @example
18875 type Data is record
18876    Master_Control : Bit;
18877    Master_V1      : Bit;
18878    Master_V2      : Bit;
18879    Master_V3      : Bit;
18880    Master_V4      : Bit;
18881    Master_V5      : Bit;
18882    Master_V6      : Bit;
18883    Master_V7      : Bit;
18884    Slave_Control  : Bit;
18885    Slave_V1       : Bit;
18886    Slave_V2       : Bit;
18887    Slave_V3       : Bit;
18888    Slave_V4       : Bit;
18889    Slave_V5       : Bit;
18890    Slave_V6       : Bit;
18891    Slave_V7       : Bit;
18892 end record;
18894 for Data use record
18895    Master_Control at 0 range 0 .. 0;
18896    Master_V1      at 0 range 1 .. 1;
18897    Master_V2      at 0 range 2 .. 2;
18898    Master_V3      at 0 range 3 .. 3;
18899    Master_V4      at 0 range 4 .. 4;
18900    Master_V5      at 0 range 5 .. 5;
18901    Master_V6      at 0 range 6 .. 6;
18902    Master_V7      at 0 range 7 .. 7;
18903    Slave_Control  at 1 range 0 .. 0;
18904    Slave_V1       at 1 range 1 .. 1;
18905    Slave_V2       at 1 range 2 .. 2;
18906    Slave_V3       at 1 range 3 .. 3;
18907    Slave_V4       at 1 range 4 .. 4;
18908    Slave_V5       at 1 range 5 .. 5;
18909    Slave_V6       at 1 range 6 .. 6;
18910    Slave_V7       at 1 range 7 .. 7;
18911 end record;
18912 @end example
18914 Now if we move this to a little endian machine, then the bit ordering within
18915 the byte is backwards, so we have to rewrite the record rep clause as:
18917 @example
18918 for Data use record
18919    Master_Control at 0 range 7 .. 7;
18920    Master_V1      at 0 range 6 .. 6;
18921    Master_V2      at 0 range 5 .. 5;
18922    Master_V3      at 0 range 4 .. 4;
18923    Master_V4      at 0 range 3 .. 3;
18924    Master_V5      at 0 range 2 .. 2;
18925    Master_V6      at 0 range 1 .. 1;
18926    Master_V7      at 0 range 0 .. 0;
18927    Slave_Control  at 1 range 7 .. 7;
18928    Slave_V1       at 1 range 6 .. 6;
18929    Slave_V2       at 1 range 5 .. 5;
18930    Slave_V3       at 1 range 4 .. 4;
18931    Slave_V4       at 1 range 3 .. 3;
18932    Slave_V5       at 1 range 2 .. 2;
18933    Slave_V6       at 1 range 1 .. 1;
18934    Slave_V7       at 1 range 0 .. 0;
18935 end record;
18936 @end example
18938 It is a nuisance to have to rewrite the clause, especially if
18939 the code has to be maintained on both machines.  However,
18940 this is a case that we can handle with the
18941 @cite{Bit_Order} attribute if it is implemented.
18942 Note that the implementation is not required on byte addressed
18943 machines, but it is indeed implemented in GNAT.
18944 This means that we can simply use the
18945 first record clause, together with the declaration
18947 @example
18948 for Data'Bit_Order use High_Order_First;
18949 @end example
18951 and the effect is what is desired, namely the layout is exactly the same,
18952 independent of whether the code is compiled on a big-endian or little-endian
18953 machine.
18955 The important point to understand is that byte ordering is not affected.
18956 A @cite{Bit_Order} attribute definition never affects which byte a field
18957 ends up in, only where it ends up in that byte.
18958 To make this clear, let us rewrite the record rep clause of the previous
18959 example as:
18961 @example
18962 for Data'Bit_Order use High_Order_First;
18963 for Data use record
18964    Master_Control at 0 range  0 .. 0;
18965    Master_V1      at 0 range  1 .. 1;
18966    Master_V2      at 0 range  2 .. 2;
18967    Master_V3      at 0 range  3 .. 3;
18968    Master_V4      at 0 range  4 .. 4;
18969    Master_V5      at 0 range  5 .. 5;
18970    Master_V6      at 0 range  6 .. 6;
18971    Master_V7      at 0 range  7 .. 7;
18972    Slave_Control  at 0 range  8 .. 8;
18973    Slave_V1       at 0 range  9 .. 9;
18974    Slave_V2       at 0 range 10 .. 10;
18975    Slave_V3       at 0 range 11 .. 11;
18976    Slave_V4       at 0 range 12 .. 12;
18977    Slave_V5       at 0 range 13 .. 13;
18978    Slave_V6       at 0 range 14 .. 14;
18979    Slave_V7       at 0 range 15 .. 15;
18980 end record;
18981 @end example
18983 This is exactly equivalent to saying (a repeat of the first example):
18985 @example
18986 for Data'Bit_Order use High_Order_First;
18987 for Data use record
18988    Master_Control at 0 range 0 .. 0;
18989    Master_V1      at 0 range 1 .. 1;
18990    Master_V2      at 0 range 2 .. 2;
18991    Master_V3      at 0 range 3 .. 3;
18992    Master_V4      at 0 range 4 .. 4;
18993    Master_V5      at 0 range 5 .. 5;
18994    Master_V6      at 0 range 6 .. 6;
18995    Master_V7      at 0 range 7 .. 7;
18996    Slave_Control  at 1 range 0 .. 0;
18997    Slave_V1       at 1 range 1 .. 1;
18998    Slave_V2       at 1 range 2 .. 2;
18999    Slave_V3       at 1 range 3 .. 3;
19000    Slave_V4       at 1 range 4 .. 4;
19001    Slave_V5       at 1 range 5 .. 5;
19002    Slave_V6       at 1 range 6 .. 6;
19003    Slave_V7       at 1 range 7 .. 7;
19004 end record;
19005 @end example
19007 Why are they equivalent? Well take a specific field, the @cite{Slave_V2}
19008 field.  The storage place attributes are obtained by normalizing the
19009 values given so that the @cite{First_Bit} value is less than 8.  After
19010 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19011 we specified in the other case.
19013 Now one might expect that the @cite{Bit_Order} attribute might affect
19014 bit numbering within the entire record component (two bytes in this
19015 case, thus affecting which byte fields end up in), but that is not
19016 the way this feature is defined, it only affects numbering of bits,
19017 not which byte they end up in.
19019 Consequently it never makes sense to specify a starting bit number
19020 greater than 7 (for a byte addressable field) if an attribute
19021 definition for @cite{Bit_Order} has been given, and indeed it
19022 may be actively confusing to specify such a value, so the compiler
19023 generates a warning for such usage.
19025 If you do need to control byte ordering then appropriate conditional
19026 values must be used.  If in our example, the slave byte came first on
19027 some machines we might write:
19029 @example
19030 Master_Byte_First constant Boolean := ...;
19032 Master_Byte : constant Natural :=
19033                 1 - Boolean'Pos (Master_Byte_First);
19034 Slave_Byte  : constant Natural :=
19035                 Boolean'Pos (Master_Byte_First);
19037 for Data'Bit_Order use High_Order_First;
19038 for Data use record
19039    Master_Control at Master_Byte range 0 .. 0;
19040    Master_V1      at Master_Byte range 1 .. 1;
19041    Master_V2      at Master_Byte range 2 .. 2;
19042    Master_V3      at Master_Byte range 3 .. 3;
19043    Master_V4      at Master_Byte range 4 .. 4;
19044    Master_V5      at Master_Byte range 5 .. 5;
19045    Master_V6      at Master_Byte range 6 .. 6;
19046    Master_V7      at Master_Byte range 7 .. 7;
19047    Slave_Control  at Slave_Byte  range 0 .. 0;
19048    Slave_V1       at Slave_Byte  range 1 .. 1;
19049    Slave_V2       at Slave_Byte  range 2 .. 2;
19050    Slave_V3       at Slave_Byte  range 3 .. 3;
19051    Slave_V4       at Slave_Byte  range 4 .. 4;
19052    Slave_V5       at Slave_Byte  range 5 .. 5;
19053    Slave_V6       at Slave_Byte  range 6 .. 6;
19054    Slave_V7       at Slave_Byte  range 7 .. 7;
19055 end record;
19056 @end example
19058 Now to switch between machines, all that is necessary is
19059 to set the boolean constant @cite{Master_Byte_First} in
19060 an appropriate manner.
19062 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19063 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{279}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{27a}
19064 @section Pragma Pack for Arrays
19067 @geindex Pragma Pack (for arrays)
19069 Pragma @cite{Pack} applied to an array has an effect that depends upon whether the
19070 component type is @emph{packable}.  For a component type to be @emph{packable}, it must
19071 be one of the following cases:
19074 @itemize *
19076 @item 
19077 Any elementary type.
19079 @item 
19080 Any small packed array type with a static size.
19082 @item 
19083 Any small simple record type with a static size.
19084 @end itemize
19086 For all these cases, if the component subtype size is in the range
19087 1 through 64, then the effect of the pragma @cite{Pack} is exactly as though a
19088 component size were specified giving the component subtype size.
19090 All other types are non-packable, they occupy an integral number of storage
19091 units and the only effect of pragma Pack is to remove alignment gaps.
19093 For example if we have:
19095 @example
19096 type r is range 0 .. 17;
19098 type ar is array (1 .. 8) of r;
19099 pragma Pack (ar);
19100 @end example
19102 Then the component size of @cite{ar} will be set to 5 (i.e., to @cite{r'size},
19103 and the size of the array @cite{ar} will be exactly 40 bits).
19105 Note that in some cases this rather fierce approach to packing can produce
19106 unexpected effects.  For example, in Ada 95 and Ada 2005,
19107 subtype @cite{Natural} typically has a size of 31, meaning that if you
19108 pack an array of @cite{Natural}, you get 31-bit
19109 close packing, which saves a few bits, but results in far less efficient
19110 access.  Since many other Ada compilers will ignore such a packing request,
19111 GNAT will generate a warning on some uses of pragma @cite{Pack} that it guesses
19112 might not be what is intended.  You can easily remove this warning by
19113 using an explicit @cite{Component_Size} setting instead, which never generates
19114 a warning, since the intention of the programmer is clear in this case.
19116 GNAT treats packed arrays in one of two ways.  If the size of the array is
19117 known at compile time and is less than 64 bits, then internally the array
19118 is represented as a single modular type, of exactly the appropriate number
19119 of bits.  If the length is greater than 63 bits, or is not known at compile
19120 time, then the packed array is represented as an array of bytes, and the
19121 length is always a multiple of 8 bits.
19123 Note that to represent a packed array as a modular type, the alignment must
19124 be suitable for the modular type involved. For example, on typical machines
19125 a 32-bit packed array will be represented by a 32-bit modular integer with
19126 an alignment of four bytes. If you explicitly override the default alignment
19127 with an alignment clause that is too small, the modular representation
19128 cannot be used. For example, consider the following set of declarations:
19130 @example
19131 type R is range 1 .. 3;
19132 type S is array (1 .. 31) of R;
19133 for S'Component_Size use 2;
19134 for S'Size use 62;
19135 for S'Alignment use 1;
19136 @end example
19138 If the alignment clause were not present, then a 62-bit modular
19139 representation would be chosen (typically with an alignment of 4 or 8
19140 bytes depending on the target). But the default alignment is overridden
19141 with the explicit alignment clause. This means that the modular
19142 representation cannot be used, and instead the array of bytes
19143 representation must be used, meaning that the length must be a multiple
19144 of 8. Thus the above set of declarations will result in a diagnostic
19145 rejecting the size clause and noting that the minimum size allowed is 64.
19147 @geindex Pragma Pack (for type Natural)
19149 @geindex Pragma Pack warning
19151 One special case that is worth noting occurs when the base type of the
19152 component size is 8/16/32 and the subtype is one bit less. Notably this
19153 occurs with subtype @cite{Natural}. Consider:
19155 @example
19156 type Arr is array (1 .. 32) of Natural;
19157 pragma Pack (Arr);
19158 @end example
19160 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19161 since typically @cite{Natural'Size} is 32 in Ada 83, and in any case most
19162 Ada 83 compilers did not attempt 31 bit packing.
19164 In Ada 95 and Ada 2005, @cite{Natural'Size} is required to be 31. Furthermore,
19165 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19166 substantial unintended performance penalty when porting legacy Ada 83 code.
19167 To help prevent this, GNAT generates a warning in such cases. If you really
19168 want 31 bit packing in a case like this, you can set the component size
19169 explicitly:
19171 @example
19172 type Arr is array (1 .. 32) of Natural;
19173 for Arr'Component_Size use 31;
19174 @end example
19176 Here 31-bit packing is achieved as required, and no warning is generated,
19177 since in this case the programmer intention is clear.
19179 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19180 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{27b}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{27c}
19181 @section Pragma Pack for Records
19184 @geindex Pragma Pack (for records)
19186 Pragma @cite{Pack} applied to a record will pack the components to reduce
19187 wasted space from alignment gaps and by reducing the amount of space
19188 taken by components.  We distinguish between @emph{packable} components and
19189 @emph{non-packable} components.
19190 Components of the following types are considered packable:
19193 @itemize *
19195 @item 
19196 Components of an elementary type are packable unless they are aliased,
19197 independent, or of an atomic type.
19199 @item 
19200 Small packed arrays, where the size is statically known, are represented
19201 internally as modular integers, and so they are also packable.
19203 @item 
19204 Small simple records, where the size is statically known, are also packable.
19205 @end itemize
19207 For all these cases, if the 'Size value is in the range 1 through 64, the
19208 components occupy the exact number of bits corresponding to this value
19209 and are packed with no padding bits, i.e. they can start on an arbitrary
19210 bit boundary.
19212 All other types are non-packable, they occupy an integral number of storage
19213 units and the only effect of pragma Pack is to remove alignment gaps.
19215 For example, consider the record
19217 @example
19218 type Rb1 is array (1 .. 13) of Boolean;
19219 pragma Pack (Rb1);
19221 type Rb2 is array (1 .. 65) of Boolean;
19222 pragma Pack (Rb2);
19224 type AF is new Float with Atomic;
19226 type X2 is record
19227    L1 : Boolean;
19228    L2 : Duration;
19229    L3 : AF;
19230    L4 : Boolean;
19231    L5 : Rb1;
19232    L6 : Rb2;
19233 end record;
19234 pragma Pack (X2);
19235 @end example
19237 The representation for the record X2 is as follows:
19239 @example
19240 for X2'Size use 224;
19241 for X2 use record
19242    L1 at  0 range  0 .. 0;
19243    L2 at  0 range  1 .. 64;
19244    L3 at 12 range  0 .. 31;
19245    L4 at 16 range  0 .. 0;
19246    L5 at 16 range  1 .. 13;
19247    L6 at 18 range  0 .. 71;
19248 end record;
19249 @end example
19251 Studying this example, we see that the packable fields @cite{L1}
19252 and @cite{L2} are
19253 of length equal to their sizes, and placed at specific bit boundaries (and
19254 not byte boundaries) to
19255 eliminate padding.  But @cite{L3} is of a non-packable float type (because
19256 it is aliased), so it is on the next appropriate alignment boundary.
19258 The next two fields are fully packable, so @cite{L4} and @cite{L5} are
19259 minimally packed with no gaps.  However, type @cite{Rb2} is a packed
19260 array that is longer than 64 bits, so it is itself non-packable.  Thus
19261 the @cite{L6} field is aligned to the next byte boundary, and takes an
19262 integral number of bytes, i.e., 72 bits.
19264 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19265 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{27d}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{27e}
19266 @section Record Representation Clauses
19269 @geindex Record Representation Clause
19271 Record representation clauses may be given for all record types, including
19272 types obtained by record extension.  Component clauses are allowed for any
19273 static component.  The restrictions on component clauses depend on the type
19274 of the component.
19276 @geindex Component Clause
19278 For all components of an elementary type, the only restriction on component
19279 clauses is that the size must be at least the 'Size value of the type
19280 (actually the Value_Size).  There are no restrictions due to alignment,
19281 and such components may freely cross storage boundaries.
19283 Packed arrays with a size up to and including 64 bits are represented
19284 internally using a modular type with the appropriate number of bits, and
19285 thus the same lack of restriction applies.  For example, if you declare:
19287 @example
19288 type R is array (1 .. 49) of Boolean;
19289 pragma Pack (R);
19290 for R'Size use 49;
19291 @end example
19293 then a component clause for a component of type R may start on any
19294 specified bit boundary, and may specify a value of 49 bits or greater.
19296 For packed bit arrays that are longer than 64 bits, there are two
19297 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19298 including the important case of single bits or boolean values, then
19299 there are no limitations on placement of such components, and they
19300 may start and end at arbitrary bit boundaries.
19302 If the component size is not a power of 2 (e.g., 3 or 5), then
19303 an array of this type longer than 64 bits must always be placed on
19304 on a storage unit (byte) boundary and occupy an integral number
19305 of storage units (bytes). Any component clause that does not
19306 meet this requirement will be rejected.
19308 Any aliased component, or component of an aliased type, must
19309 have its normal alignment and size. A component clause that
19310 does not meet this requirement will be rejected.
19312 The tag field of a tagged type always occupies an address sized field at
19313 the start of the record.  No component clause may attempt to overlay this
19314 tag. When a tagged type appears as a component, the tag field must have
19315 proper alignment
19317 In the case of a record extension T1, of a type T, no component clause applied
19318 to the type T1 can specify a storage location that would overlap the first
19319 T'Size bytes of the record.
19321 For all other component types, including non-bit-packed arrays,
19322 the component can be placed at an arbitrary bit boundary,
19323 so for example, the following is permitted:
19325 @example
19326 type R is array (1 .. 10) of Boolean;
19327 for R'Size use 80;
19329 type Q is record
19330    G, H : Boolean;
19331    L, M : R;
19332 end record;
19334 for Q use record
19335    G at 0 range  0 ..   0;
19336    H at 0 range  1 ..   1;
19337    L at 0 range  2 ..  81;
19338    R at 0 range 82 .. 161;
19339 end record;
19340 @end example
19342 Note: the above rules apply to recent releases of GNAT 5.
19343 In GNAT 3, there are more severe restrictions on larger components.
19344 For composite types, including packed arrays with a size greater than
19345 64 bits, component clauses must respect the alignment requirement of the
19346 type, in particular, always starting on a byte boundary, and the length
19347 must be a multiple of the storage unit.
19349 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19350 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{27f}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{280}
19351 @section Handling of Records with Holes
19354 @geindex Handling of Records with Holes
19356 As a result of alignment considerations, records may contain "holes"
19357 or gaps
19358 which do not correspond to the data bits of any of the components.
19359 Record representation clauses can also result in holes in records.
19361 GNAT does not attempt to clear these holes, so in record objects,
19362 they should be considered to hold undefined rubbish. The generated
19363 equality routine just tests components so does not access these
19364 undefined bits, and assignment and copy operations may or may not
19365 preserve the contents of these holes (for assignments, the holes
19366 in the target will in practice contain either the bits that are
19367 present in the holes in the source, or the bits that were present
19368 in the target before the assignment).
19370 If it is necessary to ensure that holes in records have all zero
19371 bits, then record objects for which this initialization is desired
19372 should be explicitly set to all zero values using Unchecked_Conversion
19373 or address overlays. For example
19375 @example
19376 type HRec is record
19377    C : Character;
19378    I : Integer;
19379 end record;
19380 @end example
19382 On typical machines, integers need to be aligned on a four-byte
19383 boundary, resulting in three bytes of undefined rubbish following
19384 the 8-bit field for C. To ensure that the hole in a variable of
19385 type HRec is set to all zero bits,
19386 you could for example do:
19388 @example
19389 type Base is record
19390    Dummy1, Dummy2 : Integer := 0;
19391 end record;
19393 BaseVar : Base;
19394 RealVar : Hrec;
19395 for RealVar'Address use BaseVar'Address;
19396 @end example
19398 Now the 8-bytes of the value of RealVar start out containing all zero
19399 bits. A safer approach is to just define dummy fields, avoiding the
19400 holes, as in:
19402 @example
19403 type HRec is record
19404    C      : Character;
19405    Dummy1 : Short_Short_Integer := 0;
19406    Dummy2 : Short_Short_Integer := 0;
19407    Dummy3 : Short_Short_Integer := 0;
19408    I      : Integer;
19409 end record;
19410 @end example
19412 And to make absolutely sure that the intent of this is followed, you
19413 can use representation clauses:
19415 @example
19416 for Hrec use record
19417    C      at 0 range 0 .. 7;
19418    Dummy1 at 1 range 0 .. 7;
19419    Dummy2 at 2 range 0 .. 7;
19420    Dummy3 at 3 range 0 .. 7;
19421    I      at 4 range 0 .. 31;
19422 end record;
19423 for Hrec'Size use 64;
19424 @end example
19426 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19427 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{281}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{282}
19428 @section Enumeration Clauses
19431 The only restriction on enumeration clauses is that the range of values
19432 must be representable.  For the signed case, if one or more of the
19433 representation values are negative, all values must be in the range:
19435 @example
19436 System.Min_Int .. System.Max_Int
19437 @end example
19439 For the unsigned case, where all values are nonnegative, the values must
19440 be in the range:
19442 @example
19443 0 .. System.Max_Binary_Modulus;
19444 @end example
19446 A @emph{confirming} representation clause is one in which the values range
19447 from 0 in sequence, i.e., a clause that confirms the default representation
19448 for an enumeration type.
19449 Such a confirming representation
19450 is permitted by these rules, and is specially recognized by the compiler so
19451 that no extra overhead results from the use of such a clause.
19453 If an array has an index type which is an enumeration type to which an
19454 enumeration clause has been applied, then the array is stored in a compact
19455 manner.  Consider the declarations:
19457 @example
19458 type r is (A, B, C);
19459 for r use (A => 1, B => 5, C => 10);
19460 type t is array (r) of Character;
19461 @end example
19463 The array type t corresponds to a vector with exactly three elements and
19464 has a default size equal to @cite{3*Character'Size}.  This ensures efficient
19465 use of space, but means that accesses to elements of the array will incur
19466 the overhead of converting representation values to the corresponding
19467 positional values, (i.e., the value delivered by the @cite{Pos} attribute).
19469 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19470 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{283}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{284}
19471 @section Address Clauses
19474 @geindex Address Clause
19476 The reference manual allows a general restriction on representation clauses,
19477 as found in RM 13.1(22):
19479 @quotation
19481 "An implementation need not support representation
19482 items containing nonstatic expressions, except that
19483 an implementation should support a representation item
19484 for a given entity if each nonstatic expression in the
19485 representation item is a name that statically denotes
19486 a constant declared before the entity."
19487 @end quotation
19489 In practice this is applicable only to address clauses, since this is the
19490 only case in which a nonstatic expression is permitted by the syntax.  As
19491 the AARM notes in sections 13.1 (22.a-22.h):
19493 @quotation
19495 22.a   Reason: This is to avoid the following sort of thing:
19497 22.b        X : Integer := F(...);
19498 Y : Address := G(...);
19499 for X'Address use Y;
19501 22.c   In the above, we have to evaluate the
19502 initialization expression for X before we
19503 know where to put the result.  This seems
19504 like an unreasonable implementation burden.
19506 22.d   The above code should instead be written
19507 like this:
19509 22.e        Y : constant Address := G(...);
19510 X : Integer := F(...);
19511 for X'Address use Y;
19513 22.f   This allows the expression 'Y' to be safely
19514 evaluated before X is created.
19516 22.g   The constant could be a formal parameter of mode in.
19518 22.h   An implementation can support other nonstatic
19519 expressions if it wants to.  Expressions of type
19520 Address are hardly ever static, but their value
19521 might be known at compile time anyway in many
19522 cases.
19523 @end quotation
19525 GNAT does indeed permit many additional cases of nonstatic expressions.  In
19526 particular, if the type involved is elementary there are no restrictions
19527 (since in this case, holding a temporary copy of the initialization value,
19528 if one is present, is inexpensive).  In addition, if there is no implicit or
19529 explicit initialization, then there are no restrictions.  GNAT will reject
19530 only the case where all three of these conditions hold:
19533 @itemize *
19535 @item 
19536 The type of the item is non-elementary (e.g., a record or array).
19538 @item 
19539 There is explicit or implicit initialization required for the object.
19540 Note that access values are always implicitly initialized.
19542 @item 
19543 The address value is nonstatic.  Here GNAT is more permissive than the
19544 RM, and allows the address value to be the address of a previously declared
19545 stand-alone variable, as long as it does not itself have an address clause.
19547 @example
19548 Anchor  : Some_Initialized_Type;
19549 Overlay : Some_Initialized_Type;
19550 for Overlay'Address use Anchor'Address;
19551 @end example
19553 However, the prefix of the address clause cannot be an array component, or
19554 a component of a discriminated record.
19555 @end itemize
19557 As noted above in section 22.h, address values are typically nonstatic.  In
19558 particular the To_Address function, even if applied to a literal value, is
19559 a nonstatic function call.  To avoid this minor annoyance, GNAT provides
19560 the implementation defined attribute 'To_Address.  The following two
19561 expressions have identical values:
19563 @geindex Attribute
19565 @geindex To_Address
19567 @example
19568 To_Address (16#1234_0000#)
19569 System'To_Address (16#1234_0000#);
19570 @end example
19572 except that the second form is considered to be a static expression, and
19573 thus when used as an address clause value is always permitted.
19575 Additionally, GNAT treats as static an address clause that is an
19576 unchecked_conversion of a static integer value.  This simplifies the porting
19577 of legacy code, and provides a portable equivalent to the GNAT attribute
19578 @cite{To_Address}.
19580 Another issue with address clauses is the interaction with alignment
19581 requirements.  When an address clause is given for an object, the address
19582 value must be consistent with the alignment of the object (which is usually
19583 the same as the alignment of the type of the object).  If an address clause
19584 is given that specifies an inappropriately aligned address value, then the
19585 program execution is erroneous.
19587 Since this source of erroneous behavior can have unfortunate effects on
19588 machines with strict alignment requirements, GNAT
19589 checks (at compile time if possible, generating a warning, or at execution
19590 time with a run-time check) that the alignment is appropriate.  If the
19591 run-time check fails, then @cite{Program_Error} is raised.  This run-time
19592 check is suppressed if range checks are suppressed, or if the special GNAT
19593 check Alignment_Check is suppressed, or if
19594 @cite{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
19595 suppressed by default on non-strict alignment machines (such as the x86).
19597 Finally, GNAT does not permit overlaying of objects of class-wide types. In
19598 most cases, the compiler can detect an attempt at such overlays and will
19599 generate a warning at compile time and a Program_Error exception at run time.
19601 @geindex Export
19603 An address clause cannot be given for an exported object.  More
19604 understandably the real restriction is that objects with an address
19605 clause cannot be exported.  This is because such variables are not
19606 defined by the Ada program, so there is no external object to export.
19608 @geindex Import
19610 It is permissible to give an address clause and a pragma Import for the
19611 same object.  In this case, the variable is not really defined by the
19612 Ada program, so there is no external symbol to be linked.  The link name
19613 and the external name are ignored in this case.  The reason that we allow this
19614 combination is that it provides a useful idiom to avoid unwanted
19615 initializations on objects with address clauses.
19617 When an address clause is given for an object that has implicit or
19618 explicit initialization, then by default initialization takes place.  This
19619 means that the effect of the object declaration is to overwrite the
19620 memory at the specified address.  This is almost always not what the
19621 programmer wants, so GNAT will output a warning:
19623 @example
19624 with System;
19625 package G is
19626    type R is record
19627       M : Integer := 0;
19628    end record;
19630    Ext : R;
19631    for Ext'Address use System'To_Address (16#1234_1234#);
19632        |
19633 >>> warning: implicit initialization of "Ext" may
19634     modify overlaid storage
19635 >>> warning: use pragma Import for "Ext" to suppress
19636     initialization (RM B(24))
19638 end G;
19639 @end example
19641 As indicated by the warning message, the solution is to use a (dummy) pragma
19642 Import to suppress this initialization.  The pragma tell the compiler that the
19643 object is declared and initialized elsewhere.  The following package compiles
19644 without warnings (and the initialization is suppressed):
19646 @example
19647 with System;
19648 package G is
19649    type R is record
19650       M : Integer := 0;
19651    end record;
19653    Ext : R;
19654    for Ext'Address use System'To_Address (16#1234_1234#);
19655    pragma Import (Ada, Ext);
19656 end G;
19657 @end example
19659 A final issue with address clauses involves their use for overlaying
19660 variables, as in the following example:
19662 @geindex Overlaying of objects
19664 @example
19665 A : Integer;
19666 B : Integer;
19667 for B'Address use A'Address;
19668 @end example
19670 or alternatively, using the form recommended by the RM:
19672 @example
19673 A    : Integer;
19674 Addr : constant Address := A'Address;
19675 B    : Integer;
19676 for B'Address use Addr;
19677 @end example
19679 In both of these cases, @cite{A} and @cite{B} become aliased to one another
19680 via the address clause. This use of address clauses to overlay
19681 variables, achieving an effect similar to unchecked conversion
19682 was erroneous in Ada 83, but in Ada 95 and Ada 2005
19683 the effect is implementation defined. Furthermore, the
19684 Ada RM specifically recommends that in a situation
19685 like this, @cite{B} should be subject to the following
19686 implementation advice (RM 13.3(19)):
19688 @quotation
19690 "19  If the Address of an object is specified, or it is imported
19691 or exported, then the implementation should not perform
19692 optimizations based on assumptions of no aliases."
19693 @end quotation
19695 GNAT follows this recommendation, and goes further by also applying
19696 this recommendation to the overlaid variable (@cite{A} in the above example)
19697 in this case. This means that the overlay works "as expected", in that
19698 a modification to one of the variables will affect the value of the other.
19700 More generally, GNAT interprets this recommendation conservatively for
19701 address clauses: in the cases other than overlays, it considers that the
19702 object is effectively subject to pragma @cite{Volatile} and implements the
19703 associated semantics.
19705 Note that when address clause overlays are used in this way, there is an
19706 issue of unintentional initialization, as shown by this example:
19708 @example
19709 package Overwrite_Record is
19710    type R is record
19711       A : Character := 'C';
19712       B : Character := 'A';
19713    end record;
19714    X : Short_Integer := 3;
19715    Y : R;
19716    for Y'Address use X'Address;
19717        |
19718 >>> warning: default initialization of "Y" may
19719     modify "X", use pragma Import for "Y" to
19720     suppress initialization (RM B.1(24))
19722 end Overwrite_Record;
19723 @end example
19725 Here the default initialization of @cite{Y} will clobber the value
19726 of @cite{X}, which justifies the warning. The warning notes that
19727 this effect can be eliminated by adding a @cite{pragma Import}
19728 which suppresses the initialization:
19730 @example
19731 package Overwrite_Record is
19732    type R is record
19733       A : Character := 'C';
19734       B : Character := 'A';
19735    end record;
19736    X : Short_Integer := 3;
19737    Y : R;
19738    for Y'Address use X'Address;
19739    pragma Import (Ada, Y);
19740 end Overwrite_Record;
19741 @end example
19743 Note that the use of @cite{pragma Initialize_Scalars} may cause variables to
19744 be initialized when they would not otherwise have been in the absence
19745 of the use of this pragma. This may cause an overlay to have this
19746 unintended clobbering effect. The compiler avoids this for scalar
19747 types, but not for composite objects (where in general the effect
19748 of @cite{Initialize_Scalars} is part of the initialization routine
19749 for the composite object:
19751 @example
19752 pragma Initialize_Scalars;
19753 with Ada.Text_IO;  use Ada.Text_IO;
19754 procedure Overwrite_Array is
19755    type Arr is array (1 .. 5) of Integer;
19756    X : Arr := (others => 1);
19757    A : Arr;
19758    for A'Address use X'Address;
19759        |
19760 >>> warning: default initialization of "A" may
19761     modify "X", use pragma Import for "A" to
19762     suppress initialization (RM B.1(24))
19764 begin
19765    if X /= Arr'(others => 1) then
19766       Put_Line ("X was clobbered");
19767    else
19768       Put_Line ("X was not clobbered");
19769    end if;
19770 end Overwrite_Array;
19771 @end example
19773 The above program generates the warning as shown, and at execution
19774 time, prints @cite{X was clobbered}. If the @cite{pragma Import} is
19775 added as suggested:
19777 @example
19778 pragma Initialize_Scalars;
19779 with Ada.Text_IO;  use Ada.Text_IO;
19780 procedure Overwrite_Array is
19781    type Arr is array (1 .. 5) of Integer;
19782    X : Arr := (others => 1);
19783    A : Arr;
19784    for A'Address use X'Address;
19785    pragma Import (Ada, A);
19786 begin
19787    if X /= Arr'(others => 1) then
19788       Put_Line ("X was clobbered");
19789    else
19790       Put_Line ("X was not clobbered");
19791    end if;
19792 end Overwrite_Array;
19793 @end example
19795 then the program compiles without the warning and when run will generate
19796 the output @cite{X was not clobbered}.
19798 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
19799 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{285}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{286}
19800 @section Use of Address Clauses for Memory-Mapped I/O
19803 @geindex Memory-mapped I/O
19805 A common pattern is to use an address clause to map an atomic variable to
19806 a location in memory that corresponds to a memory-mapped I/O operation or
19807 operations, for example:
19809 @example
19810 type Mem_Word is record
19811    A,B,C,D : Byte;
19812 end record;
19813 pragma Atomic (Mem_Word);
19814 for Mem_Word_Size use 32;
19816 Mem : Mem_Word;
19817 for Mem'Address use some-address;
19819 Temp := Mem;
19820 Temp.A := 32;
19821 Mem := Temp;
19822 @end example
19824 For a full access (reference or modification) of the variable (Mem) in this
19825 case, as in the above examples, GNAT guarantees that the entire atomic word
19826 will be accessed, in accordance with the RM C.6(15) clause.
19828 A problem arises with a component access such as:
19830 @example
19831 Mem.A := 32;
19832 @end example
19834 Note that the component A is not declared as atomic. This means that it is
19835 not clear what this assignment means. It could correspond to full word read
19836 and write as given in the first example, or on architectures that supported
19837 such an operation it might be a single byte store instruction. The RM does
19838 not have anything to say in this situation, and GNAT does not make any
19839 guarantee. The code generated may vary from target to target. GNAT will issue
19840 a warning in such a case:
19842 @example
19843 Mem.A := 32;
19845 >>> warning: access to non-atomic component of atomic array,
19846     may cause unexpected accesses to atomic object
19847 @end example
19849 It is best to be explicit in this situation, by either declaring the
19850 components to be atomic if you want the byte store, or explicitly writing
19851 the full word access sequence if that is what the hardware requires.
19852 Alternatively, if the full word access sequence is required, GNAT also
19853 provides the pragma @cite{Volatile_Full_Access} which can be used in lieu of
19854 pragma @cite{Atomic} and will give the additional guarantee.
19856 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
19857 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{287}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{288}
19858 @section Effect of Convention on Representation
19861 @geindex Convention
19862 @geindex effect on representation
19864 Normally the specification of a foreign language convention for a type or
19865 an object has no effect on the chosen representation.  In particular, the
19866 representation chosen for data in GNAT generally meets the standard system
19867 conventions, and for example records are laid out in a manner that is
19868 consistent with C.  This means that specifying convention C (for example)
19869 has no effect.
19871 There are four exceptions to this general rule:
19874 @itemize *
19876 @item 
19877 @emph{Convention Fortran and array subtypes}.
19879 If pragma Convention Fortran is specified for an array subtype, then in
19880 accordance with the implementation advice in section 3.6.2(11) of the
19881 Ada Reference Manual, the array will be stored in a Fortran-compatible
19882 column-major manner, instead of the normal default row-major order.
19884 @item 
19885 @emph{Convention C and enumeration types}
19887 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
19888 to accommodate all values of the type.  For example, for the enumeration
19889 type declared by:
19891 @example
19892 type Color is (Red, Green, Blue);
19893 @end example
19895 8 bits is sufficient to store all values of the type, so by default, objects
19896 of type @cite{Color} will be represented using 8 bits.  However, normal C
19897 convention is to use 32 bits for all enum values in C, since enum values
19898 are essentially of type int.  If pragma @cite{Convention C} is specified for an
19899 Ada enumeration type, then the size is modified as necessary (usually to
19900 32 bits) to be consistent with the C convention for enum values.
19902 Note that this treatment applies only to types. If Convention C is given for
19903 an enumeration object, where the enumeration type is not Convention C, then
19904 Object_Size bits are allocated. For example, for a normal enumeration type,
19905 with less than 256 elements, only 8 bits will be allocated for the object.
19906 Since this may be a surprise in terms of what C expects, GNAT will issue a
19907 warning in this situation. The warning can be suppressed by giving an explicit
19908 size clause specifying the desired size.
19910 @item 
19911 @emph{Convention C/Fortran and Boolean types}
19913 In C, the usual convention for boolean values, that is values used for
19914 conditions, is that zero represents false, and nonzero values represent
19915 true.  In Ada, the normal convention is that two specific values, typically
19916 0/1, are used to represent false/true respectively.
19918 Fortran has a similar convention for @cite{LOGICAL} values (any nonzero
19919 value represents true).
19921 To accommodate the Fortran and C conventions, if a pragma Convention specifies
19922 C or Fortran convention for a derived Boolean, as in the following example:
19924 @example
19925 type C_Switch is new Boolean;
19926 pragma Convention (C, C_Switch);
19927 @end example
19929 then the GNAT generated code will treat any nonzero value as true.  For truth
19930 values generated by GNAT, the conventional value 1 will be used for True, but
19931 when one of these values is read, any nonzero value is treated as True.
19932 @end itemize
19934 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
19935 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{289}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{28a}
19936 @section Conventions and Anonymous Access Types
19939 @geindex Anonymous access types
19941 @geindex Convention for anonymous access types
19943 The RM is not entirely clear on convention handling in a number of cases,
19944 and in particular, it is not clear on the convention to be given to
19945 anonymous access types in general, and in particular what is to be
19946 done for the case of anonymous access-to-subprogram.
19948 In GNAT, we decide that if an explicit Convention is applied
19949 to an object or component, and its type is such an anonymous type,
19950 then the convention will apply to this anonymous type as well. This
19951 seems to make sense since it is anomolous in any case to have a
19952 different convention for an object and its type, and there is clearly
19953 no way to explicitly specify a convention for an anonymous type, since
19954 it doesn't have a name to specify!
19956 Furthermore, we decide that if a convention is applied to a record type,
19957 then this convention is inherited by any of its components that are of an
19958 anonymous access type which do not have an explicitly specified convention.
19960 The following program shows these conventions in action:
19962 @example
19963 package ConvComp is
19964    type Foo is range 1 .. 10;
19965    type T1 is record
19966       A : access function (X : Foo) return Integer;
19967       B : Integer;
19968    end record;
19969    pragma Convention (C, T1);
19971    type T2 is record
19972       A : access function (X : Foo) return Integer;
19973       pragma Convention  (C, A);
19974       B : Integer;
19975    end record;
19976    pragma Convention (COBOL, T2);
19978    type T3 is record
19979       A : access function (X : Foo) return Integer;
19980       pragma Convention  (COBOL, A);
19981       B : Integer;
19982    end record;
19983    pragma Convention (C, T3);
19985    type T4 is record
19986       A : access function (X : Foo) return Integer;
19987       B : Integer;
19988    end record;
19989    pragma Convention (COBOL, T4);
19991    function F (X : Foo) return Integer;
19992    pragma Convention (C, F);
19994    function F (X : Foo) return Integer is (13);
19996    TV1 : T1 := (F'Access, 12);  -- OK
19997    TV2 : T2 := (F'Access, 13);  -- OK
19999    TV3 : T3 := (F'Access, 13);  -- ERROR
20000                 |
20001 >>> subprogram "F" has wrong convention
20002 >>> does not match access to subprogram declared at line 17
20003      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
20004                 |
20005 >>> subprogram "F" has wrong convention
20006 >>> does not match access to subprogram declared at line 24
20007      39. end ConvComp;
20008 @end example
20010 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20011 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{28c}
20012 @section Determining the Representations chosen by GNAT
20015 @geindex Representation
20016 @geindex determination of
20018 @geindex -gnatR (gcc)
20020 Although the descriptions in this section are intended to be complete, it is
20021 often easier to simply experiment to see what GNAT accepts and what the
20022 effect is on the layout of types and objects.
20024 As required by the Ada RM, if a representation clause is not accepted, then
20025 it must be rejected as illegal by the compiler.  However, when a
20026 representation clause or pragma is accepted, there can still be questions
20027 of what the compiler actually does.  For example, if a partial record
20028 representation clause specifies the location of some components and not
20029 others, then where are the non-specified components placed? Or if pragma
20030 @cite{Pack} is used on a record, then exactly where are the resulting
20031 fields placed? The section on pragma @cite{Pack} in this chapter can be
20032 used to answer the second question, but it is often easier to just see
20033 what the compiler does.
20035 For this purpose, GNAT provides the option @emph{-gnatR}.  If you compile
20036 with this option, then the compiler will output information on the actual
20037 representations chosen, in a format similar to source representation
20038 clauses.  For example, if we compile the package:
20040 @example
20041 package q is
20042    type r (x : boolean) is tagged record
20043       case x is
20044          when True => S : String (1 .. 100);
20045          when False => null;
20046       end case;
20047    end record;
20049    type r2 is new r (false) with record
20050       y2 : integer;
20051    end record;
20053    for r2 use record
20054       y2 at 16 range 0 .. 31;
20055    end record;
20057    type x is record
20058       y : character;
20059    end record;
20061    type x1 is array (1 .. 10) of x;
20062    for x1'component_size use 11;
20064    type ia is access integer;
20066    type Rb1 is array (1 .. 13) of Boolean;
20067    pragma Pack (rb1);
20069    type Rb2 is array (1 .. 65) of Boolean;
20070    pragma Pack (rb2);
20072    type x2 is record
20073       l1 : Boolean;
20074       l2 : Duration;
20075       l3 : Float;
20076       l4 : Boolean;
20077       l5 : Rb1;
20078       l6 : Rb2;
20079    end record;
20080    pragma Pack (x2);
20081 end q;
20082 @end example
20084 using the switch @emph{-gnatR} we obtain the following output:
20086 @example
20087 Representation information for unit q
20088 -------------------------------------
20090 for r'Size use ??;
20091 for r'Alignment use 4;
20092 for r use record
20093    x    at 4 range  0 .. 7;
20094    _tag at 0 range  0 .. 31;
20095    s    at 5 range  0 .. 799;
20096 end record;
20098 for r2'Size use 160;
20099 for r2'Alignment use 4;
20100 for r2 use record
20101    x       at  4 range  0 .. 7;
20102    _tag    at  0 range  0 .. 31;
20103    _parent at  0 range  0 .. 63;
20104    y2      at 16 range  0 .. 31;
20105 end record;
20107 for x'Size use 8;
20108 for x'Alignment use 1;
20109 for x use record
20110    y at 0 range  0 .. 7;
20111 end record;
20113 for x1'Size use 112;
20114 for x1'Alignment use 1;
20115 for x1'Component_Size use 11;
20117 for rb1'Size use 13;
20118 for rb1'Alignment use 2;
20119 for rb1'Component_Size use 1;
20121 for rb2'Size use 72;
20122 for rb2'Alignment use 1;
20123 for rb2'Component_Size use 1;
20125 for x2'Size use 224;
20126 for x2'Alignment use 4;
20127 for x2 use record
20128    l1 at  0 range  0 .. 0;
20129    l2 at  0 range  1 .. 64;
20130    l3 at 12 range  0 .. 31;
20131    l4 at 16 range  0 .. 0;
20132    l5 at 16 range  1 .. 13;
20133    l6 at 18 range  0 .. 71;
20134 end record;
20135 @end example
20137 The Size values are actually the Object_Size, i.e., the default size that
20138 will be allocated for objects of the type.
20139 The @code{??} size for type r indicates that we have a variant record, and the
20140 actual size of objects will depend on the discriminant value.
20142 The Alignment values show the actual alignment chosen by the compiler
20143 for each record or array type.
20145 The record representation clause for type r shows where all fields
20146 are placed, including the compiler generated tag field (whose location
20147 cannot be controlled by the programmer).
20149 The record representation clause for the type extension r2 shows all the
20150 fields present, including the parent field, which is a copy of the fields
20151 of the parent type of r2, i.e., r1.
20153 The component size and size clauses for types rb1 and rb2 show
20154 the exact effect of pragma @cite{Pack} on these arrays, and the record
20155 representation clause for type x2 shows how pragma @cite{Pack} affects
20156 this record type.
20158 In some cases, it may be useful to cut and paste the representation clauses
20159 generated by the compiler into the original source to fix and guarantee
20160 the actual representation to be used.
20162 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20163 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{28d}@anchor{gnat_rm/standard_library_routines id1}@anchor{28e}
20164 @chapter Standard Library Routines
20167 The Ada Reference Manual contains in Annex A a full description of an
20168 extensive set of standard library routines that can be used in any Ada
20169 program, and which must be provided by all Ada compilers.  They are
20170 analogous to the standard C library used by C programs.
20172 GNAT implements all of the facilities described in annex A, and for most
20173 purposes the description in the Ada Reference Manual, or appropriate Ada
20174 text book, will be sufficient for making use of these facilities.
20176 In the case of the input-output facilities,
20177 @ref{f,,The Implementation of Standard I/O},
20178 gives details on exactly how GNAT interfaces to the
20179 file system.  For the remaining packages, the Ada Reference Manual
20180 should be sufficient.  The following is a list of the packages included,
20181 together with a brief description of the functionality that is provided.
20183 For completeness, references are included to other predefined library
20184 routines defined in other sections of the Ada Reference Manual (these are
20185 cross-indexed from Annex A). For further details see the relevant
20186 package declarations in the run-time library. In particular, a few units
20187 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20188 and in this case the package declaration contains comments explaining why
20189 the unit is not implemented.
20192 @table @asis
20194 @item @code{Ada} @emph{(A.2)}
20196 This is a parent package for all the standard library packages.  It is
20197 usually included implicitly in your program, and itself contains no
20198 useful data or routines.
20200 @item @code{Ada.Assertions} @emph{(11.4.2)}
20202 @cite{Assertions} provides the @cite{Assert} subprograms, and also
20203 the declaration of the @cite{Assertion_Error} exception.
20205 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
20207 @cite{Asynchronous_Task_Control} provides low level facilities for task
20208 synchronization. It is typically not implemented. See package spec for details.
20210 @item @code{Ada.Calendar} @emph{(9.6)}
20212 @cite{Calendar} provides time of day access, and routines for
20213 manipulating times and durations.
20215 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
20217 This package provides additional arithmetic
20218 operations for @cite{Calendar}.
20220 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20222 This package provides formatting operations for @cite{Calendar}.
20224 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20226 This package provides additional @cite{Calendar} facilities
20227 for handling time zones.
20229 @item @code{Ada.Characters} @emph{(A.3.1)}
20231 This is a dummy parent package that contains no useful entities
20233 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20235 This package provides character conversion functions.
20237 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20239 This package provides some basic character handling capabilities,
20240 including classification functions for classes of characters (e.g., test
20241 for letters, or digits).
20243 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20245 This package includes a complete set of definitions of the characters
20246 that appear in type CHARACTER.  It is useful for writing programs that
20247 will run in international environments.  For example, if you want an
20248 upper case E with an acute accent in a string, it is often better to use
20249 the definition of @cite{UC_E_Acute} in this package.  Then your program
20250 will print in an understandable manner even if your environment does not
20251 support these extended characters.
20253 @item @code{Ada.Command_Line} @emph{(A.15)}
20255 This package provides access to the command line parameters and the name
20256 of the current program (analogous to the use of @cite{argc} and @cite{argv}
20257 in C), and also allows the exit status for the program to be set in a
20258 system-independent manner.
20260 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20262 This package provides text input and output of complex numbers.
20264 @item @code{Ada.Containers} @emph{(A.18.1)}
20266 A top level package providing a few basic definitions used by all the
20267 following specific child packages that provide specific kinds of
20268 containers.
20269 @end table
20271 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20273 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20275 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20277 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20279 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20281 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20283 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20285 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20287 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20289 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20291 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20293 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20295 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20297 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20299 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20301 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20303 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20305 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20307 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20309 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20311 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20313 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20315 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20318 @table @asis
20320 @item @code{Ada.Directories} @emph{(A.16)}
20322 This package provides operations on directories.
20324 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20326 This package provides additional directory operations handling
20327 hiearchical file names.
20329 @item @code{Ada.Directories.Information} @emph{(A.16)}
20331 This is an implementation defined package for additional directory
20332 operations, which is not implemented in GNAT.
20334 @item @code{Ada.Decimal} @emph{(F.2)}
20336 This package provides constants describing the range of decimal numbers
20337 implemented, and also a decimal divide routine (analogous to the COBOL
20338 verb DIVIDE ... GIVING ... REMAINDER ...)
20340 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20342 This package provides input-output using a model of a set of records of
20343 fixed-length, containing an arbitrary definite Ada type, indexed by an
20344 integer record number.
20346 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20348 A parent package containing definitions for task dispatching operations.
20350 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20352 Not implemented in GNAT.
20354 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20356 Not implemented in GNAT.
20358 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20360 Not implemented in GNAT.
20362 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20364 This package allows the priorities of a task to be adjusted dynamically
20365 as the task is running.
20367 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20369 This package provides facilities for accessing environment variables.
20371 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20373 This package provides additional information on exceptions, and also
20374 contains facilities for treating exceptions as data objects, and raising
20375 exceptions with associated messages.
20377 @item @code{Ada.Execution_Time} @emph{(D.14)}
20379 Not implemented in GNAT.
20381 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20383 Not implemented in GNAT.
20385 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20387 Not implemented in GNAT.
20389 @item @code{Ada.Finalization} @emph{(7.6)}
20391 This package contains the declarations and subprograms to support the
20392 use of controlled types, providing for automatic initialization and
20393 finalization (analogous to the constructors and destructors of C++).
20395 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20397 A library level instantiation of Text_IO.Float_IO for type Float.
20399 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20401 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20403 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20405 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20407 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20409 A library level instantiation of Text_IO.Integer_IO for type Integer.
20411 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20413 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20415 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20417 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20419 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20421 This package provides facilities for interfacing to interrupts, which
20422 includes the set of signals or conditions that can be raised and
20423 recognized as interrupts.
20425 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20427 This package provides the set of interrupt names (actually signal
20428 or condition names) that can be handled by GNAT.
20430 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20432 This package defines the set of exceptions that can be raised by use of
20433 the standard IO packages.
20435 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20437 This package provides a generic interface to generalized iterators.
20439 @item @code{Ada.Locales} @emph{(A.19)}
20441 This package provides declarations providing information (Language
20442 and Country) about the current locale.
20444 @item @code{Ada.Numerics}
20446 This package contains some standard constants and exceptions used
20447 throughout the numerics packages.  Note that the constants pi and e are
20448 defined here, and it is better to use these definitions than rolling
20449 your own.
20451 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20453 Provides operations on arrays of complex numbers.
20455 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20457 Provides the implementation of standard elementary functions (such as
20458 log and trigonometric functions) operating on complex numbers using the
20459 standard @cite{Float} and the @cite{Complex} and @cite{Imaginary} types
20460 created by the package @cite{Numerics.Complex_Types}.
20462 @item @code{Ada.Numerics.Complex_Types}
20464 This is a predefined instantiation of
20465 @cite{Numerics.Generic_Complex_Types} using @cite{Standard.Float} to
20466 build the type @cite{Complex} and @cite{Imaginary}.
20468 @item @code{Ada.Numerics.Discrete_Random}
20470 This generic package provides a random number generator suitable for generating
20471 uniformly distributed values of a specified discrete subtype.
20473 @item @code{Ada.Numerics.Float_Random}
20475 This package provides a random number generator suitable for generating
20476 uniformly distributed floating point values in the unit interval.
20478 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20480 This is a generic version of the package that provides the
20481 implementation of standard elementary functions (such as log and
20482 trigonometric functions) for an arbitrary complex type.
20484 The following predefined instantiations of this package are provided:
20487 @itemize *
20489 @item 
20490 @code{Short_Float}
20492 @cite{Ada.Numerics.Short_Complex_Elementary_Functions}
20494 @item 
20495 @code{Float}
20497 @cite{Ada.Numerics.Complex_Elementary_Functions}
20499 @item 
20500 @code{Long_Float}
20502 @cite{Ada.Numerics.Long_Complex_Elementary_Functions}
20503 @end itemize
20505 @item @code{Ada.Numerics.Generic_Complex_Types}
20507 This is a generic package that allows the creation of complex types,
20508 with associated complex arithmetic operations.
20510 The following predefined instantiations of this package exist
20513 @itemize *
20515 @item 
20516 @code{Short_Float}
20518 @cite{Ada.Numerics.Short_Complex_Complex_Types}
20520 @item 
20521 @code{Float}
20523 @cite{Ada.Numerics.Complex_Complex_Types}
20525 @item 
20526 @code{Long_Float}
20528 @cite{Ada.Numerics.Long_Complex_Complex_Types}
20529 @end itemize
20531 @item @code{Ada.Numerics.Generic_Elementary_Functions}
20533 This is a generic package that provides the implementation of standard
20534 elementary functions (such as log an trigonometric functions) for an
20535 arbitrary float type.
20537 The following predefined instantiations of this package exist
20540 @itemize *
20542 @item 
20543 @code{Short_Float}
20545 @cite{Ada.Numerics.Short_Elementary_Functions}
20547 @item 
20548 @code{Float}
20550 @cite{Ada.Numerics.Elementary_Functions}
20552 @item 
20553 @code{Long_Float}
20555 @cite{Ada.Numerics.Long_Elementary_Functions}
20556 @end itemize
20558 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
20560 Generic operations on arrays of reals
20562 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
20564 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
20566 @item @code{Ada.Real_Time} @emph{(D.8)}
20568 This package provides facilities similar to those of @cite{Calendar}, but
20569 operating with a finer clock suitable for real time control. Note that
20570 annex D requires that there be no backward clock jumps, and GNAT generally
20571 guarantees this behavior, but of course if the external clock on which
20572 the GNAT runtime depends is deliberately reset by some external event,
20573 then such a backward jump may occur.
20575 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
20577 Not implemented in GNAT.
20579 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
20581 This package provides input-output facilities for sequential files,
20582 which can contain a sequence of values of a single type, which can be
20583 any Ada type, including indefinite (unconstrained) types.
20585 @item @code{Ada.Storage_IO} @emph{(A.9)}
20587 This package provides a facility for mapping arbitrary Ada types to and
20588 from a storage buffer.  It is primarily intended for the creation of new
20589 IO packages.
20591 @item @code{Ada.Streams} @emph{(13.13.1)}
20593 This is a generic package that provides the basic support for the
20594 concept of streams as used by the stream attributes (@cite{Input},
20595 @cite{Output}, @cite{Read} and @cite{Write}).
20597 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
20599 This package is a specialization of the type @cite{Streams} defined in
20600 package @cite{Streams} together with a set of operations providing
20601 Stream_IO capability.  The Stream_IO model permits both random and
20602 sequential access to a file which can contain an arbitrary set of values
20603 of one or more Ada types.
20605 @item @code{Ada.Strings} @emph{(A.4.1)}
20607 This package provides some basic constants used by the string handling
20608 packages.
20610 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
20612 This package provides facilities for handling variable length
20613 strings.  The bounded model requires a maximum length.  It is thus
20614 somewhat more limited than the unbounded model, but avoids the use of
20615 dynamic allocation or finalization.
20617 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20619 Provides case-insensitive comparisons of bounded strings
20621 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
20623 This package provides a generic hash function for bounded strings
20625 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20627 This package provides a generic hash function for bounded strings that
20628 converts the string to be hashed to lower case.
20630 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
20632 This package provides a comparison function for bounded strings that works
20633 in a case insensitive manner by converting to lower case before the comparison.
20635 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
20637 This package provides facilities for handling fixed length strings.
20639 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
20641 This package provides an equality function for fixed strings that compares
20642 the strings after converting both to lower case.
20644 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
20646 This package provides a case insensitive hash function for fixed strings that
20647 converts the string to lower case before computing the hash.
20649 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
20651 This package provides a comparison function for fixed strings that works
20652 in a case insensitive manner by converting to lower case before the comparison.
20654 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
20656 This package provides a hash function for strings.
20658 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
20660 This package provides a hash function for strings that is case insensitive.
20661 The string is converted to lower case before computing the hash.
20663 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
20665 This package provides a comparison function for\strings that works
20666 in a case insensitive manner by converting to lower case before the comparison.
20668 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
20670 This package provides facilities for handling character mappings and
20671 arbitrarily defined subsets of characters.  For instance it is useful in
20672 defining specialized translation tables.
20674 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
20676 This package provides a standard set of predefined mappings and
20677 predefined character sets.  For example, the standard upper to lower case
20678 conversion table is found in this package.  Note that upper to lower case
20679 conversion is non-trivial if you want to take the entire set of
20680 characters, including extended characters like E with an acute accent,
20681 into account.  You should use the mappings in this package (rather than
20682 adding 32 yourself) to do case mappings.
20684 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
20686 This package provides facilities for handling variable length
20687 strings.  The unbounded model allows arbitrary length strings, but
20688 requires the use of dynamic allocation and finalization.
20690 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20692 Provides case-insensitive comparisons of unbounded strings
20694 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
20696 This package provides a generic hash function for unbounded strings
20698 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20700 This package provides a generic hash function for unbounded strings that
20701 converts the string to be hashed to lower case.
20703 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
20705 This package provides a comparison function for unbounded strings that works
20706 in a case insensitive manner by converting to lower case before the comparison.
20708 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
20710 This package provides basic definitions for dealing with UTF-encoded strings.
20712 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
20714 This package provides conversion functions for UTF-encoded strings.
20715 @end table
20717 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
20719 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
20722 @table @asis
20724 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
20726 These packages provide facilities for handling UTF encodings for
20727 Strings, Wide_Strings and Wide_Wide_Strings.
20728 @end table
20730 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
20732 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
20734 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
20737 @table @asis
20739 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
20741 These packages provide analogous capabilities to the corresponding
20742 packages without @code{Wide_} in the name, but operate with the types
20743 @cite{Wide_String} and @cite{Wide_Character} instead of @cite{String}
20744 and @cite{Character}. Versions of all the child packages are available.
20745 @end table
20747 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
20749 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
20751 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
20754 @table @asis
20756 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
20758 These packages provide analogous capabilities to the corresponding
20759 packages without @code{Wide_} in the name, but operate with the types
20760 @cite{Wide_Wide_String} and @cite{Wide_Wide_Character} instead
20761 of @cite{String} and @cite{Character}.
20763 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
20765 This package provides facilities for synchronizing tasks at a low level
20766 with barriers.
20768 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
20770 This package provides some standard facilities for controlling task
20771 communication in a synchronous manner.
20773 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
20775 Not implemented in GNAT.
20777 @item @code{Ada.Tags}
20779 This package contains definitions for manipulation of the tags of tagged
20780 values.
20782 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
20784 This package provides a way of constructing tagged class-wide values given
20785 only the tag value.
20787 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
20789 This package provides the capability of associating arbitrary
20790 task-specific data with separate tasks.
20792 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
20794 This package provides capabilities for task identification.
20796 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
20798 This package provides control over task termination.
20800 @item @code{Ada.Text_IO}
20802 This package provides basic text input-output capabilities for
20803 character, string and numeric data.  The subpackages of this
20804 package are listed next. Note that although these are defined
20805 as subpackages in the RM, they are actually transparently
20806 implemented as child packages in GNAT, meaning that they
20807 are only loaded if needed.
20809 @item @code{Ada.Text_IO.Decimal_IO}
20811 Provides input-output facilities for decimal fixed-point types
20813 @item @code{Ada.Text_IO.Enumeration_IO}
20815 Provides input-output facilities for enumeration types.
20817 @item @code{Ada.Text_IO.Fixed_IO}
20819 Provides input-output facilities for ordinary fixed-point types.
20821 @item @code{Ada.Text_IO.Float_IO}
20823 Provides input-output facilities for float types.  The following
20824 predefined instantiations of this generic package are available:
20827 @itemize *
20829 @item 
20830 @code{Short_Float}
20832 @cite{Short_Float_Text_IO}
20834 @item 
20835 @code{Float}
20837 @cite{Float_Text_IO}
20839 @item 
20840 @code{Long_Float}
20842 @cite{Long_Float_Text_IO}
20843 @end itemize
20845 @item @code{Ada.Text_IO.Integer_IO}
20847 Provides input-output facilities for integer types.  The following
20848 predefined instantiations of this generic package are available:
20851 @itemize *
20853 @item 
20854 @code{Short_Short_Integer}
20856 @cite{Ada.Short_Short_Integer_Text_IO}
20858 @item 
20859 @code{Short_Integer}
20861 @cite{Ada.Short_Integer_Text_IO}
20863 @item 
20864 @code{Integer}
20866 @cite{Ada.Integer_Text_IO}
20868 @item 
20869 @code{Long_Integer}
20871 @cite{Ada.Long_Integer_Text_IO}
20873 @item 
20874 @code{Long_Long_Integer}
20876 @cite{Ada.Long_Long_Integer_Text_IO}
20877 @end itemize
20879 @item @code{Ada.Text_IO.Modular_IO}
20881 Provides input-output facilities for modular (unsigned) types.
20883 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
20885 Provides input-output facilities for bounded strings.
20887 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
20889 This package provides basic text input-output capabilities for complex
20890 data.
20892 @item @code{Ada.Text_IO.Editing (F.3.3)}
20894 This package contains routines for edited output, analogous to the use
20895 of pictures in COBOL.  The picture formats used by this package are a
20896 close copy of the facility in COBOL.
20898 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
20900 This package provides a facility that allows Text_IO files to be treated
20901 as streams, so that the stream attributes can be used for writing
20902 arbitrary data, including binary data, to Text_IO files.
20904 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
20906 This package provides input-output facilities for unbounded strings.
20908 @item @code{Ada.Unchecked_Conversion (13.9)}
20910 This generic package allows arbitrary conversion from one type to
20911 another of the same size, providing for breaking the type safety in
20912 special circumstances.
20914 If the types have the same Size (more accurately the same Value_Size),
20915 then the effect is simply to transfer the bits from the source to the
20916 target type without any modification.  This usage is well defined, and
20917 for simple types whose representation is typically the same across
20918 all implementations, gives a portable method of performing such
20919 conversions.
20921 If the types do not have the same size, then the result is implementation
20922 defined, and thus may be non-portable.  The following describes how GNAT
20923 handles such unchecked conversion cases.
20925 If the types are of different sizes, and are both discrete types, then
20926 the effect is of a normal type conversion without any constraint checking.
20927 In particular if the result type has a larger size, the result will be
20928 zero or sign extended.  If the result type has a smaller size, the result
20929 will be truncated by ignoring high order bits.
20931 If the types are of different sizes, and are not both discrete types,
20932 then the conversion works as though pointers were created to the source
20933 and target, and the pointer value is converted.  The effect is that bits
20934 are copied from successive low order storage units and bits of the source
20935 up to the length of the target type.
20937 A warning is issued if the lengths differ, since the effect in this
20938 case is implementation dependent, and the above behavior may not match
20939 that of some other compiler.
20941 A pointer to one type may be converted to a pointer to another type using
20942 unchecked conversion.  The only case in which the effect is undefined is
20943 when one or both pointers are pointers to unconstrained array types.  In
20944 this case, the bounds information may get incorrectly transferred, and in
20945 particular, GNAT uses double size pointers for such types, and it is
20946 meaningless to convert between such pointer types.  GNAT will issue a
20947 warning if the alignment of the target designated type is more strict
20948 than the alignment of the source designated type (since the result may
20949 be unaligned in this case).
20951 A pointer other than a pointer to an unconstrained array type may be
20952 converted to and from System.Address.  Such usage is common in Ada 83
20953 programs, but note that Ada.Address_To_Access_Conversions is the
20954 preferred method of performing such conversions in Ada 95 and Ada 2005.
20955 Neither
20956 unchecked conversion nor Ada.Address_To_Access_Conversions should be
20957 used in conjunction with pointers to unconstrained objects, since
20958 the bounds information cannot be handled correctly in this case.
20960 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
20962 This generic package allows explicit freeing of storage previously
20963 allocated by use of an allocator.
20965 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
20967 This package is similar to @cite{Ada.Text_IO}, except that the external
20968 file supports wide character representations, and the internal types are
20969 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20970 and @cite{String}. The corresponding set of nested packages and child
20971 packages are defined.
20973 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
20975 This package is similar to @cite{Ada.Text_IO}, except that the external
20976 file supports wide character representations, and the internal types are
20977 @cite{Wide_Character} and @cite{Wide_String} instead of @cite{Character}
20978 and @cite{String}. The corresponding set of nested packages and child
20979 packages are defined.
20980 @end table
20982 For packages in Interfaces and System, all the RM defined packages are
20983 available in GNAT, see the Ada 2012 RM for full details.
20985 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
20986 @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{28f}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{290}
20987 @chapter The Implementation of Standard I/O
20990 GNAT implements all the required input-output facilities described in
20991 A.6 through A.14.  These sections of the Ada Reference Manual describe the
20992 required behavior of these packages from the Ada point of view, and if
20993 you are writing a portable Ada program that does not need to know the
20994 exact manner in which Ada maps to the outside world when it comes to
20995 reading or writing external files, then you do not need to read this
20996 chapter.  As long as your files are all regular files (not pipes or
20997 devices), and as long as you write and read the files only from Ada, the
20998 description in the Ada Reference Manual is sufficient.
21000 However, if you want to do input-output to pipes or other devices, such
21001 as the keyboard or screen, or if the files you are dealing with are
21002 either generated by some other language, or to be read by some other
21003 language, then you need to know more about the details of how the GNAT
21004 implementation of these input-output facilities behaves.
21006 In this chapter we give a detailed description of exactly how GNAT
21007 interfaces to the file system.  As always, the sources of the system are
21008 available to you for answering questions at an even more detailed level,
21009 but for most purposes the information in this chapter will suffice.
21011 Another reason that you may need to know more about how input-output is
21012 implemented arises when you have a program written in mixed languages
21013 where, for example, files are shared between the C and Ada sections of
21014 the same program.  GNAT provides some additional facilities, in the form
21015 of additional child library packages, that facilitate this sharing, and
21016 these additional facilities are also described in this chapter.
21018 @menu
21019 * Standard I/O Packages:: 
21020 * FORM Strings:: 
21021 * Direct_IO:: 
21022 * Sequential_IO:: 
21023 * Text_IO:: 
21024 * Wide_Text_IO:: 
21025 * Wide_Wide_Text_IO:: 
21026 * Stream_IO:: 
21027 * Text Translation:: 
21028 * Shared Files:: 
21029 * Filenames encoding:: 
21030 * File content encoding:: 
21031 * Open Modes:: 
21032 * Operations on C Streams:: 
21033 * Interfacing to C Streams:: 
21035 @end menu
21037 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21038 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{291}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{292}
21039 @section Standard I/O Packages
21042 The Standard I/O packages described in Annex A for
21045 @itemize *
21047 @item 
21048 Ada.Text_IO
21050 @item 
21051 Ada.Text_IO.Complex_IO
21053 @item 
21054 Ada.Text_IO.Text_Streams
21056 @item 
21057 Ada.Wide_Text_IO
21059 @item 
21060 Ada.Wide_Text_IO.Complex_IO
21062 @item 
21063 Ada.Wide_Text_IO.Text_Streams
21065 @item 
21066 Ada.Wide_Wide_Text_IO
21068 @item 
21069 Ada.Wide_Wide_Text_IO.Complex_IO
21071 @item 
21072 Ada.Wide_Wide_Text_IO.Text_Streams
21074 @item 
21075 Ada.Stream_IO
21077 @item 
21078 Ada.Sequential_IO
21080 @item 
21081 Ada.Direct_IO
21082 @end itemize
21084 are implemented using the C
21085 library streams facility; where
21088 @itemize *
21090 @item 
21091 All files are opened using @cite{fopen}.
21093 @item 
21094 All input/output operations use @cite{fread}/@cite{fwrite}.
21095 @end itemize
21097 There is no internal buffering of any kind at the Ada library level. The only
21098 buffering is that provided at the system level in the implementation of the
21099 library routines that support streams. This facilitates shared use of these
21100 streams by mixed language programs. Note though that system level buffering is
21101 explicitly enabled at elaboration of the standard I/O packages and that can
21102 have an impact on mixed language programs, in particular those using I/O before
21103 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21104 the Ada elaboration routine before performing any I/O or when impractical,
21105 flush the common I/O streams and in particular Standard_Output before
21106 elaborating the Ada code.
21108 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21109 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{293}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{294}
21110 @section FORM Strings
21113 The format of a FORM string in GNAT is:
21115 @example
21116 "keyword=value,keyword=value,...,keyword=value"
21117 @end example
21119 where letters may be in upper or lower case, and there are no spaces
21120 between values.  The order of the entries is not important.  Currently
21121 the following keywords defined.
21123 @example
21124 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21125 SHARED=[YES|NO]
21126 WCEM=[n|h|u|s|e|8|b]
21127 ENCODING=[UTF8|8BITS]
21128 @end example
21130 The use of these parameters is described later in this section. If an
21131 unrecognized keyword appears in a form string, it is silently ignored
21132 and not considered invalid.
21134 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21135 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{295}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{296}
21136 @section Direct_IO
21139 Direct_IO can only be instantiated for definite types.  This is a
21140 restriction of the Ada language, which means that the records are fixed
21141 length (the length being determined by @code{type'Size}, rounded
21142 up to the next storage unit boundary if necessary).
21144 The records of a Direct_IO file are simply written to the file in index
21145 sequence, with the first record starting at offset zero, and subsequent
21146 records following.  There is no control information of any kind.  For
21147 example, if 32-bit integers are being written, each record takes
21148 4-bytes, so the record at index @cite{K} starts at offset
21149 (@cite{K}-1)*4.
21151 There is no limit on the size of Direct_IO files, they are expanded as
21152 necessary to accommodate whatever records are written to the file.
21154 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21155 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{297}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{298}
21156 @section Sequential_IO
21159 Sequential_IO may be instantiated with either a definite (constrained)
21160 or indefinite (unconstrained) type.
21162 For the definite type case, the elements written to the file are simply
21163 the memory images of the data values with no control information of any
21164 kind.  The resulting file should be read using the same type, no validity
21165 checking is performed on input.
21167 For the indefinite type case, the elements written consist of two
21168 parts.  First is the size of the data item, written as the memory image
21169 of a @cite{Interfaces.C.size_t} value, followed by the memory image of
21170 the data value.  The resulting file can only be read using the same
21171 (unconstrained) type.  Normal assignment checks are performed on these
21172 read operations, and if these checks fail, @cite{Data_Error} is
21173 raised.  In particular, in the array case, the lengths must match, and in
21174 the variant record case, if the variable for a particular read operation
21175 is constrained, the discriminants must match.
21177 Note that it is not possible to use Sequential_IO to write variable
21178 length array items, and then read the data back into different length
21179 arrays.  For example, the following will raise @cite{Data_Error}:
21181 @example
21182 package IO is new Sequential_IO (String);
21183 F : IO.File_Type;
21184 S : String (1..4);
21186 IO.Create (F)
21187 IO.Write (F, "hello!")
21188 IO.Reset (F, Mode=>In_File);
21189 IO.Read (F, S);
21190 Put_Line (S);
21191 @end example
21193 On some Ada implementations, this will print @cite{hell}, but the program is
21194 clearly incorrect, since there is only one element in the file, and that
21195 element is the string @cite{hello!}.
21197 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21198 using Stream_IO, and this is the preferred mechanism.  In particular, the
21199 above program fragment rewritten to use Stream_IO will work correctly.
21201 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21202 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{299}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{29a}
21203 @section Text_IO
21206 Text_IO files consist of a stream of characters containing the following
21207 special control characters:
21209 @example
21210 LF (line feed, 16#0A#) Line Mark
21211 FF (form feed, 16#0C#) Page Mark
21212 @end example
21214 A canonical Text_IO file is defined as one in which the following
21215 conditions are met:
21218 @itemize *
21220 @item 
21221 The character @cite{LF} is used only as a line mark, i.e., to mark the end
21222 of the line.
21224 @item 
21225 The character @cite{FF} is used only as a page mark, i.e., to mark the
21226 end of a page and consequently can appear only immediately following a
21227 @cite{LF} (line mark) character.
21229 @item 
21230 The file ends with either @cite{LF} (line mark) or @cite{LF}-@cite{FF}
21231 (line mark, page mark).  In the former case, the page mark is implicitly
21232 assumed to be present.
21233 @end itemize
21235 A file written using Text_IO will be in canonical form provided that no
21236 explicit @cite{LF} or @cite{FF} characters are written using @cite{Put}
21237 or @cite{Put_Line}.  There will be no @cite{FF} character at the end of
21238 the file unless an explicit @cite{New_Page} operation was performed
21239 before closing the file.
21241 A canonical Text_IO file that is a regular file (i.e., not a device or a
21242 pipe) can be read using any of the routines in Text_IO.  The
21243 semantics in this case will be exactly as defined in the Ada Reference
21244 Manual, and all the routines in Text_IO are fully implemented.
21246 A text file that does not meet the requirements for a canonical Text_IO
21247 file has one of the following:
21250 @itemize *
21252 @item 
21253 The file contains @cite{FF} characters not immediately following a
21254 @cite{LF} character.
21256 @item 
21257 The file contains @cite{LF} or @cite{FF} characters written by
21258 @cite{Put} or @cite{Put_Line}, which are not logically considered to be
21259 line marks or page marks.
21261 @item 
21262 The file ends in a character other than @cite{LF} or @cite{FF},
21263 i.e., there is no explicit line mark or page mark at the end of the file.
21264 @end itemize
21266 Text_IO can be used to read such non-standard text files but subprograms
21267 to do with line or page numbers do not have defined meanings.  In
21268 particular, a @cite{FF} character that does not follow a @cite{LF}
21269 character may or may not be treated as a page mark from the point of
21270 view of page and line numbering.  Every @cite{LF} character is considered
21271 to end a line, and there is an implied @cite{LF} character at the end of
21272 the file.
21274 @menu
21275 * Stream Pointer Positioning:: 
21276 * Reading and Writing Non-Regular Files:: 
21277 * Get_Immediate:: 
21278 * Treating Text_IO Files as Streams:: 
21279 * Text_IO Extensions:: 
21280 * Text_IO Facilities for Unbounded Strings:: 
21282 @end menu
21284 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21285 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{29b}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{29c}
21286 @subsection Stream Pointer Positioning
21289 @cite{Ada.Text_IO} has a definition of current position for a file that
21290 is being read.  No internal buffering occurs in Text_IO, and usually the
21291 physical position in the stream used to implement the file corresponds
21292 to this logical position defined by Text_IO.  There are two exceptions:
21295 @itemize *
21297 @item 
21298 After a call to @cite{End_Of_Page} that returns @cite{True}, the stream
21299 is positioned past the @cite{LF} (line mark) that precedes the page
21300 mark.  Text_IO maintains an internal flag so that subsequent read
21301 operations properly handle the logical position which is unchanged by
21302 the @cite{End_Of_Page} call.
21304 @item 
21305 After a call to @cite{End_Of_File} that returns @cite{True}, if the
21306 Text_IO file was positioned before the line mark at the end of file
21307 before the call, then the logical position is unchanged, but the stream
21308 is physically positioned right at the end of file (past the line mark,
21309 and past a possible page mark following the line mark.  Again Text_IO
21310 maintains internal flags so that subsequent read operations properly
21311 handle the logical position.
21312 @end itemize
21314 These discrepancies have no effect on the observable behavior of
21315 Text_IO, but if a single Ada stream is shared between a C program and
21316 Ada program, or shared (using @code{shared=yes} in the form string)
21317 between two Ada files, then the difference may be observable in some
21318 situations.
21320 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21321 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{29d}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{29e}
21322 @subsection Reading and Writing Non-Regular Files
21325 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
21326 can be used for reading and writing.  Writing is not affected and the
21327 sequence of characters output is identical to the normal file case, but
21328 for reading, the behavior of Text_IO is modified to avoid undesirable
21329 look-ahead as follows:
21331 An input file that is not a regular file is considered to have no page
21332 marks.  Any @cite{Ascii.FF} characters (the character normally used for a
21333 page mark) appearing in the file are considered to be data
21334 characters.  In particular:
21337 @itemize *
21339 @item 
21340 @cite{Get_Line} and @cite{Skip_Line} do not test for a page mark
21341 following a line mark.  If a page mark appears, it will be treated as a
21342 data character.
21344 @item 
21345 This avoids the need to wait for an extra character to be typed or
21346 entered from the pipe to complete one of these operations.
21348 @item 
21349 @cite{End_Of_Page} always returns @cite{False}
21351 @item 
21352 @cite{End_Of_File} will return @cite{False} if there is a page mark at
21353 the end of the file.
21354 @end itemize
21356 Output to non-regular files is the same as for regular files.  Page marks
21357 may be written to non-regular files using @cite{New_Page}, but as noted
21358 above they will not be treated as page marks on input if the output is
21359 piped to another Ada program.
21361 Another important discrepancy when reading non-regular files is that the end
21362 of file indication is not 'sticky'.  If an end of file is entered, e.g., by
21363 pressing the @code{EOT} key,
21364 then end of file
21365 is signaled once (i.e., the test @cite{End_Of_File}
21366 will yield @cite{True}, or a read will
21367 raise @cite{End_Error}), but then reading can resume
21368 to read data past that end of
21369 file indication, until another end of file indication is entered.
21371 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21372 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{29f}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2a0}
21373 @subsection Get_Immediate
21376 @geindex Get_Immediate
21378 Get_Immediate returns the next character (including control characters)
21379 from the input file.  In particular, Get_Immediate will return LF or FF
21380 characters used as line marks or page marks.  Such operations leave the
21381 file positioned past the control character, and it is thus not treated
21382 as having its normal function.  This means that page, line and column
21383 counts after this kind of Get_Immediate call are set as though the mark
21384 did not occur.  In the case where a Get_Immediate leaves the file
21385 positioned between the line mark and page mark (which is not normally
21386 possible), it is undefined whether the FF character will be treated as a
21387 page mark.
21389 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21390 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2a1}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2a2}
21391 @subsection Treating Text_IO Files as Streams
21394 @geindex Stream files
21396 The package @cite{Text_IO.Streams} allows a Text_IO file to be treated
21397 as a stream.  Data written to a Text_IO file in this stream mode is
21398 binary data.  If this binary data contains bytes 16#0A# (@cite{LF}) or
21399 16#0C# (@cite{FF}), the resulting file may have non-standard
21400 format.  Similarly if read operations are used to read from a Text_IO
21401 file treated as a stream, then @cite{LF} and @cite{FF} characters may be
21402 skipped and the effect is similar to that described above for
21403 @cite{Get_Immediate}.
21405 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21406 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2a3}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2a4}
21407 @subsection Text_IO Extensions
21410 @geindex Text_IO extensions
21412 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21413 to the standard @cite{Text_IO} package:
21416 @itemize *
21418 @item 
21419 function File_Exists (Name : String) return Boolean;
21420 Determines if a file of the given name exists.
21422 @item 
21423 function Get_Line return String;
21424 Reads a string from the standard input file.  The value returned is exactly
21425 the length of the line that was read.
21427 @item 
21428 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21429 Similar, except that the parameter File specifies the file from which
21430 the string is to be read.
21431 @end itemize
21433 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21434 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2a5}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2a6}
21435 @subsection Text_IO Facilities for Unbounded Strings
21438 @geindex Text_IO for unbounded strings
21440 @geindex Unbounded_String
21441 @geindex Text_IO operations
21443 The package @cite{Ada.Strings.Unbounded.Text_IO}
21444 in library files @cite{a-suteio.ads/adb} contains some GNAT-specific
21445 subprograms useful for Text_IO operations on unbounded strings:
21448 @itemize *
21450 @item 
21451 function Get_Line (File : File_Type) return Unbounded_String;
21452 Reads a line from the specified file
21453 and returns the result as an unbounded string.
21455 @item 
21456 procedure Put (File : File_Type; U : Unbounded_String);
21457 Writes the value of the given unbounded string to the specified file
21458 Similar to the effect of
21459 @cite{Put (To_String (U))} except that an extra copy is avoided.
21461 @item 
21462 procedure Put_Line (File : File_Type; U : Unbounded_String);
21463 Writes the value of the given unbounded string to the specified file,
21464 followed by a @cite{New_Line}.
21465 Similar to the effect of @cite{Put_Line (To_String (U))} except
21466 that an extra copy is avoided.
21467 @end itemize
21469 In the above procedures, @cite{File} is of type @cite{Ada.Text_IO.File_Type}
21470 and is optional.  If the parameter is omitted, then the standard input or
21471 output file is referenced as appropriate.
21473 The package @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21474 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21475 @cite{Wide_Text_IO} functionality for unbounded wide strings.
21477 The package @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21478 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21479 @cite{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21481 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21482 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2a7}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2a8}
21483 @section Wide_Text_IO
21486 @cite{Wide_Text_IO} is similar in most respects to Text_IO, except that
21487 both input and output files may contain special sequences that represent
21488 wide character values.  The encoding scheme for a given file may be
21489 specified using a FORM parameter:
21491 @example
21492 WCEM=`x`
21493 @end example
21495 as part of the FORM string (WCEM = wide character encoding method),
21496 where @cite{x} is one of the following characters
21499 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21500 @headitem
21502 Character
21504 @tab
21506 Encoding
21508 @item
21510 @emph{h}
21512 @tab
21514 Hex ESC encoding
21516 @item
21518 @emph{u}
21520 @tab
21522 Upper half encoding
21524 @item
21526 @emph{s}
21528 @tab
21530 Shift-JIS encoding
21532 @item
21534 @emph{e}
21536 @tab
21538 EUC Encoding
21540 @item
21542 @emph{8}
21544 @tab
21546 UTF-8 encoding
21548 @item
21550 @emph{b}
21552 @tab
21554 Brackets encoding
21556 @end multitable
21559 The encoding methods match those that
21560 can be used in a source
21561 program, but there is no requirement that the encoding method used for
21562 the source program be the same as the encoding method used for files,
21563 and different files may use different encoding methods.
21565 The default encoding method for the standard files, and for opened files
21566 for which no WCEM parameter is given in the FORM string matches the
21567 wide character encoding specified for the main program (the default
21568 being brackets encoding if no coding method was specified with -gnatW).
21571 @table @asis
21573 @item @emph{Hex Coding}
21575 In this encoding, a wide character is represented by a five character
21576 sequence:
21577 @end table
21579 @example
21580 ESC a b c d
21581 @end example
21584 @quotation
21586 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
21587 characters (using upper case letters) of the wide character code.  For
21588 example, ESC A345 is used to represent the wide character with code
21589 16#A345#.  This scheme is compatible with use of the full
21590 @cite{Wide_Character} set.
21591 @end quotation
21594 @table @asis
21596 @item @emph{Upper Half Coding}
21598 The wide character with encoding 16#abcd#, where the upper bit is on
21599 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
21600 16#cd#.  The second byte may never be a format control character, but is
21601 not required to be in the upper half.  This method can be also used for
21602 shift-JIS or EUC where the internal coding matches the external coding.
21604 @item @emph{Shift JIS Coding}
21606 A wide character is represented by a two character sequence 16#ab# and
21607 16#cd#, with the restrictions described for upper half encoding as
21608 described above.  The internal character code is the corresponding JIS
21609 character according to the standard algorithm for Shift-JIS
21610 conversion.  Only characters defined in the JIS code set table can be
21611 used with this encoding method.
21613 @item @emph{EUC Coding}
21615 A wide character is represented by a two character sequence 16#ab# and
21616 16#cd#, with both characters being in the upper half.  The internal
21617 character code is the corresponding JIS character according to the EUC
21618 encoding algorithm.  Only characters defined in the JIS code set table
21619 can be used with this encoding method.
21621 @item @emph{UTF-8 Coding}
21623 A wide character is represented using
21624 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21625 10646-1/Am.2.  Depending on the character value, the representation
21626 is a one, two, or three byte sequence:
21627 @end table
21629 @example
21630 16#0000#-16#007f#: 2#0xxxxxxx#
21631 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
21632 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21633 @end example
21636 @quotation
21638 where the @cite{xxx} bits correspond to the left-padded bits of the
21639 16-bit character value.  Note that all lower half ASCII characters
21640 are represented as ASCII bytes and all upper half characters and
21641 other wide characters are represented as sequences of upper-half
21642 (The full UTF-8 scheme allows for encoding 31-bit characters as
21643 6-byte sequences, but in this implementation, all UTF-8 sequences
21644 of four or more bytes length will raise a Constraint_Error, as
21645 will all invalid UTF-8 sequences.)
21646 @end quotation
21649 @table @asis
21651 @item @emph{Brackets Coding}
21653 In this encoding, a wide character is represented by the following eight
21654 character sequence:
21655 @end table
21657 @example
21658 [ " a b c d " ]
21659 @end example
21662 @quotation
21664 where @cite{a}, @cite{b}, @cite{c}, @cite{d} are the four hexadecimal
21665 characters (using uppercase letters) of the wide character code.  For
21666 example, @cite{["A345"]} is used to represent the wide character with code
21667 @cite{16#A345#}.
21668 This scheme is compatible with use of the full Wide_Character set.
21669 On input, brackets coding can also be used for upper half characters,
21670 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21671 is only used for wide characters with a code greater than @cite{16#FF#}.
21673 Note that brackets coding is not normally used in the context of
21674 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
21675 a portable way of encoding source files. In the context of Wide_Text_IO
21676 or Wide_Wide_Text_IO, it can only be used if the file does not contain
21677 any instance of the left bracket character other than to encode wide
21678 character values using the brackets encoding method. In practice it is
21679 expected that some standard wide character encoding method such
21680 as UTF-8 will be used for text input output.
21682 If brackets notation is used, then any occurrence of a left bracket
21683 in the input file which is not the start of a valid wide character
21684 sequence will cause Constraint_Error to be raised. It is possible to
21685 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
21686 input will interpret this as a left bracket.
21688 However, when a left bracket is output, it will be output as a left bracket
21689 and not as ["5B"]. We make this decision because for normal use of
21690 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
21691 brackets. For example, if we write:
21693 @example
21694 Put_Line ("Start of output [first run]");
21695 @end example
21697 we really do not want to have the left bracket in this message clobbered so
21698 that the output reads:
21699 @end quotation
21701 @example
21702 Start of output ["5B"]first run]
21703 @end example
21706 @quotation
21708 In practice brackets encoding is reasonably useful for normal Put_Line use
21709 since we won't get confused between left brackets and wide character
21710 sequences in the output. But for input, or when files are written out
21711 and read back in, it really makes better sense to use one of the standard
21712 encoding methods such as UTF-8.
21713 @end quotation
21715 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
21716 not all wide character
21717 values can be represented.  An attempt to output a character that cannot
21718 be represented using the encoding scheme for the file causes
21719 Constraint_Error to be raised.  An invalid wide character sequence on
21720 input also causes Constraint_Error to be raised.
21722 @menu
21723 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
21724 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
21726 @end menu
21728 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
21729 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2a9}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2aa}
21730 @subsection Stream Pointer Positioning
21733 @cite{Ada.Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21734 of stream pointer positioning (@ref{29a,,Text_IO}).  There is one additional
21735 case:
21737 If @cite{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
21738 normal lower ASCII set (i.e., a character in the range:
21740 @example
21741 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
21742 @end example
21744 then although the logical position of the file pointer is unchanged by
21745 the @cite{Look_Ahead} call, the stream is physically positioned past the
21746 wide character sequence.  Again this is to avoid the need for buffering
21747 or backup, and all @cite{Wide_Text_IO} routines check the internal
21748 indication that this situation has occurred so that this is not visible
21749 to a normal program using @cite{Wide_Text_IO}.  However, this discrepancy
21750 can be observed if the wide text file shares a stream with another file.
21752 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
21753 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2ab}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2ac}
21754 @subsection Reading and Writing Non-Regular Files
21757 As in the case of Text_IO, when a non-regular file is read, it is
21758 assumed that the file contains no page marks (any form characters are
21759 treated as data characters), and @cite{End_Of_Page} always returns
21760 @cite{False}.  Similarly, the end of file indication is not sticky, so
21761 it is possible to read beyond an end of file.
21763 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
21764 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2ad}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2ae}
21765 @section Wide_Wide_Text_IO
21768 @cite{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
21769 both input and output files may contain special sequences that represent
21770 wide wide character values.  The encoding scheme for a given file may be
21771 specified using a FORM parameter:
21773 @example
21774 WCEM=`x`
21775 @end example
21777 as part of the FORM string (WCEM = wide character encoding method),
21778 where @cite{x} is one of the following characters
21781 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21782 @headitem
21784 Character
21786 @tab
21788 Encoding
21790 @item
21792 @emph{h}
21794 @tab
21796 Hex ESC encoding
21798 @item
21800 @emph{u}
21802 @tab
21804 Upper half encoding
21806 @item
21808 @emph{s}
21810 @tab
21812 Shift-JIS encoding
21814 @item
21816 @emph{e}
21818 @tab
21820 EUC Encoding
21822 @item
21824 @emph{8}
21826 @tab
21828 UTF-8 encoding
21830 @item
21832 @emph{b}
21834 @tab
21836 Brackets encoding
21838 @end multitable
21841 The encoding methods match those that
21842 can be used in a source
21843 program, but there is no requirement that the encoding method used for
21844 the source program be the same as the encoding method used for files,
21845 and different files may use different encoding methods.
21847 The default encoding method for the standard files, and for opened files
21848 for which no WCEM parameter is given in the FORM string matches the
21849 wide character encoding specified for the main program (the default
21850 being brackets encoding if no coding method was specified with -gnatW).
21853 @table @asis
21855 @item @emph{UTF-8 Coding}
21857 A wide character is represented using
21858 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21859 10646-1/Am.2.  Depending on the character value, the representation
21860 is a one, two, three, or four byte sequence:
21861 @end table
21863 @example
21864 16#000000#-16#00007f#: 2#0xxxxxxx#
21865 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
21866 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21867 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
21868 @end example
21871 @quotation
21873 where the @cite{xxx} bits correspond to the left-padded bits of the
21874 21-bit character value.  Note that all lower half ASCII characters
21875 are represented as ASCII bytes and all upper half characters and
21876 other wide characters are represented as sequences of upper-half
21877 characters.
21878 @end quotation
21881 @table @asis
21883 @item @emph{Brackets Coding}
21885 In this encoding, a wide wide character is represented by the following eight
21886 character sequence if is in wide character range
21887 @end table
21889 @example
21890 [ " a b c d " ]
21891 @end example
21894 @quotation
21896 and by the following ten character sequence if not
21897 @end quotation
21899 @example
21900 [ " a b c d e f " ]
21901 @end example
21904 @quotation
21906 where @cite{a}, @cite{b}, @cite{c}, @cite{d}, @cite{e}, and @cite{f}
21907 are the four or six hexadecimal
21908 characters (using uppercase letters) of the wide wide character code.  For
21909 example, @cite{["01A345"]} is used to represent the wide wide character
21910 with code @cite{16#01A345#}.
21912 This scheme is compatible with use of the full Wide_Wide_Character set.
21913 On input, brackets coding can also be used for upper half characters,
21914 e.g., @cite{["C1"]} for lower case a.  However, on output, brackets notation
21915 is only used for wide characters with a code greater than @cite{16#FF#}.
21916 @end quotation
21918 If is also possible to use the other Wide_Character encoding methods,
21919 such as Shift-JIS, but the other schemes cannot support the full range
21920 of wide wide characters.
21921 An attempt to output a character that cannot
21922 be represented using the encoding scheme for the file causes
21923 Constraint_Error to be raised.  An invalid wide character sequence on
21924 input also causes Constraint_Error to be raised.
21926 @menu
21927 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
21928 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
21930 @end menu
21932 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
21933 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2af}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2b0}
21934 @subsection Stream Pointer Positioning
21937 @cite{Ada.Wide_Wide_Text_IO} is similar to @cite{Ada.Text_IO} in its handling
21938 of stream pointer positioning (@ref{29a,,Text_IO}).  There is one additional
21939 case:
21941 If @cite{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
21942 normal lower ASCII set (i.e., a character in the range:
21944 @example
21945 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
21946 @end example
21948 then although the logical position of the file pointer is unchanged by
21949 the @cite{Look_Ahead} call, the stream is physically positioned past the
21950 wide character sequence.  Again this is to avoid the need for buffering
21951 or backup, and all @cite{Wide_Wide_Text_IO} routines check the internal
21952 indication that this situation has occurred so that this is not visible
21953 to a normal program using @cite{Wide_Wide_Text_IO}.  However, this discrepancy
21954 can be observed if the wide text file shares a stream with another file.
21956 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
21957 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2b1}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2b2}
21958 @subsection Reading and Writing Non-Regular Files
21961 As in the case of Text_IO, when a non-regular file is read, it is
21962 assumed that the file contains no page marks (any form characters are
21963 treated as data characters), and @cite{End_Of_Page} always returns
21964 @cite{False}.  Similarly, the end of file indication is not sticky, so
21965 it is possible to read beyond an end of file.
21967 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
21968 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2b3}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2b4}
21969 @section Stream_IO
21972 A stream file is a sequence of bytes, where individual elements are
21973 written to the file as described in the Ada Reference Manual.  The type
21974 @cite{Stream_Element} is simply a byte.  There are two ways to read or
21975 write a stream file.
21978 @itemize *
21980 @item 
21981 The operations @cite{Read} and @cite{Write} directly read or write a
21982 sequence of stream elements with no control information.
21984 @item 
21985 The stream attributes applied to a stream file transfer data in the
21986 manner described for stream attributes.
21987 @end itemize
21989 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
21990 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2b5}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2b6}
21991 @section Text Translation
21994 @code{Text_Translation=xxx} may be used as the Form parameter
21995 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
21996 has no effect on Unix systems. Possible values are:
21999 @itemize *
22001 @item 
22002 @code{Yes} or @code{Text} is the default, which means to
22003 translate LF to/from CR/LF on Windows systems.
22005 @code{No} disables this translation; i.e. it
22006 uses binary mode. For output files, @code{Text_Translation=No}
22007 may be used to create Unix-style files on
22008 Windows.
22010 @item 
22011 @code{wtext} translation enabled in Unicode mode.
22012 (corresponds to _O_WTEXT).
22014 @item 
22015 @code{u8text} translation enabled in Unicode UTF-8 mode.
22016 (corresponds to O_U8TEXT).
22018 @item 
22019 @code{u16text} translation enabled in Unicode UTF-16
22020 mode. (corresponds to_O_U16TEXT).
22021 @end itemize
22023 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22024 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2b7}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2b8}
22025 @section Shared Files
22028 Section A.14 of the Ada Reference Manual allows implementations to
22029 provide a wide variety of behavior if an attempt is made to access the
22030 same external file with two or more internal files.
22032 To provide a full range of functionality, while at the same time
22033 minimizing the problems of portability caused by this implementation
22034 dependence, GNAT handles file sharing as follows:
22037 @itemize *
22039 @item 
22040 In the absence of a @code{shared=xxx} form parameter, an attempt
22041 to open two or more files with the same full name is considered an error
22042 and is not supported.  The exception @cite{Use_Error} will be
22043 raised.  Note that a file that is not explicitly closed by the program
22044 remains open until the program terminates.
22046 @item 
22047 If the form parameter @code{shared=no} appears in the form string, the
22048 file can be opened or created with its own separate stream identifier,
22049 regardless of whether other files sharing the same external file are
22050 opened.  The exact effect depends on how the C stream routines handle
22051 multiple accesses to the same external files using separate streams.
22053 @item 
22054 If the form parameter @code{shared=yes} appears in the form string for
22055 each of two or more files opened using the same full name, the same
22056 stream is shared between these files, and the semantics are as described
22057 in Ada Reference Manual, Section A.14.
22058 @end itemize
22060 When a program that opens multiple files with the same name is ported
22061 from another Ada compiler to GNAT, the effect will be that
22062 @cite{Use_Error} is raised.
22064 The documentation of the original compiler and the documentation of the
22065 program should then be examined to determine if file sharing was
22066 expected, and @code{shared=xxx} parameters added to @cite{Open}
22067 and @cite{Create} calls as required.
22069 When a program is ported from GNAT to some other Ada compiler, no
22070 special attention is required unless the @code{shared=xxx} form
22071 parameter is used in the program.  In this case, you must examine the
22072 documentation of the new compiler to see if it supports the required
22073 file sharing semantics, and form strings modified appropriately.  Of
22074 course it may be the case that the program cannot be ported if the
22075 target compiler does not support the required functionality.  The best
22076 approach in writing portable code is to avoid file sharing (and hence
22077 the use of the @code{shared=xxx} parameter in the form string)
22078 completely.
22080 One common use of file sharing in Ada 83 is the use of instantiations of
22081 Sequential_IO on the same file with different types, to achieve
22082 heterogeneous input-output.  Although this approach will work in GNAT if
22083 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22084 for this purpose (using the stream attributes)
22086 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22087 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2b9}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2ba}
22088 @section Filenames encoding
22091 An encoding form parameter can be used to specify the filename
22092 encoding @code{encoding=xxx}.
22095 @itemize *
22097 @item 
22098 If the form parameter @code{encoding=utf8} appears in the form string, the
22099 filename must be encoded in UTF-8.
22101 @item 
22102 If the form parameter @code{encoding=8bits} appears in the form
22103 string, the filename must be a standard 8bits string.
22104 @end itemize
22106 In the absence of a @code{encoding=xxx} form parameter, the
22107 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22108 variable. And if not set @code{utf8} is assumed.
22111 @table @asis
22113 @item @emph{CP_ACP}
22115 The current system Windows ANSI code page.
22117 @item @emph{CP_UTF8}
22119 UTF-8 encoding
22120 @end table
22122 This encoding form parameter is only supported on the Windows
22123 platform. On the other Operating Systems the run-time is supporting
22124 UTF-8 natively.
22126 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22127 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2bb}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2bc}
22128 @section File content encoding
22131 For text files it is possible to specify the encoding to use. This is
22132 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22133 variable. And if not set @code{TEXT} is assumed.
22135 The possible values are those supported on Windows:
22138 @table @asis
22140 @item @emph{TEXT}
22142 Translated text mode
22144 @item @emph{WTEXT}
22146 Translated unicode encoding
22148 @item @emph{U16TEXT}
22150 Unicode 16-bit encoding
22152 @item @emph{U8TEXT}
22154 Unicode 8-bit encoding
22155 @end table
22157 This encoding is only supported on the Windows platform.
22159 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22160 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2bd}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2be}
22161 @section Open Modes
22164 @cite{Open} and @cite{Create} calls result in a call to @cite{fopen}
22165 using the mode shown in the following table:
22168 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
22169 @headitem
22171 @cite{Open} and @cite{Create} Call Modes
22173 @tab
22175 @tab
22177 @item
22179 @tab
22181 @strong{OPEN}
22183 @tab
22185 @strong{CREATE}
22187 @item
22189 Append_File
22191 @tab
22193 "r+"
22195 @tab
22197 "w+"
22199 @item
22201 In_File
22203 @tab
22207 @tab
22209 "w+"
22211 @item
22213 Out_File (Direct_IO)
22215 @tab
22217 "r+"
22219 @tab
22223 @item
22225 Out_File (all other cases)
22227 @tab
22231 @tab
22235 @item
22237 Inout_File
22239 @tab
22241 "r+"
22243 @tab
22245 "w+"
22247 @end multitable
22250 If text file translation is required, then either @code{b} or @code{t}
22251 is added to the mode, depending on the setting of Text.  Text file
22252 translation refers to the mapping of CR/LF sequences in an external file
22253 to LF characters internally.  This mapping only occurs in DOS and
22254 DOS-like systems, and is not relevant to other systems.
22256 A special case occurs with Stream_IO.  As shown in the above table, the
22257 file is initially opened in @code{r} or @code{w} mode for the
22258 @cite{In_File} and @cite{Out_File} cases.  If a @cite{Set_Mode} operation
22259 subsequently requires switching from reading to writing or vice-versa,
22260 then the file is reopened in @code{r+} mode to permit the required operation.
22262 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22263 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2bf}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2c0}
22264 @section Operations on C Streams
22267 The package @cite{Interfaces.C_Streams} provides an Ada program with direct
22268 access to the C library functions for operations on C streams:
22270 @example
22271 package Interfaces.C_Streams is
22272   -- Note: the reason we do not use the types that are in
22273   -- Interfaces.C is that we want to avoid dragging in the
22274   -- code in this unit if possible.
22275   subtype chars is System.Address;
22276   -- Pointer to null-terminated array of characters
22277   subtype FILEs is System.Address;
22278   -- Corresponds to the C type FILE*
22279   subtype voids is System.Address;
22280   -- Corresponds to the C type void*
22281   subtype int is Integer;
22282   subtype long is Long_Integer;
22283   -- Note: the above types are subtypes deliberately, and it
22284   -- is part of this spec that the above correspondences are
22285   -- guaranteed.  This means that it is legitimate to, for
22286   -- example, use Integer instead of int.  We provide these
22287   -- synonyms for clarity, but in some cases it may be
22288   -- convenient to use the underlying types (for example to
22289   -- avoid an unnecessary dependency of a spec on the spec
22290   -- of this unit).
22291   type size_t is mod 2 ** Standard'Address_Size;
22292   NULL_Stream : constant FILEs;
22293   -- Value returned (NULL in C) to indicate an
22294   -- fdopen/fopen/tmpfile error
22295   ----------------------------------
22296   -- Constants Defined in stdio.h --
22297   ----------------------------------
22298   EOF : constant int;
22299   -- Used by a number of routines to indicate error or
22300   -- end of file
22301   IOFBF : constant int;
22302   IOLBF : constant int;
22303   IONBF : constant int;
22304   -- Used to indicate buffering mode for setvbuf call
22305   SEEK_CUR : constant int;
22306   SEEK_END : constant int;
22307   SEEK_SET : constant int;
22308   -- Used to indicate origin for fseek call
22309   function stdin return FILEs;
22310   function stdout return FILEs;
22311   function stderr return FILEs;
22312   -- Streams associated with standard files
22313   --------------------------
22314   -- Standard C functions --
22315   --------------------------
22316   -- The functions selected below are ones that are
22317   -- available in UNIX (but not necessarily in ANSI C).
22318   -- These are very thin interfaces
22319   -- which copy exactly the C headers.  For more
22320   -- documentation on these functions, see the Microsoft C
22321   -- "Run-Time Library Reference" (Microsoft Press, 1990,
22322   -- ISBN 1-55615-225-6), which includes useful information
22323   -- on system compatibility.
22324   procedure clearerr (stream : FILEs);
22325   function fclose (stream : FILEs) return int;
22326   function fdopen (handle : int; mode : chars) return FILEs;
22327   function feof (stream : FILEs) return int;
22328   function ferror (stream : FILEs) return int;
22329   function fflush (stream : FILEs) return int;
22330   function fgetc (stream : FILEs) return int;
22331   function fgets (strng : chars; n : int; stream : FILEs)
22332       return chars;
22333   function fileno (stream : FILEs) return int;
22334   function fopen (filename : chars; Mode : chars)
22335       return FILEs;
22336   -- Note: to maintain target independence, use
22337   -- text_translation_required, a boolean variable defined in
22338   -- a-sysdep.c to deal with the target dependent text
22339   -- translation requirement.  If this variable is set,
22340   -- then  b/t should be appended to the standard mode
22341   -- argument to set the text translation mode off or on
22342   -- as required.
22343   function fputc (C : int; stream : FILEs) return int;
22344   function fputs (Strng : chars; Stream : FILEs) return int;
22345   function fread
22346      (buffer : voids;
22347       size : size_t;
22348       count : size_t;
22349       stream : FILEs)
22350       return size_t;
22351   function freopen
22352      (filename : chars;
22353       mode : chars;
22354       stream : FILEs)
22355       return FILEs;
22356   function fseek
22357      (stream : FILEs;
22358       offset : long;
22359       origin : int)
22360       return int;
22361   function ftell (stream : FILEs) return long;
22362   function fwrite
22363      (buffer : voids;
22364       size : size_t;
22365       count : size_t;
22366       stream : FILEs)
22367       return size_t;
22368   function isatty (handle : int) return int;
22369   procedure mktemp (template : chars);
22370   -- The return value (which is just a pointer to template)
22371   -- is discarded
22372   procedure rewind (stream : FILEs);
22373   function rmtmp return int;
22374   function setvbuf
22375      (stream : FILEs;
22376       buffer : chars;
22377       mode : int;
22378       size : size_t)
22379       return int;
22381   function tmpfile return FILEs;
22382   function ungetc (c : int; stream : FILEs) return int;
22383   function unlink (filename : chars) return int;
22384   ---------------------
22385   -- Extra functions --
22386   ---------------------
22387   -- These functions supply slightly thicker bindings than
22388   -- those above.  They are derived from functions in the
22389   -- C Run-Time Library, but may do a bit more work than
22390   -- just directly calling one of the Library functions.
22391   function is_regular_file (handle : int) return int;
22392   -- Tests if given handle is for a regular file (result 1)
22393   -- or for a non-regular file (pipe or device, result 0).
22394   ---------------------------------
22395   -- Control of Text/Binary Mode --
22396   ---------------------------------
22397   -- If text_translation_required is true, then the following
22398   -- functions may be used to dynamically switch a file from
22399   -- binary to text mode or vice versa.  These functions have
22400   -- no effect if text_translation_required is false (i.e., in
22401   -- normal UNIX mode).  Use fileno to get a stream handle.
22402   procedure set_binary_mode (handle : int);
22403   procedure set_text_mode (handle : int);
22404   ----------------------------
22405   -- Full Path Name support --
22406   ----------------------------
22407   procedure full_name (nam : chars; buffer : chars);
22408   -- Given a NUL terminated string representing a file
22409   -- name, returns in buffer a NUL terminated string
22410   -- representing the full path name for the file name.
22411   -- On systems where it is relevant the   drive is also
22412   -- part of the full path name.  It is the responsibility
22413   -- of the caller to pass an actual parameter for buffer
22414   -- that is big enough for any full path name.  Use
22415   -- max_path_len given below as the size of buffer.
22416   max_path_len : integer;
22417   -- Maximum length of an allowable full path name on the
22418   -- system, including a terminating NUL character.
22419 end Interfaces.C_Streams;
22420 @end example
22422 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22423 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2c1}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2c2}
22424 @section Interfacing to C Streams
22427 The packages in this section permit interfacing Ada files to C Stream
22428 operations.
22430 @example
22431 with Interfaces.C_Streams;
22432 package Ada.Sequential_IO.C_Streams is
22433    function C_Stream (F : File_Type)
22434       return Interfaces.C_Streams.FILEs;
22435    procedure Open
22436      (File : in out File_Type;
22437       Mode : in File_Mode;
22438       C_Stream : in Interfaces.C_Streams.FILEs;
22439       Form : in String := "");
22440 end Ada.Sequential_IO.C_Streams;
22442  with Interfaces.C_Streams;
22443  package Ada.Direct_IO.C_Streams is
22444     function C_Stream (F : File_Type)
22445        return Interfaces.C_Streams.FILEs;
22446     procedure Open
22447       (File : in out File_Type;
22448        Mode : in File_Mode;
22449        C_Stream : in Interfaces.C_Streams.FILEs;
22450        Form : in String := "");
22451  end Ada.Direct_IO.C_Streams;
22453  with Interfaces.C_Streams;
22454  package Ada.Text_IO.C_Streams is
22455     function C_Stream (F : File_Type)
22456        return Interfaces.C_Streams.FILEs;
22457     procedure Open
22458       (File : in out File_Type;
22459        Mode : in File_Mode;
22460        C_Stream : in Interfaces.C_Streams.FILEs;
22461        Form : in String := "");
22462  end Ada.Text_IO.C_Streams;
22464  with Interfaces.C_Streams;
22465  package Ada.Wide_Text_IO.C_Streams is
22466     function C_Stream (F : File_Type)
22467        return Interfaces.C_Streams.FILEs;
22468     procedure Open
22469       (File : in out File_Type;
22470        Mode : in File_Mode;
22471        C_Stream : in Interfaces.C_Streams.FILEs;
22472        Form : in String := "");
22473 end Ada.Wide_Text_IO.C_Streams;
22475  with Interfaces.C_Streams;
22476  package Ada.Wide_Wide_Text_IO.C_Streams is
22477     function C_Stream (F : File_Type)
22478        return Interfaces.C_Streams.FILEs;
22479     procedure Open
22480       (File : in out File_Type;
22481        Mode : in File_Mode;
22482        C_Stream : in Interfaces.C_Streams.FILEs;
22483        Form : in String := "");
22484 end Ada.Wide_Wide_Text_IO.C_Streams;
22486 with Interfaces.C_Streams;
22487 package Ada.Stream_IO.C_Streams is
22488    function C_Stream (F : File_Type)
22489       return Interfaces.C_Streams.FILEs;
22490    procedure Open
22491      (File : in out File_Type;
22492       Mode : in File_Mode;
22493       C_Stream : in Interfaces.C_Streams.FILEs;
22494       Form : in String := "");
22495 end Ada.Stream_IO.C_Streams;
22496 @end example
22498 In each of these six packages, the @cite{C_Stream} function obtains the
22499 @cite{FILE} pointer from a currently opened Ada file.  It is then
22500 possible to use the @cite{Interfaces.C_Streams} package to operate on
22501 this stream, or the stream can be passed to a C program which can
22502 operate on it directly.  Of course the program is responsible for
22503 ensuring that only appropriate sequences of operations are executed.
22505 One particular use of relevance to an Ada program is that the
22506 @cite{setvbuf} function can be used to control the buffering of the
22507 stream used by an Ada file.  In the absence of such a call the standard
22508 default buffering is used.
22510 The @cite{Open} procedures in these packages open a file giving an
22511 existing C Stream instead of a file name.  Typically this stream is
22512 imported from a C program, allowing an Ada file to operate on an
22513 existing C file.
22515 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
22516 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{2c3}@anchor{gnat_rm/the_gnat_library id1}@anchor{2c4}
22517 @chapter The GNAT Library
22520 The GNAT library contains a number of general and special purpose packages.
22521 It represents functionality that the GNAT developers have found useful, and
22522 which is made available to GNAT users.  The packages described here are fully
22523 supported, and upwards compatibility will be maintained in future releases,
22524 so you can use these facilities with the confidence that the same functionality
22525 will be available in future releases.
22527 The chapter here simply gives a brief summary of the facilities available.
22528 The full documentation is found in the spec file for the package.  The full
22529 sources of these library packages, including both spec and body, are provided
22530 with all GNAT releases.  For example, to find out the full specifications of
22531 the SPITBOL pattern matching capability, including a full tutorial and
22532 extensive examples, look in the @code{g-spipat.ads} file in the library.
22534 For each entry here, the package name (as it would appear in a @cite{with}
22535 clause) is given, followed by the name of the corresponding spec file in
22536 parentheses.  The packages are children in four hierarchies, @cite{Ada},
22537 @cite{Interfaces}, @cite{System}, and @cite{GNAT}, the latter being a
22538 GNAT-specific hierarchy.
22540 Note that an application program should only use packages in one of these
22541 four hierarchies if the package is defined in the Ada Reference Manual,
22542 or is listed in this section of the GNAT Programmers Reference Manual.
22543 All other units should be considered internal implementation units and
22544 should not be directly @cite{with}'ed by application code.  The use of
22545 a @cite{with} statement that references one of these internal implementation
22546 units makes an application potentially dependent on changes in versions
22547 of GNAT, and will generate a warning message.
22549 @menu
22550 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
22551 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
22552 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
22553 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
22554 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
22555 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
22556 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
22557 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
22558 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
22559 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
22560 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
22561 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
22562 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
22563 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
22564 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
22565 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
22566 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
22567 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
22568 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
22569 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
22570 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
22571 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
22572 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
22573 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
22574 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
22575 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
22576 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
22577 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
22578 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
22579 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
22580 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
22581 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
22582 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
22583 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
22584 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
22585 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
22586 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
22587 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
22588 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
22589 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
22590 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
22591 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
22592 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
22593 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
22594 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
22595 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
22596 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
22597 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
22598 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
22599 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
22600 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
22601 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
22602 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
22603 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
22604 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
22605 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
22606 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
22607 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
22608 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
22609 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
22610 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
22611 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
22612 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
22613 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
22614 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
22615 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
22616 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
22617 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
22618 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
22619 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
22620 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
22621 * GNAT.Exceptions (g-expect.ads): GNAT Exceptions g-expect ads. 
22622 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
22623 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
22624 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
22625 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
22626 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
22627 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
22628 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
22629 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
22630 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
22631 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
22632 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
22633 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
22634 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
22635 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
22636 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
22637 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
22638 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
22639 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
22640 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
22641 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
22642 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
22643 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
22644 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
22645 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
22646 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
22647 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
22648 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
22649 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
22650 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
22651 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
22652 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
22653 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
22654 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
22655 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
22656 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
22657 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
22658 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
22659 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
22660 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
22661 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
22662 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
22663 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
22664 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
22665 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
22666 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
22667 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
22668 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
22669 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
22670 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
22671 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
22672 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
22673 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
22674 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
22675 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
22676 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
22677 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
22678 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
22679 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
22680 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
22681 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
22682 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
22683 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
22684 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
22685 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
22686 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
22687 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
22688 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
22689 * System.Memory (s-memory.ads): System Memory s-memory ads. 
22690 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
22691 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
22692 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
22693 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
22694 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
22695 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
22696 * System.Rident (s-rident.ads): System Rident s-rident ads. 
22697 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
22698 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
22699 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
22700 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
22702 @end menu
22704 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
22705 @anchor{gnat_rm/the_gnat_library id2}@anchor{2c5}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2c6}
22706 @section @cite{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
22709 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
22711 @geindex Latin_9 constants for Character
22713 This child of @cite{Ada.Characters}
22714 provides a set of definitions corresponding to those in the
22715 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22716 few modifications required for @cite{Latin-9}
22717 The provision of such a package
22718 is specifically authorized by the Ada Reference Manual
22719 (RM A.3.3(27)).
22721 @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
22722 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2c7}@anchor{gnat_rm/the_gnat_library id3}@anchor{2c8}
22723 @section @cite{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
22726 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
22728 @geindex Latin_1 constants for Wide_Character
22730 This child of @cite{Ada.Characters}
22731 provides a set of definitions corresponding to those in the
22732 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22733 types of the constants being @cite{Wide_Character}
22734 instead of @cite{Character}.  The provision of such a package
22735 is specifically authorized by the Ada Reference Manual
22736 (RM A.3.3(27)).
22738 @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
22739 @anchor{gnat_rm/the_gnat_library id4}@anchor{2c9}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2ca}
22740 @section @cite{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
22743 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
22745 @geindex Latin_9 constants for Wide_Character
22747 This child of @cite{Ada.Characters}
22748 provides a set of definitions corresponding to those in the
22749 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22750 types of the constants being @cite{Wide_Character}
22751 instead of @cite{Character}.  The provision of such a package
22752 is specifically authorized by the Ada Reference Manual
22753 (RM A.3.3(27)).
22755 @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
22756 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2cb}@anchor{gnat_rm/the_gnat_library id5}@anchor{2cc}
22757 @section @cite{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
22760 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
22762 @geindex Latin_1 constants for Wide_Wide_Character
22764 This child of @cite{Ada.Characters}
22765 provides a set of definitions corresponding to those in the
22766 RM-defined package @cite{Ada.Characters.Latin_1} but with the
22767 types of the constants being @cite{Wide_Wide_Character}
22768 instead of @cite{Character}.  The provision of such a package
22769 is specifically authorized by the Ada Reference Manual
22770 (RM A.3.3(27)).
22772 @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
22773 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2cd}@anchor{gnat_rm/the_gnat_library id6}@anchor{2ce}
22774 @section @cite{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
22777 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
22779 @geindex Latin_9 constants for Wide_Wide_Character
22781 This child of @cite{Ada.Characters}
22782 provides a set of definitions corresponding to those in the
22783 GNAT defined package @cite{Ada.Characters.Latin_9} but with the
22784 types of the constants being @cite{Wide_Wide_Character}
22785 instead of @cite{Character}.  The provision of such a package
22786 is specifically authorized by the Ada Reference Manual
22787 (RM A.3.3(27)).
22789 @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
22790 @anchor{gnat_rm/the_gnat_library id7}@anchor{2cf}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2d0}
22791 @section @cite{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
22794 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
22796 @geindex Formal container for doubly linked lists
22798 This child of @cite{Ada.Containers} defines a modified version of the
22799 Ada 2005 container for doubly linked lists, meant to facilitate formal
22800 verification of code using such containers. The specification of this
22801 unit is compatible with SPARK 2014.
22803 Note that although this container was designed with formal verification
22804 in mind, it may well be generally useful in that it is a simplified more
22805 efficient version than the one defined in the standard. In particular it
22806 does not have the complex overhead required to detect cursor tampering.
22808 @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
22809 @anchor{gnat_rm/the_gnat_library id8}@anchor{2d1}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2d2}
22810 @section @cite{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
22813 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
22815 @geindex Formal container for hashed maps
22817 This child of @cite{Ada.Containers} defines a modified version of the
22818 Ada 2005 container for hashed maps, meant to facilitate formal
22819 verification of code using such containers. The specification of this
22820 unit is compatible with SPARK 2014.
22822 Note that although this container was designed with formal verification
22823 in mind, it may well be generally useful in that it is a simplified more
22824 efficient version than the one defined in the standard. In particular it
22825 does not have the complex overhead required to detect cursor tampering.
22827 @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
22828 @anchor{gnat_rm/the_gnat_library id9}@anchor{2d3}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2d4}
22829 @section @cite{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
22832 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
22834 @geindex Formal container for hashed sets
22836 This child of @cite{Ada.Containers} defines a modified version of the
22837 Ada 2005 container for hashed sets, meant to facilitate formal
22838 verification of code using such containers. The specification of this
22839 unit is compatible with SPARK 2014.
22841 Note that although this container was designed with formal verification
22842 in mind, it may well be generally useful in that it is a simplified more
22843 efficient version than the one defined in the standard. In particular it
22844 does not have the complex overhead required to detect cursor tampering.
22846 @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
22847 @anchor{gnat_rm/the_gnat_library id10}@anchor{2d5}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2d6}
22848 @section @cite{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
22851 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
22853 @geindex Formal container for ordered maps
22855 This child of @cite{Ada.Containers} defines a modified version of the
22856 Ada 2005 container for ordered maps, meant to facilitate formal
22857 verification of code using such containers. The specification of this
22858 unit is compatible with SPARK 2014.
22860 Note that although this container was designed with formal verification
22861 in mind, it may well be generally useful in that it is a simplified more
22862 efficient version than the one defined in the standard. In particular it
22863 does not have the complex overhead required to detect cursor tampering.
22865 @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
22866 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2d7}@anchor{gnat_rm/the_gnat_library id11}@anchor{2d8}
22867 @section @cite{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
22870 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
22872 @geindex Formal container for ordered sets
22874 This child of @cite{Ada.Containers} defines a modified version of the
22875 Ada 2005 container for ordered sets, meant to facilitate formal
22876 verification of code using such containers. The specification of this
22877 unit is compatible with SPARK 2014.
22879 Note that although this container was designed with formal verification
22880 in mind, it may well be generally useful in that it is a simplified more
22881 efficient version than the one defined in the standard. In particular it
22882 does not have the complex overhead required to detect cursor tampering.
22884 @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
22885 @anchor{gnat_rm/the_gnat_library id12}@anchor{2d9}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2da}
22886 @section @cite{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
22889 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
22891 @geindex Formal container for vectors
22893 This child of @cite{Ada.Containers} defines a modified version of the
22894 Ada 2005 container for vectors, meant to facilitate formal
22895 verification of code using such containers. The specification of this
22896 unit is compatible with SPARK 2014.
22898 Note that although this container was designed with formal verification
22899 in mind, it may well be generally useful in that it is a simplified more
22900 efficient version than the one defined in the standard. In particular it
22901 does not have the complex overhead required to detect cursor tampering.
22903 @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
22904 @anchor{gnat_rm/the_gnat_library id13}@anchor{2db}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2dc}
22905 @section @cite{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
22908 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
22910 @geindex Formal container for vectors
22912 This child of @cite{Ada.Containers} defines a modified version of the
22913 Ada 2005 container for vectors of indefinite elements, meant to
22914 facilitate formal verification of code using such containers. The
22915 specification of this unit is compatible with SPARK 2014.
22917 Note that although this container was designed with formal verification
22918 in mind, it may well be generally useful in that it is a simplified more
22919 efficient version than the one defined in the standard. In particular it
22920 does not have the complex overhead required to detect cursor tampering.
22922 @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
22923 @anchor{gnat_rm/the_gnat_library id14}@anchor{2dd}@anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2de}
22924 @section @cite{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
22927 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
22929 @geindex Formal container for vectors
22931 This child of @cite{Ada.Containers} defines a modified version of
22932 Indefinite_Holders that avoids heap allocation.
22934 @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
22935 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2df}@anchor{gnat_rm/the_gnat_library id15}@anchor{2e0}
22936 @section @cite{Ada.Command_Line.Environment} (@code{a-colien.ads})
22939 @geindex Ada.Command_Line.Environment (a-colien.ads)
22941 @geindex Environment entries
22943 This child of @cite{Ada.Command_Line}
22944 provides a mechanism for obtaining environment values on systems
22945 where this concept makes sense.
22947 @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
22948 @anchor{gnat_rm/the_gnat_library id16}@anchor{2e1}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2e2}
22949 @section @cite{Ada.Command_Line.Remove} (@code{a-colire.ads})
22952 @geindex Ada.Command_Line.Remove (a-colire.ads)
22954 @geindex Removing command line arguments
22956 @geindex Command line
22957 @geindex argument removal
22959 This child of @cite{Ada.Command_Line}
22960 provides a mechanism for logically removing
22961 arguments from the argument list.  Once removed, an argument is not visible
22962 to further calls on the subprograms in @cite{Ada.Command_Line} will not
22963 see the removed argument.
22965 @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
22966 @anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2e3}@anchor{gnat_rm/the_gnat_library id17}@anchor{2e4}
22967 @section @cite{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
22970 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
22972 @geindex Response file for command line
22974 @geindex Command line
22975 @geindex response file
22977 @geindex Command line
22978 @geindex handling long command lines
22980 This child of @cite{Ada.Command_Line} provides a mechanism facilities for
22981 getting command line arguments from a text file, called a "response file".
22982 Using a response file allow passing a set of arguments to an executable longer
22983 than the maximum allowed by the system on the command line.
22985 @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
22986 @anchor{gnat_rm/the_gnat_library id18}@anchor{2e5}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2e6}
22987 @section @cite{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
22990 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
22992 @geindex C Streams
22993 @geindex Interfacing with Direct_IO
22995 This package provides subprograms that allow interfacing between
22996 C streams and @cite{Direct_IO}.  The stream identifier can be
22997 extracted from a file opened on the Ada side, and an Ada file
22998 can be constructed from a stream opened on the C side.
23000 @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
23001 @anchor{gnat_rm/the_gnat_library id19}@anchor{2e7}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2e8}
23002 @section @cite{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23005 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23007 @geindex Null_Occurrence
23008 @geindex testing for
23010 This child subprogram provides a way of testing for the null
23011 exception occurrence (@cite{Null_Occurrence}) without raising
23012 an exception.
23014 @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
23015 @anchor{gnat_rm/the_gnat_library id20}@anchor{2e9}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2ea}
23016 @section @cite{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23019 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23021 @geindex Null_Occurrence
23022 @geindex testing for
23024 This child subprogram is used for handling otherwise unhandled
23025 exceptions (hence the name last chance), and perform clean ups before
23026 terminating the program. Note that this subprogram never returns.
23028 @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
23029 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2eb}@anchor{gnat_rm/the_gnat_library id21}@anchor{2ec}
23030 @section @cite{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23033 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23035 @geindex Traceback for Exception Occurrence
23037 This child package provides the subprogram (@cite{Tracebacks}) to
23038 give a traceback array of addresses based on an exception
23039 occurrence.
23041 @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
23042 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2ed}@anchor{gnat_rm/the_gnat_library id22}@anchor{2ee}
23043 @section @cite{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23046 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23048 @geindex C Streams
23049 @geindex Interfacing with Sequential_IO
23051 This package provides subprograms that allow interfacing between
23052 C streams and @cite{Sequential_IO}.  The stream identifier can be
23053 extracted from a file opened on the Ada side, and an Ada file
23054 can be constructed from a stream opened on the C side.
23056 @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
23057 @anchor{gnat_rm/the_gnat_library id23}@anchor{2ef}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2f0}
23058 @section @cite{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23061 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23063 @geindex C Streams
23064 @geindex Interfacing with Stream_IO
23066 This package provides subprograms that allow interfacing between
23067 C streams and @cite{Stream_IO}.  The stream identifier can be
23068 extracted from a file opened on the Ada side, and an Ada file
23069 can be constructed from a stream opened on the C side.
23071 @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
23072 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2f1}@anchor{gnat_rm/the_gnat_library id24}@anchor{2f2}
23073 @section @cite{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23076 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23078 @geindex Unbounded_String
23079 @geindex IO support
23081 @geindex Text_IO
23082 @geindex extensions for unbounded strings
23084 This package provides subprograms for Text_IO for unbounded
23085 strings, avoiding the necessity for an intermediate operation
23086 with ordinary strings.
23088 @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
23089 @anchor{gnat_rm/the_gnat_library id25}@anchor{2f3}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{2f4}
23090 @section @cite{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23093 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23095 @geindex Unbounded_Wide_String
23096 @geindex IO support
23098 @geindex Text_IO
23099 @geindex extensions for unbounded wide strings
23101 This package provides subprograms for Text_IO for unbounded
23102 wide strings, avoiding the necessity for an intermediate operation
23103 with ordinary wide strings.
23105 @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
23106 @anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{2f5}@anchor{gnat_rm/the_gnat_library id26}@anchor{2f6}
23107 @section @cite{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23110 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23112 @geindex Unbounded_Wide_Wide_String
23113 @geindex IO support
23115 @geindex Text_IO
23116 @geindex extensions for unbounded wide wide strings
23118 This package provides subprograms for Text_IO for unbounded
23119 wide wide strings, avoiding the necessity for an intermediate operation
23120 with ordinary wide wide strings.
23122 @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
23123 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{2f7}@anchor{gnat_rm/the_gnat_library id27}@anchor{2f8}
23124 @section @cite{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23127 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23129 @geindex C Streams
23130 @geindex Interfacing with `Text_IO`
23132 This package provides subprograms that allow interfacing between
23133 C streams and @cite{Text_IO}.  The stream identifier can be
23134 extracted from a file opened on the Ada side, and an Ada file
23135 can be constructed from a stream opened on the C side.
23137 @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
23138 @anchor{gnat_rm/the_gnat_library id28}@anchor{2f9}@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{2fa}
23139 @section @cite{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23142 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23144 @geindex Text_IO resetting standard files
23146 This procedure is used to reset the status of the standard files used
23147 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
23148 embedded application) where the status of the files may change during
23149 execution (for example a standard input file may be redefined to be
23150 interactive).
23152 @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
23153 @anchor{gnat_rm/the_gnat_library id29}@anchor{2fb}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{2fc}
23154 @section @cite{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23157 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23159 @geindex Unicode categorization
23160 @geindex Wide_Character
23162 This package provides subprograms that allow categorization of
23163 Wide_Character values according to Unicode categories.
23165 @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
23166 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{2fd}@anchor{gnat_rm/the_gnat_library id30}@anchor{2fe}
23167 @section @cite{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23170 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23172 @geindex C Streams
23173 @geindex Interfacing with `Wide_Text_IO`
23175 This package provides subprograms that allow interfacing between
23176 C streams and @cite{Wide_Text_IO}.  The stream identifier can be
23177 extracted from a file opened on the Ada side, and an Ada file
23178 can be constructed from a stream opened on the C side.
23180 @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
23181 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{2ff}@anchor{gnat_rm/the_gnat_library id31}@anchor{300}
23182 @section @cite{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23185 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23187 @geindex Wide_Text_IO resetting standard files
23189 This procedure is used to reset the status of the standard files used
23190 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
23191 embedded application) where the status of the files may change during
23192 execution (for example a standard input file may be redefined to be
23193 interactive).
23195 @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
23196 @anchor{gnat_rm/the_gnat_library id32}@anchor{301}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{302}
23197 @section @cite{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23200 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23202 @geindex Unicode categorization
23203 @geindex Wide_Wide_Character
23205 This package provides subprograms that allow categorization of
23206 Wide_Wide_Character values according to Unicode categories.
23208 @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
23209 @anchor{gnat_rm/the_gnat_library id33}@anchor{303}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{304}
23210 @section @cite{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23213 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23215 @geindex C Streams
23216 @geindex Interfacing with `Wide_Wide_Text_IO`
23218 This package provides subprograms that allow interfacing between
23219 C streams and @cite{Wide_Wide_Text_IO}.  The stream identifier can be
23220 extracted from a file opened on the Ada side, and an Ada file
23221 can be constructed from a stream opened on the C side.
23223 @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
23224 @anchor{gnat_rm/the_gnat_library id34}@anchor{305}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{306}
23225 @section @cite{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23228 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23230 @geindex Wide_Wide_Text_IO resetting standard files
23232 This procedure is used to reset the status of the standard files used
23233 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23234 restart in an embedded application) where the status of the files may
23235 change during execution (for example a standard input file may be
23236 redefined to be interactive).
23238 @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
23239 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{307}@anchor{gnat_rm/the_gnat_library id35}@anchor{308}
23240 @section @cite{GNAT.Altivec} (@code{g-altive.ads})
23243 @geindex GNAT.Altivec (g-altive.ads)
23245 @geindex AltiVec
23247 This is the root package of the GNAT AltiVec binding. It provides
23248 definitions of constants and types common to all the versions of the
23249 binding.
23251 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23252 @anchor{gnat_rm/the_gnat_library id36}@anchor{309}@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{30a}
23253 @section @cite{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23256 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23258 @geindex AltiVec
23260 This package provides the Vector/View conversion routines.
23262 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23263 @anchor{gnat_rm/the_gnat_library id37}@anchor{30b}@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{30c}
23264 @section @cite{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23267 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23269 @geindex AltiVec
23271 This package exposes the Ada interface to the AltiVec operations on
23272 vector objects. A soft emulation is included by default in the GNAT
23273 library. The hard binding is provided as a separate package. This unit
23274 is common to both bindings.
23276 @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
23277 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id38}@anchor{30e}
23278 @section @cite{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23281 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23283 @geindex AltiVec
23285 This package exposes the various vector types part of the Ada binding
23286 to AltiVec facilities.
23288 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23289 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{30f}@anchor{gnat_rm/the_gnat_library id39}@anchor{310}
23290 @section @cite{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23293 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23295 @geindex AltiVec
23297 This package provides public 'View' data types from/to which private
23298 vector representations can be converted via
23299 GNAT.Altivec.Conversions. This allows convenient access to individual
23300 vector elements and provides a simple way to initialize vector
23301 objects.
23303 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23304 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{311}@anchor{gnat_rm/the_gnat_library id40}@anchor{312}
23305 @section @cite{GNAT.Array_Split} (@code{g-arrspl.ads})
23308 @geindex GNAT.Array_Split (g-arrspl.ads)
23310 @geindex Array splitter
23312 Useful array-manipulation routines: given a set of separators, split
23313 an array wherever the separators appear, and provide direct access
23314 to the resulting slices.
23316 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23317 @anchor{gnat_rm/the_gnat_library id41}@anchor{313}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{314}
23318 @section @cite{GNAT.AWK} (@code{g-awk.ads})
23321 @geindex GNAT.AWK (g-awk.ads)
23323 @geindex Parsing
23325 @geindex AWK
23327 Provides AWK-like parsing functions, with an easy interface for parsing one
23328 or more files containing formatted data.  The file is viewed as a database
23329 where each record is a line and a field is a data element in this line.
23331 @node GNAT Bind_Environment g-binenv ads,GNAT Bounded_Buffers g-boubuf ads,GNAT AWK g-awk ads,The GNAT Library
23332 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{315}@anchor{gnat_rm/the_gnat_library id42}@anchor{316}
23333 @section @cite{GNAT.Bind_Environment} (@code{g-binenv.ads})
23336 @geindex GNAT.Bind_Environment (g-binenv.ads)
23338 @geindex Bind environment
23340 Provides access to key=value associations captured at bind time.
23341 These associations can be specified using the @cite{-V} binder command
23342 line switch.
23344 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23345 @anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{317}@anchor{gnat_rm/the_gnat_library id43}@anchor{318}
23346 @section @cite{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23349 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23351 @geindex Parsing
23353 @geindex Bounded Buffers
23355 Provides a concurrent generic bounded buffer abstraction.  Instances are
23356 useful directly or as parts of the implementations of other abstractions,
23357 such as mailboxes.
23359 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23360 @anchor{gnat_rm/the_gnat_library id44}@anchor{319}@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{31a}
23361 @section @cite{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23364 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23366 @geindex Parsing
23368 @geindex Mailboxes
23370 Provides a thread-safe asynchronous intertask mailbox communication facility.
23372 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23373 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id45}@anchor{31c}
23374 @section @cite{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23377 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23379 @geindex Sorting
23381 @geindex Bubble sort
23383 Provides a general implementation of bubble sort usable for sorting arbitrary
23384 data items.  Exchange and comparison procedures are provided by passing
23385 access-to-procedure values.
23387 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23388 @anchor{gnat_rm/the_gnat_library id46}@anchor{31d}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{31e}
23389 @section @cite{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23392 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23394 @geindex Sorting
23396 @geindex Bubble sort
23398 Provides a general implementation of bubble sort usable for sorting arbitrary
23399 data items.  Move and comparison procedures are provided by passing
23400 access-to-procedure values. This is an older version, retained for
23401 compatibility. Usually @cite{GNAT.Bubble_Sort} will be preferable.
23403 @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
23404 @anchor{gnat_rm/the_gnat_library id47}@anchor{31f}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{320}
23405 @section @cite{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23408 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23410 @geindex Sorting
23412 @geindex Bubble sort
23414 Similar to @cite{Bubble_Sort_A} except that the move and sorting procedures
23415 are provided as generic parameters, this improves efficiency, especially
23416 if the procedures can be inlined, at the expense of duplicating code for
23417 multiple instantiations.
23419 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23420 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{321}@anchor{gnat_rm/the_gnat_library id48}@anchor{322}
23421 @section @cite{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23424 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23426 @geindex UTF-8 representation
23428 @geindex Wide characte representations
23430 Provides a routine which given a string, reads the start of the string to
23431 see whether it is one of the standard byte order marks (BOM's) which signal
23432 the encoding of the string. The routine includes detection of special XML
23433 sequences for various UCS input formats.
23435 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
23436 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id49}@anchor{324}
23437 @section @cite{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
23440 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
23442 @geindex Byte swapping
23444 @geindex Endianness
23446 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
23447 Machine-specific implementations are available in some cases.
23449 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
23450 @anchor{gnat_rm/the_gnat_library id50}@anchor{325}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{326}
23451 @section @cite{GNAT.Calendar} (@code{g-calend.ads})
23454 @geindex GNAT.Calendar (g-calend.ads)
23456 @geindex Calendar
23458 Extends the facilities provided by @cite{Ada.Calendar} to include handling
23459 of days of the week, an extended @cite{Split} and @cite{Time_Of} capability.
23460 Also provides conversion of @cite{Ada.Calendar.Time} values to and from the
23461 C @cite{timeval} format.
23463 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
23464 @anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{327}@anchor{gnat_rm/the_gnat_library id51}@anchor{328}
23465 @section @cite{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
23468 @geindex Calendar
23470 @geindex Time
23472 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
23474 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
23475 @anchor{gnat_rm/the_gnat_library id52}@anchor{329}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{32a}
23476 @section @cite{GNAT.CRC32} (@code{g-crc32.ads})
23479 @geindex GNAT.CRC32 (g-crc32.ads)
23481 @geindex CRC32
23483 @geindex Cyclic Redundancy Check
23485 This package implements the CRC-32 algorithm.  For a full description
23486 of this algorithm see
23487 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
23488 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
23489 Aug. 1988.  Sarwate, D.V.
23491 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
23492 @anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{32b}@anchor{gnat_rm/the_gnat_library id53}@anchor{32c}
23493 @section @cite{GNAT.Case_Util} (@code{g-casuti.ads})
23496 @geindex GNAT.Case_Util (g-casuti.ads)
23498 @geindex Casing utilities
23500 @geindex Character handling (`GNAT.Case_Util`)
23502 A set of simple routines for handling upper and lower casing of strings
23503 without the overhead of the full casing tables
23504 in @cite{Ada.Characters.Handling}.
23506 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
23507 @anchor{gnat_rm/the_gnat_library id54}@anchor{32d}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{32e}
23508 @section @cite{GNAT.CGI} (@code{g-cgi.ads})
23511 @geindex GNAT.CGI (g-cgi.ads)
23513 @geindex CGI (Common Gateway Interface)
23515 This is a package for interfacing a GNAT program with a Web server via the
23516 Common Gateway Interface (CGI).  Basically this package parses the CGI
23517 parameters, which are a set of key/value pairs sent by the Web server.  It
23518 builds a table whose index is the key and provides some services to deal
23519 with this table.
23521 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
23522 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id55}@anchor{330}
23523 @section @cite{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
23526 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
23528 @geindex CGI (Common Gateway Interface) cookie support
23530 @geindex Cookie support in CGI
23532 This is a package to interface a GNAT program with a Web server via the
23533 Common Gateway Interface (CGI).  It exports services to deal with Web
23534 cookies (piece of information kept in the Web client software).
23536 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
23537 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id56}@anchor{332}
23538 @section @cite{GNAT.CGI.Debug} (@code{g-cgideb.ads})
23541 @geindex GNAT.CGI.Debug (g-cgideb.ads)
23543 @geindex CGI (Common Gateway Interface) debugging
23545 This is a package to help debugging CGI (Common Gateway Interface)
23546 programs written in Ada.
23548 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
23549 @anchor{gnat_rm/the_gnat_library id57}@anchor{333}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{334}
23550 @section @cite{GNAT.Command_Line} (@code{g-comlin.ads})
23553 @geindex GNAT.Command_Line (g-comlin.ads)
23555 @geindex Command line
23557 Provides a high level interface to @cite{Ada.Command_Line} facilities,
23558 including the ability to scan for named switches with optional parameters
23559 and expand file names using wild card notations.
23561 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
23562 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id58}@anchor{336}
23563 @section @cite{GNAT.Compiler_Version} (@code{g-comver.ads})
23566 @geindex GNAT.Compiler_Version (g-comver.ads)
23568 @geindex Compiler Version
23570 @geindex Version
23571 @geindex of compiler
23573 Provides a routine for obtaining the version of the compiler used to
23574 compile the program. More accurately this is the version of the binder
23575 used to bind the program (this will normally be the same as the version
23576 of the compiler if a consistent tool set is used to compile all units
23577 of a partition).
23579 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
23580 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id59}@anchor{338}
23581 @section @cite{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
23584 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
23586 @geindex Interrupt
23588 Provides a simple interface to handle Ctrl-C keyboard events.
23590 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
23591 @anchor{gnat_rm/the_gnat_library id60}@anchor{339}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{33a}
23592 @section @cite{GNAT.Current_Exception} (@code{g-curexc.ads})
23595 @geindex GNAT.Current_Exception (g-curexc.ads)
23597 @geindex Current exception
23599 @geindex Exception retrieval
23601 Provides access to information on the current exception that has been raised
23602 without the need for using the Ada 95 / Ada 2005 exception choice parameter
23603 specification syntax.
23604 This is particularly useful in simulating typical facilities for
23605 obtaining information about exceptions provided by Ada 83 compilers.
23607 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
23608 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id61}@anchor{33c}
23609 @section @cite{GNAT.Debug_Pools} (@code{g-debpoo.ads})
23612 @geindex GNAT.Debug_Pools (g-debpoo.ads)
23614 @geindex Debugging
23616 @geindex Debug pools
23618 @geindex Memory corruption debugging
23620 Provide a debugging storage pools that helps tracking memory corruption
23621 problems.
23622 See @cite{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
23624 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
23625 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{33d}@anchor{gnat_rm/the_gnat_library id62}@anchor{33e}
23626 @section @cite{GNAT.Debug_Utilities} (@code{g-debuti.ads})
23629 @geindex GNAT.Debug_Utilities (g-debuti.ads)
23631 @geindex Debugging
23633 Provides a few useful utilities for debugging purposes, including conversion
23634 to and from string images of address values. Supports both C and Ada formats
23635 for hexadecimal literals.
23637 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
23638 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{33f}@anchor{gnat_rm/the_gnat_library id63}@anchor{340}
23639 @section @cite{GNAT.Decode_String} (@code{g-decstr.ads})
23642 @geindex GNAT.Decode_String (g-decstr.ads)
23644 @geindex Decoding strings
23646 @geindex String decoding
23648 @geindex Wide character encoding
23650 @geindex UTF-8
23652 @geindex Unicode
23654 A generic package providing routines for decoding wide character and wide wide
23655 character strings encoded as sequences of 8-bit characters using a specified
23656 encoding method. Includes validation routines, and also routines for stepping
23657 to next or previous encoded character in an encoded string.
23658 Useful in conjunction with Unicode character coding. Note there is a
23659 preinstantiation for UTF-8. See next entry.
23661 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
23662 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{341}@anchor{gnat_rm/the_gnat_library id64}@anchor{342}
23663 @section @cite{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
23666 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
23668 @geindex Decoding strings
23670 @geindex Decoding UTF-8 strings
23672 @geindex UTF-8 string decoding
23674 @geindex Wide character decoding
23676 @geindex UTF-8
23678 @geindex Unicode
23680 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
23682 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
23683 @anchor{gnat_rm/the_gnat_library id65}@anchor{343}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{344}
23684 @section @cite{GNAT.Directory_Operations} (@code{g-dirope.ads})
23687 @geindex GNAT.Directory_Operations (g-dirope.ads)
23689 @geindex Directory operations
23691 Provides a set of routines for manipulating directories, including changing
23692 the current directory, making new directories, and scanning the files in a
23693 directory.
23695 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
23696 @anchor{gnat_rm/the_gnat_library id66}@anchor{345}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{346}
23697 @section @cite{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
23700 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
23702 @geindex Directory operations iteration
23704 A child unit of GNAT.Directory_Operations providing additional operations
23705 for iterating through directories.
23707 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
23708 @anchor{gnat_rm/the_gnat_library id67}@anchor{347}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{348}
23709 @section @cite{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
23712 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
23714 @geindex Hash tables
23716 A generic implementation of hash tables that can be used to hash arbitrary
23717 data.  Provided in two forms, a simple form with built in hash functions,
23718 and a more complex form in which the hash function is supplied.
23720 This package provides a facility similar to that of @cite{GNAT.HTable},
23721 except that this package declares a type that can be used to define
23722 dynamic instances of the hash table, while an instantiation of
23723 @cite{GNAT.HTable} creates a single instance of the hash table.
23725 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
23726 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id68}@anchor{34a}
23727 @section @cite{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
23730 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
23732 @geindex Table implementation
23734 @geindex Arrays
23735 @geindex extendable
23737 A generic package providing a single dimension array abstraction where the
23738 length of the array can be dynamically modified.
23740 This package provides a facility similar to that of @cite{GNAT.Table},
23741 except that this package declares a type that can be used to define
23742 dynamic instances of the table, while an instantiation of
23743 @cite{GNAT.Table} creates a single instance of the table type.
23745 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
23746 @anchor{gnat_rm/the_gnat_library id69}@anchor{34b}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{34c}
23747 @section @cite{GNAT.Encode_String} (@code{g-encstr.ads})
23750 @geindex GNAT.Encode_String (g-encstr.ads)
23752 @geindex Encoding strings
23754 @geindex String encoding
23756 @geindex Wide character encoding
23758 @geindex UTF-8
23760 @geindex Unicode
23762 A generic package providing routines for encoding wide character and wide
23763 wide character strings as sequences of 8-bit characters using a specified
23764 encoding method. Useful in conjunction with Unicode character coding.
23765 Note there is a preinstantiation for UTF-8. See next entry.
23767 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
23768 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id70}@anchor{34e}
23769 @section @cite{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
23772 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
23774 @geindex Encoding strings
23776 @geindex Encoding UTF-8 strings
23778 @geindex UTF-8 string encoding
23780 @geindex Wide character encoding
23782 @geindex UTF-8
23784 @geindex Unicode
23786 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
23788 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
23789 @anchor{gnat_rm/the_gnat_library id71}@anchor{34f}@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{350}
23790 @section @cite{GNAT.Exception_Actions} (@code{g-excact.ads})
23793 @geindex GNAT.Exception_Actions (g-excact.ads)
23795 @geindex Exception actions
23797 Provides callbacks when an exception is raised. Callbacks can be registered
23798 for specific exceptions, or when any exception is raised. This
23799 can be used for instance to force a core dump to ease debugging.
23801 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-expect ads,GNAT Exception_Actions g-excact ads,The GNAT Library
23802 @anchor{gnat_rm/the_gnat_library id72}@anchor{351}@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{352}
23803 @section @cite{GNAT.Exception_Traces} (@code{g-exctra.ads})
23806 @geindex GNAT.Exception_Traces (g-exctra.ads)
23808 @geindex Exception traces
23810 @geindex Debugging
23812 Provides an interface allowing to control automatic output upon exception
23813 occurrences.
23815 @node GNAT Exceptions g-expect ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
23816 @anchor{gnat_rm/the_gnat_library id73}@anchor{353}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-expect-ads}@anchor{354}
23817 @section @cite{GNAT.Exceptions} (@code{g-expect.ads})
23820 @geindex GNAT.Exceptions (g-expect.ads)
23822 @geindex Exceptions
23823 @geindex Pure
23825 @geindex Pure packages
23826 @geindex exceptions
23828 Normally it is not possible to raise an exception with
23829 a message from a subprogram in a pure package, since the
23830 necessary types and subprograms are in @cite{Ada.Exceptions}
23831 which is not a pure unit. @cite{GNAT.Exceptions} provides a
23832 facility for getting around this limitation for a few
23833 predefined exceptions, and for example allow raising
23834 @cite{Constraint_Error} with a message from a pure subprogram.
23836 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-expect ads,The GNAT Library
23837 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{355}@anchor{gnat_rm/the_gnat_library id74}@anchor{356}
23838 @section @cite{GNAT.Expect} (@code{g-expect.ads})
23841 @geindex GNAT.Expect (g-expect.ads)
23843 Provides a set of subprograms similar to what is available
23844 with the standard Tcl Expect tool.
23845 It allows you to easily spawn and communicate with an external process.
23846 You can send commands or inputs to the process, and compare the output
23847 with some expected regular expression. Currently @cite{GNAT.Expect}
23848 is implemented on all native GNAT ports.
23849 It is not implemented for cross ports, and in particular is not
23850 implemented for VxWorks or LynxOS.
23852 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
23853 @anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id75}@anchor{358}
23854 @section @cite{GNAT.Expect.TTY} (@code{g-exptty.ads})
23857 @geindex GNAT.Expect.TTY (g-exptty.ads)
23859 As GNAT.Expect but using pseudo-terminal.
23860 Currently @cite{GNAT.Expect.TTY} is implemented on all native GNAT
23861 ports. It is not implemented for cross ports, and
23862 in particular is not implemented for VxWorks or LynxOS.
23864 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
23865 @anchor{gnat_rm/the_gnat_library id76}@anchor{359}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{35a}
23866 @section @cite{GNAT.Float_Control} (@code{g-flocon.ads})
23869 @geindex GNAT.Float_Control (g-flocon.ads)
23871 @geindex Floating-Point Processor
23873 Provides an interface for resetting the floating-point processor into the
23874 mode required for correct semantic operation in Ada.  Some third party
23875 library calls may cause this mode to be modified, and the Reset procedure
23876 in this package can be used to reestablish the required mode.
23878 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
23879 @anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{35b}@anchor{gnat_rm/the_gnat_library id77}@anchor{35c}
23880 @section @cite{GNAT.Formatted_String} (@code{g-forstr.ads})
23883 @geindex GNAT.Formatted_String (g-forstr.ads)
23885 @geindex Formatted String
23887 Provides support for C/C++ printf() formatted strings. The format is
23888 copied from the printf() routine and should therefore gives identical
23889 output. Some generic routines are provided to be able to use types
23890 derived from Integer, Float or enumerations as values for the
23891 formatted string.
23893 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
23894 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{35d}@anchor{gnat_rm/the_gnat_library id78}@anchor{35e}
23895 @section @cite{GNAT.Heap_Sort} (@code{g-heasor.ads})
23898 @geindex GNAT.Heap_Sort (g-heasor.ads)
23900 @geindex Sorting
23902 Provides a general implementation of heap sort usable for sorting arbitrary
23903 data items. Exchange and comparison procedures are provided by passing
23904 access-to-procedure values.  The algorithm used is a modified heap sort
23905 that performs approximately N*log(N) comparisons in the worst case.
23907 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
23908 @anchor{gnat_rm/the_gnat_library id79}@anchor{35f}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{360}
23909 @section @cite{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
23912 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
23914 @geindex Sorting
23916 Provides a general implementation of heap sort usable for sorting arbitrary
23917 data items. Move and comparison procedures are provided by passing
23918 access-to-procedure values.  The algorithm used is a modified heap sort
23919 that performs approximately N*log(N) comparisons in the worst case.
23920 This differs from @cite{GNAT.Heap_Sort} in having a less convenient
23921 interface, but may be slightly more efficient.
23923 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
23924 @anchor{gnat_rm/the_gnat_library id80}@anchor{361}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{362}
23925 @section @cite{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
23928 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
23930 @geindex Sorting
23932 Similar to @cite{Heap_Sort_A} except that the move and sorting procedures
23933 are provided as generic parameters, this improves efficiency, especially
23934 if the procedures can be inlined, at the expense of duplicating code for
23935 multiple instantiations.
23937 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
23938 @anchor{gnat_rm/the_gnat_library id81}@anchor{363}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{364}
23939 @section @cite{GNAT.HTable} (@code{g-htable.ads})
23942 @geindex GNAT.HTable (g-htable.ads)
23944 @geindex Hash tables
23946 A generic implementation of hash tables that can be used to hash arbitrary
23947 data.  Provides two approaches, one a simple static approach, and the other
23948 allowing arbitrary dynamic hash tables.
23950 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
23951 @anchor{gnat_rm/the_gnat_library id82}@anchor{365}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{366}
23952 @section @cite{GNAT.IO} (@code{g-io.ads})
23955 @geindex GNAT.IO (g-io.ads)
23957 @geindex Simple I/O
23959 @geindex Input/Output facilities
23961 A simple preelaborable input-output package that provides a subset of
23962 simple Text_IO functions for reading characters and strings from
23963 Standard_Input, and writing characters, strings and integers to either
23964 Standard_Output or Standard_Error.
23966 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
23967 @anchor{gnat_rm/the_gnat_library id83}@anchor{367}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{368}
23968 @section @cite{GNAT.IO_Aux} (@code{g-io_aux.ads})
23971 @geindex GNAT.IO_Aux (g-io_aux.ads)
23973 @geindex Text_IO
23975 @geindex Input/Output facilities
23977 Provides some auxiliary functions for use with Text_IO, including a test
23978 for whether a file exists, and functions for reading a line of text.
23980 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
23981 @anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{369}@anchor{gnat_rm/the_gnat_library id84}@anchor{36a}
23982 @section @cite{GNAT.Lock_Files} (@code{g-locfil.ads})
23985 @geindex GNAT.Lock_Files (g-locfil.ads)
23987 @geindex File locking
23989 @geindex Locking using files
23991 Provides a general interface for using files as locks.  Can be used for
23992 providing program level synchronization.
23994 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
23995 @anchor{gnat_rm/the_gnat_library id85}@anchor{36b}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{36c}
23996 @section @cite{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
23999 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24001 @geindex Random number generation
24003 The original implementation of @cite{Ada.Numerics.Discrete_Random}.  Uses
24004 a modified version of the Blum-Blum-Shub generator.
24006 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24007 @anchor{gnat_rm/the_gnat_library id86}@anchor{36d}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{36e}
24008 @section @cite{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24011 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24013 @geindex Random number generation
24015 The original implementation of @cite{Ada.Numerics.Float_Random}.  Uses
24016 a modified version of the Blum-Blum-Shub generator.
24018 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24019 @anchor{gnat_rm/the_gnat_library id87}@anchor{36f}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{370}
24020 @section @cite{GNAT.MD5} (@code{g-md5.ads})
24023 @geindex GNAT.MD5 (g-md5.ads)
24025 @geindex Message Digest MD5
24027 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24028 the HMAC-MD5 message authentication function as described in RFC 2104 and
24029 FIPS PUB 198.
24031 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24032 @anchor{gnat_rm/the_gnat_library id88}@anchor{371}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{372}
24033 @section @cite{GNAT.Memory_Dump} (@code{g-memdum.ads})
24036 @geindex GNAT.Memory_Dump (g-memdum.ads)
24038 @geindex Dump Memory
24040 Provides a convenient routine for dumping raw memory to either the
24041 standard output or standard error files. Uses GNAT.IO for actual
24042 output.
24044 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24045 @anchor{gnat_rm/the_gnat_library id89}@anchor{373}@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{374}
24046 @section @cite{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24049 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24051 @geindex Exception
24052 @geindex obtaining most recent
24054 Provides access to the most recently raised exception.  Can be used for
24055 various logging purposes, including duplicating functionality of some
24056 Ada 83 implementation dependent extensions.
24058 @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
24059 @anchor{gnat_rm/the_gnat_library id90}@anchor{375}@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{376}
24060 @section @cite{GNAT.OS_Lib} (@code{g-os_lib.ads})
24063 @geindex GNAT.OS_Lib (g-os_lib.ads)
24065 @geindex Operating System interface
24067 @geindex Spawn capability
24069 Provides a range of target independent operating system interface functions,
24070 including time/date management, file operations, subprocess management,
24071 including a portable spawn procedure, and access to environment variables
24072 and error return codes.
24074 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24075 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id91}@anchor{378}
24076 @section @cite{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24079 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24081 @geindex Hash functions
24083 Provides a generator of static minimal perfect hash functions. No
24084 collisions occur and each item can be retrieved from the table in one
24085 probe (perfect property). The hash table size corresponds to the exact
24086 size of the key set and no larger (minimal property). The key set has to
24087 be know in advance (static property). The hash functions are also order
24088 preserving. If w2 is inserted after w1 in the generator, their
24089 hashcode are in the same order. These hashing functions are very
24090 convenient for use with realtime applications.
24092 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24093 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{379}@anchor{gnat_rm/the_gnat_library id92}@anchor{37a}
24094 @section @cite{GNAT.Random_Numbers} (@code{g-rannum.ads})
24097 @geindex GNAT.Random_Numbers (g-rannum.ads)
24099 @geindex Random number generation
24101 Provides random number capabilities which extend those available in the
24102 standard Ada library and are more convenient to use.
24104 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24105 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{24c}@anchor{gnat_rm/the_gnat_library id93}@anchor{37b}
24106 @section @cite{GNAT.Regexp} (@code{g-regexp.ads})
24109 @geindex GNAT.Regexp (g-regexp.ads)
24111 @geindex Regular expressions
24113 @geindex Pattern matching
24115 A simple implementation of regular expressions, using a subset of regular
24116 expression syntax copied from familiar Unix style utilities.  This is the
24117 simplest of the three pattern matching packages provided, and is particularly
24118 suitable for 'file globbing' applications.
24120 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24121 @anchor{gnat_rm/the_gnat_library id94}@anchor{37c}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{37d}
24122 @section @cite{GNAT.Registry} (@code{g-regist.ads})
24125 @geindex GNAT.Registry (g-regist.ads)
24127 @geindex Windows Registry
24129 This is a high level binding to the Windows registry.  It is possible to
24130 do simple things like reading a key value, creating a new key.  For full
24131 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24132 package provided with the Win32Ada binding
24134 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24135 @anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{37e}@anchor{gnat_rm/the_gnat_library id95}@anchor{37f}
24136 @section @cite{GNAT.Regpat} (@code{g-regpat.ads})
24139 @geindex GNAT.Regpat (g-regpat.ads)
24141 @geindex Regular expressions
24143 @geindex Pattern matching
24145 A complete implementation of Unix-style regular expression matching, copied
24146 from the original V7 style regular expression library written in C by
24147 Henry Spencer (and binary compatible with this C library).
24149 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24150 @anchor{gnat_rm/the_gnat_library id96}@anchor{380}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{381}
24151 @section @cite{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24154 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24156 @geindex Rewrite data
24158 A unit to rewrite on-the-fly string occurrences in a stream of
24159 data. The implementation has a very minimal memory footprint as the
24160 full content to be processed is not loaded into memory all at once. This makes
24161 this interface usable for large files or socket streams.
24163 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24164 @anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{382}@anchor{gnat_rm/the_gnat_library id97}@anchor{383}
24165 @section @cite{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24168 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24170 @geindex Secondary Stack Info
24172 Provide the capability to query the high water mark of the current task's
24173 secondary stack.
24175 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24176 @anchor{gnat_rm/the_gnat_library id98}@anchor{384}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{385}
24177 @section @cite{GNAT.Semaphores} (@code{g-semaph.ads})
24180 @geindex GNAT.Semaphores (g-semaph.ads)
24182 @geindex Semaphores
24184 Provides classic counting and binary semaphores using protected types.
24186 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24187 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{386}@anchor{gnat_rm/the_gnat_library id99}@anchor{387}
24188 @section @cite{GNAT.Serial_Communications} (@code{g-sercom.ads})
24191 @geindex GNAT.Serial_Communications (g-sercom.ads)
24193 @geindex Serial_Communications
24195 Provides a simple interface to send and receive data over a serial
24196 port. This is only supported on GNU/Linux and Windows.
24198 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24199 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{388}@anchor{gnat_rm/the_gnat_library id100}@anchor{389}
24200 @section @cite{GNAT.SHA1} (@code{g-sha1.ads})
24203 @geindex GNAT.SHA1 (g-sha1.ads)
24205 @geindex Secure Hash Algorithm SHA-1
24207 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24208 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24209 in RFC 2104 and FIPS PUB 198.
24211 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24212 @anchor{gnat_rm/the_gnat_library id101}@anchor{38a}@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{38b}
24213 @section @cite{GNAT.SHA224} (@code{g-sha224.ads})
24216 @geindex GNAT.SHA224 (g-sha224.ads)
24218 @geindex Secure Hash Algorithm SHA-224
24220 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24221 and the HMAC-SHA224 message authentication function as described
24222 in RFC 2104 and FIPS PUB 198.
24224 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24225 @anchor{gnat_rm/the_gnat_library id102}@anchor{38c}@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{38d}
24226 @section @cite{GNAT.SHA256} (@code{g-sha256.ads})
24229 @geindex GNAT.SHA256 (g-sha256.ads)
24231 @geindex Secure Hash Algorithm SHA-256
24233 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24234 and the HMAC-SHA256 message authentication function as described
24235 in RFC 2104 and FIPS PUB 198.
24237 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24238 @anchor{gnat_rm/the_gnat_library id103}@anchor{38e}@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{38f}
24239 @section @cite{GNAT.SHA384} (@code{g-sha384.ads})
24242 @geindex GNAT.SHA384 (g-sha384.ads)
24244 @geindex Secure Hash Algorithm SHA-384
24246 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24247 and the HMAC-SHA384 message authentication function as described
24248 in RFC 2104 and FIPS PUB 198.
24250 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24251 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{390}@anchor{gnat_rm/the_gnat_library id104}@anchor{391}
24252 @section @cite{GNAT.SHA512} (@code{g-sha512.ads})
24255 @geindex GNAT.SHA512 (g-sha512.ads)
24257 @geindex Secure Hash Algorithm SHA-512
24259 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24260 and the HMAC-SHA512 message authentication function as described
24261 in RFC 2104 and FIPS PUB 198.
24263 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24264 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{392}@anchor{gnat_rm/the_gnat_library id105}@anchor{393}
24265 @section @cite{GNAT.Signals} (@code{g-signal.ads})
24268 @geindex GNAT.Signals (g-signal.ads)
24270 @geindex Signals
24272 Provides the ability to manipulate the blocked status of signals on supported
24273 targets.
24275 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24276 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{394}@anchor{gnat_rm/the_gnat_library id106}@anchor{395}
24277 @section @cite{GNAT.Sockets} (@code{g-socket.ads})
24280 @geindex GNAT.Sockets (g-socket.ads)
24282 @geindex Sockets
24284 A high level and portable interface to develop sockets based applications.
24285 This package is based on the sockets thin binding found in
24286 @cite{GNAT.Sockets.Thin}. Currently @cite{GNAT.Sockets} is implemented
24287 on all native GNAT ports and on VxWorks cross prots.  It is not implemented for
24288 the LynxOS cross port.
24290 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24291 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{396}@anchor{gnat_rm/the_gnat_library id107}@anchor{397}
24292 @section @cite{GNAT.Source_Info} (@code{g-souinf.ads})
24295 @geindex GNAT.Source_Info (g-souinf.ads)
24297 @geindex Source Information
24299 Provides subprograms that give access to source code information known at
24300 compile time, such as the current file name and line number. Also provides
24301 subprograms yielding the date and time of the current compilation (like the
24302 C macros @cite{__DATE__} and @cite{__TIME__})
24304 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24305 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{398}@anchor{gnat_rm/the_gnat_library id108}@anchor{399}
24306 @section @cite{GNAT.Spelling_Checker} (@code{g-speche.ads})
24309 @geindex GNAT.Spelling_Checker (g-speche.ads)
24311 @geindex Spell checking
24313 Provides a function for determining whether one string is a plausible
24314 near misspelling of another string.
24316 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24317 @anchor{gnat_rm/the_gnat_library id109}@anchor{39a}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{39b}
24318 @section @cite{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24321 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24323 @geindex Spell checking
24325 Provides a generic function that can be instantiated with a string type for
24326 determining whether one string is a plausible near misspelling of another
24327 string.
24329 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24330 @anchor{gnat_rm/the_gnat_library id110}@anchor{39c}@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{39d}
24331 @section @cite{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24334 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24336 @geindex SPITBOL pattern matching
24338 @geindex Pattern matching
24340 A complete implementation of SNOBOL4 style pattern matching.  This is the
24341 most elaborate of the pattern matching packages provided.  It fully duplicates
24342 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24343 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24345 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24346 @anchor{gnat_rm/the_gnat_library id111}@anchor{39e}@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{39f}
24347 @section @cite{GNAT.Spitbol} (@code{g-spitbo.ads})
24350 @geindex GNAT.Spitbol (g-spitbo.ads)
24352 @geindex SPITBOL interface
24354 The top level package of the collection of SPITBOL-style functionality, this
24355 package provides basic SNOBOL4 string manipulation functions, such as
24356 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24357 useful for constructing arbitrary mappings from strings in the style of
24358 the SNOBOL4 TABLE function.
24360 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24361 @anchor{gnat_rm/the_gnat_library id112}@anchor{3a0}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3a1}
24362 @section @cite{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24365 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24367 @geindex Sets of strings
24369 @geindex SPITBOL Tables
24371 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
24372 for type @cite{Standard.Boolean}, giving an implementation of sets of
24373 string values.
24375 @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
24376 @anchor{gnat_rm/the_gnat_library id113}@anchor{3a2}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3a3}
24377 @section @cite{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24380 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24382 @geindex Integer maps
24384 @geindex Maps
24386 @geindex SPITBOL Tables
24388 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table}
24389 for type @cite{Standard.Integer}, giving an implementation of maps
24390 from string to integer values.
24392 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24393 @anchor{gnat_rm/the_gnat_library id114}@anchor{3a4}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3a5}
24394 @section @cite{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24397 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24399 @geindex String maps
24401 @geindex Maps
24403 @geindex SPITBOL Tables
24405 A library level of instantiation of @cite{GNAT.Spitbol.Patterns.Table} for
24406 a variable length string type, giving an implementation of general
24407 maps from strings to strings.
24409 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24410 @anchor{gnat_rm/the_gnat_library id115}@anchor{3a6}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3a7}
24411 @section @cite{GNAT.SSE} (@code{g-sse.ads})
24414 @geindex GNAT.SSE (g-sse.ads)
24416 Root of a set of units aimed at offering Ada bindings to a subset of
24417 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24418 targets.  It exposes vector component types together with a general
24419 introduction to the binding contents and use.
24421 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24422 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3a8}@anchor{gnat_rm/the_gnat_library id116}@anchor{3a9}
24423 @section @cite{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
24426 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
24428 SSE vector types for use with SSE related intrinsics.
24430 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
24431 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id117}@anchor{3ab}
24432 @section @cite{GNAT.String_Hash} (@code{g-strhas.ads})
24435 @geindex GNAT.String_Hash (g-strhas.ads)
24437 @geindex Hash functions
24439 Provides a generic hash function working on arrays of scalars. Both the scalar
24440 type and the hash result type are parameters.
24442 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
24443 @anchor{gnat_rm/the_gnat_library id118}@anchor{3ac}@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3ad}
24444 @section @cite{GNAT.Strings} (@code{g-string.ads})
24447 @geindex GNAT.Strings (g-string.ads)
24449 Common String access types and related subprograms. Basically it
24450 defines a string access and an array of string access types.
24452 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
24453 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3ae}@anchor{gnat_rm/the_gnat_library id119}@anchor{3af}
24454 @section @cite{GNAT.String_Split} (@code{g-strspl.ads})
24457 @geindex GNAT.String_Split (g-strspl.ads)
24459 @geindex String splitter
24461 Useful string manipulation routines: given a set of separators, split
24462 a string wherever the separators appear, and provide direct access
24463 to the resulting slices. This package is instantiated from
24464 @cite{GNAT.Array_Split}.
24466 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
24467 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id120}@anchor{3b1}
24468 @section @cite{GNAT.Table} (@code{g-table.ads})
24471 @geindex GNAT.Table (g-table.ads)
24473 @geindex Table implementation
24475 @geindex Arrays
24476 @geindex extendable
24478 A generic package providing a single dimension array abstraction where the
24479 length of the array can be dynamically modified.
24481 This package provides a facility similar to that of @cite{GNAT.Dynamic_Tables},
24482 except that this package declares a single instance of the table type,
24483 while an instantiation of @cite{GNAT.Dynamic_Tables} creates a type that can be
24484 used to define dynamic instances of the table.
24486 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
24487 @anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id121}@anchor{3b3}
24488 @section @cite{GNAT.Task_Lock} (@code{g-tasloc.ads})
24491 @geindex GNAT.Task_Lock (g-tasloc.ads)
24493 @geindex Task synchronization
24495 @geindex Task locking
24497 @geindex Locking
24499 A very simple facility for locking and unlocking sections of code using a
24500 single global task lock.  Appropriate for use in situations where contention
24501 between tasks is very rarely expected.
24503 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
24504 @anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id122}@anchor{3b5}
24505 @section @cite{GNAT.Time_Stamp} (@code{g-timsta.ads})
24508 @geindex GNAT.Time_Stamp (g-timsta.ads)
24510 @geindex Time stamp
24512 @geindex Current time
24514 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
24515 represents the current date and time in ISO 8601 format. This is a very simple
24516 routine with minimal code and there are no dependencies on any other unit.
24518 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
24519 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3b6}@anchor{gnat_rm/the_gnat_library id123}@anchor{3b7}
24520 @section @cite{GNAT.Threads} (@code{g-thread.ads})
24523 @geindex GNAT.Threads (g-thread.ads)
24525 @geindex Foreign threads
24527 @geindex Threads
24528 @geindex foreign
24530 Provides facilities for dealing with foreign threads which need to be known
24531 by the GNAT run-time system. Consult the documentation of this package for
24532 further details if your program has threads that are created by a non-Ada
24533 environment which then accesses Ada code.
24535 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
24536 @anchor{gnat_rm/the_gnat_library id124}@anchor{3b8}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3b9}
24537 @section @cite{GNAT.Traceback} (@code{g-traceb.ads})
24540 @geindex GNAT.Traceback (g-traceb.ads)
24542 @geindex Trace back facilities
24544 Provides a facility for obtaining non-symbolic traceback information, useful
24545 in various debugging situations.
24547 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
24548 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3ba}@anchor{gnat_rm/the_gnat_library id125}@anchor{3bb}
24549 @section @cite{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
24552 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
24554 @geindex Trace back facilities
24556 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
24557 @anchor{gnat_rm/the_gnat_library id126}@anchor{3bc}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3bd}
24558 @section @cite{GNAT.UTF_32} (@code{g-table.ads})
24561 @geindex GNAT.UTF_32 (g-table.ads)
24563 @geindex Wide character codes
24565 This is a package intended to be used in conjunction with the
24566 @cite{Wide_Character} type in Ada 95 and the
24567 @cite{Wide_Wide_Character} type in Ada 2005 (available
24568 in @cite{GNAT} in Ada 2005 mode). This package contains
24569 Unicode categorization routines, as well as lexical
24570 categorization routines corresponding to the Ada 2005
24571 lexical rules for identifiers and strings, and also a
24572 lower case to upper case fold routine corresponding to
24573 the Ada 2005 rules for identifier equivalence.
24575 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
24576 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3be}@anchor{gnat_rm/the_gnat_library id127}@anchor{3bf}
24577 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
24580 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
24582 @geindex Spell checking
24584 Provides a function for determining whether one wide wide string is a plausible
24585 near misspelling of another wide wide string, where the strings are represented
24586 using the UTF_32_String type defined in System.Wch_Cnv.
24588 @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
24589 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id128}@anchor{3c1}
24590 @section @cite{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
24593 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
24595 @geindex Spell checking
24597 Provides a function for determining whether one wide string is a plausible
24598 near misspelling of another wide string.
24600 @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
24601 @anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id129}@anchor{3c3}
24602 @section @cite{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
24605 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
24607 @geindex Wide_String splitter
24609 Useful wide string manipulation routines: given a set of separators, split
24610 a wide string wherever the separators appear, and provide direct access
24611 to the resulting slices. This package is instantiated from
24612 @cite{GNAT.Array_Split}.
24614 @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
24615 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3c4}@anchor{gnat_rm/the_gnat_library id130}@anchor{3c5}
24616 @section @cite{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
24619 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
24621 @geindex Spell checking
24623 Provides a function for determining whether one wide wide string is a plausible
24624 near misspelling of another wide wide string.
24626 @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
24627 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3c6}@anchor{gnat_rm/the_gnat_library id131}@anchor{3c7}
24628 @section @cite{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
24631 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
24633 @geindex Wide_Wide_String splitter
24635 Useful wide wide string manipulation routines: given a set of separators, split
24636 a wide wide string wherever the separators appear, and provide direct access
24637 to the resulting slices. This package is instantiated from
24638 @cite{GNAT.Array_Split}.
24640 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
24641 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3c8}@anchor{gnat_rm/the_gnat_library id132}@anchor{3c9}
24642 @section @cite{Interfaces.C.Extensions} (@code{i-cexten.ads})
24645 @geindex Interfaces.C.Extensions (i-cexten.ads)
24647 This package contains additional C-related definitions, intended
24648 for use with either manually or automatically generated bindings
24649 to C libraries.
24651 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
24652 @anchor{gnat_rm/the_gnat_library id133}@anchor{3ca}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3cb}
24653 @section @cite{Interfaces.C.Streams} (@code{i-cstrea.ads})
24656 @geindex Interfaces.C.Streams (i-cstrea.ads)
24658 @geindex C streams
24659 @geindex interfacing
24661 This package is a binding for the most commonly used operations
24662 on C streams.
24664 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
24665 @anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3cc}@anchor{gnat_rm/the_gnat_library id134}@anchor{3cd}
24666 @section @cite{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
24669 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
24671 @geindex IBM Packed Format
24673 @geindex Packed Decimal
24675 This package provides a set of routines for conversions to and
24676 from a packed decimal format compatible with that used on IBM
24677 mainframes.
24679 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
24680 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3ce}@anchor{gnat_rm/the_gnat_library id135}@anchor{3cf}
24681 @section @cite{Interfaces.VxWorks} (@code{i-vxwork.ads})
24684 @geindex Interfaces.VxWorks (i-vxwork.ads)
24686 @geindex Interfacing to VxWorks
24688 @geindex VxWorks
24689 @geindex interfacing
24691 This package provides a limited binding to the VxWorks API.
24692 In particular, it interfaces with the
24693 VxWorks hardware interrupt facilities.
24695 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
24696 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3d0}@anchor{gnat_rm/the_gnat_library id136}@anchor{3d1}
24697 @section @cite{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
24700 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
24702 @geindex Interfacing to VxWorks
24704 @geindex VxWorks
24705 @geindex interfacing
24707 This package provides a way for users to replace the use of
24708 intConnect() with a custom routine for installing interrupt
24709 handlers.
24711 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
24712 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3d2}@anchor{gnat_rm/the_gnat_library id137}@anchor{3d3}
24713 @section @cite{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
24716 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
24718 @geindex Interfacing to VxWorks' I/O
24720 @geindex VxWorks
24721 @geindex I/O interfacing
24723 @geindex VxWorks
24724 @geindex Get_Immediate
24726 @geindex Get_Immediate
24727 @geindex VxWorks
24729 This package provides a binding to the ioctl (IO/Control)
24730 function of VxWorks, defining a set of option values and
24731 function codes. A particular use of this package is
24732 to enable the use of Get_Immediate under VxWorks.
24734 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
24735 @anchor{gnat_rm/the_gnat_library id138}@anchor{3d4}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3d5}
24736 @section @cite{System.Address_Image} (@code{s-addima.ads})
24739 @geindex System.Address_Image (s-addima.ads)
24741 @geindex Address image
24743 @geindex Image
24744 @geindex of an address
24746 This function provides a useful debugging
24747 function that gives an (implementation dependent)
24748 string which identifies an address.
24750 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
24751 @anchor{gnat_rm/the_gnat_library id139}@anchor{3d6}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3d7}
24752 @section @cite{System.Assertions} (@code{s-assert.ads})
24755 @geindex System.Assertions (s-assert.ads)
24757 @geindex Assertions
24759 @geindex Assert_Failure
24760 @geindex exception
24762 This package provides the declaration of the exception raised
24763 by an run-time assertion failure, as well as the routine that
24764 is used internally to raise this assertion.
24766 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
24767 @anchor{gnat_rm/the_gnat_library id140}@anchor{3d8}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3d9}
24768 @section @cite{System.Atomic_Counters} (@code{s-atocou.ads})
24771 @geindex System.Atomic_Counters (s-atocou.ads)
24773 This package provides the declaration of an atomic counter type,
24774 together with efficient routines (using hardware
24775 synchronization primitives) for incrementing, decrementing,
24776 and testing of these counters. This package is implemented
24777 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
24778 x86, and x86_64 platforms.
24780 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
24781 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3da}@anchor{gnat_rm/the_gnat_library id141}@anchor{3db}
24782 @section @cite{System.Memory} (@code{s-memory.ads})
24785 @geindex System.Memory (s-memory.ads)
24787 @geindex Memory allocation
24789 This package provides the interface to the low level routines used
24790 by the generated code for allocation and freeing storage for the
24791 default storage pool (analogous to the C routines malloc and free.
24792 It also provides a reallocation interface analogous to the C routine
24793 realloc. The body of this unit may be modified to provide alternative
24794 allocation mechanisms for the default pool, and in addition, direct
24795 calls to this unit may be made for low level allocation uses (for
24796 example see the body of @cite{GNAT.Tables}).
24798 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
24799 @anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3dc}@anchor{gnat_rm/the_gnat_library id142}@anchor{3dd}
24800 @section @cite{System.Multiprocessors} (@code{s-multip.ads})
24803 @geindex System.Multiprocessors (s-multip.ads)
24805 @geindex Multiprocessor interface
24807 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24808 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24809 technically an implementation-defined addition).
24811 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
24812 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3de}@anchor{gnat_rm/the_gnat_library id143}@anchor{3df}
24813 @section @cite{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
24816 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
24818 @geindex Multiprocessor interface
24820 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
24821 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
24822 technically an implementation-defined addition).
24824 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
24825 @anchor{gnat_rm/the_gnat_library id144}@anchor{3e0}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3e1}
24826 @section @cite{System.Partition_Interface} (@code{s-parint.ads})
24829 @geindex System.Partition_Interface (s-parint.ads)
24831 @geindex Partition interfacing functions
24833 This package provides facilities for partition interfacing.  It
24834 is used primarily in a distribution context when using Annex E
24835 with @cite{GLADE}.
24837 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
24838 @anchor{gnat_rm/the_gnat_library id145}@anchor{3e2}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3e3}
24839 @section @cite{System.Pool_Global} (@code{s-pooglo.ads})
24842 @geindex System.Pool_Global (s-pooglo.ads)
24844 @geindex Storage pool
24845 @geindex global
24847 @geindex Global storage pool
24849 This package provides a storage pool that is equivalent to the default
24850 storage pool used for access types for which no pool is specifically
24851 declared. It uses malloc/free to allocate/free and does not attempt to
24852 do any automatic reclamation.
24854 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
24855 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3e4}@anchor{gnat_rm/the_gnat_library id146}@anchor{3e5}
24856 @section @cite{System.Pool_Local} (@code{s-pooloc.ads})
24859 @geindex System.Pool_Local (s-pooloc.ads)
24861 @geindex Storage pool
24862 @geindex local
24864 @geindex Local storage pool
24866 This package provides a storage pool that is intended for use with locally
24867 defined access types. It uses malloc/free for allocate/free, and maintains
24868 a list of allocated blocks, so that all storage allocated for the pool can
24869 be freed automatically when the pool is finalized.
24871 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
24872 @anchor{gnat_rm/the_gnat_library id147}@anchor{3e6}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3e7}
24873 @section @cite{System.Restrictions} (@code{s-restri.ads})
24876 @geindex System.Restrictions (s-restri.ads)
24878 @geindex Run-time restrictions access
24880 This package provides facilities for accessing at run time
24881 the status of restrictions specified at compile time for
24882 the partition. Information is available both with regard
24883 to actual restrictions specified, and with regard to
24884 compiler determined information on which restrictions
24885 are violated by one or more packages in the partition.
24887 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
24888 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3e8}@anchor{gnat_rm/the_gnat_library id148}@anchor{3e9}
24889 @section @cite{System.Rident} (@code{s-rident.ads})
24892 @geindex System.Rident (s-rident.ads)
24894 @geindex Restrictions definitions
24896 This package provides definitions of the restrictions
24897 identifiers supported by GNAT, and also the format of
24898 the restrictions provided in package System.Restrictions.
24899 It is not normally necessary to @cite{with} this generic package
24900 since the necessary instantiation is included in
24901 package System.Restrictions.
24903 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
24904 @anchor{gnat_rm/the_gnat_library id149}@anchor{3ea}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3eb}
24905 @section @cite{System.Strings.Stream_Ops} (@code{s-ststop.ads})
24908 @geindex System.Strings.Stream_Ops (s-ststop.ads)
24910 @geindex Stream operations
24912 @geindex String stream operations
24914 This package provides a set of stream subprograms for standard string types.
24915 It is intended primarily to support implicit use of such subprograms when
24916 stream attributes are applied to string types, but the subprograms in this
24917 package can be used directly by application programs.
24919 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
24920 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3ec}@anchor{gnat_rm/the_gnat_library id150}@anchor{3ed}
24921 @section @cite{System.Unsigned_Types} (@code{s-unstyp.ads})
24924 @geindex System.Unsigned_Types (s-unstyp.ads)
24926 This package contains definitions of standard unsigned types that
24927 correspond in size to the standard signed types declared in Standard,
24928 and (unlike the types in Interfaces) have corresponding names. It
24929 also contains some related definitions for other specialized types
24930 used by the compiler in connection with packed array types.
24932 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
24933 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{3ee}@anchor{gnat_rm/the_gnat_library id151}@anchor{3ef}
24934 @section @cite{System.Wch_Cnv} (@code{s-wchcnv.ads})
24937 @geindex System.Wch_Cnv (s-wchcnv.ads)
24939 @geindex Wide Character
24940 @geindex Representation
24942 @geindex Wide String
24943 @geindex Conversion
24945 @geindex Representation of wide characters
24947 This package provides routines for converting between
24948 wide and wide wide characters and a representation as a value of type
24949 @cite{Standard.String}, using a specified wide character
24950 encoding method.  It uses definitions in
24951 package @cite{System.Wch_Con}.
24953 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
24954 @anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{3f0}@anchor{gnat_rm/the_gnat_library id152}@anchor{3f1}
24955 @section @cite{System.Wch_Con} (@code{s-wchcon.ads})
24958 @geindex System.Wch_Con (s-wchcon.ads)
24960 This package provides definitions and descriptions of
24961 the various methods used for encoding wide characters
24962 in ordinary strings.  These definitions are used by
24963 the package @cite{System.Wch_Cnv}.
24965 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
24966 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{3f2}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{3f3}
24967 @chapter Interfacing to Other Languages
24970 The facilities in Annex B of the Ada Reference Manual are fully
24971 implemented in GNAT, and in addition, a full interface to C++ is
24972 provided.
24974 @menu
24975 * Interfacing to C:: 
24976 * Interfacing to C++:: 
24977 * Interfacing to COBOL:: 
24978 * Interfacing to Fortran:: 
24979 * Interfacing to non-GNAT Ada code:: 
24981 @end menu
24983 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
24984 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{3f4}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{3f5}
24985 @section Interfacing to C
24988 Interfacing to C with GNAT can use one of two approaches:
24991 @itemize *
24993 @item 
24994 The types in the package @cite{Interfaces.C} may be used.
24996 @item 
24997 Standard Ada types may be used directly.  This may be less portable to
24998 other compilers, but will work on all GNAT compilers, which guarantee
24999 correspondence between the C and Ada types.
25000 @end itemize
25002 Pragma @cite{Convention C} may be applied to Ada types, but mostly has no
25003 effect, since this is the default.  The following table shows the
25004 correspondence between Ada scalar types and the corresponding C types.
25007 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
25008 @headitem
25010 Ada Type
25012 @tab
25014 C Type
25016 @item
25018 @code{Integer}
25020 @tab
25022 @code{int}
25024 @item
25026 @code{Short_Integer}
25028 @tab
25030 @code{short}
25032 @item
25034 @code{Short_Short_Integer}
25036 @tab
25038 @code{signed char}
25040 @item
25042 @code{Long_Integer}
25044 @tab
25046 @code{long}
25048 @item
25050 @code{Long_Long_Integer}
25052 @tab
25054 @code{long long}
25056 @item
25058 @code{Short_Float}
25060 @tab
25062 @code{float}
25064 @item
25066 @code{Float}
25068 @tab
25070 @code{float}
25072 @item
25074 @code{Long_Float}
25076 @tab
25078 @code{double}
25080 @item
25082 @code{Long_Long_Float}
25084 @tab
25086 This is the longest floating-point type supported by the hardware.
25088 @end multitable
25091 Additionally, there are the following general correspondences between Ada
25092 and C types:
25095 @itemize *
25097 @item 
25098 Ada enumeration types map to C enumeration types directly if pragma
25099 @cite{Convention C} is specified, which causes them to have int
25100 length.  Without pragma @cite{Convention C}, Ada enumeration types map to
25101 8, 16, or 32 bits (i.e., C types @cite{signed char}, @cite{short},
25102 @cite{int}, respectively) depending on the number of values passed.
25103 This is the only case in which pragma @cite{Convention C} affects the
25104 representation of an Ada type.
25106 @item 
25107 Ada access types map to C pointers, except for the case of pointers to
25108 unconstrained types in Ada, which have no direct C equivalent.
25110 @item 
25111 Ada arrays map directly to C arrays.
25113 @item 
25114 Ada records map directly to C structures.
25116 @item 
25117 Packed Ada records map to C structures where all members are bit fields
25118 of the length corresponding to the @code{type'Size} value in Ada.
25119 @end itemize
25121 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25122 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{3f6}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{45}
25123 @section Interfacing to C++
25126 The interface to C++ makes use of the following pragmas, which are
25127 primarily intended to be constructed automatically using a binding generator
25128 tool, although it is possible to construct them by hand.
25130 Using these pragmas it is possible to achieve complete
25131 inter-operability between Ada tagged types and C++ class definitions.
25132 See @ref{7,,Implementation Defined Pragmas}, for more details.
25135 @table @asis
25137 @item @emph{pragma CPP_Class ([Entity =>] `LOCAL_NAME`)}
25139 The argument denotes an entity in the current declarative region that is
25140 declared as a tagged or untagged record type. It indicates that the type
25141 corresponds to an externally declared C++ class type, and is to be laid
25142 out the same way that C++ would lay out the type.
25144 Note: Pragma @cite{CPP_Class} is currently obsolete. It is supported
25145 for backward compatibility but its functionality is available
25146 using pragma @cite{Import} with @cite{Convention} = @cite{CPP}.
25148 @item @emph{pragma CPP_Constructor ([Entity =>] `LOCAL_NAME`)}
25150 This pragma identifies an imported function (imported in the usual way
25151 with pragma @cite{Import}) as corresponding to a C++ constructor.
25152 @end table
25154 A few restrictions are placed on the use of the @cite{Access} attribute
25155 in conjunction with subprograms subject to convention @cite{CPP}: the
25156 attribute may be used neither on primitive operations of a tagged
25157 record type with convention @cite{CPP}, imported or not, nor on
25158 subprograms imported with pragma @cite{CPP_Constructor}.
25160 In addition, C++ exceptions are propagated and can be handled in an
25161 @cite{others} choice of an exception handler. The corresponding Ada
25162 occurrence has no message, and the simple name of the exception identity
25163 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25164 tasks works properly when such foreign exceptions are propagated.
25166 It is also possible to import a C++ exception using the following syntax:
25168 @example
25169 LOCAL_NAME : exception;
25170 pragma Import (Cpp,
25171   [Entity =>] LOCAL_NAME,
25172   [External_Name =>] static_string_EXPRESSION);
25173 @end example
25175 The @cite{External_Name} is the name of the C++ RTTI symbol. You can then
25176 cover a specific C++ exception in an exception handler.
25178 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25179 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{3f7}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{3f8}
25180 @section Interfacing to COBOL
25183 Interfacing to COBOL is achieved as described in section B.4 of
25184 the Ada Reference Manual.
25186 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25187 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{3f9}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{3fa}
25188 @section Interfacing to Fortran
25191 Interfacing to Fortran is achieved as described in section B.5 of the
25192 Ada Reference Manual.  The pragma @cite{Convention Fortran}, applied to a
25193 multi-dimensional array causes the array to be stored in column-major
25194 order as required for convenient interface to Fortran.
25196 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25197 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{3fb}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{3fc}
25198 @section Interfacing to non-GNAT Ada code
25201 It is possible to specify the convention @cite{Ada} in a pragma
25202 @cite{Import} or pragma @cite{Export}.  However this refers to
25203 the calling conventions used by GNAT, which may or may not be
25204 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25205 compiler to allow interoperation.
25207 If arguments types are kept simple, and if the foreign compiler generally
25208 follows system calling conventions, then it may be possible to integrate
25209 files compiled by other Ada compilers, provided that the elaboration
25210 issues are adequately addressed (for example by eliminating the
25211 need for any load time elaboration).
25213 In particular, GNAT running on VMS is designed to
25214 be highly compatible with the DEC Ada 83 compiler, so this is one
25215 case in which it is possible to import foreign units of this type,
25216 provided that the data items passed are restricted to simple scalar
25217 values or simple record types without variants, or simple array
25218 types with fixed bounds.
25220 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25221 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{3fd}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{3fe}
25222 @chapter Specialized Needs Annexes
25225 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25226 required in all implementations.  However, as described in this chapter,
25227 GNAT implements all of these annexes:
25230 @table @asis
25232 @item @emph{Systems Programming (Annex C)}
25234 The Systems Programming Annex is fully implemented.
25236 @item @emph{Real-Time Systems (Annex D)}
25238 The Real-Time Systems Annex is fully implemented.
25240 @item @emph{Distributed Systems (Annex E)}
25242 Stub generation is fully implemented in the GNAT compiler.  In addition,
25243 a complete compatible PCS is available as part of the GLADE system,
25244 a separate product.  When the two
25245 products are used in conjunction, this annex is fully implemented.
25247 @item @emph{Information Systems (Annex F)}
25249 The Information Systems annex is fully implemented.
25251 @item @emph{Numerics (Annex G)}
25253 The Numerics Annex is fully implemented.
25255 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25257 The Safety and Security Annex (termed the High-Integrity Systems Annex
25258 in Ada 2005) is fully implemented.
25259 @end table
25261 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25262 @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{3ff}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{400}
25263 @chapter Implementation of Specific Ada Features
25266 This chapter describes the GNAT implementation of several Ada language
25267 facilities.
25269 @menu
25270 * Machine Code Insertions:: 
25271 * GNAT Implementation of Tasking:: 
25272 * GNAT Implementation of Shared Passive Packages:: 
25273 * Code Generation for Array Aggregates:: 
25274 * The Size of Discriminated Records with Default Discriminants:: 
25275 * Strict Conformance to the Ada Reference Manual:: 
25277 @end menu
25279 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25280 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{160}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{401}
25281 @section Machine Code Insertions
25284 @geindex Machine Code insertions
25286 Package @cite{Machine_Code} provides machine code support as described
25287 in the Ada Reference Manual in two separate forms:
25290 @itemize *
25292 @item 
25293 Machine code statements, consisting of qualified expressions that
25294 fit the requirements of RM section 13.8.
25296 @item 
25297 An intrinsic callable procedure, providing an alternative mechanism of
25298 including machine instructions in a subprogram.
25299 @end itemize
25301 The two features are similar, and both are closely related to the mechanism
25302 provided by the asm instruction in the GNU C compiler.  Full understanding
25303 and use of the facilities in this package requires understanding the asm
25304 instruction, see the section on Extended Asm in
25305 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25307 Calls to the function @cite{Asm} and the procedure @cite{Asm} have identical
25308 semantic restrictions and effects as described below.  Both are provided so
25309 that the procedure call can be used as a statement, and the function call
25310 can be used to form a code_statement.
25312 Consider this C @cite{asm} instruction:
25314 @example
25315 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25316 @end example
25318 The equivalent can be written for GNAT as:
25320 @example
25321 Asm ("fsinx %1 %0",
25322      My_Float'Asm_Output ("=f", result),
25323      My_Float'Asm_Input  ("f",  angle));
25324 @end example
25326 The first argument to @cite{Asm} is the assembler template, and is
25327 identical to what is used in GNU C.  This string must be a static
25328 expression.  The second argument is the output operand list.  It is
25329 either a single @cite{Asm_Output} attribute reference, or a list of such
25330 references enclosed in parentheses (technically an array aggregate of
25331 such references).
25333 The @cite{Asm_Output} attribute denotes a function that takes two
25334 parameters.  The first is a string, the second is the name of a variable
25335 of the type designated by the attribute prefix.  The first (string)
25336 argument is required to be a static expression and designates the
25337 constraint (see the section on Constraints in
25338 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25339 for the parameter; e.g., what kind of register is required.  The second
25340 argument is the variable to be written or updated with the
25341 result.  The possible values for constraint are the same as those used in
25342 the RTL, and are dependent on the configuration file used to build the
25343 GCC back end.  If there are no output operands, then this argument may
25344 either be omitted, or explicitly given as @cite{No_Output_Operands}.
25345 No support is provided for GNU C's symbolic names for output parameters.
25347 The second argument of @code{my_float'Asm_Output} functions as
25348 though it were an @cite{out} parameter, which is a little curious, but
25349 all names have the form of expressions, so there is no syntactic
25350 irregularity, even though normally functions would not be permitted
25351 @cite{out} parameters.  The third argument is the list of input
25352 operands.  It is either a single @cite{Asm_Input} attribute reference, or
25353 a list of such references enclosed in parentheses (technically an array
25354 aggregate of such references).
25356 The @cite{Asm_Input} attribute denotes a function that takes two
25357 parameters.  The first is a string, the second is an expression of the
25358 type designated by the prefix.  The first (string) argument is required
25359 to be a static expression, and is the constraint for the parameter,
25360 (e.g., what kind of register is required).  The second argument is the
25361 value to be used as the input argument.  The possible values for the
25362 constraint are the same as those used in the RTL, and are dependent on
25363 the configuration file used to built the GCC back end.
25364 No support is provided for GNU C's symbolic names for input parameters.
25366 If there are no input operands, this argument may either be omitted, or
25367 explicitly given as @cite{No_Input_Operands}.  The fourth argument, not
25368 present in the above example, is a list of register names, called the
25369 @emph{clobber} argument.  This argument, if given, must be a static string
25370 expression, and is a space or comma separated list of names of registers
25371 that must be considered destroyed as a result of the @cite{Asm} call.  If
25372 this argument is the null string (the default value), then the code
25373 generator assumes that no additional registers are destroyed.
25374 In addition to registers, the special clobbers @cite{memory} and
25375 @cite{cc} as described in the GNU C docs are both supported.
25377 The fifth argument, not present in the above example, called the
25378 @emph{volatile} argument, is by default @cite{False}.  It can be set to
25379 the literal value @cite{True} to indicate to the code generator that all
25380 optimizations with respect to the instruction specified should be
25381 suppressed, and in particular an instruction that has outputs
25382 will still be generated, even if none of the outputs are
25383 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25384 for the full description.
25385 Generally it is strongly advisable to use Volatile for any ASM statement
25386 that is missing either input or output operands or to avoid unwanted
25387 optimizations. A warning is generated if this advice is not followed.
25389 No support is provided for GNU C's @cite{asm goto} feature.
25391 The @cite{Asm} subprograms may be used in two ways.  First the procedure
25392 forms can be used anywhere a procedure call would be valid, and
25393 correspond to what the RM calls 'intrinsic' routines.  Such calls can
25394 be used to intersperse machine instructions with other Ada statements.
25395 Second, the function forms, which return a dummy value of the limited
25396 private type @cite{Asm_Insn}, can be used in code statements, and indeed
25397 this is the only context where such calls are allowed.  Code statements
25398 appear as aggregates of the form:
25400 @example
25401 Asm_Insn'(Asm (...));
25402 Asm_Insn'(Asm_Volatile (...));
25403 @end example
25405 In accordance with RM rules, such code statements are allowed only
25406 within subprograms whose entire body consists of such statements.  It is
25407 not permissible to intermix such statements with other Ada statements.
25409 Typically the form using intrinsic procedure calls is more convenient
25410 and more flexible.  The code statement form is provided to meet the RM
25411 suggestion that such a facility should be made available.  The following
25412 is the exact syntax of the call to @cite{Asm}. As usual, if named notation
25413 is used, the arguments may be given in arbitrary order, following the
25414 normal rules for use of positional and named arguments:
25416 @example
25417 ASM_CALL ::= Asm (
25418                  [Template =>] static_string_EXPRESSION
25419                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
25420                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
25421                [,[Clobber  =>] static_string_EXPRESSION ]
25422                [,[Volatile =>] static_boolean_EXPRESSION] )
25424 OUTPUT_OPERAND_LIST ::=
25425   [PREFIX.]No_Output_Operands
25426 | OUTPUT_OPERAND_ATTRIBUTE
25427 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
25429 OUTPUT_OPERAND_ATTRIBUTE ::=
25430   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
25432 INPUT_OPERAND_LIST ::=
25433   [PREFIX.]No_Input_Operands
25434 | INPUT_OPERAND_ATTRIBUTE
25435 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
25437 INPUT_OPERAND_ATTRIBUTE ::=
25438   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
25439 @end example
25441 The identifiers @cite{No_Input_Operands} and @cite{No_Output_Operands}
25442 are declared in the package @cite{Machine_Code} and must be referenced
25443 according to normal visibility rules. In particular if there is no
25444 @cite{use} clause for this package, then appropriate package name
25445 qualification is required.
25447 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
25448 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{402}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{403}
25449 @section GNAT Implementation of Tasking
25452 This chapter outlines the basic GNAT approach to tasking (in particular,
25453 a multi-layered library for portability) and discusses issues related
25454 to compliance with the Real-Time Systems Annex.
25456 @menu
25457 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
25458 * Ensuring Compliance with the Real-Time Annex:: 
25459 * Support for Locking Policies:: 
25461 @end menu
25463 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
25464 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{404}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{405}
25465 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
25468 GNAT's run-time support comprises two layers:
25471 @itemize *
25473 @item 
25474 GNARL (GNAT Run-time Layer)
25476 @item 
25477 GNULL (GNAT Low-level Library)
25478 @end itemize
25480 In GNAT, Ada's tasking services rely on a platform and OS independent
25481 layer known as GNARL.  This code is responsible for implementing the
25482 correct semantics of Ada's task creation, rendezvous, protected
25483 operations etc.
25485 GNARL decomposes Ada's tasking semantics into simpler lower level
25486 operations such as create a thread, set the priority of a thread,
25487 yield, create a lock, lock/unlock, etc.  The spec for these low-level
25488 operations constitutes GNULLI, the GNULL Interface.  This interface is
25489 directly inspired from the POSIX real-time API.
25491 If the underlying executive or OS implements the POSIX standard
25492 faithfully, the GNULL Interface maps as is to the services offered by
25493 the underlying kernel.  Otherwise, some target dependent glue code maps
25494 the services offered by the underlying kernel to the semantics expected
25495 by GNARL.
25497 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
25498 key point is that each Ada task is mapped on a thread in the underlying
25499 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
25501 In addition Ada task priorities map onto the underlying thread priorities.
25502 Mapping Ada tasks onto the underlying kernel threads has several advantages:
25505 @itemize *
25507 @item 
25508 The underlying scheduler is used to schedule the Ada tasks.  This
25509 makes Ada tasks as efficient as kernel threads from a scheduling
25510 standpoint.
25512 @item 
25513 Interaction with code written in C containing threads is eased
25514 since at the lowest level Ada tasks and C threads map onto the same
25515 underlying kernel concept.
25517 @item 
25518 When an Ada task is blocked during I/O the remaining Ada tasks are
25519 able to proceed.
25521 @item 
25522 On multiprocessor systems Ada tasks can execute in parallel.
25523 @end itemize
25525 Some threads libraries offer a mechanism to fork a new process, with the
25526 child process duplicating the threads from the parent.
25527 GNAT does not
25528 support this functionality when the parent contains more than one task.
25530 @geindex Forking a new process
25532 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
25533 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{406}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{407}
25534 @subsection Ensuring Compliance with the Real-Time Annex
25537 @geindex Real-Time Systems Annex compliance
25539 Although mapping Ada tasks onto
25540 the underlying threads has significant advantages, it does create some
25541 complications when it comes to respecting the scheduling semantics
25542 specified in the real-time annex (Annex D).
25544 For instance the Annex D requirement for the @cite{FIFO_Within_Priorities}
25545 scheduling policy states:
25547 @quotation
25549 @emph{When the active priority of a ready task that is not running
25550 changes, or the setting of its base priority takes effect, the
25551 task is removed from the ready queue for its old active priority
25552 and is added at the tail of the ready queue for its new active
25553 priority, except in the case where the active priority is lowered
25554 due to the loss of inherited priority, in which case the task is
25555 added at the head of the ready queue for its new active priority.}
25556 @end quotation
25558 While most kernels do put tasks at the end of the priority queue when
25559 a task changes its priority, (which respects the main
25560 FIFO_Within_Priorities requirement), almost none keep a thread at the
25561 beginning of its priority queue when its priority drops from the loss
25562 of inherited priority.
25564 As a result most vendors have provided incomplete Annex D implementations.
25566 The GNAT run-time, has a nice cooperative solution to this problem
25567 which ensures that accurate FIFO_Within_Priorities semantics are
25568 respected.
25570 The principle is as follows.  When an Ada task T is about to start
25571 running, it checks whether some other Ada task R with the same
25572 priority as T has been suspended due to the loss of priority
25573 inheritance.  If this is the case, T yields and is placed at the end of
25574 its priority queue.  When R arrives at the front of the queue it
25575 executes.
25577 Note that this simple scheme preserves the relative order of the tasks
25578 that were ready to execute in the priority queue where R has been
25579 placed at the end.
25581 @c Support_for_Locking_Policies
25583 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
25584 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{408}
25585 @subsection Support for Locking Policies
25588 This section specifies which policies specified by pragma Locking_Policy
25589 are supported on which platforms.
25591 GNAT supports the standard @cite{Ceiling_Locking} policy, and the
25592 implementation defined @cite{Inheritance_Locking} and
25593 @cite{Concurrent_Readers_Locking} policies.
25595 @cite{Ceiling_Locking} is supported on all platforms if the operating system
25596 supports it. In particular, @cite{Ceiling_Locking} is not supported on
25597 VxWorks.
25598 @cite{Inheritance_Locking} is supported on
25599 Linux,
25600 Darwin (Mac OS X),
25601 LynxOS 178,
25602 and VxWorks.
25603 @cite{Concurrent_Readers_Locking} is supported on Linux.
25605 Note that on Linux, @cite{Ceiling_Locking} requires the program to be running
25606 with root privileges. Otherwise, the policy is ignored.
25608 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
25609 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{409}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{40a}
25610 @section GNAT Implementation of Shared Passive Packages
25613 @geindex Shared passive packages
25615 GNAT fully implements the 
25616 @geindex pragma Shared_Passive
25617 pragma
25618 @cite{Shared_Passive} for
25619 the purpose of designating shared passive packages.
25620 This allows the use of passive partitions in the
25621 context described in the Ada Reference Manual; i.e., for communication
25622 between separate partitions of a distributed application using the
25623 features in Annex E.
25625 @geindex Annex E
25627 @geindex Distribution Systems Annex
25629 However, the implementation approach used by GNAT provides for more
25630 extensive usage as follows:
25633 @table @asis
25635 @item @emph{Communication between separate programs}
25637 This allows separate programs to access the data in passive
25638 partitions, using protected objects for synchronization where
25639 needed. The only requirement is that the two programs have a
25640 common shared file system. It is even possible for programs
25641 running on different machines with different architectures
25642 (e.g., different endianness) to communicate via the data in
25643 a passive partition.
25645 @item @emph{Persistence between program runs}
25647 The data in a passive package can persist from one run of a
25648 program to another, so that a later program sees the final
25649 values stored by a previous run of the same program.
25650 @end table
25652 The implementation approach used is to store the data in files. A
25653 separate stream file is created for each object in the package, and
25654 an access to an object causes the corresponding file to be read or
25655 written.
25657 @geindex SHARED_MEMORY_DIRECTORY environment variable
25659 The environment variable @cite{SHARED_MEMORY_DIRECTORY} should be
25660 set to the directory to be used for these files.
25661 The files in this directory
25662 have names that correspond to their fully qualified names. For
25663 example, if we have the package
25665 @example
25666 package X is
25667   pragma Shared_Passive (X);
25668   Y : Integer;
25669   Z : Float;
25670 end X;
25671 @end example
25673 and the environment variable is set to @cite{/stemp/}, then the files created
25674 will have the names:
25676 @example
25677 /stemp/x.y
25678 /stemp/x.z
25679 @end example
25681 These files are created when a value is initially written to the object, and
25682 the files are retained until manually deleted. This provides the persistence
25683 semantics. If no file exists, it means that no partition has assigned a value
25684 to the variable; in this case the initial value declared in the package
25685 will be used. This model ensures that there are no issues in synchronizing
25686 the elaboration process, since elaboration of passive packages elaborates the
25687 initial values, but does not create the files.
25689 The files are written using normal @cite{Stream_IO} access.
25690 If you want to be able
25691 to communicate between programs or partitions running on different
25692 architectures, then you should use the XDR versions of the stream attribute
25693 routines, since these are architecture independent.
25695 If active synchronization is required for access to the variables in the
25696 shared passive package, then as described in the Ada Reference Manual, the
25697 package may contain protected objects used for this purpose. In this case
25698 a lock file (whose name is @code{___lock} (three underscores)
25699 is created in the shared memory directory.
25701 @geindex ___lock file (for shared passive packages)
25703 This is used to provide the required locking
25704 semantics for proper protected object synchronization.
25706 GNAT supports shared passive packages on all platforms
25707 except for OpenVMS.
25709 @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
25710 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{40b}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{40c}
25711 @section Code Generation for Array Aggregates
25714 Aggregates have a rich syntax and allow the user to specify the values of
25715 complex data structures by means of a single construct.  As a result, the
25716 code generated for aggregates can be quite complex and involve loops, case
25717 statements and multiple assignments.  In the simplest cases, however, the
25718 compiler will recognize aggregates whose components and constraints are
25719 fully static, and in those cases the compiler will generate little or no
25720 executable code.  The following is an outline of the code that GNAT generates
25721 for various aggregate constructs.  For further details, you will find it
25722 useful to examine the output produced by the -gnatG flag to see the expanded
25723 source that is input to the code generator.  You may also want to examine
25724 the assembly code generated at various levels of optimization.
25726 The code generated for aggregates depends on the context, the component values,
25727 and the type.  In the context of an object declaration the code generated is
25728 generally simpler than in the case of an assignment.  As a general rule, static
25729 component values and static subtypes also lead to simpler code.
25731 @menu
25732 * Static constant aggregates with static bounds:: 
25733 * Constant aggregates with unconstrained nominal types:: 
25734 * Aggregates with static bounds:: 
25735 * Aggregates with nonstatic bounds:: 
25736 * Aggregates in assignment statements:: 
25738 @end menu
25740 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
25741 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{40d}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{40e}
25742 @subsection Static constant aggregates with static bounds
25745 For the declarations:
25747 @example
25748 type One_Dim is array (1..10) of integer;
25749 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
25750 @end example
25752 GNAT generates no executable code: the constant ar0 is placed in static memory.
25753 The same is true for constant aggregates with named associations:
25755 @example
25756 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
25757 Cr3 : constant One_Dim := (others => 7777);
25758 @end example
25760 The same is true for multidimensional constant arrays such as:
25762 @example
25763 type two_dim is array (1..3, 1..3) of integer;
25764 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
25765 @end example
25767 The same is true for arrays of one-dimensional arrays: the following are
25768 static:
25770 @example
25771 type ar1b  is array (1..3) of boolean;
25772 type ar_ar is array (1..3) of ar1b;
25773 None  : constant ar1b := (others => false);     --  fully static
25774 None2 : constant ar_ar := (1..3 => None);       --  fully static
25775 @end example
25777 However, for multidimensional aggregates with named associations, GNAT will
25778 generate assignments and loops, even if all associations are static.  The
25779 following two declarations generate a loop for the first dimension, and
25780 individual component assignments for the second dimension:
25782 @example
25783 Zero1: constant two_dim := (1..3 => (1..3 => 0));
25784 Zero2: constant two_dim := (others => (others => 0));
25785 @end example
25787 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
25788 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{40f}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{410}
25789 @subsection Constant aggregates with unconstrained nominal types
25792 In such cases the aggregate itself establishes the subtype, so that
25793 associations with @cite{others} cannot be used.  GNAT determines the
25794 bounds for the actual subtype of the aggregate, and allocates the
25795 aggregate statically as well.  No code is generated for the following:
25797 @example
25798 type One_Unc is array (natural range <>) of integer;
25799 Cr_Unc : constant One_Unc := (12,24,36);
25800 @end example
25802 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
25803 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{411}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{412}
25804 @subsection Aggregates with static bounds
25807 In all previous examples the aggregate was the initial (and immutable) value
25808 of a constant.  If the aggregate initializes a variable, then code is generated
25809 for it as a combination of individual assignments and loops over the target
25810 object.  The declarations
25812 @example
25813 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
25814 Cr_Var2 : One_Dim := (others > -1);
25815 @end example
25817 generate the equivalent of
25819 @example
25820 Cr_Var1 (1) := 2;
25821 Cr_Var1 (2) := 3;
25822 Cr_Var1 (3) := 5;
25823 Cr_Var1 (4) := 11;
25825 for I in Cr_Var2'range loop
25826    Cr_Var2 (I) := -1;
25827 end loop;
25828 @end example
25830 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
25831 @anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{413}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{414}
25832 @subsection Aggregates with nonstatic bounds
25835 If the bounds of the aggregate are not statically compatible with the bounds
25836 of the nominal subtype  of the target, then constraint checks have to be
25837 generated on the bounds.  For a multidimensional array, constraint checks may
25838 have to be applied to sub-arrays individually, if they do not have statically
25839 compatible subtypes.
25841 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
25842 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{415}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{416}
25843 @subsection Aggregates in assignment statements
25846 In general, aggregate assignment requires the construction of a temporary,
25847 and a copy from the temporary to the target of the assignment.  This is because
25848 it is not always possible to convert the assignment into a series of individual
25849 component assignments.  For example, consider the simple case:
25851 @example
25852 A := (A(2), A(1));
25853 @end example
25855 This cannot be converted into:
25857 @example
25858 A(1) := A(2);
25859 A(2) := A(1);
25860 @end example
25862 So the aggregate has to be built first in a separate location, and then
25863 copied into the target.  GNAT recognizes simple cases where this intermediate
25864 step is not required, and the assignments can be performed in place, directly
25865 into the target.  The following sufficient criteria are applied:
25868 @itemize *
25870 @item 
25871 The bounds of the aggregate are static, and the associations are static.
25873 @item 
25874 The components of the aggregate are static constants, names of
25875 simple variables that are not renamings, or expressions not involving
25876 indexed components whose operands obey these rules.
25877 @end itemize
25879 If any of these conditions are violated, the aggregate will be built in
25880 a temporary (created either by the front-end or the code generator) and then
25881 that temporary will be copied onto the target.
25883 @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
25884 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{417}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{418}
25885 @section The Size of Discriminated Records with Default Discriminants
25888 If a discriminated type @cite{T} has discriminants with default values, it is
25889 possible to declare an object of this type without providing an explicit
25890 constraint:
25892 @example
25893 type Size is range 1..100;
25895 type Rec (D : Size := 15) is record
25896    Name : String (1..D);
25897 end T;
25899 Word : Rec;
25900 @end example
25902 Such an object is said to be @emph{unconstrained}.
25903 The discriminant of the object
25904 can be modified by a full assignment to the object, as long as it preserves the
25905 relation between the value of the discriminant, and the value of the components
25906 that depend on it:
25908 @example
25909 Word := (3, "yes");
25911 Word := (5, "maybe");
25913 Word := (5, "no"); -- raises Constraint_Error
25914 @end example
25916 In order to support this behavior efficiently, an unconstrained object is
25917 given the maximum size that any value of the type requires. In the case
25918 above, @cite{Word} has storage for the discriminant and for
25919 a @cite{String} of length 100.
25920 It is important to note that unconstrained objects do not require dynamic
25921 allocation. It would be an improper implementation to place on the heap those
25922 components whose size depends on discriminants. (This improper implementation
25923 was used by some Ada83 compilers, where the @cite{Name} component above
25924 would have
25925 been stored as a pointer to a dynamic string). Following the principle that
25926 dynamic storage management should never be introduced implicitly,
25927 an Ada compiler should reserve the full size for an unconstrained declared
25928 object, and place it on the stack.
25930 This maximum size approach
25931 has been a source of surprise to some users, who expect the default
25932 values of the discriminants to determine the size reserved for an
25933 unconstrained object: "If the default is 15, why should the object occupy
25934 a larger size?"
25935 The answer, of course, is that the discriminant may be later modified,
25936 and its full range of values must be taken into account. This is why the
25937 declaration:
25939 @example
25940 type Rec (D : Positive := 15) is record
25941    Name : String (1..D);
25942 end record;
25944 Too_Large : Rec;
25945 @end example
25947 is flagged by the compiler with a warning:
25948 an attempt to create @cite{Too_Large} will raise @cite{Storage_Error},
25949 because the required size includes @cite{Positive'Last}
25950 bytes. As the first example indicates, the proper approach is to declare an
25951 index type of 'reasonable' range so that unconstrained objects are not too
25952 large.
25954 One final wrinkle: if the object is declared to be @cite{aliased}, or if it is
25955 created in the heap by means of an allocator, then it is @emph{not}
25956 unconstrained:
25957 it is constrained by the default values of the discriminants, and those values
25958 cannot be modified by full assignment. This is because in the presence of
25959 aliasing all views of the object (which may be manipulated by different tasks,
25960 say) must be consistent, so it is imperative that the object, once created,
25961 remain invariant.
25963 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
25964 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{419}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{41a}
25965 @section Strict Conformance to the Ada Reference Manual
25968 The dynamic semantics defined by the Ada Reference Manual impose a set of
25969 run-time checks to be generated. By default, the GNAT compiler will insert many
25970 run-time checks into the compiled code, including most of those required by the
25971 Ada Reference Manual. However, there are two checks that are not enabled in
25972 the default mode for efficiency reasons: checks for access before elaboration
25973 on subprogram calls, and stack overflow checking (most operating systems do not
25974 perform this check by default).
25976 Strict conformance to the Ada Reference Manual can be achieved by adding two
25977 compiler options for dynamic checks for access-before-elaboration on subprogram
25978 calls and generic instantiations (@emph{-gnatE}), and stack overflow checking
25979 (@emph{-fstack-check}).
25981 Note that the result of a floating point arithmetic operation in overflow and
25982 invalid situations, when the @cite{Machine_Overflows} attribute of the result
25983 type is @cite{False}, is to generate IEEE NaN and infinite values. This is the
25984 case for machines compliant with the IEEE floating-point standard, but on
25985 machines that are not fully compliant with this standard, such as Alpha, the
25986 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
25987 behavior (although at the cost of a significant performance penalty), so
25988 infinite and NaN values are properly generated.
25990 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
25991 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{41b}@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{41c}
25992 @chapter Implementation of Ada 2012 Features
25995 @geindex Ada 2012 implementation status
25997 @geindex -gnat12 option (gcc)
25999 @geindex pragma Ada_2012
26001 @geindex configuration pragma Ada_2012
26003 @geindex Ada_2012 configuration pragma
26005 This chapter contains a complete list of Ada 2012 features that have been
26006 implemented.
26007 Generally, these features are only
26008 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
26009 which is the default behavior,
26010 or if the configuration pragma @cite{Ada_2012} is used.
26012 However, new pragmas, attributes, and restrictions are
26013 unconditionally available, since the Ada 95 standard allows the addition of
26014 new pragmas, attributes, and restrictions (there are exceptions, which are
26015 documented in the individual descriptions), and also certain packages
26016 were made available in earlier versions of Ada.
26018 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26019 This date shows the implementation date of the feature. Any wavefront
26020 subsequent to this date will contain the indicated feature, as will any
26021 subsequent releases. A date of 0000-00-00 means that GNAT has always
26022 implemented the feature, or implemented it as soon as it appeared as a
26023 binding interpretation.
26025 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
26026 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26027 The features are ordered based on the relevant sections of the Ada
26028 Reference Manual ("RM").  When a given AI relates to multiple points
26029 in the RM, the earliest is used.
26031 A complete description of the AIs may be found in
26032 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26034 @geindex AI-0176 (Ada 2012 feature)
26037 @itemize *
26039 @item 
26040 @emph{AI-0176 Quantified expressions (2010-09-29)}
26042 Both universally and existentially quantified expressions are implemented.
26043 They use the new syntax for iterators proposed in AI05-139-2, as well as
26044 the standard Ada loop syntax.
26046 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
26047 @end itemize
26049 @geindex AI-0079 (Ada 2012 feature)
26052 @itemize *
26054 @item 
26055 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
26057 Wide characters in the unicode category @emph{other_format} are now allowed in
26058 source programs between tokens, but not within a token such as an identifier.
26060 RM References:  2.01 (4/2)   2.02 (7)
26061 @end itemize
26063 @geindex AI-0091 (Ada 2012 feature)
26066 @itemize *
26068 @item 
26069 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
26071 Wide characters in the unicode category @emph{other_format} are not permitted
26072 within  an identifier, since this can be a security problem. The error
26073 message for this case has been improved to be more specific, but GNAT has
26074 never allowed such characters to appear in identifiers.
26076 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)
26077 @end itemize
26079 @geindex AI-0100 (Ada 2012 feature)
26082 @itemize *
26084 @item 
26085 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
26087 This AI is an earlier version of AI-163. It simplifies the rules
26088 for legal placement of pragmas. In the case of lists that allow pragmas, if
26089 the list may have no elements, then the list may consist solely of pragmas.
26091 RM References:  2.08 (7)
26092 @end itemize
26094 @geindex AI-0163 (Ada 2012 feature)
26097 @itemize *
26099 @item 
26100 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
26102 A statement sequence may be composed entirely of pragmas. It is no longer
26103 necessary to add a dummy @cite{null} statement to make the sequence legal.
26105 RM References:  2.08 (7)   2.08 (16)
26106 @end itemize
26108 @geindex AI-0080 (Ada 2012 feature)
26111 @itemize *
26113 @item 
26114 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
26116 This is an editorial change only, described as non-testable in the AI.
26118 RM References:  3.01 (7)
26119 @end itemize
26121 @geindex AI-0183 (Ada 2012 feature)
26124 @itemize *
26126 @item 
26127 @emph{AI-0183 Aspect specifications (2010-08-16)}
26129 Aspect specifications have been fully implemented except for pre and post-
26130 conditions, and type invariants, which have their own separate AI's. All
26131 forms of declarations listed in the AI are supported. The following is a
26132 list of the aspects supported (with GNAT implementation aspects marked)
26133 @end itemize
26136 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
26137 @headitem
26139 Supported Aspect
26141 @tab
26143 Source
26145 @item
26147 @cite{Ada_2005}
26149 @tab
26151 -- GNAT
26153 @item
26155 @cite{Ada_2012}
26157 @tab
26159 -- GNAT
26161 @item
26163 @cite{Address}
26165 @tab
26167 @item
26169 @cite{Alignment}
26171 @tab
26173 @item
26175 @cite{Atomic}
26177 @tab
26179 @item
26181 @cite{Atomic_Components}
26183 @tab
26185 @item
26187 @cite{Bit_Order}
26189 @tab
26191 @item
26193 @cite{Component_Size}
26195 @tab
26197 @item
26199 @cite{Contract_Cases}
26201 @tab
26203 -- GNAT
26205 @item
26207 @cite{Discard_Names}
26209 @tab
26211 @item
26213 @cite{External_Tag}
26215 @tab
26217 @item
26219 @cite{Favor_Top_Level}
26221 @tab
26223 -- GNAT
26225 @item
26227 @cite{Inline}
26229 @tab
26231 @item
26233 @cite{Inline_Always}
26235 @tab
26237 -- GNAT
26239 @item
26241 @cite{Invariant}
26243 @tab
26245 -- GNAT
26247 @item
26249 @cite{Machine_Radix}
26251 @tab
26253 @item
26255 @cite{No_Return}
26257 @tab
26259 @item
26261 @cite{Object_Size}
26263 @tab
26265 -- GNAT
26267 @item
26269 @cite{Pack}
26271 @tab
26273 @item
26275 @cite{Persistent_BSS}
26277 @tab
26279 -- GNAT
26281 @item
26283 @cite{Post}
26285 @tab
26287 @item
26289 @cite{Pre}
26291 @tab
26293 @item
26295 @cite{Predicate}
26297 @tab
26299 @item
26301 @cite{Preelaborable_Initialization}
26303 @tab
26305 @item
26307 @cite{Pure_Function}
26309 @tab
26311 -- GNAT
26313 @item
26315 @cite{Remote_Access_Type}
26317 @tab
26319 -- GNAT
26321 @item
26323 @cite{Shared}
26325 @tab
26327 -- GNAT
26329 @item
26331 @cite{Size}
26333 @tab
26335 @item
26337 @cite{Storage_Pool}
26339 @tab
26341 @item
26343 @cite{Storage_Size}
26345 @tab
26347 @item
26349 @cite{Stream_Size}
26351 @tab
26353 @item
26355 @cite{Suppress}
26357 @tab
26359 @item
26361 @cite{Suppress_Debug_Info}
26363 @tab
26365 -- GNAT
26367 @item
26369 @cite{Test_Case}
26371 @tab
26373 -- GNAT
26375 @item
26377 @cite{Thread_Local_Storage}
26379 @tab
26381 -- GNAT
26383 @item
26385 @cite{Type_Invariant}
26387 @tab
26389 @item
26391 @cite{Unchecked_Union}
26393 @tab
26395 @item
26397 @cite{Universal_Aliasing}
26399 @tab
26401 -- GNAT
26403 @item
26405 @cite{Unmodified}
26407 @tab
26409 -- GNAT
26411 @item
26413 @cite{Unreferenced}
26415 @tab
26417 -- GNAT
26419 @item
26421 @cite{Unreferenced_Objects}
26423 @tab
26425 -- GNAT
26427 @item
26429 @cite{Unsuppress}
26431 @tab
26433 @item
26435 @cite{Value_Size}
26437 @tab
26439 -- GNAT
26441 @item
26443 @cite{Volatile}
26445 @tab
26447 @item
26449 @cite{Volatile_Components}
26451 @tab
26453 @item
26455 @cite{Warnings}
26457 @tab
26459 -- GNAT
26461 @end multitable
26464 @quotation
26466 Note that for aspects with an expression, e.g. @cite{Size}, the expression is
26467 treated like a default expression (visibility is analyzed at the point of
26468 occurrence of the aspect, but evaluation of the expression occurs at the
26469 freeze point of the entity involved).
26471 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
26472 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
26473 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
26474 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
26475 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
26476 13.03.01 (0)
26477 @end quotation
26479 @geindex AI-0128 (Ada 2012 feature)
26482 @itemize *
26484 @item 
26485 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
26487 If an equality operator ("=") is declared for a type, then the implicitly
26488 declared inequality operator ("/=") is a primitive operation of the type.
26489 This is the only reasonable interpretation, and is the one always implemented
26490 by GNAT, but the RM was not entirely clear in making this point.
26492 RM References:  3.02.03 (6)   6.06 (6)
26493 @end itemize
26495 @geindex AI-0003 (Ada 2012 feature)
26498 @itemize *
26500 @item 
26501 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
26503 In Ada 2012, a qualified expression is considered to be syntactically a name,
26504 meaning that constructs such as @cite{A'(F(X)).B} are now legal. This is
26505 useful in disambiguating some cases of overloading.
26507 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
26508 5.04 (7)
26509 @end itemize
26511 @geindex AI-0120 (Ada 2012 feature)
26514 @itemize *
26516 @item 
26517 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
26519 This is an RM editorial change only. The section that lists objects that are
26520 constant failed to include the current instance of a protected object
26521 within a protected function. This has always been treated as a constant
26522 in GNAT.
26524 RM References:  3.03 (21)
26525 @end itemize
26527 @geindex AI-0008 (Ada 2012 feature)
26530 @itemize *
26532 @item 
26533 @emph{AI-0008 General access to constrained objects (0000-00-00)}
26535 The wording in the RM implied that if you have a general access to a
26536 constrained object, it could be used to modify the discriminants. This was
26537 obviously not intended. @cite{Constraint_Error} should be raised, and GNAT
26538 has always done so in this situation.
26540 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
26541 @end itemize
26543 @geindex AI-0093 (Ada 2012 feature)
26546 @itemize *
26548 @item 
26549 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
26551 This is an editorial change only, to make more widespread use of the Ada 2012
26552 'immutably limited'.
26554 RM References:  3.03 (23.4/3)
26555 @end itemize
26557 @geindex AI-0096 (Ada 2012 feature)
26560 @itemize *
26562 @item 
26563 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
26565 In general it is illegal for a type derived from a formal limited type to be
26566 nonlimited.  This AI makes an exception to this rule: derivation is legal
26567 if it appears in the private part of the generic, and the formal type is not
26568 tagged. If the type is tagged, the legality check must be applied to the
26569 private part of the package.
26571 RM References:  3.04 (5.1/2)   6.02 (7)
26572 @end itemize
26574 @geindex AI-0181 (Ada 2012 feature)
26577 @itemize *
26579 @item 
26580 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
26582 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
26583 means that it has a special name (@cite{SOFT_HYPHEN}) in conjunction with the
26584 @cite{Image} and @cite{Value} attributes for the character types. Strictly
26585 speaking this is an inconsistency with Ada 95, but in practice the use of
26586 these attributes is so obscure that it will not cause problems.
26588 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
26589 @end itemize
26591 @geindex AI-0182 (Ada 2012 feature)
26594 @itemize *
26596 @item 
26597 @emph{AI-0182 Additional forms for `Character'Value} (0000-00-00)`
26599 This AI allows @cite{Character'Value} to accept the string @cite{'?'} where
26600 @cite{?} is any character including non-graphic control characters. GNAT has
26601 always accepted such strings. It also allows strings such as
26602 @cite{HEX_00000041} to be accepted, but GNAT does not take advantage of this
26603 permission and raises @cite{Constraint_Error}, as is certainly still
26604 permitted.
26606 RM References:  3.05 (56/2)
26607 @end itemize
26609 @geindex AI-0214 (Ada 2012 feature)
26612 @itemize *
26614 @item 
26615 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
26617 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
26618 to have default expressions by allowing them when the type is limited. It
26619 is often useful to define a default value for a discriminant even though
26620 it can't be changed by assignment.
26622 RM References:  3.07 (9.1/2)   3.07.02 (3)
26623 @end itemize
26625 @geindex AI-0102 (Ada 2012 feature)
26628 @itemize *
26630 @item 
26631 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
26633 It is illegal to assign an anonymous access constant to an anonymous access
26634 variable. The RM did not have a clear rule to prevent this, but GNAT has
26635 always generated an error for this usage.
26637 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
26638 @end itemize
26640 @geindex AI-0158 (Ada 2012 feature)
26643 @itemize *
26645 @item 
26646 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
26648 This AI extends the syntax of membership tests to simplify complex conditions
26649 that can be expressed as membership in a subset of values of any type. It
26650 introduces syntax for a list of expressions that may be used in loop contexts
26651 as well.
26653 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
26654 @end itemize
26656 @geindex AI-0173 (Ada 2012 feature)
26659 @itemize *
26661 @item 
26662 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
26664 The function @cite{Ada.Tags.Type_Is_Abstract} returns @cite{True} if invoked
26665 with the tag of an abstract type, and @cite{False} otherwise.
26667 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
26668 @end itemize
26670 @geindex AI-0076 (Ada 2012 feature)
26673 @itemize *
26675 @item 
26676 @emph{AI-0076 function with controlling result (0000-00-00)}
26678 This is an editorial change only. The RM defines calls with controlling
26679 results, but uses the term 'function with controlling result' without an
26680 explicit definition.
26682 RM References:  3.09.02 (2/2)
26683 @end itemize
26685 @geindex AI-0126 (Ada 2012 feature)
26688 @itemize *
26690 @item 
26691 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
26693 This AI clarifies dispatching rules, and simply confirms that dispatching
26694 executes the operation of the parent type when there is no explicitly or
26695 implicitly declared operation for the descendant type. This has always been
26696 the case in all versions of GNAT.
26698 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
26699 @end itemize
26701 @geindex AI-0097 (Ada 2012 feature)
26704 @itemize *
26706 @item 
26707 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
26709 The RM as written implied that in some cases it was possible to create an
26710 object of an abstract type, by having an abstract extension inherit a non-
26711 abstract constructor from its parent type. This mistake has been corrected
26712 in GNAT and in the RM, and this construct is now illegal.
26714 RM References:  3.09.03 (4/2)
26715 @end itemize
26717 @geindex AI-0203 (Ada 2012 feature)
26720 @itemize *
26722 @item 
26723 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
26725 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
26726 permitted such usage.
26728 RM References:  3.09.03 (8/3)
26729 @end itemize
26731 @geindex AI-0198 (Ada 2012 feature)
26734 @itemize *
26736 @item 
26737 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
26739 This AI resolves a conflict between two rules involving inherited abstract
26740 operations and predefined operators. If a derived numeric type inherits
26741 an abstract operator, it overrides the predefined one. This interpretation
26742 was always the one implemented in GNAT.
26744 RM References:  3.09.03 (4/3)
26745 @end itemize
26747 @geindex AI-0073 (Ada 2012 feature)
26750 @itemize *
26752 @item 
26753 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
26755 This AI covers a number of issues regarding returning abstract types. In
26756 particular generic functions cannot have abstract result types or access
26757 result types designated an abstract type. There are some other cases which
26758 are detailed in the AI. Note that this binding interpretation has not been
26759 retrofitted to operate before Ada 2012 mode, since it caused a significant
26760 number of regressions.
26762 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
26763 @end itemize
26765 @geindex AI-0070 (Ada 2012 feature)
26768 @itemize *
26770 @item 
26771 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
26773 This is an editorial change only, there are no testable consequences short of
26774 checking for the absence of generated code for an interface declaration.
26776 RM References:  3.09.04 (18/2)
26777 @end itemize
26779 @geindex AI-0208 (Ada 2012 feature)
26782 @itemize *
26784 @item 
26785 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
26787 The wording in the Ada 2005 RM concerning characteristics of incomplete views
26788 was incorrect and implied that some programs intended to be legal were now
26789 illegal. GNAT had never considered such programs illegal, so it has always
26790 implemented the intent of this AI.
26792 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
26793 @end itemize
26795 @geindex AI-0162 (Ada 2012 feature)
26798 @itemize *
26800 @item 
26801 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
26803 Incomplete types are made more useful by allowing them to be completed by
26804 private types and private extensions.
26806 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
26807 @end itemize
26809 @geindex AI-0098 (Ada 2012 feature)
26812 @itemize *
26814 @item 
26815 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
26817 An unintentional omission in the RM implied some inconsistent restrictions on
26818 the use of anonymous access to subprogram values. These restrictions were not
26819 intentional, and have never been enforced by GNAT.
26821 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
26822 @end itemize
26824 @geindex AI-0199 (Ada 2012 feature)
26827 @itemize *
26829 @item 
26830 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
26832 A choice list in a record aggregate can include several components of
26833 (distinct) anonymous access types as long as they have matching designated
26834 subtypes.
26836 RM References:  4.03.01 (16)
26837 @end itemize
26839 @geindex AI-0220 (Ada 2012 feature)
26842 @itemize *
26844 @item 
26845 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
26847 This AI addresses a wording problem in the RM that appears to permit some
26848 complex cases of aggregates with nonstatic discriminants. GNAT has always
26849 implemented the intended semantics.
26851 RM References:  4.03.01 (17)
26852 @end itemize
26854 @geindex AI-0147 (Ada 2012 feature)
26857 @itemize *
26859 @item 
26860 @emph{AI-0147 Conditional expressions (2009-03-29)}
26862 Conditional expressions are permitted. The form of such an expression is:
26864 @example
26865 (if expr then expr @{elsif expr then expr@} [else expr])
26866 @end example
26868 The parentheses can be omitted in contexts where parentheses are present
26869 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
26870 clause is omitted, @strong{else} @emph{True} is assumed;
26871 thus @code{(if A then B)} is a way to conveniently represent
26872 @emph{(A implies B)} in standard logic.
26874 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
26875 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
26876 @end itemize
26878 @geindex AI-0037 (Ada 2012 feature)
26881 @itemize *
26883 @item 
26884 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
26886 This AI confirms that an association of the form @cite{Indx => <>} in an
26887 array aggregate must raise @cite{Constraint_Error} if @cite{Indx}
26888 is out of range. The RM specified a range check on other associations, but
26889 not when the value of the association was defaulted. GNAT has always inserted
26890 a constraint check on the index value.
26892 RM References:  4.03.03 (29)
26893 @end itemize
26895 @geindex AI-0123 (Ada 2012 feature)
26898 @itemize *
26900 @item 
26901 @emph{AI-0123 Composability of equality (2010-04-13)}
26903 Equality of untagged record composes, so that the predefined equality for a
26904 composite type that includes a component of some untagged record type
26905 @cite{R} uses the equality operation of @cite{R} (which may be user-defined
26906 or predefined). This makes the behavior of untagged records identical to that
26907 of tagged types in this respect.
26909 This change is an incompatibility with previous versions of Ada, but it
26910 corrects a non-uniformity that was often a source of confusion. Analysis of
26911 a large number of industrial programs indicates that in those rare cases
26912 where a composite type had an untagged record component with a user-defined
26913 equality, either there was no use of the composite equality, or else the code
26914 expected the same composability as for tagged types, and thus had a bug that
26915 would be fixed by this change.
26917 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
26918 8.05.04 (8)
26919 @end itemize
26921 @geindex AI-0088 (Ada 2012 feature)
26924 @itemize *
26926 @item 
26927 @emph{AI-0088 The value of exponentiation (0000-00-00)}
26929 This AI clarifies the equivalence rule given for the dynamic semantics of
26930 exponentiation: the value of the operation can be obtained by repeated
26931 multiplication, but the operation can be implemented otherwise (for example
26932 using the familiar divide-by-two-and-square algorithm, even if this is less
26933 accurate), and does not imply repeated reads of a volatile base.
26935 RM References:  4.05.06 (11)
26936 @end itemize
26938 @geindex AI-0188 (Ada 2012 feature)
26941 @itemize *
26943 @item 
26944 @emph{AI-0188 Case expressions (2010-01-09)}
26946 Case expressions are permitted. This allows use of constructs such as:
26948 @example
26949 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
26950 @end example
26952 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
26953 @end itemize
26955 @geindex AI-0104 (Ada 2012 feature)
26958 @itemize *
26960 @item 
26961 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
26963 The assignment @code{Ptr := new not null Some_Ptr;} will raise
26964 @code{Constraint_Error} because the default value of the allocated object is
26965 @strong{null}. This useless construct is illegal in Ada 2012.
26967 RM References:  4.08 (2)
26968 @end itemize
26970 @geindex AI-0157 (Ada 2012 feature)
26973 @itemize *
26975 @item 
26976 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
26978 Allocation and Deallocation from an empty storage pool (i.e. allocation or
26979 deallocation of a pointer for which a static storage size clause of zero
26980 has been given) is now illegal and is detected as such. GNAT
26981 previously gave a warning but not an error.
26983 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
26984 @end itemize
26986 @geindex AI-0179 (Ada 2012 feature)
26989 @itemize *
26991 @item 
26992 @emph{AI-0179 Statement not required after label (2010-04-10)}
26994 It is not necessary to have a statement following a label, so a label
26995 can appear at the end of a statement sequence without the need for putting a
26996 null statement afterwards, but it is not allowable to have only labels and
26997 no real statements in a statement sequence.
26999 RM References:  5.01 (2)
27000 @end itemize
27002 @geindex AI-0139-2 (Ada 2012 feature)
27005 @itemize *
27007 @item 
27008 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
27010 The new syntax for iterating over arrays and containers is now implemented.
27011 Iteration over containers is for now limited to read-only iterators. Only
27012 default iterators are supported, with the syntax:  @cite{for Elem of C}.
27014 RM References:  5.05
27015 @end itemize
27017 @geindex AI-0134 (Ada 2012 feature)
27020 @itemize *
27022 @item 
27023 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
27025 For full conformance, the profiles of anonymous-access-to-subprogram
27026 parameters must match. GNAT has always enforced this rule.
27028 RM References:  6.03.01 (18)
27029 @end itemize
27031 @geindex AI-0207 (Ada 2012 feature)
27034 @itemize *
27036 @item 
27037 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
27039 This AI confirms that access_to_constant indication must match for mode
27040 conformance. This was implemented in GNAT when the qualifier was originally
27041 introduced in Ada 2005.
27043 RM References:  6.03.01 (16/2)
27044 @end itemize
27046 @geindex AI-0046 (Ada 2012 feature)
27049 @itemize *
27051 @item 
27052 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
27054 For full conformance, in the case of access parameters, the null exclusion
27055 must match (either both or neither must have @code{not null}).
27057 RM References:  6.03.02 (18)
27058 @end itemize
27060 @geindex AI-0118 (Ada 2012 feature)
27063 @itemize *
27065 @item 
27066 @emph{AI-0118 The association of parameter associations (0000-00-00)}
27068 This AI clarifies the rules for named associations in subprogram calls and
27069 generic instantiations. The rules have been in place since Ada 83.
27071 RM References:  6.04.01 (2)   12.03 (9)
27072 @end itemize
27074 @geindex AI-0196 (Ada 2012 feature)
27077 @itemize *
27079 @item 
27080 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
27082 Null exclusion checks are not made for @cite{**out**} parameters when
27083 evaluating the actual parameters. GNAT has never generated these checks.
27085 RM References:  6.04.01 (13)
27086 @end itemize
27088 @geindex AI-0015 (Ada 2012 feature)
27091 @itemize *
27093 @item 
27094 @emph{AI-0015 Constant return objects (0000-00-00)}
27096 The return object declared in an @emph{extended_return_statement} may be
27097 declared constant. This was always intended, and GNAT has always allowed it.
27099 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
27100 6.05 (5.7/2)
27101 @end itemize
27103 @geindex AI-0032 (Ada 2012 feature)
27106 @itemize *
27108 @item 
27109 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
27111 If a function returns a class-wide type, the object of an extended return
27112 statement can be declared with a specific type that is covered by the class-
27113 wide type. This has been implemented in GNAT since the introduction of
27114 extended returns. Note AI-0103 complements this AI by imposing matching
27115 rules for constrained return types.
27117 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
27118 6.05 (8/2)
27119 @end itemize
27121 @geindex AI-0103 (Ada 2012 feature)
27124 @itemize *
27126 @item 
27127 @emph{AI-0103 Static matching for extended return (2010-07-23)}
27129 If the return subtype of a function is an elementary type or a constrained
27130 type, the subtype indication in an extended return statement must match
27131 statically this return subtype.
27133 RM References:  6.05 (5.2/2)
27134 @end itemize
27136 @geindex AI-0058 (Ada 2012 feature)
27139 @itemize *
27141 @item 
27142 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
27144 The RM had some incorrect wording implying wrong treatment of abnormal
27145 completion in an extended return. GNAT has always implemented the intended
27146 correct semantics as described by this AI.
27148 RM References:  6.05 (22/2)
27149 @end itemize
27151 @geindex AI-0050 (Ada 2012 feature)
27154 @itemize *
27156 @item 
27157 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
27159 The implementation permissions for raising @cite{Constraint_Error} early on a function call
27160 when it was clear an exception would be raised were over-permissive and allowed
27161 mishandling of discriminants in some cases. GNAT did
27162 not take advantage of these incorrect permissions in any case.
27164 RM References:  6.05 (24/2)
27165 @end itemize
27167 @geindex AI-0125 (Ada 2012 feature)
27170 @itemize *
27172 @item 
27173 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
27175 In Ada 2012, the declaration of a primitive operation of a type extension
27176 or private extension can also override an inherited primitive that is not
27177 visible at the point of this declaration.
27179 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
27180 @end itemize
27182 @geindex AI-0062 (Ada 2012 feature)
27185 @itemize *
27187 @item 
27188 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
27190 A full constant may have a null exclusion even if its associated deferred
27191 constant does not. GNAT has always allowed this.
27193 RM References:  7.04 (6/2)   7.04 (7.1/2)
27194 @end itemize
27196 @geindex AI-0178 (Ada 2012 feature)
27199 @itemize *
27201 @item 
27202 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
27204 This AI clarifies the role of incomplete views and plugs an omission in the
27205 RM. GNAT always correctly restricted the use of incomplete views and types.
27207 RM References:  7.05 (3/2)   7.05 (6/2)
27208 @end itemize
27210 @geindex AI-0087 (Ada 2012 feature)
27213 @itemize *
27215 @item 
27216 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
27218 The actual for a formal nonlimited derived type cannot be limited. In
27219 particular, a formal derived type that extends a limited interface but which
27220 is not explicitly limited cannot be instantiated with a limited type.
27222 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
27223 @end itemize
27225 @geindex AI-0099 (Ada 2012 feature)
27228 @itemize *
27230 @item 
27231 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
27233 This AI clarifies that 'needs finalization' is part of dynamic semantics,
27234 and therefore depends on the run-time characteristics of an object (i.e. its
27235 tag) and not on its nominal type. As the AI indicates: "we do not expect
27236 this to affect any implementation'@w{'}.
27238 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
27239 @end itemize
27241 @geindex AI-0064 (Ada 2012 feature)
27244 @itemize *
27246 @item 
27247 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
27249 This is an editorial change only. The intended behavior is already checked
27250 by an existing ACATS test, which GNAT has always executed correctly.
27252 RM References:  7.06.01 (17.1/1)
27253 @end itemize
27255 @geindex AI-0026 (Ada 2012 feature)
27258 @itemize *
27260 @item 
27261 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
27263 Record representation clauses concerning Unchecked_Union types cannot mention
27264 the discriminant of the type. The type of a component declared in the variant
27265 part of an Unchecked_Union cannot be controlled, have controlled components,
27266 nor have protected or task parts. If an Unchecked_Union type is declared
27267 within the body of a generic unit or its descendants, then the type of a
27268 component declared in the variant part cannot be a formal private type or a
27269 formal private extension declared within the same generic unit.
27271 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
27272 @end itemize
27274 @geindex AI-0205 (Ada 2012 feature)
27277 @itemize *
27279 @item 
27280 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27282 This AI corrects a simple omission in the RM. Return objects have always
27283 been visible within an extended return statement.
27285 RM References:  8.03 (17)
27286 @end itemize
27288 @geindex AI-0042 (Ada 2012 feature)
27291 @itemize *
27293 @item 
27294 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
27296 This AI fixes a wording gap in the RM. An operation of a synchronized
27297 interface can be implemented by a protected or task entry, but the abstract
27298 operation is not being overridden in the usual sense, and it must be stated
27299 separately that this implementation is legal. This has always been the case
27300 in GNAT.
27302 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
27303 @end itemize
27305 @geindex AI-0030 (Ada 2012 feature)
27308 @itemize *
27310 @item 
27311 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
27313 Requeue is permitted to a protected, synchronized or task interface primitive
27314 providing it is known that the overriding operation is an entry. Otherwise
27315 the requeue statement has the same effect as a procedure call. Use of pragma
27316 @cite{Implemented} provides a way to impose a static requirement on the
27317 overriding operation by adhering to one of the implementation kinds: entry,
27318 protected procedure or any of the above.
27320 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
27321 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
27322 @end itemize
27324 @geindex AI-0201 (Ada 2012 feature)
27327 @itemize *
27329 @item 
27330 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
27332 If an Atomic object has a pragma @cite{Pack} or a @cite{Component_Size}
27333 attribute, then individual components may not be addressable by independent
27334 tasks. However, if the representation clause has no effect (is confirming),
27335 then independence is not compromised. Furthermore, in GNAT, specification of
27336 other appropriately addressable component sizes (e.g. 16 for 8-bit
27337 characters) also preserves independence. GNAT now gives very clear warnings
27338 both for the declaration of such a type, and for any assignment to its components.
27340 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
27341 @end itemize
27343 @geindex AI-0009 (Ada 2012 feature)
27346 @itemize *
27348 @item 
27349 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
27351 This AI introduces the new pragmas @cite{Independent} and
27352 @cite{Independent_Components},
27353 which control guaranteeing independence of access to objects and components.
27354 The AI also requires independence not unaffected by confirming rep clauses.
27356 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
27357 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
27358 @end itemize
27360 @geindex AI-0072 (Ada 2012 feature)
27363 @itemize *
27365 @item 
27366 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
27368 This AI clarifies that task signalling for reading @cite{'Terminated} only
27369 occurs if the result is True. GNAT semantics has always been consistent with
27370 this notion of task signalling.
27372 RM References:  9.10 (6.1/1)
27373 @end itemize
27375 @geindex AI-0108 (Ada 2012 feature)
27378 @itemize *
27380 @item 
27381 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
27383 This AI confirms that an incomplete type from a limited view does not have
27384 discriminants. This has always been the case in GNAT.
27386 RM References:  10.01.01 (12.3/2)
27387 @end itemize
27389 @geindex AI-0129 (Ada 2012 feature)
27392 @itemize *
27394 @item 
27395 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
27397 This AI clarifies the description of limited views: a limited view of a
27398 package includes only one view of a type that has an incomplete declaration
27399 and a full declaration (there is no possible ambiguity in a client package).
27400 This AI also fixes an omission: a nested package in the private part has no
27401 limited view. GNAT always implemented this correctly.
27403 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
27404 @end itemize
27406 @geindex AI-0077 (Ada 2012 feature)
27409 @itemize *
27411 @item 
27412 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
27414 This AI clarifies that a declaration does not include a context clause,
27415 and confirms that it is illegal to have a context in which both a limited
27416 and a nonlimited view of a package are accessible. Such double visibility
27417 was always rejected by GNAT.
27419 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
27420 @end itemize
27422 @geindex AI-0122 (Ada 2012 feature)
27425 @itemize *
27427 @item 
27428 @emph{AI-0122 Private with and children of generics (0000-00-00)}
27430 This AI clarifies the visibility of private children of generic units within
27431 instantiations of a parent. GNAT has always handled this correctly.
27433 RM References:  10.01.02 (12/2)
27434 @end itemize
27436 @geindex AI-0040 (Ada 2012 feature)
27439 @itemize *
27441 @item 
27442 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
27444 This AI confirms that a limited with clause in a child unit cannot name
27445 an ancestor of the unit. This has always been checked in GNAT.
27447 RM References:  10.01.02 (20/2)
27448 @end itemize
27450 @geindex AI-0132 (Ada 2012 feature)
27453 @itemize *
27455 @item 
27456 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
27458 This AI fills a gap in the description of library unit pragmas. The pragma
27459 clearly must apply to a library unit, even if it does not carry the name
27460 of the enclosing unit. GNAT has always enforced the required check.
27462 RM References:  10.01.05 (7)
27463 @end itemize
27465 @geindex AI-0034 (Ada 2012 feature)
27468 @itemize *
27470 @item 
27471 @emph{AI-0034 Categorization of limited views (0000-00-00)}
27473 The RM makes certain limited with clauses illegal because of categorization
27474 considerations, when the corresponding normal with would be legal. This is
27475 not intended, and GNAT has always implemented the recommended behavior.
27477 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
27478 @end itemize
27480 @geindex AI-0035 (Ada 2012 feature)
27483 @itemize *
27485 @item 
27486 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
27488 This AI remedies some inconsistencies in the legality rules for Pure units.
27489 Derived access types are legal in a pure unit (on the assumption that the
27490 rule for a zero storage pool size has been enforced on the ancestor type).
27491 The rules are enforced in generic instances and in subunits. GNAT has always
27492 implemented the recommended behavior.
27494 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)
27495 @end itemize
27497 @geindex AI-0219 (Ada 2012 feature)
27500 @itemize *
27502 @item 
27503 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
27505 This AI refines the rules for the cases with limited parameters which do not
27506 allow the implementations to omit 'redundant'. GNAT now properly conforms
27507 to the requirements of this binding interpretation.
27509 RM References:  10.02.01 (18/2)
27510 @end itemize
27512 @geindex AI-0043 (Ada 2012 feature)
27515 @itemize *
27517 @item 
27518 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
27520 This AI covers various omissions in the RM regarding the raising of
27521 exceptions. GNAT has always implemented the intended semantics.
27523 RM References:  11.04.01 (10.1/2)   11 (2)
27524 @end itemize
27526 @geindex AI-0200 (Ada 2012 feature)
27529 @itemize *
27531 @item 
27532 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
27534 This AI plugs a gap in the RM which appeared to allow some obviously intended
27535 illegal instantiations. GNAT has never allowed these instantiations.
27537 RM References:  12.07 (16)
27538 @end itemize
27540 @geindex AI-0112 (Ada 2012 feature)
27543 @itemize *
27545 @item 
27546 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
27548 This AI concerns giving names to various representation aspects, but the
27549 practical effect is simply to make the use of duplicate
27550 @cite{Atomic[_Components]},
27551 @cite{Volatile[_Components]}, and
27552 @cite{Independent[_Components]} pragmas illegal, and GNAT
27553 now performs this required check.
27555 RM References:  13.01 (8)
27556 @end itemize
27558 @geindex AI-0106 (Ada 2012 feature)
27561 @itemize *
27563 @item 
27564 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
27566 The RM appeared to allow representation pragmas on generic formal parameters,
27567 but this was not intended, and GNAT has never permitted this usage.
27569 RM References:  13.01 (9.1/1)
27570 @end itemize
27572 @geindex AI-0012 (Ada 2012 feature)
27575 @itemize *
27577 @item 
27578 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
27580 It is now illegal to give an inappropriate component size or a pragma
27581 @cite{Pack} that attempts to change the component size in the case of atomic
27582 or aliased components. Previously GNAT ignored such an attempt with a
27583 warning.
27585 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
27586 @end itemize
27588 @geindex AI-0039 (Ada 2012 feature)
27591 @itemize *
27593 @item 
27594 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
27596 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
27597 for stream attributes, but these were never useful and are now illegal. GNAT
27598 has always regarded such expressions as illegal.
27600 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
27601 @end itemize
27603 @geindex AI-0095 (Ada 2012 feature)
27606 @itemize *
27608 @item 
27609 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
27611 The prefix of @cite{'Address} cannot statically denote a subprogram with
27612 convention @cite{Intrinsic}. The use of the @cite{Address} attribute raises
27613 @cite{Program_Error} if the prefix denotes a subprogram with convention
27614 @cite{Intrinsic}.
27616 RM References:  13.03 (11/1)
27617 @end itemize
27619 @geindex AI-0116 (Ada 2012 feature)
27622 @itemize *
27624 @item 
27625 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
27627 This AI requires that the alignment of a class-wide object be no greater
27628 than the alignment of any type in the class. GNAT has always followed this
27629 recommendation.
27631 RM References:  13.03 (29)   13.11 (16)
27632 @end itemize
27634 @geindex AI-0146 (Ada 2012 feature)
27637 @itemize *
27639 @item 
27640 @emph{AI-0146 Type invariants (2009-09-21)}
27642 Type invariants may be specified for private types using the aspect notation.
27643 Aspect @cite{Type_Invariant} may be specified for any private type,
27644 @cite{Type_Invariant'Class} can
27645 only be specified for tagged types, and is inherited by any descendent of the
27646 tagged types. The invariant is a boolean expression that is tested for being
27647 true in the following situations: conversions to the private type, object
27648 declarations for the private type that are default initialized, and
27649 [@strong{in}] @strong{out}
27650 parameters and returned result on return from any primitive operation for
27651 the type that is visible to a client.
27652 GNAT defines the synonyms @cite{Invariant} for @cite{Type_Invariant} and
27653 @cite{Invariant'Class} for @cite{Type_Invariant'Class}.
27655 RM References:  13.03.03 (00)
27656 @end itemize
27658 @geindex AI-0078 (Ada 2012 feature)
27661 @itemize *
27663 @item 
27664 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
27666 In Ada 2012, compilers are required to support unchecked conversion where the
27667 target alignment is a multiple of the source alignment. GNAT always supported
27668 this case (and indeed all cases of differing alignments, doing copies where
27669 required if the alignment was reduced).
27671 RM References:  13.09 (7)
27672 @end itemize
27674 @geindex AI-0195 (Ada 2012 feature)
27677 @itemize *
27679 @item 
27680 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
27682 The handling of invalid values is now designated to be implementation
27683 defined. This is a documentation change only, requiring Annex M in the GNAT
27684 Reference Manual to document this handling.
27685 In GNAT, checks for invalid values are made
27686 only when necessary to avoid erroneous behavior. Operations like assignments
27687 which cannot cause erroneous behavior ignore the possibility of invalid
27688 values and do not do a check. The date given above applies only to the
27689 documentation change, this behavior has always been implemented by GNAT.
27691 RM References:  13.09.01 (10)
27692 @end itemize
27694 @geindex AI-0193 (Ada 2012 feature)
27697 @itemize *
27699 @item 
27700 @emph{AI-0193 Alignment of allocators (2010-09-16)}
27702 This AI introduces a new attribute @cite{Max_Alignment_For_Allocation},
27703 analogous to @cite{Max_Size_In_Storage_Elements}, but for alignment instead
27704 of size.
27706 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
27707 13.11.01 (2)   13.11.01 (3)
27708 @end itemize
27710 @geindex AI-0177 (Ada 2012 feature)
27713 @itemize *
27715 @item 
27716 @emph{AI-0177 Parameterized expressions (2010-07-10)}
27718 The new Ada 2012 notion of parameterized expressions is implemented. The form
27721 @example
27722 function-specification is (expression)
27723 @end example
27725 This is exactly equivalent to the
27726 corresponding function body that returns the expression, but it can appear
27727 in a package spec. Note that the expression must be parenthesized.
27729 RM References:  13.11.01 (3/2)
27730 @end itemize
27732 @geindex AI-0033 (Ada 2012 feature)
27735 @itemize *
27737 @item 
27738 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
27740 Neither of these two pragmas may appear within a generic template, because
27741 the generic might be instantiated at other than the library level.
27743 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
27744 @end itemize
27746 @geindex AI-0161 (Ada 2012 feature)
27749 @itemize *
27751 @item 
27752 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
27754 A new restriction @cite{No_Default_Stream_Attributes} prevents the use of any
27755 of the default stream attributes for elementary types. If this restriction is
27756 in force, then it is necessary to provide explicit subprograms for any
27757 stream attributes used.
27759 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
27760 @end itemize
27762 @geindex AI-0194 (Ada 2012 feature)
27765 @itemize *
27767 @item 
27768 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
27770 The @cite{Stream_Size} attribute returns the default number of bits in the
27771 stream representation of the given type.
27772 This value is not affected by the presence
27773 of stream subprogram attributes for the type. GNAT has always implemented
27774 this interpretation.
27776 RM References:  13.13.02 (1.2/2)
27777 @end itemize
27779 @geindex AI-0109 (Ada 2012 feature)
27782 @itemize *
27784 @item 
27785 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
27787 This AI is an editorial change only. It removes the need for a tag check
27788 that can never fail.
27790 RM References:  13.13.02 (34/2)
27791 @end itemize
27793 @geindex AI-0007 (Ada 2012 feature)
27796 @itemize *
27798 @item 
27799 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
27801 The RM as written appeared to limit the possibilities of declaring read
27802 attribute procedures for private scalar types. This limitation was not
27803 intended, and has never been enforced by GNAT.
27805 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
27806 @end itemize
27808 @geindex AI-0065 (Ada 2012 feature)
27811 @itemize *
27813 @item 
27814 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
27816 This AI clarifies the fact that all remote access types support external
27817 streaming. This fixes an obvious oversight in the definition of the
27818 language, and GNAT always implemented the intended correct rules.
27820 RM References:  13.13.02 (52/2)
27821 @end itemize
27823 @geindex AI-0019 (Ada 2012 feature)
27826 @itemize *
27828 @item 
27829 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
27831 The RM suggests that primitive subprograms of a specific tagged type are
27832 frozen when the tagged type is frozen. This would be an incompatible change
27833 and is not intended. GNAT has never attempted this kind of freezing and its
27834 behavior is consistent with the recommendation of this AI.
27836 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)
27837 @end itemize
27839 @geindex AI-0017 (Ada 2012 feature)
27842 @itemize *
27844 @item 
27845 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
27847 So-called 'Taft-amendment types' (i.e., types that are completed in package
27848 bodies) are not frozen by the occurrence of bodies in the
27849 enclosing declarative part. GNAT always implemented this properly.
27851 RM References:  13.14 (3/1)
27852 @end itemize
27854 @geindex AI-0060 (Ada 2012 feature)
27857 @itemize *
27859 @item 
27860 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
27862 This AI extends the definition of remote access types to include access
27863 to limited, synchronized, protected or task class-wide interface types.
27864 GNAT already implemented this extension.
27866 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
27867 @end itemize
27869 @geindex AI-0114 (Ada 2012 feature)
27872 @itemize *
27874 @item 
27875 @emph{AI-0114 Classification of letters (0000-00-00)}
27877 The code points 170 (@cite{FEMININE ORDINAL INDICATOR}),
27878 181 (@cite{MICRO SIGN}), and
27879 186 (@cite{MASCULINE ORDINAL INDICATOR}) are technically considered
27880 lower case letters by Unicode.
27881 However, they are not allowed in identifiers, and they
27882 return @cite{False} to @cite{Ada.Characters.Handling.Is_Letter/Is_Lower}.
27883 This behavior is consistent with that defined in Ada 95.
27885 RM References:  A.03.02 (59)   A.04.06 (7)
27886 @end itemize
27888 @geindex AI-0185 (Ada 2012 feature)
27891 @itemize *
27893 @item 
27894 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
27896 Two new packages @cite{Ada.Wide_[Wide_]Characters.Handling} provide
27897 classification functions for @cite{Wide_Character} and
27898 @cite{Wide_Wide_Character}, as well as providing
27899 case folding routines for @cite{Wide_[Wide_]Character} and
27900 @cite{Wide_[Wide_]String}.
27902 RM References:  A.03.05 (0)   A.03.06 (0)
27903 @end itemize
27905 @geindex AI-0031 (Ada 2012 feature)
27908 @itemize *
27910 @item 
27911 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
27913 A new version of @cite{Find_Token} is added to all relevant string packages,
27914 with an extra parameter @cite{From}. Instead of starting at the first
27915 character of the string, the search for a matching Token starts at the
27916 character indexed by the value of @cite{From}.
27917 These procedures are available in all versions of Ada
27918 but if used in versions earlier than Ada 2012 they will generate a warning
27919 that an Ada 2012 subprogram is being used.
27921 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
27922 A.04.05 (46)
27923 @end itemize
27925 @geindex AI-0056 (Ada 2012 feature)
27928 @itemize *
27930 @item 
27931 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
27933 The wording in the Ada 2005 RM implied an incompatible handling of the
27934 @cite{Index} functions, resulting in raising an exception instead of
27935 returning zero in some situations.
27936 This was not intended and has been corrected.
27937 GNAT always returned zero, and is thus consistent with this AI.
27939 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
27940 @end itemize
27942 @geindex AI-0137 (Ada 2012 feature)
27945 @itemize *
27947 @item 
27948 @emph{AI-0137 String encoding package (2010-03-25)}
27950 The packages @cite{Ada.Strings.UTF_Encoding}, together with its child
27951 packages, @cite{Conversions}, @cite{Strings}, @cite{Wide_Strings},
27952 and @cite{Wide_Wide_Strings} have been
27953 implemented. These packages (whose documentation can be found in the spec
27954 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
27955 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
27956 @cite{String}, @cite{Wide_String}, and @cite{Wide_Wide_String}
27957 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
27958 UTF-16), as well as conversions between the different UTF encodings. With
27959 the exception of @cite{Wide_Wide_Strings}, these packages are available in
27960 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
27961 The @cite{Wide_Wide_Strings package}
27962 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
27963 mode since it uses @cite{Wide_Wide_Character}).
27965 RM References:  A.04.11
27966 @end itemize
27968 @geindex AI-0038 (Ada 2012 feature)
27971 @itemize *
27973 @item 
27974 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
27976 These are minor errors in the description on three points. The intent on
27977 all these points has always been clear, and GNAT has always implemented the
27978 correct intended semantics.
27980 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)
27981 @end itemize
27983 @geindex AI-0044 (Ada 2012 feature)
27986 @itemize *
27988 @item 
27989 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
27991 This AI places restrictions on allowed instantiations of generic containers.
27992 These restrictions are not checked by the compiler, so there is nothing to
27993 change in the implementation. This affects only the RM documentation.
27995 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)
27996 @end itemize
27998 @geindex AI-0127 (Ada 2012 feature)
28001 @itemize *
28003 @item 
28004 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
28006 This package provides an interface for identifying the current locale.
28008 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
28009 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
28010 @end itemize
28012 @geindex AI-0002 (Ada 2012 feature)
28015 @itemize *
28017 @item 
28018 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
28020 The compiler is not required to support exporting an Ada subprogram with
28021 convention C if there are parameters or a return type of an unconstrained
28022 array type (such as @cite{String}). GNAT allows such declarations but
28023 generates warnings. It is possible, but complicated, to write the
28024 corresponding C code and certainly such code would be specific to GNAT and
28025 non-portable.
28027 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
28028 @end itemize
28030 @geindex AI05-0216 (Ada 2012 feature)
28033 @itemize *
28035 @item 
28036 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
28038 It is clearly the intention that @cite{No_Task_Hierarchy} is intended to
28039 forbid tasks declared locally within subprograms, or functions returning task
28040 objects, and that is the implementation that GNAT has always provided.
28041 However the language in the RM was not sufficiently clear on this point.
28042 Thus this is a documentation change in the RM only.
28044 RM References:  D.07 (3/3)
28045 @end itemize
28047 @geindex AI-0211 (Ada 2012 feature)
28050 @itemize *
28052 @item 
28053 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
28055 The restriction @cite{No_Relative_Delays} forbids any calls to the subprogram
28056 @cite{Ada.Real_Time.Timing_Events.Set_Handler}.
28058 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
28059 @end itemize
28061 @geindex AI-0190 (Ada 2012 feature)
28064 @itemize *
28066 @item 
28067 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
28069 This AI introduces a new pragma @cite{Default_Storage_Pool}, which can be
28070 used to control storage pools globally.
28071 In particular, you can force every access
28072 type that is used for allocation (@strong{new}) to have an explicit storage pool,
28073 or you can declare a pool globally to be used for all access types that lack
28074 an explicit one.
28076 RM References:  D.07 (8)
28077 @end itemize
28079 @geindex AI-0189 (Ada 2012 feature)
28082 @itemize *
28084 @item 
28085 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
28087 This AI introduces a new restriction @cite{No_Allocators_After_Elaboration},
28088 which says that no dynamic allocation will occur once elaboration is
28089 completed.
28090 In general this requires a run-time check, which is not required, and which
28091 GNAT does not attempt. But the static cases of allocators in a task body or
28092 in the body of the main program are detected and flagged at compile or bind
28093 time.
28095 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
28096 @end itemize
28098 @geindex AI-0171 (Ada 2012 feature)
28101 @itemize *
28103 @item 
28104 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
28106 A new package @cite{System.Multiprocessors} is added, together with the
28107 definition of pragma @cite{CPU} for controlling task affinity. A new no
28108 dependence restriction, on @cite{System.Multiprocessors.Dispatching_Domains},
28109 is added to the Ravenscar profile.
28111 RM References:  D.13.01 (4/2)   D.16
28112 @end itemize
28114 @geindex AI-0210 (Ada 2012 feature)
28117 @itemize *
28119 @item 
28120 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
28122 This is a documentation only issue regarding wording of metric requirements,
28123 that does not affect the implementation of the compiler.
28125 RM References:  D.15 (24/2)
28126 @end itemize
28128 @geindex AI-0206 (Ada 2012 feature)
28131 @itemize *
28133 @item 
28134 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
28136 Remote types packages are now allowed to depend on preelaborated packages.
28137 This was formerly considered illegal.
28139 RM References:  E.02.02 (6)
28140 @end itemize
28142 @geindex AI-0152 (Ada 2012 feature)
28145 @itemize *
28147 @item 
28148 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
28150 Restriction @cite{No_Anonymous_Allocators} prevents the use of allocators
28151 where the type of the returned value is an anonymous access type.
28153 RM References:  H.04 (8/1)
28154 @end itemize
28156 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
28157 @anchor{gnat_rm/obsolescent_features id1}@anchor{41d}@anchor{gnat_rm/obsolescent_features doc}@anchor{41e}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
28158 @chapter Obsolescent Features
28161 This chapter describes features that are provided by GNAT, but are
28162 considered obsolescent since there are preferred ways of achieving
28163 the same effect. These features are provided solely for historical
28164 compatibility purposes.
28166 @menu
28167 * pragma No_Run_Time:: 
28168 * pragma Ravenscar:: 
28169 * pragma Restricted_Run_Time:: 
28170 * pragma Task_Info:: 
28171 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
28173 @end menu
28175 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
28176 @anchor{gnat_rm/obsolescent_features id2}@anchor{41f}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{420}
28177 @section pragma No_Run_Time
28180 The pragma @cite{No_Run_Time} is used to achieve an affect similar
28181 to the use of the "Zero Foot Print" configurable run time, but without
28182 requiring a specially configured run time. The result of using this
28183 pragma, which must be used for all units in a partition, is to restrict
28184 the use of any language features requiring run-time support code. The
28185 preferred usage is to use an appropriately configured run-time that
28186 includes just those features that are to be made accessible.
28188 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
28189 @anchor{gnat_rm/obsolescent_features id3}@anchor{421}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{422}
28190 @section pragma Ravenscar
28193 The pragma @cite{Ravenscar} has exactly the same effect as pragma
28194 @cite{Profile (Ravenscar)}. The latter usage is preferred since it
28195 is part of the new Ada 2005 standard.
28197 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
28198 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{423}@anchor{gnat_rm/obsolescent_features id4}@anchor{424}
28199 @section pragma Restricted_Run_Time
28202 The pragma @cite{Restricted_Run_Time} has exactly the same effect as
28203 pragma @cite{Profile (Restricted)}. The latter usage is
28204 preferred since the Ada 2005 pragma @cite{Profile} is intended for
28205 this kind of implementation dependent addition.
28207 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
28208 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{425}@anchor{gnat_rm/obsolescent_features id5}@anchor{426}
28209 @section pragma Task_Info
28212 The functionality provided by pragma @cite{Task_Info} is now part of the
28213 Ada language. The @cite{CPU} aspect and the package
28214 @cite{System.Multiprocessors} offer a less system-dependent way to specify
28215 task affinity or to query the number of processsors.
28217 Syntax
28219 @example
28220 pragma Task_Info (EXPRESSION);
28221 @end example
28223 This pragma appears within a task definition (like pragma
28224 @cite{Priority}) and applies to the task in which it appears.  The
28225 argument must be of type @cite{System.Task_Info.Task_Info_Type}.
28226 The @cite{Task_Info} pragma provides system dependent control over
28227 aspects of tasking implementation, for example, the ability to map
28228 tasks to specific processors.  For details on the facilities available
28229 for the version of GNAT that you are using, see the documentation
28230 in the spec of package System.Task_Info in the runtime
28231 library.
28233 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
28234 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{427}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{428}
28235 @section package System.Task_Info (@code{s-tasinf.ads})
28238 This package provides target dependent functionality that is used
28239 to support the @cite{Task_Info} pragma. The predefined Ada package
28240 @cite{System.Multiprocessors} and the @cite{CPU} aspect now provide a
28241 standard replacement for GNAT's @cite{Task_Info} functionality.
28243 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
28244 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{429}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{42a}
28245 @chapter Compatibility and Porting Guide
28248 This chapter presents some guidelines for developing portable Ada code,
28249 describes the compatibility issues that may arise between
28250 GNAT and other Ada compilation systems (including those for Ada 83),
28251 and shows how GNAT can expedite porting
28252 applications developed in other Ada environments.
28254 @menu
28255 * Writing Portable Fixed-Point Declarations:: 
28256 * Compatibility with Ada 83:: 
28257 * Compatibility between Ada 95 and Ada 2005:: 
28258 * Implementation-dependent characteristics:: 
28259 * Compatibility with Other Ada Systems:: 
28260 * Representation Clauses:: 
28261 * Compatibility with HP Ada 83:: 
28263 @end menu
28265 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
28266 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{42b}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{42c}
28267 @section Writing Portable Fixed-Point Declarations
28270 The Ada Reference Manual gives an implementation freedom to choose bounds
28271 that are narrower by @cite{Small} from the given bounds.
28272 For example, if we write
28274 @example
28275 type F1 is delta 1.0 range -128.0 .. +128.0;
28276 @end example
28278 then the implementation is allowed to choose -128.0 .. +127.0 if it
28279 likes, but is not required to do so.
28281 This leads to possible portability problems, so let's have a closer
28282 look at this, and figure out how to avoid these problems.
28284 First, why does this freedom exist, and why would an implementation
28285 take advantage of it? To answer this, take a closer look at the type
28286 declaration for @cite{F1} above. If the compiler uses the given bounds,
28287 it would need 9 bits to hold the largest positive value (and typically
28288 that means 16 bits on all machines). But if the implementation chooses
28289 the +127.0 bound then it can fit values of the type in 8 bits.
28291 Why not make the user write +127.0 if that's what is wanted?
28292 The rationale is that if you are thinking of fixed point
28293 as a kind of 'poor man's floating-point', then you don't want
28294 to be thinking about the scaled integers that are used in its
28295 representation. Let's take another example:
28297 @example
28298 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
28299 @end example
28301 Looking at this declaration, it seems casually as though
28302 it should fit in 16 bits, but again that extra positive value
28303 +1.0 has the scaled integer equivalent of 2**15 which is one too
28304 big for signed 16 bits. The implementation can treat this as:
28306 @example
28307 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
28308 @end example
28310 and the Ada language design team felt that this was too annoying
28311 to require. We don't need to debate this decision at this point,
28312 since it is well established (the rule about narrowing the ranges
28313 dates to Ada 83).
28315 But the important point is that an implementation is not required
28316 to do this narrowing, so we have a potential portability problem.
28317 We could imagine three types of implementation:
28320 @enumerate a
28322 @item 
28323 those that narrow the range automatically if they can figure
28324 out that the narrower range will allow storage in a smaller machine unit,
28326 @item 
28327 those that will narrow only if forced to by a @cite{'Size} clause, and
28329 @item 
28330 those that will never narrow.
28331 @end enumerate
28333 Now if we are language theoreticians, we can imagine a fourth
28334 approach: to narrow all the time, e.g. to treat
28336 @example
28337 type F3 is delta 1.0 range -10.0 .. +23.0;
28338 @end example
28340 as though it had been written:
28342 @example
28343 type F3 is delta 1.0 range -9.0 .. +22.0;
28344 @end example
28346 But although technically allowed, such a behavior would be hostile and silly,
28347 and no real compiler would do this. All real compilers will fall into one of
28348 the categories (a), (b) or (c) above.
28350 So, how do you get the compiler to do what you want? The answer is give the
28351 actual bounds you want, and then use a @cite{'Small} clause and a
28352 @cite{'Size} clause to absolutely pin down what the compiler does.
28353 E.g., for @cite{F2} above, we will write:
28355 @example
28356 My_Small : constant := 2.0**(-15);
28357 My_First : constant := -1.0;
28358 My_Last  : constant := +1.0 - My_Small;
28360 type F2 is delta My_Small range My_First .. My_Last;
28361 @end example
28363 and then add
28365 @example
28366 for F2'Small use my_Small;
28367 for F2'Size  use 16;
28368 @end example
28370 In practice all compilers will do the same thing here and will give you
28371 what you want, so the above declarations are fully portable. If you really
28372 want to play language lawyer and guard against ludicrous behavior by the
28373 compiler you could add
28375 @example
28376 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28377 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
28378 @end example
28380 One or other or both are allowed to be illegal if the compiler is
28381 behaving in a silly manner, but at least the silly compiler will not
28382 get away with silently messing with your (very clear) intentions.
28384 If you follow this scheme you will be guaranteed that your fixed-point
28385 types will be portable.
28387 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
28388 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{42d}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{42e}
28389 @section Compatibility with Ada 83
28392 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
28394 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
28395 are highly upwards compatible with Ada 83.  In
28396 particular, the design intention was that the difficulties associated
28397 with moving from Ada 83 to later versions of the standard should be no greater
28398 than those that occur when moving from one Ada 83 system to another.
28400 However, there are a number of points at which there are minor
28401 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
28402 full details of these issues as they relate to Ada 95,
28403 and should be consulted for a complete treatment.
28404 In practice the
28405 following subsections treat the most likely issues to be encountered.
28407 @menu
28408 * Legal Ada 83 programs that are illegal in Ada 95:: 
28409 * More deterministic semantics:: 
28410 * Changed semantics:: 
28411 * Other language compatibility issues:: 
28413 @end menu
28415 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
28416 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{42f}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{430}
28417 @subsection Legal Ada 83 programs that are illegal in Ada 95
28420 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
28421 Ada 95 and later versions of the standard:
28424 @itemize *
28426 @item 
28427 @emph{Character literals}
28429 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
28430 @cite{Wide_Character} as a new predefined character type, some uses of
28431 character literals that were legal in Ada 83 are illegal in Ada 95.
28432 For example:
28434 @example
28435 for Char in 'A' .. 'Z' loop ... end loop;
28436 @end example
28438 The problem is that 'A' and 'Z' could be from either
28439 @cite{Character} or @cite{Wide_Character}.  The simplest correction
28440 is to make the type explicit; e.g.:
28442 @example
28443 for Char in Character range 'A' .. 'Z' loop ... end loop;
28444 @end example
28446 @item 
28447 @emph{New reserved words}
28449 The identifiers @cite{abstract}, @cite{aliased}, @cite{protected},
28450 @cite{requeue}, @cite{tagged}, and @cite{until} are reserved in Ada 95.
28451 Existing Ada 83 code using any of these identifiers must be edited to
28452 use some alternative name.
28454 @item 
28455 @emph{Freezing rules}
28457 The rules in Ada 95 are slightly different with regard to the point at
28458 which entities are frozen, and representation pragmas and clauses are
28459 not permitted past the freeze point.  This shows up most typically in
28460 the form of an error message complaining that a representation item
28461 appears too late, and the appropriate corrective action is to move
28462 the item nearer to the declaration of the entity to which it refers.
28464 A particular case is that representation pragmas
28465 cannot be applied to a subprogram body.  If necessary, a separate subprogram
28466 declaration must be introduced to which the pragma can be applied.
28468 @item 
28469 @emph{Optional bodies for library packages}
28471 In Ada 83, a package that did not require a package body was nevertheless
28472 allowed to have one.  This lead to certain surprises in compiling large
28473 systems (situations in which the body could be unexpectedly ignored by the
28474 binder).  In Ada 95, if a package does not require a body then it is not
28475 permitted to have a body.  To fix this problem, simply remove a redundant
28476 body if it is empty, or, if it is non-empty, introduce a dummy declaration
28477 into the spec that makes the body required.  One approach is to add a private
28478 part to the package declaration (if necessary), and define a parameterless
28479 procedure called @cite{Requires_Body}, which must then be given a dummy
28480 procedure body in the package body, which then becomes required.
28481 Another approach (assuming that this does not introduce elaboration
28482 circularities) is to add an @cite{Elaborate_Body} pragma to the package spec,
28483 since one effect of this pragma is to require the presence of a package body.
28485 @item 
28486 @emph{Numeric_Error is the same exception as Constraint_Error}
28488 In Ada 95, the exception @cite{Numeric_Error} is a renaming of @cite{Constraint_Error}.
28489 This means that it is illegal to have separate exception handlers for
28490 the two exceptions.  The fix is simply to remove the handler for the
28491 @cite{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
28492 @cite{Constraint_Error} in place of @cite{Numeric_Error} in all cases).
28494 @item 
28495 @emph{Indefinite subtypes in generics}
28497 In Ada 83, it was permissible to pass an indefinite type (e.g, @cite{String})
28498 as the actual for a generic formal private type, but then the instantiation
28499 would be illegal if there were any instances of declarations of variables
28500 of this type in the generic body.  In Ada 95, to avoid this clear violation
28501 of the methodological principle known as the 'contract model',
28502 the generic declaration explicitly indicates whether
28503 or not such instantiations are permitted.  If a generic formal parameter
28504 has explicit unknown discriminants, indicated by using @cite{(<>)} after the
28505 subtype name, then it can be instantiated with indefinite types, but no
28506 stand-alone variables can be declared of this type.  Any attempt to declare
28507 such a variable will result in an illegality at the time the generic is
28508 declared.  If the @cite{(<>)} notation is not used, then it is illegal
28509 to instantiate the generic with an indefinite type.
28510 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
28511 It will show up as a compile time error, and
28512 the fix is usually simply to add the @cite{(<>)} to the generic declaration.
28513 @end itemize
28515 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
28516 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{431}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{432}
28517 @subsection More deterministic semantics
28521 @itemize *
28523 @item 
28524 @emph{Conversions}
28526 Conversions from real types to integer types round away from 0.  In Ada 83
28527 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
28528 implementation freedom was intended to support unbiased rounding in
28529 statistical applications, but in practice it interfered with portability.
28530 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
28531 is required.  Numeric code may be affected by this change in semantics.
28532 Note, though, that this issue is no worse than already existed in Ada 83
28533 when porting code from one vendor to another.
28535 @item 
28536 @emph{Tasking}
28538 The Real-Time Annex introduces a set of policies that define the behavior of
28539 features that were implementation dependent in Ada 83, such as the order in
28540 which open select branches are executed.
28541 @end itemize
28543 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
28544 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{433}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{434}
28545 @subsection Changed semantics
28548 The worst kind of incompatibility is one where a program that is legal in
28549 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
28550 possible in Ada 83.  Fortunately this is extremely rare, but the one
28551 situation that you should be alert to is the change in the predefined type
28552 @cite{Character} from 7-bit ASCII to 8-bit Latin-1.
28554 @quotation
28556 @geindex Latin-1
28557 @end quotation
28560 @itemize *
28562 @item 
28563 @emph{Range of type `Character`}
28565 The range of @cite{Standard.Character} is now the full 256 characters
28566 of Latin-1, whereas in most Ada 83 implementations it was restricted
28567 to 128 characters. Although some of the effects of
28568 this change will be manifest in compile-time rejection of legal
28569 Ada 83 programs it is possible for a working Ada 83 program to have
28570 a different effect in Ada 95, one that was not permitted in Ada 83.
28571 As an example, the expression
28572 @cite{Character'Pos(Character'Last)} returned @cite{127} in Ada 83 and now
28573 delivers @cite{255} as its value.
28574 In general, you should look at the logic of any
28575 character-processing Ada 83 program and see whether it needs to be adapted
28576 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
28577 character handling package that may be relevant if code needs to be adapted
28578 to account for the additional Latin-1 elements.
28579 The desirable fix is to
28580 modify the program to accommodate the full character set, but in some cases
28581 it may be convenient to define a subtype or derived type of Character that
28582 covers only the restricted range.
28583 @end itemize
28585 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
28586 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{435}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{436}
28587 @subsection Other language compatibility issues
28591 @itemize *
28593 @item 
28594 @emph{-gnat83} switch
28596 All implementations of GNAT provide a switch that causes GNAT to operate
28597 in Ada 83 mode.  In this mode, some but not all compatibility problems
28598 of the type described above are handled automatically.  For example, the
28599 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
28600 as identifiers as in Ada 83.  However,
28601 in practice, it is usually advisable to make the necessary modifications
28602 to the program to remove the need for using this switch.
28603 See the @cite{Compiling Different Versions of Ada} section in
28604 the @cite{GNAT User's Guide}.
28606 @item 
28607 Support for removed Ada 83 pragmas and attributes
28609 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
28610 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
28611 compilers are allowed, but not required, to implement these missing
28612 elements.  In contrast with some other compilers, GNAT implements all
28613 such pragmas and attributes, eliminating this compatibility concern.  These
28614 include @cite{pragma Interface} and the floating point type attributes
28615 (@cite{Emax}, @cite{Mantissa}, etc.), among other items.
28616 @end itemize
28618 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
28619 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{437}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{438}
28620 @section Compatibility between Ada 95 and Ada 2005
28623 @geindex Compatibility between Ada 95 and Ada 2005
28625 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
28626 a number of incompatibilities. Several are enumerated below;
28627 for a complete description please see the
28628 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
28629 @cite{Rationale for Ada 2005}.
28632 @itemize *
28634 @item 
28635 @emph{New reserved words.}
28637 The words @cite{interface}, @cite{overriding} and @cite{synchronized} are
28638 reserved in Ada 2005.
28639 A pre-Ada 2005 program that uses any of these as an identifier will be
28640 illegal.
28642 @item 
28643 @emph{New declarations in predefined packages.}
28645 A number of packages in the predefined environment contain new declarations:
28646 @cite{Ada.Exceptions}, @cite{Ada.Real_Time}, @cite{Ada.Strings},
28647 @cite{Ada.Strings.Fixed}, @cite{Ada.Strings.Bounded},
28648 @cite{Ada.Strings.Unbounded}, @cite{Ada.Strings.Wide_Fixed},
28649 @cite{Ada.Strings.Wide_Bounded}, @cite{Ada.Strings.Wide_Unbounded},
28650 @cite{Ada.Tags}, @cite{Ada.Text_IO}, and @cite{Interfaces.C}.
28651 If an Ada 95 program does a @cite{with} and @cite{use} of any of these
28652 packages, the new declarations may cause name clashes.
28654 @item 
28655 @emph{Access parameters.}
28657 A nondispatching subprogram with an access parameter cannot be renamed
28658 as a dispatching operation.  This was permitted in Ada 95.
28660 @item 
28661 @emph{Access types, discriminants, and constraints.}
28663 Rule changes in this area have led to some incompatibilities; for example,
28664 constrained subtypes of some access types are not permitted in Ada 2005.
28666 @item 
28667 @emph{Aggregates for limited types.}
28669 The allowance of aggregates for limited types in Ada 2005 raises the
28670 possibility of ambiguities in legal Ada 95 programs, since additional types
28671 now need to be considered in expression resolution.
28673 @item 
28674 @emph{Fixed-point multiplication and division.}
28676 Certain expressions involving '*' or '/' for a fixed-point type, which
28677 were legal in Ada 95 and invoked the predefined versions of these operations,
28678 are now ambiguous.
28679 The ambiguity may be resolved either by applying a type conversion to the
28680 expression, or by explicitly invoking the operation from package
28681 @cite{Standard}.
28683 @item 
28684 @emph{Return-by-reference types.}
28686 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
28687 can declare a function returning a value from an anonymous access type.
28688 @end itemize
28690 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
28691 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{439}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{43a}
28692 @section Implementation-dependent characteristics
28695 Although the Ada language defines the semantics of each construct as
28696 precisely as practical, in some situations (for example for reasons of
28697 efficiency, or where the effect is heavily dependent on the host or target
28698 platform) the implementation is allowed some freedom.  In porting Ada 83
28699 code to GNAT, you need to be aware of whether / how the existing code
28700 exercised such implementation dependencies.  Such characteristics fall into
28701 several categories, and GNAT offers specific support in assisting the
28702 transition from certain Ada 83 compilers.
28704 @menu
28705 * Implementation-defined pragmas:: 
28706 * Implementation-defined attributes:: 
28707 * Libraries:: 
28708 * Elaboration order:: 
28709 * Target-specific aspects:: 
28711 @end menu
28713 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
28714 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{43b}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{43c}
28715 @subsection Implementation-defined pragmas
28718 Ada compilers are allowed to supplement the language-defined pragmas, and
28719 these are a potential source of non-portability.  All GNAT-defined pragmas
28720 are described in the @cite{Implementation Defined Pragmas} chapter of the
28721 @cite{GNAT Reference Manual}, and these include several that are specifically
28722 intended to correspond to other vendors' Ada 83 pragmas.
28723 For migrating from VADS, the pragma @cite{Use_VADS_Size} may be useful.
28724 For compatibility with HP Ada 83, GNAT supplies the pragmas
28725 @cite{Extend_System}, @cite{Ident}, @cite{Inline_Generic},
28726 @cite{Interface_Name}, @cite{Passive}, @cite{Suppress_All},
28727 and @cite{Volatile}.
28728 Other relevant pragmas include @cite{External} and @cite{Link_With}.
28729 Some vendor-specific
28730 Ada 83 pragmas (@cite{Share_Generic}, @cite{Subtitle}, and @cite{Title}) are
28731 recognized, thus
28732 avoiding compiler rejection of units that contain such pragmas; they are not
28733 relevant in a GNAT context and hence are not otherwise implemented.
28735 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
28736 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{43d}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{43e}
28737 @subsection Implementation-defined attributes
28740 Analogous to pragmas, the set of attributes may be extended by an
28741 implementation.  All GNAT-defined attributes are described in
28742 @cite{Implementation Defined Attributes} section of the
28743 @cite{GNAT Reference Manual}, and these include several that are specifically intended
28744 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
28745 the attribute @cite{VADS_Size} may be useful.  For compatibility with HP
28746 Ada 83, GNAT supplies the attributes @cite{Bit}, @cite{Machine_Size} and
28747 @cite{Type_Class}.
28749 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
28750 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{43f}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{440}
28751 @subsection Libraries
28754 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
28755 code uses vendor-specific libraries then there are several ways to manage
28756 this in Ada 95 and later versions of the standard:
28759 @itemize *
28761 @item 
28762 If the source code for the libraries (specs and bodies) are
28763 available, then the libraries can be migrated in the same way as the
28764 application.
28766 @item 
28767 If the source code for the specs but not the bodies are
28768 available, then you can reimplement the bodies.
28770 @item 
28771 Some features introduced by Ada 95 obviate the need for library support.  For
28772 example most Ada 83 vendors supplied a package for unsigned integers.  The
28773 Ada 95 modular type feature is the preferred way to handle this need, so
28774 instead of migrating or reimplementing the unsigned integer package it may
28775 be preferable to retrofit the application using modular types.
28776 @end itemize
28778 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
28779 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{441}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{442}
28780 @subsection Elaboration order
28783 The implementation can choose any elaboration order consistent with the unit
28784 dependency relationship.  This freedom means that some orders can result in
28785 Program_Error being raised due to an 'Access Before Elaboration': an attempt
28786 to invoke a subprogram before its body has been elaborated, or to instantiate
28787 a generic before the generic body has been elaborated.  By default GNAT
28788 attempts to choose a safe order (one that will not encounter access before
28789 elaboration problems) by implicitly inserting @cite{Elaborate} or
28790 @cite{Elaborate_All} pragmas where
28791 needed.  However, this can lead to the creation of elaboration circularities
28792 and a resulting rejection of the program by gnatbind.  This issue is
28793 thoroughly described in the @cite{Elaboration Order Handling in GNAT} appendix
28794 in the @cite{GNAT User's Guide}.
28795 In brief, there are several
28796 ways to deal with this situation:
28799 @itemize *
28801 @item 
28802 Modify the program to eliminate the circularities, e.g., by moving
28803 elaboration-time code into explicitly-invoked procedures
28805 @item 
28806 Constrain the elaboration order by including explicit @cite{Elaborate_Body} or
28807 @cite{Elaborate} pragmas, and then inhibit the generation of implicit
28808 @cite{Elaborate_All}
28809 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
28810 (by selectively suppressing elaboration checks via pragma
28811 @cite{Suppress(Elaboration_Check)} when it is safe to do so).
28812 @end itemize
28814 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
28815 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{443}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{444}
28816 @subsection Target-specific aspects
28819 Low-level applications need to deal with machine addresses, data
28820 representations, interfacing with assembler code, and similar issues.  If
28821 such an Ada 83 application is being ported to different target hardware (for
28822 example where the byte endianness has changed) then you will need to
28823 carefully examine the program logic; the porting effort will heavily depend
28824 on the robustness of the original design.  Moreover, Ada 95 (and thus
28825 Ada 2005 and Ada 2012) are sometimes
28826 incompatible with typical Ada 83 compiler practices regarding implicit
28827 packing, the meaning of the Size attribute, and the size of access values.
28828 GNAT's approach to these issues is described in @ref{445,,Representation Clauses}.
28830 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
28831 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{446}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{447}
28832 @section Compatibility with Other Ada Systems
28835 If programs avoid the use of implementation dependent and
28836 implementation defined features, as documented in the
28837 @cite{Ada Reference Manual}, there should be a high degree of portability between
28838 GNAT and other Ada systems.  The following are specific items which
28839 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
28840 compilers, but do not affect porting code to GNAT.
28841 (As of January 2007, GNAT is the only compiler available for Ada 2005;
28842 the following issues may or may not arise for Ada 2005 programs
28843 when other compilers appear.)
28846 @itemize *
28848 @item 
28849 @emph{Ada 83 Pragmas and Attributes}
28851 Ada 95 compilers are allowed, but not required, to implement the missing
28852 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
28853 GNAT implements all such pragmas and attributes, eliminating this as
28854 a compatibility concern, but some other Ada 95 compilers reject these
28855 pragmas and attributes.
28857 @item 
28858 @emph{Specialized Needs Annexes}
28860 GNAT implements the full set of special needs annexes.  At the
28861 current time, it is the only Ada 95 compiler to do so.  This means that
28862 programs making use of these features may not be portable to other Ada
28863 95 compilation systems.
28865 @item 
28866 @emph{Representation Clauses}
28868 Some other Ada 95 compilers implement only the minimal set of
28869 representation clauses required by the Ada 95 reference manual.  GNAT goes
28870 far beyond this minimal set, as described in the next section.
28871 @end itemize
28873 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
28874 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{445}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{448}
28875 @section Representation Clauses
28878 The Ada 83 reference manual was quite vague in describing both the minimal
28879 required implementation of representation clauses, and also their precise
28880 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
28881 minimal set of capabilities required is still quite limited.
28883 GNAT implements the full required set of capabilities in
28884 Ada 95 and Ada 2005, but also goes much further, and in particular
28885 an effort has been made to be compatible with existing Ada 83 usage to the
28886 greatest extent possible.
28888 A few cases exist in which Ada 83 compiler behavior is incompatible with
28889 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
28890 intentional or accidental dependence on specific implementation dependent
28891 characteristics of these Ada 83 compilers.  The following is a list of
28892 the cases most likely to arise in existing Ada 83 code.
28895 @itemize *
28897 @item 
28898 @emph{Implicit Packing}
28900 Some Ada 83 compilers allowed a Size specification to cause implicit
28901 packing of an array or record.  This could cause expensive implicit
28902 conversions for change of representation in the presence of derived
28903 types, and the Ada design intends to avoid this possibility.
28904 Subsequent AI's were issued to make it clear that such implicit
28905 change of representation in response to a Size clause is inadvisable,
28906 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
28907 Reference Manuals as implementation advice that is followed by GNAT.
28908 The problem will show up as an error
28909 message rejecting the size clause.  The fix is simply to provide
28910 the explicit pragma @cite{Pack}, or for more fine tuned control, provide
28911 a Component_Size clause.
28913 @item 
28914 @emph{Meaning of Size Attribute}
28916 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
28917 the minimal number of bits required to hold values of the type.  For example,
28918 on a 32-bit machine, the size of @cite{Natural} will typically be 31 and not
28919 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
28920 some 32 in this situation.  This problem will usually show up as a compile
28921 time error, but not always.  It is a good idea to check all uses of the
28922 'Size attribute when porting Ada 83 code.  The GNAT specific attribute
28923 Object_Size can provide a useful way of duplicating the behavior of
28924 some Ada 83 compiler systems.
28926 @item 
28927 @emph{Size of Access Types}
28929 A common assumption in Ada 83 code is that an access type is in fact a pointer,
28930 and that therefore it will be the same size as a System.Address value.  This
28931 assumption is true for GNAT in most cases with one exception.  For the case of
28932 a pointer to an unconstrained array type (where the bounds may vary from one
28933 value of the access type to another), the default is to use a 'fat pointer',
28934 which is represented as two separate pointers, one to the bounds, and one to
28935 the array.  This representation has a number of advantages, including improved
28936 efficiency.  However, it may cause some difficulties in porting existing Ada 83
28937 code which makes the assumption that, for example, pointers fit in 32 bits on
28938 a machine with 32-bit addressing.
28940 To get around this problem, GNAT also permits the use of 'thin pointers' for
28941 access types in this case (where the designated type is an unconstrained array
28942 type).  These thin pointers are indeed the same size as a System.Address value.
28943 To specify a thin pointer, use a size clause for the type, for example:
28945 @example
28946 type X is access all String;
28947 for X'Size use Standard'Address_Size;
28948 @end example
28950 which will cause the type X to be represented using a single pointer.
28951 When using this representation, the bounds are right behind the array.
28952 This representation is slightly less efficient, and does not allow quite
28953 such flexibility in the use of foreign pointers or in using the
28954 Unrestricted_Access attribute to create pointers to non-aliased objects.
28955 But for any standard portable use of the access type it will work in
28956 a functionally correct manner and allow porting of existing code.
28957 Note that another way of forcing a thin pointer representation
28958 is to use a component size clause for the element size in an array,
28959 or a record representation clause for an access field in a record.
28961 See the documentation of Unrestricted_Access in the GNAT RM for a
28962 full discussion of possible problems using this attribute in conjunction
28963 with thin pointers.
28964 @end itemize
28966 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
28967 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{449}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{44a}
28968 @section Compatibility with HP Ada 83
28971 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
28972 of them can sensibly be implemented.  The description of pragmas in
28973 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
28974 applicable to GNAT.
28977 @itemize *
28979 @item 
28980 @emph{Default floating-point representation}
28982 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
28983 it is VMS format.
28985 @item 
28986 @emph{System}
28988 the package System in GNAT exactly corresponds to the definition in the
28989 Ada 95 reference manual, which means that it excludes many of the
28990 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
28991 that contains the additional definitions, and a special pragma,
28992 Extend_System allows this package to be treated transparently as an
28993 extension of package System.
28994 @end itemize
28996 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
28997 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{44b}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{44c}
28998 @chapter GNU Free Documentation License
29001 Version 1.3, 3 November 2008
29003 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
29004 @indicateurl{http://fsf.org/}
29006 Everyone is permitted to copy and distribute verbatim copies of this
29007 license document, but changing it is not allowed.
29009 @strong{Preamble}
29011 The purpose of this License is to make a manual, textbook, or other
29012 functional and useful document "free" in the sense of freedom: to
29013 assure everyone the effective freedom to copy and redistribute it,
29014 with or without modifying it, either commercially or noncommercially.
29015 Secondarily, this License preserves for the author and publisher a way
29016 to get credit for their work, while not being considered responsible
29017 for modifications made by others.
29019 This License is a kind of "copyleft", which means that derivative
29020 works of the document must themselves be free in the same sense.  It
29021 complements the GNU General Public License, which is a copyleft
29022 license designed for free software.
29024 We have designed this License in order to use it for manuals for free
29025 software, because free software needs free documentation: a free
29026 program should come with manuals providing the same freedoms that the
29027 software does.  But this License is not limited to software manuals;
29028 it can be used for any textual work, regardless of subject matter or
29029 whether it is published as a printed book.  We recommend this License
29030 principally for works whose purpose is instruction or reference.
29032 @strong{1. APPLICABILITY AND DEFINITIONS}
29034 This License applies to any manual or other work, in any medium, that
29035 contains a notice placed by the copyright holder saying it can be
29036 distributed under the terms of this License.  Such a notice grants a
29037 world-wide, royalty-free license, unlimited in duration, to use that
29038 work under the conditions stated herein.  The @strong{Document}, below,
29039 refers to any such manual or work.  Any member of the public is a
29040 licensee, and is addressed as "@strong{you}".  You accept the license if you
29041 copy, modify or distribute the work in a way requiring permission
29042 under copyright law.
29044 A "@strong{Modified Version}" of the Document means any work containing the
29045 Document or a portion of it, either copied verbatim, or with
29046 modifications and/or translated into another language.
29048 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
29049 the Document that deals exclusively with the relationship of the
29050 publishers or authors of the Document to the Document's overall subject
29051 (or to related matters) and contains nothing that could fall directly
29052 within that overall subject.  (Thus, if the Document is in part a
29053 textbook of mathematics, a Secondary Section may not explain any
29054 mathematics.)  The relationship could be a matter of historical
29055 connection with the subject or with related matters, or of legal,
29056 commercial, philosophical, ethical or political position regarding
29057 them.
29059 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
29060 are designated, as being those of Invariant Sections, in the notice
29061 that says that the Document is released under this License.  If a
29062 section does not fit the above definition of Secondary then it is not
29063 allowed to be designated as Invariant.  The Document may contain zero
29064 Invariant Sections.  If the Document does not identify any Invariant
29065 Sections then there are none.
29067 The "@strong{Cover Texts}" are certain short passages of text that are listed,
29068 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
29069 the Document is released under this License.  A Front-Cover Text may
29070 be at most 5 words, and a Back-Cover Text may be at most 25 words.
29072 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
29073 represented in a format whose specification is available to the
29074 general public, that is suitable for revising the document
29075 straightforwardly with generic text editors or (for images composed of
29076 pixels) generic paint programs or (for drawings) some widely available
29077 drawing editor, and that is suitable for input to text formatters or
29078 for automatic translation to a variety of formats suitable for input
29079 to text formatters.  A copy made in an otherwise Transparent file
29080 format whose markup, or absence of markup, has been arranged to thwart
29081 or discourage subsequent modification by readers is not Transparent.
29082 An image format is not Transparent if used for any substantial amount
29083 of text.  A copy that is not "Transparent" is called @strong{Opaque}.
29085 Examples of suitable formats for Transparent copies include plain
29086 ASCII without markup, Texinfo input format, LaTeX input format, SGML
29087 or XML using a publicly available DTD, and standard-conforming simple
29088 HTML, PostScript or PDF designed for human modification.  Examples of
29089 transparent image formats include PNG, XCF and JPG.  Opaque formats
29090 include proprietary formats that can be read and edited only by
29091 proprietary word processors, SGML or XML for which the DTD and/or
29092 processing tools are not generally available, and the
29093 machine-generated HTML, PostScript or PDF produced by some word
29094 processors for output purposes only.
29096 The "@strong{Title Page}" means, for a printed book, the title page itself,
29097 plus such following pages as are needed to hold, legibly, the material
29098 this License requires to appear in the title page.  For works in
29099 formats which do not have any title page as such, "Title Page" means
29100 the text near the most prominent appearance of the work's title,
29101 preceding the beginning of the body of the text.
29103 The "@strong{publisher}" means any person or entity that distributes
29104 copies of the Document to the public.
29106 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
29107 title either is precisely XYZ or contains XYZ in parentheses following
29108 text that translates XYZ in another language.  (Here XYZ stands for a
29109 specific section name mentioned below, such as "@strong{Acknowledgements}",
29110 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
29111 To "@strong{Preserve the Title}"
29112 of such a section when you modify the Document means that it remains a
29113 section "Entitled XYZ" according to this definition.
29115 The Document may include Warranty Disclaimers next to the notice which
29116 states that this License applies to the Document.  These Warranty
29117 Disclaimers are considered to be included by reference in this
29118 License, but only as regards disclaiming warranties: any other
29119 implication that these Warranty Disclaimers may have is void and has
29120 no effect on the meaning of this License.
29122 @strong{2. VERBATIM COPYING}
29124 You may copy and distribute the Document in any medium, either
29125 commercially or noncommercially, provided that this License, the
29126 copyright notices, and the license notice saying this License applies
29127 to the Document are reproduced in all copies, and that you add no other
29128 conditions whatsoever to those of this License.  You may not use
29129 technical measures to obstruct or control the reading or further
29130 copying of the copies you make or distribute.  However, you may accept
29131 compensation in exchange for copies.  If you distribute a large enough
29132 number of copies you must also follow the conditions in section 3.
29134 You may also lend copies, under the same conditions stated above, and
29135 you may publicly display copies.
29137 @strong{3. COPYING IN QUANTITY}
29139 If you publish printed copies (or copies in media that commonly have
29140 printed covers) of the Document, numbering more than 100, and the
29141 Document's license notice requires Cover Texts, you must enclose the
29142 copies in covers that carry, clearly and legibly, all these Cover
29143 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
29144 the back cover.  Both covers must also clearly and legibly identify
29145 you as the publisher of these copies.  The front cover must present
29146 the full title with all words of the title equally prominent and
29147 visible.  You may add other material on the covers in addition.
29148 Copying with changes limited to the covers, as long as they preserve
29149 the title of the Document and satisfy these conditions, can be treated
29150 as verbatim copying in other respects.
29152 If the required texts for either cover are too voluminous to fit
29153 legibly, you should put the first ones listed (as many as fit
29154 reasonably) on the actual cover, and continue the rest onto adjacent
29155 pages.
29157 If you publish or distribute Opaque copies of the Document numbering
29158 more than 100, you must either include a machine-readable Transparent
29159 copy along with each Opaque copy, or state in or with each Opaque copy
29160 a computer-network location from which the general network-using
29161 public has access to download using public-standard network protocols
29162 a complete Transparent copy of the Document, free of added material.
29163 If you use the latter option, you must take reasonably prudent steps,
29164 when you begin distribution of Opaque copies in quantity, to ensure
29165 that this Transparent copy will remain thus accessible at the stated
29166 location until at least one year after the last time you distribute an
29167 Opaque copy (directly or through your agents or retailers) of that
29168 edition to the public.
29170 It is requested, but not required, that you contact the authors of the
29171 Document well before redistributing any large number of copies, to give
29172 them a chance to provide you with an updated version of the Document.
29174 @strong{4. MODIFICATIONS}
29176 You may copy and distribute a Modified Version of the Document under
29177 the conditions of sections 2 and 3 above, provided that you release
29178 the Modified Version under precisely this License, with the Modified
29179 Version filling the role of the Document, thus licensing distribution
29180 and modification of the Modified Version to whoever possesses a copy
29181 of it.  In addition, you must do these things in the Modified Version:
29184 @enumerate A
29186 @item 
29187 Use in the Title Page (and on the covers, if any) a title distinct
29188 from that of the Document, and from those of previous versions
29189 (which should, if there were any, be listed in the History section
29190 of the Document).  You may use the same title as a previous version
29191 if the original publisher of that version gives permission.
29193 @item 
29194 List on the Title Page, as authors, one or more persons or entities
29195 responsible for authorship of the modifications in the Modified
29196 Version, together with at least five of the principal authors of the
29197 Document (all of its principal authors, if it has fewer than five),
29198 unless they release you from this requirement.
29200 @item 
29201 State on the Title page the name of the publisher of the
29202 Modified Version, as the publisher.
29204 @item 
29205 Preserve all the copyright notices of the Document.
29207 @item 
29208 Add an appropriate copyright notice for your modifications
29209 adjacent to the other copyright notices.
29211 @item 
29212 Include, immediately after the copyright notices, a license notice
29213 giving the public permission to use the Modified Version under the
29214 terms of this License, in the form shown in the Addendum below.
29216 @item 
29217 Preserve in that license notice the full lists of Invariant Sections
29218 and required Cover Texts given in the Document's license notice.
29220 @item 
29221 Include an unaltered copy of this License.
29223 @item 
29224 Preserve the section Entitled "History", Preserve its Title, and add
29225 to it an item stating at least the title, year, new authors, and
29226 publisher of the Modified Version as given on the Title Page.  If
29227 there is no section Entitled "History" in the Document, create one
29228 stating the title, year, authors, and publisher of the Document as
29229 given on its Title Page, then add an item describing the Modified
29230 Version as stated in the previous sentence.
29232 @item 
29233 Preserve the network location, if any, given in the Document for
29234 public access to a Transparent copy of the Document, and likewise
29235 the network locations given in the Document for previous versions
29236 it was based on.  These may be placed in the "History" section.
29237 You may omit a network location for a work that was published at
29238 least four years before the Document itself, or if the original
29239 publisher of the version it refers to gives permission.
29241 @item 
29242 For any section Entitled "Acknowledgements" or "Dedications",
29243 Preserve the Title of the section, and preserve in the section all
29244 the substance and tone of each of the contributor acknowledgements
29245 and/or dedications given therein.
29247 @item 
29248 Preserve all the Invariant Sections of the Document,
29249 unaltered in their text and in their titles.  Section numbers
29250 or the equivalent are not considered part of the section titles.
29252 @item 
29253 Delete any section Entitled "Endorsements".  Such a section
29254 may not be included in the Modified Version.
29256 @item 
29257 Do not retitle any existing section to be Entitled "Endorsements"
29258 or to conflict in title with any Invariant Section.
29260 @item 
29261 Preserve any Warranty Disclaimers.
29262 @end enumerate
29264 If the Modified Version includes new front-matter sections or
29265 appendices that qualify as Secondary Sections and contain no material
29266 copied from the Document, you may at your option designate some or all
29267 of these sections as invariant.  To do this, add their titles to the
29268 list of Invariant Sections in the Modified Version's license notice.
29269 These titles must be distinct from any other section titles.
29271 You may add a section Entitled "Endorsements", provided it contains
29272 nothing but endorsements of your Modified Version by various
29273 parties---for example, statements of peer review or that the text has
29274 been approved by an organization as the authoritative definition of a
29275 standard.
29277 You may add a passage of up to five words as a Front-Cover Text, and a
29278 passage of up to 25 words as a Back-Cover Text, to the end of the list
29279 of Cover Texts in the Modified Version.  Only one passage of
29280 Front-Cover Text and one of Back-Cover Text may be added by (or
29281 through arrangements made by) any one entity.  If the Document already
29282 includes a cover text for the same cover, previously added by you or
29283 by arrangement made by the same entity you are acting on behalf of,
29284 you may not add another; but you may replace the old one, on explicit
29285 permission from the previous publisher that added the old one.
29287 The author(s) and publisher(s) of the Document do not by this License
29288 give permission to use their names for publicity for or to assert or
29289 imply endorsement of any Modified Version.
29291 @strong{5. COMBINING DOCUMENTS}
29293 You may combine the Document with other documents released under this
29294 License, under the terms defined in section 4 above for modified
29295 versions, provided that you include in the combination all of the
29296 Invariant Sections of all of the original documents, unmodified, and
29297 list them all as Invariant Sections of your combined work in its
29298 license notice, and that you preserve all their Warranty Disclaimers.
29300 The combined work need only contain one copy of this License, and
29301 multiple identical Invariant Sections may be replaced with a single
29302 copy.  If there are multiple Invariant Sections with the same name but
29303 different contents, make the title of each such section unique by
29304 adding at the end of it, in parentheses, the name of the original
29305 author or publisher of that section if known, or else a unique number.
29306 Make the same adjustment to the section titles in the list of
29307 Invariant Sections in the license notice of the combined work.
29309 In the combination, you must combine any sections Entitled "History"
29310 in the various original documents, forming one section Entitled
29311 "History"; likewise combine any sections Entitled "Acknowledgements",
29312 and any sections Entitled "Dedications".  You must delete all sections
29313 Entitled "Endorsements".
29315 @strong{6. COLLECTIONS OF DOCUMENTS}
29317 You may make a collection consisting of the Document and other documents
29318 released under this License, and replace the individual copies of this
29319 License in the various documents with a single copy that is included in
29320 the collection, provided that you follow the rules of this License for
29321 verbatim copying of each of the documents in all other respects.
29323 You may extract a single document from such a collection, and distribute
29324 it individually under this License, provided you insert a copy of this
29325 License into the extracted document, and follow this License in all
29326 other respects regarding verbatim copying of that document.
29328 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
29330 A compilation of the Document or its derivatives with other separate
29331 and independent documents or works, in or on a volume of a storage or
29332 distribution medium, is called an "aggregate" if the copyright
29333 resulting from the compilation is not used to limit the legal rights
29334 of the compilation's users beyond what the individual works permit.
29335 When the Document is included in an aggregate, this License does not
29336 apply to the other works in the aggregate which are not themselves
29337 derivative works of the Document.
29339 If the Cover Text requirement of section 3 is applicable to these
29340 copies of the Document, then if the Document is less than one half of
29341 the entire aggregate, the Document's Cover Texts may be placed on
29342 covers that bracket the Document within the aggregate, or the
29343 electronic equivalent of covers if the Document is in electronic form.
29344 Otherwise they must appear on printed covers that bracket the whole
29345 aggregate.
29347 @strong{8. TRANSLATION}
29349 Translation is considered a kind of modification, so you may
29350 distribute translations of the Document under the terms of section 4.
29351 Replacing Invariant Sections with translations requires special
29352 permission from their copyright holders, but you may include
29353 translations of some or all Invariant Sections in addition to the
29354 original versions of these Invariant Sections.  You may include a
29355 translation of this License, and all the license notices in the
29356 Document, and any Warranty Disclaimers, provided that you also include
29357 the original English version of this License and the original versions
29358 of those notices and disclaimers.  In case of a disagreement between
29359 the translation and the original version of this License or a notice
29360 or disclaimer, the original version will prevail.
29362 If a section in the Document is Entitled "Acknowledgements",
29363 "Dedications", or "History", the requirement (section 4) to Preserve
29364 its Title (section 1) will typically require changing the actual
29365 title.
29367 @strong{9. TERMINATION}
29369 You may not copy, modify, sublicense, or distribute the Document
29370 except as expressly provided under this License.  Any attempt
29371 otherwise to copy, modify, sublicense, or distribute it is void, and
29372 will automatically terminate your rights under this License.
29374 However, if you cease all violation of this License, then your license
29375 from a particular copyright holder is reinstated (a) provisionally,
29376 unless and until the copyright holder explicitly and finally
29377 terminates your license, and (b) permanently, if the copyright holder
29378 fails to notify you of the violation by some reasonable means prior to
29379 60 days after the cessation.
29381 Moreover, your license from a particular copyright holder is
29382 reinstated permanently if the copyright holder notifies you of the
29383 violation by some reasonable means, this is the first time you have
29384 received notice of violation of this License (for any work) from that
29385 copyright holder, and you cure the violation prior to 30 days after
29386 your receipt of the notice.
29388 Termination of your rights under this section does not terminate the
29389 licenses of parties who have received copies or rights from you under
29390 this License.  If your rights have been terminated and not permanently
29391 reinstated, receipt of a copy of some or all of the same material does
29392 not give you any rights to use it.
29394 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
29396 The Free Software Foundation may publish new, revised versions
29397 of the GNU Free Documentation License from time to time.  Such new
29398 versions will be similar in spirit to the present version, but may
29399 differ in detail to address new problems or concerns.  See
29400 @indicateurl{http://www.gnu.org/copyleft/}.
29402 Each version of the License is given a distinguishing version number.
29403 If the Document specifies that a particular numbered version of this
29404 License "or any later version" applies to it, you have the option of
29405 following the terms and conditions either of that specified version or
29406 of any later version that has been published (not as a draft) by the
29407 Free Software Foundation.  If the Document does not specify a version
29408 number of this License, you may choose any version ever published (not
29409 as a draft) by the Free Software Foundation.  If the Document
29410 specifies that a proxy can decide which future versions of this
29411 License can be used, that proxy's public statement of acceptance of a
29412 version permanently authorizes you to choose that version for the
29413 Document.
29415 @strong{11. RELICENSING}
29417 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
29418 World Wide Web server that publishes copyrightable works and also
29419 provides prominent facilities for anybody to edit those works.  A
29420 public wiki that anybody can edit is an example of such a server.  A
29421 "Massive Multiauthor Collaboration" (or "MMC") contained in the
29422 site means any set of copyrightable works thus published on the MMC
29423 site.
29425 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
29426 license published by Creative Commons Corporation, a not-for-profit
29427 corporation with a principal place of business in San Francisco,
29428 California, as well as future copyleft versions of that license
29429 published by that same organization.
29431 "Incorporate" means to publish or republish a Document, in whole or
29432 in part, as part of another Document.
29434 An MMC is "eligible for relicensing" if it is licensed under this
29435 License, and if all works that were first published under this License
29436 somewhere other than this MMC, and subsequently incorporated in whole
29437 or in part into the MMC, (1) had no cover texts or invariant sections,
29438 and (2) were thus incorporated prior to November 1, 2008.
29440 The operator of an MMC Site may republish an MMC contained in the site
29441 under CC-BY-SA on the same site at any time before August 1, 2009,
29442 provided the MMC is eligible for relicensing.
29444 @strong{ADDENDUM: How to use this License for your documents}
29446 To use this License in a document you have written, include a copy of
29447 the License in the document and put the following copyright and
29448 license notices just after the title page:
29450 @quotation
29452 Copyright © YEAR  YOUR NAME.
29453 Permission is granted to copy, distribute and/or modify this document
29454 under the terms of the GNU Free Documentation License, Version 1.3
29455 or any later version published by the Free Software Foundation;
29456 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
29457 A copy of the license is included in the section entitled "GNU
29458 Free Documentation License".
29459 @end quotation
29461 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
29462 replace the "with ... Texts." line with this:
29464 @quotation
29466 with the Invariant Sections being LIST THEIR TITLES, with the
29467 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
29468 @end quotation
29470 If you have Invariant Sections without Cover Texts, or some other
29471 combination of the three, merge those two alternatives to suit the
29472 situation.
29474 If your document contains nontrivial examples of program code, we
29475 recommend releasing these examples in parallel under your choice of
29476 free software license, such as the GNU General Public License,
29477 to permit their use in free software.
29479 @node Index,,GNU Free Documentation License,Top
29480 @unnumbered Index
29483 @printindex ge
29486 @c %**end of body
29487 @bye