[NDS32] new attribute no_prologue and new option -mret-in-naked-func.
[official-gcc.git] / gcc / ada / gnat_rm.texi
blobb6cad4e48897f9890c84d4ce5a3306b5458baec6
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 24, 2018
26 AdaCore
28 Copyright @copyright{} 2008-2018, 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_Component_Reordering:: 
207 * Pragma No_Elaboration_Code_All:: 
208 * Pragma No_Heap_Finalization:: 
209 * Pragma No_Inline:: 
210 * Pragma No_Return:: 
211 * Pragma No_Run_Time:: 
212 * Pragma No_Strict_Aliasing:: 
213 * Pragma No_Tagged_Streams:: 
214 * Pragma Normalize_Scalars:: 
215 * Pragma Obsolescent:: 
216 * Pragma Optimize_Alignment:: 
217 * Pragma Ordered:: 
218 * Pragma Overflow_Mode:: 
219 * Pragma Overriding_Renamings:: 
220 * Pragma Partition_Elaboration_Policy:: 
221 * Pragma Part_Of:: 
222 * Pragma Passive:: 
223 * Pragma Persistent_BSS:: 
224 * Pragma Polling:: 
225 * Pragma Post:: 
226 * Pragma Postcondition:: 
227 * Pragma Post_Class:: 
228 * Pragma Rename_Pragma:: 
229 * Pragma Pre:: 
230 * Pragma Precondition:: 
231 * Pragma Predicate:: 
232 * Pragma Predicate_Failure:: 
233 * Pragma Preelaborable_Initialization:: 
234 * Pragma Prefix_Exception_Messages:: 
235 * Pragma Pre_Class:: 
236 * Pragma Priority_Specific_Dispatching:: 
237 * Pragma Profile:: 
238 * Pragma Profile_Warnings:: 
239 * Pragma Propagate_Exceptions:: 
240 * Pragma Provide_Shift_Operators:: 
241 * Pragma Psect_Object:: 
242 * Pragma Pure_Function:: 
243 * Pragma Rational:: 
244 * Pragma Ravenscar:: 
245 * Pragma Refined_Depends:: 
246 * Pragma Refined_Global:: 
247 * Pragma Refined_Post:: 
248 * Pragma Refined_State:: 
249 * Pragma Relative_Deadline:: 
250 * Pragma Remote_Access_Type:: 
251 * Pragma Restricted_Run_Time:: 
252 * Pragma Restriction_Warnings:: 
253 * Pragma Reviewable:: 
254 * Pragma Secondary_Stack_Size:: 
255 * Pragma Share_Generic:: 
256 * Pragma Shared:: 
257 * Pragma Short_Circuit_And_Or:: 
258 * Pragma Short_Descriptors:: 
259 * Pragma Simple_Storage_Pool_Type:: 
260 * Pragma Source_File_Name:: 
261 * Pragma Source_File_Name_Project:: 
262 * Pragma Source_Reference:: 
263 * Pragma SPARK_Mode:: 
264 * Pragma Static_Elaboration_Desired:: 
265 * Pragma Stream_Convert:: 
266 * Pragma Style_Checks:: 
267 * Pragma Subtitle:: 
268 * Pragma Suppress:: 
269 * Pragma Suppress_All:: 
270 * Pragma Suppress_Debug_Info:: 
271 * Pragma Suppress_Exception_Locations:: 
272 * Pragma Suppress_Initialization:: 
273 * Pragma Task_Name:: 
274 * Pragma Task_Storage:: 
275 * Pragma Test_Case:: 
276 * Pragma Thread_Local_Storage:: 
277 * Pragma Time_Slice:: 
278 * Pragma Title:: 
279 * Pragma Type_Invariant:: 
280 * Pragma Type_Invariant_Class:: 
281 * Pragma Unchecked_Union:: 
282 * Pragma Unevaluated_Use_Of_Old:: 
283 * Pragma Unimplemented_Unit:: 
284 * Pragma Universal_Aliasing:: 
285 * Pragma Universal_Data:: 
286 * Pragma Unmodified:: 
287 * Pragma Unreferenced:: 
288 * Pragma Unreferenced_Objects:: 
289 * Pragma Unreserve_All_Interrupts:: 
290 * Pragma Unsuppress:: 
291 * Pragma Use_VADS_Size:: 
292 * Pragma Unused:: 
293 * Pragma Validity_Checks:: 
294 * Pragma Volatile:: 
295 * Pragma Volatile_Full_Access:: 
296 * Pragma Volatile_Function:: 
297 * Pragma Warning_As_Error:: 
298 * Pragma Warnings:: 
299 * Pragma Weak_External:: 
300 * Pragma Wide_Character_Encoding:: 
302 Implementation Defined Aspects
304 * Aspect Abstract_State:: 
305 * Aspect Annotate:: 
306 * Aspect Async_Readers:: 
307 * Aspect Async_Writers:: 
308 * Aspect Constant_After_Elaboration:: 
309 * Aspect Contract_Cases:: 
310 * Aspect Depends:: 
311 * Aspect Default_Initial_Condition:: 
312 * Aspect Dimension:: 
313 * Aspect Dimension_System:: 
314 * Aspect Disable_Controlled:: 
315 * Aspect Effective_Reads:: 
316 * Aspect Effective_Writes:: 
317 * Aspect Extensions_Visible:: 
318 * Aspect Favor_Top_Level:: 
319 * Aspect Ghost:: 
320 * Aspect Global:: 
321 * Aspect Initial_Condition:: 
322 * Aspect Initializes:: 
323 * Aspect Inline_Always:: 
324 * Aspect Invariant:: 
325 * Aspect Invariant'Class:: 
326 * Aspect Iterable:: 
327 * Aspect Linker_Section:: 
328 * Aspect Lock_Free:: 
329 * Aspect Max_Queue_Length:: 
330 * Aspect No_Elaboration_Code_All:: 
331 * Aspect No_Inline:: 
332 * Aspect No_Tagged_Streams:: 
333 * Aspect Object_Size:: 
334 * Aspect Obsolescent:: 
335 * Aspect Part_Of:: 
336 * Aspect Persistent_BSS:: 
337 * Aspect Predicate:: 
338 * Aspect Pure_Function:: 
339 * Aspect Refined_Depends:: 
340 * Aspect Refined_Global:: 
341 * Aspect Refined_Post:: 
342 * Aspect Refined_State:: 
343 * Aspect Remote_Access_Type:: 
344 * Aspect Secondary_Stack_Size:: 
345 * Aspect Scalar_Storage_Order:: 
346 * Aspect Shared:: 
347 * Aspect Simple_Storage_Pool:: 
348 * Aspect Simple_Storage_Pool_Type:: 
349 * Aspect SPARK_Mode:: 
350 * Aspect Suppress_Debug_Info:: 
351 * Aspect Suppress_Initialization:: 
352 * Aspect Test_Case:: 
353 * Aspect Thread_Local_Storage:: 
354 * Aspect Universal_Aliasing:: 
355 * Aspect Universal_Data:: 
356 * Aspect Unmodified:: 
357 * Aspect Unreferenced:: 
358 * Aspect Unreferenced_Objects:: 
359 * Aspect Value_Size:: 
360 * Aspect Volatile_Full_Access:: 
361 * Aspect Volatile_Function:: 
362 * Aspect Warnings:: 
364 Implementation Defined Attributes
366 * Attribute Abort_Signal:: 
367 * Attribute Address_Size:: 
368 * Attribute Asm_Input:: 
369 * Attribute Asm_Output:: 
370 * Attribute Atomic_Always_Lock_Free:: 
371 * Attribute Bit:: 
372 * Attribute Bit_Position:: 
373 * Attribute Code_Address:: 
374 * Attribute Compiler_Version:: 
375 * Attribute Constrained:: 
376 * Attribute Default_Bit_Order:: 
377 * Attribute Default_Scalar_Storage_Order:: 
378 * Attribute Deref:: 
379 * Attribute Descriptor_Size:: 
380 * Attribute Elaborated:: 
381 * Attribute Elab_Body:: 
382 * Attribute Elab_Spec:: 
383 * Attribute Elab_Subp_Body:: 
384 * Attribute Emax:: 
385 * Attribute Enabled:: 
386 * Attribute Enum_Rep:: 
387 * Attribute Enum_Val:: 
388 * Attribute Epsilon:: 
389 * Attribute Fast_Math:: 
390 * Attribute Finalization_Size:: 
391 * Attribute Fixed_Value:: 
392 * Attribute From_Any:: 
393 * Attribute Has_Access_Values:: 
394 * Attribute Has_Discriminants:: 
395 * Attribute Img:: 
396 * Attribute Integer_Value:: 
397 * Attribute Invalid_Value:: 
398 * Attribute Iterable:: 
399 * Attribute Large:: 
400 * Attribute Library_Level:: 
401 * Attribute Lock_Free:: 
402 * Attribute Loop_Entry:: 
403 * Attribute Machine_Size:: 
404 * Attribute Mantissa:: 
405 * Attribute Maximum_Alignment:: 
406 * Attribute Mechanism_Code:: 
407 * Attribute Null_Parameter:: 
408 * Attribute Object_Size:: 
409 * Attribute Old:: 
410 * Attribute Passed_By_Reference:: 
411 * Attribute Pool_Address:: 
412 * Attribute Range_Length:: 
413 * Attribute Restriction_Set:: 
414 * Attribute Result:: 
415 * Attribute Safe_Emax:: 
416 * Attribute Safe_Large:: 
417 * Attribute Safe_Small:: 
418 * Attribute Scalar_Storage_Order:: 
419 * Attribute Simple_Storage_Pool:: 
420 * Attribute Small:: 
421 * Attribute Storage_Unit:: 
422 * Attribute Stub_Type:: 
423 * Attribute System_Allocator_Alignment:: 
424 * Attribute Target_Name:: 
425 * Attribute To_Address:: 
426 * Attribute To_Any:: 
427 * Attribute Type_Class:: 
428 * Attribute Type_Key:: 
429 * Attribute TypeCode:: 
430 * Attribute Unconstrained_Array:: 
431 * Attribute Universal_Literal_String:: 
432 * Attribute Unrestricted_Access:: 
433 * Attribute Update:: 
434 * Attribute Valid_Scalars:: 
435 * Attribute VADS_Size:: 
436 * Attribute Value_Size:: 
437 * Attribute Wchar_T_Size:: 
438 * Attribute Word_Size:: 
440 Standard and Implementation Defined Restrictions
442 * Partition-Wide Restrictions:: 
443 * Program Unit Level Restrictions:: 
445 Partition-Wide Restrictions
447 * Immediate_Reclamation:: 
448 * Max_Asynchronous_Select_Nesting:: 
449 * Max_Entry_Queue_Length:: 
450 * Max_Protected_Entries:: 
451 * Max_Select_Alternatives:: 
452 * Max_Storage_At_Blocking:: 
453 * Max_Task_Entries:: 
454 * Max_Tasks:: 
455 * No_Abort_Statements:: 
456 * No_Access_Parameter_Allocators:: 
457 * No_Access_Subprograms:: 
458 * No_Allocators:: 
459 * No_Anonymous_Allocators:: 
460 * No_Asynchronous_Control:: 
461 * No_Calendar:: 
462 * No_Coextensions:: 
463 * No_Default_Initialization:: 
464 * No_Delay:: 
465 * No_Dependence:: 
466 * No_Direct_Boolean_Operators:: 
467 * No_Dispatch:: 
468 * No_Dispatching_Calls:: 
469 * No_Dynamic_Attachment:: 
470 * No_Dynamic_Priorities:: 
471 * No_Entry_Calls_In_Elaboration_Code:: 
472 * No_Enumeration_Maps:: 
473 * No_Exception_Handlers:: 
474 * No_Exception_Propagation:: 
475 * No_Exception_Registration:: 
476 * No_Exceptions:: 
477 * No_Finalization:: 
478 * No_Fixed_Point:: 
479 * No_Floating_Point:: 
480 * No_Implicit_Conditionals:: 
481 * No_Implicit_Dynamic_Code:: 
482 * No_Implicit_Heap_Allocations:: 
483 * No_Implicit_Protected_Object_Allocations:: 
484 * No_Implicit_Task_Allocations:: 
485 * No_Initialize_Scalars:: 
486 * No_IO:: 
487 * No_Local_Allocators:: 
488 * No_Local_Protected_Objects:: 
489 * No_Local_Timing_Events:: 
490 * No_Long_Long_Integers:: 
491 * No_Multiple_Elaboration:: 
492 * No_Nested_Finalization:: 
493 * No_Protected_Type_Allocators:: 
494 * No_Protected_Types:: 
495 * No_Recursion:: 
496 * No_Reentrancy:: 
497 * No_Relative_Delay:: 
498 * No_Requeue_Statements:: 
499 * No_Secondary_Stack:: 
500 * No_Select_Statements:: 
501 * No_Specific_Termination_Handlers:: 
502 * No_Specification_of_Aspect:: 
503 * No_Standard_Allocators_After_Elaboration:: 
504 * No_Standard_Storage_Pools:: 
505 * No_Stream_Optimizations:: 
506 * No_Streams:: 
507 * No_Task_Allocators:: 
508 * No_Task_At_Interrupt_Priority:: 
509 * No_Task_Attributes_Package:: 
510 * No_Task_Hierarchy:: 
511 * No_Task_Termination:: 
512 * No_Tasking:: 
513 * No_Terminate_Alternatives:: 
514 * No_Unchecked_Access:: 
515 * No_Unchecked_Conversion:: 
516 * No_Unchecked_Deallocation:: 
517 * No_Use_Of_Entity:: 
518 * Pure_Barriers:: 
519 * Simple_Barriers:: 
520 * Static_Priorities:: 
521 * Static_Storage_Size:: 
523 Program Unit Level Restrictions
525 * No_Elaboration_Code:: 
526 * No_Dynamic_Sized_Objects:: 
527 * No_Entry_Queue:: 
528 * No_Implementation_Aspect_Specifications:: 
529 * No_Implementation_Attributes:: 
530 * No_Implementation_Identifiers:: 
531 * No_Implementation_Pragmas:: 
532 * No_Implementation_Restrictions:: 
533 * No_Implementation_Units:: 
534 * No_Implicit_Aliasing:: 
535 * No_Implicit_Loops:: 
536 * No_Obsolescent_Features:: 
537 * No_Wide_Characters:: 
538 * Static_Dispatch_Tables:: 
539 * SPARK_05:: 
541 Implementation Advice
543 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
544 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
545 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
546 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
547 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
548 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
549 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
550 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
551 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
552 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
553 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
554 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
555 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
556 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
557 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
558 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
559 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
560 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
561 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
562 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
563 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
564 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
565 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
566 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
567 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
568 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
569 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
570 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
571 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
572 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
573 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
574 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
575 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
576 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
577 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
578 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
579 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
580 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
581 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
582 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
583 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
584 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
585 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
586 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
587 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
588 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
589 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
590 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
591 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
592 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
593 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
594 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
595 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
596 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
597 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
598 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
599 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
600 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
601 * RM G; Numerics: RM G Numerics. 
602 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
603 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
604 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
605 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
606 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
608 Intrinsic Subprograms
610 * Intrinsic Operators:: 
611 * Compilation_ISO_Date:: 
612 * Compilation_Date:: 
613 * Compilation_Time:: 
614 * Enclosing_Entity:: 
615 * Exception_Information:: 
616 * Exception_Message:: 
617 * Exception_Name:: 
618 * File:: 
619 * Line:: 
620 * Shifts and Rotates:: 
621 * Source_Location:: 
623 Representation Clauses and Pragmas
625 * Alignment Clauses:: 
626 * Size Clauses:: 
627 * Storage_Size Clauses:: 
628 * Size of Variant Record Objects:: 
629 * Biased Representation:: 
630 * Value_Size and Object_Size Clauses:: 
631 * Component_Size Clauses:: 
632 * Bit_Order Clauses:: 
633 * Effect of Bit_Order on Byte Ordering:: 
634 * Pragma Pack for Arrays:: 
635 * Pragma Pack for Records:: 
636 * Record Representation Clauses:: 
637 * Handling of Records with Holes:: 
638 * Enumeration Clauses:: 
639 * Address Clauses:: 
640 * Use of Address Clauses for Memory-Mapped I/O:: 
641 * Effect of Convention on Representation:: 
642 * Conventions and Anonymous Access Types:: 
643 * Determining the Representations chosen by GNAT:: 
645 The Implementation of Standard I/O
647 * Standard I/O Packages:: 
648 * FORM Strings:: 
649 * Direct_IO:: 
650 * Sequential_IO:: 
651 * Text_IO:: 
652 * Wide_Text_IO:: 
653 * Wide_Wide_Text_IO:: 
654 * Stream_IO:: 
655 * Text Translation:: 
656 * Shared Files:: 
657 * Filenames encoding:: 
658 * File content encoding:: 
659 * Open Modes:: 
660 * Operations on C Streams:: 
661 * Interfacing to C Streams:: 
663 Text_IO
665 * Stream Pointer Positioning:: 
666 * Reading and Writing Non-Regular Files:: 
667 * Get_Immediate:: 
668 * Treating Text_IO Files as Streams:: 
669 * Text_IO Extensions:: 
670 * Text_IO Facilities for Unbounded Strings:: 
672 Wide_Text_IO
674 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
675 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
677 Wide_Wide_Text_IO
679 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
680 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
682 The GNAT Library
684 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
685 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
686 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
687 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
688 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
689 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
690 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
691 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
692 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
693 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
694 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
695 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
696 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads. 
697 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads. 
698 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads. 
699 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
700 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
701 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
702 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
703 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
704 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
705 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
706 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
707 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
708 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
709 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
710 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
711 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
712 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
713 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
714 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
715 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
716 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
717 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
718 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
719 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
720 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
721 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
722 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
723 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
724 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
725 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
726 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
727 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
728 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
729 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
730 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
731 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
732 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
733 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
734 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
735 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
736 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
737 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
738 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
739 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
740 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
741 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
742 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
743 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
744 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
745 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
746 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
747 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
748 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
749 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
750 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
751 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
752 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
753 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
754 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
755 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
756 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
757 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
758 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
759 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
760 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
761 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
762 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
763 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
764 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
765 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
766 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
767 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
768 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
769 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
770 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
771 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
772 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
773 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
774 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
775 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
776 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
777 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
778 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
779 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
780 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
781 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
782 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
783 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
784 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
785 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
786 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
787 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
788 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
789 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
790 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
791 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
792 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
793 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
794 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
795 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
796 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
797 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
798 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
799 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
800 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
801 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
802 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
803 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
804 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
805 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
806 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
807 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
808 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
809 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
810 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
811 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
812 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
813 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
814 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
815 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
816 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
817 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
818 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
819 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
820 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
821 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
822 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
823 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
824 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
825 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
826 * System.Memory (s-memory.ads): System Memory s-memory ads. 
827 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
828 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
829 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
830 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
831 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
832 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
833 * System.Rident (s-rident.ads): System Rident s-rident ads. 
834 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
835 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
836 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
837 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
839 Interfacing to Other Languages
841 * Interfacing to C:: 
842 * Interfacing to C++:: 
843 * Interfacing to COBOL:: 
844 * Interfacing to Fortran:: 
845 * Interfacing to non-GNAT Ada code:: 
847 Implementation of Specific Ada Features
849 * Machine Code Insertions:: 
850 * GNAT Implementation of Tasking:: 
851 * GNAT Implementation of Shared Passive Packages:: 
852 * Code Generation for Array Aggregates:: 
853 * The Size of Discriminated Records with Default Discriminants:: 
854 * Strict Conformance to the Ada Reference Manual:: 
856 GNAT Implementation of Tasking
858 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
859 * Ensuring Compliance with the Real-Time Annex:: 
860 * Support for Locking Policies:: 
862 Code Generation for Array Aggregates
864 * Static constant aggregates with static bounds:: 
865 * Constant aggregates with unconstrained nominal types:: 
866 * Aggregates with static bounds:: 
867 * Aggregates with nonstatic bounds:: 
868 * Aggregates in assignment statements:: 
870 Obsolescent Features
872 * pragma No_Run_Time:: 
873 * pragma Ravenscar:: 
874 * pragma Restricted_Run_Time:: 
875 * pragma Task_Info:: 
876 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
878 Compatibility and Porting Guide
880 * Writing Portable Fixed-Point Declarations:: 
881 * Compatibility with Ada 83:: 
882 * Compatibility between Ada 95 and Ada 2005:: 
883 * Implementation-dependent characteristics:: 
884 * Compatibility with Other Ada Systems:: 
885 * Representation Clauses:: 
886 * Compatibility with HP Ada 83:: 
888 Compatibility with Ada 83
890 * Legal Ada 83 programs that are illegal in Ada 95:: 
891 * More deterministic semantics:: 
892 * Changed semantics:: 
893 * Other language compatibility issues:: 
895 Implementation-dependent characteristics
897 * Implementation-defined pragmas:: 
898 * Implementation-defined attributes:: 
899 * Libraries:: 
900 * Elaboration order:: 
901 * Target-specific aspects:: 
903 @end detailmenu
904 @end menu
906 @node About This Guide,Implementation Defined Pragmas,Top,Top
907 @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}
908 @chapter About This Guide
912 This manual contains useful information in writing programs using the
913 GNAT compiler.  It includes information on implementation dependent
914 characteristics of GNAT, including all the information required by
915 Annex M of the Ada language standard.
917 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
918 invoked in Ada 83 compatibility mode.
919 By default, GNAT assumes Ada 2012,
920 but you can override with a compiler switch
921 to explicitly specify the language version.
922 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
923 Throughout this manual, references to 'Ada' without a year suffix
924 apply to all the Ada versions of the language.
926 Ada is designed to be highly portable.
927 In general, a program will have the same effect even when compiled by
928 different compilers on different platforms.
929 However, since Ada is designed to be used in a
930 wide variety of applications, it also contains a number of system
931 dependent features to be used in interfacing to the external world.
933 @geindex Implementation-dependent features
935 @geindex Portability
937 Note: Any program that makes use of implementation-dependent features
938 may be non-portable.  You should follow good programming practice and
939 isolate and clearly document any sections of your program that make use
940 of these features in a non-portable manner.
942 @menu
943 * What This Reference Manual Contains:: 
944 * Conventions:: 
945 * Related Information:: 
947 @end menu
949 @node What This Reference Manual Contains,Conventions,,About This Guide
950 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
951 @section What This Reference Manual Contains
954 This reference manual contains the following chapters:
957 @itemize *
959 @item 
960 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
961 pragmas, which can be used to extend and enhance the functionality of the
962 compiler.
964 @item 
965 @ref{8,,Implementation Defined Attributes}, lists GNAT
966 implementation-dependent attributes, which can be used to extend and
967 enhance the functionality of the compiler.
969 @item 
970 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
971 implementation-dependent restrictions, which can be used to extend and
972 enhance the functionality of the compiler.
974 @item 
975 @ref{a,,Implementation Advice}, provides information on generally
976 desirable behavior which are not requirements that all compilers must
977 follow since it cannot be provided on all systems, or which may be
978 undesirable on some systems.
980 @item 
981 @ref{b,,Implementation Defined Characteristics}, provides a guide to
982 minimizing implementation dependent features.
984 @item 
985 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
986 implemented by GNAT, and how they can be imported into user
987 application programs.
989 @item 
990 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
991 way that GNAT represents data, and in particular the exact set
992 of representation clauses and pragmas that is accepted.
994 @item 
995 @ref{e,,Standard Library Routines}, provides a listing of packages and a
996 brief description of the functionality that is provided by Ada's
997 extensive set of standard library routines as implemented by GNAT.
999 @item 
1000 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1001 implementation of the input-output facilities.
1003 @item 
1004 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1005 the Ada predefined library.
1007 @item 
1008 @ref{11,,Interfacing to Other Languages}, describes how programs
1009 written in Ada using GNAT can be interfaced to other programming
1010 languages.
1012 @item 
1013 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1014 of the specialized needs annexes.
1016 @item 
1017 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1018 to GNAT's implementation of machine code insertions, tasking, and several
1019 other features.
1021 @item 
1022 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1023 GNAT implementation of the Ada 2012 language standard.
1025 @item 
1026 @ref{15,,Obsolescent Features} documents implementation dependent features,
1027 including pragmas and attributes, which are considered obsolescent, since
1028 there are other preferred ways of achieving the same results. These
1029 obsolescent forms are retained for backwards compatibility.
1031 @item 
1032 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
1033 developing portable Ada code, describes the compatibility issues that
1034 may arise between GNAT and other Ada compilation systems (including those
1035 for Ada 83), and shows how GNAT can expedite porting applications
1036 developed in other Ada environments.
1038 @item 
1039 @ref{1,,GNU Free Documentation License} contains the license for this document.
1040 @end itemize
1042 @geindex Ada 95 Language Reference Manual
1044 @geindex Ada 2005 Language Reference Manual
1046 This reference manual assumes a basic familiarity with the Ada 95 language, as
1047 described in the
1048 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1049 It does not require knowledge of the new features introduced by Ada 2005 or
1050 Ada 2012.
1051 All three reference manuals are included in the GNAT documentation
1052 package.
1054 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1055 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1056 @section Conventions
1059 @geindex Conventions
1060 @geindex typographical
1062 @geindex Typographical conventions
1064 Following are examples of the typographical and graphic conventions used
1065 in this guide:
1068 @itemize *
1070 @item 
1071 @code{Functions}, @code{utility program names}, @code{standard names},
1072 and @code{classes}.
1074 @item 
1075 @code{Option flags}
1077 @item 
1078 @code{File names}
1080 @item 
1081 @code{Variables}
1083 @item 
1084 @emph{Emphasis}
1086 @item 
1087 [optional information or parameters]
1089 @item 
1090 Examples are described by text
1092 @example
1093 and then shown this way.
1094 @end example
1096 @item 
1097 Commands that are entered by the user are shown as preceded by a prompt string
1098 comprising the @code{$} character followed by a space.
1099 @end itemize
1101 @node Related Information,,Conventions,About This Guide
1102 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1103 @section Related Information
1106 See the following documents for further information on GNAT:
1109 @itemize *
1111 @item 
1112 @cite{GNAT User's Guide for Native Platforms},
1113 which provides information on how to use the
1114 GNAT development environment.
1116 @item 
1117 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1119 @item 
1120 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1121 of the Ada 95 standard.  The annotations describe
1122 detailed aspects of the design decision, and in particular contain useful
1123 sections on Ada 83 compatibility.
1125 @item 
1126 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1128 @item 
1129 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1130 of the Ada 2005 standard.  The annotations describe
1131 detailed aspects of the design decision.
1133 @item 
1134 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1136 @item 
1137 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1138 which contains specific information on compatibility between GNAT and
1139 DEC Ada 83 systems.
1141 @item 
1142 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1143 describes in detail the pragmas and attributes provided by the DEC Ada 83
1144 compiler system.
1145 @end itemize
1147 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1148 @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}
1149 @chapter Implementation Defined Pragmas
1152 Ada defines a set of pragmas that can be used to supply additional
1153 information to the compiler.  These language defined pragmas are
1154 implemented in GNAT and work as described in the Ada Reference Manual.
1156 In addition, Ada allows implementations to define additional pragmas
1157 whose meaning is defined by the implementation.  GNAT provides a number
1158 of these implementation-defined pragmas, which can be used to extend
1159 and enhance the functionality of the compiler.  This section of the GNAT
1160 Reference Manual describes these additional pragmas.
1162 Note that any program using these pragmas might not be portable to other
1163 compilers (although GNAT implements this set of pragmas on all
1164 platforms).  Therefore if portability to other compilers is an important
1165 consideration, the use of these pragmas should be minimized.
1167 @menu
1168 * Pragma Abort_Defer:: 
1169 * Pragma Abstract_State:: 
1170 * Pragma Ada_83:: 
1171 * Pragma Ada_95:: 
1172 * Pragma Ada_05:: 
1173 * Pragma Ada_2005:: 
1174 * Pragma Ada_12:: 
1175 * Pragma Ada_2012:: 
1176 * Pragma Allow_Integer_Address:: 
1177 * Pragma Annotate:: 
1178 * Pragma Assert:: 
1179 * Pragma Assert_And_Cut:: 
1180 * Pragma Assertion_Policy:: 
1181 * Pragma Assume:: 
1182 * Pragma Assume_No_Invalid_Values:: 
1183 * Pragma Async_Readers:: 
1184 * Pragma Async_Writers:: 
1185 * Pragma Attribute_Definition:: 
1186 * Pragma C_Pass_By_Copy:: 
1187 * Pragma Check:: 
1188 * Pragma Check_Float_Overflow:: 
1189 * Pragma Check_Name:: 
1190 * Pragma Check_Policy:: 
1191 * Pragma Comment:: 
1192 * Pragma Common_Object:: 
1193 * Pragma Compile_Time_Error:: 
1194 * Pragma Compile_Time_Warning:: 
1195 * Pragma Compiler_Unit:: 
1196 * Pragma Compiler_Unit_Warning:: 
1197 * Pragma Complete_Representation:: 
1198 * Pragma Complex_Representation:: 
1199 * Pragma Component_Alignment:: 
1200 * Pragma Constant_After_Elaboration:: 
1201 * Pragma Contract_Cases:: 
1202 * Pragma Convention_Identifier:: 
1203 * Pragma CPP_Class:: 
1204 * Pragma CPP_Constructor:: 
1205 * Pragma CPP_Virtual:: 
1206 * Pragma CPP_Vtable:: 
1207 * Pragma CPU:: 
1208 * Pragma Deadline_Floor:: 
1209 * Pragma Default_Initial_Condition:: 
1210 * Pragma Debug:: 
1211 * Pragma Debug_Policy:: 
1212 * Pragma Default_Scalar_Storage_Order:: 
1213 * Pragma Default_Storage_Pool:: 
1214 * Pragma Depends:: 
1215 * Pragma Detect_Blocking:: 
1216 * Pragma Disable_Atomic_Synchronization:: 
1217 * Pragma Dispatching_Domain:: 
1218 * Pragma Effective_Reads:: 
1219 * Pragma Effective_Writes:: 
1220 * Pragma Elaboration_Checks:: 
1221 * Pragma Eliminate:: 
1222 * Pragma Enable_Atomic_Synchronization:: 
1223 * Pragma Export_Function:: 
1224 * Pragma Export_Object:: 
1225 * Pragma Export_Procedure:: 
1226 * Pragma Export_Value:: 
1227 * Pragma Export_Valued_Procedure:: 
1228 * Pragma Extend_System:: 
1229 * Pragma Extensions_Allowed:: 
1230 * Pragma Extensions_Visible:: 
1231 * Pragma External:: 
1232 * Pragma External_Name_Casing:: 
1233 * Pragma Fast_Math:: 
1234 * Pragma Favor_Top_Level:: 
1235 * Pragma Finalize_Storage_Only:: 
1236 * Pragma Float_Representation:: 
1237 * Pragma Ghost:: 
1238 * Pragma Global:: 
1239 * Pragma Ident:: 
1240 * Pragma Ignore_Pragma:: 
1241 * Pragma Implementation_Defined:: 
1242 * Pragma Implemented:: 
1243 * Pragma Implicit_Packing:: 
1244 * Pragma Import_Function:: 
1245 * Pragma Import_Object:: 
1246 * Pragma Import_Procedure:: 
1247 * Pragma Import_Valued_Procedure:: 
1248 * Pragma Independent:: 
1249 * Pragma Independent_Components:: 
1250 * Pragma Initial_Condition:: 
1251 * Pragma Initialize_Scalars:: 
1252 * Pragma Initializes:: 
1253 * Pragma Inline_Always:: 
1254 * Pragma Inline_Generic:: 
1255 * Pragma Interface:: 
1256 * Pragma Interface_Name:: 
1257 * Pragma Interrupt_Handler:: 
1258 * Pragma Interrupt_State:: 
1259 * Pragma Invariant:: 
1260 * Pragma Keep_Names:: 
1261 * Pragma License:: 
1262 * Pragma Link_With:: 
1263 * Pragma Linker_Alias:: 
1264 * Pragma Linker_Constructor:: 
1265 * Pragma Linker_Destructor:: 
1266 * Pragma Linker_Section:: 
1267 * Pragma Lock_Free:: 
1268 * Pragma Loop_Invariant:: 
1269 * Pragma Loop_Optimize:: 
1270 * Pragma Loop_Variant:: 
1271 * Pragma Machine_Attribute:: 
1272 * Pragma Main:: 
1273 * Pragma Main_Storage:: 
1274 * Pragma Max_Queue_Length:: 
1275 * Pragma No_Body:: 
1276 * Pragma No_Component_Reordering:: 
1277 * Pragma No_Elaboration_Code_All:: 
1278 * Pragma No_Heap_Finalization:: 
1279 * Pragma No_Inline:: 
1280 * Pragma No_Return:: 
1281 * Pragma No_Run_Time:: 
1282 * Pragma No_Strict_Aliasing:: 
1283 * Pragma No_Tagged_Streams:: 
1284 * Pragma Normalize_Scalars:: 
1285 * Pragma Obsolescent:: 
1286 * Pragma Optimize_Alignment:: 
1287 * Pragma Ordered:: 
1288 * Pragma Overflow_Mode:: 
1289 * Pragma Overriding_Renamings:: 
1290 * Pragma Partition_Elaboration_Policy:: 
1291 * Pragma Part_Of:: 
1292 * Pragma Passive:: 
1293 * Pragma Persistent_BSS:: 
1294 * Pragma Polling:: 
1295 * Pragma Post:: 
1296 * Pragma Postcondition:: 
1297 * Pragma Post_Class:: 
1298 * Pragma Rename_Pragma:: 
1299 * Pragma Pre:: 
1300 * Pragma Precondition:: 
1301 * Pragma Predicate:: 
1302 * Pragma Predicate_Failure:: 
1303 * Pragma Preelaborable_Initialization:: 
1304 * Pragma Prefix_Exception_Messages:: 
1305 * Pragma Pre_Class:: 
1306 * Pragma Priority_Specific_Dispatching:: 
1307 * Pragma Profile:: 
1308 * Pragma Profile_Warnings:: 
1309 * Pragma Propagate_Exceptions:: 
1310 * Pragma Provide_Shift_Operators:: 
1311 * Pragma Psect_Object:: 
1312 * Pragma Pure_Function:: 
1313 * Pragma Rational:: 
1314 * Pragma Ravenscar:: 
1315 * Pragma Refined_Depends:: 
1316 * Pragma Refined_Global:: 
1317 * Pragma Refined_Post:: 
1318 * Pragma Refined_State:: 
1319 * Pragma Relative_Deadline:: 
1320 * Pragma Remote_Access_Type:: 
1321 * Pragma Restricted_Run_Time:: 
1322 * Pragma Restriction_Warnings:: 
1323 * Pragma Reviewable:: 
1324 * Pragma Secondary_Stack_Size:: 
1325 * Pragma Share_Generic:: 
1326 * Pragma Shared:: 
1327 * Pragma Short_Circuit_And_Or:: 
1328 * Pragma Short_Descriptors:: 
1329 * Pragma Simple_Storage_Pool_Type:: 
1330 * Pragma Source_File_Name:: 
1331 * Pragma Source_File_Name_Project:: 
1332 * Pragma Source_Reference:: 
1333 * Pragma SPARK_Mode:: 
1334 * Pragma Static_Elaboration_Desired:: 
1335 * Pragma Stream_Convert:: 
1336 * Pragma Style_Checks:: 
1337 * Pragma Subtitle:: 
1338 * Pragma Suppress:: 
1339 * Pragma Suppress_All:: 
1340 * Pragma Suppress_Debug_Info:: 
1341 * Pragma Suppress_Exception_Locations:: 
1342 * Pragma Suppress_Initialization:: 
1343 * Pragma Task_Name:: 
1344 * Pragma Task_Storage:: 
1345 * Pragma Test_Case:: 
1346 * Pragma Thread_Local_Storage:: 
1347 * Pragma Time_Slice:: 
1348 * Pragma Title:: 
1349 * Pragma Type_Invariant:: 
1350 * Pragma Type_Invariant_Class:: 
1351 * Pragma Unchecked_Union:: 
1352 * Pragma Unevaluated_Use_Of_Old:: 
1353 * Pragma Unimplemented_Unit:: 
1354 * Pragma Universal_Aliasing:: 
1355 * Pragma Universal_Data:: 
1356 * Pragma Unmodified:: 
1357 * Pragma Unreferenced:: 
1358 * Pragma Unreferenced_Objects:: 
1359 * Pragma Unreserve_All_Interrupts:: 
1360 * Pragma Unsuppress:: 
1361 * Pragma Use_VADS_Size:: 
1362 * Pragma Unused:: 
1363 * Pragma Validity_Checks:: 
1364 * Pragma Volatile:: 
1365 * Pragma Volatile_Full_Access:: 
1366 * Pragma Volatile_Function:: 
1367 * Pragma Warning_As_Error:: 
1368 * Pragma Warnings:: 
1369 * Pragma Weak_External:: 
1370 * Pragma Wide_Character_Encoding:: 
1372 @end menu
1374 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1375 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1376 @section Pragma Abort_Defer
1379 @geindex Deferring aborts
1381 Syntax:
1383 @example
1384 pragma Abort_Defer;
1385 @end example
1387 This pragma must appear at the start of the statement sequence of a
1388 handled sequence of statements (right after the @code{begin}).  It has
1389 the effect of deferring aborts for the sequence of statements (but not
1390 for the declarations or handlers, if any, associated with this statement
1391 sequence).
1393 @node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
1394 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
1395 @section Pragma Abstract_State
1398 Syntax:
1400 @example
1401 pragma Abstract_State (ABSTRACT_STATE_LIST);
1403 ABSTRACT_STATE_LIST ::=
1404      null
1405   |  STATE_NAME_WITH_OPTIONS
1406   | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1408 STATE_NAME_WITH_OPTIONS ::=
1409      STATE_NAME
1410   | (STATE_NAME with OPTION_LIST)
1412 OPTION_LIST ::= OPTION @{, OPTION@}
1414 OPTION ::=
1415     SIMPLE_OPTION
1416   | NAME_VALUE_OPTION
1418 SIMPLE_OPTION ::= Ghost | Synchronous
1420 NAME_VALUE_OPTION ::=
1421     Part_Of => ABSTRACT_STATE
1422   | External [=> EXTERNAL_PROPERTY_LIST]
1424 EXTERNAL_PROPERTY_LIST ::=
1425      EXTERNAL_PROPERTY
1426   | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1428 EXTERNAL_PROPERTY ::=
1429     Async_Readers    [=> boolean_EXPRESSION]
1430   | Async_Writers    [=> boolean_EXPRESSION]
1431   | Effective_Reads  [=> boolean_EXPRESSION]
1432   | Effective_Writes [=> boolean_EXPRESSION]
1433     others            => boolean_EXPRESSION
1435 STATE_NAME ::= defining_identifier
1437 ABSTRACT_STATE ::= name
1438 @end example
1440 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1441 the SPARK 2014 Reference Manual, section 7.1.4.
1443 @node Pragma Ada_83,Pragma Ada_95,Pragma Abstract_State,Implementation Defined Pragmas
1444 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{1e}
1445 @section Pragma Ada_83
1448 Syntax:
1450 @example
1451 pragma Ada_83;
1452 @end example
1454 A configuration pragma that establishes Ada 83 mode for the unit to
1455 which it applies, regardless of the mode set by the command line
1456 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1457 the syntax and semantics of Ada 83, as defined in the original Ada
1458 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1459 and Ada 2005 are not recognized, optional package bodies are allowed,
1460 and generics may name types with unknown discriminants without using
1461 the @code{(<>)} notation.  In addition, some but not all of the additional
1462 restrictions of Ada 83 are enforced.
1464 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1465 Ada 83 code to be compiled and adapted to GNAT with less effort.
1466 Secondly, it aids in keeping code backwards compatible with Ada 83.
1467 However, there is no guarantee that code that is processed correctly
1468 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1469 83 compiler, since GNAT does not enforce all the additional checks
1470 required by Ada 83.
1472 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1473 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{1f}
1474 @section Pragma Ada_95
1477 Syntax:
1479 @example
1480 pragma Ada_95;
1481 @end example
1483 A configuration pragma that establishes Ada 95 mode for the unit to which
1484 it applies, regardless of the mode set by the command line switches.
1485 This mode is set automatically for the @code{Ada} and @code{System}
1486 packages and their children, so you need not specify it in these
1487 contexts.  This pragma is useful when writing a reusable component that
1488 itself uses Ada 95 features, but which is intended to be usable from
1489 either Ada 83 or Ada 95 programs.
1491 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1492 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{20}
1493 @section Pragma Ada_05
1496 Syntax:
1498 @example
1499 pragma Ada_05;
1500 pragma Ada_05 (local_NAME);
1501 @end example
1503 A configuration pragma that establishes Ada 2005 mode for the unit to which
1504 it applies, regardless of the mode set by the command line switches.
1505 This pragma is useful when writing a reusable component that
1506 itself uses Ada 2005 features, but which is intended to be usable from
1507 either Ada 83 or Ada 95 programs.
1509 The one argument form (which is not a configuration pragma)
1510 is used for managing the transition from
1511 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1512 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1513 mode will generate a warning. In addition, in Ada_83 or Ada_95
1514 mode, a preference rule is established which does not choose
1515 such an entity unless it is unambiguously specified. This avoids
1516 extra subprograms marked this way from generating ambiguities in
1517 otherwise legal pre-Ada_2005 programs. The one argument form is
1518 intended for exclusive use in the GNAT run-time library.
1520 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1521 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{21}
1522 @section Pragma Ada_2005
1525 Syntax:
1527 @example
1528 pragma Ada_2005;
1529 @end example
1531 This configuration pragma is a synonym for pragma Ada_05 and has the
1532 same syntax and effect.
1534 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1535 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{22}
1536 @section Pragma Ada_12
1539 Syntax:
1541 @example
1542 pragma Ada_12;
1543 pragma Ada_12 (local_NAME);
1544 @end example
1546 A configuration pragma that establishes Ada 2012 mode for the unit to which
1547 it applies, regardless of the mode set by the command line switches.
1548 This mode is set automatically for the @code{Ada} and @code{System}
1549 packages and their children, so you need not specify it in these
1550 contexts.  This pragma is useful when writing a reusable component that
1551 itself uses Ada 2012 features, but which is intended to be usable from
1552 Ada 83, Ada 95, or Ada 2005 programs.
1554 The one argument form, which is not a configuration pragma,
1555 is used for managing the transition from Ada
1556 2005 to Ada 2012 in the run-time library. If an entity is marked
1557 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1558 mode will generate a warning. In addition, in any pre-Ada_2012
1559 mode, a preference rule is established which does not choose
1560 such an entity unless it is unambiguously specified. This avoids
1561 extra subprograms marked this way from generating ambiguities in
1562 otherwise legal pre-Ada_2012 programs. The one argument form is
1563 intended for exclusive use in the GNAT run-time library.
1565 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1566 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{23}
1567 @section Pragma Ada_2012
1570 Syntax:
1572 @example
1573 pragma Ada_2012;
1574 @end example
1576 This configuration pragma is a synonym for pragma Ada_12 and has the
1577 same syntax and effect.
1579 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1580 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{24}
1581 @section Pragma Allow_Integer_Address
1584 Syntax:
1586 @example
1587 pragma Allow_Integer_Address;
1588 @end example
1590 In almost all versions of GNAT, @code{System.Address} is a private
1591 type in accordance with the implementation advice in the RM. This
1592 means that integer values,
1593 in particular integer literals, are not allowed as address values.
1594 If the configuration pragma
1595 @code{Allow_Integer_Address} is given, then integer expressions may
1596 be used anywhere a value of type @code{System.Address} is required.
1597 The effect is to introduce an implicit unchecked conversion from the
1598 integer value to type @code{System.Address}. The reverse case of using
1599 an address where an integer type is required is handled analogously.
1600 The following example compiles without errors:
1602 @example
1603 pragma Allow_Integer_Address;
1604 with System; use System;
1605 package AddrAsInt is
1606    X : Integer;
1607    Y : Integer;
1608    for X'Address use 16#1240#;
1609    for Y use at 16#3230#;
1610    m : Address := 16#4000#;
1611    n : constant Address := 4000;
1612    p : constant Address := Address (X + Y);
1613    v : Integer := y'Address;
1614    w : constant Integer := Integer (Y'Address);
1615    type R is new integer;
1616    RR : R := 1000;
1617    Z : Integer;
1618    for Z'Address use RR;
1619 end AddrAsInt;
1620 @end example
1622 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1623 is not a private type. In implementations of @code{GNAT} where
1624 System.Address is a visible integer type,
1625 this pragma serves no purpose but is ignored
1626 rather than rejected to allow common sets of sources to be used
1627 in the two situations.
1629 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1630 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{25}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{26}
1631 @section Pragma Annotate
1634 Syntax:
1636 @example
1637 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1639 ARG ::= NAME | EXPRESSION
1640 @end example
1642 This pragma is used to annotate programs.  IDENTIFIER identifies
1643 the type of annotation.  GNAT verifies that it is an identifier, but does
1644 not otherwise analyze it. The second optional identifier is also left
1645 unanalyzed, and by convention is used to control the action of the tool to
1646 which the annotation is addressed.  The remaining ARG arguments
1647 can be either string literals or more generally expressions.
1648 String literals are assumed to be either of type
1649 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1650 depending on the character literals they contain.
1651 All other kinds of arguments are analyzed as expressions, and must be
1652 unambiguous. The last argument if present must have the identifier
1653 @code{Entity} and GNAT verifies that a local name is given.
1655 The analyzed pragma is retained in the tree, but not otherwise processed
1656 by any part of the GNAT compiler, except to generate corresponding note
1657 lines in the generated ALI file. For the format of these note lines, see
1658 the compiler source file lib-writ.ads. This pragma is intended for use by
1659 external tools, including ASIS. The use of pragma Annotate does not
1660 affect the compilation process in any way. This pragma may be used as
1661 a configuration pragma.
1663 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1664 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{27}
1665 @section Pragma Assert
1668 Syntax:
1670 @example
1671 pragma Assert (
1672   boolean_EXPRESSION
1673   [, string_EXPRESSION]);
1674 @end example
1676 The effect of this pragma depends on whether the corresponding command
1677 line switch is set to activate assertions.  The pragma expands into code
1678 equivalent to the following:
1680 @example
1681 if assertions-enabled then
1682    if not boolean_EXPRESSION then
1683       System.Assertions.Raise_Assert_Failure
1684         (string_EXPRESSION);
1685    end if;
1686 end if;
1687 @end example
1689 The string argument, if given, is the message that will be associated
1690 with the exception occurrence if the exception is raised.  If no second
1691 argument is given, the default message is @code{file}:@code{nnn},
1692 where @code{file} is the name of the source file containing the assert,
1693 and @code{nnn} is the line number of the assert.
1695 Note that, as with the @code{if} statement to which it is equivalent, the
1696 type of the expression is either @code{Standard.Boolean}, or any type derived
1697 from this standard type.
1699 Assert checks can be either checked or ignored. By default they are ignored.
1700 They will be checked if either the command line switch @emph{-gnata} is
1701 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1702 to enable @code{Assert_Checks}.
1704 If assertions are ignored, then there
1705 is no run-time effect (and in particular, any side effects from the
1706 expression will not occur at run time).  (The expression is still
1707 analyzed at compile time, and may cause types to be frozen if they are
1708 mentioned here for the first time).
1710 If assertions are checked, then the given expression is tested, and if
1711 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1712 which results in the raising of @code{Assert_Failure} with the given message.
1714 You should generally avoid side effects in the expression arguments of
1715 this pragma, because these side effects will turn on and off with the
1716 setting of the assertions mode, resulting in assertions that have an
1717 effect on the program.  However, the expressions are analyzed for
1718 semantic correctness whether or not assertions are enabled, so turning
1719 assertions on and off cannot affect the legality of a program.
1721 Note that the implementation defined policy @code{DISABLE}, given in a
1722 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1724 Note: this is a standard language-defined pragma in versions
1725 of Ada from 2005 on. In GNAT, it is implemented in all versions
1726 of Ada, and the DISABLE policy is an implementation-defined
1727 addition.
1729 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1730 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{28}
1731 @section Pragma Assert_And_Cut
1734 Syntax:
1736 @example
1737 pragma Assert_And_Cut (
1738   boolean_EXPRESSION
1739   [, string_EXPRESSION]);
1740 @end example
1742 The effect of this pragma is identical to that of pragma @code{Assert},
1743 except that in an @code{Assertion_Policy} pragma, the identifier
1744 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1745 (or disabled).
1747 The intention is that this be used within a subprogram when the
1748 given test expresion sums up all the work done so far in the
1749 subprogram, so that the rest of the subprogram can be verified
1750 (informally or formally) using only the entry preconditions,
1751 and the expression in this pragma. This allows dividing up
1752 a subprogram into sections for the purposes of testing or
1753 formal verification. The pragma also serves as useful
1754 documentation.
1756 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1757 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{29}
1758 @section Pragma Assertion_Policy
1761 Syntax:
1763 @example
1764 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1766 pragma Assertion_Policy (
1767     ASSERTION_KIND => POLICY_IDENTIFIER
1768  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1770 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1772 RM_ASSERTION_KIND ::= Assert               |
1773                       Static_Predicate     |
1774                       Dynamic_Predicate    |
1775                       Pre                  |
1776                       Pre'Class            |
1777                       Post                 |
1778                       Post'Class           |
1779                       Type_Invariant       |
1780                       Type_Invariant'Class
1782 ID_ASSERTION_KIND ::= Assertions           |
1783                       Assert_And_Cut       |
1784                       Assume               |
1785                       Contract_Cases       |
1786                       Debug                |
1787                       Ghost                |
1788                       Invariant            |
1789                       Invariant'Class      |
1790                       Loop_Invariant       |
1791                       Loop_Variant         |
1792                       Postcondition        |
1793                       Precondition         |
1794                       Predicate            |
1795                       Refined_Post         |
1796                       Statement_Assertions
1798 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1799 @end example
1801 This is a standard Ada 2012 pragma that is available as an
1802 implementation-defined pragma in earlier versions of Ada.
1803 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1804 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1805 are implementation defined additions recognized by the GNAT compiler.
1807 The pragma applies in both cases to pragmas and aspects with matching
1808 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1809 applies to both the @code{Precondition} pragma
1810 and the aspect @code{Precondition}. Note that the identifiers for
1811 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1812 Pre_Class and Post_Class), since these pragmas are intended to be
1813 identical to the corresponding aspects).
1815 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1816 the corresponding pragma or aspect is activated.
1817 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1818 the corresponding pragma or aspect is deactivated.
1819 This pragma overrides the effect of the @emph{-gnata} switch on the
1820 command line.
1821 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1822 however, if the @emph{-gnatp} switch is specified all assertions are ignored.
1824 The implementation defined policy @code{DISABLE} is like
1825 @code{IGNORE} except that it completely disables semantic
1826 checking of the corresponding pragma or aspect. This is
1827 useful when the pragma or aspect argument references subprograms
1828 in a with'ed package which is replaced by a dummy package
1829 for the final build.
1831 The implementation defined assertion kind @code{Assertions} applies to all
1832 assertion kinds. The form with no assertion kind given implies this
1833 choice, so it applies to all assertion kinds (RM defined, and
1834 implementation defined).
1836 The implementation defined assertion kind @code{Statement_Assertions}
1837 applies to @code{Assert}, @code{Assert_And_Cut},
1838 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
1840 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
1841 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2a}
1842 @section Pragma Assume
1845 Syntax:
1847 @example
1848 pragma Assume (
1849   boolean_EXPRESSION
1850   [, string_EXPRESSION]);
1851 @end example
1853 The effect of this pragma is identical to that of pragma @code{Assert},
1854 except that in an @code{Assertion_Policy} pragma, the identifier
1855 @code{Assume} is used to control whether it is ignored or checked
1856 (or disabled).
1858 The intention is that this be used for assumptions about the
1859 external environment. So you cannot expect to verify formally
1860 or informally that the condition is met, this must be
1861 established by examining things outside the program itself.
1862 For example, we may have code that depends on the size of
1863 @code{Long_Long_Integer} being at least 64. So we could write:
1865 @example
1866 pragma Assume (Long_Long_Integer'Size >= 64);
1867 @end example
1869 This assumption cannot be proved from the program itself,
1870 but it acts as a useful run-time check that the assumption
1871 is met, and documents the need to ensure that it is met by
1872 reference to information outside the program.
1874 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
1875 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2b}
1876 @section Pragma Assume_No_Invalid_Values
1879 @geindex Invalid representations
1881 @geindex Invalid values
1883 Syntax:
1885 @example
1886 pragma Assume_No_Invalid_Values (On | Off);
1887 @end example
1889 This is a configuration pragma that controls the assumptions made by the
1890 compiler about the occurrence of invalid representations (invalid values)
1891 in the code.
1893 The default behavior (corresponding to an Off argument for this pragma), is
1894 to assume that values may in general be invalid unless the compiler can
1895 prove they are valid. Consider the following example:
1897 @example
1898 V1 : Integer range 1 .. 10;
1899 V2 : Integer range 11 .. 20;
1901 for J in V2 .. V1 loop
1902    ...
1903 end loop;
1904 @end example
1906 if V1 and V2 have valid values, then the loop is known at compile
1907 time not to execute since the lower bound must be greater than the
1908 upper bound. However in default mode, no such assumption is made,
1909 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
1910 is given, the compiler will assume that any occurrence of a variable
1911 other than in an explicit @code{'Valid} test always has a valid
1912 value, and the loop above will be optimized away.
1914 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
1915 you know your code is free of uninitialized variables and other
1916 possible sources of invalid representations, and may result in
1917 more efficient code. A program that accesses an invalid representation
1918 with this pragma in effect is erroneous, so no guarantees can be made
1919 about its behavior.
1921 It is peculiar though permissible to use this pragma in conjunction
1922 with validity checking (-gnatVa). In such cases, accessing invalid
1923 values will generally give an exception, though formally the program
1924 is erroneous so there are no guarantees that this will always be the
1925 case, and it is recommended that these two options not be used together.
1927 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
1928 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{2c}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{2d}
1929 @section Pragma Async_Readers
1932 Syntax:
1934 @example
1935 pragma Asynch_Readers [ (boolean_EXPRESSION) ];
1936 @end example
1938 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
1939 the SPARK 2014 Reference Manual, section 7.1.2.
1941 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
1942 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{2e}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{2f}
1943 @section Pragma Async_Writers
1946 Syntax:
1948 @example
1949 pragma Asynch_Writers [ (boolean_EXPRESSION) ];
1950 @end example
1952 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
1953 the SPARK 2014 Reference Manual, section 7.1.2.
1955 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
1956 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{30}
1957 @section Pragma Attribute_Definition
1960 Syntax:
1962 @example
1963 pragma Attribute_Definition
1964   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1965    [Entity     =>] LOCAL_NAME,
1966    [Expression =>] EXPRESSION | NAME);
1967 @end example
1969 If @code{Attribute} is a known attribute name, this pragma is equivalent to
1970 the attribute definition clause:
1972 @example
1973 for Entity'Attribute use Expression;
1974 @end example
1976 If @code{Attribute} is not a recognized attribute name, the pragma is
1977 ignored, and a warning is emitted. This allows source
1978 code to be written that takes advantage of some new attribute, while remaining
1979 compilable with earlier compilers.
1981 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
1982 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{31}
1983 @section Pragma C_Pass_By_Copy
1986 @geindex Passing by copy
1988 Syntax:
1990 @example
1991 pragma C_Pass_By_Copy
1992   ([Max_Size =>] static_integer_EXPRESSION);
1993 @end example
1995 Normally the default mechanism for passing C convention records to C
1996 convention subprograms is to pass them by reference, as suggested by RM
1997 B.3(69).  Use the configuration pragma @code{C_Pass_By_Copy} to change
1998 this default, by requiring that record formal parameters be passed by
1999 copy if all of the following conditions are met:
2002 @itemize *
2004 @item 
2005 The size of the record type does not exceed the value specified for
2006 @code{Max_Size}.
2008 @item 
2009 The record type has @code{Convention C}.
2011 @item 
2012 The formal parameter has this record type, and the subprogram has a
2013 foreign (non-Ada) convention.
2014 @end itemize
2016 If these conditions are met the argument is passed by copy; i.e., in a
2017 manner consistent with what C expects if the corresponding formal in the
2018 C prototype is a struct (rather than a pointer to a struct).
2020 You can also pass records by copy by specifying the convention
2021 @code{C_Pass_By_Copy} for the record type, or by using the extended
2022 @code{Import} and @code{Export} pragmas, which allow specification of
2023 passing mechanisms on a parameter by parameter basis.
2025 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2026 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{32}
2027 @section Pragma Check
2030 @geindex Assertions
2032 @geindex Named assertions
2034 Syntax:
2036 @example
2037 pragma Check (
2038      [Name    =>] CHECK_KIND,
2039      [Check   =>] Boolean_EXPRESSION
2040   [, [Message =>] string_EXPRESSION] );
2042 CHECK_KIND ::= IDENTIFIER           |
2043                Pre'Class            |
2044                Post'Class           |
2045                Type_Invariant'Class |
2046                Invariant'Class
2047 @end example
2049 This pragma is similar to the predefined pragma @code{Assert} except that an
2050 extra identifier argument is present. In conjunction with pragma
2051 @code{Check_Policy}, this can be used to define groups of assertions that can
2052 be independently controlled. The identifier @code{Assertion} is special, it
2053 refers to the normal set of pragma @code{Assert} statements.
2055 Checks introduced by this pragma are normally deactivated by default. They can
2056 be activated either by the command line option @emph{-gnata}, which turns on
2057 all checks, or individually controlled using pragma @code{Check_Policy}.
2059 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2060 permitted as check kinds, since this would cause confusion with the use
2061 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2062 pragmas, where they are used to refer to sets of assertions.
2064 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2065 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{33}
2066 @section Pragma Check_Float_Overflow
2069 @geindex Floating-point overflow
2071 Syntax:
2073 @example
2074 pragma Check_Float_Overflow;
2075 @end example
2077 In Ada, the predefined floating-point types (@code{Short_Float},
2078 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2079 defined to be @emph{unconstrained}. This means that even though each
2080 has a well-defined base range, an operation that delivers a result
2081 outside this base range is not required to raise an exception.
2082 This implementation permission accommodates the notion
2083 of infinities in IEEE floating-point, and corresponds to the
2084 efficient execution mode on most machines. GNAT will not raise
2085 overflow exceptions on these machines; instead it will generate
2086 infinities and NaN's as defined in the IEEE standard.
2088 Generating infinities, although efficient, is not always desirable.
2089 Often the preferable approach is to check for overflow, even at the
2090 (perhaps considerable) expense of run-time performance.
2091 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2092 range constraints -- and indeed such a subtype
2093 can have the same base range as its base type. For example:
2095 @example
2096 subtype My_Float is Float range Float'Range;
2097 @end example
2099 Here @code{My_Float} has the same range as
2100 @code{Float} but is constrained, so operations on
2101 @code{My_Float} values will be checked for overflow
2102 against this range.
2104 This style will achieve the desired goal, but
2105 it is often more convenient to be able to simply use
2106 the standard predefined floating-point types as long
2107 as overflow checking could be guaranteed.
2108 The @code{Check_Float_Overflow}
2109 configuration pragma achieves this effect. If a unit is compiled
2110 subject to this configuration pragma, then all operations
2111 on predefined floating-point types including operations on
2112 base types of these floating-point types will be treated as
2113 though those types were constrained, and overflow checks
2114 will be generated. The @code{Constraint_Error}
2115 exception is raised if the result is out of range.
2117 This mode can also be set by use of the compiler
2118 switch @emph{-gnateF}.
2120 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2121 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{34}
2122 @section Pragma Check_Name
2125 @geindex Defining check names
2127 @geindex Check names
2128 @geindex defining
2130 Syntax:
2132 @example
2133 pragma Check_Name (check_name_IDENTIFIER);
2134 @end example
2136 This is a configuration pragma that defines a new implementation
2137 defined check name (unless IDENTIFIER matches one of the predefined
2138 check names, in which case the pragma has no effect). Check names
2139 are global to a partition, so if two or more configuration pragmas
2140 are present in a partition mentioning the same name, only one new
2141 check name is introduced.
2143 An implementation defined check name introduced with this pragma may
2144 be used in only three contexts: @code{pragma Suppress},
2145 @code{pragma Unsuppress},
2146 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2147 any of these three cases, the check name must be visible. A check
2148 name is visible if it is in the configuration pragmas applying to
2149 the current unit, or if it appears at the start of any unit that
2150 is part of the dependency set of the current unit (e.g., units that
2151 are mentioned in @code{with} clauses).
2153 Check names introduced by this pragma are subject to control by compiler
2154 switches (in particular -gnatp) in the usual manner.
2156 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2157 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{35}
2158 @section Pragma Check_Policy
2161 @geindex Controlling assertions
2163 @geindex Assertions
2164 @geindex control
2166 @geindex Check pragma control
2168 @geindex Named assertions
2170 Syntax:
2172 @example
2173 pragma Check_Policy
2174  ([Name   =>] CHECK_KIND,
2175   [Policy =>] POLICY_IDENTIFIER);
2177 pragma Check_Policy (
2178     CHECK_KIND => POLICY_IDENTIFIER
2179  @{, CHECK_KIND => POLICY_IDENTIFIER@});
2181 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2183 CHECK_KIND ::= IDENTIFIER           |
2184                Pre'Class            |
2185                Post'Class           |
2186                Type_Invariant'Class |
2187                Invariant'Class
2189 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2190 avoids confusion between the two possible syntax forms for this pragma.
2192 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2193 @end example
2195 This pragma is used to set the checking policy for assertions (specified
2196 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2197 to be checked using the @code{Check} pragma. It may appear either as
2198 a configuration pragma, or within a declarative part of package. In the
2199 latter case, it applies from the point where it appears to the end of
2200 the declarative region (like pragma @code{Suppress}).
2202 The @code{Check_Policy} pragma is similar to the
2203 predefined @code{Assertion_Policy} pragma,
2204 and if the check kind corresponds to one of the assertion kinds that
2205 are allowed by @code{Assertion_Policy}, then the effect is identical.
2207 If the first argument is Debug, then the policy applies to Debug pragmas,
2208 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2209 @code{IGNORE}, and allowing them to execute with normal semantics if
2210 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2211 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2212 be totally ignored and not analyzed semantically.
2214 Finally the first argument may be some other identifier than the above
2215 possibilities, in which case it controls a set of named assertions
2216 that can be checked using pragma @code{Check}. For example, if the pragma:
2218 @example
2219 pragma Check_Policy (Critical_Error, OFF);
2220 @end example
2222 is given, then subsequent @code{Check} pragmas whose first argument is also
2223 @code{Critical_Error} will be disabled.
2225 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2226 to turn on corresponding checks. The default for a set of checks for which no
2227 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2228 @emph{-gnata} is given, which turns on all checks by default.
2230 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2231 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2232 compatibility with the standard @code{Assertion_Policy} pragma. The check
2233 policy setting @code{DISABLE} causes the second argument of a corresponding
2234 @code{Check} pragma to be completely ignored and not analyzed.
2236 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2237 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{36}
2238 @section Pragma Comment
2241 Syntax:
2243 @example
2244 pragma Comment (static_string_EXPRESSION);
2245 @end example
2247 This is almost identical in effect to pragma @code{Ident}.  It allows the
2248 placement of a comment into the object file and hence into the
2249 executable file if the operating system permits such usage.  The
2250 difference is that @code{Comment}, unlike @code{Ident}, has
2251 no limitations on placement of the pragma (it can be placed
2252 anywhere in the main source unit), and if more than one pragma
2253 is used, all comments are retained.
2255 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2256 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{37}
2257 @section Pragma Common_Object
2260 Syntax:
2262 @example
2263 pragma Common_Object (
2264      [Internal =>] LOCAL_NAME
2265   [, [External =>] EXTERNAL_SYMBOL]
2266   [, [Size     =>] EXTERNAL_SYMBOL] );
2268 EXTERNAL_SYMBOL ::=
2269   IDENTIFIER
2270 | static_string_EXPRESSION
2271 @end example
2273 This pragma enables the shared use of variables stored in overlaid
2274 linker areas corresponding to the use of @code{COMMON}
2275 in Fortran.  The single
2276 object @code{LOCAL_NAME} is assigned to the area designated by
2277 the @code{External} argument.
2278 You may define a record to correspond to a series
2279 of fields.  The @code{Size} argument
2280 is syntax checked in GNAT, but otherwise ignored.
2282 @code{Common_Object} is not supported on all platforms.  If no
2283 support is available, then the code generator will issue a message
2284 indicating that the necessary attribute for implementation of this
2285 pragma is not available.
2287 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2288 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{38}
2289 @section Pragma Compile_Time_Error
2292 Syntax:
2294 @example
2295 pragma Compile_Time_Error
2296          (boolean_EXPRESSION, static_string_EXPRESSION);
2297 @end example
2299 This pragma can be used to generate additional compile time
2300 error messages. It
2301 is particularly useful in generics, where errors can be issued for
2302 specific problematic instantiations. The first parameter is a boolean
2303 expression. The pragma is effective only if the value of this expression
2304 is known at compile time, and has the value True. The set of expressions
2305 whose values are known at compile time includes all static boolean
2306 expressions, and also other values which the compiler can determine
2307 at compile time (e.g., the size of a record type set by an explicit
2308 size representation clause, or the value of a variable which was
2309 initialized to a constant and is known not to have been modified).
2310 If these conditions are met, an error message is generated using
2311 the value given as the second argument. This string value may contain
2312 embedded ASCII.LF characters to break the message into multiple lines.
2314 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2315 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{39}
2316 @section Pragma Compile_Time_Warning
2319 Syntax:
2321 @example
2322 pragma Compile_Time_Warning
2323          (boolean_EXPRESSION, static_string_EXPRESSION);
2324 @end example
2326 Same as pragma Compile_Time_Error, except a warning is issued instead
2327 of an error message. Note that if this pragma is used in a package that
2328 is with'ed by a client, the client will get the warning even though it
2329 is issued by a with'ed package (normally warnings in with'ed units are
2330 suppressed, but this is a special exception to that rule).
2332 One typical use is within a generic where compile time known characteristics
2333 of formal parameters are tested, and warnings given appropriately. Another use
2334 with a first parameter of True is to warn a client about use of a package,
2335 for example that it is not fully implemented.
2337 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2338 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3a}
2339 @section Pragma Compiler_Unit
2342 Syntax:
2344 @example
2345 pragma Compiler_Unit;
2346 @end example
2348 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2349 retained so that old versions of the GNAT run-time that use this pragma can
2350 be compiled with newer versions of the compiler.
2352 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2353 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{3b}
2354 @section Pragma Compiler_Unit_Warning
2357 Syntax:
2359 @example
2360 pragma Compiler_Unit_Warning;
2361 @end example
2363 This pragma is intended only for internal use in the GNAT run-time library.
2364 It indicates that the unit is used as part of the compiler build. The effect
2365 is to generate warnings for the use of constructs (for example, conditional
2366 expressions) that would cause trouble when bootstrapping using an older
2367 version of GNAT. For the exact list of restrictions, see the compiler sources
2368 and references to Check_Compiler_Unit.
2370 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2371 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{3c}
2372 @section Pragma Complete_Representation
2375 Syntax:
2377 @example
2378 pragma Complete_Representation;
2379 @end example
2381 This pragma must appear immediately within a record representation
2382 clause. Typical placements are before the first component clause
2383 or after the last component clause. The effect is to give an error
2384 message if any component is missing a component clause. This pragma
2385 may be used to ensure that a record representation clause is
2386 complete, and that this invariant is maintained if fields are
2387 added to the record in the future.
2389 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2390 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{3d}
2391 @section Pragma Complex_Representation
2394 Syntax:
2396 @example
2397 pragma Complex_Representation
2398         ([Entity =>] LOCAL_NAME);
2399 @end example
2401 The @code{Entity} argument must be the name of a record type which has
2402 two fields of the same floating-point type.  The effect of this pragma is
2403 to force gcc to use the special internal complex representation form for
2404 this record, which may be more efficient.  Note that this may result in
2405 the code for this type not conforming to standard ABI (application
2406 binary interface) requirements for the handling of record types.  For
2407 example, in some environments, there is a requirement for passing
2408 records by pointer, and the use of this pragma may result in passing
2409 this type in floating-point registers.
2411 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2412 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{3e}
2413 @section Pragma Component_Alignment
2416 @geindex Alignments of components
2418 @geindex Pragma Component_Alignment
2420 Syntax:
2422 @example
2423 pragma Component_Alignment (
2424      [Form =>] ALIGNMENT_CHOICE
2425   [, [Name =>] type_LOCAL_NAME]);
2427 ALIGNMENT_CHOICE ::=
2428   Component_Size
2429 | Component_Size_4
2430 | Storage_Unit
2431 | Default
2432 @end example
2434 Specifies the alignment of components in array or record types.
2435 The meaning of the @code{Form} argument is as follows:
2437 @quotation
2439 @geindex Component_Size (in pragma Component_Alignment)
2440 @end quotation
2443 @table @asis
2445 @item @emph{Component_Size}
2447 Aligns scalar components and subcomponents of the array or record type
2448 on boundaries appropriate to their inherent size (naturally
2449 aligned).  For example, 1-byte components are aligned on byte boundaries,
2450 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2451 integer components are aligned on 4-byte boundaries and so on.  These
2452 alignment rules correspond to the normal rules for C compilers on all
2453 machines except the VAX.
2455 @geindex Component_Size_4 (in pragma Component_Alignment)
2457 @item @emph{Component_Size_4}
2459 Naturally aligns components with a size of four or fewer
2460 bytes.  Components that are larger than 4 bytes are placed on the next
2461 4-byte boundary.
2463 @geindex Storage_Unit (in pragma Component_Alignment)
2465 @item @emph{Storage_Unit}
2467 Specifies that array or record components are byte aligned, i.e.,
2468 aligned on boundaries determined by the value of the constant
2469 @code{System.Storage_Unit}.
2471 @geindex Default (in pragma Component_Alignment)
2473 @item @emph{Default}
2475 Specifies that array or record components are aligned on default
2476 boundaries, appropriate to the underlying hardware or operating system or
2477 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2478 alignment).
2479 @end table
2481 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2482 refer to a local record or array type, and the specified alignment
2483 choice applies to the specified type.  The use of
2484 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2485 @code{Component_Alignment} pragma to be ignored.  The use of
2486 @code{Component_Alignment} together with a record representation clause
2487 is only effective for fields not specified by the representation clause.
2489 If the @code{Name} parameter is absent, the pragma can be used as either
2490 a configuration pragma, in which case it applies to one or more units in
2491 accordance with the normal rules for configuration pragmas, or it can be
2492 used within a declarative part, in which case it applies to types that
2493 are declared within this declarative part, or within any nested scope
2494 within this declarative part.  In either case it specifies the alignment
2495 to be applied to any record or array type which has otherwise standard
2496 representation.
2498 If the alignment for a record or array type is not specified (using
2499 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2500 clause), the GNAT uses the default alignment as described previously.
2502 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2503 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{3f}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{40}
2504 @section Pragma Constant_After_Elaboration
2507 Syntax:
2509 @example
2510 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2511 @end example
2513 For the semantics of this pragma, see the entry for aspect
2514 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2516 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2517 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{41}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{42}
2518 @section Pragma Contract_Cases
2521 @geindex Contract cases
2523 Syntax:
2525 @example
2526 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2528 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2530 CASE_GUARD ::= boolean_EXPRESSION | others
2532 CONSEQUENCE ::= boolean_EXPRESSION
2533 @end example
2535 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2536 that can complement or replace the contract given by a precondition and a
2537 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2538 by testing and formal verification tools. The compiler checks its validity and,
2539 depending on the assertion policy at the point of declaration of the pragma,
2540 it may insert a check in the executable. For code generation, the contract
2541 cases
2543 @example
2544 pragma Contract_Cases (
2545   Cond1 => Pred1,
2546   Cond2 => Pred2);
2547 @end example
2549 are equivalent to
2551 @example
2552 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2553 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2554 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2555 pragma Postcondition (if C1 then Pred1);
2556 pragma Postcondition (if C2 then Pred2);
2557 @end example
2559 The precondition ensures that one and only one of the case guards is
2560 satisfied on entry to the subprogram.
2561 The postcondition ensures that for the case guard that was True on entry,
2562 the corrresponding consequence is True on exit. Other consequence expressions
2563 are not evaluated.
2565 A precondition @code{P} and postcondition @code{Q} can also be
2566 expressed as contract cases:
2568 @example
2569 pragma Contract_Cases (P => Q);
2570 @end example
2572 The placement and visibility rules for @code{Contract_Cases} pragmas are
2573 identical to those described for preconditions and postconditions.
2575 The compiler checks that boolean expressions given in case guards and
2576 consequences are valid, where the rules for case guards are the same as
2577 the rule for an expression in @code{Precondition} and the rules for
2578 consequences are the same as the rule for an expression in
2579 @code{Postcondition}. In particular, attributes @code{'Old} and
2580 @code{'Result} can only be used within consequence expressions.
2581 The case guard for the last contract case may be @code{others}, to denote
2582 any case not captured by the previous cases. The
2583 following is an example of use within a package spec:
2585 @example
2586 package Math_Functions is
2587    ...
2588    function Sqrt (Arg : Float) return Float;
2589    pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2590                            Arg >= 100.0         => Sqrt'Result >= 10.0,
2591                            others               => Sqrt'Result = 0.0));
2592    ...
2593 end Math_Functions;
2594 @end example
2596 The meaning of contract cases is that only one case should apply at each
2597 call, as determined by the corresponding case guard evaluating to True,
2598 and that the consequence for this case should hold when the subprogram
2599 returns.
2601 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2602 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{43}
2603 @section Pragma Convention_Identifier
2606 @geindex Conventions
2607 @geindex synonyms
2609 Syntax:
2611 @example
2612 pragma Convention_Identifier (
2613          [Name =>]       IDENTIFIER,
2614          [Convention =>] convention_IDENTIFIER);
2615 @end example
2617 This pragma provides a mechanism for supplying synonyms for existing
2618 convention identifiers. The @code{Name} identifier can subsequently
2619 be used as a synonym for the given convention in other pragmas (including
2620 for example pragma @code{Import} or another @code{Convention_Identifier}
2621 pragma). As an example of the use of this, suppose you had legacy code
2622 which used Fortran77 as the identifier for Fortran. Then the pragma:
2624 @example
2625 pragma Convention_Identifier (Fortran77, Fortran);
2626 @end example
2628 would allow the use of the convention identifier @code{Fortran77} in
2629 subsequent code, avoiding the need to modify the sources. As another
2630 example, you could use this to parameterize convention requirements
2631 according to systems. Suppose you needed to use @code{Stdcall} on
2632 windows systems, and @code{C} on some other system, then you could
2633 define a convention identifier @code{Library} and use a single
2634 @code{Convention_Identifier} pragma to specify which convention
2635 would be used system-wide.
2637 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2638 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{44}
2639 @section Pragma CPP_Class
2642 @geindex Interfacing with C++
2644 Syntax:
2646 @example
2647 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2648 @end example
2650 The argument denotes an entity in the current declarative region that is
2651 declared as a record type. It indicates that the type corresponds to an
2652 externally declared C++ class type, and is to be laid out the same way
2653 that C++ would lay out the type. If the C++ class has virtual primitives
2654 then the record must be declared as a tagged record type.
2656 Types for which @code{CPP_Class} is specified do not have assignment or
2657 equality operators defined (such operations can be imported or declared
2658 as subprograms as required). Initialization is allowed only by constructor
2659 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2660 limited if not explicitly declared as limited or derived from a limited
2661 type, and an error is issued in that case.
2663 See @ref{45,,Interfacing to C++} for related information.
2665 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2666 for backward compatibility but its functionality is available
2667 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2669 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2670 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{46}
2671 @section Pragma CPP_Constructor
2674 @geindex Interfacing with C++
2676 Syntax:
2678 @example
2679 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2680   [, [External_Name =>] static_string_EXPRESSION ]
2681   [, [Link_Name     =>] static_string_EXPRESSION ]);
2682 @end example
2684 This pragma identifies an imported function (imported in the usual way
2685 with pragma @code{Import}) as corresponding to a C++ constructor. If
2686 @code{External_Name} and @code{Link_Name} are not specified then the
2687 @code{Entity} argument is a name that must have been previously mentioned
2688 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2689 must be of one of the following forms:
2692 @itemize *
2694 @item 
2695 @strong{function} @code{Fname} @strong{return} T`
2697 @item 
2698 @strong{function} @code{Fname} @strong{return} T'Class
2700 @item 
2701 @strong{function} @code{Fname} (...) @strong{return} T`
2703 @item 
2704 @strong{function} @code{Fname} (...) @strong{return} T'Class
2705 @end itemize
2707 where @code{T} is a limited record type imported from C++ with pragma
2708 @code{Import} and @code{Convention} = @code{CPP}.
2710 The first two forms import the default constructor, used when an object
2711 of type @code{T} is created on the Ada side with no explicit constructor.
2712 The latter two forms cover all the non-default constructors of the type.
2713 See the GNAT User's Guide for details.
2715 If no constructors are imported, it is impossible to create any objects
2716 on the Ada side and the type is implicitly declared abstract.
2718 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2719 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2720 GCC switch).
2721 See @ref{45,,Interfacing to C++} for more related information.
2723 Note: The use of functions returning class-wide types for constructors is
2724 currently obsolete. They are supported for backward compatibility. The
2725 use of functions returning the type T leave the Ada sources more clear
2726 because the imported C++ constructors always return an object of type T;
2727 that is, they never return an object whose type is a descendant of type T.
2729 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2730 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{47}
2731 @section Pragma CPP_Virtual
2734 @geindex Interfacing to C++
2736 This pragma is now obsolete and, other than generating a warning if warnings
2737 on obsolescent features are enabled, is completely ignored.
2738 It is retained for compatibility
2739 purposes. It used to be required to ensure compoatibility with C++, but
2740 is no longer required for that purpose because GNAT generates
2741 the same object layout as the G++ compiler by default.
2743 See @ref{45,,Interfacing to C++} for related information.
2745 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2746 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{48}
2747 @section Pragma CPP_Vtable
2750 @geindex Interfacing with C++
2752 This pragma is now obsolete and, other than generating a warning if warnings
2753 on obsolescent features are enabled, is completely ignored.
2754 It used to be required to ensure compatibility with C++, but
2755 is no longer required for that purpose because GNAT generates
2756 the same object layout as the G++ compiler by default.
2758 See @ref{45,,Interfacing to C++} for related information.
2760 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2761 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{49}
2762 @section Pragma CPU
2765 Syntax:
2767 @example
2768 pragma CPU (EXPRESSION);
2769 @end example
2771 This pragma is standard in Ada 2012, but is available in all earlier
2772 versions of Ada as an implementation-defined pragma.
2773 See Ada 2012 Reference Manual for details.
2775 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2776 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4a}
2777 @section Pragma Deadline_Floor
2780 Syntax:
2782 @example
2783 pragma Deadline_Floor (time_span_EXPRESSION);
2784 @end example
2786 This pragma applies only to protected types and specifies the floor
2787 deadline inherited by a task when the task enters a protected object.
2788 It is effective only when the EDF scheduling policy is used.
2790 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2791 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4b}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{4c}
2792 @section Pragma Default_Initial_Condition
2795 Syntax:
2797 @example
2798 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2799 @end example
2801 For the semantics of this pragma, see the entry for aspect
2802 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2804 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2805 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{4d}
2806 @section Pragma Debug
2809 Syntax:
2811 @example
2812 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2814 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2815   PROCEDURE_NAME
2816 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2817 @end example
2819 The procedure call argument has the syntactic form of an expression, meeting
2820 the syntactic requirements for pragmas.
2822 If debug pragmas are not enabled or if the condition is present and evaluates
2823 to False, this pragma has no effect. If debug pragmas are enabled, the
2824 semantics of the pragma is exactly equivalent to the procedure call statement
2825 corresponding to the argument with a terminating semicolon. Pragmas are
2826 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2827 intersperse calls to debug procedures in the middle of declarations. Debug
2828 pragmas can be enabled either by use of the command line switch @emph{-gnata}
2829 or by use of the pragma @code{Check_Policy} with a first argument of
2830 @code{Debug}.
2832 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
2833 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{4e}
2834 @section Pragma Debug_Policy
2837 Syntax:
2839 @example
2840 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2841 @end example
2843 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
2844 with a first argument of @code{Debug}. It is retained for historical
2845 compatibility reasons.
2847 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
2848 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{4f}
2849 @section Pragma Default_Scalar_Storage_Order
2852 @geindex Default_Scalar_Storage_Order
2854 @geindex Scalar_Storage_Order
2856 Syntax:
2858 @example
2859 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
2860 @end example
2862 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
2863 type or array type, then the scalar storage order defaults to the ordinary
2864 default for the target. But this default may be overridden using this pragma.
2865 The pragma may appear as a configuration pragma, or locally within a package
2866 spec or declarative part. In the latter case, it applies to all subsequent
2867 types declared within that package spec or declarative part.
2869 The following example shows the use of this pragma:
2871 @example
2872 pragma Default_Scalar_Storage_Order (High_Order_First);
2873 with System; use System;
2874 package DSSO1 is
2875    type H1 is record
2876       a : Integer;
2877    end record;
2879    type L2 is record
2880       a : Integer;
2881    end record;
2882    for L2'Scalar_Storage_Order use Low_Order_First;
2884    type L2a is new L2;
2886    package Inner is
2887       type H3 is record
2888          a : Integer;
2889       end record;
2891       pragma Default_Scalar_Storage_Order (Low_Order_First);
2893       type L4 is record
2894          a : Integer;
2895       end record;
2896    end Inner;
2898    type H4a is new Inner.L4;
2900    type H5 is record
2901       a : Integer;
2902    end record;
2903 end DSSO1;
2904 @end example
2906 In this example record types with names starting with @emph{L} have @cite{Low_Order_First} scalar
2907 storage order, and record types with names starting with @emph{H} have @code{High_Order_First}.
2908 Note that in the case of @code{H4a}, the order is not inherited
2909 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
2910 gets inherited on type derivation.
2912 If this pragma is used as a configuration pragma which appears within a
2913 configuration pragma file (as opposed to appearing explicitly at the start
2914 of a single unit), then the binder will require that all units in a partition
2915 be compiled in a similar manner, other than run-time units, which are not
2916 affected by this pragma. Note that the use of this form is discouraged because
2917 it may significantly degrade the run-time performance of the software, instead
2918 the default scalar storage order ought to be changed only on a local basis.
2920 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
2921 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{50}
2922 @section Pragma Default_Storage_Pool
2925 @geindex Default_Storage_Pool
2927 Syntax:
2929 @example
2930 pragma Default_Storage_Pool (storage_pool_NAME | null);
2931 @end example
2933 This pragma is standard in Ada 2012, but is available in all earlier
2934 versions of Ada as an implementation-defined pragma.
2935 See Ada 2012 Reference Manual for details.
2937 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
2938 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{51}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{52}
2939 @section Pragma Depends
2942 Syntax:
2944 @example
2945 pragma Depends (DEPENDENCY_RELATION);
2947 DEPENDENCY_RELATION ::=
2948      null
2949   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
2951 DEPENDENCY_CLAUSE ::=
2952     OUTPUT_LIST =>[+] INPUT_LIST
2953   | NULL_DEPENDENCY_CLAUSE
2955 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
2957 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
2959 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
2961 OUTPUT ::= NAME | FUNCTION_RESULT
2962 INPUT  ::= NAME
2964 where FUNCTION_RESULT is a function Result attribute_reference
2965 @end example
2967 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
2968 SPARK 2014 Reference Manual, section 6.1.5.
2970 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
2971 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{53}
2972 @section Pragma Detect_Blocking
2975 Syntax:
2977 @example
2978 pragma Detect_Blocking;
2979 @end example
2981 This is a standard pragma in Ada 2005, that is available in all earlier
2982 versions of Ada as an implementation-defined pragma.
2984 This is a configuration pragma that forces the detection of potentially
2985 blocking operations within a protected operation, and to raise Program_Error
2986 if that happens.
2988 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
2989 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{54}
2990 @section Pragma Disable_Atomic_Synchronization
2993 @geindex Atomic Synchronization
2995 Syntax:
2997 @example
2998 pragma Disable_Atomic_Synchronization [(Entity)];
2999 @end example
3001 Ada requires that accesses (reads or writes) of an atomic variable be
3002 regarded as synchronization points in the case of multiple tasks.
3003 Particularly in the case of multi-processors this may require special
3004 handling, e.g. the generation of memory barriers. This capability may
3005 be turned off using this pragma in cases where it is known not to be
3006 required.
3008 The placement and scope rules for this pragma are the same as those
3009 for @code{pragma Suppress}. In particular it can be used as a
3010 configuration  pragma, or in a declaration sequence where it applies
3011 till the end of the scope. If an @code{Entity} argument is present,
3012 the action applies only to that entity.
3014 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3015 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{55}
3016 @section Pragma Dispatching_Domain
3019 Syntax:
3021 @example
3022 pragma Dispatching_Domain (EXPRESSION);
3023 @end example
3025 This pragma is standard in Ada 2012, but is available in all earlier
3026 versions of Ada as an implementation-defined pragma.
3027 See Ada 2012 Reference Manual for details.
3029 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3030 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{56}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{57}
3031 @section Pragma Effective_Reads
3034 Syntax:
3036 @example
3037 pragma Effective_Reads [ (boolean_EXPRESSION) ];
3038 @end example
3040 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3041 the SPARK 2014 Reference Manual, section 7.1.2.
3043 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3044 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{58}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{59}
3045 @section Pragma Effective_Writes
3048 Syntax:
3050 @example
3051 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3052 @end example
3054 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3055 in the SPARK 2014 Reference Manual, section 7.1.2.
3057 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3058 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5a}
3059 @section Pragma Elaboration_Checks
3062 @geindex Elaboration control
3064 Syntax:
3066 @example
3067 pragma Elaboration_Checks (Dynamic | Static);
3068 @end example
3070 This is a configuration pragma which specifies the elaboration model to be
3071 used during compilation. For more information on the elaboration models of
3072 GNAT, consult the chapter on elaboration order handling in the @emph{GNAT User's
3073 Guide}.
3075 The pragma may appear in the following contexts:
3078 @itemize *
3080 @item 
3081 Configuration pragmas file
3083 @item 
3084 Prior to the context clauses of a compilation unit's initial declaration
3085 @end itemize
3087 Any other placement of the pragma will result in a warning and the effects of
3088 the offending pragma will be ignored.
3090 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3091 effect. If the pragma argument is @code{Static}, then the static elaboration model
3092 is in effect.
3094 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3095 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5b}
3096 @section Pragma Eliminate
3099 @geindex Elimination of unused subprograms
3101 Syntax:
3103 @example
3104 pragma Eliminate (
3105             [  Unit_Name       => ] IDENTIFIER | SELECTED_COMPONENT ,
3106             [  Entity          => ] IDENTIFIER |
3107                                     SELECTED_COMPONENT |
3108                                     STRING_LITERAL
3109             [, Source_Location =>   SOURCE_TRACE ] );
3111         SOURCE_TRACE    ::= STRING_LITERAL
3112 @end example
3114 This pragma indicates that the given entity is not used in the program to be
3115 compiled and built, thus allowing the compiler to
3116 eliminate the code or data associated with the named entity. Any reference to
3117 an eliminated entity causes a compile-time or link-time error.
3119 The pragma has the following semantics, where @code{U} is the unit specified by
3120 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3121 argument:
3124 @itemize *
3126 @item 
3127 @code{E} must be a subprogram that is explicitly declared either:
3129 o  Within @code{U}, or
3131 o  Within a generic package that is instantiated in @code{U}, or
3133 o  As an instance of generic subprogram instantiated in @code{U}.
3135 Otherwise the pragma is ignored.
3137 @item 
3138 If @code{E} is overloaded within @code{U} then, in the absence of a
3139 @code{Source_Location} argument, all overloadings are eliminated.
3141 @item 
3142 If @code{E} is overloaded within @code{U} and only some overloadings
3143 are to be eliminated, then each overloading to be eliminated
3144 must be specified in a corresponding pragma @code{Eliminate}
3145 with a @code{Source_Location} argument identifying the line where the
3146 declaration appears, as described below.
3148 @item 
3149 If @code{E} is declared as the result of a generic instantiation, then
3150 a @code{Source_Location} argument is needed, as described below
3151 @end itemize
3153 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3154 manner, so that unused entities are eliminated but without
3155 needing to modify the source text. Normally the required set of
3156 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3158 Any source file change that removes, splits, or
3159 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3160 @code{Source_Location} argument values may get out of date.
3162 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3163 operation. In this case all the subprograms to which the given operation can
3164 dispatch are considered to be unused (are never called as a result of a direct
3165 or a dispatching call).
3167 The string literal given for the source location specifies the line number
3168 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3170 @example
3171 SOURCE_TRACE     ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3173 LBRACKET         ::= '['
3174 RBRACKET         ::= ']'
3176 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3178 LINE_NUMBER      ::= DIGIT @{DIGIT@}
3179 @end example
3181 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3183 The source trace that is given as the @code{Source_Location} must obey the
3184 following rules (or else the pragma is ignored), where @code{U} is
3185 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3186 subprogram specified by the @code{Entity} argument:
3189 @itemize *
3191 @item 
3192 @code{FILE_NAME} is the short name (with no directory
3193 information) of the Ada source file for @code{U}, using the required syntax
3194 for the underlying file system (e.g. case is significant if the underlying
3195 operating system is case sensitive).
3196 If @code{U} is a package and @code{E} is a subprogram declared in the package
3197 specification and its full declaration appears in the package body,
3198 then the  relevant source file is the one for the package specification;
3199 analogously if @code{U} is a generic package.
3201 @item 
3202 If @code{E} is not declared in a generic instantiation (this includes
3203 generic subprogram instances), the source trace includes only one source
3204 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3205 of the declaration of @code{E} within the source file (as a decimal literal
3206 without an exponent or point).
3208 @item 
3209 If @code{E} is declared by a generic instantiation, its source trace
3210 (from left to right) starts with the source location of the
3211 declaration of @code{E} in the generic unit and ends with the source
3212 location of the instantiation, given in square brackets. This approach is
3213 applied recursively with nested instantiations: the rightmost (nested
3214 most deeply in square brackets) element of the source trace is the location
3215 of the outermost instantiation, and the leftmost element (that is, outside
3216 of any square brackets) is the location of the declaration of @code{E} in
3217 the generic unit.
3218 @end itemize
3220 Examples:
3222 @quotation
3224 @example
3225 pragma Eliminate (Pkg0, Proc);
3226 -- Eliminate (all overloadings of) Proc in Pkg0
3228 pragma Eliminate (Pkg1, Proc,
3229                   Source_Location => "pkg1.ads:8");
3230 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3232 -- Assume the following file contents:
3233 --   gen_pkg.ads
3234 --   1: generic
3235 --   2:   type T is private;
3236 --   3: package Gen_Pkg is
3237 --   4:   procedure Proc(N : T);
3238 --  ...   ...
3239 --  ... end Gen_Pkg;
3241 --    q.adb
3242 --   1: with Gen_Pkg;
3243 --   2: procedure Q is
3244 --   3:   package Inst_Pkg is new Gen_Pkg(Integer);
3245 --  ...   -- No calls on Inst_Pkg.Proc
3246 --  ... end Q;
3248 -- The following pragma eliminates Inst_Pkg.Proc from Q
3249 pragma Eliminate (Q, Proc,
3250                   Source_Location => "gen_pkg.ads:4[q.adb:3]");
3251 @end example
3252 @end quotation
3254 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3255 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{5c}
3256 @section Pragma Enable_Atomic_Synchronization
3259 @geindex Atomic Synchronization
3261 Syntax:
3263 @example
3264 pragma Enable_Atomic_Synchronization [(Entity)];
3265 @end example
3267 Ada requires that accesses (reads or writes) of an atomic variable be
3268 regarded as synchronization points in the case of multiple tasks.
3269 Particularly in the case of multi-processors this may require special
3270 handling, e.g. the generation of memory barriers. This synchronization
3271 is performed by default, but can be turned off using
3272 @code{pragma Disable_Atomic_Synchronization}. The
3273 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3274 it back on.
3276 The placement and scope rules for this pragma are the same as those
3277 for @code{pragma Unsuppress}. In particular it can be used as a
3278 configuration  pragma, or in a declaration sequence where it applies
3279 till the end of the scope. If an @code{Entity} argument is present,
3280 the action applies only to that entity.
3282 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3283 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{5d}
3284 @section Pragma Export_Function
3287 @geindex Argument passing mechanisms
3289 Syntax:
3291 @example
3292 pragma Export_Function (
3293      [Internal         =>] LOCAL_NAME
3294   [, [External         =>] EXTERNAL_SYMBOL]
3295   [, [Parameter_Types  =>] PARAMETER_TYPES]
3296   [, [Result_Type      =>] result_SUBTYPE_MARK]
3297   [, [Mechanism        =>] MECHANISM]
3298   [, [Result_Mechanism =>] MECHANISM_NAME]);
3300 EXTERNAL_SYMBOL ::=
3301   IDENTIFIER
3302 | static_string_EXPRESSION
3303 | ""
3305 PARAMETER_TYPES ::=
3306   null
3307 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3309 TYPE_DESIGNATOR ::=
3310   subtype_NAME
3311 | subtype_Name ' Access
3313 MECHANISM ::=
3314   MECHANISM_NAME
3315 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3317 MECHANISM_ASSOCIATION ::=
3318   [formal_parameter_NAME =>] MECHANISM_NAME
3320 MECHANISM_NAME ::= Value | Reference
3321 @end example
3323 Use this pragma to make a function externally callable and optionally
3324 provide information on mechanisms to be used for passing parameter and
3325 result values.  We recommend, for the purposes of improving portability,
3326 this pragma always be used in conjunction with a separate pragma
3327 @code{Export}, which must precede the pragma @code{Export_Function}.
3328 GNAT does not require a separate pragma @code{Export}, but if none is
3329 present, @code{Convention Ada} is assumed, which is usually
3330 not what is wanted, so it is usually appropriate to use this
3331 pragma in conjunction with a @code{Export} or @code{Convention}
3332 pragma that specifies the desired foreign convention.
3333 Pragma @code{Export_Function}
3334 (and @code{Export}, if present) must appear in the same declarative
3335 region as the function to which they apply.
3337 The @code{internal_name} must uniquely designate the function to which the
3338 pragma applies.  If more than one function name exists of this name in
3339 the declarative part you must use the @code{Parameter_Types} and
3340 @code{Result_Type} parameters to achieve the required
3341 unique designation.  The @cite{subtype_mark}s in these parameters must
3342 exactly match the subtypes in the corresponding function specification,
3343 using positional notation to match parameters with subtype marks.
3344 The form with an @code{'Access} attribute can be used to match an
3345 anonymous access parameter.
3347 @geindex Suppressing external name
3349 Special treatment is given if the EXTERNAL is an explicit null
3350 string or a static string expressions that evaluates to the null
3351 string. In this case, no external name is generated. This form
3352 still allows the specification of parameter mechanisms.
3354 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3355 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{5e}
3356 @section Pragma Export_Object
3359 Syntax:
3361 @example
3362 pragma Export_Object
3363       [Internal =>] LOCAL_NAME
3364    [, [External =>] EXTERNAL_SYMBOL]
3365    [, [Size     =>] EXTERNAL_SYMBOL]
3367 EXTERNAL_SYMBOL ::=
3368   IDENTIFIER
3369 | static_string_EXPRESSION
3370 @end example
3372 This pragma designates an object as exported, and apart from the
3373 extended rules for external symbols, is identical in effect to the use of
3374 the normal @code{Export} pragma applied to an object.  You may use a
3375 separate Export pragma (and you probably should from the point of view
3376 of portability), but it is not required.  @code{Size} is syntax checked,
3377 but otherwise ignored by GNAT.
3379 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3380 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{5f}
3381 @section Pragma Export_Procedure
3384 Syntax:
3386 @example
3387 pragma Export_Procedure (
3388      [Internal        =>] LOCAL_NAME
3389   [, [External        =>] EXTERNAL_SYMBOL]
3390   [, [Parameter_Types =>] PARAMETER_TYPES]
3391   [, [Mechanism       =>] MECHANISM]);
3393 EXTERNAL_SYMBOL ::=
3394   IDENTIFIER
3395 | static_string_EXPRESSION
3396 | ""
3398 PARAMETER_TYPES ::=
3399   null
3400 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3402 TYPE_DESIGNATOR ::=
3403   subtype_NAME
3404 | subtype_Name ' Access
3406 MECHANISM ::=
3407   MECHANISM_NAME
3408 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3410 MECHANISM_ASSOCIATION ::=
3411   [formal_parameter_NAME =>] MECHANISM_NAME
3413 MECHANISM_NAME ::= Value | Reference
3414 @end example
3416 This pragma is identical to @code{Export_Function} except that it
3417 applies to a procedure rather than a function and the parameters
3418 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3419 GNAT does not require a separate pragma @code{Export}, but if none is
3420 present, @code{Convention Ada} is assumed, which is usually
3421 not what is wanted, so it is usually appropriate to use this
3422 pragma in conjunction with a @code{Export} or @code{Convention}
3423 pragma that specifies the desired foreign convention.
3425 @geindex Suppressing external name
3427 Special treatment is given if the EXTERNAL is an explicit null
3428 string or a static string expressions that evaluates to the null
3429 string. In this case, no external name is generated. This form
3430 still allows the specification of parameter mechanisms.
3432 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3433 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{60}
3434 @section Pragma Export_Value
3437 Syntax:
3439 @example
3440 pragma Export_Value (
3441   [Value     =>] static_integer_EXPRESSION,
3442   [Link_Name =>] static_string_EXPRESSION);
3443 @end example
3445 This pragma serves to export a static integer value for external use.
3446 The first argument specifies the value to be exported. The Link_Name
3447 argument specifies the symbolic name to be associated with the integer
3448 value. This pragma is useful for defining a named static value in Ada
3449 that can be referenced in assembly language units to be linked with
3450 the application. This pragma is currently supported only for the
3451 AAMP target and is ignored for other targets.
3453 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3454 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{61}
3455 @section Pragma Export_Valued_Procedure
3458 Syntax:
3460 @example
3461 pragma Export_Valued_Procedure (
3462      [Internal        =>] LOCAL_NAME
3463   [, [External        =>] EXTERNAL_SYMBOL]
3464   [, [Parameter_Types =>] PARAMETER_TYPES]
3465   [, [Mechanism       =>] MECHANISM]);
3467 EXTERNAL_SYMBOL ::=
3468   IDENTIFIER
3469 | static_string_EXPRESSION
3470 | ""
3472 PARAMETER_TYPES ::=
3473   null
3474 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3476 TYPE_DESIGNATOR ::=
3477   subtype_NAME
3478 | subtype_Name ' Access
3480 MECHANISM ::=
3481   MECHANISM_NAME
3482 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3484 MECHANISM_ASSOCIATION ::=
3485   [formal_parameter_NAME =>] MECHANISM_NAME
3487 MECHANISM_NAME ::= Value | Reference
3488 @end example
3490 This pragma is identical to @code{Export_Procedure} except that the
3491 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3492 mode @code{out}, and externally the subprogram is treated as a function
3493 with this parameter as the result of the function.  GNAT provides for
3494 this capability to allow the use of @code{out} and @code{in out}
3495 parameters in interfacing to external functions (which are not permitted
3496 in Ada functions).
3497 GNAT does not require a separate pragma @code{Export}, but if none is
3498 present, @code{Convention Ada} is assumed, which is almost certainly
3499 not what is wanted since the whole point of this pragma is to interface
3500 with foreign language functions, so it is usually appropriate to use this
3501 pragma in conjunction with a @code{Export} or @code{Convention}
3502 pragma that specifies the desired foreign convention.
3504 @geindex Suppressing external name
3506 Special treatment is given if the EXTERNAL is an explicit null
3507 string or a static string expressions that evaluates to the null
3508 string. In this case, no external name is generated. This form
3509 still allows the specification of parameter mechanisms.
3511 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3512 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{62}
3513 @section Pragma Extend_System
3516 @geindex System
3517 @geindex extending
3519 @geindex DEC Ada 83
3521 Syntax:
3523 @example
3524 pragma Extend_System ([Name =>] IDENTIFIER);
3525 @end example
3527 This pragma is used to provide backwards compatibility with other
3528 implementations that extend the facilities of package @code{System}.  In
3529 GNAT, @code{System} contains only the definitions that are present in
3530 the Ada RM.  However, other implementations, notably the DEC Ada 83
3531 implementation, provide many extensions to package @code{System}.
3533 For each such implementation accommodated by this pragma, GNAT provides a
3534 package @code{Aux_@emph{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3535 implementation, which provides the required additional definitions.  You
3536 can use this package in two ways.  You can @code{with} it in the normal
3537 way and access entities either by selection or using a @code{use}
3538 clause.  In this case no special processing is required.
3540 However, if existing code contains references such as
3541 @code{System.@emph{xxx}} where @emph{xxx} is an entity in the extended
3542 definitions provided in package @code{System}, you may use this pragma
3543 to extend visibility in @code{System} in a non-standard way that
3544 provides greater compatibility with the existing code.  Pragma
3545 @code{Extend_System} is a configuration pragma whose single argument is
3546 the name of the package containing the extended definition
3547 (e.g., @code{Aux_DEC} for the DEC Ada case).  A unit compiled under
3548 control of this pragma will be processed using special visibility
3549 processing that looks in package @code{System.Aux_@emph{xxx}} where
3550 @code{Aux_@emph{xxx}} is the pragma argument for any entity referenced in
3551 package @code{System}, but not found in package @code{System}.
3553 You can use this pragma either to access a predefined @code{System}
3554 extension supplied with the compiler, for example @code{Aux_DEC} or
3555 you can construct your own extension unit following the above
3556 definition.  Note that such a package is a child of @code{System}
3557 and thus is considered part of the implementation.
3558 To compile it you will have to use the @emph{-gnatg} switch
3559 for compiling System units, as explained in the
3560 GNAT User's Guide.
3562 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3563 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{63}
3564 @section Pragma Extensions_Allowed
3567 @geindex Ada Extensions
3569 @geindex GNAT Extensions
3571 Syntax:
3573 @example
3574 pragma Extensions_Allowed (On | Off);
3575 @end example
3577 This configuration pragma enables or disables the implementation
3578 extension mode (the use of Off as a parameter cancels the effect
3579 of the @emph{-gnatX} command switch).
3581 In extension mode, the latest version of the Ada language is
3582 implemented (currently Ada 2012), and in addition a small number
3583 of GNAT specific extensions are recognized as follows:
3586 @table @asis
3588 @item @emph{Constrained attribute for generic objects}
3590 The @code{Constrained} attribute is permitted for objects of
3591 generic types. The result indicates if the corresponding actual
3592 is constrained.
3593 @end table
3595 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3596 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{64}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{65}
3597 @section Pragma Extensions_Visible
3600 Syntax:
3602 @example
3603 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3604 @end example
3606 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3607 in the SPARK 2014 Reference Manual, section 6.1.7.
3609 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3610 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{66}
3611 @section Pragma External
3614 Syntax:
3616 @example
3617 pragma External (
3618   [   Convention    =>] convention_IDENTIFIER,
3619   [   Entity        =>] LOCAL_NAME
3620   [, [External_Name =>] static_string_EXPRESSION ]
3621   [, [Link_Name     =>] static_string_EXPRESSION ]);
3622 @end example
3624 This pragma is identical in syntax and semantics to pragma
3625 @code{Export} as defined in the Ada Reference Manual.  It is
3626 provided for compatibility with some Ada 83 compilers that
3627 used this pragma for exactly the same purposes as pragma
3628 @code{Export} before the latter was standardized.
3630 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3631 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{67}
3632 @section Pragma External_Name_Casing
3635 @geindex Dec Ada 83 casing compatibility
3637 @geindex External Names
3638 @geindex casing
3640 @geindex Casing of External names
3642 Syntax:
3644 @example
3645 pragma External_Name_Casing (
3646   Uppercase | Lowercase
3647   [, Uppercase | Lowercase | As_Is]);
3648 @end example
3650 This pragma provides control over the casing of external names associated
3651 with Import and Export pragmas.  There are two cases to consider:
3654 @itemize *
3656 @item 
3657 Implicit external names
3659 Implicit external names are derived from identifiers.  The most common case
3660 arises when a standard Ada Import or Export pragma is used with only two
3661 arguments, as in:
3663 @example
3664 pragma Import (C, C_Routine);
3665 @end example
3667 Since Ada is a case-insensitive language, the spelling of the identifier in
3668 the Ada source program does not provide any information on the desired
3669 casing of the external name, and so a convention is needed.  In GNAT the
3670 default treatment is that such names are converted to all lower case
3671 letters.  This corresponds to the normal C style in many environments.
3672 The first argument of pragma @code{External_Name_Casing} can be used to
3673 control this treatment.  If @code{Uppercase} is specified, then the name
3674 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3675 then the normal default of all lower case letters will be used.
3677 This same implicit treatment is also used in the case of extended DEC Ada 83
3678 compatible Import and Export pragmas where an external name is explicitly
3679 specified using an identifier rather than a string.
3681 @item 
3682 Explicit external names
3684 Explicit external names are given as string literals.  The most common case
3685 arises when a standard Ada Import or Export pragma is used with three
3686 arguments, as in:
3688 @example
3689 pragma Import (C, C_Routine, "C_routine");
3690 @end example
3692 In this case, the string literal normally provides the exact casing required
3693 for the external name.  The second argument of pragma
3694 @code{External_Name_Casing} may be used to modify this behavior.
3695 If @code{Uppercase} is specified, then the name
3696 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3697 then the name will be forced to all lowercase letters.  A specification of
3698 @code{As_Is} provides the normal default behavior in which the casing is
3699 taken from the string provided.
3700 @end itemize
3702 This pragma may appear anywhere that a pragma is valid.  In particular, it
3703 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3704 case it applies to all subsequent compilations, or it can be used as a program
3705 unit pragma, in which case it only applies to the current unit, or it can
3706 be used more locally to control individual Import/Export pragmas.
3708 It was primarily intended for use with OpenVMS systems, where many
3709 compilers convert all symbols to upper case by default.  For interfacing to
3710 such compilers (e.g., the DEC C compiler), it may be convenient to use
3711 the pragma:
3713 @example
3714 pragma External_Name_Casing (Uppercase, Uppercase);
3715 @end example
3717 to enforce the upper casing of all external symbols.
3719 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3720 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{68}
3721 @section Pragma Fast_Math
3724 Syntax:
3726 @example
3727 pragma Fast_Math;
3728 @end example
3730 This is a configuration pragma which activates a mode in which speed is
3731 considered more important for floating-point operations than absolutely
3732 accurate adherence to the requirements of the standard. Currently the
3733 following operations are affected:
3736 @table @asis
3738 @item @emph{Complex Multiplication}
3740 The normal simple formula for complex multiplication can result in intermediate
3741 overflows for numbers near the end of the range. The Ada standard requires that
3742 this situation be detected and corrected by scaling, but in Fast_Math mode such
3743 cases will simply result in overflow. Note that to take advantage of this you
3744 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3745 under control of the pragma, rather than use the preinstantiated versions.
3746 @end table
3748 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3749 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{69}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6a}
3750 @section Pragma Favor_Top_Level
3753 Syntax:
3755 @example
3756 pragma Favor_Top_Level (type_NAME);
3757 @end example
3759 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3760 type. This pragma is an efficiency hint to the compiler, regarding the use of
3761 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3762 The pragma means that nested subprograms are not used with this type, or are
3763 rare, so that the generated code should be efficient in the top-level case.
3764 When this pragma is used, dynamically generated trampolines may be used on some
3765 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3767 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3768 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6b}
3769 @section Pragma Finalize_Storage_Only
3772 Syntax:
3774 @example
3775 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3776 @end example
3778 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3779 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3780 pragma suppresses the call to @code{Finalize} for declared library-level objects
3781 of the argument type. This is mostly useful for types where finalization is
3782 only used to deal with storage reclamation since in most environments it is
3783 not necessary to reclaim memory just before terminating execution, hence the
3784 name. Note that this pragma does not suppress Finalize calls for library-level
3785 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3787 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3788 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{6c}
3789 @section Pragma Float_Representation
3792 Syntax:
3794 @example
3795 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3797 FLOAT_REP ::= VAX_Float | IEEE_Float
3798 @end example
3800 In the one argument form, this pragma is a configuration pragma which
3801 allows control over the internal representation chosen for the predefined
3802 floating point types declared in the packages @code{Standard} and
3803 @code{System}. This pragma is only provided for compatibility and has no effect.
3805 The two argument form specifies the representation to be used for
3806 the specified floating-point type. The argument must
3807 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3810 @itemize *
3812 @item 
3813 For a digits value of 6, 32-bit IEEE short format will be used.
3815 @item 
3816 For a digits value of 15, 64-bit IEEE long format will be used.
3818 @item 
3819 No other value of digits is permitted.
3820 @end itemize
3822 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3823 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{6d}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{6e}
3824 @section Pragma Ghost
3827 Syntax:
3829 @example
3830 pragma Ghost [ (boolean_EXPRESSION) ];
3831 @end example
3833 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
3834 2014 Reference Manual, section 6.9.
3836 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
3837 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{6f}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{70}
3838 @section Pragma Global
3841 Syntax:
3843 @example
3844 pragma Global (GLOBAL_SPECIFICATION);
3846 GLOBAL_SPECIFICATION ::=
3847      null
3848   | (GLOBAL_LIST)
3849   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
3851 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
3853 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
3854 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
3855 GLOBAL_ITEM   ::= NAME
3856 @end example
3858 For the semantics of this pragma, see the entry for aspect @code{Global} in the
3859 SPARK 2014 Reference Manual, section 6.1.4.
3861 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
3862 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{71}
3863 @section Pragma Ident
3866 Syntax:
3868 @example
3869 pragma Ident (static_string_EXPRESSION);
3870 @end example
3872 This pragma is identical in effect to pragma @code{Comment}. It is provided
3873 for compatibility with other Ada compilers providing this pragma.
3875 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
3876 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{72}
3877 @section Pragma Ignore_Pragma
3880 Syntax:
3882 @example
3883 pragma Ignore_Pragma (pragma_IDENTIFIER);
3884 @end example
3886 This is a configuration pragma
3887 that takes a single argument that is a simple identifier. Any subsequent
3888 use of a pragma whose pragma identifier matches this argument will be
3889 silently ignored. This may be useful when legacy code or code intended
3890 for compilation with some other compiler contains pragmas that match the
3891 name, but not the exact implementation, of a GNAT pragma. The use of this
3892 pragma allows such pragmas to be ignored, which may be useful in CodePeer
3893 mode, or during porting of legacy code.
3895 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
3896 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{73}
3897 @section Pragma Implementation_Defined
3900 Syntax:
3902 @example
3903 pragma Implementation_Defined (local_NAME);
3904 @end example
3906 This pragma marks a previously declared entity as implementation-defined.
3907 For an overloaded entity, applies to the most recent homonym.
3909 @example
3910 pragma Implementation_Defined;
3911 @end example
3913 The form with no arguments appears anywhere within a scope, most
3914 typically a package spec, and indicates that all entities that are
3915 defined within the package spec are Implementation_Defined.
3917 This pragma is used within the GNAT runtime library to identify
3918 implementation-defined entities introduced in language-defined units,
3919 for the purpose of implementing the No_Implementation_Identifiers
3920 restriction.
3922 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
3923 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{74}
3924 @section Pragma Implemented
3927 Syntax:
3929 @example
3930 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3932 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3933 @end example
3935 This is an Ada 2012 representation pragma which applies to protected, task
3936 and synchronized interface primitives. The use of pragma Implemented provides
3937 a way to impose a static requirement on the overriding operation by adhering
3938 to one of the three implementation kinds: entry, protected procedure or any of
3939 the above. This pragma is available in all earlier versions of Ada as an
3940 implementation-defined pragma.
3942 @example
3943 type Synch_Iface is synchronized interface;
3944 procedure Prim_Op (Obj : in out Iface) is abstract;
3945 pragma Implemented (Prim_Op, By_Protected_Procedure);
3947 protected type Prot_1 is new Synch_Iface with
3948    procedure Prim_Op;  --  Legal
3949 end Prot_1;
3951 protected type Prot_2 is new Synch_Iface with
3952    entry Prim_Op;      --  Illegal
3953 end Prot_2;
3955 task type Task_Typ is new Synch_Iface with
3956    entry Prim_Op;      --  Illegal
3957 end Task_Typ;
3958 @end example
3960 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3961 Implemented determines the runtime behavior of the requeue. Implementation kind
3962 By_Entry guarantees that the action of requeueing will proceed from an entry to
3963 another entry. Implementation kind By_Protected_Procedure transforms the
3964 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3965 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3966 the target's overriding subprogram kind.
3968 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
3969 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{75}
3970 @section Pragma Implicit_Packing
3973 @geindex Rational Profile
3975 Syntax:
3977 @example
3978 pragma Implicit_Packing;
3979 @end example
3981 This is a configuration pragma that requests implicit packing for packed
3982 arrays for which a size clause is given but no explicit pragma Pack or
3983 specification of Component_Size is present. It also applies to records
3984 where no record representation clause is present. Consider this example:
3986 @example
3987 type R is array (0 .. 7) of Boolean;
3988 for R'Size use 8;
3989 @end example
3991 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3992 does not change the layout of a composite object. So the Size clause in the
3993 above example is normally rejected, since the default layout of the array uses
3994 8-bit components, and thus the array requires a minimum of 64 bits.
3996 If this declaration is compiled in a region of code covered by an occurrence
3997 of the configuration pragma Implicit_Packing, then the Size clause in this
3998 and similar examples will cause implicit packing and thus be accepted. For
3999 this implicit packing to occur, the type in question must be an array of small
4000 components whose size is known at compile time, and the Size clause must
4001 specify the exact size that corresponds to the number of elements in the array
4002 multiplied by the size in bits of the component type (both single and
4003 multi-dimensioned arrays can be controlled with this pragma).
4005 @geindex Array packing
4007 Similarly, the following example shows the use in the record case
4009 @example
4010 type r is record
4011    a, b, c, d, e, f, g, h : boolean;
4012    chr                    : character;
4013 end record;
4014 for r'size use 16;
4015 @end example
4017 Without a pragma Pack, each Boolean field requires 8 bits, so the
4018 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4019 sufficient. The use of pragma Implicit_Packing allows this record
4020 declaration to compile without an explicit pragma Pack.
4022 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4023 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{76}
4024 @section Pragma Import_Function
4027 Syntax:
4029 @example
4030 pragma Import_Function (
4031      [Internal                 =>] LOCAL_NAME,
4032   [, [External                 =>] EXTERNAL_SYMBOL]
4033   [, [Parameter_Types          =>] PARAMETER_TYPES]
4034   [, [Result_Type              =>] SUBTYPE_MARK]
4035   [, [Mechanism                =>] MECHANISM]
4036   [, [Result_Mechanism         =>] MECHANISM_NAME]);
4038 EXTERNAL_SYMBOL ::=
4039   IDENTIFIER
4040 | static_string_EXPRESSION
4042 PARAMETER_TYPES ::=
4043   null
4044 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4046 TYPE_DESIGNATOR ::=
4047   subtype_NAME
4048 | subtype_Name ' Access
4050 MECHANISM ::=
4051   MECHANISM_NAME
4052 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4054 MECHANISM_ASSOCIATION ::=
4055   [formal_parameter_NAME =>] MECHANISM_NAME
4057 MECHANISM_NAME ::=
4058   Value
4059 | Reference
4060 @end example
4062 This pragma is used in conjunction with a pragma @code{Import} to
4063 specify additional information for an imported function.  The pragma
4064 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4065 @code{Import_Function} pragma and both must appear in the same
4066 declarative part as the function specification.
4068 The @code{Internal} argument must uniquely designate
4069 the function to which the
4070 pragma applies.  If more than one function name exists of this name in
4071 the declarative part you must use the @code{Parameter_Types} and
4072 @code{Result_Type} parameters to achieve the required unique
4073 designation.  Subtype marks in these parameters must exactly match the
4074 subtypes in the corresponding function specification, using positional
4075 notation to match parameters with subtype marks.
4076 The form with an @code{'Access} attribute can be used to match an
4077 anonymous access parameter.
4079 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4080 parameters to specify passing mechanisms for the
4081 parameters and result.  If you specify a single mechanism name, it
4082 applies to all parameters.  Otherwise you may specify a mechanism on a
4083 parameter by parameter basis using either positional or named
4084 notation.  If the mechanism is not specified, the default mechanism
4085 is used.
4087 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4088 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{77}
4089 @section Pragma Import_Object
4092 Syntax:
4094 @example
4095 pragma Import_Object
4096      [Internal =>] LOCAL_NAME
4097   [, [External =>] EXTERNAL_SYMBOL]
4098   [, [Size     =>] EXTERNAL_SYMBOL]);
4100 EXTERNAL_SYMBOL ::=
4101   IDENTIFIER
4102 | static_string_EXPRESSION
4103 @end example
4105 This pragma designates an object as imported, and apart from the
4106 extended rules for external symbols, is identical in effect to the use of
4107 the normal @code{Import} pragma applied to an object.  Unlike the
4108 subprogram case, you need not use a separate @code{Import} pragma,
4109 although you may do so (and probably should do so from a portability
4110 point of view).  @code{size} is syntax checked, but otherwise ignored by
4111 GNAT.
4113 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4114 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{78}
4115 @section Pragma Import_Procedure
4118 Syntax:
4120 @example
4121 pragma Import_Procedure (
4122      [Internal                 =>] LOCAL_NAME
4123   [, [External                 =>] EXTERNAL_SYMBOL]
4124   [, [Parameter_Types          =>] PARAMETER_TYPES]
4125   [, [Mechanism                =>] MECHANISM]);
4127 EXTERNAL_SYMBOL ::=
4128   IDENTIFIER
4129 | static_string_EXPRESSION
4131 PARAMETER_TYPES ::=
4132   null
4133 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4135 TYPE_DESIGNATOR ::=
4136   subtype_NAME
4137 | subtype_Name ' Access
4139 MECHANISM ::=
4140   MECHANISM_NAME
4141 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4143 MECHANISM_ASSOCIATION ::=
4144   [formal_parameter_NAME =>] MECHANISM_NAME
4146 MECHANISM_NAME ::= Value | Reference
4147 @end example
4149 This pragma is identical to @code{Import_Function} except that it
4150 applies to a procedure rather than a function and the parameters
4151 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4153 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4154 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{79}
4155 @section Pragma Import_Valued_Procedure
4158 Syntax:
4160 @example
4161 pragma Import_Valued_Procedure (
4162      [Internal                 =>] LOCAL_NAME
4163   [, [External                 =>] EXTERNAL_SYMBOL]
4164   [, [Parameter_Types          =>] PARAMETER_TYPES]
4165   [, [Mechanism                =>] MECHANISM]);
4167 EXTERNAL_SYMBOL ::=
4168   IDENTIFIER
4169 | static_string_EXPRESSION
4171 PARAMETER_TYPES ::=
4172   null
4173 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4175 TYPE_DESIGNATOR ::=
4176   subtype_NAME
4177 | subtype_Name ' Access
4179 MECHANISM ::=
4180   MECHANISM_NAME
4181 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4183 MECHANISM_ASSOCIATION ::=
4184   [formal_parameter_NAME =>] MECHANISM_NAME
4186 MECHANISM_NAME ::= Value | Reference
4187 @end example
4189 This pragma is identical to @code{Import_Procedure} except that the
4190 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4191 mode @code{out}, and externally the subprogram is treated as a function
4192 with this parameter as the result of the function.  The purpose of this
4193 capability is to allow the use of @code{out} and @code{in out}
4194 parameters in interfacing to external functions (which are not permitted
4195 in Ada functions).  You may optionally use the @code{Mechanism}
4196 parameters to specify passing mechanisms for the parameters.
4197 If you specify a single mechanism name, it applies to all parameters.
4198 Otherwise you may specify a mechanism on a parameter by parameter
4199 basis using either positional or named notation.  If the mechanism is not
4200 specified, the default mechanism is used.
4202 Note that it is important to use this pragma in conjunction with a separate
4203 pragma Import that specifies the desired convention, since otherwise the
4204 default convention is Ada, which is almost certainly not what is required.
4206 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4207 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7a}
4208 @section Pragma Independent
4211 Syntax:
4213 @example
4214 pragma Independent (Local_NAME);
4215 @end example
4217 This pragma is standard in Ada 2012 mode (which also provides an aspect
4218 of the same name). It is also available as an implementation-defined
4219 pragma in all earlier versions. It specifies that the
4220 designated object or all objects of the designated type must be
4221 independently addressable. This means that separate tasks can safely
4222 manipulate such objects. For example, if two components of a record are
4223 independent, then two separate tasks may access these two components.
4224 This may place
4225 constraints on the representation of the object (for instance prohibiting
4226 tight packing).
4228 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4229 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7b}
4230 @section Pragma Independent_Components
4233 Syntax:
4235 @example
4236 pragma Independent_Components (Local_NAME);
4237 @end example
4239 This pragma is standard in Ada 2012 mode (which also provides an aspect
4240 of the same name). It is also available as an implementation-defined
4241 pragma in all earlier versions. It specifies that the components of the
4242 designated object, or the components of each object of the designated
4243 type, must be
4244 independently addressable. This means that separate tasks can safely
4245 manipulate separate components in the composite object. This may place
4246 constraints on the representation of the object (for instance prohibiting
4247 tight packing).
4249 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4250 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{7c}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{7d}
4251 @section Pragma Initial_Condition
4254 Syntax:
4256 @example
4257 pragma Initial_Condition (boolean_EXPRESSION);
4258 @end example
4260 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4261 in the SPARK 2014 Reference Manual, section 7.1.6.
4263 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4264 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{7e}
4265 @section Pragma Initialize_Scalars
4268 @geindex debugging with Initialize_Scalars
4270 Syntax:
4272 @example
4273 pragma Initialize_Scalars;
4274 @end example
4276 This pragma is similar to @code{Normalize_Scalars} conceptually but has
4277 two important differences.  First, there is no requirement for the pragma
4278 to be used uniformly in all units of a partition, in particular, it is fine
4279 to use this just for some or all of the application units of a partition,
4280 without needing to recompile the run-time library.
4282 In the case where some units are compiled with the pragma, and some without,
4283 then a declaration of a variable where the type is defined in package
4284 Standard or is locally declared will always be subject to initialization,
4285 as will any declaration of a scalar variable.  For composite variables,
4286 whether the variable is initialized may also depend on whether the package
4287 in which the type of the variable is declared is compiled with the pragma.
4289 The other important difference is that you can control the value used
4290 for initializing scalar objects.  At bind time, you can select several
4291 options for initialization. You can
4292 initialize with invalid values (similar to Normalize_Scalars, though for
4293 Initialize_Scalars it is not always possible to determine the invalid
4294 values in complex cases like signed component fields with non-standard
4295 sizes). You can also initialize with high or
4296 low values, or with a specified bit pattern.  See the GNAT
4297 User's Guide for binder options for specifying these cases.
4299 This means that you can compile a program, and then without having to
4300 recompile the program, you can run it with different values being used
4301 for initializing otherwise uninitialized values, to test if your program
4302 behavior depends on the choice.  Of course the behavior should not change,
4303 and if it does, then most likely you have an incorrect reference to an
4304 uninitialized value.
4306 It is even possible to change the value at execution time eliminating even
4307 the need to rebind with a different switch using an environment variable.
4308 See the GNAT User's Guide for details.
4310 Note that pragma @code{Initialize_Scalars} is particularly useful in
4311 conjunction with the enhanced validity checking that is now provided
4312 in GNAT, which checks for invalid values under more conditions.
4313 Using this feature (see description of the @emph{-gnatV} flag in the
4314 GNAT User's Guide) in conjunction with
4315 pragma @code{Initialize_Scalars}
4316 provides a powerful new tool to assist in the detection of problems
4317 caused by uninitialized variables.
4319 Note: the use of @code{Initialize_Scalars} has a fairly extensive
4320 effect on the generated code. This may cause your code to be
4321 substantially larger. It may also cause an increase in the amount
4322 of stack required, so it is probably a good idea to turn on stack
4323 checking (see description of stack checking in the GNAT
4324 User's Guide) when using this pragma.
4326 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4327 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{7f}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{80}
4328 @section Pragma Initializes
4331 Syntax:
4333 @example
4334 pragma Initializes (INITIALIZATION_LIST);
4336 INITIALIZATION_LIST ::=
4337      null
4338   | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4340 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4342 INPUT_LIST ::=
4343      null
4344   |  INPUT
4345   | (INPUT @{, INPUT@})
4347 INPUT ::= name
4348 @end example
4350 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4351 SPARK 2014 Reference Manual, section 7.1.5.
4353 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4354 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{81}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{82}
4355 @section Pragma Inline_Always
4358 Syntax:
4360 @example
4361 pragma Inline_Always (NAME [, NAME]);
4362 @end example
4364 Similar to pragma @code{Inline} except that inlining is unconditional.
4365 Inline_Always instructs the compiler to inline every direct call to the
4366 subprogram or else to emit a compilation error, independently of any
4367 option, in particular @emph{-gnatn} or @emph{-gnatN} or the optimization level.
4368 It is an error to take the address or access of @code{NAME}. It is also an error to
4369 apply this pragma to a primitive operation of a tagged type. Thanks to such
4370 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4372 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4373 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{83}
4374 @section Pragma Inline_Generic
4377 Syntax:
4379 @example
4380 pragma Inline_Generic (GNAME @{, GNAME@});
4382 GNAME ::= generic_unit_NAME | generic_instance_NAME
4383 @end example
4385 This pragma is provided for compatibility with Dec Ada 83. It has
4386 no effect in GNAT (which always inlines generics), other
4387 than to check that the given names are all names of generic units or
4388 generic instances.
4390 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4391 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{84}
4392 @section Pragma Interface
4395 Syntax:
4397 @example
4398 pragma Interface (
4399      [Convention    =>] convention_identifier,
4400      [Entity        =>] local_NAME
4401   [, [External_Name =>] static_string_expression]
4402   [, [Link_Name     =>] static_string_expression]);
4403 @end example
4405 This pragma is identical in syntax and semantics to
4406 the standard Ada pragma @code{Import}.  It is provided for compatibility
4407 with Ada 83.  The definition is upwards compatible both with pragma
4408 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4409 with some extended implementations of this pragma in certain Ada 83
4410 implementations.  The only difference between pragma @code{Interface}
4411 and pragma @code{Import} is that there is special circuitry to allow
4412 both pragmas to appear for the same subprogram entity (normally it
4413 is illegal to have multiple @code{Import} pragmas. This is useful in
4414 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4415 Ada 83 compilers.
4417 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4418 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{85}
4419 @section Pragma Interface_Name
4422 Syntax:
4424 @example
4425 pragma Interface_Name (
4426      [Entity        =>] LOCAL_NAME
4427   [, [External_Name =>] static_string_EXPRESSION]
4428   [, [Link_Name     =>] static_string_EXPRESSION]);
4429 @end example
4431 This pragma provides an alternative way of specifying the interface name
4432 for an interfaced subprogram, and is provided for compatibility with Ada
4433 83 compilers that use the pragma for this purpose.  You must provide at
4434 least one of @code{External_Name} or @code{Link_Name}.
4436 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4437 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{86}
4438 @section Pragma Interrupt_Handler
4441 Syntax:
4443 @example
4444 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4445 @end example
4447 This program unit pragma is supported for parameterless protected procedures
4448 as described in Annex C of the Ada Reference Manual. On the AAMP target
4449 the pragma can also be specified for nonprotected parameterless procedures
4450 that are declared at the library level (which includes procedures
4451 declared at the top level of a library package). In the case of AAMP,
4452 when this pragma is applied to a nonprotected procedure, the instruction
4453 @code{IERET} is generated for returns from the procedure, enabling
4454 maskable interrupts, in place of the normal return instruction.
4456 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4457 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{87}
4458 @section Pragma Interrupt_State
4461 Syntax:
4463 @example
4464 pragma Interrupt_State
4465  ([Name  =>] value,
4466   [State =>] SYSTEM | RUNTIME | USER);
4467 @end example
4469 Normally certain interrupts are reserved to the implementation.  Any attempt
4470 to attach an interrupt causes Program_Error to be raised, as described in
4471 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
4472 many systems for an @code{Ctrl-C} interrupt.  Normally this interrupt is
4473 reserved to the implementation, so that @code{Ctrl-C} can be used to
4474 interrupt execution.  Additionally, signals such as @code{SIGSEGV},
4475 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4476 Ada exceptions, or used to implement run-time functions such as the
4477 @code{abort} statement and stack overflow checking.
4479 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4480 such uses of interrupts.  It subsumes the functionality of pragma
4481 @code{Unreserve_All_Interrupts}.  Pragma @code{Interrupt_State} is not
4482 available on Windows or VMS.  On all other platforms than VxWorks,
4483 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4484 and may be used to mark interrupts required by the board support package
4485 as reserved.
4487 Interrupts can be in one of three states:
4490 @itemize *
4492 @item 
4493 System
4495 The interrupt is reserved (no Ada handler can be installed), and the
4496 Ada run-time may not install a handler. As a result you are guaranteed
4497 standard system default action if this interrupt is raised. This also allows
4498 installing a low level handler via C APIs such as sigaction(), outside
4499 of Ada control.
4501 @item 
4502 Runtime
4504 The interrupt is reserved (no Ada handler can be installed). The run time
4505 is allowed to install a handler for internal control purposes, but is
4506 not required to do so.
4508 @item 
4509 User
4511 The interrupt is unreserved.  The user may install an Ada handler via
4512 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4513 some other action.
4514 @end itemize
4516 These states are the allowed values of the @code{State} parameter of the
4517 pragma.  The @code{Name} parameter is a value of the type
4518 @code{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
4519 @code{Ada.Interrupts.Names}.
4521 This is a configuration pragma, and the binder will check that there
4522 are no inconsistencies between different units in a partition in how a
4523 given interrupt is specified. It may appear anywhere a pragma is legal.
4525 The effect is to move the interrupt to the specified state.
4527 By declaring interrupts to be SYSTEM, you guarantee the standard system
4528 action, such as a core dump.
4530 By declaring interrupts to be USER, you guarantee that you can install
4531 a handler.
4533 Note that certain signals on many operating systems cannot be caught and
4534 handled by applications.  In such cases, the pragma is ignored.  See the
4535 operating system documentation, or the value of the array @code{Reserved}
4536 declared in the spec of package @code{System.OS_Interface}.
4538 Overriding the default state of signals used by the Ada runtime may interfere
4539 with an application's runtime behavior in the cases of the synchronous signals,
4540 and in the case of the signal used to implement the @code{abort} statement.
4542 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4543 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{88}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{89}
4544 @section Pragma Invariant
4547 Syntax:
4549 @example
4550 pragma Invariant
4551   ([Entity =>]    private_type_LOCAL_NAME,
4552    [Check  =>]    EXPRESSION
4553    [,[Message =>] String_Expression]);
4554 @end example
4556 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4557 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4558 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4559 requires the use of the aspect syntax, which is not available except in 2012
4560 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4561 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4562 note that the aspect Invariant is a synonym in GNAT for the aspect
4563 Type_Invariant, but there is no pragma Type_Invariant.
4565 The pragma must appear within the visible part of the package specification,
4566 after the type to which its Entity argument appears. As with the Invariant
4567 aspect, the Check expression is not analyzed until the end of the visible
4568 part of the package, so it may contain forward references. The Message
4569 argument, if present, provides the exception message used if the invariant
4570 is violated. If no Message parameter is provided, a default message that
4571 identifies the line on which the pragma appears is used.
4573 It is permissible to have multiple Invariants for the same type entity, in
4574 which case they are and'ed together. It is permissible to use this pragma
4575 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4576 invariant pragma for the same entity.
4578 For further details on the use of this pragma, see the Ada 2012 documentation
4579 of the Type_Invariant aspect.
4581 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4582 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8a}
4583 @section Pragma Keep_Names
4586 Syntax:
4588 @example
4589 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4590 @end example
4592 The @code{LOCAL_NAME} argument
4593 must refer to an enumeration first subtype
4594 in the current declarative part. The effect is to retain the enumeration
4595 literal names for use by @code{Image} and @code{Value} even if a global
4596 @code{Discard_Names} pragma applies. This is useful when you want to
4597 generally suppress enumeration literal names and for example you therefore
4598 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4599 want to retain the names for specific enumeration types.
4601 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4602 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8b}
4603 @section Pragma License
4606 @geindex License checking
4608 Syntax:
4610 @example
4611 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4612 @end example
4614 This pragma is provided to allow automated checking for appropriate license
4615 conditions with respect to the standard and modified GPL.  A pragma
4616 @code{License}, which is a configuration pragma that typically appears at
4617 the start of a source file or in a separate @code{gnat.adc} file, specifies
4618 the licensing conditions of a unit as follows:
4621 @itemize *
4623 @item 
4624 Unrestricted
4625 This is used for a unit that can be freely used with no license restrictions.
4626 Examples of such units are public domain units, and units from the Ada
4627 Reference Manual.
4629 @item 
4631 This is used for a unit that is licensed under the unmodified GPL, and which
4632 therefore cannot be @code{with}ed by a restricted unit.
4634 @item 
4635 Modified_GPL
4636 This is used for a unit licensed under the GNAT modified GPL that includes
4637 a special exception paragraph that specifically permits the inclusion of
4638 the unit in programs without requiring the entire program to be released
4639 under the GPL.
4641 @item 
4642 Restricted
4643 This is used for a unit that is restricted in that it is not permitted to
4644 depend on units that are licensed under the GPL.  Typical examples are
4645 proprietary code that is to be released under more restrictive license
4646 conditions.  Note that restricted units are permitted to @code{with} units
4647 which are licensed under the modified GPL (this is the whole point of the
4648 modified GPL).
4649 @end itemize
4651 Normally a unit with no @code{License} pragma is considered to have an
4652 unknown license, and no checking is done.  However, standard GNAT headers
4653 are recognized, and license information is derived from them as follows.
4655 A GNAT license header starts with a line containing 78 hyphens.  The following
4656 comment text is searched for the appearance of any of the following strings.
4658 If the string 'GNU General Public License' is found, then the unit is assumed
4659 to have GPL license, unless the string 'As a special exception' follows, in
4660 which case the license is assumed to be modified GPL.
4662 If one of the strings
4663 'This specification is adapted from the Ada Semantic Interface' or
4664 'This specification is derived from the Ada Reference Manual' is found
4665 then the unit is assumed to be unrestricted.
4667 These default actions means that a program with a restricted license pragma
4668 will automatically get warnings if a GPL unit is inappropriately
4669 @code{with}ed.  For example, the program:
4671 @example
4672 with Sem_Ch3;
4673 with GNAT.Sockets;
4674 procedure Secret_Stuff is
4675   ...
4676 end Secret_Stuff
4677 @end example
4679 if compiled with pragma @code{License} (@code{Restricted}) in a
4680 @code{gnat.adc} file will generate the warning:
4682 @example
4683 1.  with Sem_Ch3;
4684         |
4685    >>> license of withed unit "Sem_Ch3" is incompatible
4687 2.  with GNAT.Sockets;
4688 3.  procedure Secret_Stuff is
4689 @end example
4691 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4692 compiler and is licensed under the
4693 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4694 run time, and is therefore licensed under the modified GPL.
4696 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4697 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{8c}
4698 @section Pragma Link_With
4701 Syntax:
4703 @example
4704 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4705 @end example
4707 This pragma is provided for compatibility with certain Ada 83 compilers.
4708 It has exactly the same effect as pragma @code{Linker_Options} except
4709 that spaces occurring within one of the string expressions are treated
4710 as separators. For example, in the following case:
4712 @example
4713 pragma Link_With ("-labc -ldef");
4714 @end example
4716 results in passing the strings @code{-labc} and @code{-ldef} as two
4717 separate arguments to the linker. In addition pragma Link_With allows
4718 multiple arguments, with the same effect as successive pragmas.
4720 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4721 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{8d}
4722 @section Pragma Linker_Alias
4725 Syntax:
4727 @example
4728 pragma Linker_Alias (
4729   [Entity =>] LOCAL_NAME,
4730   [Target =>] static_string_EXPRESSION);
4731 @end example
4733 @code{LOCAL_NAME} must refer to an object that is declared at the library
4734 level. This pragma establishes the given entity as a linker alias for the
4735 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4736 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4737 @code{static_string_EXPRESSION} in the object file, that is to say no space
4738 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4739 to the same address as @code{static_string_EXPRESSION} by the linker.
4741 The actual linker name for the target must be used (e.g., the fully
4742 encoded name with qualification in Ada, or the mangled name in C++),
4743 or it must be declared using the C convention with @code{pragma Import}
4744 or @code{pragma Export}.
4746 Not all target machines support this pragma. On some of them it is accepted
4747 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4749 @example
4750 --  Example of the use of pragma Linker_Alias
4752 package p is
4753   i : Integer := 1;
4754   pragma Export (C, i);
4756   new_name_for_i : Integer;
4757   pragma Linker_Alias (new_name_for_i, "i");
4758 end p;
4759 @end example
4761 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4762 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{8e}
4763 @section Pragma Linker_Constructor
4766 Syntax:
4768 @example
4769 pragma Linker_Constructor (procedure_LOCAL_NAME);
4770 @end example
4772 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4773 is declared at the library level. A procedure to which this pragma is
4774 applied will be treated as an initialization routine by the linker.
4775 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4776 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
4777 of the executable is called (or immediately after the shared library is
4778 loaded if the procedure is linked in a shared library), in particular
4779 before the Ada run-time environment is set up.
4781 Because of these specific contexts, the set of operations such a procedure
4782 can perform is very limited and the type of objects it can manipulate is
4783 essentially restricted to the elementary types. In particular, it must only
4784 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4786 This pragma is used by GNAT to implement auto-initialization of shared Stand
4787 Alone Libraries, which provides a related capability without the restrictions
4788 listed above. Where possible, the use of Stand Alone Libraries is preferable
4789 to the use of this pragma.
4791 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
4792 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{8f}
4793 @section Pragma Linker_Destructor
4796 Syntax:
4798 @example
4799 pragma Linker_Destructor (procedure_LOCAL_NAME);
4800 @end example
4802 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4803 is declared at the library level. A procedure to which this pragma is
4804 applied will be treated as a finalization routine by the linker.
4805 It is equivalent to @code{__attribute__((destructor))} in GNU C and
4806 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
4807 of the executable has exited (or immediately before the shared library
4808 is unloaded if the procedure is linked in a shared library), in particular
4809 after the Ada run-time environment is shut down.
4811 See @code{pragma Linker_Constructor} for the set of restrictions that apply
4812 because of these specific contexts.
4814 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
4815 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{90}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{91}
4816 @section Pragma Linker_Section
4819 Syntax:
4821 @example
4822 pragma Linker_Section (
4823   [Entity  =>] LOCAL_NAME,
4824   [Section =>] static_string_EXPRESSION);
4825 @end example
4827 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
4828 declared at the library level. This pragma specifies the name of the
4829 linker section for the given entity. It is equivalent to
4830 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
4831 be placed in the @code{static_string_EXPRESSION} section of the
4832 executable (assuming the linker doesn't rename the section).
4833 GNAT also provides an implementation defined aspect of the same name.
4835 In the case of specifying this aspect for a type, the effect is to
4836 specify the corresponding section for all library-level objects of
4837 the type that do not have an explicit linker section set. Note that
4838 this only applies to whole objects, not to components of composite objects.
4840 In the case of a subprogram, the linker section applies to all previously
4841 declared matching overloaded subprograms in the current declarative part
4842 which do not already have a linker section assigned. The linker section
4843 aspect is useful in this case for specifying different linker sections
4844 for different elements of such an overloaded set.
4846 Note that an empty string specifies that no linker section is specified.
4847 This is not quite the same as omitting the pragma or aspect, since it
4848 can be used to specify that one element of an overloaded set of subprograms
4849 has the default linker section, or that one object of a type for which a
4850 linker section is specified should has the default linker section.
4852 The compiler normally places library-level entities in standard sections
4853 depending on the class: procedures and functions generally go in the
4854 @code{.text} section, initialized variables in the @code{.data} section
4855 and uninitialized variables in the @code{.bss} section.
4857 Other, special sections may exist on given target machines to map special
4858 hardware, for example I/O ports or flash memory. This pragma is a means to
4859 defer the final layout of the executable to the linker, thus fully working
4860 at the symbolic level with the compiler.
4862 Some file formats do not support arbitrary sections so not all target
4863 machines support this pragma. The use of this pragma may cause a program
4864 execution to be erroneous if it is used to place an entity into an
4865 inappropriate section (e.g., a modified variable into the @code{.text}
4866 section). See also @code{pragma Persistent_BSS}.
4868 @example
4869 --  Example of the use of pragma Linker_Section
4871 package IO_Card is
4872   Port_A : Integer;
4873   pragma Volatile (Port_A);
4874   pragma Linker_Section (Port_A, ".bss.port_a");
4876   Port_B : Integer;
4877   pragma Volatile (Port_B);
4878   pragma Linker_Section (Port_B, ".bss.port_b");
4880   type Port_Type is new Integer with Linker_Section => ".bss";
4881   PA : Port_Type with Linker_Section => ".bss.PA";
4882   PB : Port_Type; --  ends up in linker section ".bss"
4884   procedure Q with Linker_Section => "Qsection";
4885 end IO_Card;
4886 @end example
4888 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
4889 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{92}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{93}
4890 @section Pragma Lock_Free
4893 Syntax:
4894 This pragma may be specified for protected types or objects. It specifies that
4895 the implementation of protected operations must be implemented without locks.
4896 Compilation fails if the compiler cannot generate lock-free code for the
4897 operations.
4899 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
4900 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{94}
4901 @section Pragma Loop_Invariant
4904 Syntax:
4906 @example
4907 pragma Loop_Invariant ( boolean_EXPRESSION );
4908 @end example
4910 The effect of this pragma is similar to that of pragma @code{Assert},
4911 except that in an @code{Assertion_Policy} pragma, the identifier
4912 @code{Loop_Invariant} is used to control whether it is ignored or checked
4913 (or disabled).
4915 @code{Loop_Invariant} can only appear as one of the items in the sequence
4916 of statements of a loop body, or nested inside block statements that
4917 appear in the sequence of statements of a loop body.
4918 The intention is that it be used to
4919 represent a "loop invariant" assertion, i.e. something that is true each
4920 time through the loop, and which can be used to show that the loop is
4921 achieving its purpose.
4923 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
4924 apply to the same loop should be grouped in the same sequence of
4925 statements.
4927 To aid in writing such invariants, the special attribute @code{Loop_Entry}
4928 may be used to refer to the value of an expression on entry to the loop. This
4929 attribute can only be used within the expression of a @code{Loop_Invariant}
4930 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
4932 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
4933 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{95}
4934 @section Pragma Loop_Optimize
4937 Syntax:
4939 @example
4940 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4942 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
4943 @end example
4945 This pragma must appear immediately within a loop statement.  It allows the
4946 programmer to specify optimization hints for the enclosing loop.  The hints
4947 are not mutually exclusive and can be freely mixed, but not all combinations
4948 will yield a sensible outcome.
4950 There are five supported optimization hints for a loop:
4953 @itemize *
4955 @item 
4956 Ivdep
4958 The programmer asserts that there are no loop-carried dependencies
4959 which would prevent consecutive iterations of the loop from being
4960 executed simultaneously.
4962 @item 
4963 No_Unroll
4965 The loop must not be unrolled.  This is a strong hint: the compiler will not
4966 unroll a loop marked with this hint.
4968 @item 
4969 Unroll
4971 The loop should be unrolled.  This is a weak hint: the compiler will try to
4972 apply unrolling to this loop preferably to other optimizations, notably
4973 vectorization, but there is no guarantee that the loop will be unrolled.
4975 @item 
4976 No_Vector
4978 The loop must not be vectorized.  This is a strong hint: the compiler will not
4979 vectorize a loop marked with this hint.
4981 @item 
4982 Vector
4984 The loop should be vectorized.  This is a weak hint: the compiler will try to
4985 apply vectorization to this loop preferably to other optimizations, notably
4986 unrolling, but there is no guarantee that the loop will be vectorized.
4987 @end itemize
4989 These hints do not remove the need to pass the appropriate switches to the
4990 compiler in order to enable the relevant optimizations, that is to say
4991 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
4992 vectorization.
4994 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
4995 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{96}
4996 @section Pragma Loop_Variant
4999 Syntax:
5001 @example
5002 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5003 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5004 CHANGE_DIRECTION ::= Increases | Decreases
5005 @end example
5007 @code{Loop_Variant} can only appear as one of the items in the sequence
5008 of statements of a loop body, or nested inside block statements that
5009 appear in the sequence of statements of a loop body.
5010 It allows the specification of quantities which must always
5011 decrease or increase in successive iterations of the loop. In its simplest
5012 form, just one expression is specified, whose value must increase or decrease
5013 on each iteration of the loop.
5015 In a more complex form, multiple arguments can be given which are intepreted
5016 in a nesting lexicographic manner. For example:
5018 @example
5019 pragma Loop_Variant (Increases => X, Decreases => Y);
5020 @end example
5022 specifies that each time through the loop either X increases, or X stays
5023 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5024 loop is making progress. It can be useful in helping to show informally
5025 or prove formally that the loop always terminates.
5027 @code{Loop_Variant} is an assertion whose effect can be controlled using
5028 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5029 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5030 to ignore the check (in which case the pragma has no effect on the program),
5031 or @code{Disable} in which case the pragma is not even checked for correct
5032 syntax.
5034 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5035 apply to the same loop should be grouped in the same sequence of
5036 statements.
5038 The @code{Loop_Entry} attribute may be used within the expressions of the
5039 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5041 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5042 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{97}
5043 @section Pragma Machine_Attribute
5046 Syntax:
5048 @example
5049 pragma Machine_Attribute (
5050      [Entity         =>] LOCAL_NAME,
5051      [Attribute_Name =>] static_string_EXPRESSION
5052   [, [Info           =>] static_EXPRESSION] );
5053 @end example
5055 Machine-dependent attributes can be specified for types and/or
5056 declarations.  This pragma is semantically equivalent to
5057 @code{__attribute__((@emph{attribute_name}))} (if @code{info} is not
5058 specified) or @code{__attribute__((@emph{attribute_name(info})))}
5059 in GNU C, where @emph{attribute_name} is recognized by the
5060 compiler middle-end or the @code{TARGET_ATTRIBUTE_TABLE} machine
5061 specific macro.  A string literal for the optional parameter @code{info}
5062 is transformed into an identifier, which may make this pragma unusable
5063 for some attributes.
5064 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5066 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5067 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{98}
5068 @section Pragma Main
5071 Syntax:
5073 @example
5074 pragma Main
5075  (MAIN_OPTION [, MAIN_OPTION]);
5077 MAIN_OPTION ::=
5078   [Stack_Size              =>] static_integer_EXPRESSION
5079 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5080 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
5081 @end example
5083 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5084 no effect in GNAT, other than being syntax checked.
5086 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5087 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{99}
5088 @section Pragma Main_Storage
5091 Syntax:
5093 @example
5094 pragma Main_Storage
5095   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5097 MAIN_STORAGE_OPTION ::=
5098   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5099 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
5100 @end example
5102 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
5103 no effect in GNAT, other than being syntax checked.
5105 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5106 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9a}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9b}
5107 @section Pragma Max_Queue_Length
5110 Syntax:
5112 @example
5113 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5114 @end example
5116 This pragma is used to specify the maximum callers per entry queue for
5117 individual protected entries and entry families. It accepts a single
5118 positive integer as a parameter and must appear after the declaration
5119 of an entry.
5121 @node Pragma No_Body,Pragma No_Component_Reordering,Pragma Max_Queue_Length,Implementation Defined Pragmas
5122 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{9c}
5123 @section Pragma No_Body
5126 Syntax:
5128 @example
5129 pragma No_Body;
5130 @end example
5132 There are a number of cases in which a package spec does not require a body,
5133 and in fact a body is not permitted. GNAT will not permit the spec to be
5134 compiled if there is a body around. The pragma No_Body allows you to provide
5135 a body file, even in a case where no body is allowed. The body file must
5136 contain only comments and a single No_Body pragma. This is recognized by
5137 the compiler as indicating that no body is logically present.
5139 This is particularly useful during maintenance when a package is modified in
5140 such a way that a body needed before is no longer needed. The provision of a
5141 dummy body with a No_Body pragma ensures that there is no interference from
5142 earlier versions of the package body.
5144 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Body,Implementation Defined Pragmas
5145 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{9d}
5146 @section Pragma No_Component_Reordering
5149 Syntax:
5151 @example
5152 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5153 @end example
5155 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5156 declarative part. The effect is to preclude any reordering of components
5157 for the layout of the record, i.e. the record is laid out by the compiler
5158 in the order in which the components are declared textually. The form with
5159 no argument is a configuration pragma which applies to all record types
5160 declared in units to which the pragma applies and there is a requirement
5161 that this pragma be used consistently within a partition.
5163 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5164 @anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{9e}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{9f}
5165 @section Pragma No_Elaboration_Code_All
5168 Syntax:
5170 @example
5171 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5172 @end example
5174 This is a program unit pragma (there is also an equivalent aspect of the
5175 same name) that establishes the restriction @code{No_Elaboration_Code} for
5176 the current unit and any extended main source units (body and subunits).
5177 It also has the effect of enforcing a transitive application of this
5178 aspect, so that if any unit is implicitly or explicitly with'ed by the
5179 current unit, it must also have the No_Elaboration_Code_All aspect set.
5180 It may be applied to package or subprogram specs or their generic versions.
5182 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5183 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a0}
5184 @section Pragma No_Heap_Finalization
5187 Syntax:
5189 @example
5190 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5191 @end example
5193 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5194 type-specific pragma.
5196 In its configuration form, the pragma must appear within a configuration file
5197 such as gnat.adc, without an argument. The pragma suppresses the call to
5198 @code{Finalize} for heap-allocated objects created through library-level named
5199 access-to-object types in cases where the designated type requires finalization
5200 actions.
5202 In its type-specific form, the argument of the pragma must denote a
5203 library-level named access-to-object type. The pragma suppresses the call to
5204 @code{Finalize} for heap-allocated objects created through the specific access type
5205 in cases where the designated type requires finalization actions.
5207 It is still possible to finalize such heap-allocated objects by explicitly
5208 deallocating them.
5210 A library-level named access-to-object type declared within a generic unit will
5211 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5212 appear at the library level.
5214 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5215 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a1}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a2}
5216 @section Pragma No_Inline
5219 Syntax:
5221 @example
5222 pragma No_Inline (NAME @{, NAME@});
5223 @end example
5225 This pragma suppresses inlining for the callable entity or the instances of
5226 the generic subprogram designated by @code{NAME}, including inlining that
5227 results from the use of pragma @code{Inline}.  This pragma is always active,
5228 in particular it is not subject to the use of option @emph{-gnatn} or
5229 @emph{-gnatN}.  It is illegal to specify both pragma @code{No_Inline} and
5230 pragma @code{Inline_Always} for the same @code{NAME}.
5232 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
5233 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a3}
5234 @section Pragma No_Return
5237 Syntax:
5239 @example
5240 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5241 @end example
5243 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5244 declarations in the current declarative part.  A procedure to which this
5245 pragma is applied may not contain any explicit @code{return} statements.
5246 In addition, if the procedure contains any implicit returns from falling
5247 off the end of a statement sequence, then execution of that implicit
5248 return will cause Program_Error to be raised.
5250 One use of this pragma is to identify procedures whose only purpose is to raise
5251 an exception. Another use of this pragma is to suppress incorrect warnings
5252 about missing returns in functions, where the last statement of a function
5253 statement sequence is a call to such a procedure.
5255 Note that in Ada 2005 mode, this pragma is part of the language. It is
5256 available in all earlier versions of Ada as an implementation-defined
5257 pragma.
5259 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
5260 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{a4}
5261 @section Pragma No_Run_Time
5264 Syntax:
5266 @example
5267 pragma No_Run_Time;
5268 @end example
5270 This is an obsolete configuration pragma that historically was used to
5271 set up a runtime library with no object code. It is now used only for
5272 internal testing. The pragma has been superseded by the reconfigurable
5273 runtime capability of GNAT.
5275 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
5276 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{a5}
5277 @section Pragma No_Strict_Aliasing
5280 Syntax:
5282 @example
5283 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5284 @end example
5286 @code{type_LOCAL_NAME} must refer to an access type
5287 declaration in the current declarative part.  The effect is to inhibit
5288 strict aliasing optimization for the given type.  The form with no
5289 arguments is a configuration pragma which applies to all access types
5290 declared in units to which the pragma applies. For a detailed
5291 description of the strict aliasing optimization, and the situations
5292 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5293 in the @cite{GNAT User's Guide}.
5295 This pragma currently has no effects on access to unconstrained array types.
5297 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5298 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{a6}@anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{a7}
5299 @section Pragma No_Tagged_Streams
5302 Syntax:
5304 @example
5305 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5306 @end example
5308 Normally when a tagged type is introduced using a full type declaration,
5309 part of the processing includes generating stream access routines to be
5310 used by stream attributes referencing the type (or one of its subtypes
5311 or derived types). This can involve the generation of significant amounts
5312 of code which is wasted space if stream routines are not needed for the
5313 type in question.
5315 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5316 routines to be skipped, and any attempt to use stream operations on
5317 types subject to this pragma will be statically rejected as illegal.
5319 There are two forms of the pragma. The form with no arguments must appear
5320 in a declarative sequence or in the declarations of a package spec. This
5321 pragma affects all subsequent root tagged types declared in the declaration
5322 sequence, and specifies that no stream routines be generated. The form with
5323 an argument (for which there is also a corresponding aspect) specifies a
5324 single root tagged type for which stream routines are not to be generated.
5326 Once the pragma has been given for a particular root tagged type, all subtypes
5327 and derived types of this type inherit the pragma automatically, so the effect
5328 applies to a complete hierarchy (this is necessary to deal with the class-wide
5329 dispatching versions of the stream routines).
5331 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5332 applied to a tagged type its Expanded_Name and External_Tag are initialized
5333 with empty strings. This is useful to avoid exposing entity names at binary
5334 level but has a negative impact on the debuggability of tagged types.
5336 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5337 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{a8}
5338 @section Pragma Normalize_Scalars
5341 Syntax:
5343 @example
5344 pragma Normalize_Scalars;
5345 @end example
5347 This is a language defined pragma which is fully implemented in GNAT.  The
5348 effect is to cause all scalar objects that are not otherwise initialized
5349 to be initialized.  The initial values are implementation dependent and
5350 are as follows:
5353 @table @asis
5355 @item @emph{Standard.Character}
5357 Objects whose root type is Standard.Character are initialized to
5358 Character'Last unless the subtype range excludes NUL (in which case
5359 NUL is used). This choice will always generate an invalid value if
5360 one exists.
5362 @item @emph{Standard.Wide_Character}
5364 Objects whose root type is Standard.Wide_Character are initialized to
5365 Wide_Character'Last unless the subtype range excludes NUL (in which case
5366 NUL is used). This choice will always generate an invalid value if
5367 one exists.
5369 @item @emph{Standard.Wide_Wide_Character}
5371 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5372 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5373 which case NUL is used). This choice will always generate an invalid value if
5374 one exists.
5376 @item @emph{Integer types}
5378 Objects of an integer type are treated differently depending on whether
5379 negative values are present in the subtype. If no negative values are
5380 present, then all one bits is used as the initial value except in the
5381 special case where zero is excluded from the subtype, in which case
5382 all zero bits are used. This choice will always generate an invalid
5383 value if one exists.
5385 For subtypes with negative values present, the largest negative number
5386 is used, except in the unusual case where this largest negative number
5387 is in the subtype, and the largest positive number is not, in which case
5388 the largest positive value is used. This choice will always generate
5389 an invalid value if one exists.
5391 @item @emph{Floating-Point Types}
5393 Objects of all floating-point types are initialized to all 1-bits. For
5394 standard IEEE format, this corresponds to a NaN (not a number) which is
5395 indeed an invalid value.
5397 @item @emph{Fixed-Point Types}
5399 Objects of all fixed-point types are treated as described above for integers,
5400 with the rules applying to the underlying integer value used to represent
5401 the fixed-point value.
5403 @item @emph{Modular types}
5405 Objects of a modular type are initialized to all one bits, except in
5406 the special case where zero is excluded from the subtype, in which
5407 case all zero bits are used. This choice will always generate an
5408 invalid value if one exists.
5410 @item @emph{Enumeration types}
5412 Objects of an enumeration type are initialized to all one-bits, i.e., to
5413 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5414 whose Pos value is zero, in which case a code of zero is used. This choice
5415 will always generate an invalid value if one exists.
5416 @end table
5418 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5419 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{a9}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{aa}
5420 @section Pragma Obsolescent
5423 Syntax:
5425 @example
5426 pragma Obsolescent;
5428 pragma Obsolescent (
5429   [Message =>] static_string_EXPRESSION
5430 [,[Version =>] Ada_05]]);
5432 pragma Obsolescent (
5433   [Entity  =>] NAME
5434 [,[Message =>] static_string_EXPRESSION
5435 [,[Version =>] Ada_05]] );
5436 @end example
5438 This pragma can occur immediately following a declaration of an entity,
5439 including the case of a record component. If no Entity argument is present,
5440 then this declaration is the one to which the pragma applies. If an Entity
5441 parameter is present, it must either match the name of the entity in this
5442 declaration, or alternatively, the pragma can immediately follow an enumeration
5443 type declaration, where the Entity argument names one of the enumeration
5444 literals.
5446 This pragma is used to indicate that the named entity
5447 is considered obsolescent and should not be used. Typically this is
5448 used when an API must be modified by eventually removing or modifying
5449 existing subprograms or other entities. The pragma can be used at an
5450 intermediate stage when the entity is still present, but will be
5451 removed later.
5453 The effect of this pragma is to output a warning message on a reference to
5454 an entity thus marked that the subprogram is obsolescent if the appropriate
5455 warning option in the compiler is activated. If the @code{Message} parameter is
5456 present, then a second warning message is given containing this text. In
5457 addition, a reference to the entity is considered to be a violation of pragma
5458 @code{Restrictions (No_Obsolescent_Features)}.
5460 This pragma can also be used as a program unit pragma for a package,
5461 in which case the entity name is the name of the package, and the
5462 pragma indicates that the entire package is considered
5463 obsolescent. In this case a client @code{with}ing such a package
5464 violates the restriction, and the @code{with} clause is
5465 flagged with warnings if the warning option is set.
5467 If the @code{Version} parameter is present (which must be exactly
5468 the identifier @code{Ada_05}, no other argument is allowed), then the
5469 indication of obsolescence applies only when compiling in Ada 2005
5470 mode. This is primarily intended for dealing with the situations
5471 in the predefined library where subprograms or packages
5472 have become defined as obsolescent in Ada 2005
5473 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5475 The following examples show typical uses of this pragma:
5477 @example
5478 package p is
5479    pragma Obsolescent (p, Message => "use pp instead of p");
5480 end p;
5482 package q is
5483    procedure q2;
5484    pragma Obsolescent ("use q2new instead");
5486    type R is new integer;
5487    pragma Obsolescent
5488      (Entity  => R,
5489       Message => "use RR in Ada 2005",
5490       Version => Ada_05);
5492    type M is record
5493       F1 : Integer;
5494       F2 : Integer;
5495       pragma Obsolescent;
5496       F3 : Integer;
5497    end record;
5499    type E is (a, bc, 'd', quack);
5500    pragma Obsolescent (Entity => bc)
5501    pragma Obsolescent (Entity => 'd')
5503    function "+"
5504      (a, b : character) return character;
5505    pragma Obsolescent (Entity => "+");
5506 end;
5507 @end example
5509 Note that, as for all pragmas, if you use a pragma argument identifier,
5510 then all subsequent parameters must also use a pragma argument identifier.
5511 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5512 argument is present, it must be preceded by @code{Message =>}.
5514 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5515 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{ab}
5516 @section Pragma Optimize_Alignment
5519 @geindex Alignment
5520 @geindex default settings
5522 Syntax:
5524 @example
5525 pragma Optimize_Alignment (TIME | SPACE | OFF);
5526 @end example
5528 This is a configuration pragma which affects the choice of default alignments
5529 for types and objects where no alignment is explicitly specified. There is a
5530 time/space trade-off in the selection of these values. Large alignments result
5531 in more efficient code, at the expense of larger data space, since sizes have
5532 to be increased to match these alignments. Smaller alignments save space, but
5533 the access code is slower. The normal choice of default alignments for types
5534 and individual alignment promotions for objects (which is what you get if you
5535 do not use this pragma, or if you use an argument of OFF), tries to balance
5536 these two requirements.
5538 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5539 First any packed record is given an alignment of 1. Second, if a size is given
5540 for the type, then the alignment is chosen to avoid increasing this size. For
5541 example, consider:
5543 @example
5544 type R is record
5545    X : Integer;
5546    Y : Character;
5547 end record;
5549 for R'Size use 5*8;
5550 @end example
5552 In the default mode, this type gets an alignment of 4, so that access to the
5553 Integer field X are efficient. But this means that objects of the type end up
5554 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5555 allowed to be bigger than the size of the type, but it can waste space if for
5556 example fields of type R appear in an enclosing record. If the above type is
5557 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5559 However, there is one case in which SPACE is ignored. If a variable length
5560 record (that is a discriminated record with a component which is an array
5561 whose length depends on a discriminant), has a pragma Pack, then it is not
5562 in general possible to set the alignment of such a record to one, so the
5563 pragma is ignored in this case (with a warning).
5565 Specifying SPACE also disables alignment promotions for standalone objects,
5566 which occur when the compiler increases the alignment of a specific object
5567 without changing the alignment of its type.
5569 Specifying SPACE also disables component reordering in unpacked record types,
5570 which can result in larger sizes in order to meet alignment requirements.
5572 Specifying TIME causes larger default alignments to be chosen in the case of
5573 small types with sizes that are not a power of 2. For example, consider:
5575 @example
5576 type R is record
5577    A : Character;
5578    B : Character;
5579    C : Boolean;
5580 end record;
5582 pragma Pack (R);
5583 for R'Size use 17;
5584 @end example
5586 The default alignment for this record is normally 1, but if this type is
5587 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5588 to 4, which wastes space for objects of the type, since they are now 4 bytes
5589 long, but results in more efficient access when the whole record is referenced.
5591 As noted above, this is a configuration pragma, and there is a requirement
5592 that all units in a partition be compiled with a consistent setting of the
5593 optimization setting. This would normally be achieved by use of a configuration
5594 pragma file containing the appropriate setting. The exception to this rule is
5595 that units with an explicit configuration pragma in the same file as the source
5596 unit are excluded from the consistency check, as are all predefined units. The
5597 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5598 pragma appears at the start of the file.
5600 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5601 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{ac}
5602 @section Pragma Ordered
5605 Syntax:
5607 @example
5608 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5609 @end example
5611 Most enumeration types are from a conceptual point of view unordered.
5612 For example, consider:
5614 @example
5615 type Color is (Red, Blue, Green, Yellow);
5616 @end example
5618 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5619 but really these relations make no sense; the enumeration type merely
5620 specifies a set of possible colors, and the order is unimportant.
5622 For unordered enumeration types, it is generally a good idea if
5623 clients avoid comparisons (other than equality or inequality) and
5624 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5625 other than the unit where the type is declared, its body, and its subunits.)
5626 For example, if code buried in some client says:
5628 @example
5629 if Current_Color < Yellow then ...
5630 if Current_Color in Blue .. Green then ...
5631 @end example
5633 then the client code is relying on the order, which is undesirable.
5634 It makes the code hard to read and creates maintenance difficulties if
5635 entries have to be added to the enumeration type. Instead,
5636 the code in the client should list the possibilities, or an
5637 appropriate subtype should be declared in the unit that declares
5638 the original enumeration type. E.g., the following subtype could
5639 be declared along with the type @code{Color}:
5641 @example
5642 subtype RBG is Color range Red .. Green;
5643 @end example
5645 and then the client could write:
5647 @example
5648 if Current_Color in RBG then ...
5649 if Current_Color = Blue or Current_Color = Green then ...
5650 @end example
5652 However, some enumeration types are legitimately ordered from a conceptual
5653 point of view. For example, if you declare:
5655 @example
5656 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5657 @end example
5659 then the ordering imposed by the language is reasonable, and
5660 clients can depend on it, writing for example:
5662 @example
5663 if D in Mon .. Fri then ...
5664 if D < Wed then ...
5665 @end example
5667 The pragma @emph{Ordered} is provided to mark enumeration types that
5668 are conceptually ordered, alerting the reader that clients may depend
5669 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5670 rather than one to mark them as unordered, since in our experience,
5671 the great majority of enumeration types are conceptually unordered.
5673 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5674 and @code{Wide_Wide_Character}
5675 are considered to be ordered types, so each is declared with a
5676 pragma @code{Ordered} in package @code{Standard}.
5678 Normally pragma @code{Ordered} serves only as documentation and a guide for
5679 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5680 requests warnings for inappropriate uses (comparisons and explicit
5681 subranges) for unordered types. If this switch is used, then any
5682 enumeration type not marked with pragma @code{Ordered} will be considered
5683 as unordered, and will generate warnings for inappropriate uses.
5685 Note that generic types are not considered ordered or unordered (since the
5686 template can be instantiated for both cases), so we never generate warnings
5687 for the case of generic enumerated types.
5689 For additional information please refer to the description of the
5690 @emph{-gnatw.u} switch in the GNAT User's Guide.
5692 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5693 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{ad}
5694 @section Pragma Overflow_Mode
5697 Syntax:
5699 @example
5700 pragma Overflow_Mode
5701  (  [General    =>] MODE
5702   [,[Assertions =>] MODE]);
5704 MODE ::= STRICT | MINIMIZED | ELIMINATED
5705 @end example
5707 This pragma sets the current overflow mode to the given setting. For details
5708 of the meaning of these modes, please refer to the
5709 'Overflow Check Handling in GNAT' appendix in the
5710 GNAT User's Guide. If only the @code{General} parameter is present,
5711 the given mode applies to all expressions. If both parameters are present,
5712 the @code{General} mode applies to expressions outside assertions, and
5713 the @code{Eliminated} mode applies to expressions within assertions.
5715 The case of the @code{MODE} parameter is ignored,
5716 so @code{MINIMIZED}, @code{Minimized} and
5717 @code{minimized} all have the same effect.
5719 The @code{Overflow_Mode} pragma has the same scoping and placement
5720 rules as pragma @code{Suppress}, so it can occur either as a
5721 configuration pragma, specifying a default for the whole
5722 program, or in a declarative scope, where it applies to the
5723 remaining declarations and statements in that scope.
5725 The pragma @code{Suppress (Overflow_Check)} suppresses
5726 overflow checking, but does not affect the overflow mode.
5728 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
5729 overflow checking, but does not affect the overflow mode.
5731 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5732 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{ae}
5733 @section Pragma Overriding_Renamings
5736 @geindex Rational profile
5738 @geindex Rational compatibility
5740 Syntax:
5742 @example
5743 pragma Overriding_Renamings;
5744 @end example
5746 This is a GNAT configuration pragma to simplify porting
5747 legacy code accepted by the Rational
5748 Ada compiler. In the presence of this pragma, a renaming declaration that
5749 renames an inherited operation declared in the same scope is legal if selected
5750 notation is used as in:
5752 @example
5753 pragma Overriding_Renamings;
5755 package R is
5756   function F (..);
5757   ...
5758   function F (..) renames R.F;
5759 end R;
5760 @end example
5762 even though
5763 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5764 declaration of the overriding operation.
5766 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5767 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{af}
5768 @section Pragma Partition_Elaboration_Policy
5771 Syntax:
5773 @example
5774 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5776 POLICY_IDENTIFIER ::= Concurrent | Sequential
5777 @end example
5779 This pragma is standard in Ada 2005, but is available in all earlier
5780 versions of Ada as an implementation-defined pragma.
5781 See Ada 2012 Reference Manual for details.
5783 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
5784 @anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{b0}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b1}
5785 @section Pragma Part_Of
5788 Syntax:
5790 @example
5791 pragma Part_Of (ABSTRACT_STATE);
5793 ABSTRACT_STATE ::= NAME
5794 @end example
5796 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
5797 SPARK 2014 Reference Manual, section 7.2.6.
5799 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
5800 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b2}
5801 @section Pragma Passive
5804 Syntax:
5806 @example
5807 pragma Passive [(Semaphore | No)];
5808 @end example
5810 Syntax checked, but otherwise ignored by GNAT.  This is recognized for
5811 compatibility with DEC Ada 83 implementations, where it is used within a
5812 task definition to request that a task be made passive.  If the argument
5813 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5814 treats the pragma as an assertion that the containing task is passive
5815 and that optimization of context switch with this task is permitted and
5816 desired.  If the argument @code{No} is present, the task must not be
5817 optimized.  GNAT does not attempt to optimize any tasks in this manner
5818 (since protected objects are available in place of passive tasks).
5820 For more information on the subject of passive tasks, see the section
5821 'Passive Task Optimization' in the GNAT Users Guide.
5823 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
5824 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{b3}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b4}
5825 @section Pragma Persistent_BSS
5828 Syntax:
5830 @example
5831 pragma Persistent_BSS [(LOCAL_NAME)]
5832 @end example
5834 This pragma allows selected objects to be placed in the @code{.persistent_bss}
5835 section. On some targets the linker and loader provide for special
5836 treatment of this section, allowing a program to be reloaded without
5837 affecting the contents of this data (hence the name persistent).
5839 There are two forms of usage. If an argument is given, it must be the
5840 local name of a library-level object, with no explicit initialization
5841 and whose type is potentially persistent. If no argument is given, then
5842 the pragma is a configuration pragma, and applies to all library-level
5843 objects with no explicit initialization of potentially persistent types.
5845 A potentially persistent type is a scalar type, or an untagged,
5846 non-discriminated record, all of whose components have no explicit
5847 initialization and are themselves of a potentially persistent type,
5848 or an array, all of whose constraints are static, and whose component
5849 type is potentially persistent.
5851 If this pragma is used on a target where this feature is not supported,
5852 then the pragma will be ignored. See also @code{pragma Linker_Section}.
5854 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
5855 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{b5}
5856 @section Pragma Polling
5859 Syntax:
5861 @example
5862 pragma Polling (ON | OFF);
5863 @end example
5865 This pragma controls the generation of polling code.  This is normally off.
5866 If @code{pragma Polling (ON)} is used then periodic calls are generated to
5867 the routine @code{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5868 runtime library, and can be found in file @code{a-excpol.adb}.
5870 Pragma @code{Polling} can appear as a configuration pragma (for example it
5871 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
5872 can be used in the statement or declaration sequence to control polling
5873 more locally.
5875 A call to the polling routine is generated at the start of every loop and
5876 at the start of every subprogram call.  This guarantees that the @code{Poll}
5877 routine is called frequently, and places an upper bound (determined by
5878 the complexity of the code) on the period between two @code{Poll} calls.
5880 The primary purpose of the polling interface is to enable asynchronous
5881 aborts on targets that cannot otherwise support it (for example Windows
5882 NT), but it may be used for any other purpose requiring periodic polling.
5883 The standard version is null, and can be replaced by a user program.  This
5884 will require re-compilation of the @code{Ada.Exceptions} package that can
5885 be found in files @code{a-except.ads} and @code{a-except.adb}.
5887 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
5888 distribution) is used to enable the asynchronous abort capability on
5889 targets that do not normally support the capability.  The version of
5890 @code{Poll} in this file makes a call to the appropriate runtime routine
5891 to test for an abort condition.
5893 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
5894 See the section on switches for gcc in the @cite{GNAT User's Guide}.
5896 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
5897 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b6}
5898 @section Pragma Post
5901 @geindex Post
5903 @geindex Checks
5904 @geindex postconditions
5906 Syntax:
5908 @example
5909 pragma Post (Boolean_Expression);
5910 @end example
5912 The @code{Post} pragma is intended to be an exact replacement for
5913 the language-defined
5914 @code{Post} aspect, and shares its restrictions and semantics.
5915 It must appear either immediately following the corresponding
5916 subprogram declaration (only other pragmas may intervene), or
5917 if there is no separate subprogram declaration, then it can
5918 appear at the start of the declarations in a subprogram body
5919 (preceded only by other pragmas).
5921 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
5922 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{b7}
5923 @section Pragma Postcondition
5926 @geindex Postcondition
5928 @geindex Checks
5929 @geindex postconditions
5931 Syntax:
5933 @example
5934 pragma Postcondition (
5935    [Check   =>] Boolean_Expression
5936  [,[Message =>] String_Expression]);
5937 @end example
5939 The @code{Postcondition} pragma allows specification of automatic
5940 postcondition checks for subprograms. These checks are similar to
5941 assertions, but are automatically inserted just prior to the return
5942 statements of the subprogram with which they are associated (including
5943 implicit returns at the end of procedure bodies and associated
5944 exception handlers).
5946 In addition, the boolean expression which is the condition which
5947 must be true may contain references to function'Result in the case
5948 of a function to refer to the returned value.
5950 @code{Postcondition} pragmas may appear either immediately following the
5951 (separate) declaration of a subprogram, or at the start of the
5952 declarations of a subprogram body. Only other pragmas may intervene
5953 (that is appear between the subprogram declaration and its
5954 postconditions, or appear before the postcondition in the
5955 declaration sequence in a subprogram body). In the case of a
5956 postcondition appearing after a subprogram declaration, the
5957 formal arguments of the subprogram are visible, and can be
5958 referenced in the postcondition expressions.
5960 The postconditions are collected and automatically tested just
5961 before any return (implicit or explicit) in the subprogram body.
5962 A postcondition is only recognized if postconditions are active
5963 at the time the pragma is encountered. The compiler switch @emph{gnata}
5964 turns on all postconditions by default, and pragma @code{Check_Policy}
5965 with an identifier of @code{Postcondition} can also be used to
5966 control whether postconditions are active.
5968 The general approach is that postconditions are placed in the spec
5969 if they represent functional aspects which make sense to the client.
5970 For example we might have:
5972 @example
5973 function Direction return Integer;
5974 pragma Postcondition
5975  (Direction'Result = +1
5976     or else
5977   Direction'Result = -1);
5978 @end example
5980 which serves to document that the result must be +1 or -1, and
5981 will test that this is the case at run time if postcondition
5982 checking is active.
5984 Postconditions within the subprogram body can be used to
5985 check that some internal aspect of the implementation,
5986 not visible to the client, is operating as expected.
5987 For instance if a square root routine keeps an internal
5988 counter of the number of times it is called, then we
5989 might have the following postcondition:
5991 @example
5992 Sqrt_Calls : Natural := 0;
5994 function Sqrt (Arg : Float) return Float is
5995   pragma Postcondition
5996     (Sqrt_Calls = Sqrt_Calls'Old + 1);
5997   ...
5998 end Sqrt
5999 @end example
6001 As this example, shows, the use of the @code{Old} attribute
6002 is often useful in postconditions to refer to the state on
6003 entry to the subprogram.
6005 Note that postconditions are only checked on normal returns
6006 from the subprogram. If an abnormal return results from
6007 raising an exception, then the postconditions are not checked.
6009 If a postcondition fails, then the exception
6010 @code{System.Assertions.Assert_Failure} is raised. If
6011 a message argument was supplied, then the given string
6012 will be used as the exception message. If no message
6013 argument was supplied, then the default message has
6014 the form "Postcondition failed at file_name:line". The
6015 exception is raised in the context of the subprogram
6016 body, so it is possible to catch postcondition failures
6017 within the subprogram body itself.
6019 Within a package spec, normal visibility rules
6020 in Ada would prevent forward references within a
6021 postcondition pragma to functions defined later in
6022 the same package. This would introduce undesirable
6023 ordering constraints. To avoid this problem, all
6024 postcondition pragmas are analyzed at the end of
6025 the package spec, allowing forward references.
6027 The following example shows that this even allows
6028 mutually recursive postconditions as in:
6030 @example
6031 package Parity_Functions is
6032    function Odd  (X : Natural) return Boolean;
6033    pragma Postcondition
6034      (Odd'Result =
6035         (x = 1
6036           or else
6037         (x /= 0 and then Even (X - 1))));
6039    function Even (X : Natural) return Boolean;
6040    pragma Postcondition
6041      (Even'Result =
6042         (x = 0
6043           or else
6044         (x /= 1 and then Odd (X - 1))));
6046 end Parity_Functions;
6047 @end example
6049 There are no restrictions on the complexity or form of
6050 conditions used within @code{Postcondition} pragmas.
6051 The following example shows that it is even possible
6052 to verify performance behavior.
6054 @example
6055 package Sort is
6057    Performance : constant Float;
6058    --  Performance constant set by implementation
6059    --  to match target architecture behavior.
6061    procedure Treesort (Arg : String);
6062    --  Sorts characters of argument using N*logN sort
6063    pragma Postcondition
6064      (Float (Clock - Clock'Old) <=
6065         Float (Arg'Length) *
6066         log (Float (Arg'Length)) *
6067         Performance);
6068 end Sort;
6069 @end example
6071 Note: postcondition pragmas associated with subprograms that are
6072 marked as Inline_Always, or those marked as Inline with front-end
6073 inlining (-gnatN option set) are accepted and legality-checked
6074 by the compiler, but are ignored at run-time even if postcondition
6075 checking is enabled.
6077 Note that pragma @code{Postcondition} differs from the language-defined
6078 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6079 multiple occurrences, allowing occurences in the body even if there
6080 is a separate spec, and allowing a second string parameter, and the
6081 use of the pragma identifier @code{Check}. Historically, pragma
6082 @code{Postcondition} was implemented prior to the development of
6083 Ada 2012, and has been retained in its original form for
6084 compatibility purposes.
6086 @node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
6087 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{b8}
6088 @section Pragma Post_Class
6091 @geindex Post
6093 @geindex Checks
6094 @geindex postconditions
6096 Syntax:
6098 @example
6099 pragma Post_Class (Boolean_Expression);
6100 @end example
6102 The @code{Post_Class} pragma is intended to be an exact replacement for
6103 the language-defined
6104 @code{Post'Class} aspect, and shares its restrictions and semantics.
6105 It must appear either immediately following the corresponding
6106 subprogram declaration (only other pragmas may intervene), or
6107 if there is no separate subprogram declaration, then it can
6108 appear at the start of the declarations in a subprogram body
6109 (preceded only by other pragmas).
6111 Note: This pragma is called @code{Post_Class} rather than
6112 @code{Post'Class} because the latter would not be strictly
6113 conforming to the allowed syntax for pragmas. The motivation
6114 for provinding pragmas equivalent to the aspects is to allow a program
6115 to be written using the pragmas, and then compiled if necessary
6116 using an Ada compiler that does not recognize the pragmas or
6117 aspects, but is prepared to ignore the pragmas. The assertion
6118 policy that controls this pragma is @code{Post'Class}, not
6119 @code{Post_Class}.
6121 @node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
6122 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{b9}
6123 @section Pragma Rename_Pragma
6126 @geindex Pragmas
6127 @geindex synonyms
6129 Syntax:
6131 @example
6132 pragma Rename_Pragma (
6133          [New_Name =>] IDENTIFIER,
6134          [Renamed  =>] pragma_IDENTIFIER);
6135 @end example
6137 This pragma provides a mechanism for supplying new names for existing
6138 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
6139 the Renamed pragma. For example, suppose you have code that was originally
6140 developed on a compiler that supports Inline_Only as an implementation defined
6141 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
6142 least very similar to) the GNAT implementation defined pragma
6143 Inline_Always. You could globally replace Inline_Only with Inline_Always.
6145 However, to avoid that source modification, you could instead add a
6146 configuration pragma:
6148 @example
6149 pragma Rename_Pragma (
6150          New_Name => Inline_Only,
6151          Renamed  => Inline_Always);
6152 @end example
6154 Then GNAT will treat "pragma Inline_Only ..." as if you had written
6155 "pragma Inline_Always ...".
6157 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
6158 compiler; it's up to you to make sure the semantics are close enough.
6160 @node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
6161 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{ba}
6162 @section Pragma Pre
6165 @geindex Pre
6167 @geindex Checks
6168 @geindex preconditions
6170 Syntax:
6172 @example
6173 pragma Pre (Boolean_Expression);
6174 @end example
6176 The @code{Pre} pragma is intended to be an exact replacement for
6177 the language-defined
6178 @code{Pre} aspect, and shares its restrictions and semantics.
6179 It must appear either immediately following the corresponding
6180 subprogram declaration (only other pragmas may intervene), or
6181 if there is no separate subprogram declaration, then it can
6182 appear at the start of the declarations in a subprogram body
6183 (preceded only by other pragmas).
6185 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6186 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{bb}
6187 @section Pragma Precondition
6190 @geindex Preconditions
6192 @geindex Checks
6193 @geindex preconditions
6195 Syntax:
6197 @example
6198 pragma Precondition (
6199    [Check   =>] Boolean_Expression
6200  [,[Message =>] String_Expression]);
6201 @end example
6203 The @code{Precondition} pragma is similar to @code{Postcondition}
6204 except that the corresponding checks take place immediately upon
6205 entry to the subprogram, and if a precondition fails, the exception
6206 is raised in the context of the caller, and the attribute 'Result
6207 cannot be used within the precondition expression.
6209 Otherwise, the placement and visibility rules are identical to those
6210 described for postconditions. The following is an example of use
6211 within a package spec:
6213 @example
6214 package Math_Functions is
6215    ...
6216    function Sqrt (Arg : Float) return Float;
6217    pragma Precondition (Arg >= 0.0)
6218    ...
6219 end Math_Functions;
6220 @end example
6222 @code{Precondition} pragmas may appear either immediately following the
6223 (separate) declaration of a subprogram, or at the start of the
6224 declarations of a subprogram body. Only other pragmas may intervene
6225 (that is appear between the subprogram declaration and its
6226 postconditions, or appear before the postcondition in the
6227 declaration sequence in a subprogram body).
6229 Note: precondition pragmas associated with subprograms that are
6230 marked as Inline_Always, or those marked as Inline with front-end
6231 inlining (-gnatN option set) are accepted and legality-checked
6232 by the compiler, but are ignored at run-time even if precondition
6233 checking is enabled.
6235 Note that pragma @code{Precondition} differs from the language-defined
6236 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6237 multiple occurrences, allowing occurences in the body even if there
6238 is a separate spec, and allowing a second string parameter, and the
6239 use of the pragma identifier @code{Check}. Historically, pragma
6240 @code{Precondition} was implemented prior to the development of
6241 Ada 2012, and has been retained in its original form for
6242 compatibility purposes.
6244 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6245 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{bc}@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{bd}
6246 @section Pragma Predicate
6249 Syntax:
6251 @example
6252 pragma Predicate
6253   ([Entity =>] type_LOCAL_NAME,
6254    [Check  =>] EXPRESSION);
6255 @end example
6257 This pragma (available in all versions of Ada in GNAT) encompasses both
6258 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6259 Ada 2012. A predicate is regarded as static if it has an allowed form
6260 for @code{Static_Predicate} and is otherwise treated as a
6261 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6262 pragma behave exactly as described in the Ada 2012 reference manual.
6263 For example, if we have
6265 @example
6266 type R is range 1 .. 10;
6267 subtype S is R;
6268 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6269 subtype Q is R
6270 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6271 @end example
6273 the effect is identical to the following Ada 2012 code:
6275 @example
6276 type R is range 1 .. 10;
6277 subtype S is R with
6278   Static_Predicate => S not in 4 .. 6;
6279 subtype Q is R with
6280   Dynamic_Predicate => F(Q) or G(Q);
6281 @end example
6283 Note that there are no pragmas @code{Dynamic_Predicate}
6284 or @code{Static_Predicate}. That is
6285 because these pragmas would affect legality and semantics of
6286 the program and thus do not have a neutral effect if ignored.
6287 The motivation behind providing pragmas equivalent to
6288 corresponding aspects is to allow a program to be written
6289 using the pragmas, and then compiled with a compiler that
6290 will ignore the pragmas. That doesn't work in the case of
6291 static and dynamic predicates, since if the corresponding
6292 pragmas are ignored, then the behavior of the program is
6293 fundamentally changed (for example a membership test
6294 @code{A in B} would not take into account a predicate
6295 defined for subtype B). When following this approach, the
6296 use of predicates should be avoided.
6298 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6299 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{be}
6300 @section Pragma Predicate_Failure
6303 Syntax:
6305 @example
6306 pragma Predicate_Failure
6307   ([Entity  =>] type_LOCAL_NAME,
6308    [Message =>] String_Expression);
6309 @end example
6311 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6312 the language-defined
6313 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6315 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6316 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{bf}
6317 @section Pragma Preelaborable_Initialization
6320 Syntax:
6322 @example
6323 pragma Preelaborable_Initialization (DIRECT_NAME);
6324 @end example
6326 This pragma is standard in Ada 2005, but is available in all earlier
6327 versions of Ada as an implementation-defined pragma.
6328 See Ada 2012 Reference Manual for details.
6330 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6331 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c0}
6332 @section Pragma Prefix_Exception_Messages
6335 @geindex Prefix_Exception_Messages
6337 @geindex exception
6339 @geindex Exception_Message
6341 Syntax:
6343 @example
6344 pragma Prefix_Exception_Messages;
6345 @end example
6347 This is an implementation-defined configuration pragma that affects the
6348 behavior of raise statements with a message given as a static string
6349 constant (typically a string literal). In such cases, the string will
6350 be automatically prefixed by the name of the enclosing entity (giving
6351 the package and subprogram containing the raise statement). This helps
6352 to identify where messages are coming from, and this mode is automatic
6353 for the run-time library.
6355 The pragma has no effect if the message is computed with an expression other
6356 than a static string constant, since the assumption in this case is that
6357 the program computes exactly the string it wants. If you still want the
6358 prefixing in this case, you can always call
6359 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6361 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6362 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c1}
6363 @section Pragma Pre_Class
6366 @geindex Pre_Class
6368 @geindex Checks
6369 @geindex preconditions
6371 Syntax:
6373 @example
6374 pragma Pre_Class (Boolean_Expression);
6375 @end example
6377 The @code{Pre_Class} pragma is intended to be an exact replacement for
6378 the language-defined
6379 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6380 It must appear either immediately following the corresponding
6381 subprogram declaration (only other pragmas may intervene), or
6382 if there is no separate subprogram declaration, then it can
6383 appear at the start of the declarations in a subprogram body
6384 (preceded only by other pragmas).
6386 Note: This pragma is called @code{Pre_Class} rather than
6387 @code{Pre'Class} because the latter would not be strictly
6388 conforming to the allowed syntax for pragmas. The motivation
6389 for providing pragmas equivalent to the aspects is to allow a program
6390 to be written using the pragmas, and then compiled if necessary
6391 using an Ada compiler that does not recognize the pragmas or
6392 aspects, but is prepared to ignore the pragmas. The assertion
6393 policy that controls this pragma is @code{Pre'Class}, not
6394 @code{Pre_Class}.
6396 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6397 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c2}
6398 @section Pragma Priority_Specific_Dispatching
6401 Syntax:
6403 @example
6404 pragma Priority_Specific_Dispatching (
6405    POLICY_IDENTIFIER,
6406    first_priority_EXPRESSION,
6407    last_priority_EXPRESSION)
6409 POLICY_IDENTIFIER ::=
6410    EDF_Across_Priorities            |
6411    FIFO_Within_Priorities           |
6412    Non_Preemptive_Within_Priorities |
6413    Round_Robin_Within_Priorities
6414 @end example
6416 This pragma is standard in Ada 2005, but is available in all earlier
6417 versions of Ada as an implementation-defined pragma.
6418 See Ada 2012 Reference Manual for details.
6420 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6421 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c3}
6422 @section Pragma Profile
6425 Syntax:
6427 @example
6428 pragma Profile (Ravenscar | Restricted | Rational |
6429                 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6430 @end example
6432 This pragma is standard in Ada 2005, but is available in all earlier
6433 versions of Ada as an implementation-defined pragma. This is a
6434 configuration pragma that establishes a set of configuration pragmas
6435 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6436 The other possibilities (@code{Restricted}, @code{Rational},
6437 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6438 are implementation-defined. The set of configuration pragmas
6439 is defined in the following sections.
6442 @itemize *
6444 @item 
6445 Pragma Profile (Ravenscar)
6447 The @code{Ravenscar} profile is standard in Ada 2005,
6448 but is available in all earlier
6449 versions of Ada as an implementation-defined pragma. This profile
6450 establishes the following set of configuration pragmas:
6453 @itemize *
6455 @item 
6456 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6458 [RM D.2.2] Tasks are dispatched following a preemptive
6459 priority-ordered scheduling policy.
6461 @item 
6462 @code{Locking_Policy (Ceiling_Locking)}
6464 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6465 the ceiling priority of the corresponding protected object.
6467 @item 
6468 @code{Detect_Blocking}
6470 This pragma forces the detection of potentially blocking operations within a
6471 protected operation, and to raise Program_Error if that happens.
6472 @end itemize
6474 plus the following set of restrictions:
6477 @itemize *
6479 @item 
6480 @code{Max_Entry_Queue_Length => 1}
6482 No task can be queued on a protected entry.
6484 @item 
6485 @code{Max_Protected_Entries => 1}
6487 @item 
6488 @code{Max_Task_Entries => 0}
6490 No rendezvous statements are allowed.
6492 @item 
6493 @code{No_Abort_Statements}
6495 @item 
6496 @code{No_Dynamic_Attachment}
6498 @item 
6499 @code{No_Dynamic_Priorities}
6501 @item 
6502 @code{No_Implicit_Heap_Allocations}
6504 @item 
6505 @code{No_Local_Protected_Objects}
6507 @item 
6508 @code{No_Local_Timing_Events}
6510 @item 
6511 @code{No_Protected_Type_Allocators}
6513 @item 
6514 @code{No_Relative_Delay}
6516 @item 
6517 @code{No_Requeue_Statements}
6519 @item 
6520 @code{No_Select_Statements}
6522 @item 
6523 @code{No_Specific_Termination_Handlers}
6525 @item 
6526 @code{No_Task_Allocators}
6528 @item 
6529 @code{No_Task_Hierarchy}
6531 @item 
6532 @code{No_Task_Termination}
6534 @item 
6535 @code{Simple_Barriers}
6536 @end itemize
6538 The Ravenscar profile also includes the following restrictions that specify
6539 that there are no semantic dependences on the corresponding predefined
6540 packages:
6543 @itemize *
6545 @item 
6546 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6548 @item 
6549 @code{No_Dependence => Ada.Calendar}
6551 @item 
6552 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6554 @item 
6555 @code{No_Dependence => Ada.Execution_Time.Timers}
6557 @item 
6558 @code{No_Dependence => Ada.Task_Attributes}
6560 @item 
6561 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6562 @end itemize
6564 This set of configuration pragmas and restrictions correspond to the
6565 definition of the 'Ravenscar Profile' for limited tasking, devised and
6566 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6567 A description is also available at
6568 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6570 The original definition of the profile was revised at subsequent IRTAW
6571 meetings. It has been included in the ISO
6572 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6573 and was made part of the Ada 2005 standard.
6574 The formal definition given by
6575 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6576 AI-305) available at
6577 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6578 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6580 The above set is a superset of the restrictions provided by pragma
6581 @code{Profile (Restricted)}, it includes six additional restrictions
6582 (@code{Simple_Barriers}, @code{No_Select_Statements},
6583 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6584 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
6585 that pragma @code{Profile (Ravenscar)}, like the pragma
6586 @code{Profile (Restricted)},
6587 automatically causes the use of a simplified,
6588 more efficient version of the tasking run-time library.
6590 @item 
6591 Pragma Profile (GNAT_Extended_Ravenscar)
6593 This profile corresponds to a GNAT specific extension of the
6594 Ravenscar profile. The profile may change in the future although
6595 only in a compatible way: some restrictions may be removed or
6596 relaxed. It is defined as a variation of the Ravenscar profile.
6598 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6599 by @code{No_Implicit_Task_Allocations} and
6600 @code{No_Implicit_Protected_Object_Allocations}.
6602 The @code{Simple_Barriers} restriction has been replaced by
6603 @code{Pure_Barriers}.
6605 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6606 @code{No_Relative_Delay} restrictions have been removed.
6608 @item 
6609 Pragma Profile (GNAT_Ravenscar_EDF)
6611 This profile corresponds to the Ravenscar profile but using
6612 EDF_Across_Priority as the Task_Scheduling_Policy.
6614 @item 
6615 Pragma Profile (Restricted)
6617 This profile corresponds to the GNAT restricted run time. It
6618 establishes the following set of restrictions:
6621 @itemize *
6623 @item 
6624 @code{No_Abort_Statements}
6626 @item 
6627 @code{No_Entry_Queue}
6629 @item 
6630 @code{No_Task_Hierarchy}
6632 @item 
6633 @code{No_Task_Allocators}
6635 @item 
6636 @code{No_Dynamic_Priorities}
6638 @item 
6639 @code{No_Terminate_Alternatives}
6641 @item 
6642 @code{No_Dynamic_Attachment}
6644 @item 
6645 @code{No_Protected_Type_Allocators}
6647 @item 
6648 @code{No_Local_Protected_Objects}
6650 @item 
6651 @code{No_Requeue_Statements}
6653 @item 
6654 @code{No_Task_Attributes_Package}
6656 @item 
6657 @code{Max_Asynchronous_Select_Nesting =  0}
6659 @item 
6660 @code{Max_Task_Entries =  0}
6662 @item 
6663 @code{Max_Protected_Entries = 1}
6665 @item 
6666 @code{Max_Select_Alternatives = 0}
6667 @end itemize
6669 This set of restrictions causes the automatic selection of a simplified
6670 version of the run time that provides improved performance for the
6671 limited set of tasking functionality permitted by this set of restrictions.
6673 @item 
6674 Pragma Profile (Rational)
6676 The Rational profile is intended to facilitate porting legacy code that
6677 compiles with the Rational APEX compiler, even when the code includes non-
6678 conforming Ada constructs.  The profile enables the following three pragmas:
6681 @itemize *
6683 @item 
6684 @code{pragma Implicit_Packing}
6686 @item 
6687 @code{pragma Overriding_Renamings}
6689 @item 
6690 @code{pragma Use_VADS_Size}
6691 @end itemize
6692 @end itemize
6694 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6695 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c4}
6696 @section Pragma Profile_Warnings
6699 Syntax:
6701 @example
6702 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6703 @end example
6705 This is an implementation-defined pragma that is similar in
6706 effect to @code{pragma Profile} except that instead of
6707 generating @code{Restrictions} pragmas, it generates
6708 @code{Restriction_Warnings} pragmas. The result is that
6709 violations of the profile generate warning messages instead
6710 of error messages.
6712 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6713 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c5}
6714 @section Pragma Propagate_Exceptions
6717 @geindex Interfacing to C++
6719 Syntax:
6721 @example
6722 pragma Propagate_Exceptions;
6723 @end example
6725 This pragma is now obsolete and, other than generating a warning if warnings
6726 on obsolescent features are enabled, is ignored.
6727 It is retained for compatibility
6728 purposes. It used to be used in connection with optimization of
6729 a now-obsolete mechanism for implementation of exceptions.
6731 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6732 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c6}
6733 @section Pragma Provide_Shift_Operators
6736 @geindex Shift operators
6738 Syntax:
6740 @example
6741 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6742 @end example
6744 This pragma can be applied to a first subtype local name that specifies
6745 either an unsigned or signed type. It has the effect of providing the
6746 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6747 Rotate_Left and Rotate_Right) for the given type. It is similar to
6748 including the function declarations for these five operators, together
6749 with the pragma Import (Intrinsic, ...) statements.
6751 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6752 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{c7}
6753 @section Pragma Psect_Object
6756 Syntax:
6758 @example
6759 pragma Psect_Object (
6760      [Internal =>] LOCAL_NAME,
6761   [, [External =>] EXTERNAL_SYMBOL]
6762   [, [Size     =>] EXTERNAL_SYMBOL]);
6764 EXTERNAL_SYMBOL ::=
6765   IDENTIFIER
6766 | static_string_EXPRESSION
6767 @end example
6769 This pragma is identical in effect to pragma @code{Common_Object}.
6771 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6772 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{c8}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{c9}
6773 @section Pragma Pure_Function
6776 Syntax:
6778 @example
6779 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6780 @end example
6782 This pragma appears in the same declarative part as a function
6783 declaration (or a set of function declarations if more than one
6784 overloaded declaration exists, in which case the pragma applies
6785 to all entities).  It specifies that the function @code{Entity} is
6786 to be considered pure for the purposes of code generation.  This means
6787 that the compiler can assume that there are no side effects, and
6788 in particular that two calls with identical arguments produce the
6789 same result.  It also means that the function can be used in an
6790 address clause.
6792 Note that, quite deliberately, there are no static checks to try
6793 to ensure that this promise is met, so @code{Pure_Function} can be used
6794 with functions that are conceptually pure, even if they do modify
6795 global variables.  For example, a square root function that is
6796 instrumented to count the number of times it is called is still
6797 conceptually pure, and can still be optimized, even though it
6798 modifies a global variable (the count).  Memo functions are another
6799 example (where a table of previous calls is kept and consulted to
6800 avoid re-computation).
6802 Note also that the normal rules excluding optimization of subprograms
6803 in pure units (when parameter types are descended from System.Address,
6804 or when the full view of a parameter type is limited), do not apply
6805 for the Pure_Function case. If you explicitly specify Pure_Function,
6806 the compiler may optimize away calls with identical arguments, and
6807 if that results in unexpected behavior, the proper action is not to
6808 use the pragma for subprograms that are not (conceptually) pure.
6810 Note: Most functions in a @code{Pure} package are automatically pure, and
6811 there is no need to use pragma @code{Pure_Function} for such functions.  One
6812 exception is any function that has at least one formal of type
6813 @code{System.Address} or a type derived from it.  Such functions are not
6814 considered pure by default, since the compiler assumes that the
6815 @code{Address} parameter may be functioning as a pointer and that the
6816 referenced data may change even if the address value does not.
6817 Similarly, imported functions are not considered to be pure by default,
6818 since there is no way of checking that they are in fact pure.  The use
6819 of pragma @code{Pure_Function} for such a function will override these default
6820 assumption, and cause the compiler to treat a designated subprogram as pure
6821 in these cases.
6823 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
6824 applies to the underlying renamed function.  This can be used to
6825 disambiguate cases of overloading where some but not all functions
6826 in a set of overloaded functions are to be designated as pure.
6828 If pragma @code{Pure_Function} is applied to a library-level function, the
6829 function is also considered pure from an optimization point of view, but the
6830 unit is not a Pure unit in the categorization sense. So for example, a function
6831 thus marked is free to @code{with} non-pure units.
6833 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
6834 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{ca}
6835 @section Pragma Rational
6838 Syntax:
6840 @example
6841 pragma Rational;
6842 @end example
6844 This pragma is considered obsolescent, but is retained for
6845 compatibility purposes. It is equivalent to:
6847 @example
6848 pragma Profile (Rational);
6849 @end example
6851 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
6852 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{cb}
6853 @section Pragma Ravenscar
6856 Syntax:
6858 @example
6859 pragma Ravenscar;
6860 @end example
6862 This pragma is considered obsolescent, but is retained for
6863 compatibility purposes. It is equivalent to:
6865 @example
6866 pragma Profile (Ravenscar);
6867 @end example
6869 which is the preferred method of setting the @code{Ravenscar} profile.
6871 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
6872 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{cc}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{cd}
6873 @section Pragma Refined_Depends
6876 Syntax:
6878 @example
6879 pragma Refined_Depends (DEPENDENCY_RELATION);
6881 DEPENDENCY_RELATION ::=
6882      null
6883   | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
6885 DEPENDENCY_CLAUSE ::=
6886     OUTPUT_LIST =>[+] INPUT_LIST
6887   | NULL_DEPENDENCY_CLAUSE
6889 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
6891 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
6893 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
6895 OUTPUT ::= NAME | FUNCTION_RESULT
6896 INPUT  ::= NAME
6898 where FUNCTION_RESULT is a function Result attribute_reference
6899 @end example
6901 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
6902 the SPARK 2014 Reference Manual, section 6.1.5.
6904 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
6905 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{cf}
6906 @section Pragma Refined_Global
6909 Syntax:
6911 @example
6912 pragma Refined_Global (GLOBAL_SPECIFICATION);
6914 GLOBAL_SPECIFICATION ::=
6915      null
6916   | (GLOBAL_LIST)
6917   | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
6919 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
6921 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
6922 GLOBAL_LIST   ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
6923 GLOBAL_ITEM   ::= NAME
6924 @end example
6926 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
6927 the SPARK 2014 Reference Manual, section 6.1.4.
6929 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
6930 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d0}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d1}
6931 @section Pragma Refined_Post
6934 Syntax:
6936 @example
6937 pragma Refined_Post (boolean_EXPRESSION);
6938 @end example
6940 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
6941 the SPARK 2014 Reference Manual, section 7.2.7.
6943 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
6944 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d3}
6945 @section Pragma Refined_State
6948 Syntax:
6950 @example
6951 pragma Refined_State (REFINEMENT_LIST);
6953 REFINEMENT_LIST ::=
6954   (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
6956 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
6958 CONSTITUENT_LIST ::=
6959      null
6960   |  CONSTITUENT
6961   | (CONSTITUENT @{, CONSTITUENT@})
6963 CONSTITUENT ::= object_NAME | state_NAME
6964 @end example
6966 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
6967 the SPARK 2014 Reference Manual, section 7.2.2.
6969 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
6970 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d4}
6971 @section Pragma Relative_Deadline
6974 Syntax:
6976 @example
6977 pragma Relative_Deadline (time_span_EXPRESSION);
6978 @end example
6980 This pragma is standard in Ada 2005, but is available in all earlier
6981 versions of Ada as an implementation-defined pragma.
6982 See Ada 2012 Reference Manual for details.
6984 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
6985 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d5}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d6}
6986 @section Pragma Remote_Access_Type
6989 Syntax:
6991 @example
6992 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
6993 @end example
6995 This pragma appears in the formal part of a generic declaration.
6996 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
6997 the use of a remote access to class-wide type as actual for a formal
6998 access type.
7000 When this pragma applies to a formal access type @code{Entity}, that
7001 type is treated as a remote access to class-wide type in the generic.
7002 It must be a formal general access type, and its designated type must
7003 be the class-wide type of a formal tagged limited private type from the
7004 same generic declaration.
7006 In the generic unit, the formal type is subject to all restrictions
7007 pertaining to remote access to class-wide types. At instantiation, the
7008 actual type must be a remote access to class-wide type.
7010 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
7011 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{d7}
7012 @section Pragma Restricted_Run_Time
7015 Syntax:
7017 @example
7018 pragma Restricted_Run_Time;
7019 @end example
7021 This pragma is considered obsolescent, but is retained for
7022 compatibility purposes. It is equivalent to:
7024 @example
7025 pragma Profile (Restricted);
7026 @end example
7028 which is the preferred method of setting the restricted run time
7029 profile.
7031 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7032 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{d8}
7033 @section Pragma Restriction_Warnings
7036 Syntax:
7038 @example
7039 pragma Restriction_Warnings
7040   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7041 @end example
7043 This pragma allows a series of restriction identifiers to be
7044 specified (the list of allowed identifiers is the same as for
7045 pragma @code{Restrictions}). For each of these identifiers
7046 the compiler checks for violations of the restriction, but
7047 generates a warning message rather than an error message
7048 if the restriction is violated.
7050 One use of this is in situations where you want to know
7051 about violations of a restriction, but you want to ignore some of
7052 these violations. Consider this example, where you want to set
7053 Ada_95 mode and enable style checks, but you want to know about
7054 any other use of implementation pragmas:
7056 @example
7057 pragma Restriction_Warnings (No_Implementation_Pragmas);
7058 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7059 pragma Ada_95;
7060 pragma Style_Checks ("2bfhkM160");
7061 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7062 @end example
7064 By including the above lines in a configuration pragmas file,
7065 the Ada_95 and Style_Checks pragmas are accepted without
7066 generating a warning, but any other use of implementation
7067 defined pragmas will cause a warning to be generated.
7069 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7070 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{d9}
7071 @section Pragma Reviewable
7074 Syntax:
7076 @example
7077 pragma Reviewable;
7078 @end example
7080 This pragma is an RM-defined standard pragma, but has no effect on the
7081 program being compiled, or on the code generated for the program.
7083 To obtain the required output specified in RM H.3.1, the compiler must be
7084 run with various special switches as follows:
7087 @itemize *
7089 @item 
7090 @emph{Where compiler-generated run-time checks remain}
7092 The switch @emph{-gnatGL}
7093 may be used to list the expanded code in pseudo-Ada form.
7094 Runtime checks show up in the listing either as explicit
7095 checks or operators marked with @{@} to indicate a check is present.
7097 @item 
7098 @emph{An identification of known exceptions at compile time}
7100 If the program is compiled with @emph{-gnatwa},
7101 the compiler warning messages will indicate all cases where the compiler
7102 detects that an exception is certain to occur at run time.
7104 @item 
7105 @emph{Possible reads of uninitialized variables}
7107 The compiler warns of many such cases, but its output is incomplete.
7108 @end itemize
7111 A supplemental static analysis tool
7112 may be used to obtain a comprehensive list of all
7113 possible points at which uninitialized data may be read.
7116 @itemize *
7118 @item 
7119 @emph{Where run-time support routines are implicitly invoked}
7121 In the output from @emph{-gnatGL},
7122 run-time calls are explicitly listed as calls to the relevant
7123 run-time routine.
7125 @item 
7126 @emph{Object code listing}
7128 This may be obtained either by using the @emph{-S} switch,
7129 or the objdump utility.
7131 @item 
7132 @emph{Constructs known to be erroneous at compile time}
7134 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
7136 @item 
7137 @emph{Stack usage information}
7139 Static stack usage data (maximum per-subprogram) can be obtained via the
7140 @emph{-fstack-usage} switch to the compiler.
7141 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
7142 to gnatbind
7143 @end itemize
7147 @itemize *
7149 @item 
7150 @emph{Object code listing of entire partition}
7152 This can be obtained by compiling the partition with @emph{-S},
7153 or by applying objdump
7154 to all the object files that are part of the partition.
7156 @item 
7157 @emph{A description of the run-time model}
7159 The full sources of the run-time are available, and the documentation of
7160 these routines describes how these run-time routines interface to the
7161 underlying operating system facilities.
7163 @item 
7164 @emph{Control and data-flow information}
7165 @end itemize
7168 A supplemental static analysis tool
7169 may be used to obtain complete control and data-flow information, as well as
7170 comprehensive messages identifying possible problems based on this
7171 information.
7173 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7174 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{da}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{db}
7175 @section Pragma Secondary_Stack_Size
7178 Syntax:
7180 @example
7181 pragma Secondary_Stack_Size (integer_EXPRESSION);
7182 @end example
7184 This pragma appears within the task definition of a single task declaration
7185 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7186 task objects of that type. The argument specifies the size of the secondary
7187 stack to be used by these task objects, and must be of an integer type. The
7188 secondary stack is used to handle functions that return a variable-sized
7189 result, for example a function returning an unconstrained String.
7191 Note this pragma only applies to targets using fixed secondary stacks, like
7192 VxWorks 653 and bare board targets, where a fixed block for the
7193 secondary stack is allocated from the primary stack of the task. By default,
7194 these targets assign a percentage of the primary stack for the secondary stack,
7195 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7196 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7198 For most targets, the pragma does not apply as the secondary stack grows on
7199 demand: allocated as a chain of blocks in the heap. The default size of these
7200 blocks can be modified via the @code{-D} binder option as described in
7201 @cite{GNAT User's Guide}.
7203 Note that no check is made to see if the secondary stack can fit inside the
7204 primary stack.
7206 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7207 is in effect.
7209 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7210 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{dc}
7211 @section Pragma Share_Generic
7214 Syntax:
7216 @example
7217 pragma Share_Generic (GNAME @{, GNAME@});
7219 GNAME ::= generic_unit_NAME | generic_instance_NAME
7220 @end example
7222 This pragma is provided for compatibility with Dec Ada 83. It has
7223 no effect in GNAT (which does not implement shared generics), other
7224 than to check that the given names are all names of generic units or
7225 generic instances.
7227 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7228 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{dd}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{de}
7229 @section Pragma Shared
7232 This pragma is provided for compatibility with Ada 83. The syntax and
7233 semantics are identical to pragma Atomic.
7235 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7236 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{df}
7237 @section Pragma Short_Circuit_And_Or
7240 Syntax:
7242 @example
7243 pragma Short_Circuit_And_Or;
7244 @end example
7246 This configuration pragma causes any occurrence of the AND operator applied to
7247 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7248 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7249 may be useful in the context of certification protocols requiring the use of
7250 short-circuited logical operators. If this configuration pragma occurs locally
7251 within the file being compiled, it applies only to the file being compiled.
7252 There is no requirement that all units in a partition use this option.
7254 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7255 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e0}
7256 @section Pragma Short_Descriptors
7259 Syntax:
7261 @example
7262 pragma Short_Descriptors
7263 @end example
7265 This pragma is provided for compatibility with other Ada implementations. It
7266 is recognized but ignored by all current versions of GNAT.
7268 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7269 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e1}@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e2}
7270 @section Pragma Simple_Storage_Pool_Type
7273 @geindex Storage pool
7274 @geindex simple
7276 @geindex Simple storage pool
7278 Syntax:
7280 @example
7281 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7282 @end example
7284 A type can be established as a 'simple storage pool type' by applying
7285 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7286 A type named in the pragma must be a library-level immutably limited record
7287 type or limited tagged type declared immediately within a package declaration.
7288 The type can also be a limited private type whose full type is allowed as
7289 a simple storage pool type.
7291 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7292 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7293 are subtype conformant with the following subprogram declarations:
7295 @example
7296 procedure Allocate
7297   (Pool                     : in out SSP;
7298    Storage_Address          : out System.Address;
7299    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7300    Alignment                : System.Storage_Elements.Storage_Count);
7302 procedure Deallocate
7303   (Pool : in out SSP;
7304    Storage_Address          : System.Address;
7305    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7306    Alignment                : System.Storage_Elements.Storage_Count);
7308 function Storage_Size (Pool : SSP)
7309   return System.Storage_Elements.Storage_Count;
7310 @end example
7312 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7313 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7314 applying an unchecked deallocation has no effect other than to set its actual
7315 parameter to null. If @code{Storage_Size} is not declared, then the
7316 @code{Storage_Size} attribute applied to an access type associated with
7317 a pool object of type SSP returns zero. Additional operations can be declared
7318 for a simple storage pool type (such as for supporting a mark/release
7319 storage-management discipline).
7321 An object of a simple storage pool type can be associated with an access
7322 type by specifying the attribute
7323 @ref{e3,,Simple_Storage_Pool}. For example:
7325 @example
7326 My_Pool : My_Simple_Storage_Pool_Type;
7328 type Acc is access My_Data_Type;
7330 for Acc'Simple_Storage_Pool use My_Pool;
7331 @end example
7333 See attribute @ref{e3,,Simple_Storage_Pool}
7334 for further details.
7336 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7337 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e4}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e5}
7338 @section Pragma Source_File_Name
7341 Syntax:
7343 @example
7344 pragma Source_File_Name (
7345   [Unit_Name   =>] unit_NAME,
7346   Spec_File_Name =>  STRING_LITERAL,
7347   [Index => INTEGER_LITERAL]);
7349 pragma Source_File_Name (
7350   [Unit_Name   =>] unit_NAME,
7351   Body_File_Name =>  STRING_LITERAL,
7352   [Index => INTEGER_LITERAL]);
7353 @end example
7355 Use this to override the normal naming convention.  It is a configuration
7356 pragma, and so has the usual applicability of configuration pragmas
7357 (i.e., it applies to either an entire partition, or to all units in a
7358 compilation, or to a single unit, depending on how it is used.
7359 @code{unit_name} is mapped to @code{file_name_literal}.  The identifier for
7360 the second argument is required, and indicates whether this is the file
7361 name for the spec or for the body.
7363 The optional Index argument should be used when a file contains multiple
7364 units, and when you do not want to use @code{gnatchop} to separate then
7365 into multiple files (which is the recommended procedure to limit the
7366 number of recompilations that are needed when some sources change).
7367 For instance, if the source file @code{source.ada} contains
7369 @example
7370 package B is
7372 end B;
7374 with B;
7375 procedure A is
7376 begin
7377    ..
7378 end A;
7379 @end example
7381 you could use the following configuration pragmas:
7383 @example
7384 pragma Source_File_Name
7385   (B, Spec_File_Name => "source.ada", Index => 1);
7386 pragma Source_File_Name
7387   (A, Body_File_Name => "source.ada", Index => 2);
7388 @end example
7390 Note that the @code{gnatname} utility can also be used to generate those
7391 configuration pragmas.
7393 Another form of the @code{Source_File_Name} pragma allows
7394 the specification of patterns defining alternative file naming schemes
7395 to apply to all files.
7397 @example
7398 pragma Source_File_Name
7399   (  [Spec_File_Name  =>] STRING_LITERAL
7400    [,[Casing          =>] CASING_SPEC]
7401    [,[Dot_Replacement =>] STRING_LITERAL]);
7403 pragma Source_File_Name
7404   (  [Body_File_Name  =>] STRING_LITERAL
7405    [,[Casing          =>] CASING_SPEC]
7406    [,[Dot_Replacement =>] STRING_LITERAL]);
7408 pragma Source_File_Name
7409   (  [Subunit_File_Name =>] STRING_LITERAL
7410    [,[Casing            =>] CASING_SPEC]
7411    [,[Dot_Replacement   =>] STRING_LITERAL]);
7413 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7414 @end example
7416 The first argument is a pattern that contains a single asterisk indicating
7417 the point at which the unit name is to be inserted in the pattern string
7418 to form the file name.  The second argument is optional.  If present it
7419 specifies the casing of the unit name in the resulting file name string.
7420 The default is lower case.  Finally the third argument allows for systematic
7421 replacement of any dots in the unit name by the specified string literal.
7423 Note that Source_File_Name pragmas should not be used if you are using
7424 project files. The reason for this rule is that the project manager is not
7425 aware of these pragmas, and so other tools that use the projet file would not
7426 be aware of the intended naming conventions. If you are using project files,
7427 file naming is controlled by Source_File_Name_Project pragmas, which are
7428 usually supplied automatically by the project manager. A pragma
7429 Source_File_Name cannot appear after a @ref{e6,,Pragma Source_File_Name_Project}.
7431 For more details on the use of the @code{Source_File_Name} pragma, see the
7432 sections on @code{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7434 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7435 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{e6}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e7}
7436 @section Pragma Source_File_Name_Project
7439 This pragma has the same syntax and semantics as pragma Source_File_Name.
7440 It is only allowed as a stand-alone configuration pragma.
7441 It cannot appear after a @ref{e4,,Pragma Source_File_Name}, and
7442 most importantly, once pragma Source_File_Name_Project appears,
7443 no further Source_File_Name pragmas are allowed.
7445 The intention is that Source_File_Name_Project pragmas are always
7446 generated by the Project Manager in a manner consistent with the naming
7447 specified in a project file, and when naming is controlled in this manner,
7448 it is not permissible to attempt to modify this naming scheme using
7449 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7450 known to the project manager).
7452 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7453 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{e8}
7454 @section Pragma Source_Reference
7457 Syntax:
7459 @example
7460 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7461 @end example
7463 This pragma must appear as the first line of a source file.
7464 @code{integer_literal} is the logical line number of the line following
7465 the pragma line (for use in error messages and debugging
7466 information).  @code{string_literal} is a static string constant that
7467 specifies the file name to be used in error messages and debugging
7468 information.  This is most notably used for the output of @code{gnatchop}
7469 with the @emph{-r} switch, to make sure that the original unchopped
7470 source file is the one referred to.
7472 The second argument must be a string literal, it cannot be a static
7473 string expression other than a string literal.  This is because its value
7474 is needed for error messages issued by all phases of the compiler.
7476 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7477 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{e9}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{ea}
7478 @section Pragma SPARK_Mode
7481 Syntax:
7483 @example
7484 pragma SPARK_Mode [(On | Off)] ;
7485 @end example
7487 In general a program can have some parts that are in SPARK 2014 (and
7488 follow all the rules in the SPARK Reference Manual), and some parts
7489 that are full Ada 2012.
7491 The SPARK_Mode pragma is used to identify which parts are in SPARK
7492 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7493 be used in the following places:
7496 @itemize *
7498 @item 
7499 As a configuration pragma, in which case it sets the default mode for
7500 all units compiled with this pragma.
7502 @item 
7503 Immediately following a library-level subprogram spec
7505 @item 
7506 Immediately within a library-level package body
7508 @item 
7509 Immediately following the @code{private} keyword of a library-level
7510 package spec
7512 @item 
7513 Immediately following the @code{begin} keyword of a library-level
7514 package body
7516 @item 
7517 Immediately within a library-level subprogram body
7518 @end itemize
7520 Normally a subprogram or package spec/body inherits the current mode
7521 that is active at the point it is declared. But this can be overridden
7522 by pragma within the spec or body as above.
7524 The basic consistency rule is that you can't turn SPARK_Mode back
7525 @code{On}, once you have explicitly (with a pragma) turned if
7526 @code{Off}. So the following rules apply:
7528 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7529 also have SPARK_Mode @code{Off}.
7531 For a package, we have four parts:
7534 @itemize *
7536 @item 
7537 the package public declarations
7539 @item 
7540 the package private part
7542 @item 
7543 the body of the package
7545 @item 
7546 the elaboration code after @code{begin}
7547 @end itemize
7549 For a package, the rule is that if you explicitly turn SPARK_Mode
7550 @code{Off} for any part, then all the following parts must have
7551 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7552 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7553 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7554 default everywhere, and one particular package spec has pragma
7555 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7556 the package body.
7558 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7559 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{eb}
7560 @section Pragma Static_Elaboration_Desired
7563 Syntax:
7565 @example
7566 pragma Static_Elaboration_Desired;
7567 @end example
7569 This pragma is used to indicate that the compiler should attempt to initialize
7570 statically the objects declared in the library unit to which the pragma applies,
7571 when these objects are initialized (explicitly or implicitly) by an aggregate.
7572 In the absence of this pragma, aggregates in object declarations are expanded
7573 into assignments and loops, even when the aggregate components are static
7574 constants. When the aggregate is present the compiler builds a static expression
7575 that requires no run-time code, so that the initialized object can be placed in
7576 read-only data space. If the components are not static, or the aggregate has
7577 more that 100 components, the compiler emits a warning that the pragma cannot
7578 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7579 construction of larger aggregates with static components that include an others
7580 choice.)
7582 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7583 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{ec}
7584 @section Pragma Stream_Convert
7587 Syntax:
7589 @example
7590 pragma Stream_Convert (
7591   [Entity =>] type_LOCAL_NAME,
7592   [Read   =>] function_NAME,
7593   [Write  =>] function_NAME);
7594 @end example
7596 This pragma provides an efficient way of providing user-defined stream
7597 attributes.  Not only is it simpler to use than specifying the attributes
7598 directly, but more importantly, it allows the specification to be made in such
7599 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7600 needed (i.e. unless the stream attributes are actually used); the use of
7601 the Stream_Convert pragma adds no overhead at all, unless the stream
7602 attributes are actually used on the designated type.
7604 The first argument specifies the type for which stream functions are
7605 provided.  The second parameter provides a function used to read values
7606 of this type.  It must name a function whose argument type may be any
7607 subtype, and whose returned type must be the type given as the first
7608 argument to the pragma.
7610 The meaning of the @code{Read} parameter is that if a stream attribute directly
7611 or indirectly specifies reading of the type given as the first parameter,
7612 then a value of the type given as the argument to the Read function is
7613 read from the stream, and then the Read function is used to convert this
7614 to the required target type.
7616 Similarly the @code{Write} parameter specifies how to treat write attributes
7617 that directly or indirectly apply to the type given as the first parameter.
7618 It must have an input parameter of the type specified by the first parameter,
7619 and the return type must be the same as the input type of the Read function.
7620 The effect is to first call the Write function to convert to the given stream
7621 type, and then write the result type to the stream.
7623 The Read and Write functions must not be overloaded subprograms.  If necessary
7624 renamings can be supplied to meet this requirement.
7625 The usage of this attribute is best illustrated by a simple example, taken
7626 from the GNAT implementation of package Ada.Strings.Unbounded:
7628 @example
7629 function To_Unbounded (S : String) return Unbounded_String
7630   renames To_Unbounded_String;
7632 pragma Stream_Convert
7633   (Unbounded_String, To_Unbounded, To_String);
7634 @end example
7636 The specifications of the referenced functions, as given in the Ada
7637 Reference Manual are:
7639 @example
7640 function To_Unbounded_String (Source : String)
7641   return Unbounded_String;
7643 function To_String (Source : Unbounded_String)
7644   return String;
7645 @end example
7647 The effect is that if the value of an unbounded string is written to a stream,
7648 then the representation of the item in the stream is in the same format that
7649 would be used for @code{Standard.String'Output}, and this same representation
7650 is expected when a value of this type is read from the stream. Note that the
7651 value written always includes the bounds, even for Unbounded_String'Write,
7652 since Unbounded_String is not an array type.
7654 Note that the @code{Stream_Convert} pragma is not effective in the case of
7655 a derived type of a non-limited tagged type. If such a type is specified then
7656 the pragma is silently ignored, and the default implementation of the stream
7657 attributes is used instead.
7659 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7660 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{ed}
7661 @section Pragma Style_Checks
7664 Syntax:
7666 @example
7667 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7668                      On | Off [, LOCAL_NAME]);
7669 @end example
7671 This pragma is used in conjunction with compiler switches to control the
7672 built in style checking provided by GNAT.  The compiler switches, if set,
7673 provide an initial setting for the switches, and this pragma may be used
7674 to modify these settings, or the settings may be provided entirely by
7675 the use of the pragma.  This pragma can be used anywhere that a pragma
7676 is legal, including use as a configuration pragma (including use in
7677 the @code{gnat.adc} file).
7679 The form with a string literal specifies which style options are to be
7680 activated.  These are additive, so they apply in addition to any previously
7681 set style check options.  The codes for the options are the same as those
7682 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7683 For example the following two methods can be used to enable
7684 layout checking:
7687 @itemize *
7689 @item 
7690 @example
7691 pragma Style_Checks ("l");
7692 @end example
7694 @item 
7695 @example
7696 gcc -c -gnatyl ...
7697 @end example
7698 @end itemize
7700 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7701 to the use of the @code{gnaty} switch with no options.
7702 See the @cite{GNAT User's Guide} for details.)
7704 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7705 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7706 options (i.e. equivalent to @code{-gnatyg}).
7708 The forms with @code{Off} and @code{On}
7709 can be used to temporarily disable style checks
7710 as shown in the following example:
7712 @example
7713 pragma Style_Checks ("k"); -- requires keywords in lower case
7714 pragma Style_Checks (Off); -- turn off style checks
7715 NULL;                      -- this will not generate an error message
7716 pragma Style_Checks (On);  -- turn style checks back on
7717 NULL;                      -- this will generate an error message
7718 @end example
7720 Finally the two argument form is allowed only if the first argument is
7721 @code{On} or @code{Off}.  The effect is to turn of semantic style checks
7722 for the specified entity, as shown in the following example:
7724 @example
7725 pragma Style_Checks ("r"); -- require consistency of identifier casing
7726 Arg : Integer;
7727 Rf1 : Integer := ARG;      -- incorrect, wrong case
7728 pragma Style_Checks (Off, Arg);
7729 Rf2 : Integer := ARG;      -- OK, no error
7730 @end example
7732 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7733 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{ee}
7734 @section Pragma Subtitle
7737 Syntax:
7739 @example
7740 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7741 @end example
7743 This pragma is recognized for compatibility with other Ada compilers
7744 but is ignored by GNAT.
7746 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7747 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{ef}
7748 @section Pragma Suppress
7751 Syntax:
7753 @example
7754 pragma Suppress (Identifier [, [On =>] Name]);
7755 @end example
7757 This is a standard pragma, and supports all the check names required in
7758 the RM. It is included here because GNAT recognizes some additional check
7759 names that are implementation defined (as permitted by the RM):
7762 @itemize *
7764 @item 
7765 @code{Alignment_Check} can be used to suppress alignment checks
7766 on addresses used in address clauses. Such checks can also be suppressed
7767 by suppressing range checks, but the specific use of @code{Alignment_Check}
7768 allows suppression of alignment checks without suppressing other range checks.
7769 Note that @code{Alignment_Check} is suppressed by default on machines (such as
7770 the x86) with non-strict alignment.
7772 @item 
7773 @code{Atomic_Synchronization} can be used to suppress the special memory
7774 synchronization instructions that are normally generated for access to
7775 @code{Atomic} variables to ensure correct synchronization between tasks
7776 that use such variables for synchronization purposes.
7778 @item 
7779 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7780 for a duplicated tag value when a tagged type is declared.
7782 @item 
7783 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
7784 and instances of its children, including Tampering_Check.
7786 @item 
7787 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
7789 @item 
7790 @code{Predicate_Check} can be used to control whether predicate checks are
7791 active. It is applicable only to predicates for which the policy is
7792 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
7793 predicate is ignored or checked for the whole program, the use of
7794 @code{Suppress} and @code{Unsuppress} with this check name allows a given
7795 predicate to be turned on and off at specific points in the program.
7797 @item 
7798 @code{Validity_Check} can be used specifically to control validity checks.
7799 If @code{Suppress} is used to suppress validity checks, then no validity
7800 checks are performed, including those specified by the appropriate compiler
7801 switch or the @code{Validity_Checks} pragma.
7803 @item 
7804 Additional check names previously introduced by use of the @code{Check_Name}
7805 pragma are also allowed.
7806 @end itemize
7808 Note that pragma Suppress gives the compiler permission to omit
7809 checks, but does not require the compiler to omit checks. The compiler
7810 will generate checks if they are essentially free, even when they are
7811 suppressed. In particular, if the compiler can prove that a certain
7812 check will necessarily fail, it will generate code to do an
7813 unconditional 'raise', even if checks are suppressed. The compiler
7814 warns in this case.
7816 Of course, run-time checks are omitted whenever the compiler can prove
7817 that they will not fail, whether or not checks are suppressed.
7819 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
7820 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f0}
7821 @section Pragma Suppress_All
7824 Syntax:
7826 @example
7827 pragma Suppress_All;
7828 @end example
7830 This pragma can appear anywhere within a unit.
7831 The effect is to apply @code{Suppress (All_Checks)} to the unit
7832 in which it appears.  This pragma is implemented for compatibility with DEC
7833 Ada 83 usage where it appears at the end of a unit, and for compatibility
7834 with Rational Ada, where it appears as a program unit pragma.
7835 The use of the standard Ada pragma @code{Suppress (All_Checks)}
7836 as a normal configuration pragma is the preferred usage in GNAT.
7838 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
7839 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f1}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f2}
7840 @section Pragma Suppress_Debug_Info
7843 Syntax:
7845 @example
7846 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
7847 @end example
7849 This pragma can be used to suppress generation of debug information
7850 for the specified entity. It is intended primarily for use in debugging
7851 the debugger, and navigating around debugger problems.
7853 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
7854 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f3}
7855 @section Pragma Suppress_Exception_Locations
7858 Syntax:
7860 @example
7861 pragma Suppress_Exception_Locations;
7862 @end example
7864 In normal mode, a raise statement for an exception by default generates
7865 an exception message giving the file name and line number for the location
7866 of the raise. This is useful for debugging and logging purposes, but this
7867 entails extra space for the strings for the messages. The configuration
7868 pragma @code{Suppress_Exception_Locations} can be used to suppress the
7869 generation of these strings, with the result that space is saved, but the
7870 exception message for such raises is null. This configuration pragma may
7871 appear in a global configuration pragma file, or in a specific unit as
7872 usual. It is not required that this pragma be used consistently within
7873 a partition, so it is fine to have some units within a partition compiled
7874 with this pragma and others compiled in normal mode without it.
7876 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
7877 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f4}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f5}
7878 @section Pragma Suppress_Initialization
7881 @geindex Suppressing initialization
7883 @geindex Initialization
7884 @geindex suppression of
7886 Syntax:
7888 @example
7889 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
7890 @end example
7892 Here variable_or_subtype_Name is the name introduced by a type declaration
7893 or subtype declaration or the name of a variable introduced by an
7894 object declaration.
7896 In the case of a type or subtype
7897 this pragma suppresses any implicit or explicit initialization
7898 for all variables of the given type or subtype,
7899 including initialization resulting from the use of pragmas
7900 Normalize_Scalars or Initialize_Scalars.
7902 This is considered a representation item, so it cannot be given after
7903 the type is frozen. It applies to all subsequent object declarations,
7904 and also any allocator that creates objects of the type.
7906 If the pragma is given for the first subtype, then it is considered
7907 to apply to the base type and all its subtypes. If the pragma is given
7908 for other than a first subtype, then it applies only to the given subtype.
7909 The pragma may not be given after the type is frozen.
7911 Note that this includes eliminating initialization of discriminants
7912 for discriminated types, and tags for tagged types. In these cases,
7913 you will have to use some non-portable mechanism (e.g. address
7914 overlays or unchecked conversion) to achieve required initialization
7915 of these fields before accessing any object of the corresponding type.
7917 For the variable case, implicit initialization for the named variable
7918 is suppressed, just as though its subtype had been given in a pragma
7919 Suppress_Initialization, as described above.
7921 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
7922 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{f6}
7923 @section Pragma Task_Name
7926 Syntax
7928 @example
7929 pragma Task_Name (string_EXPRESSION);
7930 @end example
7932 This pragma appears within a task definition (like pragma
7933 @code{Priority}) and applies to the task in which it appears.  The
7934 argument must be of type String, and provides a name to be used for
7935 the task instance when the task is created.  Note that this expression
7936 is not required to be static, and in particular, it can contain
7937 references to task discriminants.  This facility can be used to
7938 provide different names for different tasks as they are created,
7939 as illustrated in the example below.
7941 The task name is recorded internally in the run-time structures
7942 and is accessible to tools like the debugger.  In addition the
7943 routine @code{Ada.Task_Identification.Image} will return this
7944 string, with a unique task address appended.
7946 @example
7947 --  Example of the use of pragma Task_Name
7949 with Ada.Task_Identification;
7950 use Ada.Task_Identification;
7951 with Text_IO; use Text_IO;
7952 procedure t3 is
7954    type Astring is access String;
7956    task type Task_Typ (Name : access String) is
7957       pragma Task_Name (Name.all);
7958    end Task_Typ;
7960    task body Task_Typ is
7961       Nam : constant String := Image (Current_Task);
7962    begin
7963       Put_Line ("-->" & Nam (1 .. 14) & "<--");
7964    end Task_Typ;
7966    type Ptr_Task is access Task_Typ;
7967    Task_Var : Ptr_Task;
7969 begin
7970    Task_Var :=
7971      new Task_Typ (new String'("This is task 1"));
7972    Task_Var :=
7973      new Task_Typ (new String'("This is task 2"));
7974 end;
7975 @end example
7977 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
7978 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{f7}
7979 @section Pragma Task_Storage
7982 Syntax:
7984 @example
7985 pragma Task_Storage (
7986   [Task_Type =>] LOCAL_NAME,
7987   [Top_Guard =>] static_integer_EXPRESSION);
7988 @end example
7990 This pragma specifies the length of the guard area for tasks.  The guard
7991 area is an additional storage area allocated to a task.  A value of zero
7992 means that either no guard area is created or a minimal guard area is
7993 created, depending on the target.  This pragma can appear anywhere a
7994 @code{Storage_Size} attribute definition clause is allowed for a task
7995 type.
7997 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
7998 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{f8}@anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f9}
7999 @section Pragma Test_Case
8002 @geindex Test cases
8004 Syntax:
8006 @example
8007 pragma Test_Case (
8008    [Name     =>] static_string_Expression
8009   ,[Mode     =>] (Nominal | Robustness)
8010  [, Requires =>  Boolean_Expression]
8011  [, Ensures  =>  Boolean_Expression]);
8012 @end example
8014 The @code{Test_Case} pragma allows defining fine-grain specifications
8015 for use by testing tools.
8016 The compiler checks the validity of the @code{Test_Case} pragma, but its
8017 presence does not lead to any modification of the code generated by the
8018 compiler.
8020 @code{Test_Case} pragmas may only appear immediately following the
8021 (separate) declaration of a subprogram in a package declaration, inside
8022 a package spec unit. Only other pragmas may intervene (that is appear
8023 between the subprogram declaration and a test case).
8025 The compiler checks that boolean expressions given in @code{Requires} and
8026 @code{Ensures} are valid, where the rules for @code{Requires} are the
8027 same as the rule for an expression in @code{Precondition} and the rules
8028 for @code{Ensures} are the same as the rule for an expression in
8029 @code{Postcondition}. In particular, attributes @code{'Old} and
8030 @code{'Result} can only be used within the @code{Ensures}
8031 expression. The following is an example of use within a package spec:
8033 @example
8034 package Math_Functions is
8035    ...
8036    function Sqrt (Arg : Float) return Float;
8037    pragma Test_Case (Name     => "Test 1",
8038                      Mode     => Nominal,
8039                      Requires => Arg < 10000,
8040                      Ensures  => Sqrt'Result < 10);
8041    ...
8042 end Math_Functions;
8043 @end example
8045 The meaning of a test case is that there is at least one context where
8046 @code{Requires} holds such that, if the associated subprogram is executed in
8047 that context, then @code{Ensures} holds when the subprogram returns.
8048 Mode @code{Nominal} indicates that the input context should also satisfy the
8049 precondition of the subprogram, and the output context should also satisfy its
8050 postcondition. Mode @code{Robustness} indicates that the precondition and
8051 postcondition of the subprogram should be ignored for this test case.
8053 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8054 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{fa}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{fb}
8055 @section Pragma Thread_Local_Storage
8058 @geindex Task specific storage
8060 @geindex TLS (Thread Local Storage)
8062 @geindex Task_Attributes
8064 Syntax:
8066 @example
8067 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8068 @end example
8070 This pragma specifies that the specified entity, which must be
8071 a variable declared in a library-level package, is to be marked as
8072 "Thread Local Storage" (@code{TLS}). On systems supporting this (which
8073 include Windows, Solaris, GNU/Linux and VxWorks 6), this causes each
8074 thread (and hence each Ada task) to see a distinct copy of the variable.
8076 The variable may not have default initialization, and if there is
8077 an explicit initialization, it must be either @code{null} for an
8078 access variable, or a static expression for a scalar variable.
8079 This provides a low level mechanism similar to that provided by
8080 the @code{Ada.Task_Attributes} package, but much more efficient
8081 and is also useful in writing interface code that will interact
8082 with foreign threads.
8084 If this pragma is used on a system where @code{TLS} is not supported,
8085 then an error message will be generated and the program will be rejected.
8087 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8088 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{fc}
8089 @section Pragma Time_Slice
8092 Syntax:
8094 @example
8095 pragma Time_Slice (static_duration_EXPRESSION);
8096 @end example
8098 For implementations of GNAT on operating systems where it is possible
8099 to supply a time slice value, this pragma may be used for this purpose.
8100 It is ignored if it is used in a system that does not allow this control,
8101 or if it appears in other than the main program unit.
8103 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8104 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{fd}
8105 @section Pragma Title
8108 Syntax:
8110 @example
8111 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8113 TITLING_OPTION ::=
8114   [Title    =>] STRING_LITERAL,
8115 | [Subtitle =>] STRING_LITERAL
8116 @end example
8118 Syntax checked but otherwise ignored by GNAT.  This is a listing control
8119 pragma used in DEC Ada 83 implementations to provide a title and/or
8120 subtitle for the program listing.  The program listing generated by GNAT
8121 does not have titles or subtitles.
8123 Unlike other pragmas, the full flexibility of named notation is allowed
8124 for this pragma, i.e., the parameters may be given in any order if named
8125 notation is used, and named and positional notation can be mixed
8126 following the normal rules for procedure calls in Ada.
8128 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8129 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{fe}
8130 @section Pragma Type_Invariant
8133 Syntax:
8135 @example
8136 pragma Type_Invariant
8137   ([Entity =>] type_LOCAL_NAME,
8138    [Check  =>] EXPRESSION);
8139 @end example
8141 The @code{Type_Invariant} pragma is intended to be an exact
8142 replacement for the language-defined @code{Type_Invariant}
8143 aspect, and shares its restrictions and semantics. It differs
8144 from the language defined @code{Invariant} pragma in that it
8145 does not permit a string parameter, and it is
8146 controlled by the assertion identifier @code{Type_Invariant}
8147 rather than @code{Invariant}.
8149 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8150 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{ff}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{100}
8151 @section Pragma Type_Invariant_Class
8154 Syntax:
8156 @example
8157 pragma Type_Invariant_Class
8158   ([Entity =>] type_LOCAL_NAME,
8159    [Check  =>] EXPRESSION);
8160 @end example
8162 The @code{Type_Invariant_Class} pragma is intended to be an exact
8163 replacement for the language-defined @code{Type_Invariant'Class}
8164 aspect, and shares its restrictions and semantics.
8166 Note: This pragma is called @code{Type_Invariant_Class} rather than
8167 @code{Type_Invariant'Class} because the latter would not be strictly
8168 conforming to the allowed syntax for pragmas. The motivation
8169 for providing pragmas equivalent to the aspects is to allow a program
8170 to be written using the pragmas, and then compiled if necessary
8171 using an Ada compiler that does not recognize the pragmas or
8172 aspects, but is prepared to ignore the pragmas. The assertion
8173 policy that controls this pragma is @code{Type_Invariant'Class},
8174 not @code{Type_Invariant_Class}.
8176 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8177 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{101}
8178 @section Pragma Unchecked_Union
8181 @geindex Unions in C
8183 Syntax:
8185 @example
8186 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8187 @end example
8189 This pragma is used to specify a representation of a record type that is
8190 equivalent to a C union. It was introduced as a GNAT implementation defined
8191 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8192 pragma, making it language defined, and GNAT fully implements this extended
8193 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8194 details, consult the Ada 2012 Reference Manual, section B.3.3.
8196 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8197 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{102}
8198 @section Pragma Unevaluated_Use_Of_Old
8201 @geindex Attribute Old
8203 @geindex Attribute Loop_Entry
8205 @geindex Unevaluated_Use_Of_Old
8207 Syntax:
8209 @example
8210 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8211 @end example
8213 This pragma controls the processing of attributes Old and Loop_Entry.
8214 If either of these attributes is used in a potentially unevaluated
8215 expression  (e.g. the then or else parts of an if expression), then
8216 normally this usage is considered illegal if the prefix of the attribute
8217 is other than an entity name. The language requires this
8218 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8220 The reason for this rule is that otherwise, we can have a situation
8221 where we save the Old value, and this results in an exception, even
8222 though we might not evaluate the attribute. Consider this example:
8224 @example
8225 package UnevalOld is
8226    K : Character;
8227    procedure U (A : String; C : Boolean)  -- ERROR
8228      with Post => (if C then A(1)'Old = K else True);
8229 end;
8230 @end example
8232 If procedure U is called with a string with a lower bound of 2, and
8233 C false, then an exception would be raised trying to evaluate A(1)
8234 on entry even though the value would not be actually used.
8236 Although the rule guarantees against this possibility, it is sometimes
8237 too restrictive. For example if we know that the string has a lower
8238 bound of 1, then we will never raise an exception.
8239 The pragma @code{Unevaluated_Use_Of_Old} can be
8240 used to modify this behavior. If the argument is @code{Error} then an
8241 error is given (this is the default RM behavior). If the argument is
8242 @code{Warn} then the usage is allowed as legal but with a warning
8243 that an exception might be raised. If the argument is @code{Allow}
8244 then the usage is allowed as legal without generating a warning.
8246 This pragma may appear as a configuration pragma, or in a declarative
8247 part or package specification. In the latter case it applies to
8248 uses up to the end of the corresponding statement sequence or
8249 sequence of package declarations.
8251 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8252 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{103}
8253 @section Pragma Unimplemented_Unit
8256 Syntax:
8258 @example
8259 pragma Unimplemented_Unit;
8260 @end example
8262 If this pragma occurs in a unit that is processed by the compiler, GNAT
8263 aborts with the message @code{xxx not implemented}, where
8264 @code{xxx} is the name of the current compilation unit.  This pragma is
8265 intended to allow the compiler to handle unimplemented library units in
8266 a clean manner.
8268 The abort only happens if code is being generated.  Thus you can use
8269 specs of unimplemented packages in syntax or semantic checking mode.
8271 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8272 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{104}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{105}
8273 @section Pragma Universal_Aliasing
8276 Syntax:
8278 @example
8279 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8280 @end example
8282 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8283 declarative part.  The effect is to inhibit strict type-based aliasing
8284 optimization for the given type.  In other words, the effect is as though
8285 access types designating this type were subject to pragma No_Strict_Aliasing.
8286 For a detailed description of the strict aliasing optimization, and the
8287 situations in which it must be suppressed, see the section on
8288 @code{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
8290 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
8291 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{106}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{107}
8292 @section Pragma Universal_Data
8295 Syntax:
8297 @example
8298 pragma Universal_Data [(library_unit_Name)];
8299 @end example
8301 This pragma is supported only for the AAMP target and is ignored for
8302 other targets. The pragma specifies that all library-level objects
8303 (Counter 0 data) associated with the library unit are to be accessed
8304 and updated using universal addressing (24-bit addresses for AAMP5)
8305 rather than the default of 16-bit Data Environment (DENV) addressing.
8306 Use of this pragma will generally result in less efficient code for
8307 references to global data associated with the library unit, but
8308 allows such data to be located anywhere in memory. This pragma is
8309 a library unit pragma, but can also be used as a configuration pragma
8310 (including use in the @code{gnat.adc} file). The functionality
8311 of this pragma is also available by applying the -univ switch on the
8312 compilations of units where universal addressing of the data is desired.
8314 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8315 @anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{108}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{109}
8316 @section Pragma Unmodified
8319 @geindex Warnings
8320 @geindex unmodified
8322 Syntax:
8324 @example
8325 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8326 @end example
8328 This pragma signals that the assignable entities (variables,
8329 @code{out} parameters, @code{in out} parameters) whose names are listed are
8330 deliberately not assigned in the current source unit. This
8331 suppresses warnings about the
8332 entities being referenced but not assigned, and in addition a warning will be
8333 generated if one of these entities is in fact assigned in the
8334 same unit as the pragma (or in the corresponding body, or one
8335 of its subunits).
8337 This is particularly useful for clearly signaling that a particular
8338 parameter is not modified, even though the spec suggests that it might
8341 For the variable case, warnings are never given for unreferenced variables
8342 whose name contains one of the substrings
8343 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8344 are typically to be used in cases where such warnings are expected.
8345 Thus it is never necessary to use @code{pragma Unmodified} for such
8346 variables, though it is harmless to do so.
8348 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8349 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10b}
8350 @section Pragma Unreferenced
8353 @geindex Warnings
8354 @geindex unreferenced
8356 Syntax:
8358 @example
8359 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8360 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8361 @end example
8363 This pragma signals that the entities whose names are listed are
8364 deliberately not referenced in the current source unit after the
8365 occurrence of the pragma. This
8366 suppresses warnings about the
8367 entities being unreferenced, and in addition a warning will be
8368 generated if one of these entities is in fact subsequently referenced in the
8369 same unit as the pragma (or in the corresponding body, or one
8370 of its subunits).
8372 This is particularly useful for clearly signaling that a particular
8373 parameter is not referenced in some particular subprogram implementation
8374 and that this is deliberate. It can also be useful in the case of
8375 objects declared only for their initialization or finalization side
8376 effects.
8378 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8379 current scope, then the entity most recently declared is the one to which
8380 the pragma applies. Note that in the case of accept formals, the pragma
8381 Unreferenced may appear immediately after the keyword @code{do} which
8382 allows the indication of whether or not accept formals are referenced
8383 or not to be given individually for each accept statement.
8385 The left hand side of an assignment does not count as a reference for the
8386 purpose of this pragma. Thus it is fine to assign to an entity for which
8387 pragma Unreferenced is given.
8389 Note that if a warning is desired for all calls to a given subprogram,
8390 regardless of whether they occur in the same unit as the subprogram
8391 declaration, then this pragma should not be used (calls from another
8392 unit would not be flagged); pragma Obsolescent can be used instead
8393 for this purpose, see @ref{a9,,Pragma Obsolescent}.
8395 The second form of pragma @code{Unreferenced} is used within a context
8396 clause. In this case the arguments must be unit names of units previously
8397 mentioned in @code{with} clauses (similar to the usage of pragma
8398 @code{Elaborate_All}. The effect is to suppress warnings about unreferenced
8399 units and unreferenced entities within these units.
8401 For the variable case, warnings are never given for unreferenced variables
8402 whose name contains one of the substrings
8403 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8404 are typically to be used in cases where such warnings are expected.
8405 Thus it is never necessary to use @code{pragma Unreferenced} for such
8406 variables, though it is harmless to do so.
8408 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8409 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10d}
8410 @section Pragma Unreferenced_Objects
8413 @geindex Warnings
8414 @geindex unreferenced
8416 Syntax:
8418 @example
8419 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8420 @end example
8422 This pragma signals that for the types or subtypes whose names are
8423 listed, objects which are declared with one of these types or subtypes may
8424 not be referenced, and if no references appear, no warnings are given.
8426 This is particularly useful for objects which are declared solely for their
8427 initialization and finalization effect. Such variables are sometimes referred
8428 to as RAII variables (Resource Acquisition Is Initialization). Using this
8429 pragma on the relevant type (most typically a limited controlled type), the
8430 compiler will automatically suppress unwanted warnings about these variables
8431 not being referenced.
8433 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8434 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{10e}
8435 @section Pragma Unreserve_All_Interrupts
8438 Syntax:
8440 @example
8441 pragma Unreserve_All_Interrupts;
8442 @end example
8444 Normally certain interrupts are reserved to the implementation.  Any attempt
8445 to attach an interrupt causes Program_Error to be raised, as described in
8446 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
8447 many systems for a @code{Ctrl-C} interrupt.  Normally this interrupt is
8448 reserved to the implementation, so that @code{Ctrl-C} can be used to
8449 interrupt execution.
8451 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8452 a program, then all such interrupts are unreserved.  This allows the
8453 program to handle these interrupts, but disables their standard
8454 functions.  For example, if this pragma is used, then pressing
8455 @code{Ctrl-C} will not automatically interrupt execution.  However,
8456 a program can then handle the @code{SIGINT} interrupt as it chooses.
8458 For a full list of the interrupts handled in a specific implementation,
8459 see the source code for the spec of @code{Ada.Interrupts.Names} in
8460 file @code{a-intnam.ads}.  This is a target dependent file that contains the
8461 list of interrupts recognized for a given target.  The documentation in
8462 this file also specifies what interrupts are affected by the use of
8463 the @code{Unreserve_All_Interrupts} pragma.
8465 For a more general facility for controlling what interrupts can be
8466 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8467 of the @code{Unreserve_All_Interrupts} pragma.
8469 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8470 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{10f}
8471 @section Pragma Unsuppress
8474 Syntax:
8476 @example
8477 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8478 @end example
8480 This pragma undoes the effect of a previous pragma @code{Suppress}.  If
8481 there is no corresponding pragma @code{Suppress} in effect, it has no
8482 effect.  The range of the effect is the same as for pragma
8483 @code{Suppress}.  The meaning of the arguments is identical to that used
8484 in pragma @code{Suppress}.
8486 One important application is to ensure that checks are on in cases where
8487 code depends on the checks for its correct functioning, so that the code
8488 will compile correctly even if the compiler switches are set to suppress
8489 checks. For example, in a program that depends on external names of tagged
8490 types and wants to ensure that the duplicated tag check occurs even if all
8491 run-time checks are suppressed by a compiler switch, the following
8492 configuration pragma will ensure this test is not suppressed:
8494 @example
8495 pragma Unsuppress (Duplicated_Tag_Check);
8496 @end example
8498 This pragma is standard in Ada 2005. It is available in all earlier versions
8499 of Ada as an implementation-defined pragma.
8501 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8502 number of implementation-defined check names. See the description of pragma
8503 @code{Suppress} for full details.
8505 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8506 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{110}
8507 @section Pragma Use_VADS_Size
8510 @geindex Size
8511 @geindex VADS compatibility
8513 @geindex Rational profile
8515 Syntax:
8517 @example
8518 pragma Use_VADS_Size;
8519 @end example
8521 This is a configuration pragma.  In a unit to which it applies, any use
8522 of the 'Size attribute is automatically interpreted as a use of the
8523 'VADS_Size attribute.  Note that this may result in incorrect semantic
8524 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
8525 the handling of existing code which depends on the interpretation of Size
8526 as implemented in the VADS compiler.  See description of the VADS_Size
8527 attribute for further details.
8529 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8530 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{111}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{112}
8531 @section Pragma Unused
8534 @geindex Warnings
8535 @geindex unused
8537 Syntax:
8539 @example
8540 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8541 @end example
8543 This pragma signals that the assignable entities (variables,
8544 @code{out} parameters, and @code{in out} parameters) whose names are listed
8545 deliberately do not get assigned or referenced in the current source unit
8546 after the occurrence of the pragma in the current source unit. This
8547 suppresses warnings about the entities that are unreferenced and/or not
8548 assigned, and, in addition, a warning will be generated if one of these
8549 entities gets assigned or subsequently referenced in the same unit as the
8550 pragma (in the corresponding body or one of its subunits).
8552 This is particularly useful for clearly signaling that a particular
8553 parameter is not modified or referenced, even though the spec suggests
8554 that it might be.
8556 For the variable case, warnings are never given for unreferenced
8557 variables whose name contains one of the substrings
8558 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8559 are typically to be used in cases where such warnings are expected.
8560 Thus it is never necessary to use @code{pragma Unmodified} for such
8561 variables, though it is harmless to do so.
8563 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8564 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{113}
8565 @section Pragma Validity_Checks
8568 Syntax:
8570 @example
8571 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8572 @end example
8574 This pragma is used in conjunction with compiler switches to control the
8575 built-in validity checking provided by GNAT.  The compiler switches, if set
8576 provide an initial setting for the switches, and this pragma may be used
8577 to modify these settings, or the settings may be provided entirely by
8578 the use of the pragma.  This pragma can be used anywhere that a pragma
8579 is legal, including use as a configuration pragma (including use in
8580 the @code{gnat.adc} file).
8582 The form with a string literal specifies which validity options are to be
8583 activated.  The validity checks are first set to include only the default
8584 reference manual settings, and then a string of letters in the string
8585 specifies the exact set of options required.  The form of this string
8586 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8587 GNAT User's Guide for details).  For example the following two
8588 methods can be used to enable validity checking for mode @code{in} and
8589 @code{in out} subprogram parameters:
8592 @itemize *
8594 @item 
8595 @example
8596 pragma Validity_Checks ("im");
8597 @end example
8599 @item 
8600 @example
8601 $ gcc -c -gnatVim ...
8602 @end example
8603 @end itemize
8605 The form ALL_CHECKS activates all standard checks (its use is equivalent
8606 to the use of the @code{gnatva} switch.
8608 The forms with @code{Off} and @code{On}
8609 can be used to temporarily disable validity checks
8610 as shown in the following example:
8612 @example
8613 pragma Validity_Checks ("c"); -- validity checks for copies
8614 pragma Validity_Checks (Off); -- turn off validity checks
8615 A := B;                       -- B will not be validity checked
8616 pragma Validity_Checks (On);  -- turn validity checks back on
8617 A := C;                       -- C will be validity checked
8618 @end example
8620 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8621 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{114}
8622 @section Pragma Volatile
8625 Syntax:
8627 @example
8628 pragma Volatile (LOCAL_NAME);
8629 @end example
8631 This pragma is defined by the Ada Reference Manual, and the GNAT
8632 implementation is fully conformant with this definition.  The reason it
8633 is mentioned in this section is that a pragma of the same name was supplied
8634 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
8635 implementation of pragma Volatile is upwards compatible with the
8636 implementation in DEC Ada 83.
8638 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8639 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{115}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{116}
8640 @section Pragma Volatile_Full_Access
8643 Syntax:
8645 @example
8646 pragma Volatile_Full_Access (LOCAL_NAME);
8647 @end example
8649 This is similar in effect to pragma Volatile, except that any reference to the
8650 object is guaranteed to be done only with instructions that read or write all
8651 the bits of the object. Furthermore, if the object is of a composite type,
8652 then any reference to a component of the object is guaranteed to read and/or
8653 write all the bits of the object.
8655 The intention is that this be suitable for use with memory-mapped I/O devices
8656 on some machines. Note that there are two important respects in which this is
8657 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8658 object is not a sequential action in the RM 9.10 sense and, therefore, does
8659 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8660 there is no guarantee that all the bits will be accessed if the reference
8661 is not to the whole object; the compiler is allowed (and generally will)
8662 access only part of the object in this case.
8664 It is not permissible to specify @code{Atomic} and @code{Volatile_Full_Access} for
8665 the same object.
8667 It is not permissible to specify @code{Volatile_Full_Access} for a composite
8668 (record or array) type or object that has at least one @code{Aliased} component.
8670 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8671 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{118}
8672 @section Pragma Volatile_Function
8675 Syntax:
8677 @example
8678 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8679 @end example
8681 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8682 in the SPARK 2014 Reference Manual, section 7.1.2.
8684 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8685 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{119}
8686 @section Pragma Warning_As_Error
8689 Syntax:
8691 @example
8692 pragma Warning_As_Error (static_string_EXPRESSION);
8693 @end example
8695 This configuration pragma allows the programmer to specify a set
8696 of warnings that will be treated as errors. Any warning which
8697 matches the pattern given by the pragma argument will be treated
8698 as an error. This gives much more precise control that -gnatwe
8699 which treats all warnings as errors.
8701 The pattern may contain asterisks, which match zero or more characters in
8702 the message. For example, you can use
8703 @code{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8704 message @code{warning: 960 bits of "a" unused} as an error. No other regular
8705 expression notations are permitted. All characters other than asterisk in
8706 these three specific cases are treated as literal characters in the match.
8707 The match is case insensitive, for example XYZ matches xyz.
8709 Note that the pattern matches if it occurs anywhere within the warning
8710 message string (it is not necessary to put an asterisk at the start and
8711 the end of the message, since this is implied).
8713 Another possibility for the static_string_EXPRESSION which works whether
8714 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8715 @emph{-gnatw} tag string, enclosed in brackets,
8716 as shown in the example below, to treat a class of warnings as errors.
8718 The above use of patterns to match the message applies only to warning
8719 messages generated by the front end. This pragma can also be applied to
8720 warnings provided by the back end and mentioned in @ref{11a,,Pragma Warnings}.
8721 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8722 can also be treated as errors.
8724 The pragma can appear either in a global configuration pragma file
8725 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8726 configuration pragma file containing:
8728 @example
8729 pragma Warning_As_Error ("[-gnatwj]");
8730 @end example
8732 which will treat all obsolescent feature warnings as errors, the
8733 following program compiles as shown (compile options here are
8734 @emph{-gnatwa.d -gnatl -gnatj55}).
8736 @example
8737     1. pragma Warning_As_Error ("*never assigned*");
8738     2. function Warnerr return String is
8739     3.    X : Integer;
8740           |
8741        >>> error: variable "X" is never read and
8742            never assigned [-gnatwv] [warning-as-error]
8744     4.    Y : Integer;
8745           |
8746        >>> warning: variable "Y" is assigned but
8747            never read [-gnatwu]
8749     5. begin
8750     6.    Y := 0;
8751     7.    return %ABC%;
8752                  |
8753        >>> error: use of "%" is an obsolescent
8754            feature (RM J.2(4)), use """ instead
8755            [-gnatwj] [warning-as-error]
8757     8. end;
8759 8 lines: No errors, 3 warnings (2 treated as errors)
8760 @end example
8762 Note that this pragma does not affect the set of warnings issued in
8763 any way, it merely changes the effect of a matching warning if one
8764 is produced as a result of other warnings options. As shown in this
8765 example, if the pragma results in a warning being treated as an error,
8766 the tag is changed from "warning:" to "error:" and the string
8767 "[warning-as-error]" is appended to the end of the message.
8769 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8770 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{11b}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11a}
8771 @section Pragma Warnings
8774 Syntax:
8776 @example
8777 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8779 DETAILS ::= On | Off
8780 DETAILS ::= On | Off, local_NAME
8781 DETAILS ::= static_string_EXPRESSION
8782 DETAILS ::= On | Off, static_string_EXPRESSION
8784 TOOL_NAME ::= GNAT | GNATProve
8786 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
8787 @end example
8789 Note: in Ada 83 mode, a string literal may be used in place of a static string
8790 expression (which does not exist in Ada 83).
8792 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
8793 second form is always understood. If the intention is to use
8794 the fourth form, then you can write @code{NAME & ""} to force the
8795 intepretation as a @emph{static_string_EXPRESSION}.
8797 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
8798 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
8799 of SPARK and GNATprove, see last part of this section for details.
8801 Normally warnings are enabled, with the output being controlled by
8802 the command line switch.  Warnings (@code{Off}) turns off generation of
8803 warnings until a Warnings (@code{On}) is encountered or the end of the
8804 current unit.  If generation of warnings is turned off using this
8805 pragma, then some or all of the warning messages are suppressed,
8806 regardless of the setting of the command line switches.
8808 The @code{Reason} parameter may optionally appear as the last argument
8809 in any of the forms of this pragma. It is intended purely for the
8810 purposes of documenting the reason for the @code{Warnings} pragma.
8811 The compiler will check that the argument is a static string but
8812 otherwise ignore this argument. Other tools may provide specialized
8813 processing for this string.
8815 The form with a single argument (or two arguments if Reason present),
8816 where the first argument is @code{ON} or @code{OFF}
8817 may be used as a configuration pragma.
8819 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
8820 the specified entity.  This suppression is effective from the point where
8821 it occurs till the end of the extended scope of the variable (similar to
8822 the scope of @code{Suppress}). This form cannot be used as a configuration
8823 pragma.
8825 In the case where the first argument is other than @code{ON} or
8826 @code{OFF},
8827 the third form with a single static_string_EXPRESSION argument (and possible
8828 reason) provides more precise
8829 control over which warnings are active. The string is a list of letters
8830 specifying which warnings are to be activated and which deactivated. The
8831 code for these letters is the same as the string used in the command
8832 line switch controlling warnings. For a brief summary, use the gnatmake
8833 command with no arguments, which will generate usage information containing
8834 the list of warnings switches supported. For
8835 full details see the section on @code{Warning Message Control} in the
8836 @cite{GNAT User's Guide}.
8837 This form can also be used as a configuration pragma.
8839 The warnings controlled by the @code{-gnatw} switch are generated by the
8840 front end of the compiler. The GCC back end can provide additional warnings
8841 and they are controlled by the @code{-W} switch. Such warnings can be
8842 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
8843 message which designates the @code{-W@emph{xxx}} switch that controls the message.
8844 The form with a single @emph{static_string_EXPRESSION} argument also works for these
8845 warnings, but the string must be a single full @code{-W@emph{xxx}} switch in this
8846 case. The above reference lists a few examples of these additional warnings.
8848 The specified warnings will be in effect until the end of the program
8849 or another pragma @code{Warnings} is encountered. The effect of the pragma is
8850 cumulative. Initially the set of warnings is the standard default set
8851 as possibly modified by compiler switches. Then each pragma Warning
8852 modifies this set of warnings as specified. This form of the pragma may
8853 also be used as a configuration pragma.
8855 The fourth form, with an @code{On|Off} parameter and a string, is used to
8856 control individual messages, based on their text. The string argument
8857 is a pattern that is used to match against the text of individual
8858 warning messages (not including the initial "warning: " tag).
8860 The pattern may contain asterisks, which match zero or more characters in
8861 the message. For example, you can use
8862 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
8863 message @code{warning: 960 bits of "a" unused}. No other regular
8864 expression notations are permitted. All characters other than asterisk in
8865 these three specific cases are treated as literal characters in the match.
8866 The match is case insensitive, for example XYZ matches xyz.
8868 Note that the pattern matches if it occurs anywhere within the warning
8869 message string (it is not necessary to put an asterisk at the start and
8870 the end of the message, since this is implied).
8872 The above use of patterns to match the message applies only to warning
8873 messages generated by the front end. This form of the pragma with a string
8874 argument can also be used to control warnings provided by the back end and
8875 mentioned above. By using a single full @code{-W@emph{xxx}} switch in the pragma,
8876 such warnings can be turned on and off.
8878 There are two ways to use the pragma in this form. The OFF form can be used
8879 as a configuration pragma. The effect is to suppress all warnings (if any)
8880 that match the pattern string throughout the compilation (or match the
8881 -W switch in the back end case).
8883 The second usage is to suppress a warning locally, and in this case, two
8884 pragmas must appear in sequence:
8886 @example
8887 pragma Warnings (Off, Pattern);
8888 ... code where given warning is to be suppressed
8889 pragma Warnings (On, Pattern);
8890 @end example
8892 In this usage, the pattern string must match in the Off and On
8893 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
8894 warning must be suppressed.
8896 Note: if the ON form is not found, then the effect of the OFF form extends
8897 until the end of the file (pragma Warnings is purely textual, so its effect
8898 does not stop at the end of the enclosing scope).
8900 Note: to write a string that will match any warning, use the string
8901 @code{"***"}. It will not work to use a single asterisk or two
8902 asterisks since this looks like an operator name. This form with three
8903 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
8904 @code{pragma Warnings (On, "***")} will be required. This can be
8905 helpful in avoiding forgetting to turn warnings back on.
8907 Note: the debug flag @code{-gnatd.i} (@code{/NOWARNINGS_PRAGMAS} in VMS) can be
8908 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
8909 be useful in checking whether obsolete pragmas in existing programs are hiding
8910 real problems.
8912 Note: pragma Warnings does not affect the processing of style messages. See
8913 separate entry for pragma Style_Checks for control of style messages.
8915 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
8916 use the version of the pragma with a @code{TOOL_NAME} parameter.
8918 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
8919 compiler or @code{GNATprove} for the formal verification tool. A given tool only
8920 takes into account pragma Warnings that do not specify a tool name, or that
8921 specify the matching tool name. This makes it possible to disable warnings
8922 selectively for each tool, and as a consequence to detect useless pragma
8923 Warnings with switch @code{-gnatw.w}.
8925 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
8926 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{11c}
8927 @section Pragma Weak_External
8930 Syntax:
8932 @example
8933 pragma Weak_External ([Entity =>] LOCAL_NAME);
8934 @end example
8936 @code{LOCAL_NAME} must refer to an object that is declared at the library
8937 level. This pragma specifies that the given entity should be marked as a
8938 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
8939 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
8940 of a regular symbol, that is to say a symbol that does not have to be
8941 resolved by the linker if used in conjunction with a pragma Import.
8943 When a weak symbol is not resolved by the linker, its address is set to
8944 zero. This is useful in writing interfaces to external modules that may
8945 or may not be linked in the final executable, for example depending on
8946 configuration settings.
8948 If a program references at run time an entity to which this pragma has been
8949 applied, and the corresponding symbol was not resolved at link time, then
8950 the execution of the program is erroneous. It is not erroneous to take the
8951 Address of such an entity, for example to guard potential references,
8952 as shown in the example below.
8954 Some file formats do not support weak symbols so not all target machines
8955 support this pragma.
8957 @example
8958 --  Example of the use of pragma Weak_External
8960 package External_Module is
8961   key : Integer;
8962   pragma Import (C, key);
8963   pragma Weak_External (key);
8964   function Present return boolean;
8965 end External_Module;
8967 with System; use System;
8968 package body External_Module is
8969   function Present return boolean is
8970   begin
8971     return key'Address /= System.Null_Address;
8972   end Present;
8973 end External_Module;
8974 @end example
8976 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
8977 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{11d}
8978 @section Pragma Wide_Character_Encoding
8981 Syntax:
8983 @example
8984 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
8985 @end example
8987 This pragma specifies the wide character encoding to be used in program
8988 source text appearing subsequently. It is a configuration pragma, but may
8989 also be used at any point that a pragma is allowed, and it is permissible
8990 to have more than one such pragma in a file, allowing multiple encodings
8991 to appear within the same file.
8993 However, note that the pragma cannot immediately precede the relevant
8994 wide character, because then the previous encoding will still be in
8995 effect, causing "illegal character" errors.
8997 The argument can be an identifier or a character literal. In the identifier
8998 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
8999 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9000 case it is correspondingly one of the characters @code{h}, @code{u},
9001 @code{s}, @code{e}, @code{8}, or @code{b}.
9003 Note that when the pragma is used within a file, it affects only the
9004 encoding within that file, and does not affect withed units, specs,
9005 or subunits.
9007 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9008 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{11e}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{11f}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{120}
9009 @chapter Implementation Defined Aspects
9012 Ada defines (throughout the Ada 2012 reference manual, summarized
9013 in Annex K) a set of aspects that can be specified for certain entities.
9014 These language defined aspects are implemented in GNAT in Ada 2012 mode
9015 and work as described in the Ada 2012 Reference Manual.
9017 In addition, Ada 2012 allows implementations to define additional aspects
9018 whose meaning is defined by the implementation.  GNAT provides
9019 a number of these implementation-defined aspects which can be used
9020 to extend and enhance the functionality of the compiler.  This section of
9021 the GNAT reference manual describes these additional aspects.
9023 Note that any program using these aspects may not be portable to
9024 other compilers (although GNAT implements this set of aspects on all
9025 platforms).  Therefore if portability to other compilers is an important
9026 consideration, you should minimize the use of these aspects.
9028 Note that for many of these aspects, the effect is essentially similar
9029 to the use of a pragma or attribute specification with the same name
9030 applied to the entity. For example, if we write:
9032 @example
9033 type R is range 1 .. 100
9034   with Value_Size => 10;
9035 @end example
9037 then the effect is the same as:
9039 @example
9040 type R is range 1 .. 100;
9041 for R'Value_Size use 10;
9042 @end example
9044 and if we write:
9046 @example
9047 type R is new Integer
9048   with Shared => True;
9049 @end example
9051 then the effect is the same as:
9053 @example
9054 type R is new Integer;
9055 pragma Shared (R);
9056 @end example
9058 In the documentation below, such cases are simply marked
9059 as being boolean aspects equivalent to the corresponding pragma
9060 or attribute definition clause.
9062 @menu
9063 * Aspect Abstract_State:: 
9064 * Aspect Annotate:: 
9065 * Aspect Async_Readers:: 
9066 * Aspect Async_Writers:: 
9067 * Aspect Constant_After_Elaboration:: 
9068 * Aspect Contract_Cases:: 
9069 * Aspect Depends:: 
9070 * Aspect Default_Initial_Condition:: 
9071 * Aspect Dimension:: 
9072 * Aspect Dimension_System:: 
9073 * Aspect Disable_Controlled:: 
9074 * Aspect Effective_Reads:: 
9075 * Aspect Effective_Writes:: 
9076 * Aspect Extensions_Visible:: 
9077 * Aspect Favor_Top_Level:: 
9078 * Aspect Ghost:: 
9079 * Aspect Global:: 
9080 * Aspect Initial_Condition:: 
9081 * Aspect Initializes:: 
9082 * Aspect Inline_Always:: 
9083 * Aspect Invariant:: 
9084 * Aspect Invariant'Class:: 
9085 * Aspect Iterable:: 
9086 * Aspect Linker_Section:: 
9087 * Aspect Lock_Free:: 
9088 * Aspect Max_Queue_Length:: 
9089 * Aspect No_Elaboration_Code_All:: 
9090 * Aspect No_Inline:: 
9091 * Aspect No_Tagged_Streams:: 
9092 * Aspect Object_Size:: 
9093 * Aspect Obsolescent:: 
9094 * Aspect Part_Of:: 
9095 * Aspect Persistent_BSS:: 
9096 * Aspect Predicate:: 
9097 * Aspect Pure_Function:: 
9098 * Aspect Refined_Depends:: 
9099 * Aspect Refined_Global:: 
9100 * Aspect Refined_Post:: 
9101 * Aspect Refined_State:: 
9102 * Aspect Remote_Access_Type:: 
9103 * Aspect Secondary_Stack_Size:: 
9104 * Aspect Scalar_Storage_Order:: 
9105 * Aspect Shared:: 
9106 * Aspect Simple_Storage_Pool:: 
9107 * Aspect Simple_Storage_Pool_Type:: 
9108 * Aspect SPARK_Mode:: 
9109 * Aspect Suppress_Debug_Info:: 
9110 * Aspect Suppress_Initialization:: 
9111 * Aspect Test_Case:: 
9112 * Aspect Thread_Local_Storage:: 
9113 * Aspect Universal_Aliasing:: 
9114 * Aspect Universal_Data:: 
9115 * Aspect Unmodified:: 
9116 * Aspect Unreferenced:: 
9117 * Aspect Unreferenced_Objects:: 
9118 * Aspect Value_Size:: 
9119 * Aspect Volatile_Full_Access:: 
9120 * Aspect Volatile_Function:: 
9121 * Aspect Warnings:: 
9123 @end menu
9125 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9126 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{121}
9127 @section Aspect Abstract_State
9130 @geindex Abstract_State
9132 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
9134 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9135 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{122}
9136 @section Aspect Annotate
9139 @geindex Annotate
9141 There are three forms of this aspect (where ID is an identifier,
9142 and ARG is a general expression),
9143 corresponding to @ref{25,,pragma Annotate}.
9146 @table @asis
9148 @item @emph{Annotate => ID}
9150 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9152 @item @emph{Annotate => (ID)}
9154 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9156 @item @emph{Annotate => (ID ,ID @{, ARG@})}
9158 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9159 @end table
9161 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9162 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{123}
9163 @section Aspect Async_Readers
9166 @geindex Async_Readers
9168 This boolean aspect is equivalent to @ref{2c,,pragma Async_Readers}.
9170 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9171 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{124}
9172 @section Aspect Async_Writers
9175 @geindex Async_Writers
9177 This boolean aspect is equivalent to @ref{2f,,pragma Async_Writers}.
9179 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9180 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{125}
9181 @section Aspect Constant_After_Elaboration
9184 @geindex Constant_After_Elaboration
9186 This aspect is equivalent to @ref{40,,pragma Constant_After_Elaboration}.
9188 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9189 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{126}
9190 @section Aspect Contract_Cases
9193 @geindex Contract_Cases
9195 This aspect is equivalent to @ref{42,,pragma Contract_Cases}, the sequence
9196 of clauses being enclosed in parentheses so that syntactically it is an
9197 aggregate.
9199 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9200 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{127}
9201 @section Aspect Depends
9204 @geindex Depends
9206 This aspect is equivalent to @ref{51,,pragma Depends}.
9208 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9209 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{128}
9210 @section Aspect Default_Initial_Condition
9213 @geindex Default_Initial_Condition
9215 This aspect is equivalent to @ref{4c,,pragma Default_Initial_Condition}.
9217 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9218 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{129}
9219 @section Aspect Dimension
9222 @geindex Dimension
9224 The @code{Dimension} aspect is used to specify the dimensions of a given
9225 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9226 used when doing formatted output of dimensioned quantities. The syntax is:
9228 @example
9229 with Dimension =>
9230   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9232 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9234 DIMENSION_VALUE ::=
9235   RATIONAL
9236 | others               => RATIONAL
9237 | DISCRETE_CHOICE_LIST => RATIONAL
9239 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9240 @end example
9242 This aspect can only be applied to a subtype whose parent type has
9243 a @code{Dimension_System} aspect. The aspect must specify values for
9244 all dimensions of the system. The rational values are the powers of the
9245 corresponding dimensions that are used by the compiler to verify that
9246 physical (numeric) computations are dimensionally consistent. For example,
9247 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9248 For further examples of the usage
9249 of this aspect, see package @code{System.Dim.Mks}.
9250 Note that when the dimensioned type is an integer type, then any
9251 dimension value must be an integer literal.
9253 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9254 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12a}
9255 @section Aspect Dimension_System
9258 @geindex Dimension_System
9260 The @code{Dimension_System} aspect is used to define a system of
9261 dimensions that will be used in subsequent subtype declarations with
9262 @code{Dimension} aspects that reference this system. The syntax is:
9264 @example
9265 with Dimension_System => (DIMENSION @{, DIMENSION@});
9267 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
9268                [Unit_Symbol =>] SYMBOL,
9269                [Dim_Symbol  =>] SYMBOL)
9271 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9272 @end example
9274 This aspect is applied to a type, which must be a numeric derived type
9275 (typically a floating-point type), that
9276 will represent values within the dimension system. Each @code{DIMENSION}
9277 corresponds to one particular dimension. A maximum of 7 dimensions may
9278 be specified. @code{Unit_Name} is the name of the dimension (for example
9279 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9280 of this dimension (for example @code{m} for @code{Meter}).
9281 @code{Dim_Symbol} gives
9282 the identification within the dimension system (typically this is a
9283 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9284 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9285 The @code{Dim_Symbol} is used in error messages when numeric operations have
9286 inconsistent dimensions.
9288 GNAT provides the standard definition of the International MKS system in
9289 the run-time package @code{System.Dim.Mks}. You can easily define
9290 similar packages for cgs units or British units, and define conversion factors
9291 between values in different systems. The MKS system is characterized by the
9292 following aspect:
9294 @example
9295 type Mks_Type is new Long_Long_Float with
9296   Dimension_System => (
9297     (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
9298     (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
9299     (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
9300     (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
9301     (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => '@@'),
9302     (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
9303     (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
9304 @end example
9306 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9307 represent a theta character (avoiding the use of extended Latin-1
9308 characters in this context).
9310 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
9311 Guide for detailed examples of use of the dimension system.
9313 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9314 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12b}
9315 @section Aspect Disable_Controlled
9318 @geindex Disable_Controlled
9320 The aspect  @code{Disable_Controlled} is defined for controlled record types. If
9321 active, this aspect causes suppression of all related calls to @code{Initialize},
9322 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9323 where for example you might want a record to be controlled or not depending on
9324 whether some run-time check is enabled or suppressed.
9326 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9327 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{12c}
9328 @section Aspect Effective_Reads
9331 @geindex Effective_Reads
9333 This aspect is equivalent to @ref{57,,pragma Effective_Reads}.
9335 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9336 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{12d}
9337 @section Aspect Effective_Writes
9340 @geindex Effective_Writes
9342 This aspect is equivalent to @ref{59,,pragma Effective_Writes}.
9344 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9345 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{12e}
9346 @section Aspect Extensions_Visible
9349 @geindex Extensions_Visible
9351 This aspect is equivalent to @ref{65,,pragma Extensions_Visible}.
9353 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9354 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{12f}
9355 @section Aspect Favor_Top_Level
9358 @geindex Favor_Top_Level
9360 This boolean aspect is equivalent to @ref{6a,,pragma Favor_Top_Level}.
9362 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9363 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{130}
9364 @section Aspect Ghost
9367 @geindex Ghost
9369 This aspect is equivalent to @ref{6d,,pragma Ghost}.
9371 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9372 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{131}
9373 @section Aspect Global
9376 @geindex Global
9378 This aspect is equivalent to @ref{6f,,pragma Global}.
9380 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9381 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{132}
9382 @section Aspect Initial_Condition
9385 @geindex Initial_Condition
9387 This aspect is equivalent to @ref{7d,,pragma Initial_Condition}.
9389 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9390 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{133}
9391 @section Aspect Initializes
9394 @geindex Initializes
9396 This aspect is equivalent to @ref{7f,,pragma Initializes}.
9398 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9399 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{134}
9400 @section Aspect Inline_Always
9403 @geindex Inline_Always
9405 This boolean aspect is equivalent to @ref{82,,pragma Inline_Always}.
9407 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9408 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{135}
9409 @section Aspect Invariant
9412 @geindex Invariant
9414 This aspect is equivalent to @ref{89,,pragma Invariant}. It is a
9415 synonym for the language defined aspect @code{Type_Invariant} except
9416 that it is separately controllable using pragma @code{Assertion_Policy}.
9418 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9419 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{136}
9420 @section Aspect Invariant'Class
9423 @geindex Invariant'Class
9425 This aspect is equivalent to @ref{100,,pragma Type_Invariant_Class}. It is a
9426 synonym for the language defined aspect @code{Type_Invariant'Class} except
9427 that it is separately controllable using pragma @code{Assertion_Policy}.
9429 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9430 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{137}
9431 @section Aspect Iterable
9434 @geindex Iterable
9436 This aspect provides a light-weight mechanism for loops and quantified
9437 expressions over container types, without the overhead imposed by the tampering
9438 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9439 with six named components, of which the last three are optional: @code{First},
9440 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9441 When only the first three components are specified, only the
9442 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9443 is specified, both this form and the @code{for .. of} form of iteration over
9444 elements are available. If the last two components are specified, reverse
9445 iterations over the container can be specified (analogous to what can be done
9446 over predefined containers that support the @code{Reverse_Iterator} interface).
9447 The following is a typical example of use:
9449 @example
9450 type List is private with
9451     Iterable => (First        => First_Cursor,
9452                  Next         => Advance,
9453                  Has_Element  => Cursor_Has_Element,
9454                 [Element      => Get_Element]);
9455 @end example
9458 @itemize *
9460 @item 
9461 The value denoted by @code{First} must denote a primitive operation of the
9462 container type that returns a @code{Cursor}, which must a be a type declared in
9463 the container package or visible from it. For example:
9464 @end itemize
9466 @example
9467 function First_Cursor (Cont : Container) return Cursor;
9468 @end example
9471 @itemize *
9473 @item 
9474 The value of @code{Next} is a primitive operation of the container type that takes
9475 both a container and a cursor and yields a cursor. For example:
9476 @end itemize
9478 @example
9479 function Advance (Cont : Container; Position : Cursor) return Cursor;
9480 @end example
9483 @itemize *
9485 @item 
9486 The value of @code{Has_Element} is a primitive operation of the container type
9487 that takes both a container and a cursor and yields a boolean. For example:
9488 @end itemize
9490 @example
9491 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9492 @end example
9495 @itemize *
9497 @item 
9498 The value of @code{Element} is a primitive operation of the container type that
9499 takes both a container and a cursor and yields an @code{Element_Type}, which must
9500 be a type declared in the container package or visible from it. For example:
9501 @end itemize
9503 @example
9504 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9505 @end example
9507 This aspect is used in the GNAT-defined formal container packages.
9509 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9510 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{138}
9511 @section Aspect Linker_Section
9514 @geindex Linker_Section
9516 This aspect is equivalent to @ref{91,,pragma Linker_Section}.
9518 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9519 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{139}
9520 @section Aspect Lock_Free
9523 @geindex Lock_Free
9525 This boolean aspect is equivalent to @ref{93,,pragma Lock_Free}.
9527 @node Aspect Max_Queue_Length,Aspect No_Elaboration_Code_All,Aspect Lock_Free,Implementation Defined Aspects
9528 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13a}
9529 @section Aspect Max_Queue_Length
9532 @geindex Max_Queue_Length
9534 This aspect is equivalent to @ref{9b,,pragma Max_Queue_Length}.
9536 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect Max_Queue_Length,Implementation Defined Aspects
9537 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{13b}
9538 @section Aspect No_Elaboration_Code_All
9541 @geindex No_Elaboration_Code_All
9543 This aspect is equivalent to @ref{9f,,pragma No_Elaboration_Code_All}
9544 for a program unit.
9546 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9547 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{13c}
9548 @section Aspect No_Inline
9551 @geindex No_Inline
9553 This boolean aspect is equivalent to @ref{a2,,pragma No_Inline}.
9555 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Inline,Implementation Defined Aspects
9556 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{13d}
9557 @section Aspect No_Tagged_Streams
9560 @geindex No_Tagged_Streams
9562 This aspect is equivalent to @ref{a6,,pragma No_Tagged_Streams} with an
9563 argument specifying a root tagged type (thus this aspect can only be
9564 applied to such a type).
9566 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9567 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{13e}
9568 @section Aspect Object_Size
9571 @geindex Object_Size
9573 This aspect is equivalent to @ref{13f,,attribute Object_Size}.
9575 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9576 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{140}
9577 @section Aspect Obsolescent
9580 @geindex Obsolsecent
9582 This aspect is equivalent to @ref{a9,,pragma Obsolescent}. Note that the
9583 evaluation of this aspect happens at the point of occurrence, it is not
9584 delayed until the freeze point.
9586 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9587 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{141}
9588 @section Aspect Part_Of
9591 @geindex Part_Of
9593 This aspect is equivalent to @ref{b1,,pragma Part_Of}.
9595 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9596 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{142}
9597 @section Aspect Persistent_BSS
9600 @geindex Persistent_BSS
9602 This boolean aspect is equivalent to @ref{b4,,pragma Persistent_BSS}.
9604 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9605 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{143}
9606 @section Aspect Predicate
9609 @geindex Predicate
9611 This aspect is equivalent to @ref{bd,,pragma Predicate}. It is thus
9612 similar to the language defined aspects @code{Dynamic_Predicate}
9613 and @code{Static_Predicate} except that whether the resulting
9614 predicate is static or dynamic is controlled by the form of the
9615 expression. It is also separately controllable using pragma
9616 @code{Assertion_Policy}.
9618 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9619 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{144}
9620 @section Aspect Pure_Function
9623 @geindex Pure_Function
9625 This boolean aspect is equivalent to @ref{c8,,pragma Pure_Function}.
9627 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9628 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{145}
9629 @section Aspect Refined_Depends
9632 @geindex Refined_Depends
9634 This aspect is equivalent to @ref{cc,,pragma Refined_Depends}.
9636 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9637 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{146}
9638 @section Aspect Refined_Global
9641 @geindex Refined_Global
9643 This aspect is equivalent to @ref{ce,,pragma Refined_Global}.
9645 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9646 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{147}
9647 @section Aspect Refined_Post
9650 @geindex Refined_Post
9652 This aspect is equivalent to @ref{d0,,pragma Refined_Post}.
9654 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9655 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{148}
9656 @section Aspect Refined_State
9659 @geindex Refined_State
9661 This aspect is equivalent to @ref{d2,,pragma Refined_State}.
9663 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Refined_State,Implementation Defined Aspects
9664 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{149}
9665 @section Aspect Remote_Access_Type
9668 @geindex Remote_Access_Type
9670 This aspect is equivalent to @ref{d6,,pragma Remote_Access_Type}.
9672 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9673 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{14a}
9674 @section Aspect Secondary_Stack_Size
9677 @geindex Secondary_Stack_Size
9679 This aspect is equivalent to @ref{db,,pragma Secondary_Stack_Size}.
9681 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9682 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{14b}
9683 @section Aspect Scalar_Storage_Order
9686 @geindex Scalar_Storage_Order
9688 This aspect is equivalent to a @ref{14c,,attribute Scalar_Storage_Order}.
9690 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9691 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{14d}
9692 @section Aspect Shared
9695 @geindex Shared
9697 This boolean aspect is equivalent to @ref{de,,pragma Shared}
9698 and is thus a synonym for aspect @code{Atomic}.
9700 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9701 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{14e}
9702 @section Aspect Simple_Storage_Pool
9705 @geindex Simple_Storage_Pool
9707 This aspect is equivalent to @ref{e3,,attribute Simple_Storage_Pool}.
9709 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9710 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{14f}
9711 @section Aspect Simple_Storage_Pool_Type
9714 @geindex Simple_Storage_Pool_Type
9716 This boolean aspect is equivalent to @ref{e1,,pragma Simple_Storage_Pool_Type}.
9718 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9719 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{150}
9720 @section Aspect SPARK_Mode
9723 @geindex SPARK_Mode
9725 This aspect is equivalent to @ref{e9,,pragma SPARK_Mode} and
9726 may be specified for either or both of the specification and body
9727 of a subprogram or package.
9729 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9730 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{151}
9731 @section Aspect Suppress_Debug_Info
9734 @geindex Suppress_Debug_Info
9736 This boolean aspect is equivalent to @ref{f1,,pragma Suppress_Debug_Info}.
9738 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9739 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{152}
9740 @section Aspect Suppress_Initialization
9743 @geindex Suppress_Initialization
9745 This boolean aspect is equivalent to @ref{f5,,pragma Suppress_Initialization}.
9747 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9748 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{153}
9749 @section Aspect Test_Case
9752 @geindex Test_Case
9754 This aspect is equivalent to @ref{f8,,pragma Test_Case}.
9756 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9757 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{154}
9758 @section Aspect Thread_Local_Storage
9761 @geindex Thread_Local_Storage
9763 This boolean aspect is equivalent to @ref{fa,,pragma Thread_Local_Storage}.
9765 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
9766 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{155}
9767 @section Aspect Universal_Aliasing
9770 @geindex Universal_Aliasing
9772 This boolean aspect is equivalent to @ref{105,,pragma Universal_Aliasing}.
9774 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
9775 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{156}
9776 @section Aspect Universal_Data
9779 @geindex Universal_Data
9781 This aspect is equivalent to @ref{106,,pragma Universal_Data}.
9783 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
9784 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{157}
9785 @section Aspect Unmodified
9788 @geindex Unmodified
9790 This boolean aspect is equivalent to @ref{108,,pragma Unmodified}.
9792 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
9793 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{158}
9794 @section Aspect Unreferenced
9797 @geindex Unreferenced
9799 This boolean aspect is equivalent to @ref{10a,,pragma Unreferenced}. Note that
9800 in the case of formal parameters, it is not permitted to have aspects for
9801 a formal parameter, so in this case the pragma form must be used.
9803 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
9804 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{159}
9805 @section Aspect Unreferenced_Objects
9808 @geindex Unreferenced_Objects
9810 This boolean aspect is equivalent to @ref{10c,,pragma Unreferenced_Objects}.
9812 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
9813 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{15a}
9814 @section Aspect Value_Size
9817 @geindex Value_Size
9819 This aspect is equivalent to @ref{15b,,attribute Value_Size}.
9821 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
9822 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{15c}
9823 @section Aspect Volatile_Full_Access
9826 @geindex Volatile_Full_Access
9828 This boolean aspect is equivalent to @ref{115,,pragma Volatile_Full_Access}.
9830 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
9831 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{15d}
9832 @section Aspect Volatile_Function
9835 @geindex Volatile_Function
9837 This boolean aspect is equivalent to @ref{118,,pragma Volatile_Function}.
9839 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
9840 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{15e}
9841 @section Aspect Warnings
9844 @geindex Warnings
9846 This aspect is equivalent to the two argument form of @ref{11a,,pragma Warnings},
9847 where the first argument is @code{ON} or @code{OFF} and the second argument
9848 is the entity.
9850 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
9851 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{15f}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{160}
9852 @chapter Implementation Defined Attributes
9855 Ada defines (throughout the Ada reference manual,
9856 summarized in Annex K),
9857 a set of attributes that provide useful additional functionality in all
9858 areas of the language.  These language defined attributes are implemented
9859 in GNAT and work as described in the Ada Reference Manual.
9861 In addition, Ada allows implementations to define additional
9862 attributes whose meaning is defined by the implementation.  GNAT provides
9863 a number of these implementation-dependent attributes which can be used
9864 to extend and enhance the functionality of the compiler.  This section of
9865 the GNAT reference manual describes these additional attributes.  It also
9866 describes additional implementation-dependent features of standard
9867 language-defined attributes.
9869 Note that any program using these attributes may not be portable to
9870 other compilers (although GNAT implements this set of attributes on all
9871 platforms).  Therefore if portability to other compilers is an important
9872 consideration, you should minimize the use of these attributes.
9874 @menu
9875 * Attribute Abort_Signal:: 
9876 * Attribute Address_Size:: 
9877 * Attribute Asm_Input:: 
9878 * Attribute Asm_Output:: 
9879 * Attribute Atomic_Always_Lock_Free:: 
9880 * Attribute Bit:: 
9881 * Attribute Bit_Position:: 
9882 * Attribute Code_Address:: 
9883 * Attribute Compiler_Version:: 
9884 * Attribute Constrained:: 
9885 * Attribute Default_Bit_Order:: 
9886 * Attribute Default_Scalar_Storage_Order:: 
9887 * Attribute Deref:: 
9888 * Attribute Descriptor_Size:: 
9889 * Attribute Elaborated:: 
9890 * Attribute Elab_Body:: 
9891 * Attribute Elab_Spec:: 
9892 * Attribute Elab_Subp_Body:: 
9893 * Attribute Emax:: 
9894 * Attribute Enabled:: 
9895 * Attribute Enum_Rep:: 
9896 * Attribute Enum_Val:: 
9897 * Attribute Epsilon:: 
9898 * Attribute Fast_Math:: 
9899 * Attribute Finalization_Size:: 
9900 * Attribute Fixed_Value:: 
9901 * Attribute From_Any:: 
9902 * Attribute Has_Access_Values:: 
9903 * Attribute Has_Discriminants:: 
9904 * Attribute Img:: 
9905 * Attribute Integer_Value:: 
9906 * Attribute Invalid_Value:: 
9907 * Attribute Iterable:: 
9908 * Attribute Large:: 
9909 * Attribute Library_Level:: 
9910 * Attribute Lock_Free:: 
9911 * Attribute Loop_Entry:: 
9912 * Attribute Machine_Size:: 
9913 * Attribute Mantissa:: 
9914 * Attribute Maximum_Alignment:: 
9915 * Attribute Mechanism_Code:: 
9916 * Attribute Null_Parameter:: 
9917 * Attribute Object_Size:: 
9918 * Attribute Old:: 
9919 * Attribute Passed_By_Reference:: 
9920 * Attribute Pool_Address:: 
9921 * Attribute Range_Length:: 
9922 * Attribute Restriction_Set:: 
9923 * Attribute Result:: 
9924 * Attribute Safe_Emax:: 
9925 * Attribute Safe_Large:: 
9926 * Attribute Safe_Small:: 
9927 * Attribute Scalar_Storage_Order:: 
9928 * Attribute Simple_Storage_Pool:: 
9929 * Attribute Small:: 
9930 * Attribute Storage_Unit:: 
9931 * Attribute Stub_Type:: 
9932 * Attribute System_Allocator_Alignment:: 
9933 * Attribute Target_Name:: 
9934 * Attribute To_Address:: 
9935 * Attribute To_Any:: 
9936 * Attribute Type_Class:: 
9937 * Attribute Type_Key:: 
9938 * Attribute TypeCode:: 
9939 * Attribute Unconstrained_Array:: 
9940 * Attribute Universal_Literal_String:: 
9941 * Attribute Unrestricted_Access:: 
9942 * Attribute Update:: 
9943 * Attribute Valid_Scalars:: 
9944 * Attribute VADS_Size:: 
9945 * Attribute Value_Size:: 
9946 * Attribute Wchar_T_Size:: 
9947 * Attribute Word_Size:: 
9949 @end menu
9951 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
9952 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{161}
9953 @section Attribute Abort_Signal
9956 @geindex Abort_Signal
9958 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
9959 prefix) provides the entity for the special exception used to signal
9960 task abort or asynchronous transfer of control.  Normally this attribute
9961 should only be used in the tasking runtime (it is highly peculiar, and
9962 completely outside the normal semantics of Ada, for a user program to
9963 intercept the abort exception).
9965 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
9966 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{162}
9967 @section Attribute Address_Size
9970 @geindex Size of `@w{`}Address`@w{`}
9972 @geindex Address_Size
9974 @code{Standard'Address_Size} (@code{Standard} is the only allowed
9975 prefix) is a static constant giving the number of bits in an
9976 @code{Address}. It is the same value as System.Address'Size,
9977 but has the advantage of being static, while a direct
9978 reference to System.Address'Size is nonstatic because Address
9979 is a private type.
9981 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
9982 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{163}
9983 @section Attribute Asm_Input
9986 @geindex Asm_Input
9988 The @code{Asm_Input} attribute denotes a function that takes two
9989 parameters.  The first is a string, the second is an expression of the
9990 type designated by the prefix.  The first (string) argument is required
9991 to be a static expression, and is the constraint for the parameter,
9992 (e.g., what kind of register is required).  The second argument is the
9993 value to be used as the input argument.  The possible values for the
9994 constant are the same as those used in the RTL, and are dependent on
9995 the configuration file used to built the GCC back end.
9996 @ref{164,,Machine Code Insertions}
9998 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
9999 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{165}
10000 @section Attribute Asm_Output
10003 @geindex Asm_Output
10005 The @code{Asm_Output} attribute denotes a function that takes two
10006 parameters.  The first is a string, the second is the name of a variable
10007 of the type designated by the attribute prefix.  The first (string)
10008 argument is required to be a static expression and designates the
10009 constraint for the parameter (e.g., what kind of register is
10010 required).  The second argument is the variable to be updated with the
10011 result.  The possible values for constraint are the same as those used in
10012 the RTL, and are dependent on the configuration file used to build the
10013 GCC back end.  If there are no output operands, then this argument may
10014 either be omitted, or explicitly given as @code{No_Output_Operands}.
10015 @ref{164,,Machine Code Insertions}
10017 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10018 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{166}
10019 @section Attribute Atomic_Always_Lock_Free
10022 @geindex Atomic_Always_Lock_Free
10024 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10025 The result is a Boolean value which is True if the type has discriminants,
10026 and False otherwise.  The result indicate whether atomic operations are
10027 supported by the target for the given type.
10029 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10030 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{167}
10031 @section Attribute Bit
10034 @geindex Bit
10036 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10037 offset within the storage unit (byte) that contains the first bit of
10038 storage allocated for the object.  The value of this attribute is of the
10039 type @emph{universal_integer}, and is always a non-negative number not
10040 exceeding the value of @code{System.Storage_Unit}.
10042 For an object that is a variable or a constant allocated in a register,
10043 the value is zero.  (The use of this attribute does not force the
10044 allocation of a variable to memory).
10046 For an object that is a formal parameter, this attribute applies
10047 to either the matching actual parameter or to a copy of the
10048 matching actual parameter.
10050 For an access object the value is zero.  Note that
10051 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10052 designated object.  Similarly for a record component
10053 @code{X.C'Bit} is subject to a discriminant check and
10054 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10055 are subject to index checks.
10057 This attribute is designed to be compatible with the DEC Ada 83 definition
10058 and implementation of the @code{Bit} attribute.
10060 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10061 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{168}
10062 @section Attribute Bit_Position
10065 @geindex Bit_Position
10067 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10068 of the fields of the record type, yields the bit
10069 offset within the record contains the first bit of
10070 storage allocated for the object.  The value of this attribute is of the
10071 type @emph{universal_integer}.  The value depends only on the field
10072 @code{C} and is independent of the alignment of
10073 the containing record @code{R}.
10075 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10076 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{169}
10077 @section Attribute Code_Address
10080 @geindex Code_Address
10082 @geindex Subprogram address
10084 @geindex Address of subprogram code
10086 The @code{'Address}
10087 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10088 intended effect seems to be to provide
10089 an address value which can be used to call the subprogram by means of
10090 an address clause as in the following example:
10092 @example
10093 procedure K is ...
10095 procedure L;
10096 for L'Address use K'Address;
10097 pragma Import (Ada, L);
10098 @end example
10100 A call to @code{L} is then expected to result in a call to @code{K}.
10101 In Ada 83, where there were no access-to-subprogram values, this was
10102 a common work-around for getting the effect of an indirect call.
10103 GNAT implements the above use of @code{Address} and the technique
10104 illustrated by the example code works correctly.
10106 However, for some purposes, it is useful to have the address of the start
10107 of the generated code for the subprogram.  On some architectures, this is
10108 not necessarily the same as the @code{Address} value described above.
10109 For example, the @code{Address} value may reference a subprogram
10110 descriptor rather than the subprogram itself.
10112 The @code{'Code_Address} attribute, which can only be applied to
10113 subprogram entities, always returns the address of the start of the
10114 generated code of the specified subprogram, which may or may not be
10115 the same value as is returned by the corresponding @code{'Address}
10116 attribute.
10118 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10119 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{16a}
10120 @section Attribute Compiler_Version
10123 @geindex Compiler_Version
10125 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10126 prefix) yields a static string identifying the version of the compiler
10127 being used to compile the unit containing the attribute reference.
10129 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10130 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{16b}
10131 @section Attribute Constrained
10134 @geindex Constrained
10136 In addition to the usage of this attribute in the Ada RM, GNAT
10137 also permits the use of the @code{'Constrained} attribute
10138 in a generic template
10139 for any type, including types without discriminants. The value of this
10140 attribute in the generic instance when applied to a scalar type or a
10141 record type without discriminants is always @code{True}. This usage is
10142 compatible with older Ada compilers, including notably DEC Ada.
10144 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10145 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{16c}
10146 @section Attribute Default_Bit_Order
10149 @geindex Big endian
10151 @geindex Little endian
10153 @geindex Default_Bit_Order
10155 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10156 permissible prefix), provides the value @code{System.Default_Bit_Order}
10157 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10158 @code{Low_Order_First}).  This is used to construct the definition of
10159 @code{Default_Bit_Order} in package @code{System}.
10161 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10162 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{16d}
10163 @section Attribute Default_Scalar_Storage_Order
10166 @geindex Big endian
10168 @geindex Little endian
10170 @geindex Default_Scalar_Storage_Order
10172 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10173 permissible prefix), provides the current value of the default scalar storage
10174 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10175 equal to @code{Default_Bit_Order} if unspecified) as a
10176 @code{System.Bit_Order} value. This is a static attribute.
10178 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10179 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{16e}
10180 @section Attribute Deref
10183 @geindex Deref
10185 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10186 the variable of type @code{typ} that is located at the given address. It is similar
10187 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10188 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10189 used on the left side of an assignment.
10191 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10192 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{16f}
10193 @section Attribute Descriptor_Size
10196 @geindex Descriptor
10198 @geindex Dope vector
10200 @geindex Descriptor_Size
10202 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10203 descriptor allocated for a type.  The result is non-zero only for unconstrained
10204 array types and the returned value is of type universal integer.  In GNAT, an
10205 array descriptor contains bounds information and is located immediately before
10206 the first element of the array.
10208 @example
10209 type Unconstr_Array is array (Positive range <>) of Boolean;
10210 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10211 @end example
10213 The attribute takes into account any additional padding due to type alignment.
10214 In the example above, the descriptor contains two values of type
10215 @code{Positive} representing the low and high bound.  Since @code{Positive} has
10216 a size of 31 bits and an alignment of 4, the descriptor size is @code{2 * Positive'Size + 2} or 64 bits.
10218 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10219 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{170}
10220 @section Attribute Elaborated
10223 @geindex Elaborated
10225 The prefix of the @code{'Elaborated} attribute must be a unit name.  The
10226 value is a Boolean which indicates whether or not the given unit has been
10227 elaborated.  This attribute is primarily intended for internal use by the
10228 generated code for dynamic elaboration checking, but it can also be used
10229 in user programs.  The value will always be True once elaboration of all
10230 units has been completed.  An exception is for units which need no
10231 elaboration, the value is always False for such units.
10233 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10234 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{171}
10235 @section Attribute Elab_Body
10238 @geindex Elab_Body
10240 This attribute can only be applied to a program unit name.  It returns
10241 the entity for the corresponding elaboration procedure for elaborating
10242 the body of the referenced unit.  This is used in the main generated
10243 elaboration procedure by the binder and is not normally used in any
10244 other context.  However, there may be specialized situations in which it
10245 is useful to be able to call this elaboration procedure from Ada code,
10246 e.g., if it is necessary to do selective re-elaboration to fix some
10247 error.
10249 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10250 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{172}
10251 @section Attribute Elab_Spec
10254 @geindex Elab_Spec
10256 This attribute can only be applied to a program unit name.  It returns
10257 the entity for the corresponding elaboration procedure for elaborating
10258 the spec of the referenced unit.  This is used in the main
10259 generated elaboration procedure by the binder and is not normally used
10260 in any other context.  However, there may be specialized situations in
10261 which it is useful to be able to call this elaboration procedure from
10262 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10263 some error.
10265 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10266 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{173}
10267 @section Attribute Elab_Subp_Body
10270 @geindex Elab_Subp_Body
10272 This attribute can only be applied to a library level subprogram
10273 name and is only allowed in CodePeer mode. It returns the entity
10274 for the corresponding elaboration procedure for elaborating the body
10275 of the referenced subprogram unit. This is used in the main generated
10276 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10277 otherwise.
10279 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10280 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{174}
10281 @section Attribute Emax
10284 @geindex Ada 83 attributes
10286 @geindex Emax
10288 The @code{Emax} attribute is provided for compatibility with Ada 83.  See
10289 the Ada 83 reference manual for an exact description of the semantics of
10290 this attribute.
10292 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10293 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{175}
10294 @section Attribute Enabled
10297 @geindex Enabled
10299 The @code{Enabled} attribute allows an application program to check at compile
10300 time to see if the designated check is currently enabled. The prefix is a
10301 simple identifier, referencing any predefined check name (other than
10302 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10303 no argument is given for the attribute, the check is for the general state
10304 of the check, if an argument is given, then it is an entity name, and the
10305 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10306 given naming the entity (if not, then the argument is ignored).
10308 Note that instantiations inherit the check status at the point of the
10309 instantiation, so a useful idiom is to have a library package that
10310 introduces a check name with @code{pragma Check_Name}, and then contains
10311 generic packages or subprograms which use the @code{Enabled} attribute
10312 to see if the check is enabled. A user of this package can then issue
10313 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10314 the package or subprogram, controlling whether the check will be present.
10316 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10317 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{176}
10318 @section Attribute Enum_Rep
10321 @geindex Representation of enums
10323 @geindex Enum_Rep
10325 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10326 function with the following spec:
10328 @example
10329 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10330 @end example
10332 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10333 enumeration type or to a non-overloaded enumeration
10334 literal.  In this case @code{S'Enum_Rep} is equivalent to
10335 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10336 enumeration literal or object.
10338 The function returns the representation value for the given enumeration
10339 value.  This will be equal to value of the @code{Pos} attribute in the
10340 absence of an enumeration representation clause.  This is a static
10341 attribute (i.e.,:the result is static if the argument is static).
10343 @code{S'Enum_Rep} can also be used with integer types and objects,
10344 in which case it simply returns the integer value.  The reason for this
10345 is to allow it to be used for @code{(<>)} discrete formal arguments in
10346 a generic unit that can be instantiated with either enumeration types
10347 or integer types.  Note that if @code{Enum_Rep} is used on a modular
10348 type whose upper bound exceeds the upper bound of the largest signed
10349 integer type, and the argument is a variable, so that the universal
10350 integer calculation is done at run time, then the call to @code{Enum_Rep}
10351 may raise @code{Constraint_Error}.
10353 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10354 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{177}
10355 @section Attribute Enum_Val
10358 @geindex Representation of enums
10360 @geindex Enum_Val
10362 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10363 function with the following spec:
10365 @example
10366 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10367 @end example
10369 The function returns the enumeration value whose representation matches the
10370 argument, or raises Constraint_Error if no enumeration literal of the type
10371 has the matching value.
10372 This will be equal to value of the @code{Val} attribute in the
10373 absence of an enumeration representation clause.  This is a static
10374 attribute (i.e., the result is static if the argument is static).
10376 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10377 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{178}
10378 @section Attribute Epsilon
10381 @geindex Ada 83 attributes
10383 @geindex Epsilon
10385 The @code{Epsilon} attribute is provided for compatibility with Ada 83.  See
10386 the Ada 83 reference manual for an exact description of the semantics of
10387 this attribute.
10389 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10390 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{179}
10391 @section Attribute Fast_Math
10394 @geindex Fast_Math
10396 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10397 prefix) yields a static Boolean value that is True if pragma
10398 @code{Fast_Math} is active, and False otherwise.
10400 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10401 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{17a}
10402 @section Attribute Finalization_Size
10405 @geindex Finalization_Size
10407 The prefix of attribute @code{Finalization_Size} must be an object or
10408 a non-class-wide type. This attribute returns the size of any hidden data
10409 reserved by the compiler to handle finalization-related actions. The type of
10410 the attribute is @emph{universal_integer}.
10412 @code{Finalization_Size} yields a value of zero for a type with no controlled
10413 parts, an object whose type has no controlled parts, or an object of a
10414 class-wide type whose tag denotes a type with no controlled parts.
10416 Note that only heap-allocated objects contain finalization data.
10418 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10419 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{17b}
10420 @section Attribute Fixed_Value
10423 @geindex Fixed_Value
10425 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10426 function with the following specification:
10428 @example
10429 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10430 @end example
10432 The value returned is the fixed-point value @code{V} such that:
10434 @example
10435 V = Arg * S'Small
10436 @end example
10438 The effect is thus similar to first converting the argument to the
10439 integer type used to represent @code{S}, and then doing an unchecked
10440 conversion to the fixed-point type.  The difference is
10441 that there are full range checks, to ensure that the result is in range.
10442 This attribute is primarily intended for use in implementation of the
10443 input-output functions for fixed-point values.
10445 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10446 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{17c}
10447 @section Attribute From_Any
10450 @geindex From_Any
10452 This internal attribute is used for the generation of remote subprogram
10453 stubs in the context of the Distributed Systems Annex.
10455 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10456 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{17d}
10457 @section Attribute Has_Access_Values
10460 @geindex Access values
10461 @geindex testing for
10463 @geindex Has_Access_Values
10465 The prefix of the @code{Has_Access_Values} attribute is a type.  The result
10466 is a Boolean value which is True if the is an access type, or is a composite
10467 type with a component (at any nesting depth) that is an access type, and is
10468 False otherwise.
10469 The intended use of this attribute is in conjunction with generic
10470 definitions.  If the attribute is applied to a generic private type, it
10471 indicates whether or not the corresponding actual type has access values.
10473 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10474 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{17e}
10475 @section Attribute Has_Discriminants
10478 @geindex Discriminants
10479 @geindex testing for
10481 @geindex Has_Discriminants
10483 The prefix of the @code{Has_Discriminants} attribute is a type.  The result
10484 is a Boolean value which is True if the type has discriminants, and False
10485 otherwise.  The intended use of this attribute is in conjunction with generic
10486 definitions.  If the attribute is applied to a generic private type, it
10487 indicates whether or not the corresponding actual type has discriminants.
10489 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10490 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{17f}
10491 @section Attribute Img
10494 @geindex Img
10496 The @code{Img} attribute differs from @code{Image} in that it is applied
10497 directly to an object, and yields the same result as
10498 @code{Image} for the subtype of the object.  This is convenient for
10499 debugging:
10501 @example
10502 Put_Line ("X = " & X'Img);
10503 @end example
10505 has the same meaning as the more verbose:
10507 @example
10508 Put_Line ("X = " & T'Image (X));
10509 @end example
10511 where @code{T} is the (sub)type of the object @code{X}.
10513 Note that technically, in analogy to @code{Image},
10514 @code{X'Img} returns a parameterless function
10515 that returns the appropriate string when called. This means that
10516 @code{X'Img} can be renamed as a function-returning-string, or used
10517 in an instantiation as a function parameter.
10519 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10520 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{180}
10521 @section Attribute Integer_Value
10524 @geindex Integer_Value
10526 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10527 function with the following spec:
10529 @example
10530 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10531 @end example
10533 The value returned is the integer value @code{V}, such that:
10535 @example
10536 Arg = V * T'Small
10537 @end example
10539 where @code{T} is the type of @code{Arg}.
10540 The effect is thus similar to first doing an unchecked conversion from
10541 the fixed-point type to its corresponding implementation type, and then
10542 converting the result to the target integer type.  The difference is
10543 that there are full range checks, to ensure that the result is in range.
10544 This attribute is primarily intended for use in implementation of the
10545 standard input-output functions for fixed-point values.
10547 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10548 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{181}
10549 @section Attribute Invalid_Value
10552 @geindex Invalid_Value
10554 For every scalar type S, S'Invalid_Value returns an undefined value of the
10555 type. If possible this value is an invalid representation for the type. The
10556 value returned is identical to the value used to initialize an otherwise
10557 uninitialized value of the type if pragma Initialize_Scalars is used,
10558 including the ability to modify the value with the binder -Sxx flag and
10559 relevant environment variables at run time.
10561 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10562 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{182}
10563 @section Attribute Iterable
10566 @geindex Iterable
10568 Equivalent to Aspect Iterable.
10570 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10571 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{183}
10572 @section Attribute Large
10575 @geindex Ada 83 attributes
10577 @geindex Large
10579 The @code{Large} attribute is provided for compatibility with Ada 83.  See
10580 the Ada 83 reference manual for an exact description of the semantics of
10581 this attribute.
10583 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10584 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{184}
10585 @section Attribute Library_Level
10588 @geindex Library_Level
10590 @code{P'Library_Level}, where P is an entity name,
10591 returns a Boolean value which is True if the entity is declared
10592 at the library level, and False otherwise. Note that within a
10593 generic instantition, the name of the generic unit denotes the
10594 instance, which means that this attribute can be used to test
10595 if a generic is instantiated at the library level, as shown
10596 in this example:
10598 @example
10599 generic
10600   ...
10601 package Gen is
10602   pragma Compile_Time_Error
10603     (not Gen'Library_Level,
10604      "Gen can only be instantiated at library level");
10605   ...
10606 end Gen;
10607 @end example
10609 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10610 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{185}
10611 @section Attribute Lock_Free
10614 @geindex Lock_Free
10616 @code{P'Lock_Free}, where P is a protected object, returns True if a
10617 pragma @code{Lock_Free} applies to P.
10619 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10620 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{186}
10621 @section Attribute Loop_Entry
10624 @geindex Loop_Entry
10626 Syntax:
10628 @example
10629 X'Loop_Entry [(loop_name)]
10630 @end example
10632 The @code{Loop_Entry} attribute is used to refer to the value that an
10633 expression had upon entry to a given loop in much the same way that the
10634 @code{Old} attribute in a subprogram postcondition can be used to refer
10635 to the value an expression had upon entry to the subprogram. The
10636 relevant loop is either identified by the given loop name, or it is the
10637 innermost enclosing loop when no loop name is given.
10639 A @code{Loop_Entry} attribute can only occur within a
10640 @code{Loop_Variant} or @code{Loop_Invariant} pragma. A common use of
10641 @code{Loop_Entry} is to compare the current value of objects with their
10642 initial value at loop entry, in a @code{Loop_Invariant} pragma.
10644 The effect of using @code{X'Loop_Entry} is the same as declaring
10645 a constant initialized with the initial value of @code{X} at loop
10646 entry. This copy is not performed if the loop is not entered, or if the
10647 corresponding pragmas are ignored or disabled.
10649 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10650 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{187}
10651 @section Attribute Machine_Size
10654 @geindex Machine_Size
10656 This attribute is identical to the @code{Object_Size} attribute.  It is
10657 provided for compatibility with the DEC Ada 83 attribute of this name.
10659 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10660 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{188}
10661 @section Attribute Mantissa
10664 @geindex Ada 83 attributes
10666 @geindex Mantissa
10668 The @code{Mantissa} attribute is provided for compatibility with Ada 83.  See
10669 the Ada 83 reference manual for an exact description of the semantics of
10670 this attribute.
10672 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10673 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{189}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{18a}
10674 @section Attribute Maximum_Alignment
10677 @geindex Alignment
10678 @geindex maximum
10680 @geindex Maximum_Alignment
10682 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
10683 permissible prefix) provides the maximum useful alignment value for the
10684 target.  This is a static value that can be used to specify the alignment
10685 for an object, guaranteeing that it is properly aligned in all
10686 cases.
10688 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10689 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{18b}
10690 @section Attribute Mechanism_Code
10693 @geindex Return values
10694 @geindex passing mechanism
10696 @geindex Parameters
10697 @geindex passing mechanism
10699 @geindex Mechanism_Code
10701 @code{func'Mechanism_Code} yields an integer code for the
10702 mechanism used for the result of function @code{func}, and
10703 @code{subprog'Mechanism_Code (n)} yields the mechanism
10704 used for formal parameter number @emph{n} (a static integer value, with 1
10705 meaning the first parameter) of subprogram @code{subprog}.  The code returned is:
10708 @table @asis
10710 @item @emph{1}
10712 by copy (value)
10714 @item @emph{2}
10716 by reference
10717 @end table
10719 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
10720 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{18c}
10721 @section Attribute Null_Parameter
10724 @geindex Zero address
10725 @geindex passing
10727 @geindex Null_Parameter
10729 A reference @code{T'Null_Parameter} denotes an imaginary object of
10730 type or subtype @code{T} allocated at machine address zero.  The attribute
10731 is allowed only as the default expression of a formal parameter, or as
10732 an actual expression of a subprogram call.  In either case, the
10733 subprogram must be imported.
10735 The identity of the object is represented by the address zero in the
10736 argument list, independent of the passing mechanism (explicit or
10737 default).
10739 This capability is needed to specify that a zero address should be
10740 passed for a record or other composite object passed by reference.
10741 There is no way of indicating this without the @code{Null_Parameter}
10742 attribute.
10744 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10745 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{13f}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{18d}
10746 @section Attribute Object_Size
10749 @geindex Size
10750 @geindex used for objects
10752 @geindex Object_Size
10754 The size of an object is not necessarily the same as the size of the type
10755 of an object.  This is because by default object sizes are increased to be
10756 a multiple of the alignment of the object.  For example,
10757 @code{Natural'Size} is
10758 31, but by default objects of type @code{Natural} will have a size of 32 bits.
10759 Similarly, a record containing an integer and a character:
10761 @example
10762 type Rec is record
10763    I : Integer;
10764    C : Character;
10765 end record;
10766 @end example
10768 will have a size of 40 (that is @code{Rec'Size} will be 40).  The
10769 alignment will be 4, because of the
10770 integer field, and so the default size of record objects for this type
10771 will be 64 (8 bytes).
10773 If the alignment of the above record is specified to be 1, then the
10774 object size will be 40 (5 bytes). This is true by default, and also
10775 an object size of 40 can be explicitly specified in this case.
10777 A consequence of this capability is that different object sizes can be
10778 given to subtypes that would otherwise be considered in Ada to be
10779 statically matching.  But it makes no sense to consider such subtypes
10780 as statically matching.  Consequently, GNAT adds a rule
10781 to the static matching rules that requires object sizes to match.
10782 Consider this example:
10784 @example
10785  1. procedure BadAVConvert is
10786  2.    type R is new Integer;
10787  3.    subtype R1 is R range 1 .. 10;
10788  4.    subtype R2 is R range 1 .. 10;
10789  5.    for R1'Object_Size use 8;
10790  6.    for R2'Object_Size use 16;
10791  7.    type R1P is access all R1;
10792  8.    type R2P is access all R2;
10793  9.    R1PV : R1P := new R1'(4);
10794 10.    R2PV : R2P;
10795 11. begin
10796 12.    R2PV := R2P (R1PV);
10797                |
10798        >>> target designated subtype not compatible with
10799            type "R1" defined at line 3
10801 13. end;
10802 @end example
10804 In the absence of lines 5 and 6,
10805 types @code{R1} and @code{R2} statically match and
10806 hence the conversion on line 12 is legal. But since lines 5 and 6
10807 cause the object sizes to differ, GNAT considers that types
10808 @code{R1} and @code{R2} are not statically matching, and line 12
10809 generates the diagnostic shown above.
10811 Similar additional checks are performed in other contexts requiring
10812 statically matching subtypes.
10814 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
10815 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{18e}
10816 @section Attribute Old
10819 @geindex Old
10821 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
10822 within @code{Post} aspect), GNAT also permits the use of this attribute
10823 in implementation defined pragmas @code{Postcondition},
10824 @code{Contract_Cases} and @code{Test_Case}. Also usages of
10825 @code{Old} which would be illegal according to the Ada 2012 RM
10826 definition are allowed under control of
10827 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
10829 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
10830 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{18f}
10831 @section Attribute Passed_By_Reference
10834 @geindex Parameters
10835 @geindex when passed by reference
10837 @geindex Passed_By_Reference
10839 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
10840 a value of type @code{Boolean} value that is @code{True} if the type is
10841 normally passed by reference and @code{False} if the type is normally
10842 passed by copy in calls.  For scalar types, the result is always @code{False}
10843 and is static.  For non-scalar types, the result is nonstatic.
10845 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
10846 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{190}
10847 @section Attribute Pool_Address
10850 @geindex Parameters
10851 @geindex when passed by reference
10853 @geindex Pool_Address
10855 @code{X'Pool_Address} for any object @code{X} returns the address
10856 of X within its storage pool. This is the same as
10857 @code{X'Address}, except that for an unconstrained array whose
10858 bounds are allocated just before the first component,
10859 @code{X'Pool_Address} returns the address of those bounds,
10860 whereas @code{X'Address} returns the address of the first
10861 component.
10863 Here, we are interpreting 'storage pool' broadly to mean
10864 @code{wherever the object is allocated}, which could be a
10865 user-defined storage pool,
10866 the global heap, on the stack, or in a static memory area.
10867 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
10868 what is passed to @code{Allocate} and returned from @code{Deallocate}.
10870 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
10871 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{191}
10872 @section Attribute Range_Length
10875 @geindex Range_Length
10877 @code{typ'Range_Length} for any discrete type @cite{typ} yields
10878 the number of values represented by the subtype (zero for a null
10879 range).  The result is static for static subtypes.  @code{Range_Length}
10880 applied to the index subtype of a one dimensional array always gives the
10881 same result as @code{Length} applied to the array itself.
10883 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
10884 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{192}
10885 @section Attribute Restriction_Set
10888 @geindex Restriction_Set
10890 @geindex Restrictions
10892 This attribute allows compile time testing of restrictions that
10893 are currently in effect. It is primarily intended for specializing
10894 code in the run-time based on restrictions that are active (e.g.
10895 don't need to save fpt registers if restriction No_Floating_Point
10896 is known to be in effect), but can be used anywhere.
10898 There are two forms:
10900 @example
10901 System'Restriction_Set (partition_boolean_restriction_NAME)
10902 System'Restriction_Set (No_Dependence => library_unit_NAME);
10903 @end example
10905 In the case of the first form, the only restriction names
10906 allowed are parameterless restrictions that are checked
10907 for consistency at bind time. For a complete list see the
10908 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
10910 The result returned is True if the restriction is known to
10911 be in effect, and False if the restriction is known not to
10912 be in effect. An important guarantee is that the value of
10913 a Restriction_Set attribute is known to be consistent throughout
10914 all the code of a partition.
10916 This is trivially achieved if the entire partition is compiled
10917 with a consistent set of restriction pragmas. However, the
10918 compilation model does not require this. It is possible to
10919 compile one set of units with one set of pragmas, and another
10920 set of units with another set of pragmas. It is even possible
10921 to compile a spec with one set of pragmas, and then WITH the
10922 same spec with a different set of pragmas. Inconsistencies
10923 in the actual use of the restriction are checked at bind time.
10925 In order to achieve the guarantee of consistency for the
10926 Restriction_Set pragma, we consider that a use of the pragma
10927 that yields False is equivalent to a violation of the
10928 restriction.
10930 So for example if you write
10932 @example
10933 if System'Restriction_Set (No_Floating_Point) then
10934    ...
10935 else
10936    ...
10937 end if;
10938 @end example
10940 And the result is False, so that the else branch is executed,
10941 you can assume that this restriction is not set for any unit
10942 in the partition. This is checked by considering this use of
10943 the restriction pragma to be a violation of the restriction
10944 No_Floating_Point. This means that no other unit can attempt
10945 to set this restriction (if some unit does attempt to set it,
10946 the binder will refuse to bind the partition).
10948 Technical note: The restriction name and the unit name are
10949 intepreted entirely syntactically, as in the corresponding
10950 Restrictions pragma, they are not analyzed semantically,
10951 so they do not have a type.
10953 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
10954 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{193}
10955 @section Attribute Result
10958 @geindex Result
10960 @code{function'Result} can only be used with in a Postcondition pragma
10961 for a function. The prefix must be the name of the corresponding function. This
10962 is used to refer to the result of the function in the postcondition expression.
10963 For a further discussion of the use of this attribute and examples of its use,
10964 see the description of pragma Postcondition.
10966 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
10967 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{194}
10968 @section Attribute Safe_Emax
10971 @geindex Ada 83 attributes
10973 @geindex Safe_Emax
10975 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
10976 the Ada 83 reference manual for an exact description of the semantics of
10977 this attribute.
10979 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
10980 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{195}
10981 @section Attribute Safe_Large
10984 @geindex Ada 83 attributes
10986 @geindex Safe_Large
10988 The @code{Safe_Large} attribute is provided for compatibility with Ada 83.  See
10989 the Ada 83 reference manual for an exact description of the semantics of
10990 this attribute.
10992 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
10993 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{196}
10994 @section Attribute Safe_Small
10997 @geindex Ada 83 attributes
10999 @geindex Safe_Small
11001 The @code{Safe_Small} attribute is provided for compatibility with Ada 83.  See
11002 the Ada 83 reference manual for an exact description of the semantics of
11003 this attribute.
11005 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11006 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{197}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{14c}
11007 @section Attribute Scalar_Storage_Order
11010 @geindex Endianness
11012 @geindex Scalar storage order
11014 @geindex Scalar_Storage_Order
11016 For every array or record type @code{S}, the representation attribute
11017 @code{Scalar_Storage_Order} denotes the order in which storage elements
11018 that make up scalar components are ordered within S. The value given must
11019 be a static expression of type System.Bit_Order. The following is an example
11020 of the use of this feature:
11022 @example
11023 --  Component type definitions
11025 subtype Yr_Type is Natural range 0 .. 127;
11026 subtype Mo_Type is Natural range 1 .. 12;
11027 subtype Da_Type is Natural range 1 .. 31;
11029 --  Record declaration
11031 type Date is record
11032    Years_Since_1980 : Yr_Type;
11033    Month            : Mo_Type;
11034    Day_Of_Month     : Da_Type;
11035 end record;
11037 --  Record representation clause
11039 for Date use record
11040    Years_Since_1980 at 0 range 0  ..  6;
11041    Month            at 0 range 7  .. 10;
11042    Day_Of_Month     at 0 range 11 .. 15;
11043 end record;
11045 --  Attribute definition clauses
11047 for Date'Bit_Order use System.High_Order_First;
11048 for Date'Scalar_Storage_Order use System.High_Order_First;
11049 --  If Scalar_Storage_Order is specified, it must be consistent with
11050 --  Bit_Order, so it's best to always define the latter explicitly if
11051 --  the former is used.
11052 @end example
11054 Other properties are as for standard representation attribute @code{Bit_Order},
11055 as defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11057 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11058 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11059 this means that if a @code{Scalar_Storage_Order} attribute definition
11060 clause is not confirming, then the type's @code{Bit_Order} shall be
11061 specified explicitly and set to the same value.
11063 Derived types inherit an explicitly set scalar storage order from their parent
11064 types. This may be overridden for the derived type by giving an explicit scalar
11065 storage order for the derived type. For a record extension, the derived type
11066 must have the same scalar storage order as the parent type.
11068 A component of a record type that is itself a record or an array and that does
11069 not start and end on a byte boundary must have have the same scalar storage
11070 order as the record type. A component of a bit-packed array type that is itself
11071 a record or an array must have the same scalar storage order as the array type.
11073 No component of a type that has an explicit @code{Scalar_Storage_Order}
11074 attribute definition may be aliased.
11076 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11077 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11079 If the opposite storage order is specified, then whenever the value of
11080 a scalar component of an object of type @code{S} is read, the storage
11081 elements of the enclosing machine scalar are first reversed (before
11082 retrieving the component value, possibly applying some shift and mask
11083 operatings on the enclosing machine scalar), and the opposite operation
11084 is done for writes.
11086 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11087 are relaxed. Instead, the following rules apply:
11090 @itemize *
11092 @item 
11093 the underlying storage elements are those at positions
11094 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11096 @item 
11097 the sequence of underlying storage elements shall have
11098 a size no greater than the largest machine scalar
11100 @item 
11101 the enclosing machine scalar is defined as the smallest machine
11102 scalar starting at a position no greater than
11103 @code{position + first_bit / storage_element_size} and covering
11104 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size`}
11106 @item 
11107 the position of the component is interpreted relative to that machine
11108 scalar.
11109 @end itemize
11111 If no scalar storage order is specified for a type (either directly, or by
11112 inheritance in the case of a derived type), then the default is normally
11113 the native ordering of the target, but this default can be overridden using
11114 pragma @code{Default_Scalar_Storage_Order}.
11116 Note that if a component of @code{T} is itself of a record or array type,
11117 the specfied @code{Scalar_Storage_Order} does @emph{not} apply to that nested type:
11118 an explicit attribute definition clause must be provided for the component
11119 type as well if desired.
11121 Note that the scalar storage order only affects the in-memory data
11122 representation. It has no effect on the representation used by stream
11123 attributes.
11125 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11126 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e3}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{198}
11127 @section Attribute Simple_Storage_Pool
11130 @geindex Storage pool
11131 @geindex simple
11133 @geindex Simple storage pool
11135 @geindex Simple_Storage_Pool
11137 For every nonformal, nonderived access-to-object type @code{Acc}, the
11138 representation attribute @code{Simple_Storage_Pool} may be specified
11139 via an attribute_definition_clause (or by specifying the equivalent aspect):
11141 @example
11142 My_Pool : My_Simple_Storage_Pool_Type;
11144 type Acc is access My_Data_Type;
11146 for Acc'Simple_Storage_Pool use My_Pool;
11147 @end example
11149 The name given in an attribute_definition_clause for the
11150 @code{Simple_Storage_Pool} attribute shall denote a variable of
11151 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
11153 The use of this attribute is only allowed for a prefix denoting a type
11154 for which it has been specified. The type of the attribute is the type
11155 of the variable specified as the simple storage pool of the access type,
11156 and the attribute denotes that variable.
11158 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11159 for the same access type.
11161 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11162 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11163 with a warning and its evaluation raises the exception @code{Program_Error}.
11165 If the Simple_Storage_Pool attribute has been specified for an access
11166 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11167 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11168 which is intended to indicate the number of storage elements reserved for
11169 the simple storage pool. If the Storage_Size function has not been defined
11170 for the simple storage pool type, then this attribute returns zero.
11172 If an access type @code{S} has a specified simple storage pool of type
11173 @code{SSP}, then the evaluation of an allocator for that access type calls
11174 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11175 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11176 semantics of such allocators is the same as those defined for allocators
11177 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11178 @emph{simple storage pool} substituted for @emph{storage pool}.
11180 If an access type @code{S} has a specified simple storage pool of type
11181 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11182 for that access type invokes the primitive @code{Deallocate} procedure
11183 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11184 parameter. The detailed semantics of such unchecked deallocations is the same
11185 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11186 term @emph{simple storage pool} is substituted for @emph{storage pool}.
11188 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11189 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{199}
11190 @section Attribute Small
11193 @geindex Ada 83 attributes
11195 @geindex Small
11197 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11198 fixed-point types.
11199 GNAT also allows this attribute to be applied to floating-point types
11200 for compatibility with Ada 83.  See
11201 the Ada 83 reference manual for an exact description of the semantics of
11202 this attribute when applied to floating-point types.
11204 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
11205 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{19a}
11206 @section Attribute Storage_Unit
11209 @geindex Storage_Unit
11211 @code{Standard'Storage_Unit} (@code{Standard} is the only permissible
11212 prefix) provides the same value as @code{System.Storage_Unit}.
11214 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11215 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{19b}
11216 @section Attribute Stub_Type
11219 @geindex Stub_Type
11221 The GNAT implementation of remote access-to-classwide types is
11222 organized as described in AARM section E.4 (20.t): a value of an RACW type
11223 (designating a remote object) is represented as a normal access
11224 value, pointing to a "stub" object which in turn contains the
11225 necessary information to contact the designated remote object. A
11226 call on any dispatching operation of such a stub object does the
11227 remote call, if necessary, using the information in the stub object
11228 to locate the target partition, etc.
11230 For a prefix @code{T} that denotes a remote access-to-classwide type,
11231 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11233 By construction, the layout of @code{T'Stub_Type} is identical to that of
11234 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11235 unit @code{System.Partition_Interface}. Use of this attribute will create
11236 an implicit dependency on this unit.
11238 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11239 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{19c}
11240 @section Attribute System_Allocator_Alignment
11243 @geindex Alignment
11244 @geindex allocator
11246 @geindex System_Allocator_Alignment
11248 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11249 permissible prefix) provides the observable guaranted to be honored by
11250 the system allocator (malloc). This is a static value that can be used
11251 in user storage pools based on malloc either to reject allocation
11252 with alignment too large or to enable a realignment circuitry if the
11253 alignment request is larger than this value.
11255 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11256 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{19d}
11257 @section Attribute Target_Name
11260 @geindex Target_Name
11262 @code{Standard'Target_Name} (@code{Standard} is the only permissible
11263 prefix) provides a static string value that identifies the target
11264 for the current compilation. For GCC implementations, this is the
11265 standard gcc target name without the terminating slash (for
11266 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
11268 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11269 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{19e}
11270 @section Attribute To_Address
11273 @geindex To_Address
11275 The @code{System'To_Address}
11276 (@code{System} is the only permissible prefix)
11277 denotes a function identical to
11278 @code{System.Storage_Elements.To_Address} except that
11279 it is a static attribute.  This means that if its argument is
11280 a static expression, then the result of the attribute is a
11281 static expression.  This means that such an expression can be
11282 used in contexts (e.g., preelaborable packages) which require a
11283 static expression and where the function call could not be used
11284 (since the function call is always nonstatic, even if its
11285 argument is static). The argument must be in the range
11286 -(2**(m-1)) .. 2**m-1, where m is the memory size
11287 (typically 32 or 64). Negative values are intepreted in a
11288 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11289 a 32 bits machine).
11291 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11292 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{19f}
11293 @section Attribute To_Any
11296 @geindex To_Any
11298 This internal attribute is used for the generation of remote subprogram
11299 stubs in the context of the Distributed Systems Annex.
11301 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11302 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a0}
11303 @section Attribute Type_Class
11306 @geindex Type_Class
11308 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11309 the value of the type class for the full type of @cite{typ}.  If
11310 @cite{typ} is a generic formal type, the value is the value for the
11311 corresponding actual subtype.  The value of this attribute is of type
11312 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11314 @example
11315 type Type_Class is
11316   (Type_Class_Enumeration,
11317    Type_Class_Integer,
11318    Type_Class_Fixed_Point,
11319    Type_Class_Floating_Point,
11320    Type_Class_Array,
11321    Type_Class_Record,
11322    Type_Class_Access,
11323    Type_Class_Task,
11324    Type_Class_Address);
11325 @end example
11327 Protected types yield the value @code{Type_Class_Task}, which thus
11328 applies to all concurrent types.  This attribute is designed to
11329 be compatible with the DEC Ada 83 attribute of the same name.
11331 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11332 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1a1}
11333 @section Attribute Type_Key
11336 @geindex Type_Key
11338 The @code{Type_Key} attribute is applicable to a type or subtype and
11339 yields a value of type Standard.String containing encoded information
11340 about the type or subtype. This provides improved compatibility with
11341 other implementations that support this attribute.
11343 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11344 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1a2}
11345 @section Attribute TypeCode
11348 @geindex TypeCode
11350 This internal attribute is used for the generation of remote subprogram
11351 stubs in the context of the Distributed Systems Annex.
11353 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11354 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1a3}
11355 @section Attribute Unconstrained_Array
11358 @geindex Unconstrained_Array
11360 The @code{Unconstrained_Array} attribute can be used with a prefix that
11361 denotes any type or subtype. It is a static attribute that yields
11362 @code{True} if the prefix designates an unconstrained array,
11363 and @code{False} otherwise. In a generic instance, the result is
11364 still static, and yields the result of applying this test to the
11365 generic actual.
11367 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11368 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1a4}
11369 @section Attribute Universal_Literal_String
11372 @geindex Named numbers
11373 @geindex representation of
11375 @geindex Universal_Literal_String
11377 The prefix of @code{Universal_Literal_String} must be a named
11378 number.  The static result is the string consisting of the characters of
11379 the number as defined in the original source.  This allows the user
11380 program to access the actual text of named numbers without intermediate
11381 conversions and without the need to enclose the strings in quotes (which
11382 would preclude their use as numbers).
11384 For example, the following program prints the first 50 digits of pi:
11386 @example
11387 with Text_IO; use Text_IO;
11388 with Ada.Numerics;
11389 procedure Pi is
11390 begin
11391    Put (Ada.Numerics.Pi'Universal_Literal_String);
11392 end;
11393 @end example
11395 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11396 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1a5}
11397 @section Attribute Unrestricted_Access
11400 @geindex Access
11401 @geindex unrestricted
11403 @geindex Unrestricted_Access
11405 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11406 except that all accessibility and aliased view checks are omitted.  This
11407 is a user-beware attribute.
11409 For objects, it is similar to @code{Address}, for which it is a
11410 desirable replacement where the value desired is an access type.
11411 In other words, its effect is similar to first applying the
11412 @code{Address} attribute and then doing an unchecked conversion to a
11413 desired access type.
11415 For subprograms, @code{P'Unrestricted_Access} may be used where
11416 @code{P'Access} would be illegal, to construct a value of a
11417 less-nested named access type that designates a more-nested
11418 subprogram. This value may be used in indirect calls, so long as the
11419 more-nested subprogram still exists; once the subprogram containing it
11420 has returned, such calls are erroneous. For example:
11422 @example
11423 package body P is
11425    type Less_Nested is not null access procedure;
11426    Global : Less_Nested;
11428    procedure P1 is
11429    begin
11430       Global.all;
11431    end P1;
11433    procedure P2 is
11434       Local_Var : Integer;
11436       procedure More_Nested is
11437       begin
11438          ... Local_Var ...
11439       end More_Nested;
11440    begin
11441       Global := More_Nested'Unrestricted_Access;
11442       P1;
11443    end P2;
11445 end P;
11446 @end example
11448 When P1 is called from P2, the call via Global is OK, but if P1 were
11449 called after P2 returns, it would be an erroneous use of a dangling
11450 pointer.
11452 For objects, it is possible to use @code{Unrestricted_Access} for any
11453 type. However, if the result is of an access-to-unconstrained array
11454 subtype, then the resulting pointer has the same scope as the context
11455 of the attribute, and must not be returned to some enclosing scope.
11456 For instance, if a function uses @code{Unrestricted_Access} to create
11457 an access-to-unconstrained-array and returns that value to the caller,
11458 the result will involve dangling pointers. In addition, it is only
11459 valid to create pointers to unconstrained arrays using this attribute
11460 if the pointer has the normal default 'fat' representation where a
11461 pointer has two components, one points to the array and one points to
11462 the bounds. If a size clause is used to force 'thin' representation
11463 for a pointer to unconstrained where there is only space for a single
11464 pointer, then the resulting pointer is not usable.
11466 In the simple case where a direct use of Unrestricted_Access attempts
11467 to make a thin pointer for a non-aliased object, the compiler will
11468 reject the use as illegal, as shown in the following example:
11470 @example
11471 with System; use System;
11472 procedure SliceUA2 is
11473    type A is access all String;
11474    for A'Size use Standard'Address_Size;
11476    procedure P (Arg : A) is
11477    begin
11478       null;
11479    end P;
11481    X : String := "hello world!";
11482    X2 : aliased String := "hello world!";
11484    AV : A := X'Unrestricted_Access;    -- ERROR
11485              |
11486 >>> illegal use of Unrestricted_Access attribute
11487 >>> attempt to generate thin pointer to unaliased object
11489 begin
11490    P (X'Unrestricted_Access);          -- ERROR
11491       |
11492 >>> illegal use of Unrestricted_Access attribute
11493 >>> attempt to generate thin pointer to unaliased object
11495    P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11496       |
11497 >>> illegal use of Unrestricted_Access attribute
11498 >>> attempt to generate thin pointer to unaliased object
11500    P (X2'Unrestricted_Access);         -- OK
11501 end;
11502 @end example
11504 but other cases cannot be detected by the compiler, and are
11505 considered to be erroneous. Consider the following example:
11507 @example
11508 with System; use System;
11509 with System; use System;
11510 procedure SliceUA is
11511    type AF is access all String;
11513    type A is access all String;
11514    for A'Size use Standard'Address_Size;
11516    procedure P (Arg : A) is
11517    begin
11518       if Arg'Length /= 6 then
11519          raise Program_Error;
11520       end if;
11521    end P;
11523    X : String := "hello world!";
11524    Y : AF := X (7 .. 12)'Unrestricted_Access;
11526 begin
11527    P (A (Y));
11528 end;
11529 @end example
11531 A normal unconstrained array value
11532 or a constrained array object marked as aliased has the bounds in memory
11533 just before the array, so a thin pointer can retrieve both the data and
11534 the bounds.  But in this case, the non-aliased object @code{X} does not have the
11535 bounds before the string.  If the size clause for type @code{A}
11536 were not present, then the pointer
11537 would be a fat pointer, where one component is a pointer to the bounds,
11538 and all would be well.  But with the size clause present, the conversion from
11539 fat pointer to thin pointer in the call loses the bounds, and so this
11540 is erroneous, and the program likely raises a @code{Program_Error} exception.
11542 In general, it is advisable to completely
11543 avoid mixing the use of thin pointers and the use of
11544 @code{Unrestricted_Access} where the designated type is an
11545 unconstrained array.  The use of thin pointers should be restricted to
11546 cases of porting legacy code that implicitly assumes the size of pointers,
11547 and such code should not in any case be using this attribute.
11549 Another erroneous situation arises if the attribute is
11550 applied to a constant. The resulting pointer can be used to access the
11551 constant, but the effect of trying to modify a constant in this manner
11552 is not well-defined. Consider this example:
11554 @example
11555 P : constant Integer := 4;
11556 type R is access all Integer;
11557 RV : R := P'Unrestricted_Access;
11559 RV.all := 3;
11560 @end example
11562 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11563 or may not notice this attempt, and subsequent references to P may yield
11564 either the value 3 or the value 4 or the assignment may blow up if the
11565 compiler decides to put P in read-only memory. One particular case where
11566 @code{Unrestricted_Access} can be used in this way is to modify the
11567 value of an @code{in} parameter:
11569 @example
11570 procedure K (S : in String) is
11571    type R is access all Character;
11572    RV : R := S (3)'Unrestricted_Access;
11573 begin
11574    RV.all := 'a';
11575 end;
11576 @end example
11578 In general this is a risky approach. It may appear to "work" but such uses of
11579 @code{Unrestricted_Access} are potentially non-portable, even from one version
11580 of GNAT to another, so are best avoided if possible.
11582 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11583 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1a6}
11584 @section Attribute Update
11587 @geindex Update
11589 The @code{Update} attribute creates a copy of an array or record value
11590 with one or more modified components. The syntax is:
11592 @example
11593 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11594 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11595 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11596                 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11598 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11599 INDEX_EXPRESSION_LIST_LIST                   ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11600 INDEX_EXPRESSION_LIST                        ::= ( EXPRESSION @{, EXPRESSION @} )
11601 @end example
11603 where @code{PREFIX} is the name of an array or record object, the
11604 association list in parentheses does not contain an @code{others}
11605 choice and the box symbol @code{<>} may not appear in any
11606 expression. The effect is to yield a copy of the array or record value
11607 which is unchanged apart from the components mentioned in the
11608 association list, which are changed to the indicated value. The
11609 original value of the array or record value is not affected. For
11610 example:
11612 @example
11613 type Arr is Array (1 .. 5) of Integer;
11615 Avar1 : Arr := (1,2,3,4,5);
11616 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11617 @end example
11619 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
11620 begin unmodified. Similarly:
11622 @example
11623 type Rec is A, B, C : Integer;
11625 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11626 Rvar2 : Rec := Rvar1'Update (B => 20);
11627 @end example
11629 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
11630 with @code{Rvar1} being unmodifed.
11631 Note that the value of the attribute reference is computed
11632 completely before it is used. This means that if you write:
11634 @example
11635 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11636 @end example
11638 then the value of @code{Avar1} is not modified if @code{Function_Call}
11639 raises an exception, unlike the effect of a series of direct assignments
11640 to elements of @code{Avar1}. In general this requires that
11641 two extra complete copies of the object are required, which should be
11642 kept in mind when considering efficiency.
11644 The @code{Update} attribute cannot be applied to prefixes of a limited
11645 type, and cannot reference discriminants in the case of a record type.
11646 The accessibility level of an Update attribute result object is defined
11647 as for an aggregate.
11649 In the record case, no component can be mentioned more than once. In
11650 the array case, two overlapping ranges can appear in the association list,
11651 in which case the modifications are processed left to right.
11653 Multi-dimensional arrays can be modified, as shown by this example:
11655 @example
11656 A : array (1 .. 10, 1 .. 10) of Integer;
11658 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11659 @end example
11661 which changes element (1,2) to 20 and (3,4) to 30.
11663 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11664 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1a7}
11665 @section Attribute Valid_Scalars
11668 @geindex Valid_Scalars
11670 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
11671 validity of scalar subcomponents of composite objects. The attribute is defined
11672 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
11673 except for tagged private or @code{Unchecked_Union} types. The value of the
11674 attribute is of type @code{Boolean}.
11676 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
11677 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
11678 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
11679 to attribute @code{'Valid} for scalar types.
11681 It is not specified in what order the subcomponents are checked, nor whether
11682 any more are checked after any one of them is determined to be invalid. If the
11683 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
11684 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
11685 only the subcomponents of @code{T} are checked; in other words, components of
11686 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
11688 The compiler will issue a warning if it can be determined at compile time that
11689 the prefix of the attribute has no scalar subcomponents.
11691 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
11692 a large variant record. If the attribute is called in many places in the same
11693 program applied to objects of the same type, it can reduce program size to
11694 write a function with a single use of the attribute, and then call that
11695 function from multiple places.
11697 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11698 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1a8}
11699 @section Attribute VADS_Size
11702 @geindex Size
11703 @geindex VADS compatibility
11705 @geindex VADS_Size
11707 The @code{'VADS_Size} attribute is intended to make it easier to port
11708 legacy code which relies on the semantics of @code{'Size} as implemented
11709 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
11710 same semantic interpretation.  In particular, @code{'VADS_Size} applied
11711 to a predefined or other primitive type with no Size clause yields the
11712 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
11713 typical machines).  In addition @code{'VADS_Size} applied to an object
11714 gives the result that would be obtained by applying the attribute to
11715 the corresponding type.
11717 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11718 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1a9}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{15b}
11719 @section Attribute Value_Size
11722 @geindex Size
11723 @geindex setting for not-first subtype
11725 @geindex Value_Size
11727 @code{type'Value_Size} is the number of bits required to represent
11728 a value of the given subtype.  It is the same as @code{type'Size},
11729 but, unlike @code{Size}, may be set for non-first subtypes.
11731 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11732 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1aa}
11733 @section Attribute Wchar_T_Size
11736 @geindex Wchar_T_Size
11738 @code{Standard'Wchar_T_Size} (@code{Standard} is the only permissible
11739 prefix) provides the size in bits of the C @code{wchar_t} type
11740 primarily for constructing the definition of this type in
11741 package @code{Interfaces.C}. The result is a static constant.
11743 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
11744 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1ab}
11745 @section Attribute Word_Size
11748 @geindex Word_Size
11750 @code{Standard'Word_Size} (@code{Standard} is the only permissible
11751 prefix) provides the value @code{System.Word_Size}. The result is
11752 a static constant.
11754 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
11755 @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{1ac}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1ad}
11756 @chapter Standard and Implementation Defined Restrictions
11759 All Ada Reference Manual-defined Restriction identifiers are implemented:
11762 @itemize *
11764 @item 
11765 language-defined restrictions (see 13.12.1)
11767 @item 
11768 tasking restrictions (see D.7)
11770 @item 
11771 high integrity restrictions (see H.4)
11772 @end itemize
11774 GNAT implements additional restriction identifiers. All restrictions, whether
11775 language defined or GNAT-specific, are listed in the following.
11777 @menu
11778 * Partition-Wide Restrictions:: 
11779 * Program Unit Level Restrictions:: 
11781 @end menu
11783 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
11784 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1ae}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1af}
11785 @section Partition-Wide Restrictions
11788 There are two separate lists of restriction identifiers. The first
11789 set requires consistency throughout a partition (in other words, if the
11790 restriction identifier is used for any compilation unit in the partition,
11791 then all compilation units in the partition must obey the restriction).
11793 @menu
11794 * Immediate_Reclamation:: 
11795 * Max_Asynchronous_Select_Nesting:: 
11796 * Max_Entry_Queue_Length:: 
11797 * Max_Protected_Entries:: 
11798 * Max_Select_Alternatives:: 
11799 * Max_Storage_At_Blocking:: 
11800 * Max_Task_Entries:: 
11801 * Max_Tasks:: 
11802 * No_Abort_Statements:: 
11803 * No_Access_Parameter_Allocators:: 
11804 * No_Access_Subprograms:: 
11805 * No_Allocators:: 
11806 * No_Anonymous_Allocators:: 
11807 * No_Asynchronous_Control:: 
11808 * No_Calendar:: 
11809 * No_Coextensions:: 
11810 * No_Default_Initialization:: 
11811 * No_Delay:: 
11812 * No_Dependence:: 
11813 * No_Direct_Boolean_Operators:: 
11814 * No_Dispatch:: 
11815 * No_Dispatching_Calls:: 
11816 * No_Dynamic_Attachment:: 
11817 * No_Dynamic_Priorities:: 
11818 * No_Entry_Calls_In_Elaboration_Code:: 
11819 * No_Enumeration_Maps:: 
11820 * No_Exception_Handlers:: 
11821 * No_Exception_Propagation:: 
11822 * No_Exception_Registration:: 
11823 * No_Exceptions:: 
11824 * No_Finalization:: 
11825 * No_Fixed_Point:: 
11826 * No_Floating_Point:: 
11827 * No_Implicit_Conditionals:: 
11828 * No_Implicit_Dynamic_Code:: 
11829 * No_Implicit_Heap_Allocations:: 
11830 * No_Implicit_Protected_Object_Allocations:: 
11831 * No_Implicit_Task_Allocations:: 
11832 * No_Initialize_Scalars:: 
11833 * No_IO:: 
11834 * No_Local_Allocators:: 
11835 * No_Local_Protected_Objects:: 
11836 * No_Local_Timing_Events:: 
11837 * No_Long_Long_Integers:: 
11838 * No_Multiple_Elaboration:: 
11839 * No_Nested_Finalization:: 
11840 * No_Protected_Type_Allocators:: 
11841 * No_Protected_Types:: 
11842 * No_Recursion:: 
11843 * No_Reentrancy:: 
11844 * No_Relative_Delay:: 
11845 * No_Requeue_Statements:: 
11846 * No_Secondary_Stack:: 
11847 * No_Select_Statements:: 
11848 * No_Specific_Termination_Handlers:: 
11849 * No_Specification_of_Aspect:: 
11850 * No_Standard_Allocators_After_Elaboration:: 
11851 * No_Standard_Storage_Pools:: 
11852 * No_Stream_Optimizations:: 
11853 * No_Streams:: 
11854 * No_Task_Allocators:: 
11855 * No_Task_At_Interrupt_Priority:: 
11856 * No_Task_Attributes_Package:: 
11857 * No_Task_Hierarchy:: 
11858 * No_Task_Termination:: 
11859 * No_Tasking:: 
11860 * No_Terminate_Alternatives:: 
11861 * No_Unchecked_Access:: 
11862 * No_Unchecked_Conversion:: 
11863 * No_Unchecked_Deallocation:: 
11864 * No_Use_Of_Entity:: 
11865 * Pure_Barriers:: 
11866 * Simple_Barriers:: 
11867 * Static_Priorities:: 
11868 * Static_Storage_Size:: 
11870 @end menu
11872 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
11873 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1b0}
11874 @subsection Immediate_Reclamation
11877 @geindex Immediate_Reclamation
11879 [RM H.4] This restriction ensures that, except for storage occupied by
11880 objects created by allocators and not deallocated via unchecked
11881 deallocation, any storage reserved at run time for an object is
11882 immediately reclaimed when the object no longer exists.
11884 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
11885 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1b1}
11886 @subsection Max_Asynchronous_Select_Nesting
11889 @geindex Max_Asynchronous_Select_Nesting
11891 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
11892 selects. Violations of this restriction with a value of zero are
11893 detected at compile time. Violations of this restriction with values
11894 other than zero cause Storage_Error to be raised.
11896 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
11897 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1b2}
11898 @subsection Max_Entry_Queue_Length
11901 @geindex Max_Entry_Queue_Length
11903 [RM D.7] This restriction is a declaration that any protected entry compiled in
11904 the scope of the restriction has at most the specified number of
11905 tasks waiting on the entry at any one time, and so no queue is required.
11906 Note that this restriction is checked at run time. Violation of this
11907 restriction results in the raising of Program_Error exception at the point of
11908 the call.
11910 @geindex Max_Entry_Queue_Depth
11912 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
11913 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
11914 compatibility purposes (and a warning will be generated for its use if
11915 warnings on obsolescent features are activated).
11917 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
11918 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1b3}
11919 @subsection Max_Protected_Entries
11922 @geindex Max_Protected_Entries
11924 [RM D.7] Specifies the maximum number of entries per protected type. The
11925 bounds of every entry family of a protected unit shall be static, or shall be
11926 defined by a discriminant of a subtype whose corresponding bound is static.
11928 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
11929 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1b4}
11930 @subsection Max_Select_Alternatives
11933 @geindex Max_Select_Alternatives
11935 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
11937 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
11938 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1b5}
11939 @subsection Max_Storage_At_Blocking
11942 @geindex Max_Storage_At_Blocking
11944 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
11945 Storage_Size that can be retained by a blocked task. A violation of this
11946 restriction causes Storage_Error to be raised.
11948 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
11949 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1b6}
11950 @subsection Max_Task_Entries
11953 @geindex Max_Task_Entries
11955 [RM D.7] Specifies the maximum number of entries
11956 per task.  The bounds of every entry family
11957 of a task unit shall be static, or shall be
11958 defined by a discriminant of a subtype whose
11959 corresponding bound is static.
11961 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
11962 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1b7}
11963 @subsection Max_Tasks
11966 @geindex Max_Tasks
11968 [RM D.7] Specifies the maximum number of task that may be created, not
11969 counting the creation of the environment task.  Violations of this
11970 restriction with a value of zero are detected at compile
11971 time. Violations of this restriction with values other than zero cause
11972 Storage_Error to be raised.
11974 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
11975 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1b8}
11976 @subsection No_Abort_Statements
11979 @geindex No_Abort_Statements
11981 [RM D.7] There are no abort_statements, and there are
11982 no calls to Task_Identification.Abort_Task.
11984 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
11985 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1b9}
11986 @subsection No_Access_Parameter_Allocators
11989 @geindex No_Access_Parameter_Allocators
11991 [RM H.4] This restriction ensures at compile time that there are no
11992 occurrences of an allocator as the actual parameter to an access
11993 parameter.
11995 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
11996 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1ba}
11997 @subsection No_Access_Subprograms
12000 @geindex No_Access_Subprograms
12002 [RM H.4] This restriction ensures at compile time that there are no
12003 declarations of access-to-subprogram types.
12005 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12006 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1bb}
12007 @subsection No_Allocators
12010 @geindex No_Allocators
12012 [RM H.4] This restriction ensures at compile time that there are no
12013 occurrences of an allocator.
12015 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12016 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1bc}
12017 @subsection No_Anonymous_Allocators
12020 @geindex No_Anonymous_Allocators
12022 [RM H.4] This restriction ensures at compile time that there are no
12023 occurrences of an allocator of anonymous access type.
12025 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12026 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1bd}
12027 @subsection No_Asynchronous_Control
12030 @geindex No_Asynchronous_Control
12032 [RM J.13] This restriction ensures at compile time that there are no semantic
12033 dependences on the predefined package Asynchronous_Task_Control.
12035 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12036 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1be}
12037 @subsection No_Calendar
12040 @geindex No_Calendar
12042 [GNAT] This restriction ensures at compile time that there are no semantic
12043 dependences on package Calendar.
12045 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12046 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1bf}
12047 @subsection No_Coextensions
12050 @geindex No_Coextensions
12052 [RM H.4] This restriction ensures at compile time that there are no
12053 coextensions. See 3.10.2.
12055 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12056 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1c0}
12057 @subsection No_Default_Initialization
12060 @geindex No_Default_Initialization
12062 [GNAT] This restriction prohibits any instance of default initialization
12063 of variables.  The binder implements a consistency rule which prevents
12064 any unit compiled without the restriction from with'ing a unit with the
12065 restriction (this allows the generation of initialization procedures to
12066 be skipped, since you can be sure that no call is ever generated to an
12067 initialization procedure in a unit with the restriction active). If used
12068 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12069 is to prohibit all cases of variables declared without a specific
12070 initializer (including the case of OUT scalar parameters).
12072 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12073 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1c1}
12074 @subsection No_Delay
12077 @geindex No_Delay
12079 [RM H.4] This restriction ensures at compile time that there are no
12080 delay statements and no semantic dependences on package Calendar.
12082 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12083 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1c2}
12084 @subsection No_Dependence
12087 @geindex No_Dependence
12089 [RM 13.12.1] This restriction ensures at compile time that there are no
12090 dependences on a library unit.
12092 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12093 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1c3}
12094 @subsection No_Direct_Boolean_Operators
12097 @geindex No_Direct_Boolean_Operators
12099 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12100 are used on operands of type Boolean (or any type derived from Boolean).
12101 This is intended for use in safety critical programs where the certification
12102 protocol requires the use of short-circuit (and then, or else) forms for all
12103 composite boolean operations.
12105 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12106 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1c4}
12107 @subsection No_Dispatch
12110 @geindex No_Dispatch
12112 [RM H.4] This restriction ensures at compile time that there are no
12113 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12115 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12116 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1c5}
12117 @subsection No_Dispatching_Calls
12120 @geindex No_Dispatching_Calls
12122 [GNAT] This restriction ensures at compile time that the code generated by the
12123 compiler involves no dispatching calls. The use of this restriction allows the
12124 safe use of record extensions, classwide membership tests and other classwide
12125 features not involving implicit dispatching. This restriction ensures that
12126 the code contains no indirect calls through a dispatching mechanism. Note that
12127 this includes internally-generated calls created by the compiler, for example
12128 in the implementation of class-wide objects assignments. The
12129 membership test is allowed in the presence of this restriction, because its
12130 implementation requires no dispatching.
12131 This restriction is comparable to the official Ada restriction
12132 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12133 all classwide constructs that do not imply dispatching.
12134 The following example indicates constructs that violate this restriction.
12136 @example
12137 package Pkg is
12138   type T is tagged record
12139     Data : Natural;
12140   end record;
12141   procedure P (X : T);
12143   type DT is new T with record
12144     More_Data : Natural;
12145   end record;
12146   procedure Q (X : DT);
12147 end Pkg;
12149 with Pkg; use Pkg;
12150 procedure Example is
12151   procedure Test (O : T'Class) is
12152     N : Natural  := O'Size;--  Error: Dispatching call
12153     C : T'Class := O;      --  Error: implicit Dispatching Call
12154   begin
12155     if O in DT'Class then  --  OK   : Membership test
12156        Q (DT (O));         --  OK   : Type conversion plus direct call
12157     else
12158        P (O);              --  Error: Dispatching call
12159     end if;
12160   end Test;
12162   Obj : DT;
12163 begin
12164   P (Obj);                 --  OK   : Direct call
12165   P (T (Obj));             --  OK   : Type conversion plus direct call
12166   P (T'Class (Obj));       --  Error: Dispatching call
12168   Test (Obj);              --  OK   : Type conversion
12170   if Obj in T'Class then   --  OK   : Membership test
12171      null;
12172   end if;
12173 end Example;
12174 @end example
12176 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12177 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1c6}
12178 @subsection No_Dynamic_Attachment
12181 @geindex No_Dynamic_Attachment
12183 [RM D.7] This restriction ensures that there is no call to any of the
12184 operations defined in package Ada.Interrupts
12185 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12186 Detach_Handler, and Reference).
12188 @geindex No_Dynamic_Interrupts
12190 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12191 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12192 compatibility purposes (and a warning will be generated for its use if
12193 warnings on obsolescent features are activated).
12195 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12196 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1c7}
12197 @subsection No_Dynamic_Priorities
12200 @geindex No_Dynamic_Priorities
12202 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12204 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12205 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1c8}
12206 @subsection No_Entry_Calls_In_Elaboration_Code
12209 @geindex No_Entry_Calls_In_Elaboration_Code
12211 [GNAT] This restriction ensures at compile time that no task or protected entry
12212 calls are made during elaboration code.  As a result of the use of this
12213 restriction, the compiler can assume that no code past an accept statement
12214 in a task can be executed at elaboration time.
12216 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12217 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1c9}
12218 @subsection No_Enumeration_Maps
12221 @geindex No_Enumeration_Maps
12223 [GNAT] This restriction ensures at compile time that no operations requiring
12224 enumeration maps are used (that is Image and Value attributes applied
12225 to enumeration types).
12227 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12228 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1ca}
12229 @subsection No_Exception_Handlers
12232 @geindex No_Exception_Handlers
12234 [GNAT] This restriction ensures at compile time that there are no explicit
12235 exception handlers. It also indicates that no exception propagation will
12236 be provided. In this mode, exceptions may be raised but will result in
12237 an immediate call to the last chance handler, a routine that the user
12238 must define with the following profile:
12240 @example
12241 procedure Last_Chance_Handler
12242   (Source_Location : System.Address; Line : Integer);
12243 pragma Export (C, Last_Chance_Handler,
12244                "__gnat_last_chance_handler");
12245 @end example
12247 The parameter is a C null-terminated string representing a message to be
12248 associated with the exception (typically the source location of the raise
12249 statement generated by the compiler). The Line parameter when nonzero
12250 represents the line number in the source program where the raise occurs.
12252 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12253 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1cb}
12254 @subsection No_Exception_Propagation
12257 @geindex No_Exception_Propagation
12259 [GNAT] This restriction guarantees that exceptions are never propagated
12260 to an outer subprogram scope. The only case in which an exception may
12261 be raised is when the handler is statically in the same subprogram, so
12262 that the effect of a raise is essentially like a goto statement. Any
12263 other raise statement (implicit or explicit) will be considered
12264 unhandled. Exception handlers are allowed, but may not contain an
12265 exception occurrence identifier (exception choice). In addition, use of
12266 the package GNAT.Current_Exception is not permitted, and reraise
12267 statements (raise with no operand) are not permitted.
12269 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12270 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1cc}
12271 @subsection No_Exception_Registration
12274 @geindex No_Exception_Registration
12276 [GNAT] This restriction ensures at compile time that no stream operations for
12277 types Exception_Id or Exception_Occurrence are used. This also makes it
12278 impossible to pass exceptions to or from a partition with this restriction
12279 in a distributed environment. If this restriction is active, the generated
12280 code is simplified by omitting the otherwise-required global registration
12281 of exceptions when they are declared.
12283 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12284 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1cd}
12285 @subsection No_Exceptions
12288 @geindex No_Exceptions
12290 [RM H.4] This restriction ensures at compile time that there are no
12291 raise statements and no exception handlers.
12293 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12294 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1ce}
12295 @subsection No_Finalization
12298 @geindex No_Finalization
12300 [GNAT] This restriction disables the language features described in
12301 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12302 performed by the compiler to support these features. The following types
12303 are no longer considered controlled when this restriction is in effect:
12306 @itemize *
12308 @item 
12309 @code{Ada.Finalization.Controlled}
12311 @item 
12312 @code{Ada.Finalization.Limited_Controlled}
12314 @item 
12315 Derivations from @code{Controlled} or @code{Limited_Controlled}
12317 @item 
12318 Class-wide types
12320 @item 
12321 Protected types
12323 @item 
12324 Task types
12326 @item 
12327 Array and record types with controlled components
12328 @end itemize
12330 The compiler no longer generates code to initialize, finalize or adjust an
12331 object or a nested component, either declared on the stack or on the heap. The
12332 deallocation of a controlled object no longer finalizes its contents.
12334 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12335 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1cf}
12336 @subsection No_Fixed_Point
12339 @geindex No_Fixed_Point
12341 [RM H.4] This restriction ensures at compile time that there are no
12342 occurrences of fixed point types and operations.
12344 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12345 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1d0}
12346 @subsection No_Floating_Point
12349 @geindex No_Floating_Point
12351 [RM H.4] This restriction ensures at compile time that there are no
12352 occurrences of floating point types and operations.
12354 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12355 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1d1}
12356 @subsection No_Implicit_Conditionals
12359 @geindex No_Implicit_Conditionals
12361 [GNAT] This restriction ensures that the generated code does not contain any
12362 implicit conditionals, either by modifying the generated code where possible,
12363 or by rejecting any construct that would otherwise generate an implicit
12364 conditional. Note that this check does not include run time constraint
12365 checks, which on some targets may generate implicit conditionals as
12366 well. To control the latter, constraint checks can be suppressed in the
12367 normal manner. Constructs generating implicit conditionals include comparisons
12368 of composite objects and the Max/Min attributes.
12370 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12371 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1d2}
12372 @subsection No_Implicit_Dynamic_Code
12375 @geindex No_Implicit_Dynamic_Code
12377 @geindex trampoline
12379 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12380 This is a structure that is built on the stack and contains dynamic
12381 code to be executed at run time. On some targets, a trampoline is
12382 built for the following features: @code{Access},
12383 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12384 nested task bodies; primitive operations of nested tagged types.
12385 Trampolines do not work on machines that prevent execution of stack
12386 data. For example, on windows systems, enabling DEP (data execution
12387 protection) will cause trampolines to raise an exception.
12388 Trampolines are also quite slow at run time.
12390 On many targets, trampolines have been largely eliminated. Look at the
12391 version of system.ads for your target --- if it has
12392 Always_Compatible_Rep equal to False, then trampolines are largely
12393 eliminated. In particular, a trampoline is built for the following
12394 features: @code{Address} of a nested subprogram;
12395 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12396 but only if pragma Favor_Top_Level applies, or the access type has a
12397 foreign-language convention; primitive operations of nested tagged
12398 types.
12400 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12401 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1d3}
12402 @subsection No_Implicit_Heap_Allocations
12405 @geindex No_Implicit_Heap_Allocations
12407 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12409 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12410 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1d4}
12411 @subsection No_Implicit_Protected_Object_Allocations
12414 @geindex No_Implicit_Protected_Object_Allocations
12416 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12417 protected object.
12419 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12420 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1d5}
12421 @subsection No_Implicit_Task_Allocations
12424 @geindex No_Implicit_Task_Allocations
12426 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12428 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12429 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1d6}
12430 @subsection No_Initialize_Scalars
12433 @geindex No_Initialize_Scalars
12435 [GNAT] This restriction ensures that no unit in the partition is compiled with
12436 pragma Initialize_Scalars. This allows the generation of more efficient
12437 code, and in particular eliminates dummy null initialization routines that
12438 are otherwise generated for some record and array types.
12440 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12441 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1d7}
12442 @subsection No_IO
12445 @geindex No_IO
12447 [RM H.4] This restriction ensures at compile time that there are no
12448 dependences on any of the library units Sequential_IO, Direct_IO,
12449 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12451 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12452 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1d8}
12453 @subsection No_Local_Allocators
12456 @geindex No_Local_Allocators
12458 [RM H.4] This restriction ensures at compile time that there are no
12459 occurrences of an allocator in subprograms, generic subprograms, tasks,
12460 and entry bodies.
12462 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12463 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1d9}
12464 @subsection No_Local_Protected_Objects
12467 @geindex No_Local_Protected_Objects
12469 [RM D.7] This restriction ensures at compile time that protected objects are
12470 only declared at the library level.
12472 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12473 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1da}
12474 @subsection No_Local_Timing_Events
12477 @geindex No_Local_Timing_Events
12479 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12480 declared at the library level.
12482 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12483 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1db}
12484 @subsection No_Long_Long_Integers
12487 @geindex No_Long_Long_Integers
12489 [GNAT] This partition-wide restriction forbids any explicit reference to
12490 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12491 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12492 Long_Integer'Size.
12494 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12495 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1dc}
12496 @subsection No_Multiple_Elaboration
12499 @geindex No_Multiple_Elaboration
12501 [GNAT] When this restriction is active, we are not requesting control-flow
12502 preservation with -fpreserve-control-flow, and the static elaboration model is
12503 used, the compiler is allowed to suppress the elaboration counter normally
12504 associated with the unit, even if the unit has elaboration code. This counter
12505 is typically used to check for access before elaboration and to control
12506 multiple elaboration attempts. If the restriction is used, then the
12507 situations in which multiple elaboration is possible, including non-Ada main
12508 programs and Stand Alone libraries, are not permitted and will be diagnosed
12509 by the binder.
12511 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12512 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1dd}
12513 @subsection No_Nested_Finalization
12516 @geindex No_Nested_Finalization
12518 [RM D.7] All objects requiring finalization are declared at the library level.
12520 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12521 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1de}
12522 @subsection No_Protected_Type_Allocators
12525 @geindex No_Protected_Type_Allocators
12527 [RM D.7] This restriction ensures at compile time that there are no allocator
12528 expressions that attempt to allocate protected objects.
12530 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12531 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1df}
12532 @subsection No_Protected_Types
12535 @geindex No_Protected_Types
12537 [RM H.4] This restriction ensures at compile time that there are no
12538 declarations of protected types or protected objects.
12540 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12541 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1e0}
12542 @subsection No_Recursion
12545 @geindex No_Recursion
12547 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12548 part of its execution.
12550 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12551 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1e1}
12552 @subsection No_Reentrancy
12555 @geindex No_Reentrancy
12557 [RM H.4] A program execution is erroneous if a subprogram is executed by
12558 two tasks at the same time.
12560 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12561 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1e2}
12562 @subsection No_Relative_Delay
12565 @geindex No_Relative_Delay
12567 [RM D.7] This restriction ensures at compile time that there are no delay
12568 relative statements and prevents expressions such as @code{delay 1.23;} from
12569 appearing in source code.
12571 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12572 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1e3}
12573 @subsection No_Requeue_Statements
12576 @geindex No_Requeue_Statements
12578 [RM D.7] This restriction ensures at compile time that no requeue statements
12579 are permitted and prevents keyword @code{requeue} from being used in source
12580 code.
12582 @geindex No_Requeue
12584 The restriction @code{No_Requeue} is recognized as a
12585 synonym for @code{No_Requeue_Statements}. This is retained for historical
12586 compatibility purposes (and a warning will be generated for its use if
12587 warnings on oNobsolescent features are activated).
12589 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12590 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1e4}
12591 @subsection No_Secondary_Stack
12594 @geindex No_Secondary_Stack
12596 [GNAT] This restriction ensures at compile time that the generated code
12597 does not contain any reference to the secondary stack.  The secondary
12598 stack is used to implement functions returning unconstrained objects
12599 (arrays or records) on some targets. Suppresses the allocation of
12600 secondary stacks for tasks (excluding the environment task) at run time.
12602 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12603 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1e5}
12604 @subsection No_Select_Statements
12607 @geindex No_Select_Statements
12609 [RM D.7] This restriction ensures at compile time no select statements of any
12610 kind are permitted, that is the keyword @code{select} may not appear.
12612 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12613 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1e6}
12614 @subsection No_Specific_Termination_Handlers
12617 @geindex No_Specific_Termination_Handlers
12619 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12620 or to Ada.Task_Termination.Specific_Handler.
12622 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12623 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1e7}
12624 @subsection No_Specification_of_Aspect
12627 @geindex No_Specification_of_Aspect
12629 [RM 13.12.1] This restriction checks at compile time that no aspect
12630 specification, attribute definition clause, or pragma is given for a
12631 given aspect.
12633 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12634 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1e8}
12635 @subsection No_Standard_Allocators_After_Elaboration
12638 @geindex No_Standard_Allocators_After_Elaboration
12640 [RM D.7] Specifies that an allocator using a standard storage pool
12641 should never be evaluated at run time after the elaboration of the
12642 library items of the partition has completed. Otherwise, Storage_Error
12643 is raised.
12645 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12646 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1e9}
12647 @subsection No_Standard_Storage_Pools
12650 @geindex No_Standard_Storage_Pools
12652 [GNAT] This restriction ensures at compile time that no access types
12653 use the standard default storage pool.  Any access type declared must
12654 have an explicit Storage_Pool attribute defined specifying a
12655 user-defined storage pool.
12657 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12658 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1ea}
12659 @subsection No_Stream_Optimizations
12662 @geindex No_Stream_Optimizations
12664 [GNAT] This restriction affects the performance of stream operations on types
12665 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
12666 compiler uses block reads and writes when manipulating @code{String} objects
12667 due to their supperior performance. When this restriction is in effect, the
12668 compiler performs all IO operations on a per-character basis.
12670 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12671 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1eb}
12672 @subsection No_Streams
12675 @geindex No_Streams
12677 [GNAT] This restriction ensures at compile/bind time that there are no
12678 stream objects created and no use of stream attributes.
12679 This restriction does not forbid dependences on the package
12680 @code{Ada.Streams}. So it is permissible to with
12681 @code{Ada.Streams} (or another package that does so itself)
12682 as long as no actual stream objects are created and no
12683 stream attributes are used.
12685 Note that the use of restriction allows optimization of tagged types,
12686 since they do not need to worry about dispatching stream operations.
12687 To take maximum advantage of this space-saving optimization, any
12688 unit declaring a tagged type should be compiled with the restriction,
12689 though this is not required.
12691 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12692 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1ec}
12693 @subsection No_Task_Allocators
12696 @geindex No_Task_Allocators
12698 [RM D.7] There are no allocators for task types
12699 or types containing task subcomponents.
12701 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
12702 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1ed}
12703 @subsection No_Task_At_Interrupt_Priority
12706 @geindex No_Task_At_Interrupt_Priority
12708 [GNAT] This restriction ensures at compile time that there is no
12709 Interrupt_Priority aspect or pragma for a task or a task type. As
12710 a consequence, the tasks are always created with a priority below
12711 that an interrupt priority.
12713 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
12714 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1ee}
12715 @subsection No_Task_Attributes_Package
12718 @geindex No_Task_Attributes_Package
12720 [GNAT] This restriction ensures at compile time that there are no implicit or
12721 explicit dependencies on the package @code{Ada.Task_Attributes}.
12723 @geindex No_Task_Attributes
12725 The restriction @code{No_Task_Attributes} is recognized as a synonym
12726 for @code{No_Task_Attributes_Package}. This is retained for historical
12727 compatibility purposes (and a warning will be generated for its use if
12728 warnings on obsolescent features are activated).
12730 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
12731 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1ef}
12732 @subsection No_Task_Hierarchy
12735 @geindex No_Task_Hierarchy
12737 [RM D.7] All (non-environment) tasks depend
12738 directly on the environment task of the partition.
12740 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
12741 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1f0}
12742 @subsection No_Task_Termination
12745 @geindex No_Task_Termination
12747 [RM D.7] Tasks that terminate are erroneous.
12749 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
12750 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1f1}
12751 @subsection No_Tasking
12754 @geindex No_Tasking
12756 [GNAT] This restriction prevents the declaration of tasks or task types
12757 throughout the partition.  It is similar in effect to the use of
12758 @code{Max_Tasks => 0} except that violations are caught at compile time
12759 and cause an error message to be output either by the compiler or
12760 binder.
12762 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
12763 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1f2}
12764 @subsection No_Terminate_Alternatives
12767 @geindex No_Terminate_Alternatives
12769 [RM D.7] There are no selective accepts with terminate alternatives.
12771 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
12772 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1f3}
12773 @subsection No_Unchecked_Access
12776 @geindex No_Unchecked_Access
12778 [RM H.4] This restriction ensures at compile time that there are no
12779 occurrences of the Unchecked_Access attribute.
12781 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
12782 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1f4}
12783 @subsection No_Unchecked_Conversion
12786 @geindex No_Unchecked_Conversion
12788 [RM J.13] This restriction ensures at compile time that there are no semantic
12789 dependences on the predefined generic function Unchecked_Conversion.
12791 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
12792 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1f5}
12793 @subsection No_Unchecked_Deallocation
12796 @geindex No_Unchecked_Deallocation
12798 [RM J.13] This restriction ensures at compile time that there are no semantic
12799 dependences on the predefined generic procedure Unchecked_Deallocation.
12801 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
12802 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1f6}
12803 @subsection No_Use_Of_Entity
12806 @geindex No_Use_Of_Entity
12808 [GNAT] This restriction ensures at compile time that there are no references
12809 to the entity given in the form
12811 @example
12812 No_Use_Of_Entity => Name
12813 @end example
12815 where @code{Name} is the fully qualified entity, for example
12817 @example
12818 No_Use_Of_Entity => Ada.Text_IO.Put_Line
12819 @end example
12821 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
12822 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1f7}
12823 @subsection Pure_Barriers
12826 @geindex Pure_Barriers
12828 [GNAT] This restriction ensures at compile time that protected entry
12829 barriers are restricted to:
12832 @itemize *
12834 @item 
12835 components of the protected object (excluding selection from dereferences),
12837 @item 
12838 constant declarations,
12840 @item 
12841 named numbers,
12843 @item 
12844 enumeration literals,
12846 @item 
12847 integer literals,
12849 @item 
12850 real literals,
12852 @item 
12853 character literals,
12855 @item 
12856 implicitly defined comparison operators,
12858 @item 
12859 uses of the Standard."not" operator,
12861 @item 
12862 short-circuit operator,
12864 @item 
12865 the Count attribute
12866 @end itemize
12868 This restriction is a relaxation of the Simple_Barriers restriction,
12869 but still ensures absence of side effects, exceptions, and recursion
12870 during the evaluation of the barriers.
12872 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
12873 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1f8}
12874 @subsection Simple_Barriers
12877 @geindex Simple_Barriers
12879 [RM D.7] This restriction ensures at compile time that barriers in entry
12880 declarations for protected types are restricted to either static boolean
12881 expressions or references to simple boolean variables defined in the private
12882 part of the protected type.  No other form of entry barriers is permitted.
12884 @geindex Boolean_Entry_Barriers
12886 The restriction @code{Boolean_Entry_Barriers} is recognized as a
12887 synonym for @code{Simple_Barriers}. This is retained for historical
12888 compatibility purposes (and a warning will be generated for its use if
12889 warnings on obsolescent features are activated).
12891 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
12892 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1f9}
12893 @subsection Static_Priorities
12896 @geindex Static_Priorities
12898 [GNAT] This restriction ensures at compile time that all priority expressions
12899 are static, and that there are no dependences on the package
12900 @code{Ada.Dynamic_Priorities}.
12902 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
12903 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1fa}
12904 @subsection Static_Storage_Size
12907 @geindex Static_Storage_Size
12909 [GNAT] This restriction ensures at compile time that any expression appearing
12910 in a Storage_Size pragma or attribute definition clause is static.
12912 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
12913 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1fb}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{1fc}
12914 @section Program Unit Level Restrictions
12917 The second set of restriction identifiers
12918 does not require partition-wide consistency.
12919 The restriction may be enforced for a single
12920 compilation unit without any effect on any of the
12921 other compilation units in the partition.
12923 @menu
12924 * No_Elaboration_Code:: 
12925 * No_Dynamic_Sized_Objects:: 
12926 * No_Entry_Queue:: 
12927 * No_Implementation_Aspect_Specifications:: 
12928 * No_Implementation_Attributes:: 
12929 * No_Implementation_Identifiers:: 
12930 * No_Implementation_Pragmas:: 
12931 * No_Implementation_Restrictions:: 
12932 * No_Implementation_Units:: 
12933 * No_Implicit_Aliasing:: 
12934 * No_Implicit_Loops:: 
12935 * No_Obsolescent_Features:: 
12936 * No_Wide_Characters:: 
12937 * Static_Dispatch_Tables:: 
12938 * SPARK_05:: 
12940 @end menu
12942 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
12943 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{1fd}
12944 @subsection No_Elaboration_Code
12947 @geindex No_Elaboration_Code
12949 [GNAT] This restriction ensures at compile time that no elaboration code is
12950 generated.  Note that this is not the same condition as is enforced
12951 by pragma @code{Preelaborate}.  There are cases in which pragma
12952 @code{Preelaborate} still permits code to be generated (e.g., code
12953 to initialize a large array to all zeroes), and there are cases of units
12954 which do not meet the requirements for pragma @code{Preelaborate},
12955 but for which no elaboration code is generated.  Generally, it is
12956 the case that preelaborable units will meet the restrictions, with
12957 the exception of large aggregates initialized with an others_clause,
12958 and exception declarations (which generate calls to a run-time
12959 registry procedure).  This restriction is enforced on
12960 a unit by unit basis, it need not be obeyed consistently
12961 throughout a partition.
12963 In the case of aggregates with others, if the aggregate has a dynamic
12964 size, there is no way to eliminate the elaboration code (such dynamic
12965 bounds would be incompatible with @code{Preelaborate} in any case). If
12966 the bounds are static, then use of this restriction actually modifies
12967 the code choice of the compiler to avoid generating a loop, and instead
12968 generate the aggregate statically if possible, no matter how many times
12969 the data for the others clause must be repeatedly generated.
12971 It is not possible to precisely document
12972 the constructs which are compatible with this restriction, since,
12973 unlike most other restrictions, this is not a restriction on the
12974 source code, but a restriction on the generated object code. For
12975 example, if the source contains a declaration:
12977 @example
12978 Val : constant Integer := X;
12979 @end example
12981 where X is not a static constant, it may be possible, depending
12982 on complex optimization circuitry, for the compiler to figure
12983 out the value of X at compile time, in which case this initialization
12984 can be done by the loader, and requires no initialization code. It
12985 is not possible to document the precise conditions under which the
12986 optimizer can figure this out.
12988 Note that this the implementation of this restriction requires full
12989 code generation. If it is used in conjunction with "semantics only"
12990 checking, then some cases of violations may be missed.
12992 When this restriction is active, we are not requesting control-flow
12993 preservation with -fpreserve-control-flow, and the static elaboration model is
12994 used, the compiler is allowed to suppress the elaboration counter normally
12995 associated with the unit. This counter is typically used to check for access
12996 before elaboration and to control multiple elaboration attempts.
12998 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
12999 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{1fe}
13000 @subsection No_Dynamic_Sized_Objects
13003 @geindex No_Dynamic_Sized_Objects
13005 [GNAT] This restriction disallows certain constructs that might lead to the
13006 creation of dynamic-sized composite objects (or array or discriminated type).
13007 An array subtype indication is illegal if the bounds are not static
13008 or references to discriminants of an enclosing type.
13009 A discriminated subtype indication is illegal if the type has
13010 discriminant-dependent array components or a variant part, and the
13011 discriminants are not static. In addition, array and record aggregates are
13012 illegal in corresponding cases. Note that this restriction does not forbid
13013 access discriminants. It is often a good idea to combine this restriction
13014 with No_Secondary_Stack.
13016 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13017 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{1ff}
13018 @subsection No_Entry_Queue
13021 @geindex No_Entry_Queue
13023 [GNAT] This restriction is a declaration that any protected entry compiled in
13024 the scope of the restriction has at most one task waiting on the entry
13025 at any one time, and so no queue is required.  This restriction is not
13026 checked at compile time.  A program execution is erroneous if an attempt
13027 is made to queue a second task on such an entry.
13029 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13030 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{200}
13031 @subsection No_Implementation_Aspect_Specifications
13034 @geindex No_Implementation_Aspect_Specifications
13036 [RM 13.12.1] This restriction checks at compile time that no
13037 GNAT-defined aspects are present.  With this restriction, the only
13038 aspects that can be used are those defined in the Ada Reference Manual.
13040 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13041 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{201}
13042 @subsection No_Implementation_Attributes
13045 @geindex No_Implementation_Attributes
13047 [RM 13.12.1] This restriction checks at compile time that no
13048 GNAT-defined attributes are present.  With this restriction, the only
13049 attributes that can be used are those defined in the Ada Reference
13050 Manual.
13052 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13053 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{202}
13054 @subsection No_Implementation_Identifiers
13057 @geindex No_Implementation_Identifiers
13059 [RM 13.12.1] This restriction checks at compile time that no
13060 implementation-defined identifiers (marked with pragma Implementation_Defined)
13061 occur within language-defined packages.
13063 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13064 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{203}
13065 @subsection No_Implementation_Pragmas
13068 @geindex No_Implementation_Pragmas
13070 [RM 13.12.1] This restriction checks at compile time that no
13071 GNAT-defined pragmas are present.  With this restriction, the only
13072 pragmas that can be used are those defined in the Ada Reference Manual.
13074 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13075 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{204}
13076 @subsection No_Implementation_Restrictions
13079 @geindex No_Implementation_Restrictions
13081 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13082 identifiers (other than @code{No_Implementation_Restrictions} itself)
13083 are present.  With this restriction, the only other restriction identifiers
13084 that can be used are those defined in the Ada Reference Manual.
13086 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13087 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{205}
13088 @subsection No_Implementation_Units
13091 @geindex No_Implementation_Units
13093 [RM 13.12.1] This restriction checks at compile time that there is no
13094 mention in the context clause of any implementation-defined descendants
13095 of packages Ada, Interfaces, or System.
13097 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13098 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{206}
13099 @subsection No_Implicit_Aliasing
13102 @geindex No_Implicit_Aliasing
13104 [GNAT] This restriction, which is not required to be partition-wide consistent,
13105 requires an explicit aliased keyword for an object to which 'Access,
13106 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
13107 the 'Unrestricted_Access attribute for objects. Note: the reason that
13108 Unrestricted_Access is forbidden is that it would require the prefix
13109 to be aliased, and in such cases, it can always be replaced by
13110 the standard attribute Unchecked_Access which is preferable.
13112 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13113 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{207}
13114 @subsection No_Implicit_Loops
13117 @geindex No_Implicit_Loops
13119 [GNAT] This restriction ensures that the generated code of the unit marked
13120 with this restriction does not contain any implicit @code{for} loops, either by
13121 modifying the generated code where possible, or by rejecting any construct
13122 that would otherwise generate an implicit @code{for} loop. If this restriction is
13123 active, it is possible to build large array aggregates with all static
13124 components without generating an intermediate temporary, and without generating
13125 a loop to initialize individual components. Otherwise, a loop is created for
13126 arrays larger than about 5000 scalar components. Note that if this restriction
13127 is set in the spec of a package, it will not apply to its body.
13129 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13130 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{208}
13131 @subsection No_Obsolescent_Features
13134 @geindex No_Obsolescent_Features
13136 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13137 features are used, as defined in Annex J of the Ada Reference Manual.
13139 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13140 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{209}
13141 @subsection No_Wide_Characters
13144 @geindex No_Wide_Characters
13146 [GNAT] This restriction ensures at compile time that no uses of the types
13147 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13148 wide types
13149 appear, and that no wide or wide wide string or character literals
13150 appear in the program (that is literals representing characters not in
13151 type @code{Character}).
13153 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13154 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{20a}
13155 @subsection Static_Dispatch_Tables
13158 @geindex Static_Dispatch_Tables
13160 [GNAT] This restriction checks at compile time that all the artifacts
13161 associated with dispatch tables can be placed in read-only memory.
13163 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13164 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{20b}
13165 @subsection SPARK_05
13168 @geindex SPARK_05
13170 [GNAT] This restriction checks at compile time that some constructs forbidden
13171 in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
13172 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13173 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13174 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13175 follows:
13177 @example
13178 gnatprove -P project.gpr --mode=stone
13179 @end example
13181 or equivalently:
13183 @example
13184 gnatprove -P project.gpr --mode=check_all
13185 @end example
13187 With restriction @code{SPARK_05}, error messages related to SPARK 2005 restriction
13188 have the form:
13190 @example
13191 violation of restriction "SPARK_05" at <source-location>
13192  <error message>
13193 @end example
13195 @geindex SPARK
13197 The restriction @code{SPARK} is recognized as a synonym for @code{SPARK_05}. This is
13198 retained for historical compatibility purposes (and an unconditional warning
13199 will be generated for its use, advising replacement by @code{SPARK_05}).
13201 This is not a replacement for the semantic checks performed by the
13202 SPARK Examiner tool, as the compiler currently only deals with code,
13203 not SPARK 2005 annotations, and does not guarantee catching all
13204 cases of constructs forbidden by SPARK 2005.
13206 Thus it may well be the case that code which passes the compiler with
13207 the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
13208 the different visibility rules of the Examiner based on SPARK 2005
13209 @code{inherit} annotations.
13211 This restriction can be useful in providing an initial filter for code
13212 developed using SPARK 2005, or in examining legacy code to see how far
13213 it is from meeting SPARK 2005 restrictions.
13215 The list below summarizes the checks that are performed when this
13216 restriction is in force:
13219 @itemize *
13221 @item 
13222 No block statements
13224 @item 
13225 No case statements with only an others clause
13227 @item 
13228 Exit statements in loops must respect the SPARK 2005 language restrictions
13230 @item 
13231 No goto statements
13233 @item 
13234 Return can only appear as last statement in function
13236 @item 
13237 Function must have return statement
13239 @item 
13240 Loop parameter specification must include subtype mark
13242 @item 
13243 Prefix of expanded name cannot be a loop statement
13245 @item 
13246 Abstract subprogram not allowed
13248 @item 
13249 User-defined operators not allowed
13251 @item 
13252 Access type parameters not allowed
13254 @item 
13255 Default expressions for parameters not allowed
13257 @item 
13258 Default expressions for record fields not allowed
13260 @item 
13261 No tasking constructs allowed
13263 @item 
13264 Label needed at end of subprograms and packages
13266 @item 
13267 No mixing of positional and named parameter association
13269 @item 
13270 No access types as result type
13272 @item 
13273 No unconstrained arrays as result types
13275 @item 
13276 No null procedures
13278 @item 
13279 Initial and later declarations must be in correct order (declaration can't come after body)
13281 @item 
13282 No attributes on private types if full declaration not visible
13284 @item 
13285 No package declaration within package specification
13287 @item 
13288 No controlled types
13290 @item 
13291 No discriminant types
13293 @item 
13294 No overloading
13296 @item 
13297 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
13299 @item 
13300 Access attribute not allowed
13302 @item 
13303 Allocator not allowed
13305 @item 
13306 Result of catenation must be String
13308 @item 
13309 Operands of catenation must be string literal, static char or another catenation
13311 @item 
13312 No conditional expressions
13314 @item 
13315 No explicit dereference
13317 @item 
13318 Quantified expression not allowed
13320 @item 
13321 Slicing not allowed
13323 @item 
13324 No exception renaming
13326 @item 
13327 No generic renaming
13329 @item 
13330 No object renaming
13332 @item 
13333 No use clause
13335 @item 
13336 Aggregates must be qualified
13338 @item 
13339 Nonstatic choice in array aggregates not allowed
13341 @item 
13342 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
13344 @item 
13345 No mixing of positional and named association in aggregate, no multi choice
13347 @item 
13348 AND, OR and XOR for arrays only allowed when operands have same static bounds
13350 @item 
13351 Fixed point operands to * or / must be qualified or converted
13353 @item 
13354 Comparison operators not allowed for Booleans or arrays (except strings)
13356 @item 
13357 Equality not allowed for arrays with non-matching static bounds (except strings)
13359 @item 
13360 Conversion / qualification not allowed for arrays with non-matching static bounds
13362 @item 
13363 Subprogram declaration only allowed in package spec (unless followed by import)
13365 @item 
13366 Access types not allowed
13368 @item 
13369 Incomplete type declaration not allowed
13371 @item 
13372 Object and subtype declarations must respect SPARK 2005 restrictions
13374 @item 
13375 Digits or delta constraint not allowed
13377 @item 
13378 Decimal fixed point type not allowed
13380 @item 
13381 Aliasing of objects not allowed
13383 @item 
13384 Modular type modulus must be power of 2
13386 @item 
13387 Base not allowed on subtype mark
13389 @item 
13390 Unary operators not allowed on modular types (except not)
13392 @item 
13393 Untagged record cannot be null
13395 @item 
13396 No class-wide operations
13398 @item 
13399 Initialization expressions must respect SPARK 2005 restrictions
13401 @item 
13402 Nonstatic ranges not allowed except in iteration schemes
13404 @item 
13405 String subtypes must have lower bound of 1
13407 @item 
13408 Subtype of Boolean cannot have constraint
13410 @item 
13411 At most one tagged type or extension per package
13413 @item 
13414 Interface is not allowed
13416 @item 
13417 Character literal cannot be prefixed (selector name cannot be character literal)
13419 @item 
13420 Record aggregate cannot contain 'others'
13422 @item 
13423 Component association in record aggregate must contain a single choice
13425 @item 
13426 Ancestor part cannot be a type mark
13428 @item 
13429 Attributes 'Image, 'Width and 'Value not allowed
13431 @item 
13432 Functions may not update globals
13434 @item 
13435 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13437 @item 
13438 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13439 @end itemize
13441 The following restrictions are enforced, but note that they are actually more
13442 strict that the latest SPARK 2005 language definition:
13445 @itemize *
13447 @item 
13448 No derived types other than tagged type extensions
13450 @item 
13451 Subtype of unconstrained array must have constraint
13452 @end itemize
13454 This list summarises the main SPARK 2005 language rules that are not
13455 currently checked by the SPARK_05 restriction:
13458 @itemize *
13460 @item 
13461 SPARK 2005 annotations are treated as comments so are not checked at all
13463 @item 
13464 Based real literals not allowed
13466 @item 
13467 Objects cannot be initialized at declaration by calls to user-defined functions
13469 @item 
13470 Objects cannot be initialized at declaration by assignments from variables
13472 @item 
13473 Objects cannot be initialized at declaration by assignments from indexed/selected components
13475 @item 
13476 Ranges shall not be null
13478 @item 
13479 A fixed point delta expression must be a simple expression
13481 @item 
13482 Restrictions on where renaming declarations may be placed
13484 @item 
13485 Externals of mode 'out' cannot be referenced
13487 @item 
13488 Externals of mode 'in' cannot be updated
13490 @item 
13491 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13493 @item 
13494 Subprogram cannot have parent unit name
13496 @item 
13497 SPARK 2005 inherited subprogram must be prefixed with overriding
13499 @item 
13500 External variables (or functions that reference them) may not be passed as actual parameters
13502 @item 
13503 Globals must be explicitly mentioned in contract
13505 @item 
13506 Deferred constants cannot be completed by pragma Import
13508 @item 
13509 Package initialization cannot read/write variables from other packages
13511 @item 
13512 Prefix not allowed for entities that are directly visible
13514 @item 
13515 Identifier declaration can't override inherited package name
13517 @item 
13518 Cannot use Standard or other predefined packages as identifiers
13520 @item 
13521 After renaming, cannot use the original name
13523 @item 
13524 Subprograms can only be renamed to remove package prefix
13526 @item 
13527 Pragma import must be immediately after entity it names
13529 @item 
13530 No mutual recursion between multiple units (this can be checked with gnatcheck)
13531 @end itemize
13533 Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
13534 violations will be reported for constructs forbidden in SPARK 95,
13535 instead of SPARK 2005.
13537 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13538 @anchor{gnat_rm/implementation_advice doc}@anchor{20c}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{20d}
13539 @chapter Implementation Advice
13542 The main text of the Ada Reference Manual describes the required
13543 behavior of all Ada compilers, and the GNAT compiler conforms to
13544 these requirements.
13546 In addition, there are sections throughout the Ada Reference Manual headed
13547 by the phrase 'Implementation advice'.  These sections are not normative,
13548 i.e., they do not specify requirements that all compilers must
13549 follow.  Rather they provide advice on generally desirable behavior.
13550 They are not requirements, because they describe behavior that cannot
13551 be provided on all systems, or may be undesirable on some systems.
13553 As far as practical, GNAT follows the implementation advice in
13554 the Ada Reference Manual.  Each such RM section corresponds to a section
13555 in this chapter whose title specifies the
13556 RM section number and paragraph number and the subject of
13557 the advice.  The contents of each section consists of the RM text within
13558 quotation marks,
13559 followed by the GNAT interpretation of the advice.  Most often, this simply says
13560 'followed', which means that GNAT follows the advice.  However, in a
13561 number of cases, GNAT deliberately deviates from this advice, in which
13562 case the text describes what GNAT does and why.
13564 @geindex Error detection
13566 @menu
13567 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection. 
13568 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units. 
13569 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors. 
13570 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas. 
13571 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas. 
13572 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets. 
13573 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types. 
13574 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types. 
13575 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values. 
13576 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types. 
13577 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays. 
13578 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small. 
13579 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation. 
13580 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information. 
13581 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks. 
13582 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses. 
13583 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types. 
13584 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses. 
13585 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses. 
13586 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses. 
13587 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses. 
13588 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses. 
13589 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses. 
13590 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses. 
13591 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes. 
13592 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering. 
13593 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private. 
13594 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations. 
13595 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion. 
13596 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage. 
13597 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation. 
13598 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes. 
13599 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types. 
13600 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling. 
13601 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling. 
13602 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation. 
13603 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate. 
13604 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export. 
13605 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces. 
13606 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C. 
13607 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL. 
13608 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran. 
13609 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations. 
13610 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations. 
13611 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support. 
13612 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers. 
13613 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts. 
13614 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements. 
13615 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names. 
13616 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes. 
13617 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies. 
13618 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies. 
13619 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort. 
13620 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions. 
13621 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time. 
13622 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem. 
13623 * RM F(7); COBOL Support: RM F 7 COBOL Support. 
13624 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support. 
13625 * RM G; Numerics: RM G Numerics. 
13626 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types. 
13627 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions. 
13628 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements. 
13629 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy. 
13630 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy. 
13632 @end menu
13634 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13635 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{20e}
13636 @section RM 1.1.3(20): Error Detection
13639 @quotation
13641 "If an implementation detects the use of an unsupported Specialized Needs
13642 Annex feature at run time, it should raise @code{Program_Error} if
13643 feasible."
13644 @end quotation
13646 Not relevant.  All specialized needs annex features are either supported,
13647 or diagnosed at compile time.
13649 @geindex Child Units
13651 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13652 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{20f}
13653 @section RM 1.1.3(31): Child Units
13656 @quotation
13658 "If an implementation wishes to provide implementation-defined
13659 extensions to the functionality of a language-defined library unit, it
13660 should normally do so by adding children to the library unit."
13661 @end quotation
13663 Followed.
13665 @geindex Bounded errors
13667 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13668 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{210}
13669 @section RM 1.1.5(12): Bounded Errors
13672 @quotation
13674 "If an implementation detects a bounded error or erroneous
13675 execution, it should raise @code{Program_Error}."
13676 @end quotation
13678 Followed in all cases in which the implementation detects a bounded
13679 error or erroneous execution.  Not all such situations are detected at
13680 runtime.
13682 @geindex Pragmas
13684 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13685 @anchor{gnat_rm/implementation_advice id2}@anchor{211}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{212}
13686 @section RM 2.8(16): Pragmas
13689 @quotation
13691 "Normally, implementation-defined pragmas should have no semantic effect
13692 for error-free programs; that is, if the implementation-defined pragmas
13693 are removed from a working program, the program should still be legal,
13694 and should still have the same semantics."
13695 @end quotation
13697 The following implementation defined pragmas are exceptions to this
13698 rule:
13701 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx} 
13702 @headitem
13704 Pragma
13706 @tab
13708 Explanation
13710 @item
13712 @emph{Abort_Defer}
13714 @tab
13716 Affects semantics
13718 @item
13720 @emph{Ada_83}
13722 @tab
13724 Affects legality
13726 @item
13728 @emph{Assert}
13730 @tab
13732 Affects semantics
13734 @item
13736 @emph{CPP_Class}
13738 @tab
13740 Affects semantics
13742 @item
13744 @emph{CPP_Constructor}
13746 @tab
13748 Affects semantics
13750 @item
13752 @emph{Debug}
13754 @tab
13756 Affects semantics
13758 @item
13760 @emph{Interface_Name}
13762 @tab
13764 Affects semantics
13766 @item
13768 @emph{Machine_Attribute}
13770 @tab
13772 Affects semantics
13774 @item
13776 @emph{Unimplemented_Unit}
13778 @tab
13780 Affects legality
13782 @item
13784 @emph{Unchecked_Union}
13786 @tab
13788 Affects semantics
13790 @end multitable
13793 In each of the above cases, it is essential to the purpose of the pragma
13794 that this advice not be followed.  For details see
13795 @ref{7,,Implementation Defined Pragmas}.
13797 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
13798 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{213}
13799 @section RM 2.8(17-19): Pragmas
13802 @quotation
13804 "Normally, an implementation should not define pragmas that can
13805 make an illegal program legal, except as follows:
13808 @itemize *
13810 @item 
13811 A pragma used to complete a declaration, such as a pragma @code{Import};
13813 @item 
13814 A pragma used to configure the environment by adding, removing, or
13815 replacing @code{library_items}."
13816 @end itemize
13817 @end quotation
13819 See @ref{212,,RM 2.8(16); Pragmas}.
13821 @geindex Character Sets
13823 @geindex Alternative Character Sets
13825 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
13826 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{214}
13827 @section RM 3.5.2(5): Alternative Character Sets
13830 @quotation
13832 "If an implementation supports a mode with alternative interpretations
13833 for @code{Character} and @code{Wide_Character}, the set of graphic
13834 characters of @code{Character} should nevertheless remain a proper
13835 subset of the set of graphic characters of @code{Wide_Character}.  Any
13836 character set 'localizations' should be reflected in the results of
13837 the subprograms defined in the language-defined package
13838 @code{Characters.Handling} (see A.3) available in such a mode.  In a mode with
13839 an alternative interpretation of @code{Character}, the implementation should
13840 also support a corresponding change in what is a legal
13841 @code{identifier_letter}."
13842 @end quotation
13844 Not all wide character modes follow this advice, in particular the JIS
13845 and IEC modes reflect standard usage in Japan, and in these encoding,
13846 the upper half of the Latin-1 set is not part of the wide-character
13847 subset, since the most significant bit is used for wide character
13848 encoding.  However, this only applies to the external forms.  Internally
13849 there is no such restriction.
13851 @geindex Integer types
13853 @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
13854 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{215}
13855 @section RM 3.5.4(28): Integer Types
13858 @quotation
13860 "An implementation should support @code{Long_Integer} in addition to
13861 @code{Integer} if the target machine supports 32-bit (or longer)
13862 arithmetic.  No other named integer subtypes are recommended for package
13863 @code{Standard}.  Instead, appropriate named integer subtypes should be
13864 provided in the library package @code{Interfaces} (see B.2)."
13865 @end quotation
13867 @code{Long_Integer} is supported.  Other standard integer types are supported
13868 so this advice is not fully followed.  These types
13869 are supported for convenient interface to C, and so that all hardware
13870 types of the machine are easily available.
13872 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
13873 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{216}
13874 @section RM 3.5.4(29): Integer Types
13877 @quotation
13879 "An implementation for a two's complement machine should support
13880 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
13881 implementation should support a non-binary modules up to @code{Integer'Last}."
13882 @end quotation
13884 Followed.
13886 @geindex Enumeration values
13888 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
13889 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{217}
13890 @section RM 3.5.5(8): Enumeration Values
13893 @quotation
13895 "For the evaluation of a call on @code{S'Pos} for an enumeration
13896 subtype, if the value of the operand does not correspond to the internal
13897 code for any enumeration literal of its type (perhaps due to an
13898 un-initialized variable), then the implementation should raise
13899 @code{Program_Error}.  This is particularly important for enumeration
13900 types with noncontiguous internal codes specified by an
13901 enumeration_representation_clause."
13902 @end quotation
13904 Followed.
13906 @geindex Float types
13908 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
13909 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{218}
13910 @section RM 3.5.7(17): Float Types
13913 @quotation
13915 "An implementation should support @code{Long_Float} in addition to
13916 @code{Float} if the target machine supports 11 or more digits of
13917 precision.  No other named floating point subtypes are recommended for
13918 package @code{Standard}.  Instead, appropriate named floating point subtypes
13919 should be provided in the library package @code{Interfaces} (see B.2)."
13920 @end quotation
13922 @code{Short_Float} and @code{Long_Long_Float} are also provided.  The
13923 former provides improved compatibility with other implementations
13924 supporting this type.  The latter corresponds to the highest precision
13925 floating-point type supported by the hardware.  On most machines, this
13926 will be the same as @code{Long_Float}, but on some machines, it will
13927 correspond to the IEEE extended form.  The notable case is all ia32
13928 (x86) implementations, where @code{Long_Long_Float} corresponds to
13929 the 80-bit extended precision format supported in hardware on this
13930 processor.  Note that the 128-bit format on SPARC is not supported,
13931 since this is a software rather than a hardware format.
13933 @geindex Multidimensional arrays
13935 @geindex Arrays
13936 @geindex multidimensional
13938 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
13939 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{219}
13940 @section RM 3.6.2(11): Multidimensional Arrays
13943 @quotation
13945 "An implementation should normally represent multidimensional arrays in
13946 row-major order, consistent with the notation used for multidimensional
13947 array aggregates (see 4.3.3).  However, if a pragma @code{Convention}
13948 (@code{Fortran}, ...) applies to a multidimensional array type, then
13949 column-major order should be used instead (see B.5, @emph{Interfacing with Fortran})."
13950 @end quotation
13952 Followed.
13954 @geindex Duration'Small
13956 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
13957 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{21a}
13958 @section RM 9.6(30-31): Duration'Small
13961 @quotation
13963 "Whenever possible in an implementation, the value of @code{Duration'Small}
13964 should be no greater than 100 microseconds."
13965 @end quotation
13967 Followed.  (@code{Duration'Small} = 10**(-9)).
13969 @quotation
13971 "The time base for @code{delay_relative_statements} should be monotonic;
13972 it need not be the same time base as used for @code{Calendar.Clock}."
13973 @end quotation
13975 Followed.
13977 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
13978 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{21b}
13979 @section RM 10.2.1(12): Consistent Representation
13982 @quotation
13984 "In an implementation, a type declared in a pre-elaborated package should
13985 have the same representation in every elaboration of a given version of
13986 the package, whether the elaborations occur in distinct executions of
13987 the same program, or in executions of distinct programs or partitions
13988 that include the given version."
13989 @end quotation
13991 Followed, except in the case of tagged types.  Tagged types involve
13992 implicit pointers to a local copy of a dispatch table, and these pointers
13993 have representations which thus depend on a particular elaboration of the
13994 package.  It is not easy to see how it would be possible to follow this
13995 advice without severely impacting efficiency of execution.
13997 @geindex Exception information
13999 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14000 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{21c}
14001 @section RM 11.4.1(19): Exception Information
14004 @quotation
14006 "@code{Exception_Message} by default and @code{Exception_Information}
14007 should produce information useful for
14008 debugging.  @code{Exception_Message} should be short, about one
14009 line.  @code{Exception_Information} can be long.  @code{Exception_Message}
14010 should not include the
14011 @code{Exception_Name}.  @code{Exception_Information} should include both
14012 the @code{Exception_Name} and the @code{Exception_Message}."
14013 @end quotation
14015 Followed.  For each exception that doesn't have a specified
14016 @code{Exception_Message}, the compiler generates one containing the location
14017 of the raise statement.  This location has the form 'file_name:line', where
14018 file_name is the short file name (without path information) and line is the line
14019 number in the file.  Note that in the case of the Zero Cost Exception
14020 mechanism, these messages become redundant with the Exception_Information that
14021 contains a full backtrace of the calling sequence, so they are disabled.
14022 To disable explicitly the generation of the source location message, use the
14023 Pragma @code{Discard_Names}.
14025 @geindex Suppression of checks
14027 @geindex Checks
14028 @geindex suppression of
14030 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14031 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{21d}
14032 @section RM 11.5(28): Suppression of Checks
14035 @quotation
14037 "The implementation should minimize the code executed for checks that
14038 have been suppressed."
14039 @end quotation
14041 Followed.
14043 @geindex Representation clauses
14045 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14046 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{21e}
14047 @section RM 13.1 (21-24): Representation Clauses
14050 @quotation
14052 "The recommended level of support for all representation items is
14053 qualified as follows:
14055 An implementation need not support representation items containing
14056 nonstatic expressions, except that an implementation should support a
14057 representation item for a given entity if each nonstatic expression in
14058 the representation item is a name that statically denotes a constant
14059 declared before the entity."
14060 @end quotation
14062 Followed.  In fact, GNAT goes beyond the recommended level of support
14063 by allowing nonstatic expressions in some representation clauses even
14064 without the need to declare constants initialized with the values of
14065 such expressions.
14066 For example:
14068 @example
14069   X : Integer;
14070   Y : Float;
14071   for Y'Address use X'Address;>>
14074 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14075 for a given composite subtype, nor the size or storage place for an
14076 object (including a component) of a given composite subtype, unless the
14077 constraints on the subtype and its composite subcomponents (if any) are
14078 all static constraints."
14079 @end example
14081 Followed.  Size Clauses are not permitted on nonstatic components, as
14082 described above.
14084 @quotation
14086 "An aliased component, or a component whose type is by-reference, should
14087 always be allocated at an addressable location."
14088 @end quotation
14090 Followed.
14092 @geindex Packed types
14094 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14095 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{21f}
14096 @section RM 13.2(6-8): Packed Types
14099 @quotation
14101 "If a type is packed, then the implementation should try to minimize
14102 storage allocated to objects of the type, possibly at the expense of
14103 speed of accessing components, subject to reasonable complexity in
14104 addressing calculations.
14106 The recommended level of support pragma @code{Pack} is:
14108 For a packed record type, the components should be packed as tightly as
14109 possible subject to the Sizes of the component subtypes, and subject to
14110 any @emph{record_representation_clause} that applies to the type; the
14111 implementation may, but need not, reorder components or cross aligned
14112 word boundaries to improve the packing.  A component whose @code{Size} is
14113 greater than the word size may be allocated an integral number of words."
14114 @end quotation
14116 Followed.  Tight packing of arrays is supported for all component sizes
14117 up to 64-bits. If the array component size is 1 (that is to say, if
14118 the component is a boolean type or an enumeration type with two values)
14119 then values of the type are implicitly initialized to zero. This
14120 happens both for objects of the packed type, and for objects that have a
14121 subcomponent of the packed type.
14123 @quotation
14125 "An implementation should support Address clauses for imported
14126 subprograms."
14127 @end quotation
14129 Followed.
14131 @geindex Address clauses
14133 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14134 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{220}
14135 @section RM 13.3(14-19): Address Clauses
14138 @quotation
14140 "For an array @code{X}, @code{X'Address} should point at the first
14141 component of the array, and not at the array bounds."
14142 @end quotation
14144 Followed.
14146 @quotation
14148 "The recommended level of support for the @code{Address} attribute is:
14150 @code{X'Address} should produce a useful result if @code{X} is an
14151 object that is aliased or of a by-reference type, or is an entity whose
14152 @code{Address} has been specified."
14153 @end quotation
14155 Followed.  A valid address will be produced even if none of those
14156 conditions have been met.  If necessary, the object is forced into
14157 memory to ensure the address is valid.
14159 @quotation
14161 "An implementation should support @code{Address} clauses for imported
14162 subprograms."
14163 @end quotation
14165 Followed.
14167 @quotation
14169 "Objects (including subcomponents) that are aliased or of a by-reference
14170 type should be allocated on storage element boundaries."
14171 @end quotation
14173 Followed.
14175 @quotation
14177 "If the @code{Address} of an object is specified, or it is imported or exported,
14178 then the implementation should not perform optimizations based on
14179 assumptions of no aliases."
14180 @end quotation
14182 Followed.
14184 @geindex Alignment clauses
14186 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14187 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{221}
14188 @section RM 13.3(29-35): Alignment Clauses
14191 @quotation
14193 "The recommended level of support for the @code{Alignment} attribute for
14194 subtypes is:
14196 An implementation should support specified Alignments that are factors
14197 and multiples of the number of storage elements per word, subject to the
14198 following:"
14199 @end quotation
14201 Followed.
14203 @quotation
14205 "An implementation need not support specified Alignments for
14206 combinations of Sizes and Alignments that cannot be easily
14207 loaded and stored by available machine instructions."
14208 @end quotation
14210 Followed.
14212 @quotation
14214 "An implementation need not support specified Alignments that are
14215 greater than the maximum @code{Alignment} the implementation ever returns by
14216 default."
14217 @end quotation
14219 Followed.
14221 @quotation
14223 "The recommended level of support for the @code{Alignment} attribute for
14224 objects is:
14226 Same as above, for subtypes, but in addition:"
14227 @end quotation
14229 Followed.
14231 @quotation
14233 "For stand-alone library-level objects of statically constrained
14234 subtypes, the implementation should support all alignments
14235 supported by the target linker.  For example, page alignment is likely to
14236 be supported for such objects, but not for subtypes."
14237 @end quotation
14239 Followed.
14241 @geindex Size clauses
14243 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14244 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{222}
14245 @section RM 13.3(42-43): Size Clauses
14248 @quotation
14250 "The recommended level of support for the @code{Size} attribute of
14251 objects is:
14253 A @code{Size} clause should be supported for an object if the specified
14254 @code{Size} is at least as large as its subtype's @code{Size}, and
14255 corresponds to a size in storage elements that is a multiple of the
14256 object's @code{Alignment} (if the @code{Alignment} is nonzero)."
14257 @end quotation
14259 Followed.
14261 @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
14262 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{223}
14263 @section RM 13.3(50-56): Size Clauses
14266 @quotation
14268 "If the @code{Size} of a subtype is specified, and allows for efficient
14269 independent addressability (see 9.10) on the target architecture, then
14270 the @code{Size} of the following objects of the subtype should equal the
14271 @code{Size} of the subtype:
14273 Aliased objects (including components)."
14274 @end quotation
14276 Followed.
14278 @quotation
14280 "@cite{Size} clause on a composite subtype should not affect the
14281 internal layout of components."
14282 @end quotation
14284 Followed. But note that this can be overridden by use of the implementation
14285 pragma Implicit_Packing in the case of packed arrays.
14287 @quotation
14289 "The recommended level of support for the @code{Size} attribute of subtypes is:
14291 The @code{Size} (if not specified) of a static discrete or fixed point
14292 subtype should be the number of bits needed to represent each value
14293 belonging to the subtype using an unbiased representation, leaving space
14294 for a sign bit only if the subtype contains negative values.  If such a
14295 subtype is a first subtype, then an implementation should support a
14296 specified @code{Size} for it that reflects this representation."
14297 @end quotation
14299 Followed.
14301 @quotation
14303 "For a subtype implemented with levels of indirection, the @code{Size}
14304 should include the size of the pointers, but not the size of what they
14305 point at."
14306 @end quotation
14308 Followed.
14310 @geindex Component_Size clauses
14312 @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
14313 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{224}
14314 @section RM 13.3(71-73): Component Size Clauses
14317 @quotation
14319 "The recommended level of support for the @code{Component_Size}
14320 attribute is:
14322 An implementation need not support specified @code{Component_Sizes} that are
14323 less than the @code{Size} of the component subtype."
14324 @end quotation
14326 Followed.
14328 @quotation
14330 "An implementation should support specified Component_Sizes that
14331 are factors and multiples of the word size.  For such
14332 Component_Sizes, the array should contain no gaps between
14333 components.  For other Component_Sizes (if supported), the array
14334 should contain no gaps between components when packing is also
14335 specified; the implementation should forbid this combination in cases
14336 where it cannot support a no-gaps representation."
14337 @end quotation
14339 Followed.
14341 @geindex Enumeration representation clauses
14343 @geindex Representation clauses
14344 @geindex enumeration
14346 @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
14347 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{225}
14348 @section RM 13.4(9-10): Enumeration Representation Clauses
14351 @quotation
14353 "The recommended level of support for enumeration representation clauses
14356 An implementation need not support enumeration representation clauses
14357 for boolean types, but should at minimum support the internal codes in
14358 the range @code{System.Min_Int .. System.Max_Int}."
14359 @end quotation
14361 Followed.
14363 @geindex Record representation clauses
14365 @geindex Representation clauses
14366 @geindex records
14368 @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
14369 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{226}
14370 @section RM 13.5.1(17-22): Record Representation Clauses
14373 @quotation
14375 "The recommended level of support for
14376 @emph{record_representation_clause}s is:
14378 An implementation should support storage places that can be extracted
14379 with a load, mask, shift sequence of machine code, and set with a load,
14380 shift, mask, store sequence, given the available machine instructions
14381 and run-time model."
14382 @end quotation
14384 Followed.
14386 @quotation
14388 "A storage place should be supported if its size is equal to the
14389 @code{Size} of the component subtype, and it starts and ends on a
14390 boundary that obeys the @code{Alignment} of the component subtype."
14391 @end quotation
14393 Followed.
14395 @quotation
14397 "If the default bit ordering applies to the declaration of a given type,
14398 then for a component whose subtype's @code{Size} is less than the word
14399 size, any storage place that does not cross an aligned word boundary
14400 should be supported."
14401 @end quotation
14403 Followed.
14405 @quotation
14407 "An implementation may reserve a storage place for the tag field of a
14408 tagged type, and disallow other components from overlapping that place."
14409 @end quotation
14411 Followed.  The storage place for the tag field is the beginning of the tagged
14412 record, and its size is Address'Size.  GNAT will reject an explicit component
14413 clause for the tag field.
14415 @quotation
14417 "An implementation need not support a @emph{component_clause} for a
14418 component of an extension part if the storage place is not after the
14419 storage places of all components of the parent type, whether or not
14420 those storage places had been specified."
14421 @end quotation
14423 Followed.  The above advice on record representation clauses is followed,
14424 and all mentioned features are implemented.
14426 @geindex Storage place attributes
14428 @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
14429 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{227}
14430 @section RM 13.5.2(5): Storage Place Attributes
14433 @quotation
14435 "If a component is represented using some form of pointer (such as an
14436 offset) to the actual data of the component, and this data is contiguous
14437 with the rest of the object, then the storage place attributes should
14438 reflect the place of the actual data, not the pointer.  If a component is
14439 allocated discontinuously from the rest of the object, then a warning
14440 should be generated upon reference to one of its storage place
14441 attributes."
14442 @end quotation
14444 Followed.  There are no such components in GNAT.
14446 @geindex Bit ordering
14448 @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
14449 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{228}
14450 @section RM 13.5.3(7-8): Bit Ordering
14453 @quotation
14455 "The recommended level of support for the non-default bit ordering is:
14457 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14458 should support the non-default bit ordering in addition to the default
14459 bit ordering."
14460 @end quotation
14462 Followed.  Word size does not equal storage size in this implementation.
14463 Thus non-default bit ordering is not supported.
14465 @geindex Address
14466 @geindex as private type
14468 @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
14469 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{229}
14470 @section RM 13.7(37): Address as Private
14473 @quotation
14475 "@cite{Address} should be of a private type."
14476 @end quotation
14478 Followed.
14480 @geindex Operations
14481 @geindex on `@w{`}Address`@w{`}
14483 @geindex Address
14484 @geindex operations of
14486 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14487 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{22a}
14488 @section RM 13.7.1(16): Address Operations
14491 @quotation
14493 "Operations in @code{System} and its children should reflect the target
14494 environment semantics as closely as is reasonable.  For example, on most
14495 machines, it makes sense for address arithmetic to 'wrap around'.
14496 Operations that do not make sense should raise @code{Program_Error}."
14497 @end quotation
14499 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
14500 operation raises @code{Program_Error}, since all operations make sense.
14502 @geindex Unchecked conversion
14504 @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
14505 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{22b}
14506 @section RM 13.9(14-17): Unchecked Conversion
14509 @quotation
14511 "The @code{Size} of an array object should not include its bounds; hence,
14512 the bounds should not be part of the converted data."
14513 @end quotation
14515 Followed.
14517 @quotation
14519 "The implementation should not generate unnecessary run-time checks to
14520 ensure that the representation of @code{S} is a representation of the
14521 target type.  It should take advantage of the permission to return by
14522 reference when possible.  Restrictions on unchecked conversions should be
14523 avoided unless required by the target environment."
14524 @end quotation
14526 Followed.  There are no restrictions on unchecked conversion.  A warning is
14527 generated if the source and target types do not have the same size since
14528 the semantics in this case may be target dependent.
14530 @quotation
14532 "The recommended level of support for unchecked conversions is:
14534 Unchecked conversions should be supported and should be reversible in
14535 the cases where this clause defines the result.  To enable meaningful use
14536 of unchecked conversion, a contiguous representation should be used for
14537 elementary subtypes, for statically constrained array subtypes whose
14538 component subtype is one of the subtypes described in this paragraph,
14539 and for record subtypes without discriminants whose component subtypes
14540 are described in this paragraph."
14541 @end quotation
14543 Followed.
14545 @geindex Heap usage
14546 @geindex implicit
14548 @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
14549 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{22c}
14550 @section RM 13.11(23-25): Implicit Heap Usage
14553 @quotation
14555 "An implementation should document any cases in which it dynamically
14556 allocates heap storage for a purpose other than the evaluation of an
14557 allocator."
14558 @end quotation
14560 Followed, the only other points at which heap storage is dynamically
14561 allocated are as follows:
14564 @itemize *
14566 @item 
14567 At initial elaboration time, to allocate dynamically sized global
14568 objects.
14570 @item 
14571 To allocate space for a task when a task is created.
14573 @item 
14574 To extend the secondary stack dynamically when needed.  The secondary
14575 stack is used for returning variable length results.
14576 @end itemize
14579 @quotation
14581 "A default (implementation-provided) storage pool for an
14582 access-to-constant type should not have overhead to support deallocation of
14583 individual objects."
14584 @end quotation
14586 Followed.
14588 @quotation
14590 "A storage pool for an anonymous access type should be created at the
14591 point of an allocator for the type, and be reclaimed when the designated
14592 object becomes inaccessible."
14593 @end quotation
14595 Followed.
14597 @geindex Unchecked deallocation
14599 @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
14600 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{22d}
14601 @section RM 13.11.2(17): Unchecked Deallocation
14604 @quotation
14606 "For a standard storage pool, @code{Free} should actually reclaim the
14607 storage."
14608 @end quotation
14610 Followed.
14612 @geindex Stream oriented attributes
14614 @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
14615 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{22e}
14616 @section RM 13.13.2(17): Stream Oriented Attributes
14619 @quotation
14621 "If a stream element is the same size as a storage element, then the
14622 normal in-memory representation should be used by @code{Read} and
14623 @code{Write} for scalar objects.  Otherwise, @code{Read} and @code{Write}
14624 should use the smallest number of stream elements needed to represent
14625 all values in the base range of the scalar type."
14626 @end quotation
14628 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
14629 which specifies using the size of the first subtype.
14630 However, such an implementation is based on direct binary
14631 representations and is therefore target- and endianness-dependent.
14632 To address this issue, GNAT also supplies an alternate implementation
14633 of the stream attributes @code{Read} and @code{Write},
14634 which uses the target-independent XDR standard representation
14635 for scalar types.
14637 @geindex XDR representation
14639 @geindex Read attribute
14641 @geindex Write attribute
14643 @geindex Stream oriented attributes
14645 The XDR implementation is provided as an alternative body of the
14646 @code{System.Stream_Attributes} package, in the file
14647 @code{s-stratt-xdr.adb} in the GNAT library.
14648 There is no @code{s-stratt-xdr.ads} file.
14649 In order to install the XDR implementation, do the following:
14652 @itemize *
14654 @item 
14655 Replace the default implementation of the
14656 @code{System.Stream_Attributes} package with the XDR implementation.
14657 For example on a Unix platform issue the commands:
14659 @example
14660 $ mv s-stratt.adb s-stratt-default.adb
14661 $ mv s-stratt-xdr.adb s-stratt.adb
14662 @end example
14664 @item 
14665 Rebuild the GNAT run-time library as documented in
14666 the @emph{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14667 @end itemize
14669 @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
14670 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{22f}
14671 @section RM A.1(52): Names of Predefined Numeric Types
14674 @quotation
14676 "If an implementation provides additional named predefined integer types,
14677 then the names should end with @code{Integer} as in
14678 @code{Long_Integer}.  If an implementation provides additional named
14679 predefined floating point types, then the names should end with
14680 @code{Float} as in @code{Long_Float}."
14681 @end quotation
14683 Followed.
14685 @geindex Ada.Characters.Handling
14687 @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
14688 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{230}
14689 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14692 @quotation
14694 "If an implementation provides a localized definition of @code{Character}
14695 or @code{Wide_Character}, then the effects of the subprograms in
14696 @code{Characters.Handling} should reflect the localizations.
14697 See also 3.5.2."
14698 @end quotation
14700 Followed.  GNAT provides no such localized definitions.
14702 @geindex Bounded-length strings
14704 @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
14705 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{231}
14706 @section RM A.4.4(106): Bounded-Length String Handling
14709 @quotation
14711 "Bounded string objects should not be implemented by implicit pointers
14712 and dynamic allocation."
14713 @end quotation
14715 Followed.  No implicit pointers or dynamic allocation are used.
14717 @geindex Random number generation
14719 @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
14720 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{232}
14721 @section RM A.5.2(46-47): Random Number Generation
14724 @quotation
14726 "Any storage associated with an object of type @code{Generator} should be
14727 reclaimed on exit from the scope of the object."
14728 @end quotation
14730 Followed.
14732 @quotation
14734 "If the generator period is sufficiently long in relation to the number
14735 of distinct initiator values, then each possible value of
14736 @code{Initiator} passed to @code{Reset} should initiate a sequence of
14737 random numbers that does not, in a practical sense, overlap the sequence
14738 initiated by any other value.  If this is not possible, then the mapping
14739 between initiator values and generator states should be a rapidly
14740 varying function of the initiator value."
14741 @end quotation
14743 Followed.  The generator period is sufficiently long for the first
14744 condition here to hold true.
14746 @geindex Get_Immediate
14748 @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
14749 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{233}
14750 @section RM A.10.7(23): @code{Get_Immediate}
14753 @quotation
14755 "The @code{Get_Immediate} procedures should be implemented with
14756 unbuffered input.  For a device such as a keyboard, input should be
14757 available if a key has already been typed, whereas for a disk
14758 file, input should always be available except at end of file.  For a file
14759 associated with a keyboard-like device, any line-editing features of the
14760 underlying operating system should be disabled during the execution of
14761 @code{Get_Immediate}."
14762 @end quotation
14764 Followed on all targets except VxWorks. For VxWorks, there is no way to
14765 provide this functionality that does not result in the input buffer being
14766 flushed before the @code{Get_Immediate} call. A special unit
14767 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
14768 this functionality.
14770 @geindex Export
14772 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
14773 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{234}
14774 @section RM B.1(39-41): Pragma @code{Export}
14777 @quotation
14779 "If an implementation supports pragma @code{Export} to a given language,
14780 then it should also allow the main subprogram to be written in that
14781 language.  It should support some mechanism for invoking the elaboration
14782 of the Ada library units included in the system, and for invoking the
14783 finalization of the environment task.  On typical systems, the
14784 recommended mechanism is to provide two subprograms whose link names are
14785 @code{adainit} and @code{adafinal}.  @code{adainit} should contain the
14786 elaboration code for library units.  @code{adafinal} should contain the
14787 finalization code.  These subprograms should have no effect the second
14788 and subsequent time they are called."
14789 @end quotation
14791 Followed.
14793 @quotation
14795 "Automatic elaboration of pre-elaborated packages should be
14796 provided when pragma @code{Export} is supported."
14797 @end quotation
14799 Followed when the main program is in Ada.  If the main program is in a
14800 foreign language, then
14801 @code{adainit} must be called to elaborate pre-elaborated
14802 packages.
14804 @quotation
14806 "For each supported convention @emph{L} other than @code{Intrinsic}, an
14807 implementation should support @code{Import} and @code{Export} pragmas
14808 for objects of @emph{L}-compatible types and for subprograms, and pragma
14809 @cite{Convention} for @emph{L}-eligible types and for subprograms,
14810 presuming the other language has corresponding features.  Pragma
14811 @code{Convention} need not be supported for scalar types."
14812 @end quotation
14814 Followed.
14816 @geindex Package Interfaces
14818 @geindex Interfaces
14820 @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
14821 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{235}
14822 @section RM B.2(12-13): Package @code{Interfaces}
14825 @quotation
14827 "For each implementation-defined convention identifier, there should be a
14828 child package of package Interfaces with the corresponding name.  This
14829 package should contain any declarations that would be useful for
14830 interfacing to the language (implementation) represented by the
14831 convention.  Any declarations useful for interfacing to any language on
14832 the given hardware architecture should be provided directly in
14833 @code{Interfaces}."
14834 @end quotation
14836 Followed.
14838 @quotation
14840 "An implementation supporting an interface to C, COBOL, or Fortran should
14841 provide the corresponding package or packages described in the following
14842 clauses."
14843 @end quotation
14845 Followed.  GNAT provides all the packages described in this section.
14847 @geindex C
14848 @geindex interfacing with
14850 @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
14851 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{236}
14852 @section RM B.3(63-71): Interfacing with C
14855 @quotation
14857 "An implementation should support the following interface correspondences
14858 between Ada and C."
14859 @end quotation
14861 Followed.
14863 @quotation
14865 "An Ada procedure corresponds to a void-returning C function."
14866 @end quotation
14868 Followed.
14870 @quotation
14872 "An Ada function corresponds to a non-void C function."
14873 @end quotation
14875 Followed.
14877 @quotation
14879 "An Ada @code{in} scalar parameter is passed as a scalar argument to a C
14880 function."
14881 @end quotation
14883 Followed.
14885 @quotation
14887 "An Ada @code{in} parameter of an access-to-object type with designated
14888 type @code{T} is passed as a @code{t*} argument to a C function,
14889 where @code{t} is the C type corresponding to the Ada type @code{T}."
14890 @end quotation
14892 Followed.
14894 @quotation
14896 "An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
14897 parameter of an elementary type @code{T}, is passed as a @code{t*}
14898 argument to a C function, where @code{t} is the C type corresponding to
14899 the Ada type @code{T}.  In the case of an elementary @code{out} or
14900 @code{in out} parameter, a pointer to a temporary copy is used to
14901 preserve by-copy semantics."
14902 @end quotation
14904 Followed.
14906 @quotation
14908 "An Ada parameter of a record type @code{T}, of any mode, is passed as a
14909 @code{t*} argument to a C function, where @code{t} is the C
14910 structure corresponding to the Ada type @code{T}."
14911 @end quotation
14913 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
14914 pragma, or Convention, or by explicitly specifying the mechanism for a given
14915 call using an extended import or export pragma.
14917 @quotation
14919 "An Ada parameter of an array type with component type @code{T}, of any
14920 mode, is passed as a @code{t*} argument to a C function, where
14921 @code{t} is the C type corresponding to the Ada type @code{T}."
14922 @end quotation
14924 Followed.
14926 @quotation
14928 "An Ada parameter of an access-to-subprogram type is passed as a pointer
14929 to a C function whose prototype corresponds to the designated
14930 subprogram's specification."
14931 @end quotation
14933 Followed.
14935 @geindex COBOL
14936 @geindex interfacing with
14938 @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
14939 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{237}
14940 @section RM B.4(95-98): Interfacing with COBOL
14943 @quotation
14945 "An Ada implementation should support the following interface
14946 correspondences between Ada and COBOL."
14947 @end quotation
14949 Followed.
14951 @quotation
14953 "An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
14954 the COBOL type corresponding to @code{T}."
14955 @end quotation
14957 Followed.
14959 @quotation
14961 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
14962 the corresponding COBOL type."
14963 @end quotation
14965 Followed.
14967 @quotation
14969 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
14970 COBOL type corresponding to the Ada parameter type; for scalars, a local
14971 copy is used if necessary to ensure by-copy semantics."
14972 @end quotation
14974 Followed.
14976 @geindex Fortran
14977 @geindex interfacing with
14979 @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
14980 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{238}
14981 @section RM B.5(22-26): Interfacing with Fortran
14984 @quotation
14986 "An Ada implementation should support the following interface
14987 correspondences between Ada and Fortran:"
14988 @end quotation
14990 Followed.
14992 @quotation
14994 "An Ada procedure corresponds to a Fortran subroutine."
14995 @end quotation
14997 Followed.
14999 @quotation
15001 "An Ada function corresponds to a Fortran function."
15002 @end quotation
15004 Followed.
15006 @quotation
15008 "An Ada parameter of an elementary, array, or record type @code{T} is
15009 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15010 the Fortran type corresponding to the Ada type @code{T}, and where the
15011 INTENT attribute of the corresponding dummy argument matches the Ada
15012 formal parameter mode; the Fortran implementation's parameter passing
15013 conventions are used.  For elementary types, a local copy is used if
15014 necessary to ensure by-copy semantics."
15015 @end quotation
15017 Followed.
15019 @quotation
15021 "An Ada parameter of an access-to-subprogram type is passed as a
15022 reference to a Fortran procedure whose interface corresponds to the
15023 designated subprogram's specification."
15024 @end quotation
15026 Followed.
15028 @geindex Machine operations
15030 @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
15031 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{239}
15032 @section RM C.1(3-5): Access to Machine Operations
15035 @quotation
15037 "The machine code or intrinsic support should allow access to all
15038 operations normally available to assembly language programmers for the
15039 target environment, including privileged instructions, if any."
15040 @end quotation
15042 Followed.
15044 @quotation
15046 "The interfacing pragmas (see Annex B) should support interface to
15047 assembler; the default assembler should be associated with the
15048 convention identifier @code{Assembler}."
15049 @end quotation
15051 Followed.
15053 @quotation
15055 "If an entity is exported to assembly language, then the implementation
15056 should allocate it at an addressable location, and should ensure that it
15057 is retained by the linking process, even if not otherwise referenced
15058 from the Ada code.  The implementation should assume that any call to a
15059 machine code or assembler subprogram is allowed to read or update every
15060 object that is specified as exported."
15061 @end quotation
15063 Followed.
15065 @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
15066 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{23a}
15067 @section RM C.1(10-16): Access to Machine Operations
15070 @quotation
15072 "The implementation should ensure that little or no overhead is
15073 associated with calling intrinsic and machine-code subprograms."
15074 @end quotation
15076 Followed for both intrinsics and machine-code subprograms.
15078 @quotation
15080 "It is recommended that intrinsic subprograms be provided for convenient
15081 access to any machine operations that provide special capabilities or
15082 efficiency and that are not otherwise available through the language
15083 constructs."
15084 @end quotation
15086 Followed.  A full set of machine operation intrinsic subprograms is provided.
15088 @quotation
15090 "Atomic read-modify-write operations---e.g., test and set, compare and
15091 swap, decrement and test, enqueue/dequeue."
15092 @end quotation
15094 Followed on any target supporting such operations.
15096 @quotation
15098 "Standard numeric functions---e.g.:, sin, log."
15099 @end quotation
15101 Followed on any target supporting such operations.
15103 @quotation
15105 "String manipulation operations---e.g.:, translate and test."
15106 @end quotation
15108 Followed on any target supporting such operations.
15110 @quotation
15112 "Vector operations---e.g.:, compare vector against thresholds."
15113 @end quotation
15115 Followed on any target supporting such operations.
15117 @quotation
15119 "Direct operations on I/O ports."
15120 @end quotation
15122 Followed on any target supporting such operations.
15124 @geindex Interrupt support
15126 @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
15127 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{23b}
15128 @section RM C.3(28): Interrupt Support
15131 @quotation
15133 "If the @code{Ceiling_Locking} policy is not in effect, the
15134 implementation should provide means for the application to specify which
15135 interrupts are to be blocked during protected actions, if the underlying
15136 system allows for a finer-grain control of interrupt blocking."
15137 @end quotation
15139 Followed.  The underlying system does not allow for finer-grain control
15140 of interrupt blocking.
15142 @geindex Protected procedure handlers
15144 @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
15145 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{23c}
15146 @section RM C.3.1(20-21): Protected Procedure Handlers
15149 @quotation
15151 "Whenever possible, the implementation should allow interrupt handlers to
15152 be called directly by the hardware."
15153 @end quotation
15155 Followed on any target where the underlying operating system permits
15156 such direct calls.
15158 @quotation
15160 "Whenever practical, violations of any
15161 implementation-defined restrictions should be detected before run time."
15162 @end quotation
15164 Followed.  Compile time warnings are given when possible.
15166 @geindex Package `@w{`}Interrupts`@w{`}
15168 @geindex Interrupts
15170 @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
15171 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{23d}
15172 @section RM C.3.2(25): Package @code{Interrupts}
15175 @quotation
15177 "If implementation-defined forms of interrupt handler procedures are
15178 supported, such as protected procedures with parameters, then for each
15179 such form of a handler, a type analogous to @code{Parameterless_Handler}
15180 should be specified in a child package of @code{Interrupts}, with the
15181 same operations as in the predefined package Interrupts."
15182 @end quotation
15184 Followed.
15186 @geindex Pre-elaboration requirements
15188 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15189 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{23e}
15190 @section RM C.4(14): Pre-elaboration Requirements
15193 @quotation
15195 "It is recommended that pre-elaborated packages be implemented in such a
15196 way that there should be little or no code executed at run time for the
15197 elaboration of entities not already covered by the Implementation
15198 Requirements."
15199 @end quotation
15201 Followed.  Executable code is generated in some cases, e.g., loops
15202 to initialize large arrays.
15204 @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
15205 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{23f}
15206 @section RM C.5(8): Pragma @code{Discard_Names}
15209 @quotation
15211 "If the pragma applies to an entity, then the implementation should
15212 reduce the amount of storage used for storing names associated with that
15213 entity."
15214 @end quotation
15216 Followed.
15218 @geindex Package Task_Attributes
15220 @geindex Task_Attributes
15222 @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
15223 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{240}
15224 @section RM C.7.2(30): The Package Task_Attributes
15227 @quotation
15229 "Some implementations are targeted to domains in which memory use at run
15230 time must be completely deterministic.  For such implementations, it is
15231 recommended that the storage for task attributes will be pre-allocated
15232 statically and not from the heap.  This can be accomplished by either
15233 placing restrictions on the number and the size of the task's
15234 attributes, or by using the pre-allocated storage for the first @code{N}
15235 attribute objects, and the heap for the others.  In the latter case,
15236 @code{N} should be documented."
15237 @end quotation
15239 Not followed.  This implementation is not targeted to such a domain.
15241 @geindex Locking Policies
15243 @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
15244 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{241}
15245 @section RM D.3(17): Locking Policies
15248 @quotation
15250 "The implementation should use names that end with @code{_Locking} for
15251 locking policies defined by the implementation."
15252 @end quotation
15254 Followed.  Two implementation-defined locking policies are defined,
15255 whose names (@code{Inheritance_Locking} and
15256 @code{Concurrent_Readers_Locking}) follow this suggestion.
15258 @geindex Entry queuing policies
15260 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15261 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{242}
15262 @section RM D.4(16): Entry Queuing Policies
15265 @quotation
15267 "Names that end with @code{_Queuing} should be used
15268 for all implementation-defined queuing policies."
15269 @end quotation
15271 Followed.  No such implementation-defined queuing policies exist.
15273 @geindex Preemptive abort
15275 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15276 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{243}
15277 @section RM D.6(9-10): Preemptive Abort
15280 @quotation
15282 "Even though the @emph{abort_statement} is included in the list of
15283 potentially blocking operations (see 9.5.1), it is recommended that this
15284 statement be implemented in a way that never requires the task executing
15285 the @emph{abort_statement} to block."
15286 @end quotation
15288 Followed.
15290 @quotation
15292 "On a multi-processor, the delay associated with aborting a task on
15293 another processor should be bounded; the implementation should use
15294 periodic polling, if necessary, to achieve this."
15295 @end quotation
15297 Followed.
15299 @geindex Tasking restrictions
15301 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15302 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{244}
15303 @section RM D.7(21): Tasking Restrictions
15306 @quotation
15308 "When feasible, the implementation should take advantage of the specified
15309 restrictions to produce a more efficient implementation."
15310 @end quotation
15312 GNAT currently takes advantage of these restrictions by providing an optimized
15313 run time when the Ravenscar profile and the GNAT restricted run time set
15314 of restrictions are specified.  See pragma @code{Profile (Ravenscar)} and
15315 pragma @code{Profile (Restricted)} for more details.
15317 @geindex Time
15318 @geindex monotonic
15320 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15321 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{245}
15322 @section RM D.8(47-49): Monotonic Time
15325 @quotation
15327 "When appropriate, implementations should provide configuration
15328 mechanisms to change the value of @code{Tick}."
15329 @end quotation
15331 Such configuration mechanisms are not appropriate to this implementation
15332 and are thus not supported.
15334 @quotation
15336 "It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15337 be implemented as transformations of the same time base."
15338 @end quotation
15340 Followed.
15342 @quotation
15344 "It is recommended that the best time base which exists in
15345 the underlying system be available to the application through
15346 @code{Clock}.  @cite{Best} may mean highest accuracy or largest range."
15347 @end quotation
15349 Followed.
15351 @geindex Partition communication subsystem
15353 @geindex PCS
15355 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15356 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{246}
15357 @section RM E.5(28-29): Partition Communication Subsystem
15360 @quotation
15362 "Whenever possible, the PCS on the called partition should allow for
15363 multiple tasks to call the RPC-receiver with different messages and
15364 should allow them to block until the corresponding subprogram body
15365 returns."
15366 @end quotation
15368 Followed by GLADE, a separately supplied PCS that can be used with
15369 GNAT.
15371 @quotation
15373 "The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15374 should raise @code{Storage_Error} if it runs out of space trying to
15375 write the @code{Item} into the stream."
15376 @end quotation
15378 Followed by GLADE, a separately supplied PCS that can be used with
15379 GNAT.
15381 @geindex COBOL support
15383 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15384 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{247}
15385 @section RM F(7): COBOL Support
15388 @quotation
15390 "If COBOL (respectively, C) is widely supported in the target
15391 environment, implementations supporting the Information Systems Annex
15392 should provide the child package @code{Interfaces.COBOL} (respectively,
15393 @code{Interfaces.C}) specified in Annex B and should support a
15394 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15395 pragmas (see Annex B), thus allowing Ada programs to interface with
15396 programs written in that language."
15397 @end quotation
15399 Followed.
15401 @geindex Decimal radix support
15403 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15404 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{248}
15405 @section RM F.1(2): Decimal Radix Support
15408 @quotation
15410 "Packed decimal should be used as the internal representation for objects
15411 of subtype @code{S} when @code{S}'Machine_Radix = 10."
15412 @end quotation
15414 Not followed.  GNAT ignores @code{S}'Machine_Radix and always uses binary
15415 representations.
15417 @geindex Numerics
15419 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15420 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{249}
15421 @section RM G: Numerics
15424 @quotation
15426 "If Fortran (respectively, C) is widely supported in the target
15427 environment, implementations supporting the Numerics Annex
15428 should provide the child package @code{Interfaces.Fortran} (respectively,
15429 @code{Interfaces.C}) specified in Annex B and should support a
15430 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15431 pragmas (see Annex B), thus allowing Ada programs to interface with
15432 programs written in that language."
15433 @end quotation
15435 Followed.
15437 @geindex Complex types
15439 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15440 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{24a}
15441 @section RM G.1.1(56-58): Complex Types
15444 @quotation
15446 "Because the usual mathematical meaning of multiplication of a complex
15447 operand and a real operand is that of the scaling of both components of
15448 the former by the latter, an implementation should not perform this
15449 operation by first promoting the real operand to complex type and then
15450 performing a full complex multiplication.  In systems that, in the
15451 future, support an Ada binding to IEC 559:1989, the latter technique
15452 will not generate the required result when one of the components of the
15453 complex operand is infinite.  (Explicit multiplication of the infinite
15454 component by the zero component obtained during promotion yields a NaN
15455 that propagates into the final result.) Analogous advice applies in the
15456 case of multiplication of a complex operand and a pure-imaginary
15457 operand, and in the case of division of a complex operand by a real or
15458 pure-imaginary operand."
15459 @end quotation
15461 Not followed.
15463 @quotation
15465 "Similarly, because the usual mathematical meaning of addition of a
15466 complex operand and a real operand is that the imaginary operand remains
15467 unchanged, an implementation should not perform this operation by first
15468 promoting the real operand to complex type and then performing a full
15469 complex addition.  In implementations in which the @code{Signed_Zeros}
15470 attribute of the component type is @code{True} (and which therefore
15471 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15472 predefined arithmetic operations), the latter technique will not
15473 generate the required result when the imaginary component of the complex
15474 operand is a negatively signed zero.  (Explicit addition of the negative
15475 zero to the zero obtained during promotion yields a positive zero.)
15476 Analogous advice applies in the case of addition of a complex operand
15477 and a pure-imaginary operand, and in the case of subtraction of a
15478 complex operand and a real or pure-imaginary operand."
15479 @end quotation
15481 Not followed.
15483 @quotation
15485 "Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15486 attempt to provide a rational treatment of the signs of zero results and
15487 result components.  As one example, the result of the @code{Argument}
15488 function should have the sign of the imaginary component of the
15489 parameter @code{X} when the point represented by that parameter lies on
15490 the positive real axis; as another, the sign of the imaginary component
15491 of the @code{Compose_From_Polar} function should be the same as
15492 (respectively, the opposite of) that of the @code{Argument} parameter when that
15493 parameter has a value of zero and the @code{Modulus} parameter has a
15494 nonnegative (respectively, negative) value."
15495 @end quotation
15497 Followed.
15499 @geindex Complex elementary functions
15501 @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
15502 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{24b}
15503 @section RM G.1.2(49): Complex Elementary Functions
15506 @quotation
15508 "Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15509 @code{True} should attempt to provide a rational treatment of the signs
15510 of zero results and result components.  For example, many of the complex
15511 elementary functions have components that are odd functions of one of
15512 the parameter components; in these cases, the result component should
15513 have the sign of the parameter component at the origin.  Other complex
15514 elementary functions have zero components whose sign is opposite that of
15515 a parameter component at the origin, or is always positive or always
15516 negative."
15517 @end quotation
15519 Followed.
15521 @geindex Accuracy requirements
15523 @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
15524 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{24c}
15525 @section RM G.2.4(19): Accuracy Requirements
15528 @quotation
15530 "The versions of the forward trigonometric functions without a
15531 @code{Cycle} parameter should not be implemented by calling the
15532 corresponding version with a @code{Cycle} parameter of
15533 @code{2.0*Numerics.Pi}, since this will not provide the required
15534 accuracy in some portions of the domain.  For the same reason, the
15535 version of @code{Log} without a @code{Base} parameter should not be
15536 implemented by calling the corresponding version with a @code{Base}
15537 parameter of @code{Numerics.e}."
15538 @end quotation
15540 Followed.
15542 @geindex Complex arithmetic accuracy
15544 @geindex Accuracy
15545 @geindex complex arithmetic
15547 @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
15548 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{24d}
15549 @section RM G.2.6(15): Complex Arithmetic Accuracy
15552 @quotation
15554 "The version of the @code{Compose_From_Polar} function without a
15555 @code{Cycle} parameter should not be implemented by calling the
15556 corresponding version with a @code{Cycle} parameter of
15557 @code{2.0*Numerics.Pi}, since this will not provide the required
15558 accuracy in some portions of the domain."
15559 @end quotation
15561 Followed.
15563 @geindex Sequential elaboration policy
15565 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15566 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{24e}
15567 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15570 @quotation
15572 "If the partition elaboration policy is @code{Sequential} and the
15573 Environment task becomes permanently blocked during elaboration then the
15574 partition is deadlocked and it is recommended that the partition be
15575 immediately terminated."
15576 @end quotation
15578 Not followed.
15580 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15581 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{24f}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{250}
15582 @chapter Implementation Defined Characteristics
15585 In addition to the implementation dependent pragmas and attributes, and the
15586 implementation advice, there are a number of other Ada features that are
15587 potentially implementation dependent and are designated as
15588 implementation-defined. These are mentioned throughout the Ada Reference
15589 Manual, and are summarized in Annex M.
15591 A requirement for conforming Ada compilers is that they provide
15592 documentation describing how the implementation deals with each of these
15593 issues.  In this chapter you will find each point in Annex M listed,
15594 followed by a description of how GNAT
15595 handles the implementation dependence.
15597 You can use this chapter as a guide to minimizing implementation
15598 dependent features in your programs if portability to other compilers
15599 and other operating systems is an important consideration.  The numbers
15600 in each entry below correspond to the paragraph numbers in the Ada
15601 Reference Manual.
15604 @itemize *
15606 @item 
15607 "Whether or not each recommendation given in Implementation
15608 Advice is followed.  See 1.1.2(37)."
15609 @end itemize
15611 See @ref{a,,Implementation Advice}.
15614 @itemize *
15616 @item 
15617 "Capacity limitations of the implementation.  See 1.1.3(3)."
15618 @end itemize
15620 The complexity of programs that can be processed is limited only by the
15621 total amount of available virtual memory, and disk space for the
15622 generated object files.
15625 @itemize *
15627 @item 
15628 "Variations from the standard that are impractical to avoid
15629 given the implementation's execution environment.  See 1.1.3(6)."
15630 @end itemize
15632 There are no variations from the standard.
15635 @itemize *
15637 @item 
15638 "Which code_statements cause external
15639 interactions.  See 1.1.3(10)."
15640 @end itemize
15642 Any @emph{code_statement} can potentially cause external interactions.
15645 @itemize *
15647 @item 
15648 "The coded representation for the text of an Ada
15649 program.  See 2.1(4)."
15650 @end itemize
15652 See separate section on source representation.
15655 @itemize *
15657 @item 
15658 "The control functions allowed in comments.  See 2.1(14)."
15659 @end itemize
15661 See separate section on source representation.
15664 @itemize *
15666 @item 
15667 "The representation for an end of line.  See 2.2(2)."
15668 @end itemize
15670 See separate section on source representation.
15673 @itemize *
15675 @item 
15676 "Maximum supported line length and lexical element
15677 length.  See 2.2(15)."
15678 @end itemize
15680 The maximum line length is 255 characters and the maximum length of
15681 a lexical element is also 255 characters. This is the default setting
15682 if not overridden by the use of compiler switch @emph{-gnaty} (which
15683 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15684 line length to be specified to be any value up to 32767. The maximum
15685 length of a lexical element is the same as the maximum line length.
15688 @itemize *
15690 @item 
15691 "Implementation defined pragmas.  See 2.8(14)."
15692 @end itemize
15694 See @ref{7,,Implementation Defined Pragmas}.
15697 @itemize *
15699 @item 
15700 "Effect of pragma @code{Optimize}.  See 2.8(27)."
15701 @end itemize
15703 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
15704 parameter, checks that the optimization flag is set, and aborts if it is
15705 not.
15708 @itemize *
15710 @item 
15711 "The sequence of characters of the value returned by
15712 @code{S'Image} when some of the graphic characters of
15713 @code{S'Wide_Image} are not defined in @code{Character}.  See
15714 3.5(37)."
15715 @end itemize
15717 The sequence of characters is as defined by the wide character encoding
15718 method used for the source.  See section on source representation for
15719 further details.
15722 @itemize *
15724 @item 
15725 "The predefined integer types declared in
15726 @code{Standard}.  See 3.5.4(25)."
15727 @end itemize
15730 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15731 @headitem
15733 Type
15735 @tab
15737 Representation
15739 @item
15741 @emph{Short_Short_Integer}
15743 @tab
15745 8 bit signed
15747 @item
15749 @emph{Short_Integer}
15751 @tab
15753 (Short) 16 bit signed
15755 @item
15757 @emph{Integer}
15759 @tab
15761 32 bit signed
15763 @item
15765 @emph{Long_Integer}
15767 @tab
15769 64 bit signed (on most 64 bit targets,
15770 depending on the C definition of long).
15771 32 bit signed (all other targets)
15773 @item
15775 @emph{Long_Long_Integer}
15777 @tab
15779 64 bit signed
15781 @end multitable
15785 @itemize *
15787 @item 
15788 "Any nonstandard integer types and the operators defined
15789 for them.  See 3.5.4(26)."
15790 @end itemize
15792 There are no nonstandard integer types.
15795 @itemize *
15797 @item 
15798 "Any nonstandard real types and the operators defined for
15799 them.  See 3.5.6(8)."
15800 @end itemize
15802 There are no nonstandard real types.
15805 @itemize *
15807 @item 
15808 "What combinations of requested decimal precision and range
15809 are supported for floating point types.  See 3.5.7(7)."
15810 @end itemize
15812 The precision and range is as defined by the IEEE standard.
15815 @itemize *
15817 @item 
15818 "The predefined floating point types declared in
15819 @code{Standard}.  See 3.5.7(16)."
15820 @end itemize
15823 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
15824 @headitem
15826 Type
15828 @tab
15830 Representation
15832 @item
15834 @emph{Short_Float}
15836 @tab
15838 32 bit IEEE short
15840 @item
15842 @emph{Float}
15844 @tab
15846 (Short) 32 bit IEEE short
15848 @item
15850 @emph{Long_Float}
15852 @tab
15854 64 bit IEEE long
15856 @item
15858 @emph{Long_Long_Float}
15860 @tab
15862 64 bit IEEE long (80 bit IEEE long on x86 processors)
15864 @end multitable
15868 @itemize *
15870 @item 
15871 "The small of an ordinary fixed point type.  See 3.5.9(8)."
15872 @end itemize
15874 @code{Fine_Delta} is 2**(-63)
15877 @itemize *
15879 @item 
15880 "What combinations of small, range, and digits are
15881 supported for fixed point types.  See 3.5.9(10)."
15882 @end itemize
15884 Any combinations are permitted that do not result in a small less than
15885 @code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
15886 If the mantissa is larger than 53 bits on machines where Long_Long_Float
15887 is 64 bits (true of all architectures except ia32), then the output from
15888 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
15889 is because floating-point conversions are used to convert fixed point.
15892 @itemize *
15894 @item 
15895 "The result of @code{Tags.Expanded_Name} for types declared
15896 within an unnamed @emph{block_statement}.  See 3.9(10)."
15897 @end itemize
15899 Block numbers of the form @code{B@emph{nnn}}, where @emph{nnn} is a
15900 decimal integer are allocated.
15903 @itemize *
15905 @item 
15906 "Implementation-defined attributes.  See 4.1.4(12)."
15907 @end itemize
15909 See @ref{8,,Implementation Defined Attributes}.
15912 @itemize *
15914 @item 
15915 "Any implementation-defined time types.  See 9.6(6)."
15916 @end itemize
15918 There are no implementation-defined time types.
15921 @itemize *
15923 @item 
15924 "The time base associated with relative delays."
15925 @end itemize
15927 See 9.6(20).  The time base used is that provided by the C library
15928 function @code{gettimeofday}.
15931 @itemize *
15933 @item 
15934 "The time base of the type @code{Calendar.Time}.  See
15935 9.6(23)."
15936 @end itemize
15938 The time base used is that provided by the C library function
15939 @code{gettimeofday}.
15942 @itemize *
15944 @item 
15945 "The time zone used for package @code{Calendar}
15946 operations.  See 9.6(24)."
15947 @end itemize
15949 The time zone used by package @code{Calendar} is the current system time zone
15950 setting for local time, as accessed by the C library function
15951 @code{localtime}.
15954 @itemize *
15956 @item 
15957 "Any limit on @emph{delay_until_statements} of
15958 @emph{select_statements}.  See 9.6(29)."
15959 @end itemize
15961 There are no such limits.
15964 @itemize *
15966 @item 
15967 "Whether or not two non-overlapping parts of a composite
15968 object are independently addressable, in the case where packing, record
15969 layout, or @code{Component_Size} is specified for the object.  See
15970 9.10(1)."
15971 @end itemize
15973 Separate components are independently addressable if they do not share
15974 overlapping storage units.
15977 @itemize *
15979 @item 
15980 "The representation for a compilation.  See 10.1(2)."
15981 @end itemize
15983 A compilation is represented by a sequence of files presented to the
15984 compiler in a single invocation of the @emph{gcc} command.
15987 @itemize *
15989 @item 
15990 "Any restrictions on compilations that contain multiple
15991 compilation_units.  See 10.1(4)."
15992 @end itemize
15994 No single file can contain more than one compilation unit, but any
15995 sequence of files can be presented to the compiler as a single
15996 compilation.
15999 @itemize *
16001 @item 
16002 "The mechanisms for creating an environment and for adding
16003 and replacing compilation units.  See 10.1.4(3)."
16004 @end itemize
16006 See separate section on compilation model.
16009 @itemize *
16011 @item 
16012 "The manner of explicitly assigning library units to a
16013 partition.  See 10.2(2)."
16014 @end itemize
16016 If a unit contains an Ada main program, then the Ada units for the partition
16017 are determined by recursive application of the rules in the Ada Reference
16018 Manual section 10.2(2-6).  In other words, the Ada units will be those that
16019 are needed by the main program, and then this definition of need is applied
16020 recursively to those units, and the partition contains the transitive
16021 closure determined by this relationship.  In short, all the necessary units
16022 are included, with no need to explicitly specify the list.  If additional
16023 units are required, e.g., by foreign language units, then all units must be
16024 mentioned in the context clause of one of the needed Ada units.
16026 If the partition contains no main program, or if the main program is in
16027 a language other than Ada, then GNAT
16028 provides the binder options @emph{-z} and @emph{-n} respectively, and in
16029 this case a list of units can be explicitly supplied to the binder for
16030 inclusion in the partition (all units needed by these units will also
16031 be included automatically).  For full details on the use of these
16032 options, refer to @emph{GNAT Make Program gnatmake} in the
16033 @cite{GNAT User's Guide}.
16036 @itemize *
16038 @item 
16039 "The implementation-defined means, if any, of specifying
16040 which compilation units are needed by a given compilation unit.  See
16041 10.2(2)."
16042 @end itemize
16044 The units needed by a given compilation unit are as defined in
16045 the Ada Reference Manual section 10.2(2-6).  There are no
16046 implementation-defined pragmas or other implementation-defined
16047 means for specifying needed units.
16050 @itemize *
16052 @item 
16053 "The manner of designating the main subprogram of a
16054 partition.  See 10.2(7)."
16055 @end itemize
16057 The main program is designated by providing the name of the
16058 corresponding @code{ALI} file as the input parameter to the binder.
16061 @itemize *
16063 @item 
16064 "The order of elaboration of @emph{library_items}.  See
16065 10.2(18)."
16066 @end itemize
16068 The first constraint on ordering is that it meets the requirements of
16069 Chapter 10 of the Ada Reference Manual.  This still leaves some
16070 implementation dependent choices, which are resolved by first
16071 elaborating bodies as early as possible (i.e., in preference to specs
16072 where there is a choice), and second by evaluating the immediate with
16073 clauses of a unit to determine the probably best choice, and
16074 third by elaborating in alphabetical order of unit names
16075 where a choice still remains.
16078 @itemize *
16080 @item 
16081 "Parameter passing and function return for the main
16082 subprogram.  See 10.2(21)."
16083 @end itemize
16085 The main program has no parameters.  It may be a procedure, or a function
16086 returning an integer type.  In the latter case, the returned integer
16087 value is the return code of the program (overriding any value that
16088 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16091 @itemize *
16093 @item 
16094 "The mechanisms for building and running partitions.  See
16095 10.2(24)."
16096 @end itemize
16098 GNAT itself supports programs with only a single partition.  The GNATDIST
16099 tool provided with the GLADE package (which also includes an implementation
16100 of the PCS) provides a completely flexible method for building and running
16101 programs consisting of multiple partitions.  See the separate GLADE manual
16102 for details.
16105 @itemize *
16107 @item 
16108 "The details of program execution, including program
16109 termination.  See 10.2(25)."
16110 @end itemize
16112 See separate section on compilation model.
16115 @itemize *
16117 @item 
16118 "The semantics of any non-active partitions supported by the
16119 implementation.  See 10.2(28)."
16120 @end itemize
16122 Passive partitions are supported on targets where shared memory is
16123 provided by the operating system.  See the GLADE reference manual for
16124 further details.
16127 @itemize *
16129 @item 
16130 "The information returned by @code{Exception_Message}.  See
16131 11.4.1(10)."
16132 @end itemize
16134 Exception message returns the null string unless a specific message has
16135 been passed by the program.
16138 @itemize *
16140 @item 
16141 "The result of @code{Exceptions.Exception_Name} for types
16142 declared within an unnamed @emph{block_statement}.  See 11.4.1(12)."
16143 @end itemize
16145 Blocks have implementation defined names of the form @code{B@emph{nnn}}
16146 where @emph{nnn} is an integer.
16149 @itemize *
16151 @item 
16152 "The information returned by
16153 @code{Exception_Information}.  See 11.4.1(13)."
16154 @end itemize
16156 @code{Exception_Information} returns a string in the following format:
16158 @example
16159 *Exception_Name:* nnnnn
16160 *Message:* mmmmm
16161 *PID:* ppp
16162 *Load address:* 0xhhhh
16163 *Call stack traceback locations:*
16164 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16165 @end example
16167 where
16169 @quotation
16172 @itemize *
16174 @item 
16175 @code{nnnn} is the fully qualified name of the exception in all upper
16176 case letters. This line is always present.
16178 @item 
16179 @code{mmmm} is the message (this line present only if message is non-null)
16181 @item 
16182 @code{ppp} is the Process Id value as a decimal integer (this line is
16183 present only if the Process Id is nonzero). Currently we are
16184 not making use of this field.
16186 @item 
16187 The Load address line, the Call stack traceback locations line and the
16188 following values are present only if at least one traceback location was
16189 recorded. The Load address indicates the address at which the main executable
16190 was loaded; this line may not be present if operating system hasn't relocated
16191 the main executable. The values are given in C style format, with lower case
16192 letters for a-f, and only as many digits present as are necessary.
16193 The line terminator sequence at the end of each line, including
16194 the last line is a single @code{LF} character (@code{16#0A#}).
16195 @end itemize
16196 @end quotation
16199 @itemize *
16201 @item 
16202 "Implementation-defined check names.  See 11.5(27)."
16203 @end itemize
16205 The implementation defined check names include Alignment_Check,
16206 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16207 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16208 program can add implementation-defined check names by means of the pragma
16209 Check_Name. See the description of pragma @code{Suppress} for full details.
16212 @itemize *
16214 @item 
16215 "The interpretation of each aspect of representation.  See
16216 13.1(20)."
16217 @end itemize
16219 See separate section on data representations.
16222 @itemize *
16224 @item 
16225 "Any restrictions placed upon representation items.  See
16226 13.1(20)."
16227 @end itemize
16229 See separate section on data representations.
16232 @itemize *
16234 @item 
16235 "The meaning of @code{Size} for indefinite subtypes.  See
16236 13.3(48)."
16237 @end itemize
16239 Size for an indefinite subtype is the maximum possible size, except that
16240 for the case of a subprogram parameter, the size of the parameter object
16241 is the actual size.
16244 @itemize *
16246 @item 
16247 "The default external representation for a type tag.  See
16248 13.3(75)."
16249 @end itemize
16251 The default external representation for a type tag is the fully expanded
16252 name of the type in upper case letters.
16255 @itemize *
16257 @item 
16258 "What determines whether a compilation unit is the same in
16259 two different partitions.  See 13.3(76)."
16260 @end itemize
16262 A compilation unit is the same in two different partitions if and only
16263 if it derives from the same source file.
16266 @itemize *
16268 @item 
16269 "Implementation-defined components.  See 13.5.1(15)."
16270 @end itemize
16272 The only implementation defined component is the tag for a tagged type,
16273 which contains a pointer to the dispatching table.
16276 @itemize *
16278 @item 
16279 "If @code{Word_Size} = @code{Storage_Unit}, the default bit
16280 ordering.  See 13.5.3(5)."
16281 @end itemize
16283 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16284 implementation, so no non-default bit ordering is supported.  The default
16285 bit ordering corresponds to the natural endianness of the target architecture.
16288 @itemize *
16290 @item 
16291 "The contents of the visible part of package @code{System}
16292 and its language-defined children.  See 13.7(2)."
16293 @end itemize
16295 See the definition of these packages in files @code{system.ads} and
16296 @code{s-stoele.ads}. Note that two declarations are added to package
16297 System.
16299 @example
16300 Max_Priority           : constant Positive := Priority'Last;
16301 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16302 @end example
16305 @itemize *
16307 @item 
16308 "The contents of the visible part of package
16309 @code{System.Machine_Code}, and the meaning of
16310 @emph{code_statements}.  See 13.8(7)."
16311 @end itemize
16313 See the definition and documentation in file @code{s-maccod.ads}.
16316 @itemize *
16318 @item 
16319 "The effect of unchecked conversion.  See 13.9(11)."
16320 @end itemize
16322 Unchecked conversion between types of the same size
16323 results in an uninterpreted transmission of the bits from one type
16324 to the other.  If the types are of unequal sizes, then in the case of
16325 discrete types, a shorter source is first zero or sign extended as
16326 necessary, and a shorter target is simply truncated on the left.
16327 For all non-discrete types, the source is first copied if necessary
16328 to ensure that the alignment requirements of the target are met, then
16329 a pointer is constructed to the source value, and the result is obtained
16330 by dereferencing this pointer after converting it to be a pointer to the
16331 target type. Unchecked conversions where the target subtype is an
16332 unconstrained array are not permitted. If the target alignment is
16333 greater than the source alignment, then a copy of the result is
16334 made with appropriate alignment
16337 @itemize *
16339 @item 
16340 "The semantics of operations on invalid representations.
16341 See 13.9.2(10-11)."
16342 @end itemize
16344 For assignments and other operations where the use of invalid values cannot
16345 result in erroneous behavior, the compiler ignores the possibility of invalid
16346 values. An exception is raised at the point where an invalid value would
16347 result in erroneous behavior. For example executing:
16349 @example
16350 procedure invalidvals is
16351   X : Integer := -1;
16352   Y : Natural range 1 .. 10;
16353   for Y'Address use X'Address;
16354   Z : Natural range 1 .. 10;
16355   A : array (Natural range 1 .. 10) of Integer;
16356 begin
16357   Z := Y;     -- no exception
16358   A (Z) := 3; -- exception raised;
16359 end;
16360 @end example
16362 As indicated, an exception is raised on the array assignment, but not
16363 on the simple assignment of the invalid negative value from Y to Z.
16366 @itemize *
16368 @item 
16369 "The manner of choosing a storage pool for an access type
16370 when @code{Storage_Pool} is not specified for the type.  See 13.11(17)."
16371 @end itemize
16373 There are 3 different standard pools used by the compiler when
16374 @code{Storage_Pool} is not specified depending whether the type is local
16375 to a subprogram or defined at the library level and whether
16376 @code{Storage_Size`@w{`}is specified or not.  See documentation in the runtime
16377 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16378 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16379 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16380 default pools used.
16383 @itemize *
16385 @item 
16386 "Whether or not the implementation provides user-accessible
16387 names for the standard pool type(s).  See 13.11(17)."
16388 @end itemize
16390 See documentation in the sources of the run time mentioned in the previous
16391 paragraph.  All these pools are accessible by means of @cite{with}ing
16392 these units.
16395 @itemize *
16397 @item 
16398 "The meaning of @code{Storage_Size}.  See 13.11(18)."
16399 @end itemize
16401 @code{Storage_Size} is measured in storage units, and refers to the
16402 total space available for an access type collection, or to the primary
16403 stack space for a task.
16406 @itemize *
16408 @item 
16409 "Implementation-defined aspects of storage pools.  See
16410 13.11(22)."
16411 @end itemize
16413 See documentation in the sources of the run time mentioned in the
16414 paragraph about standard storage pools above
16415 for details on GNAT-defined aspects of storage pools.
16418 @itemize *
16420 @item 
16421 "The set of restrictions allowed in a pragma
16422 @code{Restrictions}.  See 13.12(7)."
16423 @end itemize
16425 See @ref{9,,Standard and Implementation Defined Restrictions}.
16428 @itemize *
16430 @item 
16431 "The consequences of violating limitations on
16432 @code{Restrictions} pragmas.  See 13.12(9)."
16433 @end itemize
16435 Restrictions that can be checked at compile time result in illegalities
16436 if violated.  Currently there are no other consequences of violating
16437 restrictions.
16440 @itemize *
16442 @item 
16443 "The representation used by the @code{Read} and
16444 @code{Write} attributes of elementary types in terms of stream
16445 elements.  See 13.13.2(9)."
16446 @end itemize
16448 The representation is the in-memory representation of the base type of
16449 the type, using the number of bits corresponding to the
16450 @code{type'Size} value, and the natural ordering of the machine.
16453 @itemize *
16455 @item 
16456 "The names and characteristics of the numeric subtypes
16457 declared in the visible part of package @code{Standard}.  See A.1(3)."
16458 @end itemize
16460 See items describing the integer and floating-point types supported.
16463 @itemize *
16465 @item 
16466 "The string returned by @code{Character_Set_Version}.
16467 See A.3.5(3)."
16468 @end itemize
16470 @code{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16471 the string "Unicode 4.0", referring to version 4.0 of the
16472 Unicode specification.
16475 @itemize *
16477 @item 
16478 "The accuracy actually achieved by the elementary
16479 functions.  See A.5.1(1)."
16480 @end itemize
16482 The elementary functions correspond to the functions available in the C
16483 library.  Only fast math mode is implemented.
16486 @itemize *
16488 @item 
16489 "The sign of a zero result from some of the operators or
16490 functions in @code{Numerics.Generic_Elementary_Functions}, when
16491 @code{Float_Type'Signed_Zeros} is @code{True}.  See A.5.1(46)."
16492 @end itemize
16494 The sign of zeroes follows the requirements of the IEEE 754 standard on
16495 floating-point.
16498 @itemize *
16500 @item 
16501 "The value of
16502 @code{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27)."
16503 @end itemize
16505 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16508 @itemize *
16510 @item 
16511 "The value of
16512 @code{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27)."
16513 @end itemize
16515 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16518 @itemize *
16520 @item 
16521 "The algorithms for random number generation.  See
16522 A.5.2(32)."
16523 @end itemize
16525 The algorithm is the Mersenne Twister, as documented in the source file
16526 @code{s-rannum.adb}. This version of the algorithm has a period of
16527 2**19937-1.
16530 @itemize *
16532 @item 
16533 "The string representation of a random number generator's
16534 state.  See A.5.2(38)."
16535 @end itemize
16537 The value returned by the Image function is the concatenation of
16538 the fixed-width decimal representations of the 624 32-bit integers
16539 of the state vector.
16542 @itemize *
16544 @item 
16545 "The minimum time interval between calls to the
16546 time-dependent Reset procedure that are guaranteed to initiate different
16547 random number sequences.  See A.5.2(45)."
16548 @end itemize
16550 The minimum period between reset calls to guarantee distinct series of
16551 random numbers is one microsecond.
16554 @itemize *
16556 @item 
16557 "The values of the @code{Model_Mantissa},
16558 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16559 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16560 Annex is not supported.  See A.5.3(72)."
16561 @end itemize
16563 Run the compiler with @emph{-gnatS} to produce a listing of package
16564 @code{Standard}, has the values of all numeric attributes.
16567 @itemize *
16569 @item 
16570 "Any implementation-defined characteristics of the
16571 input-output packages.  See A.7(14)."
16572 @end itemize
16574 There are no special implementation defined characteristics for these
16575 packages.
16578 @itemize *
16580 @item 
16581 "The value of @code{Buffer_Size} in @code{Storage_IO}.  See
16582 A.9(10)."
16583 @end itemize
16585 All type representations are contiguous, and the @code{Buffer_Size} is
16586 the value of @code{type'Size} rounded up to the next storage unit
16587 boundary.
16590 @itemize *
16592 @item 
16593 "External files for standard input, standard output, and
16594 standard error See A.10(5)."
16595 @end itemize
16597 These files are mapped onto the files provided by the C streams
16598 libraries.  See source file @code{i-cstrea.ads} for further details.
16601 @itemize *
16603 @item 
16604 "The accuracy of the value produced by @code{Put}.  See
16605 A.10.9(36)."
16606 @end itemize
16608 If more digits are requested in the output than are represented by the
16609 precision of the value, zeroes are output in the corresponding least
16610 significant digit positions.
16613 @itemize *
16615 @item 
16616 "The meaning of @code{Argument_Count}, @code{Argument}, and
16617 @code{Command_Name}.  See A.15(1)."
16618 @end itemize
16620 These are mapped onto the @code{argv} and @code{argc} parameters of the
16621 main program in the natural manner.
16624 @itemize *
16626 @item 
16627 "The interpretation of the @code{Form} parameter in procedure
16628 @code{Create_Directory}.  See A.16(56)."
16629 @end itemize
16631 The @code{Form} parameter is not used.
16634 @itemize *
16636 @item 
16637 "The interpretation of the @code{Form} parameter in procedure
16638 @code{Create_Path}.  See A.16(60)."
16639 @end itemize
16641 The @code{Form} parameter is not used.
16644 @itemize *
16646 @item 
16647 "The interpretation of the @code{Form} parameter in procedure
16648 @code{Copy_File}.  See A.16(68)."
16649 @end itemize
16651 The @code{Form} parameter is case-insensitive.
16652 Two fields are recognized in the @code{Form} parameter:
16654 @example
16655 *preserve=<value>*
16656 *mode=<value>*
16657 @end example
16659 <value> starts immediately after the character '=' and ends with the
16660 character immediately preceding the next comma (',') or with the last
16661 character of the parameter.
16663 The only possible values for preserve= are:
16666 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16667 @headitem
16669 Value
16671 @tab
16673 Meaning
16675 @item
16677 @emph{no_attributes}
16679 @tab
16681 Do not try to preserve any file attributes. This is the
16682 default if no preserve= is found in Form.
16684 @item
16686 @emph{all_attributes}
16688 @tab
16690 Try to preserve all file attributes (timestamps, access rights).
16692 @item
16694 @emph{timestamps}
16696 @tab
16698 Preserve the timestamp of the copied file, but not the other
16699 file attributes.
16701 @end multitable
16704 The only possible values for mode= are:
16707 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16708 @headitem
16710 Value
16712 @tab
16714 Meaning
16716 @item
16718 @emph{copy}
16720 @tab
16722 Only do the copy if the destination file does not already exist.
16723 If it already exists, Copy_File fails.
16725 @item
16727 @emph{overwrite}
16729 @tab
16731 Copy the file in all cases. Overwrite an already existing destination file.
16733 @item
16735 @emph{append}
16737 @tab
16739 Append the original file to the destination file. If the destination file
16740 does not exist, the destination file is a copy of the source file.
16741 When mode=append, the field preserve=, if it exists, is not taken into account.
16743 @end multitable
16746 If the Form parameter includes one or both of the fields and the value or
16747 values are incorrect, Copy_file fails with Use_Error.
16749 Examples of correct Forms:
16751 @example
16752 Form => "preserve=no_attributes,mode=overwrite" (the default)
16753 Form => "mode=append"
16754 Form => "mode=copy, preserve=all_attributes"
16755 @end example
16757 Examples of incorrect Forms:
16759 @example
16760 Form => "preserve=junk"
16761 Form => "mode=internal, preserve=timestamps"
16762 @end example
16765 @itemize *
16767 @item 
16768 "The interpretation of the @code{Pattern} parameter, when not the null string,
16769 in the @code{Start_Search} and @code{Search} procedures.
16770 See A.16(104) and A.16(112)."
16771 @end itemize
16773 When the @code{Pattern} parameter is not the null string, it is interpreted
16774 according to the syntax of regular expressions as defined in the
16775 @code{GNAT.Regexp} package.
16777 See @ref{251,,GNAT.Regexp (g-regexp.ads)}.
16780 @itemize *
16782 @item 
16783 "Implementation-defined convention names.  See B.1(11)."
16784 @end itemize
16786 The following convention names are supported
16789 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
16790 @headitem
16792 Convention Name
16794 @tab
16796 Interpretation
16798 @item
16800 @emph{Ada}
16802 @tab
16806 @item
16808 @emph{Ada_Pass_By_Copy}
16810 @tab
16812 Allowed for any types except by-reference types such as limited
16813 records. Compatible with convention Ada, but causes any parameters
16814 with this convention to be passed by copy.
16816 @item
16818 @emph{Ada_Pass_By_Reference}
16820 @tab
16822 Allowed for any types except by-copy types such as scalars.
16823 Compatible with convention Ada, but causes any parameters
16824 with this convention to be passed by reference.
16826 @item
16828 @emph{Assembler}
16830 @tab
16832 Assembly language
16834 @item
16836 @emph{Asm}
16838 @tab
16840 Synonym for Assembler
16842 @item
16844 @emph{Assembly}
16846 @tab
16848 Synonym for Assembler
16850 @item
16852 @emph{C}
16854 @tab
16858 @item
16860 @emph{C_Pass_By_Copy}
16862 @tab
16864 Allowed only for record types, like C, but also notes that record
16865 is to be passed by copy rather than reference.
16867 @item
16869 @emph{COBOL}
16871 @tab
16873 COBOL
16875 @item
16877 @emph{C_Plus_Plus (or CPP)}
16879 @tab
16883 @item
16885 @emph{Default}
16887 @tab
16889 Treated the same as C
16891 @item
16893 @emph{External}
16895 @tab
16897 Treated the same as C
16899 @item
16901 @emph{Fortran}
16903 @tab
16905 Fortran
16907 @item
16909 @emph{Intrinsic}
16911 @tab
16913 For support of pragma @code{Import} with convention Intrinsic, see
16914 separate section on Intrinsic Subprograms.
16916 @item
16918 @emph{Stdcall}
16920 @tab
16922 Stdcall (used for Windows implementations only).  This convention correspond
16923 to the WINAPI (previously called Pascal convention) C/C++ convention under
16924 Windows.  A routine with this convention cleans the stack before
16925 exit. This pragma cannot be applied to a dispatching call.
16927 @item
16929 @emph{DLL}
16931 @tab
16933 Synonym for Stdcall
16935 @item
16937 @emph{Win32}
16939 @tab
16941 Synonym for Stdcall
16943 @item
16945 @emph{Stubbed}
16947 @tab
16949 Stubbed is a special convention used to indicate that the body of the
16950 subprogram will be entirely ignored.  Any call to the subprogram
16951 is converted into a raise of the @code{Program_Error} exception.  If a
16952 pragma @code{Import} specifies convention @code{stubbed} then no body need
16953 be present at all.  This convention is useful during development for the
16954 inclusion of subprograms whose body has not yet been written.
16955 In addition, all otherwise unrecognized convention names are also
16956 treated as being synonymous with convention C.  In all implementations
16957 except for VMS, use of such other names results in a warning.  In VMS
16958 implementations, these names are accepted silently.
16960 @end multitable
16964 @itemize *
16966 @item 
16967 "The meaning of link names.  See B.1(36)."
16968 @end itemize
16970 Link names are the actual names used by the linker.
16973 @itemize *
16975 @item 
16976 "The manner of choosing link names when neither the link
16977 name nor the address of an imported or exported entity is specified.  See
16978 B.1(36)."
16979 @end itemize
16981 The default linker name is that which would be assigned by the relevant
16982 external language, interpreting the Ada name as being in all lower case
16983 letters.
16986 @itemize *
16988 @item 
16989 "The effect of pragma @code{Linker_Options}.  See B.1(37)."
16990 @end itemize
16992 The string passed to @code{Linker_Options} is presented uninterpreted as
16993 an argument to the link command, unless it contains ASCII.NUL characters.
16994 NUL characters if they appear act as argument separators, so for example
16996 @example
16997 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
16998 @end example
17000 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17001 linker. The order of linker options is preserved for a given unit. The final
17002 list of options passed to the linker is in reverse order of the elaboration
17003 order. For example, linker options for a body always appear before the options
17004 from the corresponding package spec.
17007 @itemize *
17009 @item 
17010 "The contents of the visible part of package
17011 @code{Interfaces} and its language-defined descendants.  See B.2(1)."
17012 @end itemize
17014 See files with prefix @code{i-} in the distributed library.
17017 @itemize *
17019 @item 
17020 "Implementation-defined children of package
17021 @code{Interfaces}.  The contents of the visible part of package
17022 @code{Interfaces}.  See B.2(11)."
17023 @end itemize
17025 See files with prefix @code{i-} in the distributed library.
17028 @itemize *
17030 @item 
17031 "The types @code{Floating}, @code{Long_Floating},
17032 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17033 @code{COBOL_Character}; and the initialization of the variables
17034 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17035 @code{Interfaces.COBOL}.  See B.4(50)."
17036 @end itemize
17039 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
17040 @headitem
17042 COBOL
17044 @tab
17048 @item
17050 @emph{Floating}
17052 @tab
17054 Float
17056 @item
17058 @emph{Long_Floating}
17060 @tab
17062 (Floating) Long_Float
17064 @item
17066 @emph{Binary}
17068 @tab
17070 Integer
17072 @item
17074 @emph{Long_Binary}
17076 @tab
17078 Long_Long_Integer
17080 @item
17082 @emph{Decimal_Element}
17084 @tab
17086 Character
17088 @item
17090 @emph{COBOL_Character}
17092 @tab
17094 Character
17096 @end multitable
17099 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17102 @itemize *
17104 @item 
17105 "Support for access to machine instructions.  See C.1(1)."
17106 @end itemize
17108 See documentation in file @code{s-maccod.ads} in the distributed library.
17111 @itemize *
17113 @item 
17114 "Implementation-defined aspects of access to machine
17115 operations.  See C.1(9)."
17116 @end itemize
17118 See documentation in file @code{s-maccod.ads} in the distributed library.
17121 @itemize *
17123 @item 
17124 "Implementation-defined aspects of interrupts.  See C.3(2)."
17125 @end itemize
17127 Interrupts are mapped to signals or conditions as appropriate.  See
17128 definition of unit
17129 @code{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
17130 on the interrupts supported on a particular target.
17133 @itemize *
17135 @item 
17136 "Implementation-defined aspects of pre-elaboration.  See
17137 C.4(13)."
17138 @end itemize
17140 GNAT does not permit a partition to be restarted without reloading,
17141 except under control of the debugger.
17144 @itemize *
17146 @item 
17147 "The semantics of pragma @code{Discard_Names}.  See C.5(7)."
17148 @end itemize
17150 Pragma @code{Discard_Names} causes names of enumeration literals to
17151 be suppressed.  In the presence of this pragma, the Image attribute
17152 provides the image of the Pos of the literal, and Value accepts
17153 Pos values.
17155 For tagged types, when pragmas @code{Discard_Names} and @code{No_Tagged_Streams}
17156 simultaneously apply, their Expanded_Name and External_Tag are initialized
17157 with empty strings. This is useful to avoid exposing entity names at binary
17158 level.
17161 @itemize *
17163 @item 
17164 "The result of the @code{Task_Identification.Image}
17165 attribute.  See C.7.1(7)."
17166 @end itemize
17168 The result of this attribute is a string that identifies
17169 the object or component that denotes a given task. If a variable @code{Var}
17170 has a task type, the image for this task will have the form @code{Var_@emph{XXXXXXXX}},
17171 where the suffix @emph{XXXXXXXX}
17172 is the hexadecimal representation of the virtual address of the corresponding
17173 task control block. If the variable is an array of tasks, the image of each
17174 task will have the form of an indexed component indicating the position of a
17175 given task in the array, e.g., @code{Group(5)_@emph{XXXXXXX}}. If the task is a
17176 component of a record, the image of the task will have the form of a selected
17177 component. These rules are fully recursive, so that the image of a task that
17178 is a subcomponent of a composite object corresponds to the expression that
17179 designates this task.
17181 If a task is created by an allocator, its image depends on the context. If the
17182 allocator is part of an object declaration, the rules described above are used
17183 to construct its image, and this image is not affected by subsequent
17184 assignments. If the allocator appears within an expression, the image
17185 includes only the name of the task type.
17187 If the configuration pragma Discard_Names is present, or if the restriction
17188 No_Implicit_Heap_Allocation is in effect,  the image reduces to
17189 the numeric suffix, that is to say the hexadecimal representation of the
17190 virtual address of the control block of the task.
17193 @itemize *
17195 @item 
17196 "The value of @code{Current_Task} when in a protected entry
17197 or interrupt handler.  See C.7.1(17)."
17198 @end itemize
17200 Protected entries or interrupt handlers can be executed by any
17201 convenient thread, so the value of @code{Current_Task} is undefined.
17204 @itemize *
17206 @item 
17207 "The effect of calling @code{Current_Task} from an entry
17208 body or interrupt handler.  See C.7.1(19)."
17209 @end itemize
17211 When GNAT can determine statically that @code{Current_Task} is called directly in
17212 the body of an entry (or barrier) then a warning is emitted and @code{Program_Error}
17213 is raised at run time. Otherwise, the effect of calling @code{Current_Task} from an
17214 entry body or interrupt handler is to return the identification of the task
17215 currently executing the code.
17218 @itemize *
17220 @item 
17221 "Implementation-defined aspects of
17222 @code{Task_Attributes}.  See C.7.2(19)."
17223 @end itemize
17225 There are no implementation-defined aspects of @code{Task_Attributes}.
17228 @itemize *
17230 @item 
17231 "Values of all @code{Metrics}.  See D(2)."
17232 @end itemize
17234 The metrics information for GNAT depends on the performance of the
17235 underlying operating system.  The sources of the run-time for tasking
17236 implementation, together with the output from @emph{-gnatG} can be
17237 used to determine the exact sequence of operating systems calls made
17238 to implement various tasking constructs.  Together with appropriate
17239 information on the performance of the underlying operating system,
17240 on the exact target in use, this information can be used to determine
17241 the required metrics.
17244 @itemize *
17246 @item 
17247 "The declarations of @code{Any_Priority} and
17248 @code{Priority}.  See D.1(11)."
17249 @end itemize
17251 See declarations in file @code{system.ads}.
17254 @itemize *
17256 @item 
17257 "Implementation-defined execution resources.  See D.1(15)."
17258 @end itemize
17260 There are no implementation-defined execution resources.
17263 @itemize *
17265 @item 
17266 "Whether, on a multiprocessor, a task that is waiting for
17267 access to a protected object keeps its processor busy.  See D.2.1(3)."
17268 @end itemize
17270 On a multi-processor, a task that is waiting for access to a protected
17271 object does not keep its processor busy.
17274 @itemize *
17276 @item 
17277 "The affect of implementation defined execution resources
17278 on task dispatching.  See D.2.1(9)."
17279 @end itemize
17281 Tasks map to threads in the threads package used by GNAT.  Where possible
17282 and appropriate, these threads correspond to native threads of the
17283 underlying operating system.
17286 @itemize *
17288 @item 
17289 "Implementation-defined @emph{policy_identifiers} allowed
17290 in a pragma @code{Task_Dispatching_Policy}.  See D.2.2(3)."
17291 @end itemize
17293 There are no implementation-defined policy-identifiers allowed in this
17294 pragma.
17297 @itemize *
17299 @item 
17300 "Implementation-defined aspects of priority inversion.  See
17301 D.2.2(16)."
17302 @end itemize
17304 Execution of a task cannot be preempted by the implementation processing
17305 of delay expirations for lower priority tasks.
17308 @itemize *
17310 @item 
17311 "Implementation-defined task dispatching.  See D.2.2(18)."
17312 @end itemize
17314 The policy is the same as that of the underlying threads implementation.
17317 @itemize *
17319 @item 
17320 "Implementation-defined @emph{policy_identifiers} allowed
17321 in a pragma @code{Locking_Policy}.  See D.3(4)."
17322 @end itemize
17324 The two implementation defined policies permitted in GNAT are
17325 @code{Inheritance_Locking} and  @code{Concurrent_Readers_Locking}. On
17326 targets that support the @code{Inheritance_Locking} policy, locking is
17327 implemented by inheritance, i.e., the task owning the lock operates
17328 at a priority equal to the highest priority of any task currently
17329 requesting the lock. On targets that support the
17330 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17331 read/write lock allowing multiple protected object functions to enter
17332 concurrently.
17335 @itemize *
17337 @item 
17338 "Default ceiling priorities.  See D.3(10)."
17339 @end itemize
17341 The ceiling priority of protected objects of the type
17342 @code{System.Interrupt_Priority'Last} as described in the Ada
17343 Reference Manual D.3(10),
17346 @itemize *
17348 @item 
17349 "The ceiling of any protected object used internally by
17350 the implementation.  See D.3(16)."
17351 @end itemize
17353 The ceiling priority of internal protected objects is
17354 @code{System.Priority'Last}.
17357 @itemize *
17359 @item 
17360 "Implementation-defined queuing policies.  See D.4(1)."
17361 @end itemize
17363 There are no implementation-defined queuing policies.
17366 @itemize *
17368 @item 
17369 "On a multiprocessor, any conditions that cause the
17370 completion of an aborted construct to be delayed later than what is
17371 specified for a single processor.  See D.6(3)."
17372 @end itemize
17374 The semantics for abort on a multi-processor is the same as on a single
17375 processor, there are no further delays.
17378 @itemize *
17380 @item 
17381 "Any operations that implicitly require heap storage
17382 allocation.  See D.7(8)."
17383 @end itemize
17385 The only operation that implicitly requires heap storage allocation is
17386 task creation.
17389 @itemize *
17391 @item 
17392 "What happens when a task terminates in the presence of
17393 pragma @code{No_Task_Termination}. See D.7(15)."
17394 @end itemize
17396 Execution is erroneous in that case.
17399 @itemize *
17401 @item 
17402 "Implementation-defined aspects of pragma
17403 @code{Restrictions}.  See D.7(20)."
17404 @end itemize
17406 There are no such implementation-defined aspects.
17409 @itemize *
17411 @item 
17412 "Implementation-defined aspects of package
17413 @code{Real_Time}.  See D.8(17)."
17414 @end itemize
17416 There are no implementation defined aspects of package @code{Real_Time}.
17419 @itemize *
17421 @item 
17422 "Implementation-defined aspects of
17423 @emph{delay_statements}.  See D.9(8)."
17424 @end itemize
17426 Any difference greater than one microsecond will cause the task to be
17427 delayed (see D.9(7)).
17430 @itemize *
17432 @item 
17433 "The upper bound on the duration of interrupt blocking
17434 caused by the implementation.  See D.12(5)."
17435 @end itemize
17437 The upper bound is determined by the underlying operating system.  In
17438 no cases is it more than 10 milliseconds.
17441 @itemize *
17443 @item 
17444 "The means for creating and executing distributed
17445 programs.  See E(5)."
17446 @end itemize
17448 The GLADE package provides a utility GNATDIST for creating and executing
17449 distributed programs.  See the GLADE reference manual for further details.
17452 @itemize *
17454 @item 
17455 "Any events that can result in a partition becoming
17456 inaccessible.  See E.1(7)."
17457 @end itemize
17459 See the GLADE reference manual for full details on such events.
17462 @itemize *
17464 @item 
17465 "The scheduling policies, treatment of priorities, and
17466 management of shared resources between partitions in certain cases.  See
17467 E.1(11)."
17468 @end itemize
17470 See the GLADE reference manual for full details on these aspects of
17471 multi-partition execution.
17474 @itemize *
17476 @item 
17477 "Events that cause the version of a compilation unit to
17478 change.  See E.3(5)."
17479 @end itemize
17481 Editing the source file of a compilation unit, or the source files of
17482 any units on which it is dependent in a significant way cause the version
17483 to change.  No other actions cause the version number to change.  All changes
17484 are significant except those which affect only layout, capitalization or
17485 comments.
17488 @itemize *
17490 @item 
17491 "Whether the execution of the remote subprogram is
17492 immediately aborted as a result of cancellation.  See E.4(13)."
17493 @end itemize
17495 See the GLADE reference manual for details on the effect of abort in
17496 a distributed application.
17499 @itemize *
17501 @item 
17502 "Implementation-defined aspects of the PCS.  See E.5(25)."
17503 @end itemize
17505 See the GLADE reference manual for a full description of all implementation
17506 defined aspects of the PCS.
17509 @itemize *
17511 @item 
17512 "Implementation-defined interfaces in the PCS.  See
17513 E.5(26)."
17514 @end itemize
17516 See the GLADE reference manual for a full description of all
17517 implementation defined interfaces.
17520 @itemize *
17522 @item 
17523 "The values of named numbers in the package
17524 @code{Decimal}.  See F.2(7)."
17525 @end itemize
17528 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx} 
17529 @headitem
17531 Named Number
17533 @tab
17535 Value
17537 @item
17539 @emph{Max_Scale}
17541 @tab
17545 @item
17547 @emph{Min_Scale}
17549 @tab
17553 @item
17555 @emph{Min_Delta}
17557 @tab
17559 1.0E-18
17561 @item
17563 @emph{Max_Delta}
17565 @tab
17567 1.0E+18
17569 @item
17571 @emph{Max_Decimal_Digits}
17573 @tab
17577 @end multitable
17581 @itemize *
17583 @item 
17584 "The value of @code{Max_Picture_Length} in the package
17585 @code{Text_IO.Editing}.  See F.3.3(16)."
17586 @end itemize
17591 @itemize *
17593 @item 
17594 "The value of @code{Max_Picture_Length} in the package
17595 @code{Wide_Text_IO.Editing}.  See F.3.4(5)."
17596 @end itemize
17601 @itemize *
17603 @item 
17604 "The accuracy actually achieved by the complex elementary
17605 functions and by other complex arithmetic operations.  See G.1(1)."
17606 @end itemize
17608 Standard library functions are used for the complex arithmetic
17609 operations.  Only fast math mode is currently supported.
17612 @itemize *
17614 @item 
17615 "The sign of a zero result (or a component thereof) from
17616 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17617 @code{Real'Signed_Zeros} is True.  See G.1.1(53)."
17618 @end itemize
17620 The signs of zero values are as recommended by the relevant
17621 implementation advice.
17624 @itemize *
17626 @item 
17627 "The sign of a zero result (or a component thereof) from
17628 any operator or function in
17629 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17630 @code{Real'Signed_Zeros} is @code{True}.  See G.1.2(45)."
17631 @end itemize
17633 The signs of zero values are as recommended by the relevant
17634 implementation advice.
17637 @itemize *
17639 @item 
17640 "Whether the strict mode or the relaxed mode is the
17641 default.  See G.2(2)."
17642 @end itemize
17644 The strict mode is the default.  There is no separate relaxed mode.  GNAT
17645 provides a highly efficient implementation of strict mode.
17648 @itemize *
17650 @item 
17651 "The result interval in certain cases of fixed-to-float
17652 conversion.  See G.2.1(10)."
17653 @end itemize
17655 For cases where the result interval is implementation dependent, the
17656 accuracy is that provided by performing all operations in 64-bit IEEE
17657 floating-point format.
17660 @itemize *
17662 @item 
17663 "The result of a floating point arithmetic operation in
17664 overflow situations, when the @code{Machine_Overflows} attribute of the
17665 result type is @code{False}.  See G.2.1(13)."
17666 @end itemize
17668 Infinite and NaN values are produced as dictated by the IEEE
17669 floating-point standard.
17670 Note that on machines that are not fully compliant with the IEEE
17671 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17672 must be used for achieving IEEE conforming behavior (although at the cost
17673 of a significant performance penalty), so infinite and NaN values are
17674 properly generated.
17677 @itemize *
17679 @item 
17680 "The result interval for division (or exponentiation by a
17681 negative exponent), when the floating point hardware implements division
17682 as multiplication by a reciprocal.  See G.2.1(16)."
17683 @end itemize
17685 Not relevant, division is IEEE exact.
17688 @itemize *
17690 @item 
17691 "The definition of close result set, which determines the
17692 accuracy of certain fixed point multiplications and divisions.  See
17693 G.2.3(5)."
17694 @end itemize
17696 Operations in the close result set are performed using IEEE long format
17697 floating-point arithmetic.  The input operands are converted to
17698 floating-point, the operation is done in floating-point, and the result
17699 is converted to the target type.
17702 @itemize *
17704 @item 
17705 "Conditions on a @emph{universal_real} operand of a fixed
17706 point multiplication or division for which the result shall be in the
17707 perfect result set.  See G.2.3(22)."
17708 @end itemize
17710 The result is only defined to be in the perfect result set if the result
17711 can be computed by a single scaling operation involving a scale factor
17712 representable in 64-bits.
17715 @itemize *
17717 @item 
17718 "The result of a fixed point arithmetic operation in
17719 overflow situations, when the @code{Machine_Overflows} attribute of the
17720 result type is @code{False}.  See G.2.3(27)."
17721 @end itemize
17723 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
17724 types.
17727 @itemize *
17729 @item 
17730 "The result of an elementary function reference in
17731 overflow situations, when the @code{Machine_Overflows} attribute of the
17732 result type is @code{False}.  See G.2.4(4)."
17733 @end itemize
17735 IEEE infinite and Nan values are produced as appropriate.
17738 @itemize *
17740 @item 
17741 "The value of the angle threshold, within which certain
17742 elementary functions, complex arithmetic operations, and complex
17743 elementary functions yield results conforming to a maximum relative
17744 error bound.  See G.2.4(10)."
17745 @end itemize
17747 Information on this subject is not yet available.
17750 @itemize *
17752 @item 
17753 "The accuracy of certain elementary functions for
17754 parameters beyond the angle threshold.  See G.2.4(10)."
17755 @end itemize
17757 Information on this subject is not yet available.
17760 @itemize *
17762 @item 
17763 "The result of a complex arithmetic operation or complex
17764 elementary function reference in overflow situations, when the
17765 @code{Machine_Overflows} attribute of the corresponding real type is
17766 @code{False}.  See G.2.6(5)."
17767 @end itemize
17769 IEEE infinite and Nan values are produced as appropriate.
17772 @itemize *
17774 @item 
17775 "The accuracy of certain complex arithmetic operations and
17776 certain complex elementary functions for parameters (or components
17777 thereof) beyond the angle threshold.  See G.2.6(8)."
17778 @end itemize
17780 Information on those subjects is not yet available.
17783 @itemize *
17785 @item 
17786 "Information regarding bounded errors and erroneous
17787 execution.  See H.2(1)."
17788 @end itemize
17790 Information on this subject is not yet available.
17793 @itemize *
17795 @item 
17796 "Implementation-defined aspects of pragma
17797 @code{Inspection_Point}.  See H.3.2(8)."
17798 @end itemize
17800 Pragma @code{Inspection_Point} ensures that the variable is live and can
17801 be examined by the debugger at the inspection point.
17804 @itemize *
17806 @item 
17807 "Implementation-defined aspects of pragma
17808 @code{Restrictions}.  See H.4(25)."
17809 @end itemize
17811 There are no implementation-defined aspects of pragma @code{Restrictions}.  The
17812 use of pragma @code{Restrictions [No_Exceptions]} has no effect on the
17813 generated code.  Checks must suppressed by use of pragma @code{Suppress}.
17816 @itemize *
17818 @item 
17819 "Any restrictions on pragma @code{Restrictions}.  See
17820 H.4(27)."
17821 @end itemize
17823 There are no restrictions on pragma @code{Restrictions}.
17825 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
17826 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{252}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{253}
17827 @chapter Intrinsic Subprograms
17830 @geindex Intrinsic Subprograms
17832 GNAT allows a user application program to write the declaration:
17834 @example
17835 pragma Import (Intrinsic, name);
17836 @end example
17838 providing that the name corresponds to one of the implemented intrinsic
17839 subprograms in GNAT, and that the parameter profile of the referenced
17840 subprogram meets the requirements.  This chapter describes the set of
17841 implemented intrinsic subprograms, and the requirements on parameter profiles.
17842 Note that no body is supplied; as with other uses of pragma Import, the
17843 body is supplied elsewhere (in this case by the compiler itself).  Note
17844 that any use of this feature is potentially non-portable, since the
17845 Ada standard does not require Ada compilers to implement this feature.
17847 @menu
17848 * Intrinsic Operators:: 
17849 * Compilation_ISO_Date:: 
17850 * Compilation_Date:: 
17851 * Compilation_Time:: 
17852 * Enclosing_Entity:: 
17853 * Exception_Information:: 
17854 * Exception_Message:: 
17855 * Exception_Name:: 
17856 * File:: 
17857 * Line:: 
17858 * Shifts and Rotates:: 
17859 * Source_Location:: 
17861 @end menu
17863 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
17864 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{254}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{255}
17865 @section Intrinsic Operators
17868 @geindex Intrinsic operator
17870 All the predefined numeric operators in package Standard
17871 in @code{pragma Import (Intrinsic,..)}
17872 declarations.  In the binary operator case, the operands must have the same
17873 size.  The operand or operands must also be appropriate for
17874 the operator.  For example, for addition, the operands must
17875 both be floating-point or both be fixed-point, and the
17876 right operand for @code{"**"} must have a root type of
17877 @code{Standard.Integer'Base}.
17878 You can use an intrinsic operator declaration as in the following example:
17880 @example
17881 type Int1 is new Integer;
17882 type Int2 is new Integer;
17884 function "+" (X1 : Int1; X2 : Int2) return Int1;
17885 function "+" (X1 : Int1; X2 : Int2) return Int2;
17886 pragma Import (Intrinsic, "+");
17887 @end example
17889 This declaration would permit 'mixed mode' arithmetic on items
17890 of the differing types @code{Int1} and @code{Int2}.
17891 It is also possible to specify such operators for private types, if the
17892 full views are appropriate arithmetic types.
17894 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
17895 @anchor{gnat_rm/intrinsic_subprograms id3}@anchor{256}@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{257}
17896 @section Compilation_ISO_Date
17899 @geindex Compilation_ISO_Date
17901 This intrinsic subprogram is used in the implementation of the
17902 library package @code{GNAT.Source_Info}.  The only useful use of the
17903 intrinsic import in this case is the one in this unit, so an
17904 application program should simply call the function
17905 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
17906 the current compilation (in local time format YYYY-MM-DD).
17908 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
17909 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{258}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{259}
17910 @section Compilation_Date
17913 @geindex Compilation_Date
17915 Same as Compilation_ISO_Date, except the string is in the form
17916 MMM DD YYYY.
17918 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
17919 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{25a}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{25b}
17920 @section Compilation_Time
17923 @geindex Compilation_Time
17925 This intrinsic subprogram is used in the implementation of the
17926 library package @code{GNAT.Source_Info}.  The only useful use of the
17927 intrinsic import in this case is the one in this unit, so an
17928 application program should simply call the function
17929 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
17930 the current compilation (in local time format HH:MM:SS).
17932 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
17933 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{25c}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{25d}
17934 @section Enclosing_Entity
17937 @geindex Enclosing_Entity
17939 This intrinsic subprogram is used in the implementation of the
17940 library package @code{GNAT.Source_Info}.  The only useful use of the
17941 intrinsic import in this case is the one in this unit, so an
17942 application program should simply call the function
17943 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
17944 the current subprogram, package, task, entry, or protected subprogram.
17946 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
17947 @anchor{gnat_rm/intrinsic_subprograms id7}@anchor{25e}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{25f}
17948 @section Exception_Information
17951 @geindex Exception_Information'
17953 This intrinsic subprogram is used in the implementation of the
17954 library package @code{GNAT.Current_Exception}.  The only useful
17955 use of the intrinsic import in this case is the one in this unit,
17956 so an application program should simply call the function
17957 @code{GNAT.Current_Exception.Exception_Information} to obtain
17958 the exception information associated with the current exception.
17960 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
17961 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{261}
17962 @section Exception_Message
17965 @geindex Exception_Message
17967 This intrinsic subprogram is used in the implementation of the
17968 library package @code{GNAT.Current_Exception}.  The only useful
17969 use of the intrinsic import in this case is the one in this unit,
17970 so an application program should simply call the function
17971 @code{GNAT.Current_Exception.Exception_Message} to obtain
17972 the message associated with the current exception.
17974 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
17975 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{263}
17976 @section Exception_Name
17979 @geindex Exception_Name
17981 This intrinsic subprogram is used in the implementation of the
17982 library package @code{GNAT.Current_Exception}.  The only useful
17983 use of the intrinsic import in this case is the one in this unit,
17984 so an application program should simply call the function
17985 @code{GNAT.Current_Exception.Exception_Name} to obtain
17986 the name of the current exception.
17988 @node File,Line,Exception_Name,Intrinsic Subprograms
17989 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms file}@anchor{265}
17990 @section File
17993 @geindex File
17995 This intrinsic subprogram is used in the implementation of the
17996 library package @code{GNAT.Source_Info}.  The only useful use of the
17997 intrinsic import in this case is the one in this unit, so an
17998 application program should simply call the function
17999 @code{GNAT.Source_Info.File} to obtain the name of the current
18000 file.
18002 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18003 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{267}
18004 @section Line
18007 @geindex Line
18009 This intrinsic subprogram is used in the implementation of the
18010 library package @code{GNAT.Source_Info}.  The only useful use of the
18011 intrinsic import in this case is the one in this unit, so an
18012 application program should simply call the function
18013 @code{GNAT.Source_Info.Line} to obtain the number of the current
18014 source line.
18016 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18017 @anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{269}
18018 @section Shifts and Rotates
18021 @geindex Shift_Left
18023 @geindex Shift_Right
18025 @geindex Shift_Right_Arithmetic
18027 @geindex Rotate_Left
18029 @geindex Rotate_Right
18031 In standard Ada, the shift and rotate functions are available only
18032 for the predefined modular types in package @code{Interfaces}.  However, in
18033 GNAT it is possible to define these functions for any integer
18034 type (signed or modular), as in this example:
18036 @example
18037 function Shift_Left
18038   (Value  : T;
18039    Amount : Natural) return T;
18040 @end example
18042 The function name must be one of
18043 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18044 Rotate_Right. T must be an integer type. T'Size must be
18045 8, 16, 32 or 64 bits; if T is modular, the modulus
18046 must be 2**8, 2**16, 2**32 or 2**64.
18047 The result type must be the same as the type of @code{Value}.
18048 The shift amount must be Natural.
18049 The formal parameter names can be anything.
18051 A more convenient way of providing these shift operators is to use
18052 the Provide_Shift_Operators pragma, which provides the function declarations
18053 and corresponding pragma Import's for all five shift functions.
18055 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18056 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{26b}
18057 @section Source_Location
18060 @geindex Source_Location
18062 This intrinsic subprogram is used in the implementation of the
18063 library routine @code{GNAT.Source_Info}.  The only useful use of the
18064 intrinsic import in this case is the one in this unit, so an
18065 application program should simply call the function
18066 @code{GNAT.Source_Info.Source_Location} to obtain the current
18067 source file location.
18069 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18070 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{26c}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{26d}
18071 @chapter Representation Clauses and Pragmas
18074 @geindex Representation Clauses
18076 @geindex Representation Clause
18078 @geindex Representation Pragma
18080 @geindex Pragma
18081 @geindex representation
18083 This section describes the representation clauses accepted by GNAT, and
18084 their effect on the representation of corresponding data objects.
18086 GNAT fully implements Annex C (Systems Programming).  This means that all
18087 the implementation advice sections in chapter 13 are fully implemented.
18088 However, these sections only require a minimal level of support for
18089 representation clauses.  GNAT provides much more extensive capabilities,
18090 and this section describes the additional capabilities provided.
18092 @menu
18093 * Alignment Clauses:: 
18094 * Size Clauses:: 
18095 * Storage_Size Clauses:: 
18096 * Size of Variant Record Objects:: 
18097 * Biased Representation:: 
18098 * Value_Size and Object_Size Clauses:: 
18099 * Component_Size Clauses:: 
18100 * Bit_Order Clauses:: 
18101 * Effect of Bit_Order on Byte Ordering:: 
18102 * Pragma Pack for Arrays:: 
18103 * Pragma Pack for Records:: 
18104 * Record Representation Clauses:: 
18105 * Handling of Records with Holes:: 
18106 * Enumeration Clauses:: 
18107 * Address Clauses:: 
18108 * Use of Address Clauses for Memory-Mapped I/O:: 
18109 * Effect of Convention on Representation:: 
18110 * Conventions and Anonymous Access Types:: 
18111 * Determining the Representations chosen by GNAT:: 
18113 @end menu
18115 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18116 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{26e}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{26f}
18117 @section Alignment Clauses
18120 @geindex Alignment Clause
18122 GNAT requires that all alignment clauses specify a power of 2, and all
18123 default alignments are always a power of 2.  The default alignment
18124 values are as follows:
18127 @itemize *
18129 @item 
18130 @emph{Elementary Types}.
18132 For elementary types, the alignment is the minimum of the actual size of
18133 objects of the type divided by @code{Storage_Unit},
18134 and the maximum alignment supported by the target.
18135 (This maximum alignment is given by the GNAT-specific attribute
18136 @code{Standard'Maximum_Alignment}; see @ref{189,,Attribute Maximum_Alignment}.)
18138 @geindex Maximum_Alignment attribute
18140 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18141 default alignment will be 8 on any target that supports alignments
18142 this large, but on some targets, the maximum alignment may be smaller
18143 than 8, in which case objects of type @code{Long_Float} will be maximally
18144 aligned.
18146 @item 
18147 @emph{Arrays}.
18149 For arrays, the alignment is equal to the alignment of the component type
18150 for the normal case where no packing or component size is given.  If the
18151 array is packed, and the packing is effective (see separate section on
18152 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18153 arrays or arrays whose length is not known at compile time, depending on
18154 whether the component size is divisible by 4, 2, or is odd.  For short packed
18155 arrays, which are handled internally as modular types, the alignment
18156 will be as described for elementary types, e.g. a packed array of length
18157 31 bits will have an object size of four bytes, and an alignment of 4.
18159 @item 
18160 @emph{Records}.
18162 For the normal unpacked case, the alignment of a record is equal to
18163 the maximum alignment of any of its components.  For tagged records, this
18164 includes the implicit access type used for the tag.  If a pragma @code{Pack}
18165 is used and all components are packable (see separate section on pragma
18166 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18167 record makes it profitable to increase it.
18169 A special case is when:
18172 @itemize *
18174 @item 
18175 the size of the record is given explicitly, or a
18176 full record representation clause is given, and
18178 @item 
18179 the size of the record is 2, 4, or 8 bytes.
18180 @end itemize
18182 In this case, an alignment is chosen to match the
18183 size of the record. For example, if we have:
18185 @example
18186 type Small is record
18187    A, B : Character;
18188 end record;
18189 for Small'Size use 16;
18190 @end example
18192 then the default alignment of the record type @code{Small} is 2, not 1. This
18193 leads to more efficient code when the record is treated as a unit, and also
18194 allows the type to specified as @code{Atomic} on architectures requiring
18195 strict alignment.
18196 @end itemize
18198 An alignment clause may specify a larger alignment than the default value
18199 up to some maximum value dependent on the target (obtainable by using the
18200 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18201 a smaller alignment than the default value for enumeration, integer and
18202 fixed point types, as well as for record types, for example
18204 @example
18205 type V is record
18206    A : Integer;
18207 end record;
18209 for V'alignment use 1;
18210 @end example
18212 @geindex Alignment
18213 @geindex default
18215 The default alignment for the type @code{V} is 4, as a result of the
18216 Integer field in the record, but it is permissible, as shown, to
18217 override the default alignment of the record with a smaller value.
18219 @geindex Alignment
18220 @geindex subtypes
18222 Note that according to the Ada standard, an alignment clause applies only
18223 to the first named subtype. If additional subtypes are declared, then the
18224 compiler is allowed to choose any alignment it likes, and there is no way
18225 to control this choice. Consider:
18227 @example
18228 type R is range 1 .. 10_000;
18229 for R'Alignment use 1;
18230 subtype RS is R range 1 .. 1000;
18231 @end example
18233 The alignment clause specifies an alignment of 1 for the first named subtype
18234 @code{R} but this does not necessarily apply to @code{RS}. When writing
18235 portable Ada code, you should avoid writing code that explicitly or
18236 implicitly relies on the alignment of such subtypes.
18238 For the GNAT compiler, if an explicit alignment clause is given, this
18239 value is also used for any subsequent subtypes. So for GNAT, in the
18240 above example, you can count on the alignment of @code{RS} being 1. But this
18241 assumption is non-portable, and other compilers may choose different
18242 alignments for the subtype @code{RS}.
18244 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18245 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{270}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{271}
18246 @section Size Clauses
18249 @geindex Size Clause
18251 The default size for a type @code{T} is obtainable through the
18252 language-defined attribute @code{T'Size} and also through the
18253 equivalent GNAT-defined attribute @code{T'Value_Size}.
18254 For objects of type @code{T}, GNAT will generally increase the type size
18255 so that the object size (obtainable through the GNAT-defined attribute
18256 @code{T'Object_Size})
18257 is a multiple of @code{T'Alignment * Storage_Unit}.
18259 For example:
18261 @example
18262 type Smallint is range 1 .. 6;
18264 type Rec is record
18265    Y1 : integer;
18266    Y2 : boolean;
18267 end record;
18268 @end example
18270 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18271 as specified by the RM rules,
18272 but objects of this type will have a size of 8
18273 (@code{Smallint'Object_Size} = 8),
18274 since objects by default occupy an integral number
18275 of storage units.  On some targets, notably older
18276 versions of the Digital Alpha, the size of stand
18277 alone objects of this type may be 32, reflecting
18278 the inability of the hardware to do byte load/stores.
18280 Similarly, the size of type @code{Rec} is 40 bits
18281 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18282 the alignment is 4, so objects of this type will have
18283 their size increased to 64 bits so that it is a multiple
18284 of the alignment (in bits).  This decision is
18285 in accordance with the specific Implementation Advice in RM 13.3(43):
18287 @quotation
18289 "A @code{Size} clause should be supported for an object if the specified
18290 @code{Size} is at least as large as its subtype's @code{Size}, and corresponds
18291 to a size in storage elements that is a multiple of the object's
18292 @code{Alignment} (if the @code{Alignment} is nonzero)."
18293 @end quotation
18295 An explicit size clause may be used to override the default size by
18296 increasing it.  For example, if we have:
18298 @example
18299 type My_Boolean is new Boolean;
18300 for My_Boolean'Size use 32;
18301 @end example
18303 then values of this type will always be 32 bits long.  In the case of
18304 discrete types, the size can be increased up to 64 bits, with the effect
18305 that the entire specified field is used to hold the value, sign- or
18306 zero-extended as appropriate.  If more than 64 bits is specified, then
18307 padding space is allocated after the value, and a warning is issued that
18308 there are unused bits.
18310 Similarly the size of records and arrays may be increased, and the effect
18311 is to add padding bits after the value.  This also causes a warning message
18312 to be generated.
18314 The largest Size value permitted in GNAT is 2**31-1.  Since this is a
18315 Size in bits, this corresponds to an object of size 256 megabytes (minus
18316 one).  This limitation is true on all targets.  The reason for this
18317 limitation is that it improves the quality of the code in many cases
18318 if it is known that a Size value can be accommodated in an object of
18319 type Integer.
18321 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18322 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{272}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{273}
18323 @section Storage_Size Clauses
18326 @geindex Storage_Size Clause
18328 For tasks, the @code{Storage_Size} clause specifies the amount of space
18329 to be allocated for the task stack.  This cannot be extended, and if the
18330 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18331 checking is enabled).  Use a @code{Storage_Size} attribute definition clause,
18332 or a @code{Storage_Size} pragma in the task definition to set the
18333 appropriate required size.  A useful technique is to include in every
18334 task definition a pragma of the form:
18336 @example
18337 pragma Storage_Size (Default_Stack_Size);
18338 @end example
18340 Then @code{Default_Stack_Size} can be defined in a global package, and
18341 modified as required. Any tasks requiring stack sizes different from the
18342 default can have an appropriate alternative reference in the pragma.
18344 You can also use the @emph{-d} binder switch to modify the default stack
18345 size.
18347 For access types, the @code{Storage_Size} clause specifies the maximum
18348 space available for allocation of objects of the type.  If this space is
18349 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18350 In the case where the access type is declared local to a subprogram, the
18351 use of a @code{Storage_Size} clause triggers automatic use of a special
18352 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18353 space for the pool is automatically reclaimed on exit from the scope in
18354 which the type is declared.
18356 A special case recognized by the compiler is the specification of a
18357 @code{Storage_Size} of zero for an access type.  This means that no
18358 items can be allocated from the pool, and this is recognized at compile
18359 time, and all the overhead normally associated with maintaining a fixed
18360 size storage pool is eliminated.  Consider the following example:
18362 @example
18363 procedure p is
18364    type R is array (Natural) of Character;
18365    type P is access all R;
18366    for P'Storage_Size use 0;
18367    --  Above access type intended only for interfacing purposes
18369    y : P;
18371    procedure g (m : P);
18372    pragma Import (C, g);
18374    --  ...
18376 begin
18377    --  ...
18378    y := new R;
18379 end;
18380 @end example
18382 As indicated in this example, these dummy storage pools are often useful in
18383 connection with interfacing where no object will ever be allocated.  If you
18384 compile the above example, you get the warning:
18386 @example
18387 p.adb:16:09: warning: allocation from empty storage pool
18388 p.adb:16:09: warning: Storage_Error will be raised at run time
18389 @end example
18391 Of course in practice, there will not be any explicit allocators in the
18392 case of such an access declaration.
18394 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18395 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{274}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{275}
18396 @section Size of Variant Record Objects
18399 @geindex Size
18400 @geindex variant record objects
18402 @geindex Variant record objects
18403 @geindex size
18405 In the case of variant record objects, there is a question whether Size gives
18406 information about a particular variant, or the maximum size required
18407 for any variant.  Consider the following program
18409 @example
18410 with Text_IO; use Text_IO;
18411 procedure q is
18412    type R1 (A : Boolean := False) is record
18413      case A is
18414        when True  => X : Character;
18415        when False => null;
18416      end case;
18417    end record;
18419    V1 : R1 (False);
18420    V2 : R1;
18422 begin
18423    Put_Line (Integer'Image (V1'Size));
18424    Put_Line (Integer'Image (V2'Size));
18425 end q;
18426 @end example
18428 Here we are dealing with a variant record, where the True variant
18429 requires 16 bits, and the False variant requires 8 bits.
18430 In the above example, both V1 and V2 contain the False variant,
18431 which is only 8 bits long.  However, the result of running the
18432 program is:
18434 @example
18437 @end example
18439 The reason for the difference here is that the discriminant value of
18440 V1 is fixed, and will always be False.  It is not possible to assign
18441 a True variant value to V1, therefore 8 bits is sufficient.  On the
18442 other hand, in the case of V2, the initial discriminant value is
18443 False (from the default), but it is possible to assign a True
18444 variant value to V2, therefore 16 bits must be allocated for V2
18445 in the general case, even fewer bits may be needed at any particular
18446 point during the program execution.
18448 As can be seen from the output of this program, the @code{'Size}
18449 attribute applied to such an object in GNAT gives the actual allocated
18450 size of the variable, which is the largest size of any of the variants.
18451 The Ada Reference Manual is not completely clear on what choice should
18452 be made here, but the GNAT behavior seems most consistent with the
18453 language in the RM.
18455 In some cases, it may be desirable to obtain the size of the current
18456 variant, rather than the size of the largest variant.  This can be
18457 achieved in GNAT by making use of the fact that in the case of a
18458 subprogram parameter, GNAT does indeed return the size of the current
18459 variant (because a subprogram has no way of knowing how much space
18460 is actually allocated for the actual).
18462 Consider the following modified version of the above program:
18464 @example
18465 with Text_IO; use Text_IO;
18466 procedure q is
18467    type R1 (A : Boolean := False) is record
18468      case A is
18469        when True  => X : Character;
18470        when False => null;
18471      end case;
18472    end record;
18474    V2 : R1;
18476    function Size (V : R1) return Integer is
18477    begin
18478       return V'Size;
18479    end Size;
18481 begin
18482    Put_Line (Integer'Image (V2'Size));
18483    Put_Line (Integer'Image (Size (V2)));
18484    V2 := (True, 'x');
18485    Put_Line (Integer'Image (V2'Size));
18486    Put_Line (Integer'Image (Size (V2)));
18487 end q;
18488 @end example
18490 The output from this program is
18492 @example
18497 @end example
18499 Here we see that while the @code{'Size} attribute always returns
18500 the maximum size, regardless of the current variant value, the
18501 @code{Size} function does indeed return the size of the current
18502 variant value.
18504 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18505 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{276}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{277}
18506 @section Biased Representation
18509 @geindex Size for biased representation
18511 @geindex Biased representation
18513 In the case of scalars with a range starting at other than zero, it is
18514 possible in some cases to specify a size smaller than the default minimum
18515 value, and in such cases, GNAT uses an unsigned biased representation,
18516 in which zero is used to represent the lower bound, and successive values
18517 represent successive values of the type.
18519 For example, suppose we have the declaration:
18521 @example
18522 type Small is range -7 .. -4;
18523 for Small'Size use 2;
18524 @end example
18526 Although the default size of type @code{Small} is 4, the @code{Size}
18527 clause is accepted by GNAT and results in the following representation
18528 scheme:
18530 @example
18531 -7 is represented as 2#00#
18532 -6 is represented as 2#01#
18533 -5 is represented as 2#10#
18534 -4 is represented as 2#11#
18535 @end example
18537 Biased representation is only used if the specified @code{Size} clause
18538 cannot be accepted in any other manner.  These reduced sizes that force
18539 biased representation can be used for all discrete types except for
18540 enumeration types for which a representation clause is given.
18542 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18543 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{279}
18544 @section Value_Size and Object_Size Clauses
18547 @geindex Value_Size
18549 @geindex Object_Size
18551 @geindex Size
18552 @geindex of objects
18554 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18555 number of bits required to hold values of type @code{T}.
18556 Although this interpretation was allowed in Ada 83, it was not required,
18557 and this requirement in practice can cause some significant difficulties.
18558 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18559 However, in Ada 95 and Ada 2005,
18560 @code{Natural'Size} is
18561 typically 31.  This means that code may change in behavior when moving
18562 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
18564 @example
18565 type Rec is record;
18566    A : Natural;
18567    B : Natural;
18568 end record;
18570 for Rec use record
18571    at 0  range 0 .. Natural'Size - 1;
18572    at 0  range Natural'Size .. 2 * Natural'Size - 1;
18573 end record;
18574 @end example
18576 In the above code, since the typical size of @code{Natural} objects
18577 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18578 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18579 there are cases where the fact that the object size can exceed the
18580 size of the type causes surprises.
18582 To help get around this problem GNAT provides two implementation
18583 defined attributes, @code{Value_Size} and @code{Object_Size}.  When
18584 applied to a type, these attributes yield the size of the type
18585 (corresponding to the RM defined size attribute), and the size of
18586 objects of the type respectively.
18588 The @code{Object_Size} is used for determining the default size of
18589 objects and components.  This size value can be referred to using the
18590 @code{Object_Size} attribute.  The phrase 'is used' here means that it is
18591 the basis of the determination of the size.  The backend is free to
18592 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18593 character might be stored in 32 bits on a machine with no efficient
18594 byte access instructions such as the Alpha.
18596 The default rules for the value of @code{Object_Size} for
18597 discrete types are as follows:
18600 @itemize *
18602 @item 
18603 The @code{Object_Size} for base subtypes reflect the natural hardware
18604 size in bits (run the compiler with @emph{-gnatS} to find those values
18605 for numeric types). Enumeration types and fixed-point base subtypes have
18606 8, 16, 32, or 64 bits for this size, depending on the range of values
18607 to be stored.
18609 @item 
18610 The @code{Object_Size} of a subtype is the same as the
18611 @code{Object_Size} of
18612 the type from which it is obtained.
18614 @item 
18615 The @code{Object_Size} of a derived base type is copied from the parent
18616 base type, and the @code{Object_Size} of a derived first subtype is copied
18617 from the parent first subtype.
18618 @end itemize
18620 The @code{Value_Size} attribute
18621 is the (minimum) number of bits required to store a value
18622 of the type.
18623 This value is used to determine how tightly to pack
18624 records or arrays with components of this type, and also affects
18625 the semantics of unchecked conversion (unchecked conversions where
18626 the @code{Value_Size} values differ generate a warning, and are potentially
18627 target dependent).
18629 The default rules for the value of @code{Value_Size} are as follows:
18632 @itemize *
18634 @item 
18635 The @code{Value_Size} for a base subtype is the minimum number of bits
18636 required to store all values of the type (including the sign bit
18637 only if negative values are possible).
18639 @item 
18640 If a subtype statically matches the first subtype of a given type, then it has
18641 by default the same @code{Value_Size} as the first subtype.  This is a
18642 consequence of RM 13.1(14): "if two subtypes statically match,
18643 then their subtype-specific aspects are the same".)
18645 @item 
18646 All other subtypes have a @code{Value_Size} corresponding to the minimum
18647 number of bits required to store all values of the subtype.  For
18648 dynamic bounds, it is assumed that the value can range down or up
18649 to the corresponding bound of the ancestor
18650 @end itemize
18652 The RM defined attribute @code{Size} corresponds to the
18653 @code{Value_Size} attribute.
18655 The @code{Size} attribute may be defined for a first-named subtype.  This sets
18656 the @code{Value_Size} of
18657 the first-named subtype to the given value, and the
18658 @code{Object_Size} of this first-named subtype to the given value padded up
18659 to an appropriate boundary.  It is a consequence of the default rules
18660 above that this @code{Object_Size} will apply to all further subtypes.  On the
18661 other hand, @code{Value_Size} is affected only for the first subtype, any
18662 dynamic subtypes obtained from it directly, and any statically matching
18663 subtypes.  The @code{Value_Size} of any other static subtypes is not affected.
18665 @code{Value_Size} and
18666 @code{Object_Size} may be explicitly set for any subtype using
18667 an attribute definition clause.  Note that the use of these attributes
18668 can cause the RM 13.1(14) rule to be violated.  If two access types
18669 reference aliased objects whose subtypes have differing @code{Object_Size}
18670 values as a result of explicit attribute definition clauses, then it
18671 is illegal to convert from one access subtype to the other. For a more
18672 complete description of this additional legality rule, see the
18673 description of the @code{Object_Size} attribute.
18675 To get a feel for the difference, consider the following examples (note
18676 that in each case the base is @code{Short_Short_Integer} with a size of 8):
18679 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} 
18680 @headitem
18682 Type or subtype declaration
18684 @tab
18686 Object_Size
18688 @tab
18690 Value_Size
18692 @item
18694 @code{type x1 is range 0 .. 5;}
18696 @tab
18700 @tab
18704 @item
18706 @code{type x2 is range 0 .. 5;}
18707 @code{for x2'size use 12;}
18709 @tab
18713 @tab
18717 @item
18719 @code{subtype x3 is x2 range 0 .. 3;}
18721 @tab
18725 @tab
18729 @item
18731 @code{subtype x4 is x2'base range 0 .. 10;}
18733 @tab
18737 @tab
18741 @item
18743 @code{dynamic : x2'Base range -64 .. +63;}
18745 @tab
18747 @tab
18749 @item
18751 @code{subtype x5 is x2 range 0 .. dynamic;}
18753 @tab
18757 @tab
18761 @item
18763 @code{subtype x6 is x2'base range 0 .. dynamic;}
18765 @tab
18769 @tab
18773 @end multitable
18776 Note: the entries marked '*' are not actually specified by the Ada
18777 Reference Manual, which has nothing to say about size in the dynamic
18778 case. What GNAT does is to allocate sufficient bits to accomodate any
18779 possible dynamic values for the bounds at run-time.
18781 So far, so good, but GNAT has to obey the RM rules, so the question is
18782 under what conditions must the RM @code{Size} be used.
18783 The following is a list
18784 of the occasions on which the RM @code{Size} must be used:
18787 @itemize *
18789 @item 
18790 Component size for packed arrays or records
18792 @item 
18793 Value of the attribute @code{Size} for a type
18795 @item 
18796 Warning about sizes not matching for unchecked conversion
18797 @end itemize
18799 For record types, the @code{Object_Size} is always a multiple of the
18800 alignment of the type (this is true for all types). In some cases the
18801 @code{Value_Size} can be smaller. Consider:
18803 @example
18804 type R is record
18805   X : Integer;
18806   Y : Character;
18807 end record;
18808 @end example
18810 On a typical 32-bit architecture, the X component will be four bytes, and
18811 require four-byte alignment, and the Y component will be one byte. In this
18812 case @code{R'Value_Size} will be 40 (bits) since this is the minimum size
18813 required to store a value of this type, and for example, it is permissible
18814 to have a component of type R in an outer array whose component size is
18815 specified to be 48 bits. However, @code{R'Object_Size} will be 64 (bits),
18816 since it must be rounded up so that this value is a multiple of the
18817 alignment (4 bytes = 32 bits).
18819 For all other types, the @code{Object_Size}
18820 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
18821 Only @code{Size} may be specified for such types.
18823 Note that @code{Value_Size} can be used to force biased representation
18824 for a particular subtype. Consider this example:
18826 @example
18827 type R is (A, B, C, D, E, F);
18828 subtype RAB is R range A .. B;
18829 subtype REF is R range E .. F;
18830 @end example
18832 By default, @code{RAB}
18833 has a size of 1 (sufficient to accommodate the representation
18834 of @code{A} and @code{B}, 0 and 1), and @code{REF}
18835 has a size of 3 (sufficient to accommodate the representation
18836 of @code{E} and @code{F}, 4 and 5). But if we add the
18837 following @code{Value_Size} attribute definition clause:
18839 @example
18840 for REF'Value_Size use 1;
18841 @end example
18843 then biased representation is forced for @code{REF},
18844 and 0 will represent @code{E} and 1 will represent @code{F}.
18845 A warning is issued when a @code{Value_Size} attribute
18846 definition clause forces biased representation. This
18847 warning can be turned off using @code{-gnatw.B}.
18849 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
18850 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{27b}
18851 @section Component_Size Clauses
18854 @geindex Component_Size Clause
18856 Normally, the value specified in a component size clause must be consistent
18857 with the subtype of the array component with regard to size and alignment.
18858 In other words, the value specified must be at least equal to the size
18859 of this subtype, and must be a multiple of the alignment value.
18861 In addition, component size clauses are allowed which cause the array
18862 to be packed, by specifying a smaller value.  A first case is for
18863 component size values in the range 1 through 63.  The value specified
18864 must not be smaller than the Size of the subtype.  GNAT will accurately
18865 honor all packing requests in this range.  For example, if we have:
18867 @example
18868 type r is array (1 .. 8) of Natural;
18869 for r'Component_Size use 31;
18870 @end example
18872 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
18873 Of course access to the components of such an array is considerably
18874 less efficient than if the natural component size of 32 is used.
18875 A second case is when the subtype of the component is a record type
18876 padded because of its default alignment.  For example, if we have:
18878 @example
18879 type r is record
18880   i : Integer;
18881   j : Integer;
18882   b : Boolean;
18883 end record;
18885 type a is array (1 .. 8) of r;
18886 for a'Component_Size use 72;
18887 @end example
18889 then the resulting array has a length of 72 bytes, instead of 96 bytes
18890 if the alignment of the record (4) was obeyed.
18892 Note that there is no point in giving both a component size clause
18893 and a pragma Pack for the same array type. if such duplicate
18894 clauses are given, the pragma Pack will be ignored.
18896 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
18897 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{27d}
18898 @section Bit_Order Clauses
18901 @geindex Bit_Order Clause
18903 @geindex bit ordering
18905 @geindex ordering
18906 @geindex of bits
18908 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
18909 attribute.  The specification may either correspond to the default bit
18910 order for the target, in which case the specification has no effect and
18911 places no additional restrictions, or it may be for the non-standard
18912 setting (that is the opposite of the default).
18914 In the case where the non-standard value is specified, the effect is
18915 to renumber bits within each byte, but the ordering of bytes is not
18916 affected.  There are certain
18917 restrictions placed on component clauses as follows:
18920 @itemize *
18922 @item 
18923 Components fitting within a single storage unit.
18925 These are unrestricted, and the effect is merely to renumber bits.  For
18926 example if we are on a little-endian machine with @code{Low_Order_First}
18927 being the default, then the following two declarations have exactly
18928 the same effect:
18930 @example
18931 type R1 is record
18932    A : Boolean;
18933    B : Integer range 1 .. 120;
18934 end record;
18936 for R1 use record
18937    A at 0 range 0 .. 0;
18938    B at 0 range 1 .. 7;
18939 end record;
18941 type R2 is record
18942    A : Boolean;
18943    B : Integer range 1 .. 120;
18944 end record;
18946 for R2'Bit_Order use High_Order_First;
18948 for R2 use record
18949    A at 0 range 7 .. 7;
18950    B at 0 range 0 .. 6;
18951 end record;
18952 @end example
18954 The useful application here is to write the second declaration with the
18955 @code{Bit_Order} attribute definition clause, and know that it will be treated
18956 the same, regardless of whether the target is little-endian or big-endian.
18958 @item 
18959 Components occupying an integral number of bytes.
18961 These are components that exactly fit in two or more bytes.  Such component
18962 declarations are allowed, but have no effect, since it is important to realize
18963 that the @code{Bit_Order} specification does not affect the ordering of bytes.
18964 In particular, the following attempt at getting an endian-independent integer
18965 does not work:
18967 @example
18968 type R2 is record
18969    A : Integer;
18970 end record;
18972 for R2'Bit_Order use High_Order_First;
18974 for R2 use record
18975    A at 0 range 0 .. 31;
18976 end record;
18977 @end example
18979 This declaration will result in a little-endian integer on a
18980 little-endian machine, and a big-endian integer on a big-endian machine.
18981 If byte flipping is required for interoperability between big- and
18982 little-endian machines, this must be explicitly programmed.  This capability
18983 is not provided by @code{Bit_Order}.
18985 @item 
18986 Components that are positioned across byte boundaries.
18988 but do not occupy an integral number of bytes.  Given that bytes are not
18989 reordered, such fields would occupy a non-contiguous sequence of bits
18990 in memory, requiring non-trivial code to reassemble.  They are for this
18991 reason not permitted, and any component clause specifying such a layout
18992 will be flagged as illegal by GNAT.
18993 @end itemize
18995 Since the misconception that Bit_Order automatically deals with all
18996 endian-related incompatibilities is a common one, the specification of
18997 a component field that is an integral number of bytes will always
18998 generate a warning.  This warning may be suppressed using @code{pragma Warnings (Off)}
18999 if desired.  The following section contains additional
19000 details regarding the issue of byte ordering.
19002 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19003 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{27f}
19004 @section Effect of Bit_Order on Byte Ordering
19007 @geindex byte ordering
19009 @geindex ordering
19010 @geindex of bytes
19012 In this section we will review the effect of the @code{Bit_Order} attribute
19013 definition clause on byte ordering.  Briefly, it has no effect at all, but
19014 a detailed example will be helpful.  Before giving this
19015 example, let us review the precise
19016 definition of the effect of defining @code{Bit_Order}.  The effect of a
19017 non-standard bit order is described in section 13.5.3 of the Ada
19018 Reference Manual:
19020 @quotation
19022 "2   A bit ordering is a method of interpreting the meaning of
19023 the storage place attributes."
19024 @end quotation
19026 To understand the precise definition of storage place attributes in
19027 this context, we visit section 13.5.1 of the manual:
19029 @quotation
19031 "13   A record_representation_clause (without the mod_clause)
19032 specifies the layout.  The storage place attributes (see 13.5.2)
19033 are taken from the values of the position, first_bit, and last_bit
19034 expressions after normalizing those values so that first_bit is
19035 less than Storage_Unit."
19036 @end quotation
19038 The critical point here is that storage places are taken from
19039 the values after normalization, not before.  So the @code{Bit_Order}
19040 interpretation applies to normalized values.  The interpretation
19041 is described in the later part of the 13.5.3 paragraph:
19043 @quotation
19045 "2   A bit ordering is a method of interpreting the meaning of
19046 the storage place attributes.  High_Order_First (known in the
19047 vernacular as 'big endian') means that the first bit of a
19048 storage element (bit 0) is the most significant bit (interpreting
19049 the sequence of bits that represent a component as an unsigned
19050 integer value).  Low_Order_First (known in the vernacular as
19051 'little endian') means the opposite: the first bit is the
19052 least significant."
19053 @end quotation
19055 Note that the numbering is with respect to the bits of a storage
19056 unit.  In other words, the specification affects only the numbering
19057 of bits within a single storage unit.
19059 We can make the effect clearer by giving an example.
19061 Suppose that we have an external device which presents two bytes, the first
19062 byte presented, which is the first (low addressed byte) of the two byte
19063 record is called Master, and the second byte is called Slave.
19065 The left most (most significant bit is called Control for each byte, and
19066 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
19067 (least significant) bit.
19069 On a big-endian machine, we can write the following representation clause
19071 @example
19072 type Data is record
19073    Master_Control : Bit;
19074    Master_V1      : Bit;
19075    Master_V2      : Bit;
19076    Master_V3      : Bit;
19077    Master_V4      : Bit;
19078    Master_V5      : Bit;
19079    Master_V6      : Bit;
19080    Master_V7      : Bit;
19081    Slave_Control  : Bit;
19082    Slave_V1       : Bit;
19083    Slave_V2       : Bit;
19084    Slave_V3       : Bit;
19085    Slave_V4       : Bit;
19086    Slave_V5       : Bit;
19087    Slave_V6       : Bit;
19088    Slave_V7       : Bit;
19089 end record;
19091 for Data use record
19092    Master_Control at 0 range 0 .. 0;
19093    Master_V1      at 0 range 1 .. 1;
19094    Master_V2      at 0 range 2 .. 2;
19095    Master_V3      at 0 range 3 .. 3;
19096    Master_V4      at 0 range 4 .. 4;
19097    Master_V5      at 0 range 5 .. 5;
19098    Master_V6      at 0 range 6 .. 6;
19099    Master_V7      at 0 range 7 .. 7;
19100    Slave_Control  at 1 range 0 .. 0;
19101    Slave_V1       at 1 range 1 .. 1;
19102    Slave_V2       at 1 range 2 .. 2;
19103    Slave_V3       at 1 range 3 .. 3;
19104    Slave_V4       at 1 range 4 .. 4;
19105    Slave_V5       at 1 range 5 .. 5;
19106    Slave_V6       at 1 range 6 .. 6;
19107    Slave_V7       at 1 range 7 .. 7;
19108 end record;
19109 @end example
19111 Now if we move this to a little endian machine, then the bit ordering within
19112 the byte is backwards, so we have to rewrite the record rep clause as:
19114 @example
19115 for Data use record
19116    Master_Control at 0 range 7 .. 7;
19117    Master_V1      at 0 range 6 .. 6;
19118    Master_V2      at 0 range 5 .. 5;
19119    Master_V3      at 0 range 4 .. 4;
19120    Master_V4      at 0 range 3 .. 3;
19121    Master_V5      at 0 range 2 .. 2;
19122    Master_V6      at 0 range 1 .. 1;
19123    Master_V7      at 0 range 0 .. 0;
19124    Slave_Control  at 1 range 7 .. 7;
19125    Slave_V1       at 1 range 6 .. 6;
19126    Slave_V2       at 1 range 5 .. 5;
19127    Slave_V3       at 1 range 4 .. 4;
19128    Slave_V4       at 1 range 3 .. 3;
19129    Slave_V5       at 1 range 2 .. 2;
19130    Slave_V6       at 1 range 1 .. 1;
19131    Slave_V7       at 1 range 0 .. 0;
19132 end record;
19133 @end example
19135 It is a nuisance to have to rewrite the clause, especially if
19136 the code has to be maintained on both machines.  However,
19137 this is a case that we can handle with the
19138 @code{Bit_Order} attribute if it is implemented.
19139 Note that the implementation is not required on byte addressed
19140 machines, but it is indeed implemented in GNAT.
19141 This means that we can simply use the
19142 first record clause, together with the declaration
19144 @example
19145 for Data'Bit_Order use High_Order_First;
19146 @end example
19148 and the effect is what is desired, namely the layout is exactly the same,
19149 independent of whether the code is compiled on a big-endian or little-endian
19150 machine.
19152 The important point to understand is that byte ordering is not affected.
19153 A @code{Bit_Order} attribute definition never affects which byte a field
19154 ends up in, only where it ends up in that byte.
19155 To make this clear, let us rewrite the record rep clause of the previous
19156 example as:
19158 @example
19159 for Data'Bit_Order use High_Order_First;
19160 for Data use record
19161    Master_Control at 0 range  0 .. 0;
19162    Master_V1      at 0 range  1 .. 1;
19163    Master_V2      at 0 range  2 .. 2;
19164    Master_V3      at 0 range  3 .. 3;
19165    Master_V4      at 0 range  4 .. 4;
19166    Master_V5      at 0 range  5 .. 5;
19167    Master_V6      at 0 range  6 .. 6;
19168    Master_V7      at 0 range  7 .. 7;
19169    Slave_Control  at 0 range  8 .. 8;
19170    Slave_V1       at 0 range  9 .. 9;
19171    Slave_V2       at 0 range 10 .. 10;
19172    Slave_V3       at 0 range 11 .. 11;
19173    Slave_V4       at 0 range 12 .. 12;
19174    Slave_V5       at 0 range 13 .. 13;
19175    Slave_V6       at 0 range 14 .. 14;
19176    Slave_V7       at 0 range 15 .. 15;
19177 end record;
19178 @end example
19180 This is exactly equivalent to saying (a repeat of the first example):
19182 @example
19183 for Data'Bit_Order use High_Order_First;
19184 for Data use record
19185    Master_Control at 0 range 0 .. 0;
19186    Master_V1      at 0 range 1 .. 1;
19187    Master_V2      at 0 range 2 .. 2;
19188    Master_V3      at 0 range 3 .. 3;
19189    Master_V4      at 0 range 4 .. 4;
19190    Master_V5      at 0 range 5 .. 5;
19191    Master_V6      at 0 range 6 .. 6;
19192    Master_V7      at 0 range 7 .. 7;
19193    Slave_Control  at 1 range 0 .. 0;
19194    Slave_V1       at 1 range 1 .. 1;
19195    Slave_V2       at 1 range 2 .. 2;
19196    Slave_V3       at 1 range 3 .. 3;
19197    Slave_V4       at 1 range 4 .. 4;
19198    Slave_V5       at 1 range 5 .. 5;
19199    Slave_V6       at 1 range 6 .. 6;
19200    Slave_V7       at 1 range 7 .. 7;
19201 end record;
19202 @end example
19204 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19205 field.  The storage place attributes are obtained by normalizing the
19206 values given so that the @code{First_Bit} value is less than 8.  After
19207 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19208 we specified in the other case.
19210 Now one might expect that the @code{Bit_Order} attribute might affect
19211 bit numbering within the entire record component (two bytes in this
19212 case, thus affecting which byte fields end up in), but that is not
19213 the way this feature is defined, it only affects numbering of bits,
19214 not which byte they end up in.
19216 Consequently it never makes sense to specify a starting bit number
19217 greater than 7 (for a byte addressable field) if an attribute
19218 definition for @code{Bit_Order} has been given, and indeed it
19219 may be actively confusing to specify such a value, so the compiler
19220 generates a warning for such usage.
19222 If you do need to control byte ordering then appropriate conditional
19223 values must be used.  If in our example, the slave byte came first on
19224 some machines we might write:
19226 @example
19227 Master_Byte_First constant Boolean := ...;
19229 Master_Byte : constant Natural :=
19230                 1 - Boolean'Pos (Master_Byte_First);
19231 Slave_Byte  : constant Natural :=
19232                 Boolean'Pos (Master_Byte_First);
19234 for Data'Bit_Order use High_Order_First;
19235 for Data use record
19236    Master_Control at Master_Byte range 0 .. 0;
19237    Master_V1      at Master_Byte range 1 .. 1;
19238    Master_V2      at Master_Byte range 2 .. 2;
19239    Master_V3      at Master_Byte range 3 .. 3;
19240    Master_V4      at Master_Byte range 4 .. 4;
19241    Master_V5      at Master_Byte range 5 .. 5;
19242    Master_V6      at Master_Byte range 6 .. 6;
19243    Master_V7      at Master_Byte range 7 .. 7;
19244    Slave_Control  at Slave_Byte  range 0 .. 0;
19245    Slave_V1       at Slave_Byte  range 1 .. 1;
19246    Slave_V2       at Slave_Byte  range 2 .. 2;
19247    Slave_V3       at Slave_Byte  range 3 .. 3;
19248    Slave_V4       at Slave_Byte  range 4 .. 4;
19249    Slave_V5       at Slave_Byte  range 5 .. 5;
19250    Slave_V6       at Slave_Byte  range 6 .. 6;
19251    Slave_V7       at Slave_Byte  range 7 .. 7;
19252 end record;
19253 @end example
19255 Now to switch between machines, all that is necessary is
19256 to set the boolean constant @code{Master_Byte_First} in
19257 an appropriate manner.
19259 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19260 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{281}
19261 @section Pragma Pack for Arrays
19264 @geindex Pragma Pack (for arrays)
19266 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19267 component type is @emph{packable}.  For a component type to be @emph{packable}, it must
19268 be one of the following cases:
19271 @itemize *
19273 @item 
19274 Any elementary type.
19276 @item 
19277 Any small packed array type with a static size.
19279 @item 
19280 Any small simple record type with a static size.
19281 @end itemize
19283 For all these cases, if the component subtype size is in the range
19284 1 through 64, then the effect of the pragma @code{Pack} is exactly as though a
19285 component size were specified giving the component subtype size.
19287 All other types are non-packable, they occupy an integral number of storage
19288 units and the only effect of pragma Pack is to remove alignment gaps.
19290 For example if we have:
19292 @example
19293 type r is range 0 .. 17;
19295 type ar is array (1 .. 8) of r;
19296 pragma Pack (ar);
19297 @end example
19299 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19300 and the size of the array @code{ar} will be exactly 40 bits).
19302 Note that in some cases this rather fierce approach to packing can produce
19303 unexpected effects.  For example, in Ada 95 and Ada 2005,
19304 subtype @code{Natural} typically has a size of 31, meaning that if you
19305 pack an array of @code{Natural}, you get 31-bit
19306 close packing, which saves a few bits, but results in far less efficient
19307 access.  Since many other Ada compilers will ignore such a packing request,
19308 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19309 might not be what is intended.  You can easily remove this warning by
19310 using an explicit @code{Component_Size} setting instead, which never generates
19311 a warning, since the intention of the programmer is clear in this case.
19313 GNAT treats packed arrays in one of two ways.  If the size of the array is
19314 known at compile time and is less than 64 bits, then internally the array
19315 is represented as a single modular type, of exactly the appropriate number
19316 of bits.  If the length is greater than 63 bits, or is not known at compile
19317 time, then the packed array is represented as an array of bytes, and the
19318 length is always a multiple of 8 bits.
19320 Note that to represent a packed array as a modular type, the alignment must
19321 be suitable for the modular type involved. For example, on typical machines
19322 a 32-bit packed array will be represented by a 32-bit modular integer with
19323 an alignment of four bytes. If you explicitly override the default alignment
19324 with an alignment clause that is too small, the modular representation
19325 cannot be used. For example, consider the following set of declarations:
19327 @example
19328 type R is range 1 .. 3;
19329 type S is array (1 .. 31) of R;
19330 for S'Component_Size use 2;
19331 for S'Size use 62;
19332 for S'Alignment use 1;
19333 @end example
19335 If the alignment clause were not present, then a 62-bit modular
19336 representation would be chosen (typically with an alignment of 4 or 8
19337 bytes depending on the target). But the default alignment is overridden
19338 with the explicit alignment clause. This means that the modular
19339 representation cannot be used, and instead the array of bytes
19340 representation must be used, meaning that the length must be a multiple
19341 of 8. Thus the above set of declarations will result in a diagnostic
19342 rejecting the size clause and noting that the minimum size allowed is 64.
19344 @geindex Pragma Pack (for type Natural)
19346 @geindex Pragma Pack warning
19348 One special case that is worth noting occurs when the base type of the
19349 component size is 8/16/32 and the subtype is one bit less. Notably this
19350 occurs with subtype @code{Natural}. Consider:
19352 @example
19353 type Arr is array (1 .. 32) of Natural;
19354 pragma Pack (Arr);
19355 @end example
19357 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19358 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19359 Ada 83 compilers did not attempt 31 bit packing.
19361 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19362 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19363 substantial unintended performance penalty when porting legacy Ada 83 code.
19364 To help prevent this, GNAT generates a warning in such cases. If you really
19365 want 31 bit packing in a case like this, you can set the component size
19366 explicitly:
19368 @example
19369 type Arr is array (1 .. 32) of Natural;
19370 for Arr'Component_Size use 31;
19371 @end example
19373 Here 31-bit packing is achieved as required, and no warning is generated,
19374 since in this case the programmer intention is clear.
19376 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19377 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{283}
19378 @section Pragma Pack for Records
19381 @geindex Pragma Pack (for records)
19383 Pragma @code{Pack} applied to a record will pack the components to reduce
19384 wasted space from alignment gaps and by reducing the amount of space
19385 taken by components.  We distinguish between @emph{packable} components and
19386 @emph{non-packable} components.
19387 Components of the following types are considered packable:
19390 @itemize *
19392 @item 
19393 Components of an elementary type are packable unless they are aliased,
19394 independent, or of an atomic type.
19396 @item 
19397 Small packed arrays, where the size is statically known, are represented
19398 internally as modular integers, and so they are also packable.
19400 @item 
19401 Small simple records, where the size is statically known, are also packable.
19402 @end itemize
19404 For all these cases, if the @code{'Size} value is in the range 1 through 64, the
19405 components occupy the exact number of bits corresponding to this value
19406 and are packed with no padding bits, i.e. they can start on an arbitrary
19407 bit boundary.
19409 All other types are non-packable, they occupy an integral number of storage
19410 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19412 For example, consider the record
19414 @example
19415 type Rb1 is array (1 .. 13) of Boolean;
19416 pragma Pack (Rb1);
19418 type Rb2 is array (1 .. 65) of Boolean;
19419 pragma Pack (Rb2);
19421 type AF is new Float with Atomic;
19423 type X2 is record
19424    L1 : Boolean;
19425    L2 : Duration;
19426    L3 : AF;
19427    L4 : Boolean;
19428    L5 : Rb1;
19429    L6 : Rb2;
19430 end record;
19431 pragma Pack (X2);
19432 @end example
19434 The representation for the record @code{X2} is as follows:
19436 @example
19437 for X2'Size use 224;
19438 for X2 use record
19439    L1 at  0 range  0 .. 0;
19440    L2 at  0 range  1 .. 64;
19441    L3 at 12 range  0 .. 31;
19442    L4 at 16 range  0 .. 0;
19443    L5 at 16 range  1 .. 13;
19444    L6 at 18 range  0 .. 71;
19445 end record;
19446 @end example
19448 Studying this example, we see that the packable fields @code{L1}
19449 and @code{L2} are
19450 of length equal to their sizes, and placed at specific bit boundaries (and
19451 not byte boundaries) to
19452 eliminate padding.  But @code{L3} is of a non-packable float type (because
19453 it is aliased), so it is on the next appropriate alignment boundary.
19455 The next two fields are fully packable, so @code{L4} and @code{L5} are
19456 minimally packed with no gaps.  However, type @code{Rb2} is a packed
19457 array that is longer than 64 bits, so it is itself non-packable.  Thus
19458 the @code{L6} field is aligned to the next byte boundary, and takes an
19459 integral number of bytes, i.e., 72 bits.
19461 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19462 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{285}
19463 @section Record Representation Clauses
19466 @geindex Record Representation Clause
19468 Record representation clauses may be given for all record types, including
19469 types obtained by record extension.  Component clauses are allowed for any
19470 static component.  The restrictions on component clauses depend on the type
19471 of the component.
19473 @geindex Component Clause
19475 For all components of an elementary type, the only restriction on component
19476 clauses is that the size must be at least the @code{'Size} value of the type
19477 (actually the Value_Size).  There are no restrictions due to alignment,
19478 and such components may freely cross storage boundaries.
19480 Packed arrays with a size up to and including 64 bits are represented
19481 internally using a modular type with the appropriate number of bits, and
19482 thus the same lack of restriction applies.  For example, if you declare:
19484 @example
19485 type R is array (1 .. 49) of Boolean;
19486 pragma Pack (R);
19487 for R'Size use 49;
19488 @end example
19490 then a component clause for a component of type @code{R} may start on any
19491 specified bit boundary, and may specify a value of 49 bits or greater.
19493 For packed bit arrays that are longer than 64 bits, there are two
19494 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19495 including the important case of single bits or boolean values, then
19496 there are no limitations on placement of such components, and they
19497 may start and end at arbitrary bit boundaries.
19499 If the component size is not a power of 2 (e.g., 3 or 5), then
19500 an array of this type longer than 64 bits must always be placed on
19501 on a storage unit (byte) boundary and occupy an integral number
19502 of storage units (bytes). Any component clause that does not
19503 meet this requirement will be rejected.
19505 Any aliased component, or component of an aliased type, must
19506 have its normal alignment and size. A component clause that
19507 does not meet this requirement will be rejected.
19509 The tag field of a tagged type always occupies an address sized field at
19510 the start of the record.  No component clause may attempt to overlay this
19511 tag. When a tagged type appears as a component, the tag field must have
19512 proper alignment
19514 In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied
19515 to the type @code{T1} can specify a storage location that would overlap the first
19516 @code{T'Size} bytes of the record.
19518 For all other component types, including non-bit-packed arrays,
19519 the component can be placed at an arbitrary bit boundary,
19520 so for example, the following is permitted:
19522 @example
19523 type R is array (1 .. 10) of Boolean;
19524 for R'Size use 80;
19526 type Q is record
19527    G, H : Boolean;
19528    L, M : R;
19529 end record;
19531 for Q use record
19532    G at 0 range  0 ..   0;
19533    H at 0 range  1 ..   1;
19534    L at 0 range  2 ..  81;
19535    R at 0 range 82 .. 161;
19536 end record;
19537 @end example
19539 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19540 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{286}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{287}
19541 @section Handling of Records with Holes
19544 @geindex Handling of Records with Holes
19546 As a result of alignment considerations, records may contain "holes"
19547 or gaps
19548 which do not correspond to the data bits of any of the components.
19549 Record representation clauses can also result in holes in records.
19551 GNAT does not attempt to clear these holes, so in record objects,
19552 they should be considered to hold undefined rubbish. The generated
19553 equality routine just tests components so does not access these
19554 undefined bits, and assignment and copy operations may or may not
19555 preserve the contents of these holes (for assignments, the holes
19556 in the target will in practice contain either the bits that are
19557 present in the holes in the source, or the bits that were present
19558 in the target before the assignment).
19560 If it is necessary to ensure that holes in records have all zero
19561 bits, then record objects for which this initialization is desired
19562 should be explicitly set to all zero values using Unchecked_Conversion
19563 or address overlays. For example
19565 @example
19566 type HRec is record
19567    C : Character;
19568    I : Integer;
19569 end record;
19570 @end example
19572 On typical machines, integers need to be aligned on a four-byte
19573 boundary, resulting in three bytes of undefined rubbish following
19574 the 8-bit field for C. To ensure that the hole in a variable of
19575 type HRec is set to all zero bits,
19576 you could for example do:
19578 @example
19579 type Base is record
19580    Dummy1, Dummy2 : Integer := 0;
19581 end record;
19583 BaseVar : Base;
19584 RealVar : Hrec;
19585 for RealVar'Address use BaseVar'Address;
19586 @end example
19588 Now the 8-bytes of the value of RealVar start out containing all zero
19589 bits. A safer approach is to just define dummy fields, avoiding the
19590 holes, as in:
19592 @example
19593 type HRec is record
19594    C      : Character;
19595    Dummy1 : Short_Short_Integer := 0;
19596    Dummy2 : Short_Short_Integer := 0;
19597    Dummy3 : Short_Short_Integer := 0;
19598    I      : Integer;
19599 end record;
19600 @end example
19602 And to make absolutely sure that the intent of this is followed, you
19603 can use representation clauses:
19605 @example
19606 for Hrec use record
19607    C      at 0 range 0 .. 7;
19608    Dummy1 at 1 range 0 .. 7;
19609    Dummy2 at 2 range 0 .. 7;
19610    Dummy3 at 3 range 0 .. 7;
19611    I      at 4 range 0 .. 31;
19612 end record;
19613 for Hrec'Size use 64;
19614 @end example
19616 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19617 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{289}
19618 @section Enumeration Clauses
19621 The only restriction on enumeration clauses is that the range of values
19622 must be representable.  For the signed case, if one or more of the
19623 representation values are negative, all values must be in the range:
19625 @example
19626 System.Min_Int .. System.Max_Int
19627 @end example
19629 For the unsigned case, where all values are nonnegative, the values must
19630 be in the range:
19632 @example
19633 0 .. System.Max_Binary_Modulus;
19634 @end example
19636 A @emph{confirming} representation clause is one in which the values range
19637 from 0 in sequence, i.e., a clause that confirms the default representation
19638 for an enumeration type.
19639 Such a confirming representation
19640 is permitted by these rules, and is specially recognized by the compiler so
19641 that no extra overhead results from the use of such a clause.
19643 If an array has an index type which is an enumeration type to which an
19644 enumeration clause has been applied, then the array is stored in a compact
19645 manner.  Consider the declarations:
19647 @example
19648 type r is (A, B, C);
19649 for r use (A => 1, B => 5, C => 10);
19650 type t is array (r) of Character;
19651 @end example
19653 The array type t corresponds to a vector with exactly three elements and
19654 has a default size equal to @code{3*Character'Size}.  This ensures efficient
19655 use of space, but means that accesses to elements of the array will incur
19656 the overhead of converting representation values to the corresponding
19657 positional values, (i.e., the value delivered by the @code{Pos} attribute).
19659 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19660 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{28b}
19661 @section Address Clauses
19664 @geindex Address Clause
19666 The reference manual allows a general restriction on representation clauses,
19667 as found in RM 13.1(22):
19669 @quotation
19671 "An implementation need not support representation
19672 items containing nonstatic expressions, except that
19673 an implementation should support a representation item
19674 for a given entity if each nonstatic expression in the
19675 representation item is a name that statically denotes
19676 a constant declared before the entity."
19677 @end quotation
19679 In practice this is applicable only to address clauses, since this is the
19680 only case in which a nonstatic expression is permitted by the syntax.  As
19681 the AARM notes in sections 13.1 (22.a-22.h):
19683 @quotation
19685 22.a   Reason: This is to avoid the following sort of thing:
19687 22.b        X : Integer := F(...);
19688 Y : Address := G(...);
19689 for X'Address use Y;
19691 22.c   In the above, we have to evaluate the
19692 initialization expression for X before we
19693 know where to put the result.  This seems
19694 like an unreasonable implementation burden.
19696 22.d   The above code should instead be written
19697 like this:
19699 22.e        Y : constant Address := G(...);
19700 X : Integer := F(...);
19701 for X'Address use Y;
19703 22.f   This allows the expression 'Y' to be safely
19704 evaluated before X is created.
19706 22.g   The constant could be a formal parameter of mode in.
19708 22.h   An implementation can support other nonstatic
19709 expressions if it wants to.  Expressions of type
19710 Address are hardly ever static, but their value
19711 might be known at compile time anyway in many
19712 cases.
19713 @end quotation
19715 GNAT does indeed permit many additional cases of nonstatic expressions.  In
19716 particular, if the type involved is elementary there are no restrictions
19717 (since in this case, holding a temporary copy of the initialization value,
19718 if one is present, is inexpensive).  In addition, if there is no implicit or
19719 explicit initialization, then there are no restrictions.  GNAT will reject
19720 only the case where all three of these conditions hold:
19723 @itemize *
19725 @item 
19726 The type of the item is non-elementary (e.g., a record or array).
19728 @item 
19729 There is explicit or implicit initialization required for the object.
19730 Note that access values are always implicitly initialized.
19732 @item 
19733 The address value is nonstatic.  Here GNAT is more permissive than the
19734 RM, and allows the address value to be the address of a previously declared
19735 stand-alone variable, as long as it does not itself have an address clause.
19737 @example
19738 Anchor  : Some_Initialized_Type;
19739 Overlay : Some_Initialized_Type;
19740 for Overlay'Address use Anchor'Address;
19741 @end example
19743 However, the prefix of the address clause cannot be an array component, or
19744 a component of a discriminated record.
19745 @end itemize
19747 As noted above in section 22.h, address values are typically nonstatic.  In
19748 particular the To_Address function, even if applied to a literal value, is
19749 a nonstatic function call.  To avoid this minor annoyance, GNAT provides
19750 the implementation defined attribute 'To_Address.  The following two
19751 expressions have identical values:
19753 @geindex Attribute
19755 @geindex To_Address
19757 @example
19758 To_Address (16#1234_0000#)
19759 System'To_Address (16#1234_0000#);
19760 @end example
19762 except that the second form is considered to be a static expression, and
19763 thus when used as an address clause value is always permitted.
19765 Additionally, GNAT treats as static an address clause that is an
19766 unchecked_conversion of a static integer value.  This simplifies the porting
19767 of legacy code, and provides a portable equivalent to the GNAT attribute
19768 @code{To_Address}.
19770 Another issue with address clauses is the interaction with alignment
19771 requirements.  When an address clause is given for an object, the address
19772 value must be consistent with the alignment of the object (which is usually
19773 the same as the alignment of the type of the object).  If an address clause
19774 is given that specifies an inappropriately aligned address value, then the
19775 program execution is erroneous.
19777 Since this source of erroneous behavior can have unfortunate effects on
19778 machines with strict alignment requirements, GNAT
19779 checks (at compile time if possible, generating a warning, or at execution
19780 time with a run-time check) that the alignment is appropriate.  If the
19781 run-time check fails, then @code{Program_Error} is raised.  This run-time
19782 check is suppressed if range checks are suppressed, or if the special GNAT
19783 check Alignment_Check is suppressed, or if
19784 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
19785 suppressed by default on non-strict alignment machines (such as the x86).
19787 Finally, GNAT does not permit overlaying of objects of class-wide types. In
19788 most cases, the compiler can detect an attempt at such overlays and will
19789 generate a warning at compile time and a Program_Error exception at run time.
19791 @geindex Export
19793 An address clause cannot be given for an exported object.  More
19794 understandably the real restriction is that objects with an address
19795 clause cannot be exported.  This is because such variables are not
19796 defined by the Ada program, so there is no external object to export.
19798 @geindex Import
19800 It is permissible to give an address clause and a pragma Import for the
19801 same object.  In this case, the variable is not really defined by the
19802 Ada program, so there is no external symbol to be linked.  The link name
19803 and the external name are ignored in this case.  The reason that we allow this
19804 combination is that it provides a useful idiom to avoid unwanted
19805 initializations on objects with address clauses.
19807 When an address clause is given for an object that has implicit or
19808 explicit initialization, then by default initialization takes place.  This
19809 means that the effect of the object declaration is to overwrite the
19810 memory at the specified address.  This is almost always not what the
19811 programmer wants, so GNAT will output a warning:
19813 @example
19814 with System;
19815 package G is
19816    type R is record
19817       M : Integer := 0;
19818    end record;
19820    Ext : R;
19821    for Ext'Address use System'To_Address (16#1234_1234#);
19822        |
19823 >>> warning: implicit initialization of "Ext" may
19824     modify overlaid storage
19825 >>> warning: use pragma Import for "Ext" to suppress
19826     initialization (RM B(24))
19828 end G;
19829 @end example
19831 As indicated by the warning message, the solution is to use a (dummy) pragma
19832 Import to suppress this initialization.  The pragma tell the compiler that the
19833 object is declared and initialized elsewhere.  The following package compiles
19834 without warnings (and the initialization is suppressed):
19836 @example
19837 with System;
19838 package G is
19839    type R is record
19840       M : Integer := 0;
19841    end record;
19843    Ext : R;
19844    for Ext'Address use System'To_Address (16#1234_1234#);
19845    pragma Import (Ada, Ext);
19846 end G;
19847 @end example
19849 A final issue with address clauses involves their use for overlaying
19850 variables, as in the following example:
19852 @geindex Overlaying of objects
19854 @example
19855 A : Integer;
19856 B : Integer;
19857 for B'Address use A'Address;
19858 @end example
19860 or alternatively, using the form recommended by the RM:
19862 @example
19863 A    : Integer;
19864 Addr : constant Address := A'Address;
19865 B    : Integer;
19866 for B'Address use Addr;
19867 @end example
19869 In both of these cases, @code{A} and @code{B} become aliased to one another
19870 via the address clause. This use of address clauses to overlay
19871 variables, achieving an effect similar to unchecked conversion
19872 was erroneous in Ada 83, but in Ada 95 and Ada 2005
19873 the effect is implementation defined. Furthermore, the
19874 Ada RM specifically recommends that in a situation
19875 like this, @code{B} should be subject to the following
19876 implementation advice (RM 13.3(19)):
19878 @quotation
19880 "19  If the Address of an object is specified, or it is imported
19881 or exported, then the implementation should not perform
19882 optimizations based on assumptions of no aliases."
19883 @end quotation
19885 GNAT follows this recommendation, and goes further by also applying
19886 this recommendation to the overlaid variable (@code{A} in the above example)
19887 in this case. This means that the overlay works "as expected", in that
19888 a modification to one of the variables will affect the value of the other.
19890 More generally, GNAT interprets this recommendation conservatively for
19891 address clauses: in the cases other than overlays, it considers that the
19892 object is effectively subject to pragma @code{Volatile} and implements the
19893 associated semantics.
19895 Note that when address clause overlays are used in this way, there is an
19896 issue of unintentional initialization, as shown by this example:
19898 @example
19899 package Overwrite_Record is
19900    type R is record
19901       A : Character := 'C';
19902       B : Character := 'A';
19903    end record;
19904    X : Short_Integer := 3;
19905    Y : R;
19906    for Y'Address use X'Address;
19907        |
19908 >>> warning: default initialization of "Y" may
19909     modify "X", use pragma Import for "Y" to
19910     suppress initialization (RM B.1(24))
19912 end Overwrite_Record;
19913 @end example
19915 Here the default initialization of @code{Y} will clobber the value
19916 of @code{X}, which justifies the warning. The warning notes that
19917 this effect can be eliminated by adding a @code{pragma Import}
19918 which suppresses the initialization:
19920 @example
19921 package Overwrite_Record is
19922    type R is record
19923       A : Character := 'C';
19924       B : Character := 'A';
19925    end record;
19926    X : Short_Integer := 3;
19927    Y : R;
19928    for Y'Address use X'Address;
19929    pragma Import (Ada, Y);
19930 end Overwrite_Record;
19931 @end example
19933 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
19934 be initialized when they would not otherwise have been in the absence
19935 of the use of this pragma. This may cause an overlay to have this
19936 unintended clobbering effect. The compiler avoids this for scalar
19937 types, but not for composite objects (where in general the effect
19938 of @code{Initialize_Scalars} is part of the initialization routine
19939 for the composite object:
19941 @example
19942 pragma Initialize_Scalars;
19943 with Ada.Text_IO;  use Ada.Text_IO;
19944 procedure Overwrite_Array is
19945    type Arr is array (1 .. 5) of Integer;
19946    X : Arr := (others => 1);
19947    A : Arr;
19948    for A'Address use X'Address;
19949        |
19950 >>> warning: default initialization of "A" may
19951     modify "X", use pragma Import for "A" to
19952     suppress initialization (RM B.1(24))
19954 begin
19955    if X /= Arr'(others => 1) then
19956       Put_Line ("X was clobbered");
19957    else
19958       Put_Line ("X was not clobbered");
19959    end if;
19960 end Overwrite_Array;
19961 @end example
19963 The above program generates the warning as shown, and at execution
19964 time, prints @code{X was clobbered}. If the @code{pragma Import} is
19965 added as suggested:
19967 @example
19968 pragma Initialize_Scalars;
19969 with Ada.Text_IO;  use Ada.Text_IO;
19970 procedure Overwrite_Array is
19971    type Arr is array (1 .. 5) of Integer;
19972    X : Arr := (others => 1);
19973    A : Arr;
19974    for A'Address use X'Address;
19975    pragma Import (Ada, A);
19976 begin
19977    if X /= Arr'(others => 1) then
19978       Put_Line ("X was clobbered");
19979    else
19980       Put_Line ("X was not clobbered");
19981    end if;
19982 end Overwrite_Array;
19983 @end example
19985 then the program compiles without the warning and when run will generate
19986 the output @code{X was not clobbered}.
19988 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
19989 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{28d}
19990 @section Use of Address Clauses for Memory-Mapped I/O
19993 @geindex Memory-mapped I/O
19995 A common pattern is to use an address clause to map an atomic variable to
19996 a location in memory that corresponds to a memory-mapped I/O operation or
19997 operations, for example:
19999 @example
20000 type Mem_Word is record
20001    A,B,C,D : Byte;
20002 end record;
20003 pragma Atomic (Mem_Word);
20004 for Mem_Word_Size use 32;
20006 Mem : Mem_Word;
20007 for Mem'Address use some-address;
20009 Temp := Mem;
20010 Temp.A := 32;
20011 Mem := Temp;
20012 @end example
20014 For a full access (reference or modification) of the variable (Mem) in this
20015 case, as in the above examples, GNAT guarantees that the entire atomic word
20016 will be accessed, in accordance with the RM C.6(15) clause.
20018 A problem arises with a component access such as:
20020 @example
20021 Mem.A := 32;
20022 @end example
20024 Note that the component A is not declared as atomic. This means that it is
20025 not clear what this assignment means. It could correspond to full word read
20026 and write as given in the first example, or on architectures that supported
20027 such an operation it might be a single byte store instruction. The RM does
20028 not have anything to say in this situation, and GNAT does not make any
20029 guarantee. The code generated may vary from target to target. GNAT will issue
20030 a warning in such a case:
20032 @example
20033 Mem.A := 32;
20035 >>> warning: access to non-atomic component of atomic array,
20036     may cause unexpected accesses to atomic object
20037 @end example
20039 It is best to be explicit in this situation, by either declaring the
20040 components to be atomic if you want the byte store, or explicitly writing
20041 the full word access sequence if that is what the hardware requires.
20042 Alternatively, if the full word access sequence is required, GNAT also
20043 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20044 pragma @code{Atomic} and will give the additional guarantee.
20046 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20047 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{28f}
20048 @section Effect of Convention on Representation
20051 @geindex Convention
20052 @geindex effect on representation
20054 Normally the specification of a foreign language convention for a type or
20055 an object has no effect on the chosen representation.  In particular, the
20056 representation chosen for data in GNAT generally meets the standard system
20057 conventions, and for example records are laid out in a manner that is
20058 consistent with C.  This means that specifying convention C (for example)
20059 has no effect.
20061 There are four exceptions to this general rule:
20064 @itemize *
20066 @item 
20067 @emph{Convention Fortran and array subtypes}.
20069 If pragma Convention Fortran is specified for an array subtype, then in
20070 accordance with the implementation advice in section 3.6.2(11) of the
20071 Ada Reference Manual, the array will be stored in a Fortran-compatible
20072 column-major manner, instead of the normal default row-major order.
20074 @item 
20075 @emph{Convention C and enumeration types}
20077 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20078 to accommodate all values of the type.  For example, for the enumeration
20079 type declared by:
20081 @example
20082 type Color is (Red, Green, Blue);
20083 @end example
20085 8 bits is sufficient to store all values of the type, so by default, objects
20086 of type @code{Color} will be represented using 8 bits.  However, normal C
20087 convention is to use 32 bits for all enum values in C, since enum values
20088 are essentially of type int.  If pragma @code{Convention C} is specified for an
20089 Ada enumeration type, then the size is modified as necessary (usually to
20090 32 bits) to be consistent with the C convention for enum values.
20092 Note that this treatment applies only to types. If Convention C is given for
20093 an enumeration object, where the enumeration type is not Convention C, then
20094 Object_Size bits are allocated. For example, for a normal enumeration type,
20095 with less than 256 elements, only 8 bits will be allocated for the object.
20096 Since this may be a surprise in terms of what C expects, GNAT will issue a
20097 warning in this situation. The warning can be suppressed by giving an explicit
20098 size clause specifying the desired size.
20100 @item 
20101 @emph{Convention C/Fortran and Boolean types}
20103 In C, the usual convention for boolean values, that is values used for
20104 conditions, is that zero represents false, and nonzero values represent
20105 true.  In Ada, the normal convention is that two specific values, typically
20106 0/1, are used to represent false/true respectively.
20108 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20109 value represents true).
20111 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20112 C or Fortran convention for a derived Boolean, as in the following example:
20114 @example
20115 type C_Switch is new Boolean;
20116 pragma Convention (C, C_Switch);
20117 @end example
20119 then the GNAT generated code will treat any nonzero value as true.  For truth
20120 values generated by GNAT, the conventional value 1 will be used for True, but
20121 when one of these values is read, any nonzero value is treated as True.
20122 @end itemize
20124 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20125 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{291}
20126 @section Conventions and Anonymous Access Types
20129 @geindex Anonymous access types
20131 @geindex Convention for anonymous access types
20133 The RM is not entirely clear on convention handling in a number of cases,
20134 and in particular, it is not clear on the convention to be given to
20135 anonymous access types in general, and in particular what is to be
20136 done for the case of anonymous access-to-subprogram.
20138 In GNAT, we decide that if an explicit Convention is applied
20139 to an object or component, and its type is such an anonymous type,
20140 then the convention will apply to this anonymous type as well. This
20141 seems to make sense since it is anomolous in any case to have a
20142 different convention for an object and its type, and there is clearly
20143 no way to explicitly specify a convention for an anonymous type, since
20144 it doesn't have a name to specify!
20146 Furthermore, we decide that if a convention is applied to a record type,
20147 then this convention is inherited by any of its components that are of an
20148 anonymous access type which do not have an explicitly specified convention.
20150 The following program shows these conventions in action:
20152 @example
20153 package ConvComp is
20154    type Foo is range 1 .. 10;
20155    type T1 is record
20156       A : access function (X : Foo) return Integer;
20157       B : Integer;
20158    end record;
20159    pragma Convention (C, T1);
20161    type T2 is record
20162       A : access function (X : Foo) return Integer;
20163       pragma Convention  (C, A);
20164       B : Integer;
20165    end record;
20166    pragma Convention (COBOL, T2);
20168    type T3 is record
20169       A : access function (X : Foo) return Integer;
20170       pragma Convention  (COBOL, A);
20171       B : Integer;
20172    end record;
20173    pragma Convention (C, T3);
20175    type T4 is record
20176       A : access function (X : Foo) return Integer;
20177       B : Integer;
20178    end record;
20179    pragma Convention (COBOL, T4);
20181    function F (X : Foo) return Integer;
20182    pragma Convention (C, F);
20184    function F (X : Foo) return Integer is (13);
20186    TV1 : T1 := (F'Access, 12);  -- OK
20187    TV2 : T2 := (F'Access, 13);  -- OK
20189    TV3 : T3 := (F'Access, 13);  -- ERROR
20190                 |
20191 >>> subprogram "F" has wrong convention
20192 >>> does not match access to subprogram declared at line 17
20193      38.    TV4 : T4 := (F'Access, 13);  -- ERROR
20194                 |
20195 >>> subprogram "F" has wrong convention
20196 >>> does not match access to subprogram declared at line 24
20197      39. end ConvComp;
20198 @end example
20200 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20201 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{293}
20202 @section Determining the Representations chosen by GNAT
20205 @geindex Representation
20206 @geindex determination of
20208 @geindex -gnatR (gcc)
20210 Although the descriptions in this section are intended to be complete, it is
20211 often easier to simply experiment to see what GNAT accepts and what the
20212 effect is on the layout of types and objects.
20214 As required by the Ada RM, if a representation clause is not accepted, then
20215 it must be rejected as illegal by the compiler.  However, when a
20216 representation clause or pragma is accepted, there can still be questions
20217 of what the compiler actually does.  For example, if a partial record
20218 representation clause specifies the location of some components and not
20219 others, then where are the non-specified components placed? Or if pragma
20220 @code{Pack} is used on a record, then exactly where are the resulting
20221 fields placed? The section on pragma @code{Pack} in this chapter can be
20222 used to answer the second question, but it is often easier to just see
20223 what the compiler does.
20225 For this purpose, GNAT provides the option @emph{-gnatR}.  If you compile
20226 with this option, then the compiler will output information on the actual
20227 representations chosen, in a format similar to source representation
20228 clauses.  For example, if we compile the package:
20230 @example
20231 package q is
20232    type r (x : boolean) is tagged record
20233       case x is
20234          when True => S : String (1 .. 100);
20235          when False => null;
20236       end case;
20237    end record;
20239    type r2 is new r (false) with record
20240       y2 : integer;
20241    end record;
20243    for r2 use record
20244       y2 at 16 range 0 .. 31;
20245    end record;
20247    type x is record
20248       y : character;
20249    end record;
20251    type x1 is array (1 .. 10) of x;
20252    for x1'component_size use 11;
20254    type ia is access integer;
20256    type Rb1 is array (1 .. 13) of Boolean;
20257    pragma Pack (rb1);
20259    type Rb2 is array (1 .. 65) of Boolean;
20260    pragma Pack (rb2);
20262    type x2 is record
20263       l1 : Boolean;
20264       l2 : Duration;
20265       l3 : Float;
20266       l4 : Boolean;
20267       l5 : Rb1;
20268       l6 : Rb2;
20269    end record;
20270    pragma Pack (x2);
20271 end q;
20272 @end example
20274 using the switch @emph{-gnatR} we obtain the following output:
20276 @example
20277 Representation information for unit q
20278 -------------------------------------
20280 for r'Size use ??;
20281 for r'Alignment use 4;
20282 for r use record
20283    x    at 4 range  0 .. 7;
20284    _tag at 0 range  0 .. 31;
20285    s    at 5 range  0 .. 799;
20286 end record;
20288 for r2'Size use 160;
20289 for r2'Alignment use 4;
20290 for r2 use record
20291    x       at  4 range  0 .. 7;
20292    _tag    at  0 range  0 .. 31;
20293    _parent at  0 range  0 .. 63;
20294    y2      at 16 range  0 .. 31;
20295 end record;
20297 for x'Size use 8;
20298 for x'Alignment use 1;
20299 for x use record
20300    y at 0 range  0 .. 7;
20301 end record;
20303 for x1'Size use 112;
20304 for x1'Alignment use 1;
20305 for x1'Component_Size use 11;
20307 for rb1'Size use 13;
20308 for rb1'Alignment use 2;
20309 for rb1'Component_Size use 1;
20311 for rb2'Size use 72;
20312 for rb2'Alignment use 1;
20313 for rb2'Component_Size use 1;
20315 for x2'Size use 224;
20316 for x2'Alignment use 4;
20317 for x2 use record
20318    l1 at  0 range  0 .. 0;
20319    l2 at  0 range  1 .. 64;
20320    l3 at 12 range  0 .. 31;
20321    l4 at 16 range  0 .. 0;
20322    l5 at 16 range  1 .. 13;
20323    l6 at 18 range  0 .. 71;
20324 end record;
20325 @end example
20327 The Size values are actually the Object_Size, i.e., the default size that
20328 will be allocated for objects of the type.
20329 The @code{??} size for type r indicates that we have a variant record, and the
20330 actual size of objects will depend on the discriminant value.
20332 The Alignment values show the actual alignment chosen by the compiler
20333 for each record or array type.
20335 The record representation clause for type r shows where all fields
20336 are placed, including the compiler generated tag field (whose location
20337 cannot be controlled by the programmer).
20339 The record representation clause for the type extension r2 shows all the
20340 fields present, including the parent field, which is a copy of the fields
20341 of the parent type of r2, i.e., r1.
20343 The component size and size clauses for types rb1 and rb2 show
20344 the exact effect of pragma @code{Pack} on these arrays, and the record
20345 representation clause for type x2 shows how pragma @cite{Pack} affects
20346 this record type.
20348 In some cases, it may be useful to cut and paste the representation clauses
20349 generated by the compiler into the original source to fix and guarantee
20350 the actual representation to be used.
20352 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20353 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{294}@anchor{gnat_rm/standard_library_routines id1}@anchor{295}
20354 @chapter Standard Library Routines
20357 The Ada Reference Manual contains in Annex A a full description of an
20358 extensive set of standard library routines that can be used in any Ada
20359 program, and which must be provided by all Ada compilers.  They are
20360 analogous to the standard C library used by C programs.
20362 GNAT implements all of the facilities described in annex A, and for most
20363 purposes the description in the Ada Reference Manual, or appropriate Ada
20364 text book, will be sufficient for making use of these facilities.
20366 In the case of the input-output facilities,
20367 @ref{f,,The Implementation of Standard I/O},
20368 gives details on exactly how GNAT interfaces to the
20369 file system.  For the remaining packages, the Ada Reference Manual
20370 should be sufficient.  The following is a list of the packages included,
20371 together with a brief description of the functionality that is provided.
20373 For completeness, references are included to other predefined library
20374 routines defined in other sections of the Ada Reference Manual (these are
20375 cross-indexed from Annex A). For further details see the relevant
20376 package declarations in the run-time library. In particular, a few units
20377 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20378 and in this case the package declaration contains comments explaining why
20379 the unit is not implemented.
20382 @table @asis
20384 @item @code{Ada} @emph{(A.2)}
20386 This is a parent package for all the standard library packages.  It is
20387 usually included implicitly in your program, and itself contains no
20388 useful data or routines.
20390 @item @code{Ada.Assertions} @emph{(11.4.2)}
20392 @code{Assertions} provides the @code{Assert} subprograms, and also
20393 the declaration of the @code{Assertion_Error} exception.
20395 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
20397 @code{Asynchronous_Task_Control} provides low level facilities for task
20398 synchronization. It is typically not implemented. See package spec for details.
20400 @item @code{Ada.Calendar} @emph{(9.6)}
20402 @code{Calendar} provides time of day access, and routines for
20403 manipulating times and durations.
20405 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
20407 This package provides additional arithmetic
20408 operations for @code{Calendar}.
20410 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20412 This package provides formatting operations for @code{Calendar}.
20414 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20416 This package provides additional @code{Calendar} facilities
20417 for handling time zones.
20419 @item @code{Ada.Characters} @emph{(A.3.1)}
20421 This is a dummy parent package that contains no useful entities
20423 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20425 This package provides character conversion functions.
20427 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20429 This package provides some basic character handling capabilities,
20430 including classification functions for classes of characters (e.g., test
20431 for letters, or digits).
20433 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20435 This package includes a complete set of definitions of the characters
20436 that appear in type CHARACTER.  It is useful for writing programs that
20437 will run in international environments.  For example, if you want an
20438 upper case E with an acute accent in a string, it is often better to use
20439 the definition of @code{UC_E_Acute} in this package.  Then your program
20440 will print in an understandable manner even if your environment does not
20441 support these extended characters.
20443 @item @code{Ada.Command_Line} @emph{(A.15)}
20445 This package provides access to the command line parameters and the name
20446 of the current program (analogous to the use of @code{argc} and @code{argv}
20447 in C), and also allows the exit status for the program to be set in a
20448 system-independent manner.
20450 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20452 This package provides text input and output of complex numbers.
20454 @item @code{Ada.Containers} @emph{(A.18.1)}
20456 A top level package providing a few basic definitions used by all the
20457 following specific child packages that provide specific kinds of
20458 containers.
20459 @end table
20461 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20463 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20465 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20467 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20469 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20471 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20473 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20475 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20477 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20479 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20481 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20483 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20485 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20487 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20489 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20491 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20493 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20495 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20497 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20499 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20501 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20503 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20505 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20508 @table @asis
20510 @item @code{Ada.Directories} @emph{(A.16)}
20512 This package provides operations on directories.
20514 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20516 This package provides additional directory operations handling
20517 hiearchical file names.
20519 @item @code{Ada.Directories.Information} @emph{(A.16)}
20521 This is an implementation defined package for additional directory
20522 operations, which is not implemented in GNAT.
20524 @item @code{Ada.Decimal} @emph{(F.2)}
20526 This package provides constants describing the range of decimal numbers
20527 implemented, and also a decimal divide routine (analogous to the COBOL
20528 verb DIVIDE ... GIVING ... REMAINDER ...)
20530 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20532 This package provides input-output using a model of a set of records of
20533 fixed-length, containing an arbitrary definite Ada type, indexed by an
20534 integer record number.
20536 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20538 A parent package containing definitions for task dispatching operations.
20540 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20542 Not implemented in GNAT.
20544 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20546 Not implemented in GNAT.
20548 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20550 Not implemented in GNAT.
20552 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20554 This package allows the priorities of a task to be adjusted dynamically
20555 as the task is running.
20557 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20559 This package provides facilities for accessing environment variables.
20561 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20563 This package provides additional information on exceptions, and also
20564 contains facilities for treating exceptions as data objects, and raising
20565 exceptions with associated messages.
20567 @item @code{Ada.Execution_Time} @emph{(D.14)}
20569 This package provides CPU clock functionalities. It is not implemented on
20570 all targets (see package spec for details).
20572 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20574 Not implemented in GNAT.
20576 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20578 Not implemented in GNAT.
20580 @item @code{Ada.Finalization} @emph{(7.6)}
20582 This package contains the declarations and subprograms to support the
20583 use of controlled types, providing for automatic initialization and
20584 finalization (analogous to the constructors and destructors of C++).
20586 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20588 A library level instantiation of Text_IO.Float_IO for type Float.
20590 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20592 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20594 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20596 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20598 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20600 A library level instantiation of Text_IO.Integer_IO for type Integer.
20602 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20604 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20606 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20608 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20610 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20612 This package provides facilities for interfacing to interrupts, which
20613 includes the set of signals or conditions that can be raised and
20614 recognized as interrupts.
20616 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20618 This package provides the set of interrupt names (actually signal
20619 or condition names) that can be handled by GNAT.
20621 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20623 This package defines the set of exceptions that can be raised by use of
20624 the standard IO packages.
20626 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20628 This package provides a generic interface to generalized iterators.
20630 @item @code{Ada.Locales} @emph{(A.19)}
20632 This package provides declarations providing information (Language
20633 and Country) about the current locale.
20635 @item @code{Ada.Numerics}
20637 This package contains some standard constants and exceptions used
20638 throughout the numerics packages.  Note that the constants pi and e are
20639 defined here, and it is better to use these definitions than rolling
20640 your own.
20642 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20644 Provides operations on arrays of complex numbers.
20646 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20648 Provides the implementation of standard elementary functions (such as
20649 log and trigonometric functions) operating on complex numbers using the
20650 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
20651 created by the package @code{Numerics.Complex_Types}.
20653 @item @code{Ada.Numerics.Complex_Types}
20655 This is a predefined instantiation of
20656 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
20657 build the type @code{Complex} and @code{Imaginary}.
20659 @item @code{Ada.Numerics.Discrete_Random}
20661 This generic package provides a random number generator suitable for generating
20662 uniformly distributed values of a specified discrete subtype.
20664 @item @code{Ada.Numerics.Float_Random}
20666 This package provides a random number generator suitable for generating
20667 uniformly distributed floating point values in the unit interval.
20669 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20671 This is a generic version of the package that provides the
20672 implementation of standard elementary functions (such as log and
20673 trigonometric functions) for an arbitrary complex type.
20675 The following predefined instantiations of this package are provided:
20678 @itemize *
20680 @item 
20681 @code{Short_Float}
20683 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
20685 @item 
20686 @code{Float}
20688 @code{Ada.Numerics.Complex_Elementary_Functions}
20690 @item 
20691 @code{Long_Float}
20693 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
20694 @end itemize
20696 @item @code{Ada.Numerics.Generic_Complex_Types}
20698 This is a generic package that allows the creation of complex types,
20699 with associated complex arithmetic operations.
20701 The following predefined instantiations of this package exist
20704 @itemize *
20706 @item 
20707 @code{Short_Float}
20709 @code{Ada.Numerics.Short_Complex_Complex_Types}
20711 @item 
20712 @code{Float}
20714 @code{Ada.Numerics.Complex_Complex_Types}
20716 @item 
20717 @code{Long_Float}
20719 @code{Ada.Numerics.Long_Complex_Complex_Types}
20720 @end itemize
20722 @item @code{Ada.Numerics.Generic_Elementary_Functions}
20724 This is a generic package that provides the implementation of standard
20725 elementary functions (such as log an trigonometric functions) for an
20726 arbitrary float type.
20728 The following predefined instantiations of this package exist
20731 @itemize *
20733 @item 
20734 @code{Short_Float}
20736 @code{Ada.Numerics.Short_Elementary_Functions}
20738 @item 
20739 @code{Float}
20741 @code{Ada.Numerics.Elementary_Functions}
20743 @item 
20744 @code{Long_Float}
20746 @code{Ada.Numerics.Long_Elementary_Functions}
20747 @end itemize
20749 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
20751 Generic operations on arrays of reals
20753 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
20755 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
20757 @item @code{Ada.Real_Time} @emph{(D.8)}
20759 This package provides facilities similar to those of @code{Calendar}, but
20760 operating with a finer clock suitable for real time control. Note that
20761 annex D requires that there be no backward clock jumps, and GNAT generally
20762 guarantees this behavior, but of course if the external clock on which
20763 the GNAT runtime depends is deliberately reset by some external event,
20764 then such a backward jump may occur.
20766 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
20768 Not implemented in GNAT.
20770 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
20772 This package provides input-output facilities for sequential files,
20773 which can contain a sequence of values of a single type, which can be
20774 any Ada type, including indefinite (unconstrained) types.
20776 @item @code{Ada.Storage_IO} @emph{(A.9)}
20778 This package provides a facility for mapping arbitrary Ada types to and
20779 from a storage buffer.  It is primarily intended for the creation of new
20780 IO packages.
20782 @item @code{Ada.Streams} @emph{(13.13.1)}
20784 This is a generic package that provides the basic support for the
20785 concept of streams as used by the stream attributes (@code{Input},
20786 @code{Output}, @code{Read} and @code{Write}).
20788 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
20790 This package is a specialization of the type @code{Streams} defined in
20791 package @code{Streams} together with a set of operations providing
20792 Stream_IO capability.  The Stream_IO model permits both random and
20793 sequential access to a file which can contain an arbitrary set of values
20794 of one or more Ada types.
20796 @item @code{Ada.Strings} @emph{(A.4.1)}
20798 This package provides some basic constants used by the string handling
20799 packages.
20801 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
20803 This package provides facilities for handling variable length
20804 strings.  The bounded model requires a maximum length.  It is thus
20805 somewhat more limited than the unbounded model, but avoids the use of
20806 dynamic allocation or finalization.
20808 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20810 Provides case-insensitive comparisons of bounded strings
20812 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
20814 This package provides a generic hash function for bounded strings
20816 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20818 This package provides a generic hash function for bounded strings that
20819 converts the string to be hashed to lower case.
20821 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
20823 This package provides a comparison function for bounded strings that works
20824 in a case insensitive manner by converting to lower case before the comparison.
20826 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
20828 This package provides facilities for handling fixed length strings.
20830 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
20832 This package provides an equality function for fixed strings that compares
20833 the strings after converting both to lower case.
20835 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
20837 This package provides a case insensitive hash function for fixed strings that
20838 converts the string to lower case before computing the hash.
20840 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
20842 This package provides a comparison function for fixed strings that works
20843 in a case insensitive manner by converting to lower case before the comparison.
20845 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
20847 This package provides a hash function for strings.
20849 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
20851 This package provides a hash function for strings that is case insensitive.
20852 The string is converted to lower case before computing the hash.
20854 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
20856 This package provides a comparison function for\strings that works
20857 in a case insensitive manner by converting to lower case before the comparison.
20859 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
20861 This package provides facilities for handling character mappings and
20862 arbitrarily defined subsets of characters.  For instance it is useful in
20863 defining specialized translation tables.
20865 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
20867 This package provides a standard set of predefined mappings and
20868 predefined character sets.  For example, the standard upper to lower case
20869 conversion table is found in this package.  Note that upper to lower case
20870 conversion is non-trivial if you want to take the entire set of
20871 characters, including extended characters like E with an acute accent,
20872 into account.  You should use the mappings in this package (rather than
20873 adding 32 yourself) to do case mappings.
20875 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
20877 This package provides facilities for handling variable length
20878 strings.  The unbounded model allows arbitrary length strings, but
20879 requires the use of dynamic allocation and finalization.
20881 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
20883 Provides case-insensitive comparisons of unbounded strings
20885 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
20887 This package provides a generic hash function for unbounded strings
20889 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
20891 This package provides a generic hash function for unbounded strings that
20892 converts the string to be hashed to lower case.
20894 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
20896 This package provides a comparison function for unbounded strings that works
20897 in a case insensitive manner by converting to lower case before the comparison.
20899 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
20901 This package provides basic definitions for dealing with UTF-encoded strings.
20903 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
20905 This package provides conversion functions for UTF-encoded strings.
20906 @end table
20908 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
20910 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
20913 @table @asis
20915 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
20917 These packages provide facilities for handling UTF encodings for
20918 Strings, Wide_Strings and Wide_Wide_Strings.
20919 @end table
20921 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
20923 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
20925 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
20928 @table @asis
20930 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
20932 These packages provide analogous capabilities to the corresponding
20933 packages without @code{Wide_} in the name, but operate with the types
20934 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
20935 and @code{Character}. Versions of all the child packages are available.
20936 @end table
20938 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
20940 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
20942 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
20945 @table @asis
20947 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
20949 These packages provide analogous capabilities to the corresponding
20950 packages without @code{Wide_} in the name, but operate with the types
20951 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
20952 of @code{String} and @code{Character}.
20954 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
20956 This package provides facilities for synchronizing tasks at a low level
20957 with barriers.
20959 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
20961 This package provides some standard facilities for controlling task
20962 communication in a synchronous manner.
20964 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
20966 Not implemented in GNAT.
20968 @item @code{Ada.Tags}
20970 This package contains definitions for manipulation of the tags of tagged
20971 values.
20973 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
20975 This package provides a way of constructing tagged class-wide values given
20976 only the tag value.
20978 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
20980 This package provides the capability of associating arbitrary
20981 task-specific data with separate tasks.
20983 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
20985 This package provides capabilities for task identification.
20987 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
20989 This package provides control over task termination.
20991 @item @code{Ada.Text_IO}
20993 This package provides basic text input-output capabilities for
20994 character, string and numeric data.  The subpackages of this
20995 package are listed next. Note that although these are defined
20996 as subpackages in the RM, they are actually transparently
20997 implemented as child packages in GNAT, meaning that they
20998 are only loaded if needed.
21000 @item @code{Ada.Text_IO.Decimal_IO}
21002 Provides input-output facilities for decimal fixed-point types
21004 @item @code{Ada.Text_IO.Enumeration_IO}
21006 Provides input-output facilities for enumeration types.
21008 @item @code{Ada.Text_IO.Fixed_IO}
21010 Provides input-output facilities for ordinary fixed-point types.
21012 @item @code{Ada.Text_IO.Float_IO}
21014 Provides input-output facilities for float types.  The following
21015 predefined instantiations of this generic package are available:
21018 @itemize *
21020 @item 
21021 @code{Short_Float}
21023 @code{Short_Float_Text_IO}
21025 @item 
21026 @code{Float}
21028 @code{Float_Text_IO}
21030 @item 
21031 @code{Long_Float}
21033 @code{Long_Float_Text_IO}
21034 @end itemize
21036 @item @code{Ada.Text_IO.Integer_IO}
21038 Provides input-output facilities for integer types.  The following
21039 predefined instantiations of this generic package are available:
21042 @itemize *
21044 @item 
21045 @code{Short_Short_Integer}
21047 @code{Ada.Short_Short_Integer_Text_IO}
21049 @item 
21050 @code{Short_Integer}
21052 @code{Ada.Short_Integer_Text_IO}
21054 @item 
21055 @code{Integer}
21057 @code{Ada.Integer_Text_IO}
21059 @item 
21060 @code{Long_Integer}
21062 @code{Ada.Long_Integer_Text_IO}
21064 @item 
21065 @code{Long_Long_Integer}
21067 @code{Ada.Long_Long_Integer_Text_IO}
21068 @end itemize
21070 @item @code{Ada.Text_IO.Modular_IO}
21072 Provides input-output facilities for modular (unsigned) types.
21074 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21076 Provides input-output facilities for bounded strings.
21078 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21080 This package provides basic text input-output capabilities for complex
21081 data.
21083 @item @code{Ada.Text_IO.Editing (F.3.3)}
21085 This package contains routines for edited output, analogous to the use
21086 of pictures in COBOL.  The picture formats used by this package are a
21087 close copy of the facility in COBOL.
21089 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21091 This package provides a facility that allows Text_IO files to be treated
21092 as streams, so that the stream attributes can be used for writing
21093 arbitrary data, including binary data, to Text_IO files.
21095 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21097 This package provides input-output facilities for unbounded strings.
21099 @item @code{Ada.Unchecked_Conversion (13.9)}
21101 This generic package allows arbitrary conversion from one type to
21102 another of the same size, providing for breaking the type safety in
21103 special circumstances.
21105 If the types have the same Size (more accurately the same Value_Size),
21106 then the effect is simply to transfer the bits from the source to the
21107 target type without any modification.  This usage is well defined, and
21108 for simple types whose representation is typically the same across
21109 all implementations, gives a portable method of performing such
21110 conversions.
21112 If the types do not have the same size, then the result is implementation
21113 defined, and thus may be non-portable.  The following describes how GNAT
21114 handles such unchecked conversion cases.
21116 If the types are of different sizes, and are both discrete types, then
21117 the effect is of a normal type conversion without any constraint checking.
21118 In particular if the result type has a larger size, the result will be
21119 zero or sign extended.  If the result type has a smaller size, the result
21120 will be truncated by ignoring high order bits.
21122 If the types are of different sizes, and are not both discrete types,
21123 then the conversion works as though pointers were created to the source
21124 and target, and the pointer value is converted.  The effect is that bits
21125 are copied from successive low order storage units and bits of the source
21126 up to the length of the target type.
21128 A warning is issued if the lengths differ, since the effect in this
21129 case is implementation dependent, and the above behavior may not match
21130 that of some other compiler.
21132 A pointer to one type may be converted to a pointer to another type using
21133 unchecked conversion.  The only case in which the effect is undefined is
21134 when one or both pointers are pointers to unconstrained array types.  In
21135 this case, the bounds information may get incorrectly transferred, and in
21136 particular, GNAT uses double size pointers for such types, and it is
21137 meaningless to convert between such pointer types.  GNAT will issue a
21138 warning if the alignment of the target designated type is more strict
21139 than the alignment of the source designated type (since the result may
21140 be unaligned in this case).
21142 A pointer other than a pointer to an unconstrained array type may be
21143 converted to and from System.Address.  Such usage is common in Ada 83
21144 programs, but note that Ada.Address_To_Access_Conversions is the
21145 preferred method of performing such conversions in Ada 95 and Ada 2005.
21146 Neither
21147 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21148 used in conjunction with pointers to unconstrained objects, since
21149 the bounds information cannot be handled correctly in this case.
21151 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
21153 This generic package allows explicit freeing of storage previously
21154 allocated by use of an allocator.
21156 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
21158 This package is similar to @code{Ada.Text_IO}, except that the external
21159 file supports wide character representations, and the internal types are
21160 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21161 and @code{String}. The corresponding set of nested packages and child
21162 packages are defined.
21164 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
21166 This package is similar to @code{Ada.Text_IO}, except that the external
21167 file supports wide character representations, and the internal types are
21168 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21169 and @code{String}. The corresponding set of nested packages and child
21170 packages are defined.
21171 @end table
21173 For packages in Interfaces and System, all the RM defined packages are
21174 available in GNAT, see the Ada 2012 RM for full details.
21176 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21177 @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{296}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{297}
21178 @chapter The Implementation of Standard I/O
21181 GNAT implements all the required input-output facilities described in
21182 A.6 through A.14.  These sections of the Ada Reference Manual describe the
21183 required behavior of these packages from the Ada point of view, and if
21184 you are writing a portable Ada program that does not need to know the
21185 exact manner in which Ada maps to the outside world when it comes to
21186 reading or writing external files, then you do not need to read this
21187 chapter.  As long as your files are all regular files (not pipes or
21188 devices), and as long as you write and read the files only from Ada, the
21189 description in the Ada Reference Manual is sufficient.
21191 However, if you want to do input-output to pipes or other devices, such
21192 as the keyboard or screen, or if the files you are dealing with are
21193 either generated by some other language, or to be read by some other
21194 language, then you need to know more about the details of how the GNAT
21195 implementation of these input-output facilities behaves.
21197 In this chapter we give a detailed description of exactly how GNAT
21198 interfaces to the file system.  As always, the sources of the system are
21199 available to you for answering questions at an even more detailed level,
21200 but for most purposes the information in this chapter will suffice.
21202 Another reason that you may need to know more about how input-output is
21203 implemented arises when you have a program written in mixed languages
21204 where, for example, files are shared between the C and Ada sections of
21205 the same program.  GNAT provides some additional facilities, in the form
21206 of additional child library packages, that facilitate this sharing, and
21207 these additional facilities are also described in this chapter.
21209 @menu
21210 * Standard I/O Packages:: 
21211 * FORM Strings:: 
21212 * Direct_IO:: 
21213 * Sequential_IO:: 
21214 * Text_IO:: 
21215 * Wide_Text_IO:: 
21216 * Wide_Wide_Text_IO:: 
21217 * Stream_IO:: 
21218 * Text Translation:: 
21219 * Shared Files:: 
21220 * Filenames encoding:: 
21221 * File content encoding:: 
21222 * Open Modes:: 
21223 * Operations on C Streams:: 
21224 * Interfacing to C Streams:: 
21226 @end menu
21228 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21229 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{298}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{299}
21230 @section Standard I/O Packages
21233 The Standard I/O packages described in Annex A for
21236 @itemize *
21238 @item 
21239 Ada.Text_IO
21241 @item 
21242 Ada.Text_IO.Complex_IO
21244 @item 
21245 Ada.Text_IO.Text_Streams
21247 @item 
21248 Ada.Wide_Text_IO
21250 @item 
21251 Ada.Wide_Text_IO.Complex_IO
21253 @item 
21254 Ada.Wide_Text_IO.Text_Streams
21256 @item 
21257 Ada.Wide_Wide_Text_IO
21259 @item 
21260 Ada.Wide_Wide_Text_IO.Complex_IO
21262 @item 
21263 Ada.Wide_Wide_Text_IO.Text_Streams
21265 @item 
21266 Ada.Stream_IO
21268 @item 
21269 Ada.Sequential_IO
21271 @item 
21272 Ada.Direct_IO
21273 @end itemize
21275 are implemented using the C
21276 library streams facility; where
21279 @itemize *
21281 @item 
21282 All files are opened using @code{fopen}.
21284 @item 
21285 All input/output operations use @code{fread}/@cite{fwrite}.
21286 @end itemize
21288 There is no internal buffering of any kind at the Ada library level. The only
21289 buffering is that provided at the system level in the implementation of the
21290 library routines that support streams. This facilitates shared use of these
21291 streams by mixed language programs. Note though that system level buffering is
21292 explicitly enabled at elaboration of the standard I/O packages and that can
21293 have an impact on mixed language programs, in particular those using I/O before
21294 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21295 the Ada elaboration routine before performing any I/O or when impractical,
21296 flush the common I/O streams and in particular Standard_Output before
21297 elaborating the Ada code.
21299 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21300 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{29a}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{29b}
21301 @section FORM Strings
21304 The format of a FORM string in GNAT is:
21306 @example
21307 "keyword=value,keyword=value,...,keyword=value"
21308 @end example
21310 where letters may be in upper or lower case, and there are no spaces
21311 between values.  The order of the entries is not important.  Currently
21312 the following keywords defined.
21314 @example
21315 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21316 SHARED=[YES|NO]
21317 WCEM=[n|h|u|s|e|8|b]
21318 ENCODING=[UTF8|8BITS]
21319 @end example
21321 The use of these parameters is described later in this section. If an
21322 unrecognized keyword appears in a form string, it is silently ignored
21323 and not considered invalid.
21325 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21326 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{29c}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{29d}
21327 @section Direct_IO
21330 Direct_IO can only be instantiated for definite types.  This is a
21331 restriction of the Ada language, which means that the records are fixed
21332 length (the length being determined by @code{type'Size}, rounded
21333 up to the next storage unit boundary if necessary).
21335 The records of a Direct_IO file are simply written to the file in index
21336 sequence, with the first record starting at offset zero, and subsequent
21337 records following.  There is no control information of any kind.  For
21338 example, if 32-bit integers are being written, each record takes
21339 4-bytes, so the record at index @code{K} starts at offset
21340 (@code{K}-1)*4.
21342 There is no limit on the size of Direct_IO files, they are expanded as
21343 necessary to accommodate whatever records are written to the file.
21345 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21346 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{29e}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{29f}
21347 @section Sequential_IO
21350 Sequential_IO may be instantiated with either a definite (constrained)
21351 or indefinite (unconstrained) type.
21353 For the definite type case, the elements written to the file are simply
21354 the memory images of the data values with no control information of any
21355 kind.  The resulting file should be read using the same type, no validity
21356 checking is performed on input.
21358 For the indefinite type case, the elements written consist of two
21359 parts.  First is the size of the data item, written as the memory image
21360 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21361 the data value.  The resulting file can only be read using the same
21362 (unconstrained) type.  Normal assignment checks are performed on these
21363 read operations, and if these checks fail, @code{Data_Error} is
21364 raised.  In particular, in the array case, the lengths must match, and in
21365 the variant record case, if the variable for a particular read operation
21366 is constrained, the discriminants must match.
21368 Note that it is not possible to use Sequential_IO to write variable
21369 length array items, and then read the data back into different length
21370 arrays.  For example, the following will raise @code{Data_Error}:
21372 @example
21373 package IO is new Sequential_IO (String);
21374 F : IO.File_Type;
21375 S : String (1..4);
21377 IO.Create (F)
21378 IO.Write (F, "hello!")
21379 IO.Reset (F, Mode=>In_File);
21380 IO.Read (F, S);
21381 Put_Line (S);
21382 @end example
21384 On some Ada implementations, this will print @code{hell}, but the program is
21385 clearly incorrect, since there is only one element in the file, and that
21386 element is the string @code{hello!}.
21388 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21389 using Stream_IO, and this is the preferred mechanism.  In particular, the
21390 above program fragment rewritten to use Stream_IO will work correctly.
21392 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21393 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2a0}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2a1}
21394 @section Text_IO
21397 Text_IO files consist of a stream of characters containing the following
21398 special control characters:
21400 @example
21401 LF (line feed, 16#0A#) Line Mark
21402 FF (form feed, 16#0C#) Page Mark
21403 @end example
21405 A canonical Text_IO file is defined as one in which the following
21406 conditions are met:
21409 @itemize *
21411 @item 
21412 The character @code{LF} is used only as a line mark, i.e., to mark the end
21413 of the line.
21415 @item 
21416 The character @code{FF} is used only as a page mark, i.e., to mark the
21417 end of a page and consequently can appear only immediately following a
21418 @code{LF} (line mark) character.
21420 @item 
21421 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21422 (line mark, page mark).  In the former case, the page mark is implicitly
21423 assumed to be present.
21424 @end itemize
21426 A file written using Text_IO will be in canonical form provided that no
21427 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21428 or @code{Put_Line}.  There will be no @code{FF} character at the end of
21429 the file unless an explicit @code{New_Page} operation was performed
21430 before closing the file.
21432 A canonical Text_IO file that is a regular file (i.e., not a device or a
21433 pipe) can be read using any of the routines in Text_IO.  The
21434 semantics in this case will be exactly as defined in the Ada Reference
21435 Manual, and all the routines in Text_IO are fully implemented.
21437 A text file that does not meet the requirements for a canonical Text_IO
21438 file has one of the following:
21441 @itemize *
21443 @item 
21444 The file contains @code{FF} characters not immediately following a
21445 @code{LF} character.
21447 @item 
21448 The file contains @code{LF} or @code{FF} characters written by
21449 @code{Put} or @code{Put_Line}, which are not logically considered to be
21450 line marks or page marks.
21452 @item 
21453 The file ends in a character other than @code{LF} or @code{FF},
21454 i.e., there is no explicit line mark or page mark at the end of the file.
21455 @end itemize
21457 Text_IO can be used to read such non-standard text files but subprograms
21458 to do with line or page numbers do not have defined meanings.  In
21459 particular, a @code{FF} character that does not follow a @code{LF}
21460 character may or may not be treated as a page mark from the point of
21461 view of page and line numbering.  Every @code{LF} character is considered
21462 to end a line, and there is an implied @code{LF} character at the end of
21463 the file.
21465 @menu
21466 * Stream Pointer Positioning:: 
21467 * Reading and Writing Non-Regular Files:: 
21468 * Get_Immediate:: 
21469 * Treating Text_IO Files as Streams:: 
21470 * Text_IO Extensions:: 
21471 * Text_IO Facilities for Unbounded Strings:: 
21473 @end menu
21475 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21476 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2a2}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2a3}
21477 @subsection Stream Pointer Positioning
21480 @code{Ada.Text_IO} has a definition of current position for a file that
21481 is being read.  No internal buffering occurs in Text_IO, and usually the
21482 physical position in the stream used to implement the file corresponds
21483 to this logical position defined by Text_IO.  There are two exceptions:
21486 @itemize *
21488 @item 
21489 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21490 is positioned past the @code{LF} (line mark) that precedes the page
21491 mark.  Text_IO maintains an internal flag so that subsequent read
21492 operations properly handle the logical position which is unchanged by
21493 the @code{End_Of_Page} call.
21495 @item 
21496 After a call to @code{End_Of_File} that returns @code{True}, if the
21497 Text_IO file was positioned before the line mark at the end of file
21498 before the call, then the logical position is unchanged, but the stream
21499 is physically positioned right at the end of file (past the line mark,
21500 and past a possible page mark following the line mark.  Again Text_IO
21501 maintains internal flags so that subsequent read operations properly
21502 handle the logical position.
21503 @end itemize
21505 These discrepancies have no effect on the observable behavior of
21506 Text_IO, but if a single Ada stream is shared between a C program and
21507 Ada program, or shared (using @code{shared=yes} in the form string)
21508 between two Ada files, then the difference may be observable in some
21509 situations.
21511 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21512 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2a5}
21513 @subsection Reading and Writing Non-Regular Files
21516 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
21517 can be used for reading and writing.  Writing is not affected and the
21518 sequence of characters output is identical to the normal file case, but
21519 for reading, the behavior of Text_IO is modified to avoid undesirable
21520 look-ahead as follows:
21522 An input file that is not a regular file is considered to have no page
21523 marks.  Any @code{Ascii.FF} characters (the character normally used for a
21524 page mark) appearing in the file are considered to be data
21525 characters.  In particular:
21528 @itemize *
21530 @item 
21531 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21532 following a line mark.  If a page mark appears, it will be treated as a
21533 data character.
21535 @item 
21536 This avoids the need to wait for an extra character to be typed or
21537 entered from the pipe to complete one of these operations.
21539 @item 
21540 @code{End_Of_Page} always returns @code{False}
21542 @item 
21543 @code{End_Of_File} will return @code{False} if there is a page mark at
21544 the end of the file.
21545 @end itemize
21547 Output to non-regular files is the same as for regular files.  Page marks
21548 may be written to non-regular files using @code{New_Page}, but as noted
21549 above they will not be treated as page marks on input if the output is
21550 piped to another Ada program.
21552 Another important discrepancy when reading non-regular files is that the end
21553 of file indication is not 'sticky'.  If an end of file is entered, e.g., by
21554 pressing the @code{EOT} key,
21555 then end of file
21556 is signaled once (i.e., the test @code{End_Of_File}
21557 will yield @code{True}, or a read will
21558 raise @code{End_Error}), but then reading can resume
21559 to read data past that end of
21560 file indication, until another end of file indication is entered.
21562 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21563 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2a7}
21564 @subsection Get_Immediate
21567 @geindex Get_Immediate
21569 Get_Immediate returns the next character (including control characters)
21570 from the input file.  In particular, Get_Immediate will return LF or FF
21571 characters used as line marks or page marks.  Such operations leave the
21572 file positioned past the control character, and it is thus not treated
21573 as having its normal function.  This means that page, line and column
21574 counts after this kind of Get_Immediate call are set as though the mark
21575 did not occur.  In the case where a Get_Immediate leaves the file
21576 positioned between the line mark and page mark (which is not normally
21577 possible), it is undefined whether the FF character will be treated as a
21578 page mark.
21580 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21581 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2a9}
21582 @subsection Treating Text_IO Files as Streams
21585 @geindex Stream files
21587 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21588 as a stream.  Data written to a @code{Text_IO} file in this stream mode is
21589 binary data.  If this binary data contains bytes 16#0A# (@code{LF}) or
21590 16#0C# (@code{FF}), the resulting file may have non-standard
21591 format.  Similarly if read operations are used to read from a Text_IO
21592 file treated as a stream, then @code{LF} and @code{FF} characters may be
21593 skipped and the effect is similar to that described above for
21594 @code{Get_Immediate}.
21596 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21597 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2ab}
21598 @subsection Text_IO Extensions
21601 @geindex Text_IO extensions
21603 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21604 to the standard @code{Text_IO} package:
21607 @itemize *
21609 @item 
21610 function File_Exists (Name : String) return Boolean;
21611 Determines if a file of the given name exists.
21613 @item 
21614 function Get_Line return String;
21615 Reads a string from the standard input file.  The value returned is exactly
21616 the length of the line that was read.
21618 @item 
21619 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21620 Similar, except that the parameter File specifies the file from which
21621 the string is to be read.
21622 @end itemize
21624 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21625 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2ad}
21626 @subsection Text_IO Facilities for Unbounded Strings
21629 @geindex Text_IO for unbounded strings
21631 @geindex Unbounded_String
21632 @geindex Text_IO operations
21634 The package @code{Ada.Strings.Unbounded.Text_IO}
21635 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
21636 subprograms useful for Text_IO operations on unbounded strings:
21639 @itemize *
21641 @item 
21642 function Get_Line (File : File_Type) return Unbounded_String;
21643 Reads a line from the specified file
21644 and returns the result as an unbounded string.
21646 @item 
21647 procedure Put (File : File_Type; U : Unbounded_String);
21648 Writes the value of the given unbounded string to the specified file
21649 Similar to the effect of
21650 @code{Put (To_String (U))} except that an extra copy is avoided.
21652 @item 
21653 procedure Put_Line (File : File_Type; U : Unbounded_String);
21654 Writes the value of the given unbounded string to the specified file,
21655 followed by a @code{New_Line}.
21656 Similar to the effect of @code{Put_Line (To_String (U))} except
21657 that an extra copy is avoided.
21658 @end itemize
21660 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
21661 and is optional.  If the parameter is omitted, then the standard input or
21662 output file is referenced as appropriate.
21664 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21665 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21666 @code{Wide_Text_IO} functionality for unbounded wide strings.
21668 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21669 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21670 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21672 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21673 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2af}
21674 @section Wide_Text_IO
21677 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
21678 both input and output files may contain special sequences that represent
21679 wide character values.  The encoding scheme for a given file may be
21680 specified using a FORM parameter:
21682 @example
21683 WCEM=`x`
21684 @end example
21686 as part of the FORM string (WCEM = wide character encoding method),
21687 where @code{x} is one of the following characters
21690 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21691 @headitem
21693 Character
21695 @tab
21697 Encoding
21699 @item
21701 @emph{h}
21703 @tab
21705 Hex ESC encoding
21707 @item
21709 @emph{u}
21711 @tab
21713 Upper half encoding
21715 @item
21717 @emph{s}
21719 @tab
21721 Shift-JIS encoding
21723 @item
21725 @emph{e}
21727 @tab
21729 EUC Encoding
21731 @item
21733 @emph{8}
21735 @tab
21737 UTF-8 encoding
21739 @item
21741 @emph{b}
21743 @tab
21745 Brackets encoding
21747 @end multitable
21750 The encoding methods match those that
21751 can be used in a source
21752 program, but there is no requirement that the encoding method used for
21753 the source program be the same as the encoding method used for files,
21754 and different files may use different encoding methods.
21756 The default encoding method for the standard files, and for opened files
21757 for which no WCEM parameter is given in the FORM string matches the
21758 wide character encoding specified for the main program (the default
21759 being brackets encoding if no coding method was specified with -gnatW).
21762 @table @asis
21764 @item @emph{Hex Coding}
21766 In this encoding, a wide character is represented by a five character
21767 sequence:
21768 @end table
21770 @example
21771 ESC a b c d
21772 @end example
21775 @quotation
21777 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
21778 characters (using upper case letters) of the wide character code.  For
21779 example, ESC A345 is used to represent the wide character with code
21780 16#A345#.  This scheme is compatible with use of the full
21781 @code{Wide_Character} set.
21782 @end quotation
21785 @table @asis
21787 @item @emph{Upper Half Coding}
21789 The wide character with encoding 16#abcd#, where the upper bit is on
21790 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
21791 16#cd#.  The second byte may never be a format control character, but is
21792 not required to be in the upper half.  This method can be also used for
21793 shift-JIS or EUC where the internal coding matches the external coding.
21795 @item @emph{Shift JIS Coding}
21797 A wide character is represented by a two character sequence 16#ab# and
21798 16#cd#, with the restrictions described for upper half encoding as
21799 described above.  The internal character code is the corresponding JIS
21800 character according to the standard algorithm for Shift-JIS
21801 conversion.  Only characters defined in the JIS code set table can be
21802 used with this encoding method.
21804 @item @emph{EUC Coding}
21806 A wide character is represented by a two character sequence 16#ab# and
21807 16#cd#, with both characters being in the upper half.  The internal
21808 character code is the corresponding JIS character according to the EUC
21809 encoding algorithm.  Only characters defined in the JIS code set table
21810 can be used with this encoding method.
21812 @item @emph{UTF-8 Coding}
21814 A wide character is represented using
21815 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
21816 10646-1/Am.2.  Depending on the character value, the representation
21817 is a one, two, or three byte sequence:
21818 @end table
21820 @example
21821 16#0000#-16#007f#: 2#0xxxxxxx#
21822 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
21823 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
21824 @end example
21827 @quotation
21829 where the @code{xxx} bits correspond to the left-padded bits of the
21830 16-bit character value.  Note that all lower half ASCII characters
21831 are represented as ASCII bytes and all upper half characters and
21832 other wide characters are represented as sequences of upper-half
21833 (The full UTF-8 scheme allows for encoding 31-bit characters as
21834 6-byte sequences, but in this implementation, all UTF-8 sequences
21835 of four or more bytes length will raise a Constraint_Error, as
21836 will all invalid UTF-8 sequences.)
21837 @end quotation
21840 @table @asis
21842 @item @emph{Brackets Coding}
21844 In this encoding, a wide character is represented by the following eight
21845 character sequence:
21846 @end table
21848 @example
21849 [ " a b c d " ]
21850 @end example
21853 @quotation
21855 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
21856 characters (using uppercase letters) of the wide character code.  For
21857 example, @code{["A345"]} is used to represent the wide character with code
21858 @code{16#A345#}.
21859 This scheme is compatible with use of the full Wide_Character set.
21860 On input, brackets coding can also be used for upper half characters,
21861 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
21862 is only used for wide characters with a code greater than @code{16#FF#}.
21864 Note that brackets coding is not normally used in the context of
21865 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
21866 a portable way of encoding source files. In the context of Wide_Text_IO
21867 or Wide_Wide_Text_IO, it can only be used if the file does not contain
21868 any instance of the left bracket character other than to encode wide
21869 character values using the brackets encoding method. In practice it is
21870 expected that some standard wide character encoding method such
21871 as UTF-8 will be used for text input output.
21873 If brackets notation is used, then any occurrence of a left bracket
21874 in the input file which is not the start of a valid wide character
21875 sequence will cause Constraint_Error to be raised. It is possible to
21876 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
21877 input will interpret this as a left bracket.
21879 However, when a left bracket is output, it will be output as a left bracket
21880 and not as ["5B"]. We make this decision because for normal use of
21881 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
21882 brackets. For example, if we write:
21884 @example
21885 Put_Line ("Start of output [first run]");
21886 @end example
21888 we really do not want to have the left bracket in this message clobbered so
21889 that the output reads:
21890 @end quotation
21892 @example
21893 Start of output ["5B"]first run]
21894 @end example
21897 @quotation
21899 In practice brackets encoding is reasonably useful for normal Put_Line use
21900 since we won't get confused between left brackets and wide character
21901 sequences in the output. But for input, or when files are written out
21902 and read back in, it really makes better sense to use one of the standard
21903 encoding methods such as UTF-8.
21904 @end quotation
21906 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
21907 not all wide character
21908 values can be represented.  An attempt to output a character that cannot
21909 be represented using the encoding scheme for the file causes
21910 Constraint_Error to be raised.  An invalid wide character sequence on
21911 input also causes Constraint_Error to be raised.
21913 @menu
21914 * Stream Pointer Positioning: Stream Pointer Positioning<2>. 
21915 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>. 
21917 @end menu
21919 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
21920 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2b1}
21921 @subsection Stream Pointer Positioning
21924 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
21925 of stream pointer positioning (@ref{2a1,,Text_IO}).  There is one additional
21926 case:
21928 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
21929 normal lower ASCII set (i.e., a character in the range:
21931 @example
21932 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
21933 @end example
21935 then although the logical position of the file pointer is unchanged by
21936 the @code{Look_Ahead} call, the stream is physically positioned past the
21937 wide character sequence.  Again this is to avoid the need for buffering
21938 or backup, and all @code{Wide_Text_IO} routines check the internal
21939 indication that this situation has occurred so that this is not visible
21940 to a normal program using @code{Wide_Text_IO}.  However, this discrepancy
21941 can be observed if the wide text file shares a stream with another file.
21943 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
21944 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2b3}
21945 @subsection Reading and Writing Non-Regular Files
21948 As in the case of Text_IO, when a non-regular file is read, it is
21949 assumed that the file contains no page marks (any form characters are
21950 treated as data characters), and @code{End_Of_Page} always returns
21951 @code{False}.  Similarly, the end of file indication is not sticky, so
21952 it is possible to read beyond an end of file.
21954 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
21955 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2b5}
21956 @section Wide_Wide_Text_IO
21959 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
21960 both input and output files may contain special sequences that represent
21961 wide wide character values.  The encoding scheme for a given file may be
21962 specified using a FORM parameter:
21964 @example
21965 WCEM=`x`
21966 @end example
21968 as part of the FORM string (WCEM = wide character encoding method),
21969 where @code{x} is one of the following characters
21972 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx} 
21973 @headitem
21975 Character
21977 @tab
21979 Encoding
21981 @item
21983 @emph{h}
21985 @tab
21987 Hex ESC encoding
21989 @item
21991 @emph{u}
21993 @tab
21995 Upper half encoding
21997 @item
21999 @emph{s}
22001 @tab
22003 Shift-JIS encoding
22005 @item
22007 @emph{e}
22009 @tab
22011 EUC Encoding
22013 @item
22015 @emph{8}
22017 @tab
22019 UTF-8 encoding
22021 @item
22023 @emph{b}
22025 @tab
22027 Brackets encoding
22029 @end multitable
22032 The encoding methods match those that
22033 can be used in a source
22034 program, but there is no requirement that the encoding method used for
22035 the source program be the same as the encoding method used for files,
22036 and different files may use different encoding methods.
22038 The default encoding method for the standard files, and for opened files
22039 for which no WCEM parameter is given in the FORM string matches the
22040 wide character encoding specified for the main program (the default
22041 being brackets encoding if no coding method was specified with -gnatW).
22044 @table @asis
22046 @item @emph{UTF-8 Coding}
22048 A wide character is represented using
22049 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22050 10646-1/Am.2.  Depending on the character value, the representation
22051 is a one, two, three, or four byte sequence:
22052 @end table
22054 @example
22055 16#000000#-16#00007f#: 2#0xxxxxxx#
22056 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22057 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22058 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22059 @end example
22062 @quotation
22064 where the @code{xxx} bits correspond to the left-padded bits of the
22065 21-bit character value.  Note that all lower half ASCII characters
22066 are represented as ASCII bytes and all upper half characters and
22067 other wide characters are represented as sequences of upper-half
22068 characters.
22069 @end quotation
22072 @table @asis
22074 @item @emph{Brackets Coding}
22076 In this encoding, a wide wide character is represented by the following eight
22077 character sequence if is in wide character range
22078 @end table
22080 @example
22081 [ " a b c d " ]
22082 @end example
22085 @quotation
22087 and by the following ten character sequence if not
22088 @end quotation
22090 @example
22091 [ " a b c d e f " ]
22092 @end example
22095 @quotation
22097 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22098 are the four or six hexadecimal
22099 characters (using uppercase letters) of the wide wide character code.  For
22100 example, @code{["01A345"]} is used to represent the wide wide character
22101 with code @code{16#01A345#}.
22103 This scheme is compatible with use of the full Wide_Wide_Character set.
22104 On input, brackets coding can also be used for upper half characters,
22105 e.g., @code{["C1"]} for lower case a.  However, on output, brackets notation
22106 is only used for wide characters with a code greater than @code{16#FF#}.
22107 @end quotation
22109 If is also possible to use the other Wide_Character encoding methods,
22110 such as Shift-JIS, but the other schemes cannot support the full range
22111 of wide wide characters.
22112 An attempt to output a character that cannot
22113 be represented using the encoding scheme for the file causes
22114 Constraint_Error to be raised.  An invalid wide character sequence on
22115 input also causes Constraint_Error to be raised.
22117 @menu
22118 * Stream Pointer Positioning: Stream Pointer Positioning<3>. 
22119 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>. 
22121 @end menu
22123 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22124 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2b7}
22125 @subsection Stream Pointer Positioning
22128 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22129 of stream pointer positioning (@ref{2a1,,Text_IO}).  There is one additional
22130 case:
22132 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22133 normal lower ASCII set (i.e., a character in the range:
22135 @example
22136 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22137 @end example
22139 then although the logical position of the file pointer is unchanged by
22140 the @code{Look_Ahead} call, the stream is physically positioned past the
22141 wide character sequence.  Again this is to avoid the need for buffering
22142 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22143 indication that this situation has occurred so that this is not visible
22144 to a normal program using @code{Wide_Wide_Text_IO}.  However, this discrepancy
22145 can be observed if the wide text file shares a stream with another file.
22147 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22148 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2b9}
22149 @subsection Reading and Writing Non-Regular Files
22152 As in the case of Text_IO, when a non-regular file is read, it is
22153 assumed that the file contains no page marks (any form characters are
22154 treated as data characters), and @code{End_Of_Page} always returns
22155 @code{False}.  Similarly, the end of file indication is not sticky, so
22156 it is possible to read beyond an end of file.
22158 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22159 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2ba}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2bb}
22160 @section Stream_IO
22163 A stream file is a sequence of bytes, where individual elements are
22164 written to the file as described in the Ada Reference Manual.  The type
22165 @code{Stream_Element} is simply a byte.  There are two ways to read or
22166 write a stream file.
22169 @itemize *
22171 @item 
22172 The operations @code{Read} and @code{Write} directly read or write a
22173 sequence of stream elements with no control information.
22175 @item 
22176 The stream attributes applied to a stream file transfer data in the
22177 manner described for stream attributes.
22178 @end itemize
22180 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22181 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2bc}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2bd}
22182 @section Text Translation
22185 @code{Text_Translation=xxx} may be used as the Form parameter
22186 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22187 has no effect on Unix systems. Possible values are:
22190 @itemize *
22192 @item 
22193 @code{Yes} or @code{Text} is the default, which means to
22194 translate LF to/from CR/LF on Windows systems.
22196 @code{No} disables this translation; i.e. it
22197 uses binary mode. For output files, @code{Text_Translation=No}
22198 may be used to create Unix-style files on
22199 Windows.
22201 @item 
22202 @code{wtext} translation enabled in Unicode mode.
22203 (corresponds to _O_WTEXT).
22205 @item 
22206 @code{u8text} translation enabled in Unicode UTF-8 mode.
22207 (corresponds to O_U8TEXT).
22209 @item 
22210 @code{u16text} translation enabled in Unicode UTF-16
22211 mode. (corresponds to_O_U16TEXT).
22212 @end itemize
22214 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22215 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2be}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2bf}
22216 @section Shared Files
22219 Section A.14 of the Ada Reference Manual allows implementations to
22220 provide a wide variety of behavior if an attempt is made to access the
22221 same external file with two or more internal files.
22223 To provide a full range of functionality, while at the same time
22224 minimizing the problems of portability caused by this implementation
22225 dependence, GNAT handles file sharing as follows:
22228 @itemize *
22230 @item 
22231 In the absence of a @code{shared=xxx} form parameter, an attempt
22232 to open two or more files with the same full name is considered an error
22233 and is not supported.  The exception @code{Use_Error} will be
22234 raised.  Note that a file that is not explicitly closed by the program
22235 remains open until the program terminates.
22237 @item 
22238 If the form parameter @code{shared=no} appears in the form string, the
22239 file can be opened or created with its own separate stream identifier,
22240 regardless of whether other files sharing the same external file are
22241 opened.  The exact effect depends on how the C stream routines handle
22242 multiple accesses to the same external files using separate streams.
22244 @item 
22245 If the form parameter @code{shared=yes} appears in the form string for
22246 each of two or more files opened using the same full name, the same
22247 stream is shared between these files, and the semantics are as described
22248 in Ada Reference Manual, Section A.14.
22249 @end itemize
22251 When a program that opens multiple files with the same name is ported
22252 from another Ada compiler to GNAT, the effect will be that
22253 @code{Use_Error} is raised.
22255 The documentation of the original compiler and the documentation of the
22256 program should then be examined to determine if file sharing was
22257 expected, and @code{shared=xxx} parameters added to @code{Open}
22258 and @code{Create} calls as required.
22260 When a program is ported from GNAT to some other Ada compiler, no
22261 special attention is required unless the @code{shared=xxx} form
22262 parameter is used in the program.  In this case, you must examine the
22263 documentation of the new compiler to see if it supports the required
22264 file sharing semantics, and form strings modified appropriately.  Of
22265 course it may be the case that the program cannot be ported if the
22266 target compiler does not support the required functionality.  The best
22267 approach in writing portable code is to avoid file sharing (and hence
22268 the use of the @code{shared=xxx} parameter in the form string)
22269 completely.
22271 One common use of file sharing in Ada 83 is the use of instantiations of
22272 Sequential_IO on the same file with different types, to achieve
22273 heterogeneous input-output.  Although this approach will work in GNAT if
22274 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22275 for this purpose (using the stream attributes)
22277 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22278 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2c0}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2c1}
22279 @section Filenames encoding
22282 An encoding form parameter can be used to specify the filename
22283 encoding @code{encoding=xxx}.
22286 @itemize *
22288 @item 
22289 If the form parameter @code{encoding=utf8} appears in the form string, the
22290 filename must be encoded in UTF-8.
22292 @item 
22293 If the form parameter @code{encoding=8bits} appears in the form
22294 string, the filename must be a standard 8bits string.
22295 @end itemize
22297 In the absence of a @code{encoding=xxx} form parameter, the
22298 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22299 variable. And if not set @code{utf8} is assumed.
22302 @table @asis
22304 @item @emph{CP_ACP}
22306 The current system Windows ANSI code page.
22308 @item @emph{CP_UTF8}
22310 UTF-8 encoding
22311 @end table
22313 This encoding form parameter is only supported on the Windows
22314 platform. On the other Operating Systems the run-time is supporting
22315 UTF-8 natively.
22317 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22318 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2c2}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2c3}
22319 @section File content encoding
22322 For text files it is possible to specify the encoding to use. This is
22323 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22324 variable. And if not set @code{TEXT} is assumed.
22326 The possible values are those supported on Windows:
22329 @table @asis
22331 @item @emph{TEXT}
22333 Translated text mode
22335 @item @emph{WTEXT}
22337 Translated unicode encoding
22339 @item @emph{U16TEXT}
22341 Unicode 16-bit encoding
22343 @item @emph{U8TEXT}
22345 Unicode 8-bit encoding
22346 @end table
22348 This encoding is only supported on the Windows platform.
22350 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22351 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2c4}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2c5}
22352 @section Open Modes
22355 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22356 using the mode shown in the following table:
22359 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx} 
22360 @headitem
22362 @code{Open} and @code{Create} Call Modes
22364 @tab
22366 @tab
22368 @item
22370 @tab
22372 @strong{OPEN}
22374 @tab
22376 @strong{CREATE}
22378 @item
22380 Append_File
22382 @tab
22384 "r+"
22386 @tab
22388 "w+"
22390 @item
22392 In_File
22394 @tab
22398 @tab
22400 "w+"
22402 @item
22404 Out_File (Direct_IO)
22406 @tab
22408 "r+"
22410 @tab
22414 @item
22416 Out_File (all other cases)
22418 @tab
22422 @tab
22426 @item
22428 Inout_File
22430 @tab
22432 "r+"
22434 @tab
22436 "w+"
22438 @end multitable
22441 If text file translation is required, then either @code{b} or @code{t}
22442 is added to the mode, depending on the setting of Text.  Text file
22443 translation refers to the mapping of CR/LF sequences in an external file
22444 to LF characters internally.  This mapping only occurs in DOS and
22445 DOS-like systems, and is not relevant to other systems.
22447 A special case occurs with Stream_IO.  As shown in the above table, the
22448 file is initially opened in @code{r} or @code{w} mode for the
22449 @code{In_File} and @code{Out_File} cases.  If a @code{Set_Mode} operation
22450 subsequently requires switching from reading to writing or vice-versa,
22451 then the file is reopened in @code{r+} mode to permit the required operation.
22453 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22454 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2c6}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2c7}
22455 @section Operations on C Streams
22458 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22459 access to the C library functions for operations on C streams:
22461 @example
22462 package Interfaces.C_Streams is
22463   -- Note: the reason we do not use the types that are in
22464   -- Interfaces.C is that we want to avoid dragging in the
22465   -- code in this unit if possible.
22466   subtype chars is System.Address;
22467   -- Pointer to null-terminated array of characters
22468   subtype FILEs is System.Address;
22469   -- Corresponds to the C type FILE*
22470   subtype voids is System.Address;
22471   -- Corresponds to the C type void*
22472   subtype int is Integer;
22473   subtype long is Long_Integer;
22474   -- Note: the above types are subtypes deliberately, and it
22475   -- is part of this spec that the above correspondences are
22476   -- guaranteed.  This means that it is legitimate to, for
22477   -- example, use Integer instead of int.  We provide these
22478   -- synonyms for clarity, but in some cases it may be
22479   -- convenient to use the underlying types (for example to
22480   -- avoid an unnecessary dependency of a spec on the spec
22481   -- of this unit).
22482   type size_t is mod 2 ** Standard'Address_Size;
22483   NULL_Stream : constant FILEs;
22484   -- Value returned (NULL in C) to indicate an
22485   -- fdopen/fopen/tmpfile error
22486   ----------------------------------
22487   -- Constants Defined in stdio.h --
22488   ----------------------------------
22489   EOF : constant int;
22490   -- Used by a number of routines to indicate error or
22491   -- end of file
22492   IOFBF : constant int;
22493   IOLBF : constant int;
22494   IONBF : constant int;
22495   -- Used to indicate buffering mode for setvbuf call
22496   SEEK_CUR : constant int;
22497   SEEK_END : constant int;
22498   SEEK_SET : constant int;
22499   -- Used to indicate origin for fseek call
22500   function stdin return FILEs;
22501   function stdout return FILEs;
22502   function stderr return FILEs;
22503   -- Streams associated with standard files
22504   --------------------------
22505   -- Standard C functions --
22506   --------------------------
22507   -- The functions selected below are ones that are
22508   -- available in UNIX (but not necessarily in ANSI C).
22509   -- These are very thin interfaces
22510   -- which copy exactly the C headers.  For more
22511   -- documentation on these functions, see the Microsoft C
22512   -- "Run-Time Library Reference" (Microsoft Press, 1990,
22513   -- ISBN 1-55615-225-6), which includes useful information
22514   -- on system compatibility.
22515   procedure clearerr (stream : FILEs);
22516   function fclose (stream : FILEs) return int;
22517   function fdopen (handle : int; mode : chars) return FILEs;
22518   function feof (stream : FILEs) return int;
22519   function ferror (stream : FILEs) return int;
22520   function fflush (stream : FILEs) return int;
22521   function fgetc (stream : FILEs) return int;
22522   function fgets (strng : chars; n : int; stream : FILEs)
22523       return chars;
22524   function fileno (stream : FILEs) return int;
22525   function fopen (filename : chars; Mode : chars)
22526       return FILEs;
22527   -- Note: to maintain target independence, use
22528   -- text_translation_required, a boolean variable defined in
22529   -- a-sysdep.c to deal with the target dependent text
22530   -- translation requirement.  If this variable is set,
22531   -- then  b/t should be appended to the standard mode
22532   -- argument to set the text translation mode off or on
22533   -- as required.
22534   function fputc (C : int; stream : FILEs) return int;
22535   function fputs (Strng : chars; Stream : FILEs) return int;
22536   function fread
22537      (buffer : voids;
22538       size : size_t;
22539       count : size_t;
22540       stream : FILEs)
22541       return size_t;
22542   function freopen
22543      (filename : chars;
22544       mode : chars;
22545       stream : FILEs)
22546       return FILEs;
22547   function fseek
22548      (stream : FILEs;
22549       offset : long;
22550       origin : int)
22551       return int;
22552   function ftell (stream : FILEs) return long;
22553   function fwrite
22554      (buffer : voids;
22555       size : size_t;
22556       count : size_t;
22557       stream : FILEs)
22558       return size_t;
22559   function isatty (handle : int) return int;
22560   procedure mktemp (template : chars);
22561   -- The return value (which is just a pointer to template)
22562   -- is discarded
22563   procedure rewind (stream : FILEs);
22564   function rmtmp return int;
22565   function setvbuf
22566      (stream : FILEs;
22567       buffer : chars;
22568       mode : int;
22569       size : size_t)
22570       return int;
22572   function tmpfile return FILEs;
22573   function ungetc (c : int; stream : FILEs) return int;
22574   function unlink (filename : chars) return int;
22575   ---------------------
22576   -- Extra functions --
22577   ---------------------
22578   -- These functions supply slightly thicker bindings than
22579   -- those above.  They are derived from functions in the
22580   -- C Run-Time Library, but may do a bit more work than
22581   -- just directly calling one of the Library functions.
22582   function is_regular_file (handle : int) return int;
22583   -- Tests if given handle is for a regular file (result 1)
22584   -- or for a non-regular file (pipe or device, result 0).
22585   ---------------------------------
22586   -- Control of Text/Binary Mode --
22587   ---------------------------------
22588   -- If text_translation_required is true, then the following
22589   -- functions may be used to dynamically switch a file from
22590   -- binary to text mode or vice versa.  These functions have
22591   -- no effect if text_translation_required is false (i.e., in
22592   -- normal UNIX mode).  Use fileno to get a stream handle.
22593   procedure set_binary_mode (handle : int);
22594   procedure set_text_mode (handle : int);
22595   ----------------------------
22596   -- Full Path Name support --
22597   ----------------------------
22598   procedure full_name (nam : chars; buffer : chars);
22599   -- Given a NUL terminated string representing a file
22600   -- name, returns in buffer a NUL terminated string
22601   -- representing the full path name for the file name.
22602   -- On systems where it is relevant the   drive is also
22603   -- part of the full path name.  It is the responsibility
22604   -- of the caller to pass an actual parameter for buffer
22605   -- that is big enough for any full path name.  Use
22606   -- max_path_len given below as the size of buffer.
22607   max_path_len : integer;
22608   -- Maximum length of an allowable full path name on the
22609   -- system, including a terminating NUL character.
22610 end Interfaces.C_Streams;
22611 @end example
22613 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22614 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2c8}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2c9}
22615 @section Interfacing to C Streams
22618 The packages in this section permit interfacing Ada files to C Stream
22619 operations.
22621 @example
22622 with Interfaces.C_Streams;
22623 package Ada.Sequential_IO.C_Streams is
22624    function C_Stream (F : File_Type)
22625       return Interfaces.C_Streams.FILEs;
22626    procedure Open
22627      (File : in out File_Type;
22628       Mode : in File_Mode;
22629       C_Stream : in Interfaces.C_Streams.FILEs;
22630       Form : in String := "");
22631 end Ada.Sequential_IO.C_Streams;
22633  with Interfaces.C_Streams;
22634  package Ada.Direct_IO.C_Streams is
22635     function C_Stream (F : File_Type)
22636        return Interfaces.C_Streams.FILEs;
22637     procedure Open
22638       (File : in out File_Type;
22639        Mode : in File_Mode;
22640        C_Stream : in Interfaces.C_Streams.FILEs;
22641        Form : in String := "");
22642  end Ada.Direct_IO.C_Streams;
22644  with Interfaces.C_Streams;
22645  package Ada.Text_IO.C_Streams is
22646     function C_Stream (F : File_Type)
22647        return Interfaces.C_Streams.FILEs;
22648     procedure Open
22649       (File : in out File_Type;
22650        Mode : in File_Mode;
22651        C_Stream : in Interfaces.C_Streams.FILEs;
22652        Form : in String := "");
22653  end Ada.Text_IO.C_Streams;
22655  with Interfaces.C_Streams;
22656  package Ada.Wide_Text_IO.C_Streams is
22657     function C_Stream (F : File_Type)
22658        return Interfaces.C_Streams.FILEs;
22659     procedure Open
22660       (File : in out File_Type;
22661        Mode : in File_Mode;
22662        C_Stream : in Interfaces.C_Streams.FILEs;
22663        Form : in String := "");
22664 end Ada.Wide_Text_IO.C_Streams;
22666  with Interfaces.C_Streams;
22667  package Ada.Wide_Wide_Text_IO.C_Streams is
22668     function C_Stream (F : File_Type)
22669        return Interfaces.C_Streams.FILEs;
22670     procedure Open
22671       (File : in out File_Type;
22672        Mode : in File_Mode;
22673        C_Stream : in Interfaces.C_Streams.FILEs;
22674        Form : in String := "");
22675 end Ada.Wide_Wide_Text_IO.C_Streams;
22677 with Interfaces.C_Streams;
22678 package Ada.Stream_IO.C_Streams is
22679    function C_Stream (F : File_Type)
22680       return Interfaces.C_Streams.FILEs;
22681    procedure Open
22682      (File : in out File_Type;
22683       Mode : in File_Mode;
22684       C_Stream : in Interfaces.C_Streams.FILEs;
22685       Form : in String := "");
22686 end Ada.Stream_IO.C_Streams;
22687 @end example
22689 In each of these six packages, the @code{C_Stream} function obtains the
22690 @code{FILE} pointer from a currently opened Ada file.  It is then
22691 possible to use the @code{Interfaces.C_Streams} package to operate on
22692 this stream, or the stream can be passed to a C program which can
22693 operate on it directly.  Of course the program is responsible for
22694 ensuring that only appropriate sequences of operations are executed.
22696 One particular use of relevance to an Ada program is that the
22697 @code{setvbuf} function can be used to control the buffering of the
22698 stream used by an Ada file.  In the absence of such a call the standard
22699 default buffering is used.
22701 The @code{Open} procedures in these packages open a file giving an
22702 existing C Stream instead of a file name.  Typically this stream is
22703 imported from a C program, allowing an Ada file to operate on an
22704 existing C file.
22706 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
22707 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{2ca}@anchor{gnat_rm/the_gnat_library id1}@anchor{2cb}
22708 @chapter The GNAT Library
22711 The GNAT library contains a number of general and special purpose packages.
22712 It represents functionality that the GNAT developers have found useful, and
22713 which is made available to GNAT users.  The packages described here are fully
22714 supported, and upwards compatibility will be maintained in future releases,
22715 so you can use these facilities with the confidence that the same functionality
22716 will be available in future releases.
22718 The chapter here simply gives a brief summary of the facilities available.
22719 The full documentation is found in the spec file for the package.  The full
22720 sources of these library packages, including both spec and body, are provided
22721 with all GNAT releases.  For example, to find out the full specifications of
22722 the SPITBOL pattern matching capability, including a full tutorial and
22723 extensive examples, look in the @code{g-spipat.ads} file in the library.
22725 For each entry here, the package name (as it would appear in a @code{with}
22726 clause) is given, followed by the name of the corresponding spec file in
22727 parentheses.  The packages are children in four hierarchies, @code{Ada},
22728 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
22729 GNAT-specific hierarchy.
22731 Note that an application program should only use packages in one of these
22732 four hierarchies if the package is defined in the Ada Reference Manual,
22733 or is listed in this section of the GNAT Programmers Reference Manual.
22734 All other units should be considered internal implementation units and
22735 should not be directly @code{with}ed by application code.  The use of
22736 a @code{with} clause that references one of these internal implementation
22737 units makes an application potentially dependent on changes in versions
22738 of GNAT, and will generate a warning message.
22740 @menu
22741 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads. 
22742 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads. 
22743 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads. 
22744 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads. 
22745 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads. 
22746 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads. 
22747 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads. 
22748 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads. 
22749 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads. 
22750 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads. 
22751 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads. 
22752 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads. 
22753 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads. 
22754 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads. 
22755 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads. 
22756 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads. 
22757 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads. 
22758 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads. 
22759 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads. 
22760 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads. 
22761 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads. 
22762 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads. 
22763 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads. 
22764 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads. 
22765 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads. 
22766 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads. 
22767 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads. 
22768 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads. 
22769 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads. 
22770 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads. 
22771 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads. 
22772 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads. 
22773 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads. 
22774 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads. 
22775 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads. 
22776 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads. 
22777 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads. 
22778 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads. 
22779 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads. 
22780 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads. 
22781 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads. 
22782 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads. 
22783 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads. 
22784 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads. 
22785 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads. 
22786 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads. 
22787 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads. 
22788 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads. 
22789 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads. 
22790 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads. 
22791 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads. 
22792 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads. 
22793 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads. 
22794 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads. 
22795 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads. 
22796 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads. 
22797 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads. 
22798 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads. 
22799 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads. 
22800 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads. 
22801 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads. 
22802 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads. 
22803 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads. 
22804 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads. 
22805 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads. 
22806 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads. 
22807 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads. 
22808 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads. 
22809 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads. 
22810 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads. 
22811 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads. 
22812 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads. 
22813 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads. 
22814 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads. 
22815 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads. 
22816 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads. 
22817 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads. 
22818 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads. 
22819 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads. 
22820 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads. 
22821 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads. 
22822 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads. 
22823 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads. 
22824 * GNAT.IO (g-io.ads): GNAT IO g-io ads. 
22825 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads. 
22826 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads. 
22827 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads. 
22828 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads. 
22829 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads. 
22830 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads. 
22831 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads. 
22832 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads. 
22833 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads. 
22834 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads. 
22835 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads. 
22836 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads. 
22837 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads. 
22838 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads. 
22839 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads. 
22840 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads. 
22841 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads. 
22842 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads. 
22843 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads. 
22844 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads. 
22845 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads. 
22846 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads. 
22847 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads. 
22848 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads. 
22849 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads. 
22850 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads. 
22851 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads. 
22852 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads. 
22853 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads. 
22854 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads. 
22855 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads. 
22856 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads. 
22857 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads. 
22858 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads. 
22859 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads. 
22860 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads. 
22861 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads. 
22862 * GNAT.Table (g-table.ads): GNAT Table g-table ads. 
22863 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads. 
22864 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads. 
22865 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads. 
22866 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads. 
22867 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads. 
22868 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads. 
22869 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads. 
22870 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads. 
22871 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads. 
22872 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads. 
22873 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads. 
22874 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads. 
22875 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads. 
22876 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads. 
22877 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads. 
22878 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads. 
22879 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads. 
22880 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads. 
22881 * System.Assertions (s-assert.ads): System Assertions s-assert ads. 
22882 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads. 
22883 * System.Memory (s-memory.ads): System Memory s-memory ads. 
22884 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads. 
22885 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads. 
22886 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads. 
22887 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads. 
22888 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads. 
22889 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads. 
22890 * System.Rident (s-rident.ads): System Rident s-rident ads. 
22891 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads. 
22892 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads. 
22893 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads. 
22894 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads. 
22896 @end menu
22898 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
22899 @anchor{gnat_rm/the_gnat_library id2}@anchor{2cc}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2cd}
22900 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
22903 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
22905 @geindex Latin_9 constants for Character
22907 This child of @code{Ada.Characters}
22908 provides a set of definitions corresponding to those in the
22909 RM-defined package @code{Ada.Characters.Latin_1} but with the
22910 few modifications required for @code{Latin-9}
22911 The provision of such a package
22912 is specifically authorized by the Ada Reference Manual
22913 (RM A.3.3(27)).
22915 @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
22916 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2ce}@anchor{gnat_rm/the_gnat_library id3}@anchor{2cf}
22917 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
22920 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
22922 @geindex Latin_1 constants for Wide_Character
22924 This child of @code{Ada.Characters}
22925 provides a set of definitions corresponding to those in the
22926 RM-defined package @code{Ada.Characters.Latin_1} but with the
22927 types of the constants being @code{Wide_Character}
22928 instead of @code{Character}.  The provision of such a package
22929 is specifically authorized by the Ada Reference Manual
22930 (RM A.3.3(27)).
22932 @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
22933 @anchor{gnat_rm/the_gnat_library id4}@anchor{2d0}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2d1}
22934 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
22937 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
22939 @geindex Latin_9 constants for Wide_Character
22941 This child of @code{Ada.Characters}
22942 provides a set of definitions corresponding to those in the
22943 GNAT defined package @code{Ada.Characters.Latin_9} but with the
22944 types of the constants being @code{Wide_Character}
22945 instead of @code{Character}.  The provision of such a package
22946 is specifically authorized by the Ada Reference Manual
22947 (RM A.3.3(27)).
22949 @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
22950 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2d2}@anchor{gnat_rm/the_gnat_library id5}@anchor{2d3}
22951 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
22954 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
22956 @geindex Latin_1 constants for Wide_Wide_Character
22958 This child of @code{Ada.Characters}
22959 provides a set of definitions corresponding to those in the
22960 RM-defined package @code{Ada.Characters.Latin_1} but with the
22961 types of the constants being @code{Wide_Wide_Character}
22962 instead of @code{Character}.  The provision of such a package
22963 is specifically authorized by the Ada Reference Manual
22964 (RM A.3.3(27)).
22966 @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
22967 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2d4}@anchor{gnat_rm/the_gnat_library id6}@anchor{2d5}
22968 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
22971 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
22973 @geindex Latin_9 constants for Wide_Wide_Character
22975 This child of @code{Ada.Characters}
22976 provides a set of definitions corresponding to those in the
22977 GNAT defined package @code{Ada.Characters.Latin_9} but with the
22978 types of the constants being @code{Wide_Wide_Character}
22979 instead of @code{Character}.  The provision of such a package
22980 is specifically authorized by the Ada Reference Manual
22981 (RM A.3.3(27)).
22983 @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
22984 @anchor{gnat_rm/the_gnat_library id7}@anchor{2d6}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2d7}
22985 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
22988 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
22990 @geindex Formal container for doubly linked lists
22992 This child of @code{Ada.Containers} defines a modified version of the
22993 Ada 2005 container for doubly linked lists, meant to facilitate formal
22994 verification of code using such containers. The specification of this
22995 unit is compatible with SPARK 2014.
22997 Note that although this container was designed with formal verification
22998 in mind, it may well be generally useful in that it is a simplified more
22999 efficient version than the one defined in the standard. In particular it
23000 does not have the complex overhead required to detect cursor tampering.
23002 @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
23003 @anchor{gnat_rm/the_gnat_library id8}@anchor{2d8}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2d9}
23004 @section @code{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
23007 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
23009 @geindex Formal container for hashed maps
23011 This child of @code{Ada.Containers} defines a modified version of the
23012 Ada 2005 container for hashed maps, meant to facilitate formal
23013 verification of code using such containers. The specification of this
23014 unit is compatible with SPARK 2014.
23016 Note that although this container was designed with formal verification
23017 in mind, it may well be generally useful in that it is a simplified more
23018 efficient version than the one defined in the standard. In particular it
23019 does not have the complex overhead required to detect cursor tampering.
23021 @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
23022 @anchor{gnat_rm/the_gnat_library id9}@anchor{2da}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2db}
23023 @section @code{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
23026 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
23028 @geindex Formal container for hashed sets
23030 This child of @code{Ada.Containers} defines a modified version of the
23031 Ada 2005 container for hashed sets, meant to facilitate formal
23032 verification of code using such containers. The specification of this
23033 unit is compatible with SPARK 2014.
23035 Note that although this container was designed with formal verification
23036 in mind, it may well be generally useful in that it is a simplified more
23037 efficient version than the one defined in the standard. In particular it
23038 does not have the complex overhead required to detect cursor tampering.
23040 @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
23041 @anchor{gnat_rm/the_gnat_library id10}@anchor{2dc}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2dd}
23042 @section @code{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
23045 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
23047 @geindex Formal container for ordered maps
23049 This child of @code{Ada.Containers} defines a modified version of the
23050 Ada 2005 container for ordered maps, meant to facilitate formal
23051 verification of code using such containers. The specification of this
23052 unit is compatible with SPARK 2014.
23054 Note that although this container was designed with formal verification
23055 in mind, it may well be generally useful in that it is a simplified more
23056 efficient version than the one defined in the standard. In particular it
23057 does not have the complex overhead required to detect cursor tampering.
23059 @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
23060 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2de}@anchor{gnat_rm/the_gnat_library id11}@anchor{2df}
23061 @section @code{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
23064 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
23066 @geindex Formal container for ordered sets
23068 This child of @code{Ada.Containers} defines a modified version of the
23069 Ada 2005 container for ordered sets, meant to facilitate formal
23070 verification of code using such containers. The specification of this
23071 unit is compatible with SPARK 2014.
23073 Note that although this container was designed with formal verification
23074 in mind, it may well be generally useful in that it is a simplified more
23075 efficient version than the one defined in the standard. In particular it
23076 does not have the complex overhead required to detect cursor tampering.
23078 @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
23079 @anchor{gnat_rm/the_gnat_library id12}@anchor{2e0}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2e1}
23080 @section @code{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
23083 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
23085 @geindex Formal container for vectors
23087 This child of @code{Ada.Containers} defines a modified version of the
23088 Ada 2005 container for vectors, meant to facilitate formal
23089 verification of code using such containers. The specification of this
23090 unit is compatible with SPARK 2014.
23092 Note that although this container was designed with formal verification
23093 in mind, it may well be generally useful in that it is a simplified more
23094 efficient version than the one defined in the standard. In particular it
23095 does not have the complex overhead required to detect cursor tampering.
23097 @node Ada Containers Formal_Indefinite_Vectors a-cfinve ads,Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Formal_Vectors a-cofove ads,The GNAT Library
23098 @anchor{gnat_rm/the_gnat_library id13}@anchor{2e2}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2e3}
23099 @section @code{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
23102 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
23104 @geindex Formal container for vectors
23106 This child of @code{Ada.Containers} defines a modified version of the
23107 Ada 2005 container for vectors of indefinite elements, meant to
23108 facilitate formal verification of code using such containers. The
23109 specification of this unit is compatible with SPARK 2014.
23111 Note that although this container was designed with formal verification
23112 in mind, it may well be generally useful in that it is a simplified more
23113 efficient version than the one defined in the standard. In particular it
23114 does not have the complex overhead required to detect cursor tampering.
23116 @node Ada Containers Functional_Vectors a-cofuve ads,Ada Containers Functional_Sets a-cofuse ads,Ada Containers Formal_Indefinite_Vectors a-cfinve ads,The GNAT Library
23117 @anchor{gnat_rm/the_gnat_library id14}@anchor{2e4}@anchor{gnat_rm/the_gnat_library ada-containers-functional-vectors-a-cofuve-ads}@anchor{2e5}
23118 @section @code{Ada.Containers.Functional_Vectors} (@code{a-cofuve.ads})
23121 @geindex Ada.Containers.Functional_Vectors (a-cofuve.ads)
23123 @geindex Functional vectors
23125 This child of @code{Ada.Containers} defines immutable vectors. These
23126 containers are unbounded and may contain indefinite elements. Furthermore, to
23127 be usable in every context, they are neither controlled nor limited. As they
23128 are functional, that is, no primitives are provided which would allow modifying
23129 an existing container, these containers can still be used safely.
23131 Their API features functions creating new containers from existing ones.
23132 As a consequence, these containers are highly inefficient. They are also
23133 memory consuming, as the allocated memory is not reclaimed when the container
23134 is no longer referenced. Thus, they should in general be used in ghost code
23135 and annotations, so that they can be removed from the final executable. The
23136 specification of this unit is compatible with SPARK 2014.
23138 @node Ada Containers Functional_Sets a-cofuse ads,Ada Containers Functional_Maps a-cofuma ads,Ada Containers Functional_Vectors a-cofuve ads,The GNAT Library
23139 @anchor{gnat_rm/the_gnat_library ada-containers-functional-sets-a-cofuse-ads}@anchor{2e6}@anchor{gnat_rm/the_gnat_library id15}@anchor{2e7}
23140 @section @code{Ada.Containers.Functional_Sets} (@code{a-cofuse.ads})
23143 @geindex Ada.Containers.Functional_Sets (a-cofuse.ads)
23145 @geindex Functional sets
23147 This child of @code{Ada.Containers} defines immutable sets. These containers are
23148 unbounded and may contain indefinite elements. Furthermore, to be usable in
23149 every context, they are neither controlled nor limited. As they are functional,
23150 that is, no primitives are provided which would allow modifying an existing
23151 container, these containers can still be used safely.
23153 Their API features functions creating new containers from existing ones.
23154 As a consequence, these containers are highly inefficient. They are also
23155 memory consuming, as the allocated memory is not reclaimed when the container
23156 is no longer referenced. Thus, they should in general be used in ghost code
23157 and annotations, so that they can be removed from the final executable. The
23158 specification of this unit is compatible with SPARK 2014.
23160 @node Ada Containers Functional_Maps a-cofuma ads,Ada Containers Bounded_Holders a-coboho ads,Ada Containers Functional_Sets a-cofuse ads,The GNAT Library
23161 @anchor{gnat_rm/the_gnat_library id16}@anchor{2e8}@anchor{gnat_rm/the_gnat_library ada-containers-functional-maps-a-cofuma-ads}@anchor{2e9}
23162 @section @code{Ada.Containers.Functional_Maps} (@code{a-cofuma.ads})
23165 @geindex Ada.Containers.Functional_Maps (a-cofuma.ads)
23167 @geindex Functional maps
23169 This child of @code{Ada.Containers} defines immutable maps. These containers are
23170 unbounded and may contain indefinite elements. Furthermore, to be usable in
23171 every context, they are neither controlled nor limited. As they are functional,
23172 that is, no primitives are provided which would allow modifying an existing
23173 container, these containers can still be used safely.
23175 Their API features functions creating new containers from existing ones.
23176 As a consequence, these containers are highly inefficient. They are also
23177 memory consuming, as the allocated memory is not reclaimed when the container
23178 is no longer referenced. Thus, they should in general be used in ghost code
23179 and annotations, so that they can be removed from the final executable. The
23180 specification of this unit is compatible with SPARK 2014.
23182 @node Ada Containers Bounded_Holders a-coboho ads,Ada Command_Line Environment a-colien ads,Ada Containers Functional_Maps a-cofuma ads,The GNAT Library
23183 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2ea}@anchor{gnat_rm/the_gnat_library id17}@anchor{2eb}
23184 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23187 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23189 @geindex Formal container for vectors
23191 This child of @code{Ada.Containers} defines a modified version of
23192 Indefinite_Holders that avoids heap allocation.
23194 @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
23195 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2ec}@anchor{gnat_rm/the_gnat_library id18}@anchor{2ed}
23196 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23199 @geindex Ada.Command_Line.Environment (a-colien.ads)
23201 @geindex Environment entries
23203 This child of @code{Ada.Command_Line}
23204 provides a mechanism for obtaining environment values on systems
23205 where this concept makes sense.
23207 @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
23208 @anchor{gnat_rm/the_gnat_library id19}@anchor{2ee}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2ef}
23209 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23212 @geindex Ada.Command_Line.Remove (a-colire.ads)
23214 @geindex Removing command line arguments
23216 @geindex Command line
23217 @geindex argument removal
23219 This child of @code{Ada.Command_Line}
23220 provides a mechanism for logically removing
23221 arguments from the argument list.  Once removed, an argument is not visible
23222 to further calls on the subprograms in @code{Ada.Command_Line} will not
23223 see the removed argument.
23225 @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
23226 @anchor{gnat_rm/the_gnat_library id20}@anchor{2f0}@anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2f1}
23227 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23230 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23232 @geindex Response file for command line
23234 @geindex Command line
23235 @geindex response file
23237 @geindex Command line
23238 @geindex handling long command lines
23240 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23241 getting command line arguments from a text file, called a "response file".
23242 Using a response file allow passing a set of arguments to an executable longer
23243 than the maximum allowed by the system on the command line.
23245 @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
23246 @anchor{gnat_rm/the_gnat_library id21}@anchor{2f2}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2f3}
23247 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23250 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23252 @geindex C Streams
23253 @geindex Interfacing with Direct_IO
23255 This package provides subprograms that allow interfacing between
23256 C streams and @code{Direct_IO}.  The stream identifier can be
23257 extracted from a file opened on the Ada side, and an Ada file
23258 can be constructed from a stream opened on the C side.
23260 @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
23261 @anchor{gnat_rm/the_gnat_library id22}@anchor{2f4}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2f5}
23262 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23265 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23267 @geindex Null_Occurrence
23268 @geindex testing for
23270 This child subprogram provides a way of testing for the null
23271 exception occurrence (@code{Null_Occurrence}) without raising
23272 an exception.
23274 @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
23275 @anchor{gnat_rm/the_gnat_library id23}@anchor{2f6}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2f7}
23276 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23279 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23281 @geindex Null_Occurrence
23282 @geindex testing for
23284 This child subprogram is used for handling otherwise unhandled
23285 exceptions (hence the name last chance), and perform clean ups before
23286 terminating the program. Note that this subprogram never returns.
23288 @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
23289 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2f8}@anchor{gnat_rm/the_gnat_library id24}@anchor{2f9}
23290 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23293 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23295 @geindex Traceback for Exception Occurrence
23297 This child package provides the subprogram (@code{Tracebacks}) to
23298 give a traceback array of addresses based on an exception
23299 occurrence.
23301 @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
23302 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2fa}@anchor{gnat_rm/the_gnat_library id25}@anchor{2fb}
23303 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23306 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23308 @geindex C Streams
23309 @geindex Interfacing with Sequential_IO
23311 This package provides subprograms that allow interfacing between
23312 C streams and @code{Sequential_IO}.  The stream identifier can be
23313 extracted from a file opened on the Ada side, and an Ada file
23314 can be constructed from a stream opened on the C side.
23316 @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
23317 @anchor{gnat_rm/the_gnat_library id26}@anchor{2fc}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{2fd}
23318 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23321 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23323 @geindex C Streams
23324 @geindex Interfacing with Stream_IO
23326 This package provides subprograms that allow interfacing between
23327 C streams and @code{Stream_IO}.  The stream identifier can be
23328 extracted from a file opened on the Ada side, and an Ada file
23329 can be constructed from a stream opened on the C side.
23331 @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
23332 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{2fe}@anchor{gnat_rm/the_gnat_library id27}@anchor{2ff}
23333 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23336 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23338 @geindex Unbounded_String
23339 @geindex IO support
23341 @geindex Text_IO
23342 @geindex extensions for unbounded strings
23344 This package provides subprograms for Text_IO for unbounded
23345 strings, avoiding the necessity for an intermediate operation
23346 with ordinary strings.
23348 @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
23349 @anchor{gnat_rm/the_gnat_library id28}@anchor{300}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{301}
23350 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23353 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23355 @geindex Unbounded_Wide_String
23356 @geindex IO support
23358 @geindex Text_IO
23359 @geindex extensions for unbounded wide strings
23361 This package provides subprograms for Text_IO for unbounded
23362 wide strings, avoiding the necessity for an intermediate operation
23363 with ordinary wide strings.
23365 @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
23366 @anchor{gnat_rm/the_gnat_library id29}@anchor{302}@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{303}
23367 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23370 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23372 @geindex Unbounded_Wide_Wide_String
23373 @geindex IO support
23375 @geindex Text_IO
23376 @geindex extensions for unbounded wide wide strings
23378 This package provides subprograms for Text_IO for unbounded
23379 wide wide strings, avoiding the necessity for an intermediate operation
23380 with ordinary wide wide strings.
23382 @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
23383 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{304}@anchor{gnat_rm/the_gnat_library id30}@anchor{305}
23384 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23387 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23389 @geindex C Streams
23390 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23392 This package provides subprograms that allow interfacing between
23393 C streams and @code{Text_IO}.  The stream identifier can be
23394 extracted from a file opened on the Ada side, and an Ada file
23395 can be constructed from a stream opened on the C side.
23397 @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
23398 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{306}@anchor{gnat_rm/the_gnat_library id31}@anchor{307}
23399 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23402 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23404 @geindex Text_IO resetting standard files
23406 This procedure is used to reset the status of the standard files used
23407 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
23408 embedded application) where the status of the files may change during
23409 execution (for example a standard input file may be redefined to be
23410 interactive).
23412 @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
23413 @anchor{gnat_rm/the_gnat_library id32}@anchor{308}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{309}
23414 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23417 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23419 @geindex Unicode categorization
23420 @geindex Wide_Character
23422 This package provides subprograms that allow categorization of
23423 Wide_Character values according to Unicode categories.
23425 @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
23426 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{30a}@anchor{gnat_rm/the_gnat_library id33}@anchor{30b}
23427 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23430 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23432 @geindex C Streams
23433 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23435 This package provides subprograms that allow interfacing between
23436 C streams and @code{Wide_Text_IO}.  The stream identifier can be
23437 extracted from a file opened on the Ada side, and an Ada file
23438 can be constructed from a stream opened on the C side.
23440 @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
23441 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{30c}@anchor{gnat_rm/the_gnat_library id34}@anchor{30d}
23442 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23445 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23447 @geindex Wide_Text_IO resetting standard files
23449 This procedure is used to reset the status of the standard files used
23450 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
23451 embedded application) where the status of the files may change during
23452 execution (for example a standard input file may be redefined to be
23453 interactive).
23455 @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
23456 @anchor{gnat_rm/the_gnat_library id35}@anchor{30e}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{30f}
23457 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23460 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23462 @geindex Unicode categorization
23463 @geindex Wide_Wide_Character
23465 This package provides subprograms that allow categorization of
23466 Wide_Wide_Character values according to Unicode categories.
23468 @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
23469 @anchor{gnat_rm/the_gnat_library id36}@anchor{310}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{311}
23470 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23473 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23475 @geindex C Streams
23476 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23478 This package provides subprograms that allow interfacing between
23479 C streams and @code{Wide_Wide_Text_IO}.  The stream identifier can be
23480 extracted from a file opened on the Ada side, and an Ada file
23481 can be constructed from a stream opened on the C side.
23483 @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
23484 @anchor{gnat_rm/the_gnat_library id37}@anchor{312}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{313}
23485 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23488 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23490 @geindex Wide_Wide_Text_IO resetting standard files
23492 This procedure is used to reset the status of the standard files used
23493 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23494 restart in an embedded application) where the status of the files may
23495 change during execution (for example a standard input file may be
23496 redefined to be interactive).
23498 @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
23499 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{314}@anchor{gnat_rm/the_gnat_library id38}@anchor{315}
23500 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23503 @geindex GNAT.Altivec (g-altive.ads)
23505 @geindex AltiVec
23507 This is the root package of the GNAT AltiVec binding. It provides
23508 definitions of constants and types common to all the versions of the
23509 binding.
23511 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23512 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{316}@anchor{gnat_rm/the_gnat_library id39}@anchor{317}
23513 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23516 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23518 @geindex AltiVec
23520 This package provides the Vector/View conversion routines.
23522 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23523 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{318}@anchor{gnat_rm/the_gnat_library id40}@anchor{319}
23524 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23527 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23529 @geindex AltiVec
23531 This package exposes the Ada interface to the AltiVec operations on
23532 vector objects. A soft emulation is included by default in the GNAT
23533 library. The hard binding is provided as a separate package. This unit
23534 is common to both bindings.
23536 @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
23537 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id41}@anchor{31b}
23538 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23541 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23543 @geindex AltiVec
23545 This package exposes the various vector types part of the Ada binding
23546 to AltiVec facilities.
23548 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23549 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id42}@anchor{31d}
23550 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23553 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23555 @geindex AltiVec
23557 This package provides public 'View' data types from/to which private
23558 vector representations can be converted via
23559 GNAT.Altivec.Conversions. This allows convenient access to individual
23560 vector elements and provides a simple way to initialize vector
23561 objects.
23563 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23564 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id43}@anchor{31f}
23565 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23568 @geindex GNAT.Array_Split (g-arrspl.ads)
23570 @geindex Array splitter
23572 Useful array-manipulation routines: given a set of separators, split
23573 an array wherever the separators appear, and provide direct access
23574 to the resulting slices.
23576 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23577 @anchor{gnat_rm/the_gnat_library id44}@anchor{320}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{321}
23578 @section @code{GNAT.AWK} (@code{g-awk.ads})
23581 @geindex GNAT.AWK (g-awk.ads)
23583 @geindex Parsing
23585 @geindex AWK
23587 Provides AWK-like parsing functions, with an easy interface for parsing one
23588 or more files containing formatted data.  The file is viewed as a database
23589 where each record is a line and a field is a data element in this line.
23591 @node GNAT Bind_Environment g-binenv ads,GNAT Bounded_Buffers g-boubuf ads,GNAT AWK g-awk ads,The GNAT Library
23592 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id45}@anchor{323}
23593 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23596 @geindex GNAT.Bind_Environment (g-binenv.ads)
23598 @geindex Bind environment
23600 Provides access to key=value associations captured at bind time.
23601 These associations can be specified using the @code{-V} binder command
23602 line switch.
23604 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23605 @anchor{gnat_rm/the_gnat_library id46}@anchor{324}@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{325}
23606 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23609 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23611 @geindex Parsing
23613 @geindex Bounded Buffers
23615 Provides a concurrent generic bounded buffer abstraction.  Instances are
23616 useful directly or as parts of the implementations of other abstractions,
23617 such as mailboxes.
23619 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23620 @anchor{gnat_rm/the_gnat_library id47}@anchor{326}@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{327}
23621 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23624 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23626 @geindex Parsing
23628 @geindex Mailboxes
23630 Provides a thread-safe asynchronous intertask mailbox communication facility.
23632 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23633 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{328}@anchor{gnat_rm/the_gnat_library id48}@anchor{329}
23634 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23637 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23639 @geindex Sorting
23641 @geindex Bubble sort
23643 Provides a general implementation of bubble sort usable for sorting arbitrary
23644 data items.  Exchange and comparison procedures are provided by passing
23645 access-to-procedure values.
23647 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23648 @anchor{gnat_rm/the_gnat_library id49}@anchor{32a}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{32b}
23649 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23652 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23654 @geindex Sorting
23656 @geindex Bubble sort
23658 Provides a general implementation of bubble sort usable for sorting arbitrary
23659 data items.  Move and comparison procedures are provided by passing
23660 access-to-procedure values. This is an older version, retained for
23661 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23663 @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
23664 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{32c}@anchor{gnat_rm/the_gnat_library id50}@anchor{32d}
23665 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23668 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23670 @geindex Sorting
23672 @geindex Bubble sort
23674 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23675 are provided as generic parameters, this improves efficiency, especially
23676 if the procedures can be inlined, at the expense of duplicating code for
23677 multiple instantiations.
23679 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23680 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{32e}@anchor{gnat_rm/the_gnat_library id51}@anchor{32f}
23681 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23684 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23686 @geindex UTF-8 representation
23688 @geindex Wide characte representations
23690 Provides a routine which given a string, reads the start of the string to
23691 see whether it is one of the standard byte order marks (BOM's) which signal
23692 the encoding of the string. The routine includes detection of special XML
23693 sequences for various UCS input formats.
23695 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
23696 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{330}@anchor{gnat_rm/the_gnat_library id52}@anchor{331}
23697 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
23700 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
23702 @geindex Byte swapping
23704 @geindex Endianness
23706 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
23707 Machine-specific implementations are available in some cases.
23709 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
23710 @anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id53}@anchor{333}
23711 @section @code{GNAT.Calendar} (@code{g-calend.ads})
23714 @geindex GNAT.Calendar (g-calend.ads)
23716 @geindex Calendar
23718 Extends the facilities provided by @code{Ada.Calendar} to include handling
23719 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
23720 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
23721 C @code{timeval} format.
23723 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
23724 @anchor{gnat_rm/the_gnat_library id54}@anchor{334}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{335}
23725 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
23728 @geindex Calendar
23730 @geindex Time
23732 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
23734 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
23735 @anchor{gnat_rm/the_gnat_library id55}@anchor{336}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{337}
23736 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
23739 @geindex GNAT.CRC32 (g-crc32.ads)
23741 @geindex CRC32
23743 @geindex Cyclic Redundancy Check
23745 This package implements the CRC-32 algorithm.  For a full description
23746 of this algorithm see
23747 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
23748 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
23749 Aug. 1988.  Sarwate, D.V.
23751 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
23752 @anchor{gnat_rm/the_gnat_library id56}@anchor{338}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{339}
23753 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
23756 @geindex GNAT.Case_Util (g-casuti.ads)
23758 @geindex Casing utilities
23760 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
23762 A set of simple routines for handling upper and lower casing of strings
23763 without the overhead of the full casing tables
23764 in @code{Ada.Characters.Handling}.
23766 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
23767 @anchor{gnat_rm/the_gnat_library id57}@anchor{33a}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{33b}
23768 @section @code{GNAT.CGI} (@code{g-cgi.ads})
23771 @geindex GNAT.CGI (g-cgi.ads)
23773 @geindex CGI (Common Gateway Interface)
23775 This is a package for interfacing a GNAT program with a Web server via the
23776 Common Gateway Interface (CGI).  Basically this package parses the CGI
23777 parameters, which are a set of key/value pairs sent by the Web server.  It
23778 builds a table whose index is the key and provides some services to deal
23779 with this table.
23781 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
23782 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{33c}@anchor{gnat_rm/the_gnat_library id58}@anchor{33d}
23783 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
23786 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
23788 @geindex CGI (Common Gateway Interface) cookie support
23790 @geindex Cookie support in CGI
23792 This is a package to interface a GNAT program with a Web server via the
23793 Common Gateway Interface (CGI).  It exports services to deal with Web
23794 cookies (piece of information kept in the Web client software).
23796 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
23797 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{33e}@anchor{gnat_rm/the_gnat_library id59}@anchor{33f}
23798 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
23801 @geindex GNAT.CGI.Debug (g-cgideb.ads)
23803 @geindex CGI (Common Gateway Interface) debugging
23805 This is a package to help debugging CGI (Common Gateway Interface)
23806 programs written in Ada.
23808 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
23809 @anchor{gnat_rm/the_gnat_library id60}@anchor{340}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{341}
23810 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
23813 @geindex GNAT.Command_Line (g-comlin.ads)
23815 @geindex Command line
23817 Provides a high level interface to @code{Ada.Command_Line} facilities,
23818 including the ability to scan for named switches with optional parameters
23819 and expand file names using wild card notations.
23821 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
23822 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{342}@anchor{gnat_rm/the_gnat_library id61}@anchor{343}
23823 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
23826 @geindex GNAT.Compiler_Version (g-comver.ads)
23828 @geindex Compiler Version
23830 @geindex Version
23831 @geindex of compiler
23833 Provides a routine for obtaining the version of the compiler used to
23834 compile the program. More accurately this is the version of the binder
23835 used to bind the program (this will normally be the same as the version
23836 of the compiler if a consistent tool set is used to compile all units
23837 of a partition).
23839 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
23840 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{344}@anchor{gnat_rm/the_gnat_library id62}@anchor{345}
23841 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
23844 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
23846 @geindex Interrupt
23848 Provides a simple interface to handle Ctrl-C keyboard events.
23850 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
23851 @anchor{gnat_rm/the_gnat_library id63}@anchor{346}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{347}
23852 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
23855 @geindex GNAT.Current_Exception (g-curexc.ads)
23857 @geindex Current exception
23859 @geindex Exception retrieval
23861 Provides access to information on the current exception that has been raised
23862 without the need for using the Ada 95 / Ada 2005 exception choice parameter
23863 specification syntax.
23864 This is particularly useful in simulating typical facilities for
23865 obtaining information about exceptions provided by Ada 83 compilers.
23867 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
23868 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id64}@anchor{349}
23869 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
23872 @geindex GNAT.Debug_Pools (g-debpoo.ads)
23874 @geindex Debugging
23876 @geindex Debug pools
23878 @geindex Memory corruption debugging
23880 Provide a debugging storage pools that helps tracking memory corruption
23881 problems.
23882 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
23884 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
23885 @anchor{gnat_rm/the_gnat_library id65}@anchor{34a}@anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{34b}
23886 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
23889 @geindex GNAT.Debug_Utilities (g-debuti.ads)
23891 @geindex Debugging
23893 Provides a few useful utilities for debugging purposes, including conversion
23894 to and from string images of address values. Supports both C and Ada formats
23895 for hexadecimal literals.
23897 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
23898 @anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{34c}@anchor{gnat_rm/the_gnat_library id66}@anchor{34d}
23899 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
23902 @geindex GNAT.Decode_String (g-decstr.ads)
23904 @geindex Decoding strings
23906 @geindex String decoding
23908 @geindex Wide character encoding
23910 @geindex UTF-8
23912 @geindex Unicode
23914 A generic package providing routines for decoding wide character and wide wide
23915 character strings encoded as sequences of 8-bit characters using a specified
23916 encoding method. Includes validation routines, and also routines for stepping
23917 to next or previous encoded character in an encoded string.
23918 Useful in conjunction with Unicode character coding. Note there is a
23919 preinstantiation for UTF-8. See next entry.
23921 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
23922 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id67}@anchor{34f}
23923 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
23926 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
23928 @geindex Decoding strings
23930 @geindex Decoding UTF-8 strings
23932 @geindex UTF-8 string decoding
23934 @geindex Wide character decoding
23936 @geindex UTF-8
23938 @geindex Unicode
23940 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
23942 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
23943 @anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{350}@anchor{gnat_rm/the_gnat_library id68}@anchor{351}
23944 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
23947 @geindex GNAT.Directory_Operations (g-dirope.ads)
23949 @geindex Directory operations
23951 Provides a set of routines for manipulating directories, including changing
23952 the current directory, making new directories, and scanning the files in a
23953 directory.
23955 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
23956 @anchor{gnat_rm/the_gnat_library id69}@anchor{352}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{353}
23957 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
23960 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
23962 @geindex Directory operations iteration
23964 A child unit of GNAT.Directory_Operations providing additional operations
23965 for iterating through directories.
23967 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
23968 @anchor{gnat_rm/the_gnat_library id70}@anchor{354}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{355}
23969 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
23972 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
23974 @geindex Hash tables
23976 A generic implementation of hash tables that can be used to hash arbitrary
23977 data.  Provided in two forms, a simple form with built in hash functions,
23978 and a more complex form in which the hash function is supplied.
23980 This package provides a facility similar to that of @code{GNAT.HTable},
23981 except that this package declares a type that can be used to define
23982 dynamic instances of the hash table, while an instantiation of
23983 @code{GNAT.HTable} creates a single instance of the hash table.
23985 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
23986 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{356}@anchor{gnat_rm/the_gnat_library id71}@anchor{357}
23987 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
23990 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
23992 @geindex Table implementation
23994 @geindex Arrays
23995 @geindex extendable
23997 A generic package providing a single dimension array abstraction where the
23998 length of the array can be dynamically modified.
24000 This package provides a facility similar to that of @code{GNAT.Table},
24001 except that this package declares a type that can be used to define
24002 dynamic instances of the table, while an instantiation of
24003 @code{GNAT.Table} creates a single instance of the table type.
24005 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24006 @anchor{gnat_rm/the_gnat_library id72}@anchor{358}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{359}
24007 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24010 @geindex GNAT.Encode_String (g-encstr.ads)
24012 @geindex Encoding strings
24014 @geindex String encoding
24016 @geindex Wide character encoding
24018 @geindex UTF-8
24020 @geindex Unicode
24022 A generic package providing routines for encoding wide character and wide
24023 wide character strings as sequences of 8-bit characters using a specified
24024 encoding method. Useful in conjunction with Unicode character coding.
24025 Note there is a preinstantiation for UTF-8. See next entry.
24027 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24028 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{35a}@anchor{gnat_rm/the_gnat_library id73}@anchor{35b}
24029 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24032 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24034 @geindex Encoding strings
24036 @geindex Encoding UTF-8 strings
24038 @geindex UTF-8 string encoding
24040 @geindex Wide character encoding
24042 @geindex UTF-8
24044 @geindex Unicode
24046 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24048 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24049 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{35c}@anchor{gnat_rm/the_gnat_library id74}@anchor{35d}
24050 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24053 @geindex GNAT.Exception_Actions (g-excact.ads)
24055 @geindex Exception actions
24057 Provides callbacks when an exception is raised. Callbacks can be registered
24058 for specific exceptions, or when any exception is raised. This
24059 can be used for instance to force a core dump to ease debugging.
24061 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24062 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{35e}@anchor{gnat_rm/the_gnat_library id75}@anchor{35f}
24063 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24066 @geindex GNAT.Exception_Traces (g-exctra.ads)
24068 @geindex Exception traces
24070 @geindex Debugging
24072 Provides an interface allowing to control automatic output upon exception
24073 occurrences.
24075 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24076 @anchor{gnat_rm/the_gnat_library id76}@anchor{360}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{361}
24077 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24080 @geindex GNAT.Exceptions (g-except.ads)
24082 @geindex Exceptions
24083 @geindex Pure
24085 @geindex Pure packages
24086 @geindex exceptions
24088 Normally it is not possible to raise an exception with
24089 a message from a subprogram in a pure package, since the
24090 necessary types and subprograms are in @code{Ada.Exceptions}
24091 which is not a pure unit. @code{GNAT.Exceptions} provides a
24092 facility for getting around this limitation for a few
24093 predefined exceptions, and for example allow raising
24094 @code{Constraint_Error} with a message from a pure subprogram.
24096 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24097 @anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{362}@anchor{gnat_rm/the_gnat_library id77}@anchor{363}
24098 @section @code{GNAT.Expect} (@code{g-expect.ads})
24101 @geindex GNAT.Expect (g-expect.ads)
24103 Provides a set of subprograms similar to what is available
24104 with the standard Tcl Expect tool.
24105 It allows you to easily spawn and communicate with an external process.
24106 You can send commands or inputs to the process, and compare the output
24107 with some expected regular expression. Currently @code{GNAT.Expect}
24108 is implemented on all native GNAT ports.
24109 It is not implemented for cross ports, and in particular is not
24110 implemented for VxWorks or LynxOS.
24112 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24113 @anchor{gnat_rm/the_gnat_library id78}@anchor{364}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{365}
24114 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24117 @geindex GNAT.Expect.TTY (g-exptty.ads)
24119 As GNAT.Expect but using pseudo-terminal.
24120 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24121 ports. It is not implemented for cross ports, and
24122 in particular is not implemented for VxWorks or LynxOS.
24124 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24125 @anchor{gnat_rm/the_gnat_library id79}@anchor{366}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{367}
24126 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24129 @geindex GNAT.Float_Control (g-flocon.ads)
24131 @geindex Floating-Point Processor
24133 Provides an interface for resetting the floating-point processor into the
24134 mode required for correct semantic operation in Ada.  Some third party
24135 library calls may cause this mode to be modified, and the Reset procedure
24136 in this package can be used to reestablish the required mode.
24138 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
24139 @anchor{gnat_rm/the_gnat_library id80}@anchor{368}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{369}
24140 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24143 @geindex GNAT.Formatted_String (g-forstr.ads)
24145 @geindex Formatted String
24147 Provides support for C/C++ printf() formatted strings. The format is
24148 copied from the printf() routine and should therefore gives identical
24149 output. Some generic routines are provided to be able to use types
24150 derived from Integer, Float or enumerations as values for the
24151 formatted string.
24153 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24154 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{36a}@anchor{gnat_rm/the_gnat_library id81}@anchor{36b}
24155 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24158 @geindex GNAT.Heap_Sort (g-heasor.ads)
24160 @geindex Sorting
24162 Provides a general implementation of heap sort usable for sorting arbitrary
24163 data items. Exchange and comparison procedures are provided by passing
24164 access-to-procedure values.  The algorithm used is a modified heap sort
24165 that performs approximately N*log(N) comparisons in the worst case.
24167 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24168 @anchor{gnat_rm/the_gnat_library id82}@anchor{36c}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{36d}
24169 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24172 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24174 @geindex Sorting
24176 Provides a general implementation of heap sort usable for sorting arbitrary
24177 data items. Move and comparison procedures are provided by passing
24178 access-to-procedure values.  The algorithm used is a modified heap sort
24179 that performs approximately N*log(N) comparisons in the worst case.
24180 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24181 interface, but may be slightly more efficient.
24183 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24184 @anchor{gnat_rm/the_gnat_library id83}@anchor{36e}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{36f}
24185 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24188 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24190 @geindex Sorting
24192 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24193 are provided as generic parameters, this improves efficiency, especially
24194 if the procedures can be inlined, at the expense of duplicating code for
24195 multiple instantiations.
24197 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24198 @anchor{gnat_rm/the_gnat_library id84}@anchor{370}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{371}
24199 @section @code{GNAT.HTable} (@code{g-htable.ads})
24202 @geindex GNAT.HTable (g-htable.ads)
24204 @geindex Hash tables
24206 A generic implementation of hash tables that can be used to hash arbitrary
24207 data.  Provides two approaches, one a simple static approach, and the other
24208 allowing arbitrary dynamic hash tables.
24210 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24211 @anchor{gnat_rm/the_gnat_library id85}@anchor{372}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{373}
24212 @section @code{GNAT.IO} (@code{g-io.ads})
24215 @geindex GNAT.IO (g-io.ads)
24217 @geindex Simple I/O
24219 @geindex Input/Output facilities
24221 A simple preelaborable input-output package that provides a subset of
24222 simple Text_IO functions for reading characters and strings from
24223 Standard_Input, and writing characters, strings and integers to either
24224 Standard_Output or Standard_Error.
24226 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24227 @anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{374}@anchor{gnat_rm/the_gnat_library id86}@anchor{375}
24228 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24231 @geindex GNAT.IO_Aux (g-io_aux.ads)
24233 @geindex Text_IO
24235 @geindex Input/Output facilities
24237 Provides some auxiliary functions for use with Text_IO, including a test
24238 for whether a file exists, and functions for reading a line of text.
24240 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24241 @anchor{gnat_rm/the_gnat_library id87}@anchor{376}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{377}
24242 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24245 @geindex GNAT.Lock_Files (g-locfil.ads)
24247 @geindex File locking
24249 @geindex Locking using files
24251 Provides a general interface for using files as locks.  Can be used for
24252 providing program level synchronization.
24254 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24255 @anchor{gnat_rm/the_gnat_library id88}@anchor{378}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{379}
24256 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24259 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24261 @geindex Random number generation
24263 The original implementation of @code{Ada.Numerics.Discrete_Random}.  Uses
24264 a modified version of the Blum-Blum-Shub generator.
24266 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24267 @anchor{gnat_rm/the_gnat_library id89}@anchor{37a}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{37b}
24268 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24271 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24273 @geindex Random number generation
24275 The original implementation of @code{Ada.Numerics.Float_Random}.  Uses
24276 a modified version of the Blum-Blum-Shub generator.
24278 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24279 @anchor{gnat_rm/the_gnat_library id90}@anchor{37c}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{37d}
24280 @section @code{GNAT.MD5} (@code{g-md5.ads})
24283 @geindex GNAT.MD5 (g-md5.ads)
24285 @geindex Message Digest MD5
24287 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24288 the HMAC-MD5 message authentication function as described in RFC 2104 and
24289 FIPS PUB 198.
24291 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24292 @anchor{gnat_rm/the_gnat_library id91}@anchor{37e}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{37f}
24293 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24296 @geindex GNAT.Memory_Dump (g-memdum.ads)
24298 @geindex Dump Memory
24300 Provides a convenient routine for dumping raw memory to either the
24301 standard output or standard error files. Uses GNAT.IO for actual
24302 output.
24304 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24305 @anchor{gnat_rm/the_gnat_library id92}@anchor{380}@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{381}
24306 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24309 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24311 @geindex Exception
24312 @geindex obtaining most recent
24314 Provides access to the most recently raised exception.  Can be used for
24315 various logging purposes, including duplicating functionality of some
24316 Ada 83 implementation dependent extensions.
24318 @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
24319 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{382}@anchor{gnat_rm/the_gnat_library id93}@anchor{383}
24320 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24323 @geindex GNAT.OS_Lib (g-os_lib.ads)
24325 @geindex Operating System interface
24327 @geindex Spawn capability
24329 Provides a range of target independent operating system interface functions,
24330 including time/date management, file operations, subprocess management,
24331 including a portable spawn procedure, and access to environment variables
24332 and error return codes.
24334 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24335 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{384}@anchor{gnat_rm/the_gnat_library id94}@anchor{385}
24336 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24339 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24341 @geindex Hash functions
24343 Provides a generator of static minimal perfect hash functions. No
24344 collisions occur and each item can be retrieved from the table in one
24345 probe (perfect property). The hash table size corresponds to the exact
24346 size of the key set and no larger (minimal property). The key set has to
24347 be know in advance (static property). The hash functions are also order
24348 preserving. If w2 is inserted after w1 in the generator, their
24349 hashcode are in the same order. These hashing functions are very
24350 convenient for use with realtime applications.
24352 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24353 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{386}@anchor{gnat_rm/the_gnat_library id95}@anchor{387}
24354 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24357 @geindex GNAT.Random_Numbers (g-rannum.ads)
24359 @geindex Random number generation
24361 Provides random number capabilities which extend those available in the
24362 standard Ada library and are more convenient to use.
24364 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24365 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{251}@anchor{gnat_rm/the_gnat_library id96}@anchor{388}
24366 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24369 @geindex GNAT.Regexp (g-regexp.ads)
24371 @geindex Regular expressions
24373 @geindex Pattern matching
24375 A simple implementation of regular expressions, using a subset of regular
24376 expression syntax copied from familiar Unix style utilities.  This is the
24377 simplest of the three pattern matching packages provided, and is particularly
24378 suitable for 'file globbing' applications.
24380 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24381 @anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id97}@anchor{38a}
24382 @section @code{GNAT.Registry} (@code{g-regist.ads})
24385 @geindex GNAT.Registry (g-regist.ads)
24387 @geindex Windows Registry
24389 This is a high level binding to the Windows registry.  It is possible to
24390 do simple things like reading a key value, creating a new key.  For full
24391 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24392 package provided with the Win32Ada binding
24394 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24395 @anchor{gnat_rm/the_gnat_library id98}@anchor{38b}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{38c}
24396 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24399 @geindex GNAT.Regpat (g-regpat.ads)
24401 @geindex Regular expressions
24403 @geindex Pattern matching
24405 A complete implementation of Unix-style regular expression matching, copied
24406 from the original V7 style regular expression library written in C by
24407 Henry Spencer (and binary compatible with this C library).
24409 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24410 @anchor{gnat_rm/the_gnat_library id99}@anchor{38d}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{38e}
24411 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24414 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24416 @geindex Rewrite data
24418 A unit to rewrite on-the-fly string occurrences in a stream of
24419 data. The implementation has a very minimal memory footprint as the
24420 full content to be processed is not loaded into memory all at once. This makes
24421 this interface usable for large files or socket streams.
24423 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24424 @anchor{gnat_rm/the_gnat_library id100}@anchor{38f}@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{390}
24425 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24428 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24430 @geindex Secondary Stack Info
24432 Provide the capability to query the high water mark of the current task's
24433 secondary stack.
24435 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24436 @anchor{gnat_rm/the_gnat_library id101}@anchor{391}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{392}
24437 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24440 @geindex GNAT.Semaphores (g-semaph.ads)
24442 @geindex Semaphores
24444 Provides classic counting and binary semaphores using protected types.
24446 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24447 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{393}@anchor{gnat_rm/the_gnat_library id102}@anchor{394}
24448 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24451 @geindex GNAT.Serial_Communications (g-sercom.ads)
24453 @geindex Serial_Communications
24455 Provides a simple interface to send and receive data over a serial
24456 port. This is only supported on GNU/Linux and Windows.
24458 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24459 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{395}@anchor{gnat_rm/the_gnat_library id103}@anchor{396}
24460 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24463 @geindex GNAT.SHA1 (g-sha1.ads)
24465 @geindex Secure Hash Algorithm SHA-1
24467 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24468 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24469 in RFC 2104 and FIPS PUB 198.
24471 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24472 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{397}@anchor{gnat_rm/the_gnat_library id104}@anchor{398}
24473 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24476 @geindex GNAT.SHA224 (g-sha224.ads)
24478 @geindex Secure Hash Algorithm SHA-224
24480 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24481 and the HMAC-SHA224 message authentication function as described
24482 in RFC 2104 and FIPS PUB 198.
24484 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24485 @anchor{gnat_rm/the_gnat_library id105}@anchor{399}@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{39a}
24486 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24489 @geindex GNAT.SHA256 (g-sha256.ads)
24491 @geindex Secure Hash Algorithm SHA-256
24493 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24494 and the HMAC-SHA256 message authentication function as described
24495 in RFC 2104 and FIPS PUB 198.
24497 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24498 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{39b}@anchor{gnat_rm/the_gnat_library id106}@anchor{39c}
24499 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24502 @geindex GNAT.SHA384 (g-sha384.ads)
24504 @geindex Secure Hash Algorithm SHA-384
24506 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24507 and the HMAC-SHA384 message authentication function as described
24508 in RFC 2104 and FIPS PUB 198.
24510 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24511 @anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id107}@anchor{39e}
24512 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24515 @geindex GNAT.SHA512 (g-sha512.ads)
24517 @geindex Secure Hash Algorithm SHA-512
24519 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24520 and the HMAC-SHA512 message authentication function as described
24521 in RFC 2104 and FIPS PUB 198.
24523 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24524 @anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id108}@anchor{3a0}
24525 @section @code{GNAT.Signals} (@code{g-signal.ads})
24528 @geindex GNAT.Signals (g-signal.ads)
24530 @geindex Signals
24532 Provides the ability to manipulate the blocked status of signals on supported
24533 targets.
24535 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24536 @anchor{gnat_rm/the_gnat_library id109}@anchor{3a1}@anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3a2}
24537 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24540 @geindex GNAT.Sockets (g-socket.ads)
24542 @geindex Sockets
24544 A high level and portable interface to develop sockets based applications.
24545 This package is based on the sockets thin binding found in
24546 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24547 on all native GNAT ports and on VxWorks cross prots.  It is not implemented for
24548 the LynxOS cross port.
24550 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24551 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3a3}@anchor{gnat_rm/the_gnat_library id110}@anchor{3a4}
24552 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24555 @geindex GNAT.Source_Info (g-souinf.ads)
24557 @geindex Source Information
24559 Provides subprograms that give access to source code information known at
24560 compile time, such as the current file name and line number. Also provides
24561 subprograms yielding the date and time of the current compilation (like the
24562 C macros @code{__DATE__} and @code{__TIME__})
24564 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24565 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3a5}@anchor{gnat_rm/the_gnat_library id111}@anchor{3a6}
24566 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24569 @geindex GNAT.Spelling_Checker (g-speche.ads)
24571 @geindex Spell checking
24573 Provides a function for determining whether one string is a plausible
24574 near misspelling of another string.
24576 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24577 @anchor{gnat_rm/the_gnat_library id112}@anchor{3a7}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3a8}
24578 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24581 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24583 @geindex Spell checking
24585 Provides a generic function that can be instantiated with a string type for
24586 determining whether one string is a plausible near misspelling of another
24587 string.
24589 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24590 @anchor{gnat_rm/the_gnat_library id113}@anchor{3a9}@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3aa}
24591 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24594 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24596 @geindex SPITBOL pattern matching
24598 @geindex Pattern matching
24600 A complete implementation of SNOBOL4 style pattern matching.  This is the
24601 most elaborate of the pattern matching packages provided.  It fully duplicates
24602 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24603 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24605 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24606 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3ab}@anchor{gnat_rm/the_gnat_library id114}@anchor{3ac}
24607 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24610 @geindex GNAT.Spitbol (g-spitbo.ads)
24612 @geindex SPITBOL interface
24614 The top level package of the collection of SPITBOL-style functionality, this
24615 package provides basic SNOBOL4 string manipulation functions, such as
24616 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24617 useful for constructing arbitrary mappings from strings in the style of
24618 the SNOBOL4 TABLE function.
24620 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24621 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id115}@anchor{3ae}
24622 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24625 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24627 @geindex Sets of strings
24629 @geindex SPITBOL Tables
24631 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24632 for type @code{Standard.Boolean}, giving an implementation of sets of
24633 string values.
24635 @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
24636 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3af}@anchor{gnat_rm/the_gnat_library id116}@anchor{3b0}
24637 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24640 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24642 @geindex Integer maps
24644 @geindex Maps
24646 @geindex SPITBOL Tables
24648 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24649 for type @code{Standard.Integer}, giving an implementation of maps
24650 from string to integer values.
24652 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24653 @anchor{gnat_rm/the_gnat_library id117}@anchor{3b1}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3b2}
24654 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24657 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24659 @geindex String maps
24661 @geindex Maps
24663 @geindex SPITBOL Tables
24665 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24666 a variable length string type, giving an implementation of general
24667 maps from strings to strings.
24669 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24670 @anchor{gnat_rm/the_gnat_library id118}@anchor{3b3}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3b4}
24671 @section @code{GNAT.SSE} (@code{g-sse.ads})
24674 @geindex GNAT.SSE (g-sse.ads)
24676 Root of a set of units aimed at offering Ada bindings to a subset of
24677 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24678 targets.  It exposes vector component types together with a general
24679 introduction to the binding contents and use.
24681 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24682 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id119}@anchor{3b6}
24683 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
24686 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
24688 SSE vector types for use with SSE related intrinsics.
24690 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
24691 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3b7}@anchor{gnat_rm/the_gnat_library id120}@anchor{3b8}
24692 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
24695 @geindex GNAT.String_Hash (g-strhas.ads)
24697 @geindex Hash functions
24699 Provides a generic hash function working on arrays of scalars. Both the scalar
24700 type and the hash result type are parameters.
24702 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
24703 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3b9}@anchor{gnat_rm/the_gnat_library id121}@anchor{3ba}
24704 @section @code{GNAT.Strings} (@code{g-string.ads})
24707 @geindex GNAT.Strings (g-string.ads)
24709 Common String access types and related subprograms. Basically it
24710 defines a string access and an array of string access types.
24712 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
24713 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3bb}@anchor{gnat_rm/the_gnat_library id122}@anchor{3bc}
24714 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
24717 @geindex GNAT.String_Split (g-strspl.ads)
24719 @geindex String splitter
24721 Useful string manipulation routines: given a set of separators, split
24722 a string wherever the separators appear, and provide direct access
24723 to the resulting slices. This package is instantiated from
24724 @code{GNAT.Array_Split}.
24726 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
24727 @anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3bd}@anchor{gnat_rm/the_gnat_library id123}@anchor{3be}
24728 @section @code{GNAT.Table} (@code{g-table.ads})
24731 @geindex GNAT.Table (g-table.ads)
24733 @geindex Table implementation
24735 @geindex Arrays
24736 @geindex extendable
24738 A generic package providing a single dimension array abstraction where the
24739 length of the array can be dynamically modified.
24741 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
24742 except that this package declares a single instance of the table type,
24743 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
24744 used to define dynamic instances of the table.
24746 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
24747 @anchor{gnat_rm/the_gnat_library id124}@anchor{3bf}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c0}
24748 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
24751 @geindex GNAT.Task_Lock (g-tasloc.ads)
24753 @geindex Task synchronization
24755 @geindex Task locking
24757 @geindex Locking
24759 A very simple facility for locking and unlocking sections of code using a
24760 single global task lock.  Appropriate for use in situations where contention
24761 between tasks is very rarely expected.
24763 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
24764 @anchor{gnat_rm/the_gnat_library id125}@anchor{3c1}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3c2}
24765 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
24768 @geindex GNAT.Time_Stamp (g-timsta.ads)
24770 @geindex Time stamp
24772 @geindex Current time
24774 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
24775 represents the current date and time in ISO 8601 format. This is a very simple
24776 routine with minimal code and there are no dependencies on any other unit.
24778 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
24779 @anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3c3}@anchor{gnat_rm/the_gnat_library id126}@anchor{3c4}
24780 @section @code{GNAT.Threads} (@code{g-thread.ads})
24783 @geindex GNAT.Threads (g-thread.ads)
24785 @geindex Foreign threads
24787 @geindex Threads
24788 @geindex foreign
24790 Provides facilities for dealing with foreign threads which need to be known
24791 by the GNAT run-time system. Consult the documentation of this package for
24792 further details if your program has threads that are created by a non-Ada
24793 environment which then accesses Ada code.
24795 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
24796 @anchor{gnat_rm/the_gnat_library id127}@anchor{3c5}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3c6}
24797 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
24800 @geindex GNAT.Traceback (g-traceb.ads)
24802 @geindex Trace back facilities
24804 Provides a facility for obtaining non-symbolic traceback information, useful
24805 in various debugging situations.
24807 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
24808 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3c7}@anchor{gnat_rm/the_gnat_library id128}@anchor{3c8}
24809 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
24812 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
24814 @geindex Trace back facilities
24816 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
24817 @anchor{gnat_rm/the_gnat_library id129}@anchor{3c9}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3ca}
24818 @section @code{GNAT.UTF_32} (@code{g-table.ads})
24821 @geindex GNAT.UTF_32 (g-table.ads)
24823 @geindex Wide character codes
24825 This is a package intended to be used in conjunction with the
24826 @code{Wide_Character} type in Ada 95 and the
24827 @code{Wide_Wide_Character} type in Ada 2005 (available
24828 in @code{GNAT} in Ada 2005 mode). This package contains
24829 Unicode categorization routines, as well as lexical
24830 categorization routines corresponding to the Ada 2005
24831 lexical rules for identifiers and strings, and also a
24832 lower case to upper case fold routine corresponding to
24833 the Ada 2005 rules for identifier equivalence.
24835 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
24836 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3cb}@anchor{gnat_rm/the_gnat_library id130}@anchor{3cc}
24837 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
24840 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
24842 @geindex Spell checking
24844 Provides a function for determining whether one wide wide string is a plausible
24845 near misspelling of another wide wide string, where the strings are represented
24846 using the UTF_32_String type defined in System.Wch_Cnv.
24848 @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
24849 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3cd}@anchor{gnat_rm/the_gnat_library id131}@anchor{3ce}
24850 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
24853 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
24855 @geindex Spell checking
24857 Provides a function for determining whether one wide string is a plausible
24858 near misspelling of another wide string.
24860 @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
24861 @anchor{gnat_rm/the_gnat_library id132}@anchor{3cf}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d0}
24862 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
24865 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
24867 @geindex Wide_String splitter
24869 Useful wide string manipulation routines: given a set of separators, split
24870 a wide string wherever the separators appear, and provide direct access
24871 to the resulting slices. This package is instantiated from
24872 @code{GNAT.Array_Split}.
24874 @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
24875 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id133}@anchor{3d2}
24876 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
24879 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
24881 @geindex Spell checking
24883 Provides a function for determining whether one wide wide string is a plausible
24884 near misspelling of another wide wide string.
24886 @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
24887 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3d3}@anchor{gnat_rm/the_gnat_library id134}@anchor{3d4}
24888 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
24891 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
24893 @geindex Wide_Wide_String splitter
24895 Useful wide wide string manipulation routines: given a set of separators, split
24896 a wide wide string wherever the separators appear, and provide direct access
24897 to the resulting slices. This package is instantiated from
24898 @code{GNAT.Array_Split}.
24900 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
24901 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3d5}@anchor{gnat_rm/the_gnat_library id135}@anchor{3d6}
24902 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
24905 @geindex Interfaces.C.Extensions (i-cexten.ads)
24907 This package contains additional C-related definitions, intended
24908 for use with either manually or automatically generated bindings
24909 to C libraries.
24911 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
24912 @anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3d7}@anchor{gnat_rm/the_gnat_library id136}@anchor{3d8}
24913 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
24916 @geindex Interfaces.C.Streams (i-cstrea.ads)
24918 @geindex C streams
24919 @geindex interfacing
24921 This package is a binding for the most commonly used operations
24922 on C streams.
24924 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
24925 @anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3d9}@anchor{gnat_rm/the_gnat_library id137}@anchor{3da}
24926 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
24929 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
24931 @geindex IBM Packed Format
24933 @geindex Packed Decimal
24935 This package provides a set of routines for conversions to and
24936 from a packed decimal format compatible with that used on IBM
24937 mainframes.
24939 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
24940 @anchor{gnat_rm/the_gnat_library id138}@anchor{3db}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3dc}
24941 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
24944 @geindex Interfaces.VxWorks (i-vxwork.ads)
24946 @geindex Interfacing to VxWorks
24948 @geindex VxWorks
24949 @geindex interfacing
24951 This package provides a limited binding to the VxWorks API.
24952 In particular, it interfaces with the
24953 VxWorks hardware interrupt facilities.
24955 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
24956 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3dd}@anchor{gnat_rm/the_gnat_library id139}@anchor{3de}
24957 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
24960 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
24962 @geindex Interfacing to VxWorks
24964 @geindex VxWorks
24965 @geindex interfacing
24967 This package provides a way for users to replace the use of
24968 intConnect() with a custom routine for installing interrupt
24969 handlers.
24971 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
24972 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3df}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e0}
24973 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
24976 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
24978 @geindex Interfacing to VxWorks' I/O
24980 @geindex VxWorks
24981 @geindex I/O interfacing
24983 @geindex VxWorks
24984 @geindex Get_Immediate
24986 @geindex Get_Immediate
24987 @geindex VxWorks
24989 This package provides a binding to the ioctl (IO/Control)
24990 function of VxWorks, defining a set of option values and
24991 function codes. A particular use of this package is
24992 to enable the use of Get_Immediate under VxWorks.
24994 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
24995 @anchor{gnat_rm/the_gnat_library id141}@anchor{3e1}@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3e2}
24996 @section @code{System.Address_Image} (@code{s-addima.ads})
24999 @geindex System.Address_Image (s-addima.ads)
25001 @geindex Address image
25003 @geindex Image
25004 @geindex of an address
25006 This function provides a useful debugging
25007 function that gives an (implementation dependent)
25008 string which identifies an address.
25010 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25011 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3e3}@anchor{gnat_rm/the_gnat_library id142}@anchor{3e4}
25012 @section @code{System.Assertions} (@code{s-assert.ads})
25015 @geindex System.Assertions (s-assert.ads)
25017 @geindex Assertions
25019 @geindex Assert_Failure
25020 @geindex exception
25022 This package provides the declaration of the exception raised
25023 by an run-time assertion failure, as well as the routine that
25024 is used internally to raise this assertion.
25026 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25027 @anchor{gnat_rm/the_gnat_library id143}@anchor{3e5}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3e6}
25028 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25031 @geindex System.Atomic_Counters (s-atocou.ads)
25033 This package provides the declaration of an atomic counter type,
25034 together with efficient routines (using hardware
25035 synchronization primitives) for incrementing, decrementing,
25036 and testing of these counters. This package is implemented
25037 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
25038 x86, and x86_64 platforms.
25040 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25041 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3e7}@anchor{gnat_rm/the_gnat_library id144}@anchor{3e8}
25042 @section @code{System.Memory} (@code{s-memory.ads})
25045 @geindex System.Memory (s-memory.ads)
25047 @geindex Memory allocation
25049 This package provides the interface to the low level routines used
25050 by the generated code for allocation and freeing storage for the
25051 default storage pool (analogous to the C routines malloc and free.
25052 It also provides a reallocation interface analogous to the C routine
25053 realloc. The body of this unit may be modified to provide alternative
25054 allocation mechanisms for the default pool, and in addition, direct
25055 calls to this unit may be made for low level allocation uses (for
25056 example see the body of @code{GNAT.Tables}).
25058 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25059 @anchor{gnat_rm/the_gnat_library id145}@anchor{3e9}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3ea}
25060 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25063 @geindex System.Multiprocessors (s-multip.ads)
25065 @geindex Multiprocessor interface
25067 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25068 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25069 technically an implementation-defined addition).
25071 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25072 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3eb}@anchor{gnat_rm/the_gnat_library id146}@anchor{3ec}
25073 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25076 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25078 @geindex Multiprocessor interface
25080 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25081 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25082 technically an implementation-defined addition).
25084 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25085 @anchor{gnat_rm/the_gnat_library id147}@anchor{3ed}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3ee}
25086 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25089 @geindex System.Partition_Interface (s-parint.ads)
25091 @geindex Partition interfacing functions
25093 This package provides facilities for partition interfacing.  It
25094 is used primarily in a distribution context when using Annex E
25095 with @code{GLADE}.
25097 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25098 @anchor{gnat_rm/the_gnat_library id148}@anchor{3ef}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f0}
25099 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25102 @geindex System.Pool_Global (s-pooglo.ads)
25104 @geindex Storage pool
25105 @geindex global
25107 @geindex Global storage pool
25109 This package provides a storage pool that is equivalent to the default
25110 storage pool used for access types for which no pool is specifically
25111 declared. It uses malloc/free to allocate/free and does not attempt to
25112 do any automatic reclamation.
25114 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25115 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3f1}@anchor{gnat_rm/the_gnat_library id149}@anchor{3f2}
25116 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25119 @geindex System.Pool_Local (s-pooloc.ads)
25121 @geindex Storage pool
25122 @geindex local
25124 @geindex Local storage pool
25126 This package provides a storage pool that is intended for use with locally
25127 defined access types. It uses malloc/free for allocate/free, and maintains
25128 a list of allocated blocks, so that all storage allocated for the pool can
25129 be freed automatically when the pool is finalized.
25131 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25132 @anchor{gnat_rm/the_gnat_library id150}@anchor{3f3}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3f4}
25133 @section @code{System.Restrictions} (@code{s-restri.ads})
25136 @geindex System.Restrictions (s-restri.ads)
25138 @geindex Run-time restrictions access
25140 This package provides facilities for accessing at run time
25141 the status of restrictions specified at compile time for
25142 the partition. Information is available both with regard
25143 to actual restrictions specified, and with regard to
25144 compiler determined information on which restrictions
25145 are violated by one or more packages in the partition.
25147 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25148 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3f5}@anchor{gnat_rm/the_gnat_library id151}@anchor{3f6}
25149 @section @code{System.Rident} (@code{s-rident.ads})
25152 @geindex System.Rident (s-rident.ads)
25154 @geindex Restrictions definitions
25156 This package provides definitions of the restrictions
25157 identifiers supported by GNAT, and also the format of
25158 the restrictions provided in package System.Restrictions.
25159 It is not normally necessary to @code{with} this generic package
25160 since the necessary instantiation is included in
25161 package System.Restrictions.
25163 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25164 @anchor{gnat_rm/the_gnat_library id152}@anchor{3f7}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3f8}
25165 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25168 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25170 @geindex Stream operations
25172 @geindex String stream operations
25174 This package provides a set of stream subprograms for standard string types.
25175 It is intended primarily to support implicit use of such subprograms when
25176 stream attributes are applied to string types, but the subprograms in this
25177 package can be used directly by application programs.
25179 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25180 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3f9}@anchor{gnat_rm/the_gnat_library id153}@anchor{3fa}
25181 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25184 @geindex System.Unsigned_Types (s-unstyp.ads)
25186 This package contains definitions of standard unsigned types that
25187 correspond in size to the standard signed types declared in Standard,
25188 and (unlike the types in Interfaces) have corresponding names. It
25189 also contains some related definitions for other specialized types
25190 used by the compiler in connection with packed array types.
25192 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25193 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{3fb}@anchor{gnat_rm/the_gnat_library id154}@anchor{3fc}
25194 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25197 @geindex System.Wch_Cnv (s-wchcnv.ads)
25199 @geindex Wide Character
25200 @geindex Representation
25202 @geindex Wide String
25203 @geindex Conversion
25205 @geindex Representation of wide characters
25207 This package provides routines for converting between
25208 wide and wide wide characters and a representation as a value of type
25209 @code{Standard.String}, using a specified wide character
25210 encoding method.  It uses definitions in
25211 package @code{System.Wch_Con}.
25213 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25214 @anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{3fd}@anchor{gnat_rm/the_gnat_library id155}@anchor{3fe}
25215 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25218 @geindex System.Wch_Con (s-wchcon.ads)
25220 This package provides definitions and descriptions of
25221 the various methods used for encoding wide characters
25222 in ordinary strings.  These definitions are used by
25223 the package @code{System.Wch_Cnv}.
25225 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25226 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{3ff}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{400}
25227 @chapter Interfacing to Other Languages
25230 The facilities in Annex B of the Ada Reference Manual are fully
25231 implemented in GNAT, and in addition, a full interface to C++ is
25232 provided.
25234 @menu
25235 * Interfacing to C:: 
25236 * Interfacing to C++:: 
25237 * Interfacing to COBOL:: 
25238 * Interfacing to Fortran:: 
25239 * Interfacing to non-GNAT Ada code:: 
25241 @end menu
25243 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25244 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{401}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{402}
25245 @section Interfacing to C
25248 Interfacing to C with GNAT can use one of two approaches:
25251 @itemize *
25253 @item 
25254 The types in the package @code{Interfaces.C} may be used.
25256 @item 
25257 Standard Ada types may be used directly.  This may be less portable to
25258 other compilers, but will work on all GNAT compilers, which guarantee
25259 correspondence between the C and Ada types.
25260 @end itemize
25262 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25263 effect, since this is the default.  The following table shows the
25264 correspondence between Ada scalar types and the corresponding C types.
25267 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 
25268 @headitem
25270 Ada Type
25272 @tab
25274 C Type
25276 @item
25278 @code{Integer}
25280 @tab
25282 @code{int}
25284 @item
25286 @code{Short_Integer}
25288 @tab
25290 @code{short}
25292 @item
25294 @code{Short_Short_Integer}
25296 @tab
25298 @code{signed char}
25300 @item
25302 @code{Long_Integer}
25304 @tab
25306 @code{long}
25308 @item
25310 @code{Long_Long_Integer}
25312 @tab
25314 @code{long long}
25316 @item
25318 @code{Short_Float}
25320 @tab
25322 @code{float}
25324 @item
25326 @code{Float}
25328 @tab
25330 @code{float}
25332 @item
25334 @code{Long_Float}
25336 @tab
25338 @code{double}
25340 @item
25342 @code{Long_Long_Float}
25344 @tab
25346 This is the longest floating-point type supported by the hardware.
25348 @end multitable
25351 Additionally, there are the following general correspondences between Ada
25352 and C types:
25355 @itemize *
25357 @item 
25358 Ada enumeration types map to C enumeration types directly if pragma
25359 @code{Convention C} is specified, which causes them to have int
25360 length.  Without pragma @code{Convention C}, Ada enumeration types map to
25361 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25362 @code{int}, respectively) depending on the number of values passed.
25363 This is the only case in which pragma @code{Convention C} affects the
25364 representation of an Ada type.
25366 @item 
25367 Ada access types map to C pointers, except for the case of pointers to
25368 unconstrained types in Ada, which have no direct C equivalent.
25370 @item 
25371 Ada arrays map directly to C arrays.
25373 @item 
25374 Ada records map directly to C structures.
25376 @item 
25377 Packed Ada records map to C structures where all members are bit fields
25378 of the length corresponding to the @code{type'Size} value in Ada.
25379 @end itemize
25381 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25382 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{403}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{45}
25383 @section Interfacing to C++
25386 The interface to C++ makes use of the following pragmas, which are
25387 primarily intended to be constructed automatically using a binding generator
25388 tool, although it is possible to construct them by hand.
25390 Using these pragmas it is possible to achieve complete
25391 inter-operability between Ada tagged types and C++ class definitions.
25392 See @ref{7,,Implementation Defined Pragmas}, for more details.
25395 @table @asis
25397 @item @code{pragma CPP_Class ([Entity =>] @emph{LOCAL_NAME})}
25399 The argument denotes an entity in the current declarative region that is
25400 declared as a tagged or untagged record type. It indicates that the type
25401 corresponds to an externally declared C++ class type, and is to be laid
25402 out the same way that C++ would lay out the type.
25404 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25405 for backward compatibility but its functionality is available
25406 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25408 @item @code{pragma CPP_Constructor ([Entity =>] @emph{LOCAL_NAME})}
25410 This pragma identifies an imported function (imported in the usual way
25411 with pragma @code{Import}) as corresponding to a C++ constructor.
25412 @end table
25414 A few restrictions are placed on the use of the @code{Access} attribute
25415 in conjunction with subprograms subject to convention @code{CPP}: the
25416 attribute may be used neither on primitive operations of a tagged
25417 record type with convention @code{CPP}, imported or not, nor on
25418 subprograms imported with pragma @code{CPP_Constructor}.
25420 In addition, C++ exceptions are propagated and can be handled in an
25421 @code{others} choice of an exception handler. The corresponding Ada
25422 occurrence has no message, and the simple name of the exception identity
25423 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25424 tasks works properly when such foreign exceptions are propagated.
25426 It is also possible to import a C++ exception using the following syntax:
25428 @example
25429 LOCAL_NAME : exception;
25430 pragma Import (Cpp,
25431   [Entity =>] LOCAL_NAME,
25432   [External_Name =>] static_string_EXPRESSION);
25433 @end example
25435 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25436 cover a specific C++ exception in an exception handler.
25438 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25439 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{404}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{405}
25440 @section Interfacing to COBOL
25443 Interfacing to COBOL is achieved as described in section B.4 of
25444 the Ada Reference Manual.
25446 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25447 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{406}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{407}
25448 @section Interfacing to Fortran
25451 Interfacing to Fortran is achieved as described in section B.5 of the
25452 Ada Reference Manual.  The pragma @code{Convention Fortran}, applied to a
25453 multi-dimensional array causes the array to be stored in column-major
25454 order as required for convenient interface to Fortran.
25456 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25457 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{408}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{409}
25458 @section Interfacing to non-GNAT Ada code
25461 It is possible to specify the convention @code{Ada} in a pragma
25462 @code{Import} or pragma @code{Export}.  However this refers to
25463 the calling conventions used by GNAT, which may or may not be
25464 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25465 compiler to allow interoperation.
25467 If arguments types are kept simple, and if the foreign compiler generally
25468 follows system calling conventions, then it may be possible to integrate
25469 files compiled by other Ada compilers, provided that the elaboration
25470 issues are adequately addressed (for example by eliminating the
25471 need for any load time elaboration).
25473 In particular, GNAT running on VMS is designed to
25474 be highly compatible with the DEC Ada 83 compiler, so this is one
25475 case in which it is possible to import foreign units of this type,
25476 provided that the data items passed are restricted to simple scalar
25477 values or simple record types without variants, or simple array
25478 types with fixed bounds.
25480 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25481 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{40a}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{40b}
25482 @chapter Specialized Needs Annexes
25485 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25486 required in all implementations.  However, as described in this chapter,
25487 GNAT implements all of these annexes:
25490 @table @asis
25492 @item @emph{Systems Programming (Annex C)}
25494 The Systems Programming Annex is fully implemented.
25496 @item @emph{Real-Time Systems (Annex D)}
25498 The Real-Time Systems Annex is fully implemented.
25500 @item @emph{Distributed Systems (Annex E)}
25502 Stub generation is fully implemented in the GNAT compiler.  In addition,
25503 a complete compatible PCS is available as part of the GLADE system,
25504 a separate product.  When the two
25505 products are used in conjunction, this annex is fully implemented.
25507 @item @emph{Information Systems (Annex F)}
25509 The Information Systems annex is fully implemented.
25511 @item @emph{Numerics (Annex G)}
25513 The Numerics Annex is fully implemented.
25515 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25517 The Safety and Security Annex (termed the High-Integrity Systems Annex
25518 in Ada 2005) is fully implemented.
25519 @end table
25521 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25522 @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{40c}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{40d}
25523 @chapter Implementation of Specific Ada Features
25526 This chapter describes the GNAT implementation of several Ada language
25527 facilities.
25529 @menu
25530 * Machine Code Insertions:: 
25531 * GNAT Implementation of Tasking:: 
25532 * GNAT Implementation of Shared Passive Packages:: 
25533 * Code Generation for Array Aggregates:: 
25534 * The Size of Discriminated Records with Default Discriminants:: 
25535 * Strict Conformance to the Ada Reference Manual:: 
25537 @end menu
25539 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25540 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{164}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{40e}
25541 @section Machine Code Insertions
25544 @geindex Machine Code insertions
25546 Package @code{Machine_Code} provides machine code support as described
25547 in the Ada Reference Manual in two separate forms:
25550 @itemize *
25552 @item 
25553 Machine code statements, consisting of qualified expressions that
25554 fit the requirements of RM section 13.8.
25556 @item 
25557 An intrinsic callable procedure, providing an alternative mechanism of
25558 including machine instructions in a subprogram.
25559 @end itemize
25561 The two features are similar, and both are closely related to the mechanism
25562 provided by the asm instruction in the GNU C compiler.  Full understanding
25563 and use of the facilities in this package requires understanding the asm
25564 instruction, see the section on Extended Asm in
25565 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25567 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25568 semantic restrictions and effects as described below.  Both are provided so
25569 that the procedure call can be used as a statement, and the function call
25570 can be used to form a code_statement.
25572 Consider this C @code{asm} instruction:
25574 @example
25575 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25576 @end example
25578 The equivalent can be written for GNAT as:
25580 @example
25581 Asm ("fsinx %1 %0",
25582      My_Float'Asm_Output ("=f", result),
25583      My_Float'Asm_Input  ("f",  angle));
25584 @end example
25586 The first argument to @code{Asm} is the assembler template, and is
25587 identical to what is used in GNU C.  This string must be a static
25588 expression.  The second argument is the output operand list.  It is
25589 either a single @code{Asm_Output} attribute reference, or a list of such
25590 references enclosed in parentheses (technically an array aggregate of
25591 such references).
25593 The @code{Asm_Output} attribute denotes a function that takes two
25594 parameters.  The first is a string, the second is the name of a variable
25595 of the type designated by the attribute prefix.  The first (string)
25596 argument is required to be a static expression and designates the
25597 constraint (see the section on Constraints in
25598 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25599 for the parameter; e.g., what kind of register is required.  The second
25600 argument is the variable to be written or updated with the
25601 result.  The possible values for constraint are the same as those used in
25602 the RTL, and are dependent on the configuration file used to build the
25603 GCC back end.  If there are no output operands, then this argument may
25604 either be omitted, or explicitly given as @code{No_Output_Operands}.
25605 No support is provided for GNU C's symbolic names for output parameters.
25607 The second argument of @code{my_float'Asm_Output} functions as
25608 though it were an @code{out} parameter, which is a little curious, but
25609 all names have the form of expressions, so there is no syntactic
25610 irregularity, even though normally functions would not be permitted
25611 @code{out} parameters.  The third argument is the list of input
25612 operands.  It is either a single @code{Asm_Input} attribute reference, or
25613 a list of such references enclosed in parentheses (technically an array
25614 aggregate of such references).
25616 The @code{Asm_Input} attribute denotes a function that takes two
25617 parameters.  The first is a string, the second is an expression of the
25618 type designated by the prefix.  The first (string) argument is required
25619 to be a static expression, and is the constraint for the parameter,
25620 (e.g., what kind of register is required).  The second argument is the
25621 value to be used as the input argument.  The possible values for the
25622 constraint are the same as those used in the RTL, and are dependent on
25623 the configuration file used to built the GCC back end.
25624 No support is provided for GNU C's symbolic names for input parameters.
25626 If there are no input operands, this argument may either be omitted, or
25627 explicitly given as @code{No_Input_Operands}.  The fourth argument, not
25628 present in the above example, is a list of register names, called the
25629 @emph{clobber} argument.  This argument, if given, must be a static string
25630 expression, and is a space or comma separated list of names of registers
25631 that must be considered destroyed as a result of the @code{Asm} call.  If
25632 this argument is the null string (the default value), then the code
25633 generator assumes that no additional registers are destroyed.
25634 In addition to registers, the special clobbers @code{memory} and
25635 @code{cc} as described in the GNU C docs are both supported.
25637 The fifth argument, not present in the above example, called the
25638 @emph{volatile} argument, is by default @code{False}.  It can be set to
25639 the literal value @code{True} to indicate to the code generator that all
25640 optimizations with respect to the instruction specified should be
25641 suppressed, and in particular an instruction that has outputs
25642 will still be generated, even if none of the outputs are
25643 used.  See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25644 for the full description.
25645 Generally it is strongly advisable to use Volatile for any ASM statement
25646 that is missing either input or output operands or to avoid unwanted
25647 optimizations. A warning is generated if this advice is not followed.
25649 No support is provided for GNU C's @code{asm goto} feature.
25651 The @code{Asm} subprograms may be used in two ways.  First the procedure
25652 forms can be used anywhere a procedure call would be valid, and
25653 correspond to what the RM calls 'intrinsic' routines.  Such calls can
25654 be used to intersperse machine instructions with other Ada statements.
25655 Second, the function forms, which return a dummy value of the limited
25656 private type @code{Asm_Insn}, can be used in code statements, and indeed
25657 this is the only context where such calls are allowed.  Code statements
25658 appear as aggregates of the form:
25660 @example
25661 Asm_Insn'(Asm (...));
25662 Asm_Insn'(Asm_Volatile (...));
25663 @end example
25665 In accordance with RM rules, such code statements are allowed only
25666 within subprograms whose entire body consists of such statements.  It is
25667 not permissible to intermix such statements with other Ada statements.
25669 Typically the form using intrinsic procedure calls is more convenient
25670 and more flexible.  The code statement form is provided to meet the RM
25671 suggestion that such a facility should be made available.  The following
25672 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25673 is used, the arguments may be given in arbitrary order, following the
25674 normal rules for use of positional and named arguments:
25676 @example
25677 ASM_CALL ::= Asm (
25678                  [Template =>] static_string_EXPRESSION
25679                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
25680                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
25681                [,[Clobber  =>] static_string_EXPRESSION ]
25682                [,[Volatile =>] static_boolean_EXPRESSION] )
25684 OUTPUT_OPERAND_LIST ::=
25685   [PREFIX.]No_Output_Operands
25686 | OUTPUT_OPERAND_ATTRIBUTE
25687 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
25689 OUTPUT_OPERAND_ATTRIBUTE ::=
25690   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
25692 INPUT_OPERAND_LIST ::=
25693   [PREFIX.]No_Input_Operands
25694 | INPUT_OPERAND_ATTRIBUTE
25695 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
25697 INPUT_OPERAND_ATTRIBUTE ::=
25698   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
25699 @end example
25701 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
25702 are declared in the package @code{Machine_Code} and must be referenced
25703 according to normal visibility rules. In particular if there is no
25704 @code{use} clause for this package, then appropriate package name
25705 qualification is required.
25707 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
25708 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{40f}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{410}
25709 @section GNAT Implementation of Tasking
25712 This chapter outlines the basic GNAT approach to tasking (in particular,
25713 a multi-layered library for portability) and discusses issues related
25714 to compliance with the Real-Time Systems Annex.
25716 @menu
25717 * Mapping Ada Tasks onto the Underlying Kernel Threads:: 
25718 * Ensuring Compliance with the Real-Time Annex:: 
25719 * Support for Locking Policies:: 
25721 @end menu
25723 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
25724 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{411}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{412}
25725 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
25728 GNAT's run-time support comprises two layers:
25731 @itemize *
25733 @item 
25734 GNARL (GNAT Run-time Layer)
25736 @item 
25737 GNULL (GNAT Low-level Library)
25738 @end itemize
25740 In GNAT, Ada's tasking services rely on a platform and OS independent
25741 layer known as GNARL.  This code is responsible for implementing the
25742 correct semantics of Ada's task creation, rendezvous, protected
25743 operations etc.
25745 GNARL decomposes Ada's tasking semantics into simpler lower level
25746 operations such as create a thread, set the priority of a thread,
25747 yield, create a lock, lock/unlock, etc.  The spec for these low-level
25748 operations constitutes GNULLI, the GNULL Interface.  This interface is
25749 directly inspired from the POSIX real-time API.
25751 If the underlying executive or OS implements the POSIX standard
25752 faithfully, the GNULL Interface maps as is to the services offered by
25753 the underlying kernel.  Otherwise, some target dependent glue code maps
25754 the services offered by the underlying kernel to the semantics expected
25755 by GNARL.
25757 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
25758 key point is that each Ada task is mapped on a thread in the underlying
25759 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
25761 In addition Ada task priorities map onto the underlying thread priorities.
25762 Mapping Ada tasks onto the underlying kernel threads has several advantages:
25765 @itemize *
25767 @item 
25768 The underlying scheduler is used to schedule the Ada tasks.  This
25769 makes Ada tasks as efficient as kernel threads from a scheduling
25770 standpoint.
25772 @item 
25773 Interaction with code written in C containing threads is eased
25774 since at the lowest level Ada tasks and C threads map onto the same
25775 underlying kernel concept.
25777 @item 
25778 When an Ada task is blocked during I/O the remaining Ada tasks are
25779 able to proceed.
25781 @item 
25782 On multiprocessor systems Ada tasks can execute in parallel.
25783 @end itemize
25785 Some threads libraries offer a mechanism to fork a new process, with the
25786 child process duplicating the threads from the parent.
25787 GNAT does not
25788 support this functionality when the parent contains more than one task.
25790 @geindex Forking a new process
25792 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
25793 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{413}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{414}
25794 @subsection Ensuring Compliance with the Real-Time Annex
25797 @geindex Real-Time Systems Annex compliance
25799 Although mapping Ada tasks onto
25800 the underlying threads has significant advantages, it does create some
25801 complications when it comes to respecting the scheduling semantics
25802 specified in the real-time annex (Annex D).
25804 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
25805 scheduling policy states:
25807 @quotation
25809 @emph{When the active priority of a ready task that is not running
25810 changes, or the setting of its base priority takes effect, the
25811 task is removed from the ready queue for its old active priority
25812 and is added at the tail of the ready queue for its new active
25813 priority, except in the case where the active priority is lowered
25814 due to the loss of inherited priority, in which case the task is
25815 added at the head of the ready queue for its new active priority.}
25816 @end quotation
25818 While most kernels do put tasks at the end of the priority queue when
25819 a task changes its priority, (which respects the main
25820 FIFO_Within_Priorities requirement), almost none keep a thread at the
25821 beginning of its priority queue when its priority drops from the loss
25822 of inherited priority.
25824 As a result most vendors have provided incomplete Annex D implementations.
25826 The GNAT run-time, has a nice cooperative solution to this problem
25827 which ensures that accurate FIFO_Within_Priorities semantics are
25828 respected.
25830 The principle is as follows.  When an Ada task T is about to start
25831 running, it checks whether some other Ada task R with the same
25832 priority as T has been suspended due to the loss of priority
25833 inheritance.  If this is the case, T yields and is placed at the end of
25834 its priority queue.  When R arrives at the front of the queue it
25835 executes.
25837 Note that this simple scheme preserves the relative order of the tasks
25838 that were ready to execute in the priority queue where R has been
25839 placed at the end.
25841 @c Support_for_Locking_Policies
25843 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
25844 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{415}
25845 @subsection Support for Locking Policies
25848 This section specifies which policies specified by pragma Locking_Policy
25849 are supported on which platforms.
25851 GNAT supports the standard @code{Ceiling_Locking} policy, and the
25852 implementation defined @code{Inheritance_Locking} and
25853 @code{Concurrent_Readers_Locking} policies.
25855 @code{Ceiling_Locking} is supported on all platforms if the operating system
25856 supports it. In particular, @code{Ceiling_Locking} is not supported on
25857 VxWorks.
25858 @code{Inheritance_Locking} is supported on
25859 Linux,
25860 Darwin (Mac OS X),
25861 LynxOS 178,
25862 and VxWorks.
25863 @code{Concurrent_Readers_Locking} is supported on Linux.
25865 Notes about @code{Ceiling_Locking} on Linux:
25866 If the process is running as 'root', ceiling locking is used.
25867 If the capabilities facility is installed
25868 ("sudo apt-get --assume-yes install libcap-dev" on Ubuntu,
25869 for example),
25870 and the program is linked against that library
25871 ("-largs -lcap"),
25872 and the executable file has the cap_sys_nice capability
25873 ("sudo /sbin/setcap cap_sys_nice=ep executable_file_name"),
25874 then ceiling locking is used.
25875 Otherwise, the @code{Ceiling_Locking} policy is ignored.
25877 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
25878 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{416}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{417}
25879 @section GNAT Implementation of Shared Passive Packages
25882 @geindex Shared passive packages
25884 GNAT fully implements the 
25885 @geindex pragma Shared_Passive
25886 pragma
25887 @code{Shared_Passive} for
25888 the purpose of designating shared passive packages.
25889 This allows the use of passive partitions in the
25890 context described in the Ada Reference Manual; i.e., for communication
25891 between separate partitions of a distributed application using the
25892 features in Annex E.
25894 @geindex Annex E
25896 @geindex Distribution Systems Annex
25898 However, the implementation approach used by GNAT provides for more
25899 extensive usage as follows:
25902 @table @asis
25904 @item @emph{Communication between separate programs}
25906 This allows separate programs to access the data in passive
25907 partitions, using protected objects for synchronization where
25908 needed. The only requirement is that the two programs have a
25909 common shared file system. It is even possible for programs
25910 running on different machines with different architectures
25911 (e.g., different endianness) to communicate via the data in
25912 a passive partition.
25914 @item @emph{Persistence between program runs}
25916 The data in a passive package can persist from one run of a
25917 program to another, so that a later program sees the final
25918 values stored by a previous run of the same program.
25919 @end table
25921 The implementation approach used is to store the data in files. A
25922 separate stream file is created for each object in the package, and
25923 an access to an object causes the corresponding file to be read or
25924 written.
25926 @geindex SHARED_MEMORY_DIRECTORY environment variable
25928 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
25929 set to the directory to be used for these files.
25930 The files in this directory
25931 have names that correspond to their fully qualified names. For
25932 example, if we have the package
25934 @example
25935 package X is
25936   pragma Shared_Passive (X);
25937   Y : Integer;
25938   Z : Float;
25939 end X;
25940 @end example
25942 and the environment variable is set to @code{/stemp/}, then the files created
25943 will have the names:
25945 @example
25946 /stemp/x.y
25947 /stemp/x.z
25948 @end example
25950 These files are created when a value is initially written to the object, and
25951 the files are retained until manually deleted. This provides the persistence
25952 semantics. If no file exists, it means that no partition has assigned a value
25953 to the variable; in this case the initial value declared in the package
25954 will be used. This model ensures that there are no issues in synchronizing
25955 the elaboration process, since elaboration of passive packages elaborates the
25956 initial values, but does not create the files.
25958 The files are written using normal @code{Stream_IO} access.
25959 If you want to be able
25960 to communicate between programs or partitions running on different
25961 architectures, then you should use the XDR versions of the stream attribute
25962 routines, since these are architecture independent.
25964 If active synchronization is required for access to the variables in the
25965 shared passive package, then as described in the Ada Reference Manual, the
25966 package may contain protected objects used for this purpose. In this case
25967 a lock file (whose name is @code{___lock} (three underscores)
25968 is created in the shared memory directory.
25970 @geindex ___lock file (for shared passive packages)
25972 This is used to provide the required locking
25973 semantics for proper protected object synchronization.
25975 GNAT supports shared passive packages on all platforms
25976 except for OpenVMS.
25978 @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
25979 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{418}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{419}
25980 @section Code Generation for Array Aggregates
25983 Aggregates have a rich syntax and allow the user to specify the values of
25984 complex data structures by means of a single construct.  As a result, the
25985 code generated for aggregates can be quite complex and involve loops, case
25986 statements and multiple assignments.  In the simplest cases, however, the
25987 compiler will recognize aggregates whose components and constraints are
25988 fully static, and in those cases the compiler will generate little or no
25989 executable code.  The following is an outline of the code that GNAT generates
25990 for various aggregate constructs.  For further details, you will find it
25991 useful to examine the output produced by the -gnatG flag to see the expanded
25992 source that is input to the code generator.  You may also want to examine
25993 the assembly code generated at various levels of optimization.
25995 The code generated for aggregates depends on the context, the component values,
25996 and the type.  In the context of an object declaration the code generated is
25997 generally simpler than in the case of an assignment.  As a general rule, static
25998 component values and static subtypes also lead to simpler code.
26000 @menu
26001 * Static constant aggregates with static bounds:: 
26002 * Constant aggregates with unconstrained nominal types:: 
26003 * Aggregates with static bounds:: 
26004 * Aggregates with nonstatic bounds:: 
26005 * Aggregates in assignment statements:: 
26007 @end menu
26009 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26010 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{41a}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{41b}
26011 @subsection Static constant aggregates with static bounds
26014 For the declarations:
26016 @example
26017 type One_Dim is array (1..10) of integer;
26018 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26019 @end example
26021 GNAT generates no executable code: the constant ar0 is placed in static memory.
26022 The same is true for constant aggregates with named associations:
26024 @example
26025 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26026 Cr3 : constant One_Dim := (others => 7777);
26027 @end example
26029 The same is true for multidimensional constant arrays such as:
26031 @example
26032 type two_dim is array (1..3, 1..3) of integer;
26033 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26034 @end example
26036 The same is true for arrays of one-dimensional arrays: the following are
26037 static:
26039 @example
26040 type ar1b  is array (1..3) of boolean;
26041 type ar_ar is array (1..3) of ar1b;
26042 None  : constant ar1b := (others => false);     --  fully static
26043 None2 : constant ar_ar := (1..3 => None);       --  fully static
26044 @end example
26046 However, for multidimensional aggregates with named associations, GNAT will
26047 generate assignments and loops, even if all associations are static.  The
26048 following two declarations generate a loop for the first dimension, and
26049 individual component assignments for the second dimension:
26051 @example
26052 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26053 Zero2: constant two_dim := (others => (others => 0));
26054 @end example
26056 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26057 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{41c}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{41d}
26058 @subsection Constant aggregates with unconstrained nominal types
26061 In such cases the aggregate itself establishes the subtype, so that
26062 associations with @code{others} cannot be used.  GNAT determines the
26063 bounds for the actual subtype of the aggregate, and allocates the
26064 aggregate statically as well.  No code is generated for the following:
26066 @example
26067 type One_Unc is array (natural range <>) of integer;
26068 Cr_Unc : constant One_Unc := (12,24,36);
26069 @end example
26071 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26072 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{41e}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{41f}
26073 @subsection Aggregates with static bounds
26076 In all previous examples the aggregate was the initial (and immutable) value
26077 of a constant.  If the aggregate initializes a variable, then code is generated
26078 for it as a combination of individual assignments and loops over the target
26079 object.  The declarations
26081 @example
26082 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26083 Cr_Var2 : One_Dim := (others > -1);
26084 @end example
26086 generate the equivalent of
26088 @example
26089 Cr_Var1 (1) := 2;
26090 Cr_Var1 (2) := 3;
26091 Cr_Var1 (3) := 5;
26092 Cr_Var1 (4) := 11;
26094 for I in Cr_Var2'range loop
26095    Cr_Var2 (I) := -1;
26096 end loop;
26097 @end example
26099 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26100 @anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{420}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{421}
26101 @subsection Aggregates with nonstatic bounds
26104 If the bounds of the aggregate are not statically compatible with the bounds
26105 of the nominal subtype  of the target, then constraint checks have to be
26106 generated on the bounds.  For a multidimensional array, constraint checks may
26107 have to be applied to sub-arrays individually, if they do not have statically
26108 compatible subtypes.
26110 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26111 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{423}
26112 @subsection Aggregates in assignment statements
26115 In general, aggregate assignment requires the construction of a temporary,
26116 and a copy from the temporary to the target of the assignment.  This is because
26117 it is not always possible to convert the assignment into a series of individual
26118 component assignments.  For example, consider the simple case:
26120 @example
26121 A := (A(2), A(1));
26122 @end example
26124 This cannot be converted into:
26126 @example
26127 A(1) := A(2);
26128 A(2) := A(1);
26129 @end example
26131 So the aggregate has to be built first in a separate location, and then
26132 copied into the target.  GNAT recognizes simple cases where this intermediate
26133 step is not required, and the assignments can be performed in place, directly
26134 into the target.  The following sufficient criteria are applied:
26137 @itemize *
26139 @item 
26140 The bounds of the aggregate are static, and the associations are static.
26142 @item 
26143 The components of the aggregate are static constants, names of
26144 simple variables that are not renamings, or expressions not involving
26145 indexed components whose operands obey these rules.
26146 @end itemize
26148 If any of these conditions are violated, the aggregate will be built in
26149 a temporary (created either by the front-end or the code generator) and then
26150 that temporary will be copied onto the target.
26152 @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
26153 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{425}
26154 @section The Size of Discriminated Records with Default Discriminants
26157 If a discriminated type @code{T} has discriminants with default values, it is
26158 possible to declare an object of this type without providing an explicit
26159 constraint:
26161 @example
26162 type Size is range 1..100;
26164 type Rec (D : Size := 15) is record
26165    Name : String (1..D);
26166 end T;
26168 Word : Rec;
26169 @end example
26171 Such an object is said to be @emph{unconstrained}.
26172 The discriminant of the object
26173 can be modified by a full assignment to the object, as long as it preserves the
26174 relation between the value of the discriminant, and the value of the components
26175 that depend on it:
26177 @example
26178 Word := (3, "yes");
26180 Word := (5, "maybe");
26182 Word := (5, "no"); -- raises Constraint_Error
26183 @end example
26185 In order to support this behavior efficiently, an unconstrained object is
26186 given the maximum size that any value of the type requires. In the case
26187 above, @code{Word} has storage for the discriminant and for
26188 a @code{String} of length 100.
26189 It is important to note that unconstrained objects do not require dynamic
26190 allocation. It would be an improper implementation to place on the heap those
26191 components whose size depends on discriminants. (This improper implementation
26192 was used by some Ada83 compilers, where the @code{Name} component above
26193 would have
26194 been stored as a pointer to a dynamic string). Following the principle that
26195 dynamic storage management should never be introduced implicitly,
26196 an Ada compiler should reserve the full size for an unconstrained declared
26197 object, and place it on the stack.
26199 This maximum size approach
26200 has been a source of surprise to some users, who expect the default
26201 values of the discriminants to determine the size reserved for an
26202 unconstrained object: "If the default is 15, why should the object occupy
26203 a larger size?"
26204 The answer, of course, is that the discriminant may be later modified,
26205 and its full range of values must be taken into account. This is why the
26206 declaration:
26208 @example
26209 type Rec (D : Positive := 15) is record
26210    Name : String (1..D);
26211 end record;
26213 Too_Large : Rec;
26214 @end example
26216 is flagged by the compiler with a warning:
26217 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26218 because the required size includes @code{Positive'Last}
26219 bytes. As the first example indicates, the proper approach is to declare an
26220 index type of 'reasonable' range so that unconstrained objects are not too
26221 large.
26223 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26224 created in the heap by means of an allocator, then it is @emph{not}
26225 unconstrained:
26226 it is constrained by the default values of the discriminants, and those values
26227 cannot be modified by full assignment. This is because in the presence of
26228 aliasing all views of the object (which may be manipulated by different tasks,
26229 say) must be consistent, so it is imperative that the object, once created,
26230 remain invariant.
26232 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
26233 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{426}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{427}
26234 @section Strict Conformance to the Ada Reference Manual
26237 The dynamic semantics defined by the Ada Reference Manual impose a set of
26238 run-time checks to be generated. By default, the GNAT compiler will insert many
26239 run-time checks into the compiled code, including most of those required by the
26240 Ada Reference Manual. However, there are two checks that are not enabled in
26241 the default mode for efficiency reasons: checks for access before elaboration
26242 on subprogram calls, and stack overflow checking (most operating systems do not
26243 perform this check by default).
26245 Strict conformance to the Ada Reference Manual can be achieved by adding two
26246 compiler options for dynamic checks for access-before-elaboration on subprogram
26247 calls and generic instantiations (@emph{-gnatE}), and stack overflow checking
26248 (@emph{-fstack-check}).
26250 Note that the result of a floating point arithmetic operation in overflow and
26251 invalid situations, when the @code{Machine_Overflows} attribute of the result
26252 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26253 case for machines compliant with the IEEE floating-point standard, but on
26254 machines that are not fully compliant with this standard, such as Alpha, the
26255 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
26256 behavior (although at the cost of a significant performance penalty), so
26257 infinite and NaN values are properly generated.
26259 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
26260 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{428}@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{429}
26261 @chapter Implementation of Ada 2012 Features
26264 @geindex Ada 2012 implementation status
26266 @geindex -gnat12 option (gcc)
26268 @geindex pragma Ada_2012
26270 @geindex configuration pragma Ada_2012
26272 @geindex Ada_2012 configuration pragma
26274 This chapter contains a complete list of Ada 2012 features that have been
26275 implemented.
26276 Generally, these features are only
26277 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
26278 which is the default behavior,
26279 or if the configuration pragma @code{Ada_2012} is used.
26281 However, new pragmas, attributes, and restrictions are
26282 unconditionally available, since the Ada 95 standard allows the addition of
26283 new pragmas, attributes, and restrictions (there are exceptions, which are
26284 documented in the individual descriptions), and also certain packages
26285 were made available in earlier versions of Ada.
26287 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26288 This date shows the implementation date of the feature. Any wavefront
26289 subsequent to this date will contain the indicated feature, as will any
26290 subsequent releases. A date of 0000-00-00 means that GNAT has always
26291 implemented the feature, or implemented it as soon as it appeared as a
26292 binding interpretation.
26294 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
26295 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26296 The features are ordered based on the relevant sections of the Ada
26297 Reference Manual ("RM").  When a given AI relates to multiple points
26298 in the RM, the earliest is used.
26300 A complete description of the AIs may be found in
26301 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26303 @geindex AI-0176 (Ada 2012 feature)
26306 @itemize *
26308 @item 
26309 @emph{AI-0176 Quantified expressions (2010-09-29)}
26311 Both universally and existentially quantified expressions are implemented.
26312 They use the new syntax for iterators proposed in AI05-139-2, as well as
26313 the standard Ada loop syntax.
26315 RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
26316 @end itemize
26318 @geindex AI-0079 (Ada 2012 feature)
26321 @itemize *
26323 @item 
26324 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
26326 Wide characters in the unicode category @emph{other_format} are now allowed in
26327 source programs between tokens, but not within a token such as an identifier.
26329 RM References:  2.01 (4/2)   2.02 (7)
26330 @end itemize
26332 @geindex AI-0091 (Ada 2012 feature)
26335 @itemize *
26337 @item 
26338 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
26340 Wide characters in the unicode category @emph{other_format} are not permitted
26341 within  an identifier, since this can be a security problem. The error
26342 message for this case has been improved to be more specific, but GNAT has
26343 never allowed such characters to appear in identifiers.
26345 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)
26346 @end itemize
26348 @geindex AI-0100 (Ada 2012 feature)
26351 @itemize *
26353 @item 
26354 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
26356 This AI is an earlier version of AI-163. It simplifies the rules
26357 for legal placement of pragmas. In the case of lists that allow pragmas, if
26358 the list may have no elements, then the list may consist solely of pragmas.
26360 RM References:  2.08 (7)
26361 @end itemize
26363 @geindex AI-0163 (Ada 2012 feature)
26366 @itemize *
26368 @item 
26369 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
26371 A statement sequence may be composed entirely of pragmas. It is no longer
26372 necessary to add a dummy @code{null} statement to make the sequence legal.
26374 RM References:  2.08 (7)   2.08 (16)
26375 @end itemize
26377 @geindex AI-0080 (Ada 2012 feature)
26380 @itemize *
26382 @item 
26383 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
26385 This is an editorial change only, described as non-testable in the AI.
26387 RM References:  3.01 (7)
26388 @end itemize
26390 @geindex AI-0183 (Ada 2012 feature)
26393 @itemize *
26395 @item 
26396 @emph{AI-0183 Aspect specifications (2010-08-16)}
26398 Aspect specifications have been fully implemented except for pre and post-
26399 conditions, and type invariants, which have their own separate AI's. All
26400 forms of declarations listed in the AI are supported. The following is a
26401 list of the aspects supported (with GNAT implementation aspects marked)
26402 @end itemize
26405 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx} 
26406 @headitem
26408 Supported Aspect
26410 @tab
26412 Source
26414 @item
26416 @code{Ada_2005}
26418 @tab
26420 -- GNAT
26422 @item
26424 @code{Ada_2012}
26426 @tab
26428 -- GNAT
26430 @item
26432 @code{Address}
26434 @tab
26436 @item
26438 @code{Alignment}
26440 @tab
26442 @item
26444 @code{Atomic}
26446 @tab
26448 @item
26450 @code{Atomic_Components}
26452 @tab
26454 @item
26456 @code{Bit_Order}
26458 @tab
26460 @item
26462 @code{Component_Size}
26464 @tab
26466 @item
26468 @code{Contract_Cases}
26470 @tab
26472 -- GNAT
26474 @item
26476 @code{Discard_Names}
26478 @tab
26480 @item
26482 @code{External_Tag}
26484 @tab
26486 @item
26488 @code{Favor_Top_Level}
26490 @tab
26492 -- GNAT
26494 @item
26496 @code{Inline}
26498 @tab
26500 @item
26502 @code{Inline_Always}
26504 @tab
26506 -- GNAT
26508 @item
26510 @code{Invariant}
26512 @tab
26514 -- GNAT
26516 @item
26518 @code{Machine_Radix}
26520 @tab
26522 @item
26524 @code{No_Return}
26526 @tab
26528 @item
26530 @code{Object_Size}
26532 @tab
26534 -- GNAT
26536 @item
26538 @code{Pack}
26540 @tab
26542 @item
26544 @code{Persistent_BSS}
26546 @tab
26548 -- GNAT
26550 @item
26552 @code{Post}
26554 @tab
26556 @item
26558 @code{Pre}
26560 @tab
26562 @item
26564 @code{Predicate}
26566 @tab
26568 @item
26570 @code{Preelaborable_Initialization}
26572 @tab
26574 @item
26576 @code{Pure_Function}
26578 @tab
26580 -- GNAT
26582 @item
26584 @code{Remote_Access_Type}
26586 @tab
26588 -- GNAT
26590 @item
26592 @code{Shared}
26594 @tab
26596 -- GNAT
26598 @item
26600 @code{Size}
26602 @tab
26604 @item
26606 @code{Storage_Pool}
26608 @tab
26610 @item
26612 @code{Storage_Size}
26614 @tab
26616 @item
26618 @code{Stream_Size}
26620 @tab
26622 @item
26624 @code{Suppress}
26626 @tab
26628 @item
26630 @code{Suppress_Debug_Info}
26632 @tab
26634 -- GNAT
26636 @item
26638 @code{Test_Case}
26640 @tab
26642 -- GNAT
26644 @item
26646 @code{Thread_Local_Storage}
26648 @tab
26650 -- GNAT
26652 @item
26654 @code{Type_Invariant}
26656 @tab
26658 @item
26660 @code{Unchecked_Union}
26662 @tab
26664 @item
26666 @code{Universal_Aliasing}
26668 @tab
26670 -- GNAT
26672 @item
26674 @code{Unmodified}
26676 @tab
26678 -- GNAT
26680 @item
26682 @code{Unreferenced}
26684 @tab
26686 -- GNAT
26688 @item
26690 @code{Unreferenced_Objects}
26692 @tab
26694 -- GNAT
26696 @item
26698 @code{Unsuppress}
26700 @tab
26702 @item
26704 @code{Value_Size}
26706 @tab
26708 -- GNAT
26710 @item
26712 @code{Volatile}
26714 @tab
26716 @item
26718 @code{Volatile_Components}
26720 @tab
26722 @item
26724 @code{Warnings}
26726 @tab
26728 -- GNAT
26730 @end multitable
26733 @quotation
26735 Note that for aspects with an expression, e.g. @code{Size}, the expression is
26736 treated like a default expression (visibility is analyzed at the point of
26737 occurrence of the aspect, but evaluation of the expression occurs at the
26738 freeze point of the entity involved).
26740 RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
26741 3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
26742 (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
26743 9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
26744 12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
26745 13.03.01 (0)
26746 @end quotation
26748 @geindex AI-0128 (Ada 2012 feature)
26751 @itemize *
26753 @item 
26754 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
26756 If an equality operator ("=") is declared for a type, then the implicitly
26757 declared inequality operator ("/=") is a primitive operation of the type.
26758 This is the only reasonable interpretation, and is the one always implemented
26759 by GNAT, but the RM was not entirely clear in making this point.
26761 RM References:  3.02.03 (6)   6.06 (6)
26762 @end itemize
26764 @geindex AI-0003 (Ada 2012 feature)
26767 @itemize *
26769 @item 
26770 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
26772 In Ada 2012, a qualified expression is considered to be syntactically a name,
26773 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
26774 useful in disambiguating some cases of overloading.
26776 RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
26777 5.04 (7)
26778 @end itemize
26780 @geindex AI-0120 (Ada 2012 feature)
26783 @itemize *
26785 @item 
26786 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
26788 This is an RM editorial change only. The section that lists objects that are
26789 constant failed to include the current instance of a protected object
26790 within a protected function. This has always been treated as a constant
26791 in GNAT.
26793 RM References:  3.03 (21)
26794 @end itemize
26796 @geindex AI-0008 (Ada 2012 feature)
26799 @itemize *
26801 @item 
26802 @emph{AI-0008 General access to constrained objects (0000-00-00)}
26804 The wording in the RM implied that if you have a general access to a
26805 constrained object, it could be used to modify the discriminants. This was
26806 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
26807 has always done so in this situation.
26809 RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
26810 @end itemize
26812 @geindex AI-0093 (Ada 2012 feature)
26815 @itemize *
26817 @item 
26818 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
26820 This is an editorial change only, to make more widespread use of the Ada 2012
26821 'immutably limited'.
26823 RM References:  3.03 (23.4/3)
26824 @end itemize
26826 @geindex AI-0096 (Ada 2012 feature)
26829 @itemize *
26831 @item 
26832 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
26834 In general it is illegal for a type derived from a formal limited type to be
26835 nonlimited.  This AI makes an exception to this rule: derivation is legal
26836 if it appears in the private part of the generic, and the formal type is not
26837 tagged. If the type is tagged, the legality check must be applied to the
26838 private part of the package.
26840 RM References:  3.04 (5.1/2)   6.02 (7)
26841 @end itemize
26843 @geindex AI-0181 (Ada 2012 feature)
26846 @itemize *
26848 @item 
26849 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
26851 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
26852 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
26853 @code{Image} and @code{Value} attributes for the character types. Strictly
26854 speaking this is an inconsistency with Ada 95, but in practice the use of
26855 these attributes is so obscure that it will not cause problems.
26857 RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
26858 @end itemize
26860 @geindex AI-0182 (Ada 2012 feature)
26863 @itemize *
26865 @item 
26866 @emph{AI-0182 Additional forms for} @code{Character'Value} @emph{(0000-00-00)}
26868 This AI allows @code{Character'Value} to accept the string @code{'?'} where
26869 @code{?} is any character including non-graphic control characters. GNAT has
26870 always accepted such strings. It also allows strings such as
26871 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
26872 permission and raises @code{Constraint_Error}, as is certainly still
26873 permitted.
26875 RM References:  3.05 (56/2)
26876 @end itemize
26878 @geindex AI-0214 (Ada 2012 feature)
26881 @itemize *
26883 @item 
26884 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
26886 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
26887 to have default expressions by allowing them when the type is limited. It
26888 is often useful to define a default value for a discriminant even though
26889 it can't be changed by assignment.
26891 RM References:  3.07 (9.1/2)   3.07.02 (3)
26892 @end itemize
26894 @geindex AI-0102 (Ada 2012 feature)
26897 @itemize *
26899 @item 
26900 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
26902 It is illegal to assign an anonymous access constant to an anonymous access
26903 variable. The RM did not have a clear rule to prevent this, but GNAT has
26904 always generated an error for this usage.
26906 RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
26907 @end itemize
26909 @geindex AI-0158 (Ada 2012 feature)
26912 @itemize *
26914 @item 
26915 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
26917 This AI extends the syntax of membership tests to simplify complex conditions
26918 that can be expressed as membership in a subset of values of any type. It
26919 introduces syntax for a list of expressions that may be used in loop contexts
26920 as well.
26922 RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
26923 @end itemize
26925 @geindex AI-0173 (Ada 2012 feature)
26928 @itemize *
26930 @item 
26931 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
26933 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
26934 with the tag of an abstract type, and @code{False} otherwise.
26936 RM References:  3.09 (7.4/2)   3.09 (12.4/2)
26937 @end itemize
26939 @geindex AI-0076 (Ada 2012 feature)
26942 @itemize *
26944 @item 
26945 @emph{AI-0076 function with controlling result (0000-00-00)}
26947 This is an editorial change only. The RM defines calls with controlling
26948 results, but uses the term 'function with controlling result' without an
26949 explicit definition.
26951 RM References:  3.09.02 (2/2)
26952 @end itemize
26954 @geindex AI-0126 (Ada 2012 feature)
26957 @itemize *
26959 @item 
26960 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
26962 This AI clarifies dispatching rules, and simply confirms that dispatching
26963 executes the operation of the parent type when there is no explicitly or
26964 implicitly declared operation for the descendant type. This has always been
26965 the case in all versions of GNAT.
26967 RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
26968 @end itemize
26970 @geindex AI-0097 (Ada 2012 feature)
26973 @itemize *
26975 @item 
26976 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
26978 The RM as written implied that in some cases it was possible to create an
26979 object of an abstract type, by having an abstract extension inherit a non-
26980 abstract constructor from its parent type. This mistake has been corrected
26981 in GNAT and in the RM, and this construct is now illegal.
26983 RM References:  3.09.03 (4/2)
26984 @end itemize
26986 @geindex AI-0203 (Ada 2012 feature)
26989 @itemize *
26991 @item 
26992 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
26994 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
26995 permitted such usage.
26997 RM References:  3.09.03 (8/3)
26998 @end itemize
27000 @geindex AI-0198 (Ada 2012 feature)
27003 @itemize *
27005 @item 
27006 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
27008 This AI resolves a conflict between two rules involving inherited abstract
27009 operations and predefined operators. If a derived numeric type inherits
27010 an abstract operator, it overrides the predefined one. This interpretation
27011 was always the one implemented in GNAT.
27013 RM References:  3.09.03 (4/3)
27014 @end itemize
27016 @geindex AI-0073 (Ada 2012 feature)
27019 @itemize *
27021 @item 
27022 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
27024 This AI covers a number of issues regarding returning abstract types. In
27025 particular generic functions cannot have abstract result types or access
27026 result types designated an abstract type. There are some other cases which
27027 are detailed in the AI. Note that this binding interpretation has not been
27028 retrofitted to operate before Ada 2012 mode, since it caused a significant
27029 number of regressions.
27031 RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
27032 @end itemize
27034 @geindex AI-0070 (Ada 2012 feature)
27037 @itemize *
27039 @item 
27040 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
27042 This is an editorial change only, there are no testable consequences short of
27043 checking for the absence of generated code for an interface declaration.
27045 RM References:  3.09.04 (18/2)
27046 @end itemize
27048 @geindex AI-0208 (Ada 2012 feature)
27051 @itemize *
27053 @item 
27054 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
27056 The wording in the Ada 2005 RM concerning characteristics of incomplete views
27057 was incorrect and implied that some programs intended to be legal were now
27058 illegal. GNAT had never considered such programs illegal, so it has always
27059 implemented the intent of this AI.
27061 RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
27062 @end itemize
27064 @geindex AI-0162 (Ada 2012 feature)
27067 @itemize *
27069 @item 
27070 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
27072 Incomplete types are made more useful by allowing them to be completed by
27073 private types and private extensions.
27075 RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
27076 @end itemize
27078 @geindex AI-0098 (Ada 2012 feature)
27081 @itemize *
27083 @item 
27084 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
27086 An unintentional omission in the RM implied some inconsistent restrictions on
27087 the use of anonymous access to subprogram values. These restrictions were not
27088 intentional, and have never been enforced by GNAT.
27090 RM References:  3.10.01 (6)   3.10.01 (9.2/2)
27091 @end itemize
27093 @geindex AI-0199 (Ada 2012 feature)
27096 @itemize *
27098 @item 
27099 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
27101 A choice list in a record aggregate can include several components of
27102 (distinct) anonymous access types as long as they have matching designated
27103 subtypes.
27105 RM References:  4.03.01 (16)
27106 @end itemize
27108 @geindex AI-0220 (Ada 2012 feature)
27111 @itemize *
27113 @item 
27114 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
27116 This AI addresses a wording problem in the RM that appears to permit some
27117 complex cases of aggregates with nonstatic discriminants. GNAT has always
27118 implemented the intended semantics.
27120 RM References:  4.03.01 (17)
27121 @end itemize
27123 @geindex AI-0147 (Ada 2012 feature)
27126 @itemize *
27128 @item 
27129 @emph{AI-0147 Conditional expressions (2009-03-29)}
27131 Conditional expressions are permitted. The form of such an expression is:
27133 @example
27134 (if expr then expr @{elsif expr then expr@} [else expr])
27135 @end example
27137 The parentheses can be omitted in contexts where parentheses are present
27138 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
27139 clause is omitted, @strong{else} @emph{True} is assumed;
27140 thus @code{(if A then B)} is a way to conveniently represent
27141 @emph{(A implies B)} in standard logic.
27143 RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
27144 4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
27145 @end itemize
27147 @geindex AI-0037 (Ada 2012 feature)
27150 @itemize *
27152 @item 
27153 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
27155 This AI confirms that an association of the form @code{Indx => <>} in an
27156 array aggregate must raise @code{Constraint_Error} if @code{Indx}
27157 is out of range. The RM specified a range check on other associations, but
27158 not when the value of the association was defaulted. GNAT has always inserted
27159 a constraint check on the index value.
27161 RM References:  4.03.03 (29)
27162 @end itemize
27164 @geindex AI-0123 (Ada 2012 feature)
27167 @itemize *
27169 @item 
27170 @emph{AI-0123 Composability of equality (2010-04-13)}
27172 Equality of untagged record composes, so that the predefined equality for a
27173 composite type that includes a component of some untagged record type
27174 @code{R} uses the equality operation of @code{R} (which may be user-defined
27175 or predefined). This makes the behavior of untagged records identical to that
27176 of tagged types in this respect.
27178 This change is an incompatibility with previous versions of Ada, but it
27179 corrects a non-uniformity that was often a source of confusion. Analysis of
27180 a large number of industrial programs indicates that in those rare cases
27181 where a composite type had an untagged record component with a user-defined
27182 equality, either there was no use of the composite equality, or else the code
27183 expected the same composability as for tagged types, and thus had a bug that
27184 would be fixed by this change.
27186 RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
27187 8.05.04 (8)
27188 @end itemize
27190 @geindex AI-0088 (Ada 2012 feature)
27193 @itemize *
27195 @item 
27196 @emph{AI-0088 The value of exponentiation (0000-00-00)}
27198 This AI clarifies the equivalence rule given for the dynamic semantics of
27199 exponentiation: the value of the operation can be obtained by repeated
27200 multiplication, but the operation can be implemented otherwise (for example
27201 using the familiar divide-by-two-and-square algorithm, even if this is less
27202 accurate), and does not imply repeated reads of a volatile base.
27204 RM References:  4.05.06 (11)
27205 @end itemize
27207 @geindex AI-0188 (Ada 2012 feature)
27210 @itemize *
27212 @item 
27213 @emph{AI-0188 Case expressions (2010-01-09)}
27215 Case expressions are permitted. This allows use of constructs such as:
27217 @example
27218 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27219 @end example
27221 RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
27222 @end itemize
27224 @geindex AI-0104 (Ada 2012 feature)
27227 @itemize *
27229 @item 
27230 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
27232 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27233 @code{Constraint_Error} because the default value of the allocated object is
27234 @strong{null}. This useless construct is illegal in Ada 2012.
27236 RM References:  4.08 (2)
27237 @end itemize
27239 @geindex AI-0157 (Ada 2012 feature)
27242 @itemize *
27244 @item 
27245 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
27247 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27248 deallocation of a pointer for which a static storage size clause of zero
27249 has been given) is now illegal and is detected as such. GNAT
27250 previously gave a warning but not an error.
27252 RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
27253 @end itemize
27255 @geindex AI-0179 (Ada 2012 feature)
27258 @itemize *
27260 @item 
27261 @emph{AI-0179 Statement not required after label (2010-04-10)}
27263 It is not necessary to have a statement following a label, so a label
27264 can appear at the end of a statement sequence without the need for putting a
27265 null statement afterwards, but it is not allowable to have only labels and
27266 no real statements in a statement sequence.
27268 RM References:  5.01 (2)
27269 @end itemize
27271 @geindex AI-0139-2 (Ada 2012 feature)
27274 @itemize *
27276 @item 
27277 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
27279 The new syntax for iterating over arrays and containers is now implemented.
27280 Iteration over containers is for now limited to read-only iterators. Only
27281 default iterators are supported, with the syntax:  @code{for Elem of C}.
27283 RM References:  5.05
27284 @end itemize
27286 @geindex AI-0134 (Ada 2012 feature)
27289 @itemize *
27291 @item 
27292 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
27294 For full conformance, the profiles of anonymous-access-to-subprogram
27295 parameters must match. GNAT has always enforced this rule.
27297 RM References:  6.03.01 (18)
27298 @end itemize
27300 @geindex AI-0207 (Ada 2012 feature)
27303 @itemize *
27305 @item 
27306 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
27308 This AI confirms that access_to_constant indication must match for mode
27309 conformance. This was implemented in GNAT when the qualifier was originally
27310 introduced in Ada 2005.
27312 RM References:  6.03.01 (16/2)
27313 @end itemize
27315 @geindex AI-0046 (Ada 2012 feature)
27318 @itemize *
27320 @item 
27321 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
27323 For full conformance, in the case of access parameters, the null exclusion
27324 must match (either both or neither must have @code{not null}).
27326 RM References:  6.03.02 (18)
27327 @end itemize
27329 @geindex AI-0118 (Ada 2012 feature)
27332 @itemize *
27334 @item 
27335 @emph{AI-0118 The association of parameter associations (0000-00-00)}
27337 This AI clarifies the rules for named associations in subprogram calls and
27338 generic instantiations. The rules have been in place since Ada 83.
27340 RM References:  6.04.01 (2)   12.03 (9)
27341 @end itemize
27343 @geindex AI-0196 (Ada 2012 feature)
27346 @itemize *
27348 @item 
27349 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
27351 Null exclusion checks are not made for @code{out} parameters when
27352 evaluating the actual parameters. GNAT has never generated these checks.
27354 RM References:  6.04.01 (13)
27355 @end itemize
27357 @geindex AI-0015 (Ada 2012 feature)
27360 @itemize *
27362 @item 
27363 @emph{AI-0015 Constant return objects (0000-00-00)}
27365 The return object declared in an @emph{extended_return_statement} may be
27366 declared constant. This was always intended, and GNAT has always allowed it.
27368 RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
27369 6.05 (5.7/2)
27370 @end itemize
27372 @geindex AI-0032 (Ada 2012 feature)
27375 @itemize *
27377 @item 
27378 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
27380 If a function returns a class-wide type, the object of an extended return
27381 statement can be declared with a specific type that is covered by the class-
27382 wide type. This has been implemented in GNAT since the introduction of
27383 extended returns. Note AI-0103 complements this AI by imposing matching
27384 rules for constrained return types.
27386 RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
27387 6.05 (8/2)
27388 @end itemize
27390 @geindex AI-0103 (Ada 2012 feature)
27393 @itemize *
27395 @item 
27396 @emph{AI-0103 Static matching for extended return (2010-07-23)}
27398 If the return subtype of a function is an elementary type or a constrained
27399 type, the subtype indication in an extended return statement must match
27400 statically this return subtype.
27402 RM References:  6.05 (5.2/2)
27403 @end itemize
27405 @geindex AI-0058 (Ada 2012 feature)
27408 @itemize *
27410 @item 
27411 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
27413 The RM had some incorrect wording implying wrong treatment of abnormal
27414 completion in an extended return. GNAT has always implemented the intended
27415 correct semantics as described by this AI.
27417 RM References:  6.05 (22/2)
27418 @end itemize
27420 @geindex AI-0050 (Ada 2012 feature)
27423 @itemize *
27425 @item 
27426 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
27428 The implementation permissions for raising @code{Constraint_Error} early on a function call
27429 when it was clear an exception would be raised were over-permissive and allowed
27430 mishandling of discriminants in some cases. GNAT did
27431 not take advantage of these incorrect permissions in any case.
27433 RM References:  6.05 (24/2)
27434 @end itemize
27436 @geindex AI-0125 (Ada 2012 feature)
27439 @itemize *
27441 @item 
27442 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
27444 In Ada 2012, the declaration of a primitive operation of a type extension
27445 or private extension can also override an inherited primitive that is not
27446 visible at the point of this declaration.
27448 RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
27449 @end itemize
27451 @geindex AI-0062 (Ada 2012 feature)
27454 @itemize *
27456 @item 
27457 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
27459 A full constant may have a null exclusion even if its associated deferred
27460 constant does not. GNAT has always allowed this.
27462 RM References:  7.04 (6/2)   7.04 (7.1/2)
27463 @end itemize
27465 @geindex AI-0178 (Ada 2012 feature)
27468 @itemize *
27470 @item 
27471 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
27473 This AI clarifies the role of incomplete views and plugs an omission in the
27474 RM. GNAT always correctly restricted the use of incomplete views and types.
27476 RM References:  7.05 (3/2)   7.05 (6/2)
27477 @end itemize
27479 @geindex AI-0087 (Ada 2012 feature)
27482 @itemize *
27484 @item 
27485 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
27487 The actual for a formal nonlimited derived type cannot be limited. In
27488 particular, a formal derived type that extends a limited interface but which
27489 is not explicitly limited cannot be instantiated with a limited type.
27491 RM References:  7.05 (5/2)   12.05.01 (5.1/2)
27492 @end itemize
27494 @geindex AI-0099 (Ada 2012 feature)
27497 @itemize *
27499 @item 
27500 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
27502 This AI clarifies that 'needs finalization' is part of dynamic semantics,
27503 and therefore depends on the run-time characteristics of an object (i.e. its
27504 tag) and not on its nominal type. As the AI indicates: "we do not expect
27505 this to affect any implementation'@w{'}.
27507 RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
27508 @end itemize
27510 @geindex AI-0064 (Ada 2012 feature)
27513 @itemize *
27515 @item 
27516 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
27518 This is an editorial change only. The intended behavior is already checked
27519 by an existing ACATS test, which GNAT has always executed correctly.
27521 RM References:  7.06.01 (17.1/1)
27522 @end itemize
27524 @geindex AI-0026 (Ada 2012 feature)
27527 @itemize *
27529 @item 
27530 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
27532 Record representation clauses concerning Unchecked_Union types cannot mention
27533 the discriminant of the type. The type of a component declared in the variant
27534 part of an Unchecked_Union cannot be controlled, have controlled components,
27535 nor have protected or task parts. If an Unchecked_Union type is declared
27536 within the body of a generic unit or its descendants, then the type of a
27537 component declared in the variant part cannot be a formal private type or a
27538 formal private extension declared within the same generic unit.
27540 RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
27541 @end itemize
27543 @geindex AI-0205 (Ada 2012 feature)
27546 @itemize *
27548 @item 
27549 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27551 This AI corrects a simple omission in the RM. Return objects have always
27552 been visible within an extended return statement.
27554 RM References:  8.03 (17)
27555 @end itemize
27557 @geindex AI-0042 (Ada 2012 feature)
27560 @itemize *
27562 @item 
27563 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
27565 This AI fixes a wording gap in the RM. An operation of a synchronized
27566 interface can be implemented by a protected or task entry, but the abstract
27567 operation is not being overridden in the usual sense, and it must be stated
27568 separately that this implementation is legal. This has always been the case
27569 in GNAT.
27571 RM References:  9.01 (9.2/2)   9.04 (11.1/2)
27572 @end itemize
27574 @geindex AI-0030 (Ada 2012 feature)
27577 @itemize *
27579 @item 
27580 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
27582 Requeue is permitted to a protected, synchronized or task interface primitive
27583 providing it is known that the overriding operation is an entry. Otherwise
27584 the requeue statement has the same effect as a procedure call. Use of pragma
27585 @code{Implemented} provides a way to impose a static requirement on the
27586 overriding operation by adhering to one of the implementation kinds: entry,
27587 protected procedure or any of the above.
27589 RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
27590 9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
27591 @end itemize
27593 @geindex AI-0201 (Ada 2012 feature)
27596 @itemize *
27598 @item 
27599 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
27601 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
27602 attribute, then individual components may not be addressable by independent
27603 tasks. However, if the representation clause has no effect (is confirming),
27604 then independence is not compromised. Furthermore, in GNAT, specification of
27605 other appropriately addressable component sizes (e.g. 16 for 8-bit
27606 characters) also preserves independence. GNAT now gives very clear warnings
27607 both for the declaration of such a type, and for any assignment to its components.
27609 RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
27610 @end itemize
27612 @geindex AI-0009 (Ada 2012 feature)
27615 @itemize *
27617 @item 
27618 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
27620 This AI introduces the new pragmas @code{Independent} and
27621 @code{Independent_Components},
27622 which control guaranteeing independence of access to objects and components.
27623 The AI also requires independence not unaffected by confirming rep clauses.
27625 RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
27626 C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
27627 @end itemize
27629 @geindex AI-0072 (Ada 2012 feature)
27632 @itemize *
27634 @item 
27635 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
27637 This AI clarifies that task signalling for reading @code{'Terminated} only
27638 occurs if the result is True. GNAT semantics has always been consistent with
27639 this notion of task signalling.
27641 RM References:  9.10 (6.1/1)
27642 @end itemize
27644 @geindex AI-0108 (Ada 2012 feature)
27647 @itemize *
27649 @item 
27650 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
27652 This AI confirms that an incomplete type from a limited view does not have
27653 discriminants. This has always been the case in GNAT.
27655 RM References:  10.01.01 (12.3/2)
27656 @end itemize
27658 @geindex AI-0129 (Ada 2012 feature)
27661 @itemize *
27663 @item 
27664 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
27666 This AI clarifies the description of limited views: a limited view of a
27667 package includes only one view of a type that has an incomplete declaration
27668 and a full declaration (there is no possible ambiguity in a client package).
27669 This AI also fixes an omission: a nested package in the private part has no
27670 limited view. GNAT always implemented this correctly.
27672 RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
27673 @end itemize
27675 @geindex AI-0077 (Ada 2012 feature)
27678 @itemize *
27680 @item 
27681 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
27683 This AI clarifies that a declaration does not include a context clause,
27684 and confirms that it is illegal to have a context in which both a limited
27685 and a nonlimited view of a package are accessible. Such double visibility
27686 was always rejected by GNAT.
27688 RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
27689 @end itemize
27691 @geindex AI-0122 (Ada 2012 feature)
27694 @itemize *
27696 @item 
27697 @emph{AI-0122 Private with and children of generics (0000-00-00)}
27699 This AI clarifies the visibility of private children of generic units within
27700 instantiations of a parent. GNAT has always handled this correctly.
27702 RM References:  10.01.02 (12/2)
27703 @end itemize
27705 @geindex AI-0040 (Ada 2012 feature)
27708 @itemize *
27710 @item 
27711 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
27713 This AI confirms that a limited with clause in a child unit cannot name
27714 an ancestor of the unit. This has always been checked in GNAT.
27716 RM References:  10.01.02 (20/2)
27717 @end itemize
27719 @geindex AI-0132 (Ada 2012 feature)
27722 @itemize *
27724 @item 
27725 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
27727 This AI fills a gap in the description of library unit pragmas. The pragma
27728 clearly must apply to a library unit, even if it does not carry the name
27729 of the enclosing unit. GNAT has always enforced the required check.
27731 RM References:  10.01.05 (7)
27732 @end itemize
27734 @geindex AI-0034 (Ada 2012 feature)
27737 @itemize *
27739 @item 
27740 @emph{AI-0034 Categorization of limited views (0000-00-00)}
27742 The RM makes certain limited with clauses illegal because of categorization
27743 considerations, when the corresponding normal with would be legal. This is
27744 not intended, and GNAT has always implemented the recommended behavior.
27746 RM References:  10.02.01 (11/1)   10.02.01 (17/2)
27747 @end itemize
27749 @geindex AI-0035 (Ada 2012 feature)
27752 @itemize *
27754 @item 
27755 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
27757 This AI remedies some inconsistencies in the legality rules for Pure units.
27758 Derived access types are legal in a pure unit (on the assumption that the
27759 rule for a zero storage pool size has been enforced on the ancestor type).
27760 The rules are enforced in generic instances and in subunits. GNAT has always
27761 implemented the recommended behavior.
27763 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)
27764 @end itemize
27766 @geindex AI-0219 (Ada 2012 feature)
27769 @itemize *
27771 @item 
27772 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
27774 This AI refines the rules for the cases with limited parameters which do not
27775 allow the implementations to omit 'redundant'. GNAT now properly conforms
27776 to the requirements of this binding interpretation.
27778 RM References:  10.02.01 (18/2)
27779 @end itemize
27781 @geindex AI-0043 (Ada 2012 feature)
27784 @itemize *
27786 @item 
27787 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
27789 This AI covers various omissions in the RM regarding the raising of
27790 exceptions. GNAT has always implemented the intended semantics.
27792 RM References:  11.04.01 (10.1/2)   11 (2)
27793 @end itemize
27795 @geindex AI-0200 (Ada 2012 feature)
27798 @itemize *
27800 @item 
27801 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
27803 This AI plugs a gap in the RM which appeared to allow some obviously intended
27804 illegal instantiations. GNAT has never allowed these instantiations.
27806 RM References:  12.07 (16)
27807 @end itemize
27809 @geindex AI-0112 (Ada 2012 feature)
27812 @itemize *
27814 @item 
27815 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
27817 This AI concerns giving names to various representation aspects, but the
27818 practical effect is simply to make the use of duplicate
27819 @code{Atomic[_Components]},
27820 @code{Volatile[_Components]}, and
27821 @code{Independent[_Components]} pragmas illegal, and GNAT
27822 now performs this required check.
27824 RM References:  13.01 (8)
27825 @end itemize
27827 @geindex AI-0106 (Ada 2012 feature)
27830 @itemize *
27832 @item 
27833 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
27835 The RM appeared to allow representation pragmas on generic formal parameters,
27836 but this was not intended, and GNAT has never permitted this usage.
27838 RM References:  13.01 (9.1/1)
27839 @end itemize
27841 @geindex AI-0012 (Ada 2012 feature)
27844 @itemize *
27846 @item 
27847 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
27849 It is now illegal to give an inappropriate component size or a pragma
27850 @code{Pack} that attempts to change the component size in the case of atomic
27851 or aliased components. Previously GNAT ignored such an attempt with a
27852 warning.
27854 RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
27855 @end itemize
27857 @geindex AI-0039 (Ada 2012 feature)
27860 @itemize *
27862 @item 
27863 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
27865 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
27866 for stream attributes, but these were never useful and are now illegal. GNAT
27867 has always regarded such expressions as illegal.
27869 RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
27870 @end itemize
27872 @geindex AI-0095 (Ada 2012 feature)
27875 @itemize *
27877 @item 
27878 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
27880 The prefix of @code{'Address} cannot statically denote a subprogram with
27881 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
27882 @code{Program_Error} if the prefix denotes a subprogram with convention
27883 @code{Intrinsic}.
27885 RM References:  13.03 (11/1)
27886 @end itemize
27888 @geindex AI-0116 (Ada 2012 feature)
27891 @itemize *
27893 @item 
27894 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
27896 This AI requires that the alignment of a class-wide object be no greater
27897 than the alignment of any type in the class. GNAT has always followed this
27898 recommendation.
27900 RM References:  13.03 (29)   13.11 (16)
27901 @end itemize
27903 @geindex AI-0146 (Ada 2012 feature)
27906 @itemize *
27908 @item 
27909 @emph{AI-0146 Type invariants (2009-09-21)}
27911 Type invariants may be specified for private types using the aspect notation.
27912 Aspect @code{Type_Invariant} may be specified for any private type,
27913 @code{Type_Invariant'Class} can
27914 only be specified for tagged types, and is inherited by any descendent of the
27915 tagged types. The invariant is a boolean expression that is tested for being
27916 true in the following situations: conversions to the private type, object
27917 declarations for the private type that are default initialized, and
27918 [@strong{in}] @strong{out}
27919 parameters and returned result on return from any primitive operation for
27920 the type that is visible to a client.
27921 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
27922 @code{Invariant'Class} for @code{Type_Invariant'Class}.
27924 RM References:  13.03.03 (00)
27925 @end itemize
27927 @geindex AI-0078 (Ada 2012 feature)
27930 @itemize *
27932 @item 
27933 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
27935 In Ada 2012, compilers are required to support unchecked conversion where the
27936 target alignment is a multiple of the source alignment. GNAT always supported
27937 this case (and indeed all cases of differing alignments, doing copies where
27938 required if the alignment was reduced).
27940 RM References:  13.09 (7)
27941 @end itemize
27943 @geindex AI-0195 (Ada 2012 feature)
27946 @itemize *
27948 @item 
27949 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
27951 The handling of invalid values is now designated to be implementation
27952 defined. This is a documentation change only, requiring Annex M in the GNAT
27953 Reference Manual to document this handling.
27954 In GNAT, checks for invalid values are made
27955 only when necessary to avoid erroneous behavior. Operations like assignments
27956 which cannot cause erroneous behavior ignore the possibility of invalid
27957 values and do not do a check. The date given above applies only to the
27958 documentation change, this behavior has always been implemented by GNAT.
27960 RM References:  13.09.01 (10)
27961 @end itemize
27963 @geindex AI-0193 (Ada 2012 feature)
27966 @itemize *
27968 @item 
27969 @emph{AI-0193 Alignment of allocators (2010-09-16)}
27971 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
27972 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
27973 of size.
27975 RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
27976 13.11.01 (2)   13.11.01 (3)
27977 @end itemize
27979 @geindex AI-0177 (Ada 2012 feature)
27982 @itemize *
27984 @item 
27985 @emph{AI-0177 Parameterized expressions (2010-07-10)}
27987 The new Ada 2012 notion of parameterized expressions is implemented. The form
27990 @example
27991 function-specification is (expression)
27992 @end example
27994 This is exactly equivalent to the
27995 corresponding function body that returns the expression, but it can appear
27996 in a package spec. Note that the expression must be parenthesized.
27998 RM References:  13.11.01 (3/2)
27999 @end itemize
28001 @geindex AI-0033 (Ada 2012 feature)
28004 @itemize *
28006 @item 
28007 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
28009 Neither of these two pragmas may appear within a generic template, because
28010 the generic might be instantiated at other than the library level.
28012 RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
28013 @end itemize
28015 @geindex AI-0161 (Ada 2012 feature)
28018 @itemize *
28020 @item 
28021 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
28023 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
28024 of the default stream attributes for elementary types. If this restriction is
28025 in force, then it is necessary to provide explicit subprograms for any
28026 stream attributes used.
28028 RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
28029 @end itemize
28031 @geindex AI-0194 (Ada 2012 feature)
28034 @itemize *
28036 @item 
28037 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
28039 The @code{Stream_Size} attribute returns the default number of bits in the
28040 stream representation of the given type.
28041 This value is not affected by the presence
28042 of stream subprogram attributes for the type. GNAT has always implemented
28043 this interpretation.
28045 RM References:  13.13.02 (1.2/2)
28046 @end itemize
28048 @geindex AI-0109 (Ada 2012 feature)
28051 @itemize *
28053 @item 
28054 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
28056 This AI is an editorial change only. It removes the need for a tag check
28057 that can never fail.
28059 RM References:  13.13.02 (34/2)
28060 @end itemize
28062 @geindex AI-0007 (Ada 2012 feature)
28065 @itemize *
28067 @item 
28068 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
28070 The RM as written appeared to limit the possibilities of declaring read
28071 attribute procedures for private scalar types. This limitation was not
28072 intended, and has never been enforced by GNAT.
28074 RM References:  13.13.02 (50/2)   13.13.02 (51/2)
28075 @end itemize
28077 @geindex AI-0065 (Ada 2012 feature)
28080 @itemize *
28082 @item 
28083 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
28085 This AI clarifies the fact that all remote access types support external
28086 streaming. This fixes an obvious oversight in the definition of the
28087 language, and GNAT always implemented the intended correct rules.
28089 RM References:  13.13.02 (52/2)
28090 @end itemize
28092 @geindex AI-0019 (Ada 2012 feature)
28095 @itemize *
28097 @item 
28098 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
28100 The RM suggests that primitive subprograms of a specific tagged type are
28101 frozen when the tagged type is frozen. This would be an incompatible change
28102 and is not intended. GNAT has never attempted this kind of freezing and its
28103 behavior is consistent with the recommendation of this AI.
28105 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)
28106 @end itemize
28108 @geindex AI-0017 (Ada 2012 feature)
28111 @itemize *
28113 @item 
28114 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
28116 So-called 'Taft-amendment types' (i.e., types that are completed in package
28117 bodies) are not frozen by the occurrence of bodies in the
28118 enclosing declarative part. GNAT always implemented this properly.
28120 RM References:  13.14 (3/1)
28121 @end itemize
28123 @geindex AI-0060 (Ada 2012 feature)
28126 @itemize *
28128 @item 
28129 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
28131 This AI extends the definition of remote access types to include access
28132 to limited, synchronized, protected or task class-wide interface types.
28133 GNAT already implemented this extension.
28135 RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
28136 @end itemize
28138 @geindex AI-0114 (Ada 2012 feature)
28141 @itemize *
28143 @item 
28144 @emph{AI-0114 Classification of letters (0000-00-00)}
28146 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
28147 181 (@code{MICRO SIGN}), and
28148 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
28149 lower case letters by Unicode.
28150 However, they are not allowed in identifiers, and they
28151 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
28152 This behavior is consistent with that defined in Ada 95.
28154 RM References:  A.03.02 (59)   A.04.06 (7)
28155 @end itemize
28157 @geindex AI-0185 (Ada 2012 feature)
28160 @itemize *
28162 @item 
28163 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
28165 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28166 classification functions for @code{Wide_Character} and
28167 @code{Wide_Wide_Character}, as well as providing
28168 case folding routines for @code{Wide_[Wide_]Character} and
28169 @code{Wide_[Wide_]String}.
28171 RM References:  A.03.05 (0)   A.03.06 (0)
28172 @end itemize
28174 @geindex AI-0031 (Ada 2012 feature)
28177 @itemize *
28179 @item 
28180 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
28182 A new version of @code{Find_Token} is added to all relevant string packages,
28183 with an extra parameter @code{From}. Instead of starting at the first
28184 character of the string, the search for a matching Token starts at the
28185 character indexed by the value of @code{From}.
28186 These procedures are available in all versions of Ada
28187 but if used in versions earlier than Ada 2012 they will generate a warning
28188 that an Ada 2012 subprogram is being used.
28190 RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
28191 A.04.05 (46)
28192 @end itemize
28194 @geindex AI-0056 (Ada 2012 feature)
28197 @itemize *
28199 @item 
28200 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
28202 The wording in the Ada 2005 RM implied an incompatible handling of the
28203 @code{Index} functions, resulting in raising an exception instead of
28204 returning zero in some situations.
28205 This was not intended and has been corrected.
28206 GNAT always returned zero, and is thus consistent with this AI.
28208 RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
28209 @end itemize
28211 @geindex AI-0137 (Ada 2012 feature)
28214 @itemize *
28216 @item 
28217 @emph{AI-0137 String encoding package (2010-03-25)}
28219 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
28220 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
28221 and @code{Wide_Wide_Strings} have been
28222 implemented. These packages (whose documentation can be found in the spec
28223 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
28224 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
28225 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
28226 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
28227 UTF-16), as well as conversions between the different UTF encodings. With
28228 the exception of @code{Wide_Wide_Strings}, these packages are available in
28229 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
28230 The @code{Wide_Wide_Strings} package
28231 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
28232 mode since it uses @code{Wide_Wide_Character}).
28234 RM References:  A.04.11
28235 @end itemize
28237 @geindex AI-0038 (Ada 2012 feature)
28240 @itemize *
28242 @item 
28243 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
28245 These are minor errors in the description on three points. The intent on
28246 all these points has always been clear, and GNAT has always implemented the
28247 correct intended semantics.
28249 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)
28250 @end itemize
28252 @geindex AI-0044 (Ada 2012 feature)
28255 @itemize *
28257 @item 
28258 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
28260 This AI places restrictions on allowed instantiations of generic containers.
28261 These restrictions are not checked by the compiler, so there is nothing to
28262 change in the implementation. This affects only the RM documentation.
28264 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)
28265 @end itemize
28267 @geindex AI-0127 (Ada 2012 feature)
28270 @itemize *
28272 @item 
28273 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
28275 This package provides an interface for identifying the current locale.
28277 RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
28278 A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
28279 @end itemize
28281 @geindex AI-0002 (Ada 2012 feature)
28284 @itemize *
28286 @item 
28287 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
28289 The compiler is not required to support exporting an Ada subprogram with
28290 convention C if there are parameters or a return type of an unconstrained
28291 array type (such as @code{String}). GNAT allows such declarations but
28292 generates warnings. It is possible, but complicated, to write the
28293 corresponding C code and certainly such code would be specific to GNAT and
28294 non-portable.
28296 RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
28297 @end itemize
28299 @geindex AI05-0216 (Ada 2012 feature)
28302 @itemize *
28304 @item 
28305 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
28307 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28308 forbid tasks declared locally within subprograms, or functions returning task
28309 objects, and that is the implementation that GNAT has always provided.
28310 However the language in the RM was not sufficiently clear on this point.
28311 Thus this is a documentation change in the RM only.
28313 RM References:  D.07 (3/3)
28314 @end itemize
28316 @geindex AI-0211 (Ada 2012 feature)
28319 @itemize *
28321 @item 
28322 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
28324 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28325 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28327 RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
28328 @end itemize
28330 @geindex AI-0190 (Ada 2012 feature)
28333 @itemize *
28335 @item 
28336 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
28338 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28339 used to control storage pools globally.
28340 In particular, you can force every access
28341 type that is used for allocation (@strong{new}) to have an explicit storage pool,
28342 or you can declare a pool globally to be used for all access types that lack
28343 an explicit one.
28345 RM References:  D.07 (8)
28346 @end itemize
28348 @geindex AI-0189 (Ada 2012 feature)
28351 @itemize *
28353 @item 
28354 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
28356 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28357 which says that no dynamic allocation will occur once elaboration is
28358 completed.
28359 In general this requires a run-time check, which is not required, and which
28360 GNAT does not attempt. But the static cases of allocators in a task body or
28361 in the body of the main program are detected and flagged at compile or bind
28362 time.
28364 RM References:  D.07 (19.1/2)   H.04 (23.3/2)
28365 @end itemize
28367 @geindex AI-0171 (Ada 2012 feature)
28370 @itemize *
28372 @item 
28373 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
28375 A new package @code{System.Multiprocessors} is added, together with the
28376 definition of pragma @code{CPU} for controlling task affinity. A new no
28377 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
28378 is added to the Ravenscar profile.
28380 RM References:  D.13.01 (4/2)   D.16
28381 @end itemize
28383 @geindex AI-0210 (Ada 2012 feature)
28386 @itemize *
28388 @item 
28389 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
28391 This is a documentation only issue regarding wording of metric requirements,
28392 that does not affect the implementation of the compiler.
28394 RM References:  D.15 (24/2)
28395 @end itemize
28397 @geindex AI-0206 (Ada 2012 feature)
28400 @itemize *
28402 @item 
28403 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
28405 Remote types packages are now allowed to depend on preelaborated packages.
28406 This was formerly considered illegal.
28408 RM References:  E.02.02 (6)
28409 @end itemize
28411 @geindex AI-0152 (Ada 2012 feature)
28414 @itemize *
28416 @item 
28417 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
28419 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28420 where the type of the returned value is an anonymous access type.
28422 RM References:  H.04 (8/1)
28423 @end itemize
28425 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
28426 @anchor{gnat_rm/obsolescent_features id1}@anchor{42a}@anchor{gnat_rm/obsolescent_features doc}@anchor{42b}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
28427 @chapter Obsolescent Features
28430 This chapter describes features that are provided by GNAT, but are
28431 considered obsolescent since there are preferred ways of achieving
28432 the same effect. These features are provided solely for historical
28433 compatibility purposes.
28435 @menu
28436 * pragma No_Run_Time:: 
28437 * pragma Ravenscar:: 
28438 * pragma Restricted_Run_Time:: 
28439 * pragma Task_Info:: 
28440 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads. 
28442 @end menu
28444 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
28445 @anchor{gnat_rm/obsolescent_features id2}@anchor{42c}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{42d}
28446 @section pragma No_Run_Time
28449 The pragma @code{No_Run_Time} is used to achieve an affect similar
28450 to the use of the "Zero Foot Print" configurable run time, but without
28451 requiring a specially configured run time. The result of using this
28452 pragma, which must be used for all units in a partition, is to restrict
28453 the use of any language features requiring run-time support code. The
28454 preferred usage is to use an appropriately configured run-time that
28455 includes just those features that are to be made accessible.
28457 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
28458 @anchor{gnat_rm/obsolescent_features id3}@anchor{42e}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{42f}
28459 @section pragma Ravenscar
28462 The pragma @code{Ravenscar} has exactly the same effect as pragma
28463 @code{Profile (Ravenscar)}. The latter usage is preferred since it
28464 is part of the new Ada 2005 standard.
28466 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
28467 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{430}@anchor{gnat_rm/obsolescent_features id4}@anchor{431}
28468 @section pragma Restricted_Run_Time
28471 The pragma @code{Restricted_Run_Time} has exactly the same effect as
28472 pragma @code{Profile (Restricted)}. The latter usage is
28473 preferred since the Ada 2005 pragma @code{Profile} is intended for
28474 this kind of implementation dependent addition.
28476 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
28477 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{432}@anchor{gnat_rm/obsolescent_features id5}@anchor{433}
28478 @section pragma Task_Info
28481 The functionality provided by pragma @code{Task_Info} is now part of the
28482 Ada language. The @code{CPU} aspect and the package
28483 @code{System.Multiprocessors} offer a less system-dependent way to specify
28484 task affinity or to query the number of processsors.
28486 Syntax
28488 @example
28489 pragma Task_Info (EXPRESSION);
28490 @end example
28492 This pragma appears within a task definition (like pragma
28493 @code{Priority}) and applies to the task in which it appears.  The
28494 argument must be of type @code{System.Task_Info.Task_Info_Type}.
28495 The @code{Task_Info} pragma provides system dependent control over
28496 aspects of tasking implementation, for example, the ability to map
28497 tasks to specific processors.  For details on the facilities available
28498 for the version of GNAT that you are using, see the documentation
28499 in the spec of package System.Task_Info in the runtime
28500 library.
28502 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
28503 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{434}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{435}
28504 @section package System.Task_Info (@code{s-tasinf.ads})
28507 This package provides target dependent functionality that is used
28508 to support the @code{Task_Info} pragma. The predefined Ada package
28509 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
28510 standard replacement for GNAT's @code{Task_Info} functionality.
28512 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
28513 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{436}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{437}
28514 @chapter Compatibility and Porting Guide
28517 This chapter presents some guidelines for developing portable Ada code,
28518 describes the compatibility issues that may arise between
28519 GNAT and other Ada compilation systems (including those for Ada 83),
28520 and shows how GNAT can expedite porting
28521 applications developed in other Ada environments.
28523 @menu
28524 * Writing Portable Fixed-Point Declarations:: 
28525 * Compatibility with Ada 83:: 
28526 * Compatibility between Ada 95 and Ada 2005:: 
28527 * Implementation-dependent characteristics:: 
28528 * Compatibility with Other Ada Systems:: 
28529 * Representation Clauses:: 
28530 * Compatibility with HP Ada 83:: 
28532 @end menu
28534 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
28535 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{438}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{439}
28536 @section Writing Portable Fixed-Point Declarations
28539 The Ada Reference Manual gives an implementation freedom to choose bounds
28540 that are narrower by @code{Small} from the given bounds.
28541 For example, if we write
28543 @example
28544 type F1 is delta 1.0 range -128.0 .. +128.0;
28545 @end example
28547 then the implementation is allowed to choose -128.0 .. +127.0 if it
28548 likes, but is not required to do so.
28550 This leads to possible portability problems, so let's have a closer
28551 look at this, and figure out how to avoid these problems.
28553 First, why does this freedom exist, and why would an implementation
28554 take advantage of it? To answer this, take a closer look at the type
28555 declaration for @code{F1} above. If the compiler uses the given bounds,
28556 it would need 9 bits to hold the largest positive value (and typically
28557 that means 16 bits on all machines). But if the implementation chooses
28558 the +127.0 bound then it can fit values of the type in 8 bits.
28560 Why not make the user write +127.0 if that's what is wanted?
28561 The rationale is that if you are thinking of fixed point
28562 as a kind of 'poor man's floating-point', then you don't want
28563 to be thinking about the scaled integers that are used in its
28564 representation. Let's take another example:
28566 @example
28567 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
28568 @end example
28570 Looking at this declaration, it seems casually as though
28571 it should fit in 16 bits, but again that extra positive value
28572 +1.0 has the scaled integer equivalent of 2**15 which is one too
28573 big for signed 16 bits. The implementation can treat this as:
28575 @example
28576 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
28577 @end example
28579 and the Ada language design team felt that this was too annoying
28580 to require. We don't need to debate this decision at this point,
28581 since it is well established (the rule about narrowing the ranges
28582 dates to Ada 83).
28584 But the important point is that an implementation is not required
28585 to do this narrowing, so we have a potential portability problem.
28586 We could imagine three types of implementation:
28589 @enumerate a
28591 @item 
28592 those that narrow the range automatically if they can figure
28593 out that the narrower range will allow storage in a smaller machine unit,
28595 @item 
28596 those that will narrow only if forced to by a @code{'Size} clause, and
28598 @item 
28599 those that will never narrow.
28600 @end enumerate
28602 Now if we are language theoreticians, we can imagine a fourth
28603 approach: to narrow all the time, e.g. to treat
28605 @example
28606 type F3 is delta 1.0 range -10.0 .. +23.0;
28607 @end example
28609 as though it had been written:
28611 @example
28612 type F3 is delta 1.0 range -9.0 .. +22.0;
28613 @end example
28615 But although technically allowed, such a behavior would be hostile and silly,
28616 and no real compiler would do this. All real compilers will fall into one of
28617 the categories (a), (b) or (c) above.
28619 So, how do you get the compiler to do what you want? The answer is give the
28620 actual bounds you want, and then use a @code{'Small} clause and a
28621 @code{'Size} clause to absolutely pin down what the compiler does.
28622 E.g., for @code{F2} above, we will write:
28624 @example
28625 My_Small : constant := 2.0**(-15);
28626 My_First : constant := -1.0;
28627 My_Last  : constant := +1.0 - My_Small;
28629 type F2 is delta My_Small range My_First .. My_Last;
28630 @end example
28632 and then add
28634 @example
28635 for F2'Small use my_Small;
28636 for F2'Size  use 16;
28637 @end example
28639 In practice all compilers will do the same thing here and will give you
28640 what you want, so the above declarations are fully portable. If you really
28641 want to play language lawyer and guard against ludicrous behavior by the
28642 compiler you could add
28644 @example
28645 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28646 Test2 : constant := 1 / Boolean'Pos (F2'Last  = My_Last);
28647 @end example
28649 One or other or both are allowed to be illegal if the compiler is
28650 behaving in a silly manner, but at least the silly compiler will not
28651 get away with silently messing with your (very clear) intentions.
28653 If you follow this scheme you will be guaranteed that your fixed-point
28654 types will be portable.
28656 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
28657 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{43a}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{43b}
28658 @section Compatibility with Ada 83
28661 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
28663 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
28664 are highly upwards compatible with Ada 83.  In
28665 particular, the design intention was that the difficulties associated
28666 with moving from Ada 83 to later versions of the standard should be no greater
28667 than those that occur when moving from one Ada 83 system to another.
28669 However, there are a number of points at which there are minor
28670 incompatibilities.  The @cite{Ada 95 Annotated Reference Manual} contains
28671 full details of these issues as they relate to Ada 95,
28672 and should be consulted for a complete treatment.
28673 In practice the
28674 following subsections treat the most likely issues to be encountered.
28676 @menu
28677 * Legal Ada 83 programs that are illegal in Ada 95:: 
28678 * More deterministic semantics:: 
28679 * Changed semantics:: 
28680 * Other language compatibility issues:: 
28682 @end menu
28684 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
28685 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{43c}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{43d}
28686 @subsection Legal Ada 83 programs that are illegal in Ada 95
28689 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
28690 Ada 95 and later versions of the standard:
28693 @itemize *
28695 @item 
28696 @emph{Character literals}
28698 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
28699 @code{Wide_Character} as a new predefined character type, some uses of
28700 character literals that were legal in Ada 83 are illegal in Ada 95.
28701 For example:
28703 @example
28704 for Char in 'A' .. 'Z' loop ... end loop;
28705 @end example
28707 The problem is that 'A' and 'Z' could be from either
28708 @code{Character} or @code{Wide_Character}.  The simplest correction
28709 is to make the type explicit; e.g.:
28711 @example
28712 for Char in Character range 'A' .. 'Z' loop ... end loop;
28713 @end example
28715 @item 
28716 @emph{New reserved words}
28718 The identifiers @code{abstract}, @code{aliased}, @code{protected},
28719 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
28720 Existing Ada 83 code using any of these identifiers must be edited to
28721 use some alternative name.
28723 @item 
28724 @emph{Freezing rules}
28726 The rules in Ada 95 are slightly different with regard to the point at
28727 which entities are frozen, and representation pragmas and clauses are
28728 not permitted past the freeze point.  This shows up most typically in
28729 the form of an error message complaining that a representation item
28730 appears too late, and the appropriate corrective action is to move
28731 the item nearer to the declaration of the entity to which it refers.
28733 A particular case is that representation pragmas
28734 cannot be applied to a subprogram body.  If necessary, a separate subprogram
28735 declaration must be introduced to which the pragma can be applied.
28737 @item 
28738 @emph{Optional bodies for library packages}
28740 In Ada 83, a package that did not require a package body was nevertheless
28741 allowed to have one.  This lead to certain surprises in compiling large
28742 systems (situations in which the body could be unexpectedly ignored by the
28743 binder).  In Ada 95, if a package does not require a body then it is not
28744 permitted to have a body.  To fix this problem, simply remove a redundant
28745 body if it is empty, or, if it is non-empty, introduce a dummy declaration
28746 into the spec that makes the body required.  One approach is to add a private
28747 part to the package declaration (if necessary), and define a parameterless
28748 procedure called @code{Requires_Body}, which must then be given a dummy
28749 procedure body in the package body, which then becomes required.
28750 Another approach (assuming that this does not introduce elaboration
28751 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
28752 since one effect of this pragma is to require the presence of a package body.
28754 @item 
28755 @emph{Numeric_Error is the same exception as Constraint_Error}
28757 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
28758 This means that it is illegal to have separate exception handlers for
28759 the two exceptions.  The fix is simply to remove the handler for the
28760 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
28761 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
28763 @item 
28764 @emph{Indefinite subtypes in generics}
28766 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
28767 as the actual for a generic formal private type, but then the instantiation
28768 would be illegal if there were any instances of declarations of variables
28769 of this type in the generic body.  In Ada 95, to avoid this clear violation
28770 of the methodological principle known as the 'contract model',
28771 the generic declaration explicitly indicates whether
28772 or not such instantiations are permitted.  If a generic formal parameter
28773 has explicit unknown discriminants, indicated by using @code{(<>)} after the
28774 subtype name, then it can be instantiated with indefinite types, but no
28775 stand-alone variables can be declared of this type.  Any attempt to declare
28776 such a variable will result in an illegality at the time the generic is
28777 declared.  If the @code{(<>)} notation is not used, then it is illegal
28778 to instantiate the generic with an indefinite type.
28779 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
28780 It will show up as a compile time error, and
28781 the fix is usually simply to add the @code{(<>)} to the generic declaration.
28782 @end itemize
28784 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
28785 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{43e}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{43f}
28786 @subsection More deterministic semantics
28790 @itemize *
28792 @item 
28793 @emph{Conversions}
28795 Conversions from real types to integer types round away from 0.  In Ada 83
28796 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
28797 implementation freedom was intended to support unbiased rounding in
28798 statistical applications, but in practice it interfered with portability.
28799 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
28800 is required.  Numeric code may be affected by this change in semantics.
28801 Note, though, that this issue is no worse than already existed in Ada 83
28802 when porting code from one vendor to another.
28804 @item 
28805 @emph{Tasking}
28807 The Real-Time Annex introduces a set of policies that define the behavior of
28808 features that were implementation dependent in Ada 83, such as the order in
28809 which open select branches are executed.
28810 @end itemize
28812 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
28813 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{440}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{441}
28814 @subsection Changed semantics
28817 The worst kind of incompatibility is one where a program that is legal in
28818 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
28819 possible in Ada 83.  Fortunately this is extremely rare, but the one
28820 situation that you should be alert to is the change in the predefined type
28821 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
28823 @quotation
28825 @geindex Latin-1
28826 @end quotation
28829 @itemize *
28831 @item 
28832 @emph{Range of type `@w{`}Character`@w{`}}
28834 The range of @code{Standard.Character} is now the full 256 characters
28835 of Latin-1, whereas in most Ada 83 implementations it was restricted
28836 to 128 characters. Although some of the effects of
28837 this change will be manifest in compile-time rejection of legal
28838 Ada 83 programs it is possible for a working Ada 83 program to have
28839 a different effect in Ada 95, one that was not permitted in Ada 83.
28840 As an example, the expression
28841 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
28842 delivers @code{255} as its value.
28843 In general, you should look at the logic of any
28844 character-processing Ada 83 program and see whether it needs to be adapted
28845 to work correctly with Latin-1.  Note that the predefined Ada 95 API has a
28846 character handling package that may be relevant if code needs to be adapted
28847 to account for the additional Latin-1 elements.
28848 The desirable fix is to
28849 modify the program to accommodate the full character set, but in some cases
28850 it may be convenient to define a subtype or derived type of Character that
28851 covers only the restricted range.
28852 @end itemize
28854 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
28855 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{442}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{443}
28856 @subsection Other language compatibility issues
28860 @itemize *
28862 @item 
28863 @emph{-gnat83} switch
28865 All implementations of GNAT provide a switch that causes GNAT to operate
28866 in Ada 83 mode.  In this mode, some but not all compatibility problems
28867 of the type described above are handled automatically.  For example, the
28868 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
28869 as identifiers as in Ada 83.  However,
28870 in practice, it is usually advisable to make the necessary modifications
28871 to the program to remove the need for using this switch.
28872 See the @code{Compiling Different Versions of Ada} section in
28873 the @cite{GNAT User's Guide}.
28875 @item 
28876 Support for removed Ada 83 pragmas and attributes
28878 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
28879 generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
28880 compilers are allowed, but not required, to implement these missing
28881 elements.  In contrast with some other compilers, GNAT implements all
28882 such pragmas and attributes, eliminating this compatibility concern.  These
28883 include @code{pragma Interface} and the floating point type attributes
28884 (@code{Emax}, @code{Mantissa}, etc.), among other items.
28885 @end itemize
28887 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
28888 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{444}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{445}
28889 @section Compatibility between Ada 95 and Ada 2005
28892 @geindex Compatibility between Ada 95 and Ada 2005
28894 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
28895 a number of incompatibilities. Several are enumerated below;
28896 for a complete description please see the
28897 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
28898 @cite{Rationale for Ada 2005}.
28901 @itemize *
28903 @item 
28904 @emph{New reserved words.}
28906 The words @code{interface}, @code{overriding} and @code{synchronized} are
28907 reserved in Ada 2005.
28908 A pre-Ada 2005 program that uses any of these as an identifier will be
28909 illegal.
28911 @item 
28912 @emph{New declarations in predefined packages.}
28914 A number of packages in the predefined environment contain new declarations:
28915 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
28916 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
28917 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
28918 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
28919 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
28920 If an Ada 95 program does a @code{with} and @code{use} of any of these
28921 packages, the new declarations may cause name clashes.
28923 @item 
28924 @emph{Access parameters.}
28926 A nondispatching subprogram with an access parameter cannot be renamed
28927 as a dispatching operation.  This was permitted in Ada 95.
28929 @item 
28930 @emph{Access types, discriminants, and constraints.}
28932 Rule changes in this area have led to some incompatibilities; for example,
28933 constrained subtypes of some access types are not permitted in Ada 2005.
28935 @item 
28936 @emph{Aggregates for limited types.}
28938 The allowance of aggregates for limited types in Ada 2005 raises the
28939 possibility of ambiguities in legal Ada 95 programs, since additional types
28940 now need to be considered in expression resolution.
28942 @item 
28943 @emph{Fixed-point multiplication and division.}
28945 Certain expressions involving '*' or '/' for a fixed-point type, which
28946 were legal in Ada 95 and invoked the predefined versions of these operations,
28947 are now ambiguous.
28948 The ambiguity may be resolved either by applying a type conversion to the
28949 expression, or by explicitly invoking the operation from package
28950 @code{Standard}.
28952 @item 
28953 @emph{Return-by-reference types.}
28955 The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
28956 can declare a function returning a value from an anonymous access type.
28957 @end itemize
28959 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
28960 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{446}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{447}
28961 @section Implementation-dependent characteristics
28964 Although the Ada language defines the semantics of each construct as
28965 precisely as practical, in some situations (for example for reasons of
28966 efficiency, or where the effect is heavily dependent on the host or target
28967 platform) the implementation is allowed some freedom.  In porting Ada 83
28968 code to GNAT, you need to be aware of whether / how the existing code
28969 exercised such implementation dependencies.  Such characteristics fall into
28970 several categories, and GNAT offers specific support in assisting the
28971 transition from certain Ada 83 compilers.
28973 @menu
28974 * Implementation-defined pragmas:: 
28975 * Implementation-defined attributes:: 
28976 * Libraries:: 
28977 * Elaboration order:: 
28978 * Target-specific aspects:: 
28980 @end menu
28982 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
28983 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{448}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{449}
28984 @subsection Implementation-defined pragmas
28987 Ada compilers are allowed to supplement the language-defined pragmas, and
28988 these are a potential source of non-portability.  All GNAT-defined pragmas
28989 are described in @ref{7,,Implementation Defined Pragmas},
28990 and these include several that are specifically
28991 intended to correspond to other vendors' Ada 83 pragmas.
28992 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
28993 For compatibility with HP Ada 83, GNAT supplies the pragmas
28994 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
28995 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
28996 and @code{Volatile}.
28997 Other relevant pragmas include @code{External} and @code{Link_With}.
28998 Some vendor-specific
28999 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
29000 recognized, thus
29001 avoiding compiler rejection of units that contain such pragmas; they are not
29002 relevant in a GNAT context and hence are not otherwise implemented.
29004 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
29005 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{44a}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{44b}
29006 @subsection Implementation-defined attributes
29009 Analogous to pragmas, the set of attributes may be extended by an
29010 implementation.  All GNAT-defined attributes are described in
29011 @ref{8,,Implementation Defined Attributes},
29012 and these include several that are specifically intended
29013 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
29014 the attribute @code{VADS_Size} may be useful.  For compatibility with HP
29015 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
29016 @code{Type_Class}.
29018 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
29019 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{44c}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{44d}
29020 @subsection Libraries
29023 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
29024 code uses vendor-specific libraries then there are several ways to manage
29025 this in Ada 95 and later versions of the standard:
29028 @itemize *
29030 @item 
29031 If the source code for the libraries (specs and bodies) are
29032 available, then the libraries can be migrated in the same way as the
29033 application.
29035 @item 
29036 If the source code for the specs but not the bodies are
29037 available, then you can reimplement the bodies.
29039 @item 
29040 Some features introduced by Ada 95 obviate the need for library support.  For
29041 example most Ada 83 vendors supplied a package for unsigned integers.  The
29042 Ada 95 modular type feature is the preferred way to handle this need, so
29043 instead of migrating or reimplementing the unsigned integer package it may
29044 be preferable to retrofit the application using modular types.
29045 @end itemize
29047 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
29048 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{44e}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{44f}
29049 @subsection Elaboration order
29052 The implementation can choose any elaboration order consistent with the unit
29053 dependency relationship.  This freedom means that some orders can result in
29054 Program_Error being raised due to an 'Access Before Elaboration': an attempt
29055 to invoke a subprogram before its body has been elaborated, or to instantiate
29056 a generic before the generic body has been elaborated.  By default GNAT
29057 attempts to choose a safe order (one that will not encounter access before
29058 elaboration problems) by implicitly inserting @code{Elaborate} or
29059 @code{Elaborate_All} pragmas where
29060 needed.  However, this can lead to the creation of elaboration circularities
29061 and a resulting rejection of the program by gnatbind.  This issue is
29062 thoroughly described in the @emph{Elaboration Order Handling in GNAT} appendix
29063 in the @cite{GNAT User's Guide}.
29064 In brief, there are several
29065 ways to deal with this situation:
29068 @itemize *
29070 @item 
29071 Modify the program to eliminate the circularities, e.g., by moving
29072 elaboration-time code into explicitly-invoked procedures
29074 @item 
29075 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
29076 @code{Elaborate} pragmas, and then inhibit the generation of implicit
29077 @code{Elaborate_All}
29078 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
29079 (by selectively suppressing elaboration checks via pragma
29080 @code{Suppress(Elaboration_Check)} when it is safe to do so).
29081 @end itemize
29083 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
29084 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{450}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{451}
29085 @subsection Target-specific aspects
29088 Low-level applications need to deal with machine addresses, data
29089 representations, interfacing with assembler code, and similar issues.  If
29090 such an Ada 83 application is being ported to different target hardware (for
29091 example where the byte endianness has changed) then you will need to
29092 carefully examine the program logic; the porting effort will heavily depend
29093 on the robustness of the original design.  Moreover, Ada 95 (and thus
29094 Ada 2005 and Ada 2012) are sometimes
29095 incompatible with typical Ada 83 compiler practices regarding implicit
29096 packing, the meaning of the Size attribute, and the size of access values.
29097 GNAT's approach to these issues is described in @ref{452,,Representation Clauses}.
29099 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
29100 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{454}
29101 @section Compatibility with Other Ada Systems
29104 If programs avoid the use of implementation dependent and
29105 implementation defined features, as documented in the
29106 @cite{Ada Reference Manual}, there should be a high degree of portability between
29107 GNAT and other Ada systems.  The following are specific items which
29108 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
29109 compilers, but do not affect porting code to GNAT.
29110 (As of January 2007, GNAT is the only compiler available for Ada 2005;
29111 the following issues may or may not arise for Ada 2005 programs
29112 when other compilers appear.)
29115 @itemize *
29117 @item 
29118 @emph{Ada 83 Pragmas and Attributes}
29120 Ada 95 compilers are allowed, but not required, to implement the missing
29121 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
29122 GNAT implements all such pragmas and attributes, eliminating this as
29123 a compatibility concern, but some other Ada 95 compilers reject these
29124 pragmas and attributes.
29126 @item 
29127 @emph{Specialized Needs Annexes}
29129 GNAT implements the full set of special needs annexes.  At the
29130 current time, it is the only Ada 95 compiler to do so.  This means that
29131 programs making use of these features may not be portable to other Ada
29132 95 compilation systems.
29134 @item 
29135 @emph{Representation Clauses}
29137 Some other Ada 95 compilers implement only the minimal set of
29138 representation clauses required by the Ada 95 reference manual.  GNAT goes
29139 far beyond this minimal set, as described in the next section.
29140 @end itemize
29142 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
29143 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{452}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{455}
29144 @section Representation Clauses
29147 The Ada 83 reference manual was quite vague in describing both the minimal
29148 required implementation of representation clauses, and also their precise
29149 effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
29150 minimal set of capabilities required is still quite limited.
29152 GNAT implements the full required set of capabilities in
29153 Ada 95 and Ada 2005, but also goes much further, and in particular
29154 an effort has been made to be compatible with existing Ada 83 usage to the
29155 greatest extent possible.
29157 A few cases exist in which Ada 83 compiler behavior is incompatible with
29158 the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
29159 intentional or accidental dependence on specific implementation dependent
29160 characteristics of these Ada 83 compilers.  The following is a list of
29161 the cases most likely to arise in existing Ada 83 code.
29164 @itemize *
29166 @item 
29167 @emph{Implicit Packing}
29169 Some Ada 83 compilers allowed a Size specification to cause implicit
29170 packing of an array or record.  This could cause expensive implicit
29171 conversions for change of representation in the presence of derived
29172 types, and the Ada design intends to avoid this possibility.
29173 Subsequent AI's were issued to make it clear that such implicit
29174 change of representation in response to a Size clause is inadvisable,
29175 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
29176 Reference Manuals as implementation advice that is followed by GNAT.
29177 The problem will show up as an error
29178 message rejecting the size clause.  The fix is simply to provide
29179 the explicit pragma @code{Pack}, or for more fine tuned control, provide
29180 a Component_Size clause.
29182 @item 
29183 @emph{Meaning of Size Attribute}
29185 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
29186 the minimal number of bits required to hold values of the type.  For example,
29187 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
29188 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
29189 some 32 in this situation.  This problem will usually show up as a compile
29190 time error, but not always.  It is a good idea to check all uses of the
29191 'Size attribute when porting Ada 83 code.  The GNAT specific attribute
29192 Object_Size can provide a useful way of duplicating the behavior of
29193 some Ada 83 compiler systems.
29195 @item 
29196 @emph{Size of Access Types}
29198 A common assumption in Ada 83 code is that an access type is in fact a pointer,
29199 and that therefore it will be the same size as a System.Address value.  This
29200 assumption is true for GNAT in most cases with one exception.  For the case of
29201 a pointer to an unconstrained array type (where the bounds may vary from one
29202 value of the access type to another), the default is to use a 'fat pointer',
29203 which is represented as two separate pointers, one to the bounds, and one to
29204 the array.  This representation has a number of advantages, including improved
29205 efficiency.  However, it may cause some difficulties in porting existing Ada 83
29206 code which makes the assumption that, for example, pointers fit in 32 bits on
29207 a machine with 32-bit addressing.
29209 To get around this problem, GNAT also permits the use of 'thin pointers' for
29210 access types in this case (where the designated type is an unconstrained array
29211 type).  These thin pointers are indeed the same size as a System.Address value.
29212 To specify a thin pointer, use a size clause for the type, for example:
29214 @example
29215 type X is access all String;
29216 for X'Size use Standard'Address_Size;
29217 @end example
29219 which will cause the type X to be represented using a single pointer.
29220 When using this representation, the bounds are right behind the array.
29221 This representation is slightly less efficient, and does not allow quite
29222 such flexibility in the use of foreign pointers or in using the
29223 Unrestricted_Access attribute to create pointers to non-aliased objects.
29224 But for any standard portable use of the access type it will work in
29225 a functionally correct manner and allow porting of existing code.
29226 Note that another way of forcing a thin pointer representation
29227 is to use a component size clause for the element size in an array,
29228 or a record representation clause for an access field in a record.
29230 See the documentation of Unrestricted_Access in the GNAT RM for a
29231 full discussion of possible problems using this attribute in conjunction
29232 with thin pointers.
29233 @end itemize
29235 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
29236 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{456}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{457}
29237 @section Compatibility with HP Ada 83
29240 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
29241 of them can sensibly be implemented.  The description of pragmas in
29242 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
29243 applicable to GNAT.
29246 @itemize *
29248 @item 
29249 @emph{Default floating-point representation}
29251 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
29252 it is VMS format.
29254 @item 
29255 @emph{System}
29257 the package System in GNAT exactly corresponds to the definition in the
29258 Ada 95 reference manual, which means that it excludes many of the
29259 HP Ada 83 extensions.  However, a separate package Aux_DEC is provided
29260 that contains the additional definitions, and a special pragma,
29261 Extend_System allows this package to be treated transparently as an
29262 extension of package System.
29263 @end itemize
29265 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
29266 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{458}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{459}
29267 @chapter GNU Free Documentation License
29270 Version 1.3, 3 November 2008
29272 Copyright  2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc
29273 @indicateurl{http://fsf.org/}
29275 Everyone is permitted to copy and distribute verbatim copies of this
29276 license document, but changing it is not allowed.
29278 @strong{Preamble}
29280 The purpose of this License is to make a manual, textbook, or other
29281 functional and useful document "free" in the sense of freedom: to
29282 assure everyone the effective freedom to copy and redistribute it,
29283 with or without modifying it, either commercially or noncommercially.
29284 Secondarily, this License preserves for the author and publisher a way
29285 to get credit for their work, while not being considered responsible
29286 for modifications made by others.
29288 This License is a kind of "copyleft", which means that derivative
29289 works of the document must themselves be free in the same sense.  It
29290 complements the GNU General Public License, which is a copyleft
29291 license designed for free software.
29293 We have designed this License in order to use it for manuals for free
29294 software, because free software needs free documentation: a free
29295 program should come with manuals providing the same freedoms that the
29296 software does.  But this License is not limited to software manuals;
29297 it can be used for any textual work, regardless of subject matter or
29298 whether it is published as a printed book.  We recommend this License
29299 principally for works whose purpose is instruction or reference.
29301 @strong{1. APPLICABILITY AND DEFINITIONS}
29303 This License applies to any manual or other work, in any medium, that
29304 contains a notice placed by the copyright holder saying it can be
29305 distributed under the terms of this License.  Such a notice grants a
29306 world-wide, royalty-free license, unlimited in duration, to use that
29307 work under the conditions stated herein.  The @strong{Document}, below,
29308 refers to any such manual or work.  Any member of the public is a
29309 licensee, and is addressed as "@strong{you}".  You accept the license if you
29310 copy, modify or distribute the work in a way requiring permission
29311 under copyright law.
29313 A "@strong{Modified Version}" of the Document means any work containing the
29314 Document or a portion of it, either copied verbatim, or with
29315 modifications and/or translated into another language.
29317 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
29318 the Document that deals exclusively with the relationship of the
29319 publishers or authors of the Document to the Document's overall subject
29320 (or to related matters) and contains nothing that could fall directly
29321 within that overall subject.  (Thus, if the Document is in part a
29322 textbook of mathematics, a Secondary Section may not explain any
29323 mathematics.)  The relationship could be a matter of historical
29324 connection with the subject or with related matters, or of legal,
29325 commercial, philosophical, ethical or political position regarding
29326 them.
29328 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
29329 are designated, as being those of Invariant Sections, in the notice
29330 that says that the Document is released under this License.  If a
29331 section does not fit the above definition of Secondary then it is not
29332 allowed to be designated as Invariant.  The Document may contain zero
29333 Invariant Sections.  If the Document does not identify any Invariant
29334 Sections then there are none.
29336 The "@strong{Cover Texts}" are certain short passages of text that are listed,
29337 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
29338 the Document is released under this License.  A Front-Cover Text may
29339 be at most 5 words, and a Back-Cover Text may be at most 25 words.
29341 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
29342 represented in a format whose specification is available to the
29343 general public, that is suitable for revising the document
29344 straightforwardly with generic text editors or (for images composed of
29345 pixels) generic paint programs or (for drawings) some widely available
29346 drawing editor, and that is suitable for input to text formatters or
29347 for automatic translation to a variety of formats suitable for input
29348 to text formatters.  A copy made in an otherwise Transparent file
29349 format whose markup, or absence of markup, has been arranged to thwart
29350 or discourage subsequent modification by readers is not Transparent.
29351 An image format is not Transparent if used for any substantial amount
29352 of text.  A copy that is not "Transparent" is called @strong{Opaque}.
29354 Examples of suitable formats for Transparent copies include plain
29355 ASCII without markup, Texinfo input format, LaTeX input format, SGML
29356 or XML using a publicly available DTD, and standard-conforming simple
29357 HTML, PostScript or PDF designed for human modification.  Examples of
29358 transparent image formats include PNG, XCF and JPG.  Opaque formats
29359 include proprietary formats that can be read and edited only by
29360 proprietary word processors, SGML or XML for which the DTD and/or
29361 processing tools are not generally available, and the
29362 machine-generated HTML, PostScript or PDF produced by some word
29363 processors for output purposes only.
29365 The "@strong{Title Page}" means, for a printed book, the title page itself,
29366 plus such following pages as are needed to hold, legibly, the material
29367 this License requires to appear in the title page.  For works in
29368 formats which do not have any title page as such, "Title Page" means
29369 the text near the most prominent appearance of the work's title,
29370 preceding the beginning of the body of the text.
29372 The "@strong{publisher}" means any person or entity that distributes
29373 copies of the Document to the public.
29375 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
29376 title either is precisely XYZ or contains XYZ in parentheses following
29377 text that translates XYZ in another language.  (Here XYZ stands for a
29378 specific section name mentioned below, such as "@strong{Acknowledgements}",
29379 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
29380 To "@strong{Preserve the Title}"
29381 of such a section when you modify the Document means that it remains a
29382 section "Entitled XYZ" according to this definition.
29384 The Document may include Warranty Disclaimers next to the notice which
29385 states that this License applies to the Document.  These Warranty
29386 Disclaimers are considered to be included by reference in this
29387 License, but only as regards disclaiming warranties: any other
29388 implication that these Warranty Disclaimers may have is void and has
29389 no effect on the meaning of this License.
29391 @strong{2. VERBATIM COPYING}
29393 You may copy and distribute the Document in any medium, either
29394 commercially or noncommercially, provided that this License, the
29395 copyright notices, and the license notice saying this License applies
29396 to the Document are reproduced in all copies, and that you add no other
29397 conditions whatsoever to those of this License.  You may not use
29398 technical measures to obstruct or control the reading or further
29399 copying of the copies you make or distribute.  However, you may accept
29400 compensation in exchange for copies.  If you distribute a large enough
29401 number of copies you must also follow the conditions in section 3.
29403 You may also lend copies, under the same conditions stated above, and
29404 you may publicly display copies.
29406 @strong{3. COPYING IN QUANTITY}
29408 If you publish printed copies (or copies in media that commonly have
29409 printed covers) of the Document, numbering more than 100, and the
29410 Document's license notice requires Cover Texts, you must enclose the
29411 copies in covers that carry, clearly and legibly, all these Cover
29412 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
29413 the back cover.  Both covers must also clearly and legibly identify
29414 you as the publisher of these copies.  The front cover must present
29415 the full title with all words of the title equally prominent and
29416 visible.  You may add other material on the covers in addition.
29417 Copying with changes limited to the covers, as long as they preserve
29418 the title of the Document and satisfy these conditions, can be treated
29419 as verbatim copying in other respects.
29421 If the required texts for either cover are too voluminous to fit
29422 legibly, you should put the first ones listed (as many as fit
29423 reasonably) on the actual cover, and continue the rest onto adjacent
29424 pages.
29426 If you publish or distribute Opaque copies of the Document numbering
29427 more than 100, you must either include a machine-readable Transparent
29428 copy along with each Opaque copy, or state in or with each Opaque copy
29429 a computer-network location from which the general network-using
29430 public has access to download using public-standard network protocols
29431 a complete Transparent copy of the Document, free of added material.
29432 If you use the latter option, you must take reasonably prudent steps,
29433 when you begin distribution of Opaque copies in quantity, to ensure
29434 that this Transparent copy will remain thus accessible at the stated
29435 location until at least one year after the last time you distribute an
29436 Opaque copy (directly or through your agents or retailers) of that
29437 edition to the public.
29439 It is requested, but not required, that you contact the authors of the
29440 Document well before redistributing any large number of copies, to give
29441 them a chance to provide you with an updated version of the Document.
29443 @strong{4. MODIFICATIONS}
29445 You may copy and distribute a Modified Version of the Document under
29446 the conditions of sections 2 and 3 above, provided that you release
29447 the Modified Version under precisely this License, with the Modified
29448 Version filling the role of the Document, thus licensing distribution
29449 and modification of the Modified Version to whoever possesses a copy
29450 of it.  In addition, you must do these things in the Modified Version:
29453 @enumerate A
29455 @item 
29456 Use in the Title Page (and on the covers, if any) a title distinct
29457 from that of the Document, and from those of previous versions
29458 (which should, if there were any, be listed in the History section
29459 of the Document).  You may use the same title as a previous version
29460 if the original publisher of that version gives permission.
29462 @item 
29463 List on the Title Page, as authors, one or more persons or entities
29464 responsible for authorship of the modifications in the Modified
29465 Version, together with at least five of the principal authors of the
29466 Document (all of its principal authors, if it has fewer than five),
29467 unless they release you from this requirement.
29469 @item 
29470 State on the Title page the name of the publisher of the
29471 Modified Version, as the publisher.
29473 @item 
29474 Preserve all the copyright notices of the Document.
29476 @item 
29477 Add an appropriate copyright notice for your modifications
29478 adjacent to the other copyright notices.
29480 @item 
29481 Include, immediately after the copyright notices, a license notice
29482 giving the public permission to use the Modified Version under the
29483 terms of this License, in the form shown in the Addendum below.
29485 @item 
29486 Preserve in that license notice the full lists of Invariant Sections
29487 and required Cover Texts given in the Document's license notice.
29489 @item 
29490 Include an unaltered copy of this License.
29492 @item 
29493 Preserve the section Entitled "History", Preserve its Title, and add
29494 to it an item stating at least the title, year, new authors, and
29495 publisher of the Modified Version as given on the Title Page.  If
29496 there is no section Entitled "History" in the Document, create one
29497 stating the title, year, authors, and publisher of the Document as
29498 given on its Title Page, then add an item describing the Modified
29499 Version as stated in the previous sentence.
29501 @item 
29502 Preserve the network location, if any, given in the Document for
29503 public access to a Transparent copy of the Document, and likewise
29504 the network locations given in the Document for previous versions
29505 it was based on.  These may be placed in the "History" section.
29506 You may omit a network location for a work that was published at
29507 least four years before the Document itself, or if the original
29508 publisher of the version it refers to gives permission.
29510 @item 
29511 For any section Entitled "Acknowledgements" or "Dedications",
29512 Preserve the Title of the section, and preserve in the section all
29513 the substance and tone of each of the contributor acknowledgements
29514 and/or dedications given therein.
29516 @item 
29517 Preserve all the Invariant Sections of the Document,
29518 unaltered in their text and in their titles.  Section numbers
29519 or the equivalent are not considered part of the section titles.
29521 @item 
29522 Delete any section Entitled "Endorsements".  Such a section
29523 may not be included in the Modified Version.
29525 @item 
29526 Do not retitle any existing section to be Entitled "Endorsements"
29527 or to conflict in title with any Invariant Section.
29529 @item 
29530 Preserve any Warranty Disclaimers.
29531 @end enumerate
29533 If the Modified Version includes new front-matter sections or
29534 appendices that qualify as Secondary Sections and contain no material
29535 copied from the Document, you may at your option designate some or all
29536 of these sections as invariant.  To do this, add their titles to the
29537 list of Invariant Sections in the Modified Version's license notice.
29538 These titles must be distinct from any other section titles.
29540 You may add a section Entitled "Endorsements", provided it contains
29541 nothing but endorsements of your Modified Version by various
29542 parties---for example, statements of peer review or that the text has
29543 been approved by an organization as the authoritative definition of a
29544 standard.
29546 You may add a passage of up to five words as a Front-Cover Text, and a
29547 passage of up to 25 words as a Back-Cover Text, to the end of the list
29548 of Cover Texts in the Modified Version.  Only one passage of
29549 Front-Cover Text and one of Back-Cover Text may be added by (or
29550 through arrangements made by) any one entity.  If the Document already
29551 includes a cover text for the same cover, previously added by you or
29552 by arrangement made by the same entity you are acting on behalf of,
29553 you may not add another; but you may replace the old one, on explicit
29554 permission from the previous publisher that added the old one.
29556 The author(s) and publisher(s) of the Document do not by this License
29557 give permission to use their names for publicity for or to assert or
29558 imply endorsement of any Modified Version.
29560 @strong{5. COMBINING DOCUMENTS}
29562 You may combine the Document with other documents released under this
29563 License, under the terms defined in section 4 above for modified
29564 versions, provided that you include in the combination all of the
29565 Invariant Sections of all of the original documents, unmodified, and
29566 list them all as Invariant Sections of your combined work in its
29567 license notice, and that you preserve all their Warranty Disclaimers.
29569 The combined work need only contain one copy of this License, and
29570 multiple identical Invariant Sections may be replaced with a single
29571 copy.  If there are multiple Invariant Sections with the same name but
29572 different contents, make the title of each such section unique by
29573 adding at the end of it, in parentheses, the name of the original
29574 author or publisher of that section if known, or else a unique number.
29575 Make the same adjustment to the section titles in the list of
29576 Invariant Sections in the license notice of the combined work.
29578 In the combination, you must combine any sections Entitled "History"
29579 in the various original documents, forming one section Entitled
29580 "History"; likewise combine any sections Entitled "Acknowledgements",
29581 and any sections Entitled "Dedications".  You must delete all sections
29582 Entitled "Endorsements".
29584 @strong{6. COLLECTIONS OF DOCUMENTS}
29586 You may make a collection consisting of the Document and other documents
29587 released under this License, and replace the individual copies of this
29588 License in the various documents with a single copy that is included in
29589 the collection, provided that you follow the rules of this License for
29590 verbatim copying of each of the documents in all other respects.
29592 You may extract a single document from such a collection, and distribute
29593 it individually under this License, provided you insert a copy of this
29594 License into the extracted document, and follow this License in all
29595 other respects regarding verbatim copying of that document.
29597 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
29599 A compilation of the Document or its derivatives with other separate
29600 and independent documents or works, in or on a volume of a storage or
29601 distribution medium, is called an "aggregate" if the copyright
29602 resulting from the compilation is not used to limit the legal rights
29603 of the compilation's users beyond what the individual works permit.
29604 When the Document is included in an aggregate, this License does not
29605 apply to the other works in the aggregate which are not themselves
29606 derivative works of the Document.
29608 If the Cover Text requirement of section 3 is applicable to these
29609 copies of the Document, then if the Document is less than one half of
29610 the entire aggregate, the Document's Cover Texts may be placed on
29611 covers that bracket the Document within the aggregate, or the
29612 electronic equivalent of covers if the Document is in electronic form.
29613 Otherwise they must appear on printed covers that bracket the whole
29614 aggregate.
29616 @strong{8. TRANSLATION}
29618 Translation is considered a kind of modification, so you may
29619 distribute translations of the Document under the terms of section 4.
29620 Replacing Invariant Sections with translations requires special
29621 permission from their copyright holders, but you may include
29622 translations of some or all Invariant Sections in addition to the
29623 original versions of these Invariant Sections.  You may include a
29624 translation of this License, and all the license notices in the
29625 Document, and any Warranty Disclaimers, provided that you also include
29626 the original English version of this License and the original versions
29627 of those notices and disclaimers.  In case of a disagreement between
29628 the translation and the original version of this License or a notice
29629 or disclaimer, the original version will prevail.
29631 If a section in the Document is Entitled "Acknowledgements",
29632 "Dedications", or "History", the requirement (section 4) to Preserve
29633 its Title (section 1) will typically require changing the actual
29634 title.
29636 @strong{9. TERMINATION}
29638 You may not copy, modify, sublicense, or distribute the Document
29639 except as expressly provided under this License.  Any attempt
29640 otherwise to copy, modify, sublicense, or distribute it is void, and
29641 will automatically terminate your rights under this License.
29643 However, if you cease all violation of this License, then your license
29644 from a particular copyright holder is reinstated (a) provisionally,
29645 unless and until the copyright holder explicitly and finally
29646 terminates your license, and (b) permanently, if the copyright holder
29647 fails to notify you of the violation by some reasonable means prior to
29648 60 days after the cessation.
29650 Moreover, your license from a particular copyright holder is
29651 reinstated permanently if the copyright holder notifies you of the
29652 violation by some reasonable means, this is the first time you have
29653 received notice of violation of this License (for any work) from that
29654 copyright holder, and you cure the violation prior to 30 days after
29655 your receipt of the notice.
29657 Termination of your rights under this section does not terminate the
29658 licenses of parties who have received copies or rights from you under
29659 this License.  If your rights have been terminated and not permanently
29660 reinstated, receipt of a copy of some or all of the same material does
29661 not give you any rights to use it.
29663 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
29665 The Free Software Foundation may publish new, revised versions
29666 of the GNU Free Documentation License from time to time.  Such new
29667 versions will be similar in spirit to the present version, but may
29668 differ in detail to address new problems or concerns.  See
29669 @indicateurl{http://www.gnu.org/copyleft/}.
29671 Each version of the License is given a distinguishing version number.
29672 If the Document specifies that a particular numbered version of this
29673 License "or any later version" applies to it, you have the option of
29674 following the terms and conditions either of that specified version or
29675 of any later version that has been published (not as a draft) by the
29676 Free Software Foundation.  If the Document does not specify a version
29677 number of this License, you may choose any version ever published (not
29678 as a draft) by the Free Software Foundation.  If the Document
29679 specifies that a proxy can decide which future versions of this
29680 License can be used, that proxy's public statement of acceptance of a
29681 version permanently authorizes you to choose that version for the
29682 Document.
29684 @strong{11. RELICENSING}
29686 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
29687 World Wide Web server that publishes copyrightable works and also
29688 provides prominent facilities for anybody to edit those works.  A
29689 public wiki that anybody can edit is an example of such a server.  A
29690 "Massive Multiauthor Collaboration" (or "MMC") contained in the
29691 site means any set of copyrightable works thus published on the MMC
29692 site.
29694 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
29695 license published by Creative Commons Corporation, a not-for-profit
29696 corporation with a principal place of business in San Francisco,
29697 California, as well as future copyleft versions of that license
29698 published by that same organization.
29700 "Incorporate" means to publish or republish a Document, in whole or
29701 in part, as part of another Document.
29703 An MMC is "eligible for relicensing" if it is licensed under this
29704 License, and if all works that were first published under this License
29705 somewhere other than this MMC, and subsequently incorporated in whole
29706 or in part into the MMC, (1) had no cover texts or invariant sections,
29707 and (2) were thus incorporated prior to November 1, 2008.
29709 The operator of an MMC Site may republish an MMC contained in the site
29710 under CC-BY-SA on the same site at any time before August 1, 2009,
29711 provided the MMC is eligible for relicensing.
29713 @strong{ADDENDUM: How to use this License for your documents}
29715 To use this License in a document you have written, include a copy of
29716 the License in the document and put the following copyright and
29717 license notices just after the title page:
29719 @quotation
29721 Copyright © YEAR  YOUR NAME.
29722 Permission is granted to copy, distribute and/or modify this document
29723 under the terms of the GNU Free Documentation License, Version 1.3
29724 or any later version published by the Free Software Foundation;
29725 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
29726 A copy of the license is included in the section entitled "GNU
29727 Free Documentation License".
29728 @end quotation
29730 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
29731 replace the "with ... Texts." line with this:
29733 @quotation
29735 with the Invariant Sections being LIST THEIR TITLES, with the
29736 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
29737 @end quotation
29739 If you have Invariant Sections without Cover Texts, or some other
29740 combination of the three, merge those two alternatives to suit the
29741 situation.
29743 If your document contains nontrivial examples of program code, we
29744 recommend releasing these examples in parallel under your choice of
29745 free software license, such as the GNU General Public License,
29746 to permit their use in free software.
29748 @node Index,,GNU Free Documentation License,Top
29749 @unnumbered Index
29752 @printindex ge
29755 @c %**end of body
29756 @bye