[Ada] Improve support for tuning branch probability heuristics
[gcc.git] / gcc / ada / gnat_rm.texi
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
17
18 @definfoenclose strong,`,'
19 @definfoenclose emph,`,'
20 @c %**end of header
21
22 @copying
23 @quotation
24 GNAT Reference Manual , Jun 21, 2019
25
26 AdaCore
27
28 Copyright @copyright{} 2008-2019, Free Software Foundation
29 @end quotation
30
31 @end copying
32
33 @titlepage
34 @title GNAT Reference Manual
35 @insertcopying
36 @end titlepage
37 @contents
38
39 @c %** start of user preamble
40
41 @c %** end of user preamble
42
43 @ifnottex
44 @node Top
45 @top GNAT Reference Manual
46 @insertcopying
47 @end ifnottex
48
49 @c %**start of body
50 @anchor{gnat_rm doc}@anchor{0}
51 @emph{GNAT, The GNU Ada Development Environment}
52
53
54 @include gcc-common.texi
55 GCC version @value{version-GCC}@*
56 AdaCore
57
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}.
64
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::
86
87 @detailmenu
88 --- The Detailed Node Listing ---
89
90 About This Guide
91
92 * What This Reference Manual Contains::
93 * Conventions::
94 * Related Information::
95
96 Implementation Defined Pragmas
97
98 * Pragma Abort_Defer::
99 * Pragma Abstract_State::
100 * Pragma Acc_Parallel::
101 * Pragma Acc_Loop::
102 * Pragma Acc_Kernels::
103 * Pragma Acc_Data::
104 * Pragma Ada_83::
105 * Pragma Ada_95::
106 * Pragma Ada_05::
107 * Pragma Ada_2005::
108 * Pragma Ada_12::
109 * Pragma Ada_2012::
110 * Pragma Allow_Integer_Address::
111 * Pragma Annotate::
112 * Pragma Assert::
113 * Pragma Assert_And_Cut::
114 * Pragma Assertion_Policy::
115 * Pragma Assume::
116 * Pragma Assume_No_Invalid_Values::
117 * Pragma Async_Readers::
118 * Pragma Async_Writers::
119 * Pragma Attribute_Definition::
120 * Pragma C_Pass_By_Copy::
121 * Pragma Check::
122 * Pragma Check_Float_Overflow::
123 * Pragma Check_Name::
124 * Pragma Check_Policy::
125 * Pragma Comment::
126 * Pragma Common_Object::
127 * Pragma Compile_Time_Error::
128 * Pragma Compile_Time_Warning::
129 * Pragma Compiler_Unit::
130 * Pragma Compiler_Unit_Warning::
131 * Pragma Complete_Representation::
132 * Pragma Complex_Representation::
133 * Pragma Component_Alignment::
134 * Pragma Constant_After_Elaboration::
135 * Pragma Contract_Cases::
136 * Pragma Convention_Identifier::
137 * Pragma CPP_Class::
138 * Pragma CPP_Constructor::
139 * Pragma CPP_Virtual::
140 * Pragma CPP_Vtable::
141 * Pragma CPU::
142 * Pragma Deadline_Floor::
143 * Pragma Default_Initial_Condition::
144 * Pragma Debug::
145 * Pragma Debug_Policy::
146 * Pragma Default_Scalar_Storage_Order::
147 * Pragma Default_Storage_Pool::
148 * Pragma Depends::
149 * Pragma Detect_Blocking::
150 * Pragma Disable_Atomic_Synchronization::
151 * Pragma Dispatching_Domain::
152 * Pragma Effective_Reads::
153 * Pragma Effective_Writes::
154 * Pragma Elaboration_Checks::
155 * Pragma Eliminate::
156 * Pragma Enable_Atomic_Synchronization::
157 * Pragma Export_Function::
158 * Pragma Export_Object::
159 * Pragma Export_Procedure::
160 * Pragma Export_Value::
161 * Pragma Export_Valued_Procedure::
162 * Pragma Extend_System::
163 * Pragma Extensions_Allowed::
164 * Pragma Extensions_Visible::
165 * Pragma External::
166 * Pragma External_Name_Casing::
167 * Pragma Fast_Math::
168 * Pragma Favor_Top_Level::
169 * Pragma Finalize_Storage_Only::
170 * Pragma Float_Representation::
171 * Pragma Ghost::
172 * Pragma Global::
173 * Pragma Ident::
174 * Pragma Ignore_Pragma::
175 * Pragma Implementation_Defined::
176 * Pragma Implemented::
177 * Pragma Implicit_Packing::
178 * Pragma Import_Function::
179 * Pragma Import_Object::
180 * Pragma Import_Procedure::
181 * Pragma Import_Valued_Procedure::
182 * Pragma Independent::
183 * Pragma Independent_Components::
184 * Pragma Initial_Condition::
185 * Pragma Initialize_Scalars::
186 * Pragma Initializes::
187 * Pragma Inline_Always::
188 * Pragma Inline_Generic::
189 * Pragma Interface::
190 * Pragma Interface_Name::
191 * Pragma Interrupt_Handler::
192 * Pragma Interrupt_State::
193 * Pragma Invariant::
194 * Pragma Keep_Names::
195 * Pragma License::
196 * Pragma Link_With::
197 * Pragma Linker_Alias::
198 * Pragma Linker_Constructor::
199 * Pragma Linker_Destructor::
200 * Pragma Linker_Section::
201 * Pragma Lock_Free::
202 * Pragma Loop_Invariant::
203 * Pragma Loop_Optimize::
204 * Pragma Loop_Variant::
205 * Pragma Machine_Attribute::
206 * Pragma Main::
207 * Pragma Main_Storage::
208 * Pragma Max_Queue_Length::
209 * Pragma No_Body::
210 * Pragma No_Component_Reordering::
211 * Pragma No_Elaboration_Code_All::
212 * Pragma No_Heap_Finalization::
213 * Pragma No_Inline::
214 * Pragma No_Return::
215 * Pragma No_Run_Time::
216 * Pragma No_Strict_Aliasing::
217 * Pragma No_Tagged_Streams::
218 * Pragma Normalize_Scalars::
219 * Pragma Obsolescent::
220 * Pragma Optimize_Alignment::
221 * Pragma Ordered::
222 * Pragma Overflow_Mode::
223 * Pragma Overriding_Renamings::
224 * Pragma Partition_Elaboration_Policy::
225 * Pragma Part_Of::
226 * Pragma Passive::
227 * Pragma Persistent_BSS::
228 * Pragma Polling::
229 * Pragma Post::
230 * Pragma Postcondition::
231 * Pragma Post_Class::
232 * Pragma Rename_Pragma::
233 * Pragma Pre::
234 * Pragma Precondition::
235 * Pragma Predicate::
236 * Pragma Predicate_Failure::
237 * Pragma Preelaborable_Initialization::
238 * Pragma Prefix_Exception_Messages::
239 * Pragma Pre_Class::
240 * Pragma Priority_Specific_Dispatching::
241 * Pragma Profile::
242 * Pragma Profile_Warnings::
243 * Pragma Propagate_Exceptions::
244 * Pragma Provide_Shift_Operators::
245 * Pragma Psect_Object::
246 * Pragma Pure_Function::
247 * Pragma Rational::
248 * Pragma Ravenscar::
249 * Pragma Refined_Depends::
250 * Pragma Refined_Global::
251 * Pragma Refined_Post::
252 * Pragma Refined_State::
253 * Pragma Relative_Deadline::
254 * Pragma Remote_Access_Type::
255 * Pragma Restricted_Run_Time::
256 * Pragma Restriction_Warnings::
257 * Pragma Reviewable::
258 * Pragma Secondary_Stack_Size::
259 * Pragma Share_Generic::
260 * Pragma Shared::
261 * Pragma Short_Circuit_And_Or::
262 * Pragma Short_Descriptors::
263 * Pragma Simple_Storage_Pool_Type::
264 * Pragma Source_File_Name::
265 * Pragma Source_File_Name_Project::
266 * Pragma Source_Reference::
267 * Pragma SPARK_Mode::
268 * Pragma Static_Elaboration_Desired::
269 * Pragma Stream_Convert::
270 * Pragma Style_Checks::
271 * Pragma Subtitle::
272 * Pragma Suppress::
273 * Pragma Suppress_All::
274 * Pragma Suppress_Debug_Info::
275 * Pragma Suppress_Exception_Locations::
276 * Pragma Suppress_Initialization::
277 * Pragma Task_Name::
278 * Pragma Task_Storage::
279 * Pragma Test_Case::
280 * Pragma Thread_Local_Storage::
281 * Pragma Time_Slice::
282 * Pragma Title::
283 * Pragma Type_Invariant::
284 * Pragma Type_Invariant_Class::
285 * Pragma Unchecked_Union::
286 * Pragma Unevaluated_Use_Of_Old::
287 * Pragma Unimplemented_Unit::
288 * Pragma Universal_Aliasing::
289 * Pragma Universal_Data::
290 * Pragma Unmodified::
291 * Pragma Unreferenced::
292 * Pragma Unreferenced_Objects::
293 * Pragma Unreserve_All_Interrupts::
294 * Pragma Unsuppress::
295 * Pragma Use_VADS_Size::
296 * Pragma Unused::
297 * Pragma Validity_Checks::
298 * Pragma Volatile::
299 * Pragma Volatile_Full_Access::
300 * Pragma Volatile_Function::
301 * Pragma Warning_As_Error::
302 * Pragma Warnings::
303 * Pragma Weak_External::
304 * Pragma Wide_Character_Encoding::
305
306 Implementation Defined Aspects
307
308 * Aspect Abstract_State::
309 * Aspect Annotate::
310 * Aspect Async_Readers::
311 * Aspect Async_Writers::
312 * Aspect Constant_After_Elaboration::
313 * Aspect Contract_Cases::
314 * Aspect Depends::
315 * Aspect Default_Initial_Condition::
316 * Aspect Dimension::
317 * Aspect Dimension_System::
318 * Aspect Disable_Controlled::
319 * Aspect Effective_Reads::
320 * Aspect Effective_Writes::
321 * Aspect Extensions_Visible::
322 * Aspect Favor_Top_Level::
323 * Aspect Ghost::
324 * Aspect Global::
325 * Aspect Initial_Condition::
326 * Aspect Initializes::
327 * Aspect Inline_Always::
328 * Aspect Invariant::
329 * Aspect Invariant'Class::
330 * Aspect Iterable::
331 * Aspect Linker_Section::
332 * Aspect Lock_Free::
333 * Aspect Max_Queue_Length::
334 * Aspect No_Elaboration_Code_All::
335 * Aspect No_Inline::
336 * Aspect No_Tagged_Streams::
337 * Aspect Object_Size::
338 * Aspect Obsolescent::
339 * Aspect Part_Of::
340 * Aspect Persistent_BSS::
341 * Aspect Predicate::
342 * Aspect Pure_Function::
343 * Aspect Refined_Depends::
344 * Aspect Refined_Global::
345 * Aspect Refined_Post::
346 * Aspect Refined_State::
347 * Aspect Remote_Access_Type::
348 * Aspect Secondary_Stack_Size::
349 * Aspect Scalar_Storage_Order::
350 * Aspect Shared::
351 * Aspect Simple_Storage_Pool::
352 * Aspect Simple_Storage_Pool_Type::
353 * Aspect SPARK_Mode::
354 * Aspect Suppress_Debug_Info::
355 * Aspect Suppress_Initialization::
356 * Aspect Test_Case::
357 * Aspect Thread_Local_Storage::
358 * Aspect Universal_Aliasing::
359 * Aspect Universal_Data::
360 * Aspect Unmodified::
361 * Aspect Unreferenced::
362 * Aspect Unreferenced_Objects::
363 * Aspect Value_Size::
364 * Aspect Volatile_Full_Access::
365 * Aspect Volatile_Function::
366 * Aspect Warnings::
367
368 Implementation Defined Attributes
369
370 * Attribute Abort_Signal::
371 * Attribute Address_Size::
372 * Attribute Asm_Input::
373 * Attribute Asm_Output::
374 * Attribute Atomic_Always_Lock_Free::
375 * Attribute Bit::
376 * Attribute Bit_Position::
377 * Attribute Code_Address::
378 * Attribute Compiler_Version::
379 * Attribute Constrained::
380 * Attribute Default_Bit_Order::
381 * Attribute Default_Scalar_Storage_Order::
382 * Attribute Deref::
383 * Attribute Descriptor_Size::
384 * Attribute Elaborated::
385 * Attribute Elab_Body::
386 * Attribute Elab_Spec::
387 * Attribute Elab_Subp_Body::
388 * Attribute Emax::
389 * Attribute Enabled::
390 * Attribute Enum_Rep::
391 * Attribute Enum_Val::
392 * Attribute Epsilon::
393 * Attribute Fast_Math::
394 * Attribute Finalization_Size::
395 * Attribute Fixed_Value::
396 * Attribute From_Any::
397 * Attribute Has_Access_Values::
398 * Attribute Has_Discriminants::
399 * Attribute Img::
400 * Attribute Integer_Value::
401 * Attribute Invalid_Value::
402 * Attribute Iterable::
403 * Attribute Large::
404 * Attribute Library_Level::
405 * Attribute Lock_Free::
406 * Attribute Loop_Entry::
407 * Attribute Machine_Size::
408 * Attribute Mantissa::
409 * Attribute Maximum_Alignment::
410 * Attribute Mechanism_Code::
411 * Attribute Null_Parameter::
412 * Attribute Object_Size::
413 * Attribute Old::
414 * Attribute Passed_By_Reference::
415 * Attribute Pool_Address::
416 * Attribute Range_Length::
417 * Attribute Restriction_Set::
418 * Attribute Result::
419 * Attribute Safe_Emax::
420 * Attribute Safe_Large::
421 * Attribute Safe_Small::
422 * Attribute Scalar_Storage_Order::
423 * Attribute Simple_Storage_Pool::
424 * Attribute Small::
425 * Attribute Storage_Unit::
426 * Attribute Stub_Type::
427 * Attribute System_Allocator_Alignment::
428 * Attribute Target_Name::
429 * Attribute To_Address::
430 * Attribute To_Any::
431 * Attribute Type_Class::
432 * Attribute Type_Key::
433 * Attribute TypeCode::
434 * Attribute Unconstrained_Array::
435 * Attribute Universal_Literal_String::
436 * Attribute Unrestricted_Access::
437 * Attribute Update::
438 * Attribute Valid_Scalars::
439 * Attribute VADS_Size::
440 * Attribute Value_Size::
441 * Attribute Wchar_T_Size::
442 * Attribute Word_Size::
443
444 Standard and Implementation Defined Restrictions
445
446 * Partition-Wide Restrictions::
447 * Program Unit Level Restrictions::
448
449 Partition-Wide Restrictions
450
451 * Immediate_Reclamation::
452 * Max_Asynchronous_Select_Nesting::
453 * Max_Entry_Queue_Length::
454 * Max_Protected_Entries::
455 * Max_Select_Alternatives::
456 * Max_Storage_At_Blocking::
457 * Max_Task_Entries::
458 * Max_Tasks::
459 * No_Abort_Statements::
460 * No_Access_Parameter_Allocators::
461 * No_Access_Subprograms::
462 * No_Allocators::
463 * No_Anonymous_Allocators::
464 * No_Asynchronous_Control::
465 * No_Calendar::
466 * No_Coextensions::
467 * No_Default_Initialization::
468 * No_Delay::
469 * No_Dependence::
470 * No_Direct_Boolean_Operators::
471 * No_Dispatch::
472 * No_Dispatching_Calls::
473 * No_Dynamic_Attachment::
474 * No_Dynamic_Priorities::
475 * No_Entry_Calls_In_Elaboration_Code::
476 * No_Enumeration_Maps::
477 * No_Exception_Handlers::
478 * No_Exception_Propagation::
479 * No_Exception_Registration::
480 * No_Exceptions::
481 * No_Finalization::
482 * No_Fixed_Point::
483 * No_Floating_Point::
484 * No_Implicit_Conditionals::
485 * No_Implicit_Dynamic_Code::
486 * No_Implicit_Heap_Allocations::
487 * No_Implicit_Protected_Object_Allocations::
488 * No_Implicit_Task_Allocations::
489 * No_Initialize_Scalars::
490 * No_IO::
491 * No_Local_Allocators::
492 * No_Local_Protected_Objects::
493 * No_Local_Timing_Events::
494 * No_Long_Long_Integers::
495 * No_Multiple_Elaboration::
496 * No_Nested_Finalization::
497 * No_Protected_Type_Allocators::
498 * No_Protected_Types::
499 * No_Recursion::
500 * No_Reentrancy::
501 * No_Relative_Delay::
502 * No_Requeue_Statements::
503 * No_Secondary_Stack::
504 * No_Select_Statements::
505 * No_Specific_Termination_Handlers::
506 * No_Specification_of_Aspect::
507 * No_Standard_Allocators_After_Elaboration::
508 * No_Standard_Storage_Pools::
509 * No_Stream_Optimizations::
510 * No_Streams::
511 * No_Task_Allocators::
512 * No_Task_At_Interrupt_Priority::
513 * No_Task_Attributes_Package::
514 * No_Task_Hierarchy::
515 * No_Task_Termination::
516 * No_Tasking::
517 * No_Terminate_Alternatives::
518 * No_Unchecked_Access::
519 * No_Unchecked_Conversion::
520 * No_Unchecked_Deallocation::
521 * No_Use_Of_Entity::
522 * Pure_Barriers::
523 * Simple_Barriers::
524 * Static_Priorities::
525 * Static_Storage_Size::
526
527 Program Unit Level Restrictions
528
529 * No_Elaboration_Code::
530 * No_Dynamic_Sized_Objects::
531 * No_Entry_Queue::
532 * No_Implementation_Aspect_Specifications::
533 * No_Implementation_Attributes::
534 * No_Implementation_Identifiers::
535 * No_Implementation_Pragmas::
536 * No_Implementation_Restrictions::
537 * No_Implementation_Units::
538 * No_Implicit_Aliasing::
539 * No_Implicit_Loops::
540 * No_Obsolescent_Features::
541 * No_Wide_Characters::
542 * Static_Dispatch_Tables::
543 * SPARK_05::
544
545 Implementation Advice
546
547 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
548 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
549 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
550 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
551 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
552 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
553 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
554 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
555 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
556 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
557 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
558 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small.
559 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
560 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
561 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
562 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
563 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
564 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
565 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
566 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
567 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
568 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
569 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
570 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
571 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
572 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
573 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
574 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
575 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
576 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
577 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
578 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes.
579 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
580 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
581 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
582 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
583 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
584 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
585 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
586 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
587 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
588 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
589 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
590 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
591 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
592 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
593 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
594 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
595 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
596 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
597 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
598 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
599 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
600 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
601 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
602 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
603 * RM F(7); COBOL Support: RM F 7 COBOL Support.
604 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
605 * RM G; Numerics: RM G Numerics.
606 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
607 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
608 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
609 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
610 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
611
612 Intrinsic Subprograms
613
614 * Intrinsic Operators::
615 * Compilation_ISO_Date::
616 * Compilation_Date::
617 * Compilation_Time::
618 * Enclosing_Entity::
619 * Exception_Information::
620 * Exception_Message::
621 * Exception_Name::
622 * File::
623 * Line::
624 * Shifts and Rotates::
625 * Source_Location::
626
627 Representation Clauses and Pragmas
628
629 * Alignment Clauses::
630 * Size Clauses::
631 * Storage_Size Clauses::
632 * Size of Variant Record Objects::
633 * Biased Representation::
634 * Value_Size and Object_Size Clauses::
635 * Component_Size Clauses::
636 * Bit_Order Clauses::
637 * Effect of Bit_Order on Byte Ordering::
638 * Pragma Pack for Arrays::
639 * Pragma Pack for Records::
640 * Record Representation Clauses::
641 * Handling of Records with Holes::
642 * Enumeration Clauses::
643 * Address Clauses::
644 * Use of Address Clauses for Memory-Mapped I/O::
645 * Effect of Convention on Representation::
646 * Conventions and Anonymous Access Types::
647 * Determining the Representations chosen by GNAT::
648
649 The Implementation of Standard I/O
650
651 * Standard I/O Packages::
652 * FORM Strings::
653 * Direct_IO::
654 * Sequential_IO::
655 * Text_IO::
656 * Wide_Text_IO::
657 * Wide_Wide_Text_IO::
658 * Stream_IO::
659 * Text Translation::
660 * Shared Files::
661 * Filenames encoding::
662 * File content encoding::
663 * Open Modes::
664 * Operations on C Streams::
665 * Interfacing to C Streams::
666
667 Text_IO
668
669 * Stream Pointer Positioning::
670 * Reading and Writing Non-Regular Files::
671 * Get_Immediate::
672 * Treating Text_IO Files as Streams::
673 * Text_IO Extensions::
674 * Text_IO Facilities for Unbounded Strings::
675
676 Wide_Text_IO
677
678 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
679 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
680
681 Wide_Wide_Text_IO
682
683 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
684 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
685
686 The GNAT Library
687
688 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
689 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
690 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
691 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
692 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
693 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
694 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
695 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
696 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
697 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
698 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
699 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
700 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
701 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
702 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
703 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
704 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
705 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
706 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
707 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
708 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
709 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
710 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
711 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
712 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
713 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
714 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
715 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
716 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
717 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
718 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
719 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
720 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
721 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
722 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
723 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
724 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
725 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
726 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
727 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
728 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
729 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
730 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
731 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
732 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
733 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
734 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
735 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
736 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
737 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
738 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
739 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
740 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
741 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
742 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
743 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
744 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
745 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
746 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
747 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
748 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
749 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
750 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
751 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
752 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
753 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
754 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
755 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
756 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
757 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
758 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
759 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
760 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
761 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
762 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
763 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
764 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
765 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
766 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
767 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
768 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
769 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
770 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
771 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
772 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
773 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
774 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
775 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
776 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
777 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
778 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
779 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
780 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
781 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
782 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
783 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
784 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
785 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
786 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
787 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
788 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
789 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
790 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
791 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
792 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
793 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
794 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
795 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
796 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
797 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
798 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
799 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
800 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
801 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
802 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
803 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
804 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
805 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
806 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
807 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
808 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
809 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
810 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
811 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
812 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
813 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
814 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
815 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
816 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
817 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
818 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
819 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
820 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
821 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
822 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
823 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
824 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
825 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
826 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
827 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
828 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
829 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
830 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
831 * System.Memory (s-memory.ads): System Memory s-memory ads.
832 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
833 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
834 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
835 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
836 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
837 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
838 * System.Rident (s-rident.ads): System Rident s-rident ads.
839 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
840 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
841 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
842 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
843
844 Interfacing to Other Languages
845
846 * Interfacing to C::
847 * Interfacing to C++::
848 * Interfacing to COBOL::
849 * Interfacing to Fortran::
850 * Interfacing to non-GNAT Ada code::
851
852 Implementation of Specific Ada Features
853
854 * Machine Code Insertions::
855 * GNAT Implementation of Tasking::
856 * GNAT Implementation of Shared Passive Packages::
857 * Code Generation for Array Aggregates::
858 * The Size of Discriminated Records with Default Discriminants::
859 * Strict Conformance to the Ada Reference Manual::
860
861 GNAT Implementation of Tasking
862
863 * Mapping Ada Tasks onto the Underlying Kernel Threads::
864 * Ensuring Compliance with the Real-Time Annex::
865 * Support for Locking Policies::
866
867 Code Generation for Array Aggregates
868
869 * Static constant aggregates with static bounds::
870 * Constant aggregates with unconstrained nominal types::
871 * Aggregates with static bounds::
872 * Aggregates with nonstatic bounds::
873 * Aggregates in assignment statements::
874
875 Obsolescent Features
876
877 * pragma No_Run_Time::
878 * pragma Ravenscar::
879 * pragma Restricted_Run_Time::
880 * pragma Task_Info::
881 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
882
883 Compatibility and Porting Guide
884
885 * Writing Portable Fixed-Point Declarations::
886 * Compatibility with Ada 83::
887 * Compatibility between Ada 95 and Ada 2005::
888 * Implementation-dependent characteristics::
889 * Compatibility with Other Ada Systems::
890 * Representation Clauses::
891 * Compatibility with HP Ada 83::
892
893 Compatibility with Ada 83
894
895 * Legal Ada 83 programs that are illegal in Ada 95::
896 * More deterministic semantics::
897 * Changed semantics::
898 * Other language compatibility issues::
899
900 Implementation-dependent characteristics
901
902 * Implementation-defined pragmas::
903 * Implementation-defined attributes::
904 * Libraries::
905 * Elaboration order::
906 * Target-specific aspects::
907
908 @end detailmenu
909 @end menu
910
911 @node About This Guide,Implementation Defined Pragmas,Top,Top
912 @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}
913 @chapter About This Guide
914
915
916
917 This manual contains useful information in writing programs using the
918 GNAT compiler. It includes information on implementation dependent
919 characteristics of GNAT, including all the information required by
920 Annex M of the Ada language standard.
921
922 GNAT implements Ada 95, Ada 2005 and Ada 2012, and it may also be
923 invoked in Ada 83 compatibility mode.
924 By default, GNAT assumes Ada 2012,
925 but you can override with a compiler switch
926 to explicitly specify the language version.
927 (Please refer to the @emph{GNAT User's Guide} for details on these switches.)
928 Throughout this manual, references to 'Ada' without a year suffix
929 apply to all the Ada versions of the language.
930
931 Ada is designed to be highly portable.
932 In general, a program will have the same effect even when compiled by
933 different compilers on different platforms.
934 However, since Ada is designed to be used in a
935 wide variety of applications, it also contains a number of system
936 dependent features to be used in interfacing to the external world.
937
938 @geindex Implementation-dependent features
939
940 @geindex Portability
941
942 Note: Any program that makes use of implementation-dependent features
943 may be non-portable. You should follow good programming practice and
944 isolate and clearly document any sections of your program that make use
945 of these features in a non-portable manner.
946
947 @menu
948 * What This Reference Manual Contains::
949 * Conventions::
950 * Related Information::
951
952 @end menu
953
954 @node What This Reference Manual Contains,Conventions,,About This Guide
955 @anchor{gnat_rm/about_this_guide what-this-reference-manual-contains}@anchor{6}
956 @section What This Reference Manual Contains
957
958
959 This reference manual contains the following chapters:
960
961
962 @itemize *
963
964 @item
965 @ref{7,,Implementation Defined Pragmas}, lists GNAT implementation-dependent
966 pragmas, which can be used to extend and enhance the functionality of the
967 compiler.
968
969 @item
970 @ref{8,,Implementation Defined Attributes}, lists GNAT
971 implementation-dependent attributes, which can be used to extend and
972 enhance the functionality of the compiler.
973
974 @item
975 @ref{9,,Standard and Implementation Defined Restrictions}, lists GNAT
976 implementation-dependent restrictions, which can be used to extend and
977 enhance the functionality of the compiler.
978
979 @item
980 @ref{a,,Implementation Advice}, provides information on generally
981 desirable behavior which are not requirements that all compilers must
982 follow since it cannot be provided on all systems, or which may be
983 undesirable on some systems.
984
985 @item
986 @ref{b,,Implementation Defined Characteristics}, provides a guide to
987 minimizing implementation dependent features.
988
989 @item
990 @ref{c,,Intrinsic Subprograms}, describes the intrinsic subprograms
991 implemented by GNAT, and how they can be imported into user
992 application programs.
993
994 @item
995 @ref{d,,Representation Clauses and Pragmas}, describes in detail the
996 way that GNAT represents data, and in particular the exact set
997 of representation clauses and pragmas that is accepted.
998
999 @item
1000 @ref{e,,Standard Library Routines}, provides a listing of packages and a
1001 brief description of the functionality that is provided by Ada's
1002 extensive set of standard library routines as implemented by GNAT.
1003
1004 @item
1005 @ref{f,,The Implementation of Standard I/O}, details how the GNAT
1006 implementation of the input-output facilities.
1007
1008 @item
1009 @ref{10,,The GNAT Library}, is a catalog of packages that complement
1010 the Ada predefined library.
1011
1012 @item
1013 @ref{11,,Interfacing to Other Languages}, describes how programs
1014 written in Ada using GNAT can be interfaced to other programming
1015 languages.
1016
1017 @item
1018 @ref{12,,Specialized Needs Annexes}, describes the GNAT implementation of all
1019 of the specialized needs annexes.
1020
1021 @item
1022 @ref{13,,Implementation of Specific Ada Features}, discusses issues related
1023 to GNAT's implementation of machine code insertions, tasking, and several
1024 other features.
1025
1026 @item
1027 @ref{14,,Implementation of Ada 2012 Features}, describes the status of the
1028 GNAT implementation of the Ada 2012 language standard.
1029
1030 @item
1031 @ref{15,,Obsolescent Features} documents implementation dependent features,
1032 including pragmas and attributes, which are considered obsolescent, since
1033 there are other preferred ways of achieving the same results. These
1034 obsolescent forms are retained for backwards compatibility.
1035
1036 @item
1037 @ref{16,,Compatibility and Porting Guide} presents some guidelines for
1038 developing portable Ada code, describes the compatibility issues that
1039 may arise between GNAT and other Ada compilation systems (including those
1040 for Ada 83), and shows how GNAT can expedite porting applications
1041 developed in other Ada environments.
1042
1043 @item
1044 @ref{1,,GNU Free Documentation License} contains the license for this document.
1045 @end itemize
1046
1047 @geindex Ada 95 Language Reference Manual
1048
1049 @geindex Ada 2005 Language Reference Manual
1050
1051 This reference manual assumes a basic familiarity with the Ada 95 language, as
1052 described in the
1053 @cite{International Standard ANSI/ISO/IEC-8652:1995}.
1054 It does not require knowledge of the new features introduced by Ada 2005 or
1055 Ada 2012.
1056 All three reference manuals are included in the GNAT documentation
1057 package.
1058
1059 @node Conventions,Related Information,What This Reference Manual Contains,About This Guide
1060 @anchor{gnat_rm/about_this_guide conventions}@anchor{17}
1061 @section Conventions
1062
1063
1064 @geindex Conventions
1065 @geindex typographical
1066
1067 @geindex Typographical conventions
1068
1069 Following are examples of the typographical and graphic conventions used
1070 in this guide:
1071
1072
1073 @itemize *
1074
1075 @item
1076 @code{Functions}, @code{utility program names}, @code{standard names},
1077 and @code{classes}.
1078
1079 @item
1080 @code{Option flags}
1081
1082 @item
1083 @code{File names}
1084
1085 @item
1086 @code{Variables}
1087
1088 @item
1089 @emph{Emphasis}
1090
1091 @item
1092 [optional information or parameters]
1093
1094 @item
1095 Examples are described by text
1096
1097 @example
1098 and then shown this way.
1099 @end example
1100
1101 @item
1102 Commands that are entered by the user are shown as preceded by a prompt string
1103 comprising the @code{$} character followed by a space.
1104 @end itemize
1105
1106 @node Related Information,,Conventions,About This Guide
1107 @anchor{gnat_rm/about_this_guide related-information}@anchor{18}
1108 @section Related Information
1109
1110
1111 See the following documents for further information on GNAT:
1112
1113
1114 @itemize *
1115
1116 @item
1117 @cite{GNAT User's Guide for Native Platforms},
1118 which provides information on how to use the
1119 GNAT development environment.
1120
1121 @item
1122 @cite{Ada 95 Reference Manual}, the Ada 95 programming language standard.
1123
1124 @item
1125 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
1126 of the Ada 95 standard. The annotations describe
1127 detailed aspects of the design decision, and in particular contain useful
1128 sections on Ada 83 compatibility.
1129
1130 @item
1131 @cite{Ada 2005 Reference Manual}, the Ada 2005 programming language standard.
1132
1133 @item
1134 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
1135 of the Ada 2005 standard. The annotations describe
1136 detailed aspects of the design decision.
1137
1138 @item
1139 @cite{Ada 2012 Reference Manual}, the Ada 2012 programming language standard.
1140
1141 @item
1142 @cite{DEC Ada@comma{} Technical Overview and Comparison on DIGITAL Platforms},
1143 which contains specific information on compatibility between GNAT and
1144 DEC Ada 83 systems.
1145
1146 @item
1147 @cite{DEC Ada@comma{} Language Reference Manual}, part number AA-PYZAB-TK, which
1148 describes in detail the pragmas and attributes provided by the DEC Ada 83
1149 compiler system.
1150 @end itemize
1151
1152 @node Implementation Defined Pragmas,Implementation Defined Aspects,About This Guide,Top
1153 @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}
1154 @chapter Implementation Defined Pragmas
1155
1156
1157 Ada defines a set of pragmas that can be used to supply additional
1158 information to the compiler. These language defined pragmas are
1159 implemented in GNAT and work as described in the Ada Reference Manual.
1160
1161 In addition, Ada allows implementations to define additional pragmas
1162 whose meaning is defined by the implementation. GNAT provides a number
1163 of these implementation-defined pragmas, which can be used to extend
1164 and enhance the functionality of the compiler. This section of the GNAT
1165 Reference Manual describes these additional pragmas.
1166
1167 Note that any program using these pragmas might not be portable to other
1168 compilers (although GNAT implements this set of pragmas on all
1169 platforms). Therefore if portability to other compilers is an important
1170 consideration, the use of these pragmas should be minimized.
1171
1172 @menu
1173 * Pragma Abort_Defer::
1174 * Pragma Abstract_State::
1175 * Pragma Acc_Parallel::
1176 * Pragma Acc_Loop::
1177 * Pragma Acc_Kernels::
1178 * Pragma Acc_Data::
1179 * Pragma Ada_83::
1180 * Pragma Ada_95::
1181 * Pragma Ada_05::
1182 * Pragma Ada_2005::
1183 * Pragma Ada_12::
1184 * Pragma Ada_2012::
1185 * Pragma Allow_Integer_Address::
1186 * Pragma Annotate::
1187 * Pragma Assert::
1188 * Pragma Assert_And_Cut::
1189 * Pragma Assertion_Policy::
1190 * Pragma Assume::
1191 * Pragma Assume_No_Invalid_Values::
1192 * Pragma Async_Readers::
1193 * Pragma Async_Writers::
1194 * Pragma Attribute_Definition::
1195 * Pragma C_Pass_By_Copy::
1196 * Pragma Check::
1197 * Pragma Check_Float_Overflow::
1198 * Pragma Check_Name::
1199 * Pragma Check_Policy::
1200 * Pragma Comment::
1201 * Pragma Common_Object::
1202 * Pragma Compile_Time_Error::
1203 * Pragma Compile_Time_Warning::
1204 * Pragma Compiler_Unit::
1205 * Pragma Compiler_Unit_Warning::
1206 * Pragma Complete_Representation::
1207 * Pragma Complex_Representation::
1208 * Pragma Component_Alignment::
1209 * Pragma Constant_After_Elaboration::
1210 * Pragma Contract_Cases::
1211 * Pragma Convention_Identifier::
1212 * Pragma CPP_Class::
1213 * Pragma CPP_Constructor::
1214 * Pragma CPP_Virtual::
1215 * Pragma CPP_Vtable::
1216 * Pragma CPU::
1217 * Pragma Deadline_Floor::
1218 * Pragma Default_Initial_Condition::
1219 * Pragma Debug::
1220 * Pragma Debug_Policy::
1221 * Pragma Default_Scalar_Storage_Order::
1222 * Pragma Default_Storage_Pool::
1223 * Pragma Depends::
1224 * Pragma Detect_Blocking::
1225 * Pragma Disable_Atomic_Synchronization::
1226 * Pragma Dispatching_Domain::
1227 * Pragma Effective_Reads::
1228 * Pragma Effective_Writes::
1229 * Pragma Elaboration_Checks::
1230 * Pragma Eliminate::
1231 * Pragma Enable_Atomic_Synchronization::
1232 * Pragma Export_Function::
1233 * Pragma Export_Object::
1234 * Pragma Export_Procedure::
1235 * Pragma Export_Value::
1236 * Pragma Export_Valued_Procedure::
1237 * Pragma Extend_System::
1238 * Pragma Extensions_Allowed::
1239 * Pragma Extensions_Visible::
1240 * Pragma External::
1241 * Pragma External_Name_Casing::
1242 * Pragma Fast_Math::
1243 * Pragma Favor_Top_Level::
1244 * Pragma Finalize_Storage_Only::
1245 * Pragma Float_Representation::
1246 * Pragma Ghost::
1247 * Pragma Global::
1248 * Pragma Ident::
1249 * Pragma Ignore_Pragma::
1250 * Pragma Implementation_Defined::
1251 * Pragma Implemented::
1252 * Pragma Implicit_Packing::
1253 * Pragma Import_Function::
1254 * Pragma Import_Object::
1255 * Pragma Import_Procedure::
1256 * Pragma Import_Valued_Procedure::
1257 * Pragma Independent::
1258 * Pragma Independent_Components::
1259 * Pragma Initial_Condition::
1260 * Pragma Initialize_Scalars::
1261 * Pragma Initializes::
1262 * Pragma Inline_Always::
1263 * Pragma Inline_Generic::
1264 * Pragma Interface::
1265 * Pragma Interface_Name::
1266 * Pragma Interrupt_Handler::
1267 * Pragma Interrupt_State::
1268 * Pragma Invariant::
1269 * Pragma Keep_Names::
1270 * Pragma License::
1271 * Pragma Link_With::
1272 * Pragma Linker_Alias::
1273 * Pragma Linker_Constructor::
1274 * Pragma Linker_Destructor::
1275 * Pragma Linker_Section::
1276 * Pragma Lock_Free::
1277 * Pragma Loop_Invariant::
1278 * Pragma Loop_Optimize::
1279 * Pragma Loop_Variant::
1280 * Pragma Machine_Attribute::
1281 * Pragma Main::
1282 * Pragma Main_Storage::
1283 * Pragma Max_Queue_Length::
1284 * Pragma No_Body::
1285 * Pragma No_Component_Reordering::
1286 * Pragma No_Elaboration_Code_All::
1287 * Pragma No_Heap_Finalization::
1288 * Pragma No_Inline::
1289 * Pragma No_Return::
1290 * Pragma No_Run_Time::
1291 * Pragma No_Strict_Aliasing::
1292 * Pragma No_Tagged_Streams::
1293 * Pragma Normalize_Scalars::
1294 * Pragma Obsolescent::
1295 * Pragma Optimize_Alignment::
1296 * Pragma Ordered::
1297 * Pragma Overflow_Mode::
1298 * Pragma Overriding_Renamings::
1299 * Pragma Partition_Elaboration_Policy::
1300 * Pragma Part_Of::
1301 * Pragma Passive::
1302 * Pragma Persistent_BSS::
1303 * Pragma Polling::
1304 * Pragma Post::
1305 * Pragma Postcondition::
1306 * Pragma Post_Class::
1307 * Pragma Rename_Pragma::
1308 * Pragma Pre::
1309 * Pragma Precondition::
1310 * Pragma Predicate::
1311 * Pragma Predicate_Failure::
1312 * Pragma Preelaborable_Initialization::
1313 * Pragma Prefix_Exception_Messages::
1314 * Pragma Pre_Class::
1315 * Pragma Priority_Specific_Dispatching::
1316 * Pragma Profile::
1317 * Pragma Profile_Warnings::
1318 * Pragma Propagate_Exceptions::
1319 * Pragma Provide_Shift_Operators::
1320 * Pragma Psect_Object::
1321 * Pragma Pure_Function::
1322 * Pragma Rational::
1323 * Pragma Ravenscar::
1324 * Pragma Refined_Depends::
1325 * Pragma Refined_Global::
1326 * Pragma Refined_Post::
1327 * Pragma Refined_State::
1328 * Pragma Relative_Deadline::
1329 * Pragma Remote_Access_Type::
1330 * Pragma Restricted_Run_Time::
1331 * Pragma Restriction_Warnings::
1332 * Pragma Reviewable::
1333 * Pragma Secondary_Stack_Size::
1334 * Pragma Share_Generic::
1335 * Pragma Shared::
1336 * Pragma Short_Circuit_And_Or::
1337 * Pragma Short_Descriptors::
1338 * Pragma Simple_Storage_Pool_Type::
1339 * Pragma Source_File_Name::
1340 * Pragma Source_File_Name_Project::
1341 * Pragma Source_Reference::
1342 * Pragma SPARK_Mode::
1343 * Pragma Static_Elaboration_Desired::
1344 * Pragma Stream_Convert::
1345 * Pragma Style_Checks::
1346 * Pragma Subtitle::
1347 * Pragma Suppress::
1348 * Pragma Suppress_All::
1349 * Pragma Suppress_Debug_Info::
1350 * Pragma Suppress_Exception_Locations::
1351 * Pragma Suppress_Initialization::
1352 * Pragma Task_Name::
1353 * Pragma Task_Storage::
1354 * Pragma Test_Case::
1355 * Pragma Thread_Local_Storage::
1356 * Pragma Time_Slice::
1357 * Pragma Title::
1358 * Pragma Type_Invariant::
1359 * Pragma Type_Invariant_Class::
1360 * Pragma Unchecked_Union::
1361 * Pragma Unevaluated_Use_Of_Old::
1362 * Pragma Unimplemented_Unit::
1363 * Pragma Universal_Aliasing::
1364 * Pragma Universal_Data::
1365 * Pragma Unmodified::
1366 * Pragma Unreferenced::
1367 * Pragma Unreferenced_Objects::
1368 * Pragma Unreserve_All_Interrupts::
1369 * Pragma Unsuppress::
1370 * Pragma Use_VADS_Size::
1371 * Pragma Unused::
1372 * Pragma Validity_Checks::
1373 * Pragma Volatile::
1374 * Pragma Volatile_Full_Access::
1375 * Pragma Volatile_Function::
1376 * Pragma Warning_As_Error::
1377 * Pragma Warnings::
1378 * Pragma Weak_External::
1379 * Pragma Wide_Character_Encoding::
1380
1381 @end menu
1382
1383 @node Pragma Abort_Defer,Pragma Abstract_State,,Implementation Defined Pragmas
1384 @anchor{gnat_rm/implementation_defined_pragmas pragma-abort-defer}@anchor{1b}
1385 @section Pragma Abort_Defer
1386
1387
1388 @geindex Deferring aborts
1389
1390 Syntax:
1391
1392 @example
1393 pragma Abort_Defer;
1394 @end example
1395
1396 This pragma must appear at the start of the statement sequence of a
1397 handled sequence of statements (right after the @code{begin}). It has
1398 the effect of deferring aborts for the sequence of statements (but not
1399 for the declarations or handlers, if any, associated with this statement
1400 sequence).
1401
1402 @node Pragma Abstract_State,Pragma Acc_Parallel,Pragma Abort_Defer,Implementation Defined Pragmas
1403 @anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
1404 @section Pragma Abstract_State
1405
1406
1407 Syntax:
1408
1409 @example
1410 pragma Abstract_State (ABSTRACT_STATE_LIST);
1411
1412 ABSTRACT_STATE_LIST ::=
1413 null
1414 | STATE_NAME_WITH_OPTIONS
1415 | (STATE_NAME_WITH_OPTIONS @{, STATE_NAME_WITH_OPTIONS@} )
1416
1417 STATE_NAME_WITH_OPTIONS ::=
1418 STATE_NAME
1419 | (STATE_NAME with OPTION_LIST)
1420
1421 OPTION_LIST ::= OPTION @{, OPTION@}
1422
1423 OPTION ::=
1424 SIMPLE_OPTION
1425 | NAME_VALUE_OPTION
1426
1427 SIMPLE_OPTION ::= Ghost | Synchronous
1428
1429 NAME_VALUE_OPTION ::=
1430 Part_Of => ABSTRACT_STATE
1431 | External [=> EXTERNAL_PROPERTY_LIST]
1432
1433 EXTERNAL_PROPERTY_LIST ::=
1434 EXTERNAL_PROPERTY
1435 | (EXTERNAL_PROPERTY @{, EXTERNAL_PROPERTY@} )
1436
1437 EXTERNAL_PROPERTY ::=
1438 Async_Readers [=> boolean_EXPRESSION]
1439 | Async_Writers [=> boolean_EXPRESSION]
1440 | Effective_Reads [=> boolean_EXPRESSION]
1441 | Effective_Writes [=> boolean_EXPRESSION]
1442 others => boolean_EXPRESSION
1443
1444 STATE_NAME ::= defining_identifier
1445
1446 ABSTRACT_STATE ::= name
1447 @end example
1448
1449 For the semantics of this pragma, see the entry for aspect @code{Abstract_State} in
1450 the SPARK 2014 Reference Manual, section 7.1.4.
1451
1452 @node Pragma Acc_Parallel,Pragma Acc_Loop,Pragma Abstract_State,Implementation Defined Pragmas
1453 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-parallel}@anchor{1e}
1454 @section Pragma Acc_Parallel
1455
1456
1457 Syntax:
1458
1459 @example
1460 pragma Acc_Parallel [( ACC_PARALLEL_CLAUSE [, ACC_PARALLEL_CLAUSE... ])];
1461
1462 ACC_PARALLEL_CLAUSE ::=
1463 Acc_If => boolean_EXPRESSION
1464 | Acc_Private => IDENTIFIERS
1465 | Async => integer_EXPRESSION
1466 | Copy => IDENTIFIERS
1467 | Copy_In => IDENTIFIERS
1468 | Copy_Out => IDENTIFIERS
1469 | Create => IDENTIFIERS
1470 | Default => None
1471 | Device_Ptr => IDENTIFIERS
1472 | First_Private => IDENTIFIERS
1473 | Num_Gangs => integer_EXPRESSION
1474 | Num_Workers => integer_EXPRESSION
1475 | Present => IDENTIFIERS
1476 | Reduction => (REDUCTION_RECORD)
1477 | Vector_Length => integer_EXPRESSION
1478 | Wait => INTEGERS
1479
1480 REDUCTION_RECORD ::=
1481 "+" => IDENTIFIERS
1482 | "*" => IDENTIFIERS
1483 | "min" => IDENTIFIERS
1484 | "max" => IDENTIFIERS
1485 | "or" => IDENTIFIERS
1486 | "and" => IDENTIFIERS
1487
1488 IDENTIFIERS ::=
1489 | IDENTIFIER
1490 | (IDENTIFIER, IDENTIFIERS)
1491
1492 INTEGERS ::=
1493 | integer_EXPRESSION
1494 | (integer_EXPRESSION, INTEGERS)
1495 @end example
1496
1497 Requires the @code{-fopenacc} flag.
1498
1499 Equivalent to the @code{parallel} directive of the OpenAcc standard. This pragma
1500 should be placed in loops. It offloads the content of the loop to an
1501 accelerator device.
1502
1503 For more information about the effect of the clauses, see the OpenAcc
1504 specification.
1505
1506 @node Pragma Acc_Loop,Pragma Acc_Kernels,Pragma Acc_Parallel,Implementation Defined Pragmas
1507 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-loop}@anchor{1f}
1508 @section Pragma Acc_Loop
1509
1510
1511 Syntax:
1512
1513 @example
1514 pragma Acc_Loop [( ACC_LOOP_CLAUSE [, ACC_LOOP_CLAUSE... ])];
1515
1516 ACC_LOOP_CLAUSE ::=
1517 Auto
1518 | Collapse => INTEGER_LITERAL
1519 | Gang [=> GANG_ARG]
1520 | Independent
1521 | Private => IDENTIFIERS
1522 | Reduction => (REDUCTION_RECORD)
1523 | Seq
1524 | Tile => SIZE_EXPRESSION
1525 | Vector [=> integer_EXPRESSION]
1526 | Worker [=> integer_EXPRESSION]
1527
1528 GANG_ARG ::=
1529 integer_EXPRESSION
1530 | Static => SIZE_EXPRESSION
1531
1532 SIZE_EXPRESSION ::=
1533 *
1534 | integer_EXPRESSION
1535 @end example
1536
1537 Requires the @code{-fopenacc} flag.
1538
1539 Equivalent to the @code{loop} directive of the OpenAcc standard. This pragma
1540 should be placed in for loops after the "Acc_Parallel" pragma. It tells the
1541 compiler how to parallelize the loop.
1542
1543 For more information about the effect of the clauses, see the OpenAcc
1544 specification.
1545
1546 @node Pragma Acc_Kernels,Pragma Acc_Data,Pragma Acc_Loop,Implementation Defined Pragmas
1547 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-kernels}@anchor{20}
1548 @section Pragma Acc_Kernels
1549
1550
1551 Syntax:
1552
1553 @example
1554 pragma Acc_Kernels [( ACC_KERNELS_CLAUSE [, ACC_KERNELS_CLAUSE...])];
1555
1556 ACC_KERNELS_CLAUSE ::=
1557 Acc_If => boolean_EXPRESSION
1558 | Async => integer_EXPRESSION
1559 | Copy => IDENTIFIERS
1560 | Copy_In => IDENTIFIERS
1561 | Copy_Out => IDENTIFIERS
1562 | Create => IDENTIFIERS
1563 | Default => None
1564 | Device_Ptr => IDENTIFIERS
1565 | Num_Gangs => integer_EXPRESSION
1566 | Num_Workers => integer_EXPRESSION
1567 | Present => IDENTIFIERS
1568 | Vector_Length => integer_EXPRESSION
1569 | Wait => INTEGERS
1570
1571 IDENTIFIERS ::=
1572 | IDENTIFIER
1573 | (IDENTIFIER, IDENTIFIERS)
1574
1575 INTEGERS ::=
1576 | integer_EXPRESSION
1577 | (integer_EXPRESSION, INTEGERS)
1578 @end example
1579
1580 Requires the @code{-fopenacc} flag.
1581
1582 Equivalent to the kernels directive of the OpenAcc standard. This pragma should
1583 be placed in loops.
1584
1585 For more information about the effect of the clauses, see the OpenAcc
1586 specification.
1587
1588 @node Pragma Acc_Data,Pragma Ada_83,Pragma Acc_Kernels,Implementation Defined Pragmas
1589 @anchor{gnat_rm/implementation_defined_pragmas pragma-acc-data}@anchor{21}
1590 @section Pragma Acc_Data
1591
1592
1593 Syntax:
1594
1595 @example
1596 pragma Acc_Data ([ ACC_DATA_CLAUSE [, ACC_DATA_CLAUSE...]]);
1597
1598 ACC_DATA_CLAUSE ::=
1599 Copy => IDENTIFIERS
1600 | Copy_In => IDENTIFIERS
1601 | Copy_Out => IDENTIFIERS
1602 | Create => IDENTIFIERS
1603 | Device_Ptr => IDENTIFIERS
1604 | Present => IDENTIFIERS
1605 @end example
1606
1607 Requires the @code{-fopenacc} flag.
1608
1609 Equivalent to the @code{data} directive of the OpenAcc standard. This pragma
1610 should be placed in loops.
1611
1612 For more information about the effect of the clauses, see the OpenAcc
1613 specification.
1614
1615 @node Pragma Ada_83,Pragma Ada_95,Pragma Acc_Data,Implementation Defined Pragmas
1616 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-83}@anchor{22}
1617 @section Pragma Ada_83
1618
1619
1620 Syntax:
1621
1622 @example
1623 pragma Ada_83;
1624 @end example
1625
1626 A configuration pragma that establishes Ada 83 mode for the unit to
1627 which it applies, regardless of the mode set by the command line
1628 switches. In Ada 83 mode, GNAT attempts to be as compatible with
1629 the syntax and semantics of Ada 83, as defined in the original Ada
1630 83 Reference Manual as possible. In particular, the keywords added by Ada 95
1631 and Ada 2005 are not recognized, optional package bodies are allowed,
1632 and generics may name types with unknown discriminants without using
1633 the @code{(<>)} notation. In addition, some but not all of the additional
1634 restrictions of Ada 83 are enforced.
1635
1636 Ada 83 mode is intended for two purposes. Firstly, it allows existing
1637 Ada 83 code to be compiled and adapted to GNAT with less effort.
1638 Secondly, it aids in keeping code backwards compatible with Ada 83.
1639 However, there is no guarantee that code that is processed correctly
1640 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1641 83 compiler, since GNAT does not enforce all the additional checks
1642 required by Ada 83.
1643
1644 @node Pragma Ada_95,Pragma Ada_05,Pragma Ada_83,Implementation Defined Pragmas
1645 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-95}@anchor{23}
1646 @section Pragma Ada_95
1647
1648
1649 Syntax:
1650
1651 @example
1652 pragma Ada_95;
1653 @end example
1654
1655 A configuration pragma that establishes Ada 95 mode for the unit to which
1656 it applies, regardless of the mode set by the command line switches.
1657 This mode is set automatically for the @code{Ada} and @code{System}
1658 packages and their children, so you need not specify it in these
1659 contexts. This pragma is useful when writing a reusable component that
1660 itself uses Ada 95 features, but which is intended to be usable from
1661 either Ada 83 or Ada 95 programs.
1662
1663 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined Pragmas
1664 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{24}
1665 @section Pragma Ada_05
1666
1667
1668 Syntax:
1669
1670 @example
1671 pragma Ada_05;
1672 pragma Ada_05 (local_NAME);
1673 @end example
1674
1675 A configuration pragma that establishes Ada 2005 mode for the unit to which
1676 it applies, regardless of the mode set by the command line switches.
1677 This pragma is useful when writing a reusable component that
1678 itself uses Ada 2005 features, but which is intended to be usable from
1679 either Ada 83 or Ada 95 programs.
1680
1681 The one argument form (which is not a configuration pragma)
1682 is used for managing the transition from
1683 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
1684 as Ada_2005 only, then referencing the entity in Ada_83 or Ada_95
1685 mode will generate a warning. In addition, in Ada_83 or Ada_95
1686 mode, a preference rule is established which does not choose
1687 such an entity unless it is unambiguously specified. This avoids
1688 extra subprograms marked this way from generating ambiguities in
1689 otherwise legal pre-Ada_2005 programs. The one argument form is
1690 intended for exclusive use in the GNAT run-time library.
1691
1692 @node Pragma Ada_2005,Pragma Ada_12,Pragma Ada_05,Implementation Defined Pragmas
1693 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2005}@anchor{25}
1694 @section Pragma Ada_2005
1695
1696
1697 Syntax:
1698
1699 @example
1700 pragma Ada_2005;
1701 @end example
1702
1703 This configuration pragma is a synonym for pragma Ada_05 and has the
1704 same syntax and effect.
1705
1706 @node Pragma Ada_12,Pragma Ada_2012,Pragma Ada_2005,Implementation Defined Pragmas
1707 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-12}@anchor{26}
1708 @section Pragma Ada_12
1709
1710
1711 Syntax:
1712
1713 @example
1714 pragma Ada_12;
1715 pragma Ada_12 (local_NAME);
1716 @end example
1717
1718 A configuration pragma that establishes Ada 2012 mode for the unit to which
1719 it applies, regardless of the mode set by the command line switches.
1720 This mode is set automatically for the @code{Ada} and @code{System}
1721 packages and their children, so you need not specify it in these
1722 contexts. This pragma is useful when writing a reusable component that
1723 itself uses Ada 2012 features, but which is intended to be usable from
1724 Ada 83, Ada 95, or Ada 2005 programs.
1725
1726 The one argument form, which is not a configuration pragma,
1727 is used for managing the transition from Ada
1728 2005 to Ada 2012 in the run-time library. If an entity is marked
1729 as Ada_2012 only, then referencing the entity in any pre-Ada_2012
1730 mode will generate a warning. In addition, in any pre-Ada_2012
1731 mode, a preference rule is established which does not choose
1732 such an entity unless it is unambiguously specified. This avoids
1733 extra subprograms marked this way from generating ambiguities in
1734 otherwise legal pre-Ada_2012 programs. The one argument form is
1735 intended for exclusive use in the GNAT run-time library.
1736
1737 @node Pragma Ada_2012,Pragma Allow_Integer_Address,Pragma Ada_12,Implementation Defined Pragmas
1738 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-2012}@anchor{27}
1739 @section Pragma Ada_2012
1740
1741
1742 Syntax:
1743
1744 @example
1745 pragma Ada_2012;
1746 @end example
1747
1748 This configuration pragma is a synonym for pragma Ada_12 and has the
1749 same syntax and effect.
1750
1751 @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Ada_2012,Implementation Defined Pragmas
1752 @anchor{gnat_rm/implementation_defined_pragmas pragma-allow-integer-address}@anchor{28}
1753 @section Pragma Allow_Integer_Address
1754
1755
1756 Syntax:
1757
1758 @example
1759 pragma Allow_Integer_Address;
1760 @end example
1761
1762 In almost all versions of GNAT, @code{System.Address} is a private
1763 type in accordance with the implementation advice in the RM. This
1764 means that integer values,
1765 in particular integer literals, are not allowed as address values.
1766 If the configuration pragma
1767 @code{Allow_Integer_Address} is given, then integer expressions may
1768 be used anywhere a value of type @code{System.Address} is required.
1769 The effect is to introduce an implicit unchecked conversion from the
1770 integer value to type @code{System.Address}. The reverse case of using
1771 an address where an integer type is required is handled analogously.
1772 The following example compiles without errors:
1773
1774 @example
1775 pragma Allow_Integer_Address;
1776 with System; use System;
1777 package AddrAsInt is
1778 X : Integer;
1779 Y : Integer;
1780 for X'Address use 16#1240#;
1781 for Y use at 16#3230#;
1782 m : Address := 16#4000#;
1783 n : constant Address := 4000;
1784 p : constant Address := Address (X + Y);
1785 v : Integer := y'Address;
1786 w : constant Integer := Integer (Y'Address);
1787 type R is new integer;
1788 RR : R := 1000;
1789 Z : Integer;
1790 for Z'Address use RR;
1791 end AddrAsInt;
1792 @end example
1793
1794 Note that pragma @code{Allow_Integer_Address} is ignored if @code{System.Address}
1795 is not a private type. In implementations of @code{GNAT} where
1796 System.Address is a visible integer type,
1797 this pragma serves no purpose but is ignored
1798 rather than rejected to allow common sets of sources to be used
1799 in the two situations.
1800
1801 @node Pragma Annotate,Pragma Assert,Pragma Allow_Integer_Address,Implementation Defined Pragmas
1802 @anchor{gnat_rm/implementation_defined_pragmas pragma-annotate}@anchor{29}@anchor{gnat_rm/implementation_defined_pragmas id3}@anchor{2a}
1803 @section Pragma Annotate
1804
1805
1806 Syntax:
1807
1808 @example
1809 pragma Annotate (IDENTIFIER [, IDENTIFIER @{, ARG@}] [, entity => local_NAME]);
1810
1811 ARG ::= NAME | EXPRESSION
1812 @end example
1813
1814 This pragma is used to annotate programs. IDENTIFIER identifies
1815 the type of annotation. GNAT verifies that it is an identifier, but does
1816 not otherwise analyze it. The second optional identifier is also left
1817 unanalyzed, and by convention is used to control the action of the tool to
1818 which the annotation is addressed. The remaining ARG arguments
1819 can be either string literals or more generally expressions.
1820 String literals are assumed to be either of type
1821 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1822 depending on the character literals they contain.
1823 All other kinds of arguments are analyzed as expressions, and must be
1824 unambiguous. The last argument if present must have the identifier
1825 @code{Entity} and GNAT verifies that a local name is given.
1826
1827 The analyzed pragma is retained in the tree, but not otherwise processed
1828 by any part of the GNAT compiler, except to generate corresponding note
1829 lines in the generated ALI file. For the format of these note lines, see
1830 the compiler source file lib-writ.ads. This pragma is intended for use by
1831 external tools, including ASIS. The use of pragma Annotate does not
1832 affect the compilation process in any way. This pragma may be used as
1833 a configuration pragma.
1834
1835 @node Pragma Assert,Pragma Assert_And_Cut,Pragma Annotate,Implementation Defined Pragmas
1836 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert}@anchor{2b}
1837 @section Pragma Assert
1838
1839
1840 Syntax:
1841
1842 @example
1843 pragma Assert (
1844 boolean_EXPRESSION
1845 [, string_EXPRESSION]);
1846 @end example
1847
1848 The effect of this pragma depends on whether the corresponding command
1849 line switch is set to activate assertions. The pragma expands into code
1850 equivalent to the following:
1851
1852 @example
1853 if assertions-enabled then
1854 if not boolean_EXPRESSION then
1855 System.Assertions.Raise_Assert_Failure
1856 (string_EXPRESSION);
1857 end if;
1858 end if;
1859 @end example
1860
1861 The string argument, if given, is the message that will be associated
1862 with the exception occurrence if the exception is raised. If no second
1863 argument is given, the default message is @code{file}:@code{nnn},
1864 where @code{file} is the name of the source file containing the assert,
1865 and @code{nnn} is the line number of the assert.
1866
1867 Note that, as with the @code{if} statement to which it is equivalent, the
1868 type of the expression is either @code{Standard.Boolean}, or any type derived
1869 from this standard type.
1870
1871 Assert checks can be either checked or ignored. By default they are ignored.
1872 They will be checked if either the command line switch @emph{-gnata} is
1873 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1874 to enable @code{Assert_Checks}.
1875
1876 If assertions are ignored, then there
1877 is no run-time effect (and in particular, any side effects from the
1878 expression will not occur at run time). (The expression is still
1879 analyzed at compile time, and may cause types to be frozen if they are
1880 mentioned here for the first time).
1881
1882 If assertions are checked, then the given expression is tested, and if
1883 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1884 which results in the raising of @code{Assert_Failure} with the given message.
1885
1886 You should generally avoid side effects in the expression arguments of
1887 this pragma, because these side effects will turn on and off with the
1888 setting of the assertions mode, resulting in assertions that have an
1889 effect on the program. However, the expressions are analyzed for
1890 semantic correctness whether or not assertions are enabled, so turning
1891 assertions on and off cannot affect the legality of a program.
1892
1893 Note that the implementation defined policy @code{DISABLE}, given in a
1894 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1895
1896 Note: this is a standard language-defined pragma in versions
1897 of Ada from 2005 on. In GNAT, it is implemented in all versions
1898 of Ada, and the DISABLE policy is an implementation-defined
1899 addition.
1900
1901 @node Pragma Assert_And_Cut,Pragma Assertion_Policy,Pragma Assert,Implementation Defined Pragmas
1902 @anchor{gnat_rm/implementation_defined_pragmas pragma-assert-and-cut}@anchor{2c}
1903 @section Pragma Assert_And_Cut
1904
1905
1906 Syntax:
1907
1908 @example
1909 pragma Assert_And_Cut (
1910 boolean_EXPRESSION
1911 [, string_EXPRESSION]);
1912 @end example
1913
1914 The effect of this pragma is identical to that of pragma @code{Assert},
1915 except that in an @code{Assertion_Policy} pragma, the identifier
1916 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1917 (or disabled).
1918
1919 The intention is that this be used within a subprogram when the
1920 given test expresion sums up all the work done so far in the
1921 subprogram, so that the rest of the subprogram can be verified
1922 (informally or formally) using only the entry preconditions,
1923 and the expression in this pragma. This allows dividing up
1924 a subprogram into sections for the purposes of testing or
1925 formal verification. The pragma also serves as useful
1926 documentation.
1927
1928 @node Pragma Assertion_Policy,Pragma Assume,Pragma Assert_And_Cut,Implementation Defined Pragmas
1929 @anchor{gnat_rm/implementation_defined_pragmas pragma-assertion-policy}@anchor{2d}
1930 @section Pragma Assertion_Policy
1931
1932
1933 Syntax:
1934
1935 @example
1936 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
1937
1938 pragma Assertion_Policy (
1939 ASSERTION_KIND => POLICY_IDENTIFIER
1940 @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1941
1942 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1943
1944 RM_ASSERTION_KIND ::= Assert |
1945 Static_Predicate |
1946 Dynamic_Predicate |
1947 Pre |
1948 Pre'Class |
1949 Post |
1950 Post'Class |
1951 Type_Invariant |
1952 Type_Invariant'Class
1953
1954 ID_ASSERTION_KIND ::= Assertions |
1955 Assert_And_Cut |
1956 Assume |
1957 Contract_Cases |
1958 Debug |
1959 Ghost |
1960 Invariant |
1961 Invariant'Class |
1962 Loop_Invariant |
1963 Loop_Variant |
1964 Postcondition |
1965 Precondition |
1966 Predicate |
1967 Refined_Post |
1968 Statement_Assertions
1969
1970 POLICY_IDENTIFIER ::= Check | Disable | Ignore | Suppressible
1971 @end example
1972
1973 This is a standard Ada 2012 pragma that is available as an
1974 implementation-defined pragma in earlier versions of Ada.
1975 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1976 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1977 are implementation defined additions recognized by the GNAT compiler.
1978
1979 The pragma applies in both cases to pragmas and aspects with matching
1980 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1981 applies to both the @code{Precondition} pragma
1982 and the aspect @code{Precondition}. Note that the identifiers for
1983 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1984 Pre_Class and Post_Class), since these pragmas are intended to be
1985 identical to the corresponding aspects).
1986
1987 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1988 the corresponding pragma or aspect is activated.
1989 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1990 the corresponding pragma or aspect is deactivated.
1991 This pragma overrides the effect of the @emph{-gnata} switch on the
1992 command line.
1993 If the policy is @code{SUPPRESSIBLE}, then assertions are enabled by default,
1994 however, if the @emph{-gnatp} switch is specified all assertions are ignored.
1995
1996 The implementation defined policy @code{DISABLE} is like
1997 @code{IGNORE} except that it completely disables semantic
1998 checking of the corresponding pragma or aspect. This is
1999 useful when the pragma or aspect argument references subprograms
2000 in a with'ed package which is replaced by a dummy package
2001 for the final build.
2002
2003 The implementation defined assertion kind @code{Assertions} applies to all
2004 assertion kinds. The form with no assertion kind given implies this
2005 choice, so it applies to all assertion kinds (RM defined, and
2006 implementation defined).
2007
2008 The implementation defined assertion kind @code{Statement_Assertions}
2009 applies to @code{Assert}, @code{Assert_And_Cut},
2010 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
2011
2012 @node Pragma Assume,Pragma Assume_No_Invalid_Values,Pragma Assertion_Policy,Implementation Defined Pragmas
2013 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume}@anchor{2e}
2014 @section Pragma Assume
2015
2016
2017 Syntax:
2018
2019 @example
2020 pragma Assume (
2021 boolean_EXPRESSION
2022 [, string_EXPRESSION]);
2023 @end example
2024
2025 The effect of this pragma is identical to that of pragma @code{Assert},
2026 except that in an @code{Assertion_Policy} pragma, the identifier
2027 @code{Assume} is used to control whether it is ignored or checked
2028 (or disabled).
2029
2030 The intention is that this be used for assumptions about the
2031 external environment. So you cannot expect to verify formally
2032 or informally that the condition is met, this must be
2033 established by examining things outside the program itself.
2034 For example, we may have code that depends on the size of
2035 @code{Long_Long_Integer} being at least 64. So we could write:
2036
2037 @example
2038 pragma Assume (Long_Long_Integer'Size >= 64);
2039 @end example
2040
2041 This assumption cannot be proved from the program itself,
2042 but it acts as a useful run-time check that the assumption
2043 is met, and documents the need to ensure that it is met by
2044 reference to information outside the program.
2045
2046 @node Pragma Assume_No_Invalid_Values,Pragma Async_Readers,Pragma Assume,Implementation Defined Pragmas
2047 @anchor{gnat_rm/implementation_defined_pragmas pragma-assume-no-invalid-values}@anchor{2f}
2048 @section Pragma Assume_No_Invalid_Values
2049
2050
2051 @geindex Invalid representations
2052
2053 @geindex Invalid values
2054
2055 Syntax:
2056
2057 @example
2058 pragma Assume_No_Invalid_Values (On | Off);
2059 @end example
2060
2061 This is a configuration pragma that controls the assumptions made by the
2062 compiler about the occurrence of invalid representations (invalid values)
2063 in the code.
2064
2065 The default behavior (corresponding to an Off argument for this pragma), is
2066 to assume that values may in general be invalid unless the compiler can
2067 prove they are valid. Consider the following example:
2068
2069 @example
2070 V1 : Integer range 1 .. 10;
2071 V2 : Integer range 11 .. 20;
2072 ...
2073 for J in V2 .. V1 loop
2074 ...
2075 end loop;
2076 @end example
2077
2078 if V1 and V2 have valid values, then the loop is known at compile
2079 time not to execute since the lower bound must be greater than the
2080 upper bound. However in default mode, no such assumption is made,
2081 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
2082 is given, the compiler will assume that any occurrence of a variable
2083 other than in an explicit @code{'Valid} test always has a valid
2084 value, and the loop above will be optimized away.
2085
2086 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
2087 you know your code is free of uninitialized variables and other
2088 possible sources of invalid representations, and may result in
2089 more efficient code. A program that accesses an invalid representation
2090 with this pragma in effect is erroneous, so no guarantees can be made
2091 about its behavior.
2092
2093 It is peculiar though permissible to use this pragma in conjunction
2094 with validity checking (-gnatVa). In such cases, accessing invalid
2095 values will generally give an exception, though formally the program
2096 is erroneous so there are no guarantees that this will always be the
2097 case, and it is recommended that these two options not be used together.
2098
2099 @node Pragma Async_Readers,Pragma Async_Writers,Pragma Assume_No_Invalid_Values,Implementation Defined Pragmas
2100 @anchor{gnat_rm/implementation_defined_pragmas pragma-async-readers}@anchor{30}@anchor{gnat_rm/implementation_defined_pragmas id4}@anchor{31}
2101 @section Pragma Async_Readers
2102
2103
2104 Syntax:
2105
2106 @example
2107 pragma Asynch_Readers [ (boolean_EXPRESSION) ];
2108 @end example
2109
2110 For the semantics of this pragma, see the entry for aspect @code{Async_Readers} in
2111 the SPARK 2014 Reference Manual, section 7.1.2.
2112
2113 @node Pragma Async_Writers,Pragma Attribute_Definition,Pragma Async_Readers,Implementation Defined Pragmas
2114 @anchor{gnat_rm/implementation_defined_pragmas id5}@anchor{32}@anchor{gnat_rm/implementation_defined_pragmas pragma-async-writers}@anchor{33}
2115 @section Pragma Async_Writers
2116
2117
2118 Syntax:
2119
2120 @example
2121 pragma Asynch_Writers [ (boolean_EXPRESSION) ];
2122 @end example
2123
2124 For the semantics of this pragma, see the entry for aspect @code{Async_Writers} in
2125 the SPARK 2014 Reference Manual, section 7.1.2.
2126
2127 @node Pragma Attribute_Definition,Pragma C_Pass_By_Copy,Pragma Async_Writers,Implementation Defined Pragmas
2128 @anchor{gnat_rm/implementation_defined_pragmas pragma-attribute-definition}@anchor{34}
2129 @section Pragma Attribute_Definition
2130
2131
2132 Syntax:
2133
2134 @example
2135 pragma Attribute_Definition
2136 ([Attribute =>] ATTRIBUTE_DESIGNATOR,
2137 [Entity =>] LOCAL_NAME,
2138 [Expression =>] EXPRESSION | NAME);
2139 @end example
2140
2141 If @code{Attribute} is a known attribute name, this pragma is equivalent to
2142 the attribute definition clause:
2143
2144 @example
2145 for Entity'Attribute use Expression;
2146 @end example
2147
2148 If @code{Attribute} is not a recognized attribute name, the pragma is
2149 ignored, and a warning is emitted. This allows source
2150 code to be written that takes advantage of some new attribute, while remaining
2151 compilable with earlier compilers.
2152
2153 @node Pragma C_Pass_By_Copy,Pragma Check,Pragma Attribute_Definition,Implementation Defined Pragmas
2154 @anchor{gnat_rm/implementation_defined_pragmas pragma-c-pass-by-copy}@anchor{35}
2155 @section Pragma C_Pass_By_Copy
2156
2157
2158 @geindex Passing by copy
2159
2160 Syntax:
2161
2162 @example
2163 pragma C_Pass_By_Copy
2164 ([Max_Size =>] static_integer_EXPRESSION);
2165 @end example
2166
2167 Normally the default mechanism for passing C convention records to C
2168 convention subprograms is to pass them by reference, as suggested by RM
2169 B.3(69). Use the configuration pragma @code{C_Pass_By_Copy} to change
2170 this default, by requiring that record formal parameters be passed by
2171 copy if all of the following conditions are met:
2172
2173
2174 @itemize *
2175
2176 @item
2177 The size of the record type does not exceed the value specified for
2178 @code{Max_Size}.
2179
2180 @item
2181 The record type has @code{Convention C}.
2182
2183 @item
2184 The formal parameter has this record type, and the subprogram has a
2185 foreign (non-Ada) convention.
2186 @end itemize
2187
2188 If these conditions are met the argument is passed by copy; i.e., in a
2189 manner consistent with what C expects if the corresponding formal in the
2190 C prototype is a struct (rather than a pointer to a struct).
2191
2192 You can also pass records by copy by specifying the convention
2193 @code{C_Pass_By_Copy} for the record type, or by using the extended
2194 @code{Import} and @code{Export} pragmas, which allow specification of
2195 passing mechanisms on a parameter by parameter basis.
2196
2197 @node Pragma Check,Pragma Check_Float_Overflow,Pragma C_Pass_By_Copy,Implementation Defined Pragmas
2198 @anchor{gnat_rm/implementation_defined_pragmas pragma-check}@anchor{36}
2199 @section Pragma Check
2200
2201
2202 @geindex Assertions
2203
2204 @geindex Named assertions
2205
2206 Syntax:
2207
2208 @example
2209 pragma Check (
2210 [Name =>] CHECK_KIND,
2211 [Check =>] Boolean_EXPRESSION
2212 [, [Message =>] string_EXPRESSION] );
2213
2214 CHECK_KIND ::= IDENTIFIER |
2215 Pre'Class |
2216 Post'Class |
2217 Type_Invariant'Class |
2218 Invariant'Class
2219 @end example
2220
2221 This pragma is similar to the predefined pragma @code{Assert} except that an
2222 extra identifier argument is present. In conjunction with pragma
2223 @code{Check_Policy}, this can be used to define groups of assertions that can
2224 be independently controlled. The identifier @code{Assertion} is special, it
2225 refers to the normal set of pragma @code{Assert} statements.
2226
2227 Checks introduced by this pragma are normally deactivated by default. They can
2228 be activated either by the command line option @emph{-gnata}, which turns on
2229 all checks, or individually controlled using pragma @code{Check_Policy}.
2230
2231 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
2232 permitted as check kinds, since this would cause confusion with the use
2233 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
2234 pragmas, where they are used to refer to sets of assertions.
2235
2236 @node Pragma Check_Float_Overflow,Pragma Check_Name,Pragma Check,Implementation Defined Pragmas
2237 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-float-overflow}@anchor{37}
2238 @section Pragma Check_Float_Overflow
2239
2240
2241 @geindex Floating-point overflow
2242
2243 Syntax:
2244
2245 @example
2246 pragma Check_Float_Overflow;
2247 @end example
2248
2249 In Ada, the predefined floating-point types (@code{Short_Float},
2250 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
2251 defined to be @emph{unconstrained}. This means that even though each
2252 has a well-defined base range, an operation that delivers a result
2253 outside this base range is not required to raise an exception.
2254 This implementation permission accommodates the notion
2255 of infinities in IEEE floating-point, and corresponds to the
2256 efficient execution mode on most machines. GNAT will not raise
2257 overflow exceptions on these machines; instead it will generate
2258 infinities and NaN's as defined in the IEEE standard.
2259
2260 Generating infinities, although efficient, is not always desirable.
2261 Often the preferable approach is to check for overflow, even at the
2262 (perhaps considerable) expense of run-time performance.
2263 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
2264 range constraints -- and indeed such a subtype
2265 can have the same base range as its base type. For example:
2266
2267 @example
2268 subtype My_Float is Float range Float'Range;
2269 @end example
2270
2271 Here @code{My_Float} has the same range as
2272 @code{Float} but is constrained, so operations on
2273 @code{My_Float} values will be checked for overflow
2274 against this range.
2275
2276 This style will achieve the desired goal, but
2277 it is often more convenient to be able to simply use
2278 the standard predefined floating-point types as long
2279 as overflow checking could be guaranteed.
2280 The @code{Check_Float_Overflow}
2281 configuration pragma achieves this effect. If a unit is compiled
2282 subject to this configuration pragma, then all operations
2283 on predefined floating-point types including operations on
2284 base types of these floating-point types will be treated as
2285 though those types were constrained, and overflow checks
2286 will be generated. The @code{Constraint_Error}
2287 exception is raised if the result is out of range.
2288
2289 This mode can also be set by use of the compiler
2290 switch @emph{-gnateF}.
2291
2292 @node Pragma Check_Name,Pragma Check_Policy,Pragma Check_Float_Overflow,Implementation Defined Pragmas
2293 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-name}@anchor{38}
2294 @section Pragma Check_Name
2295
2296
2297 @geindex Defining check names
2298
2299 @geindex Check names
2300 @geindex defining
2301
2302 Syntax:
2303
2304 @example
2305 pragma Check_Name (check_name_IDENTIFIER);
2306 @end example
2307
2308 This is a configuration pragma that defines a new implementation
2309 defined check name (unless IDENTIFIER matches one of the predefined
2310 check names, in which case the pragma has no effect). Check names
2311 are global to a partition, so if two or more configuration pragmas
2312 are present in a partition mentioning the same name, only one new
2313 check name is introduced.
2314
2315 An implementation defined check name introduced with this pragma may
2316 be used in only three contexts: @code{pragma Suppress},
2317 @code{pragma Unsuppress},
2318 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
2319 any of these three cases, the check name must be visible. A check
2320 name is visible if it is in the configuration pragmas applying to
2321 the current unit, or if it appears at the start of any unit that
2322 is part of the dependency set of the current unit (e.g., units that
2323 are mentioned in @code{with} clauses).
2324
2325 Check names introduced by this pragma are subject to control by compiler
2326 switches (in particular -gnatp) in the usual manner.
2327
2328 @node Pragma Check_Policy,Pragma Comment,Pragma Check_Name,Implementation Defined Pragmas
2329 @anchor{gnat_rm/implementation_defined_pragmas pragma-check-policy}@anchor{39}
2330 @section Pragma Check_Policy
2331
2332
2333 @geindex Controlling assertions
2334
2335 @geindex Assertions
2336 @geindex control
2337
2338 @geindex Check pragma control
2339
2340 @geindex Named assertions
2341
2342 Syntax:
2343
2344 @example
2345 pragma Check_Policy
2346 ([Name =>] CHECK_KIND,
2347 [Policy =>] POLICY_IDENTIFIER);
2348
2349 pragma Check_Policy (
2350 CHECK_KIND => POLICY_IDENTIFIER
2351 @{, CHECK_KIND => POLICY_IDENTIFIER@});
2352
2353 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
2354
2355 CHECK_KIND ::= IDENTIFIER |
2356 Pre'Class |
2357 Post'Class |
2358 Type_Invariant'Class |
2359 Invariant'Class
2360
2361 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
2362 avoids confusion between the two possible syntax forms for this pragma.
2363
2364 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
2365 @end example
2366
2367 This pragma is used to set the checking policy for assertions (specified
2368 by aspects or pragmas), the @code{Debug} pragma, or additional checks
2369 to be checked using the @code{Check} pragma. It may appear either as
2370 a configuration pragma, or within a declarative part of package. In the
2371 latter case, it applies from the point where it appears to the end of
2372 the declarative region (like pragma @code{Suppress}).
2373
2374 The @code{Check_Policy} pragma is similar to the
2375 predefined @code{Assertion_Policy} pragma,
2376 and if the check kind corresponds to one of the assertion kinds that
2377 are allowed by @code{Assertion_Policy}, then the effect is identical.
2378
2379 If the first argument is Debug, then the policy applies to Debug pragmas,
2380 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
2381 @code{IGNORE}, and allowing them to execute with normal semantics if
2382 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
2383 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
2384 be totally ignored and not analyzed semantically.
2385
2386 Finally the first argument may be some other identifier than the above
2387 possibilities, in which case it controls a set of named assertions
2388 that can be checked using pragma @code{Check}. For example, if the pragma:
2389
2390 @example
2391 pragma Check_Policy (Critical_Error, OFF);
2392 @end example
2393
2394 is given, then subsequent @code{Check} pragmas whose first argument is also
2395 @code{Critical_Error} will be disabled.
2396
2397 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
2398 to turn on corresponding checks. The default for a set of checks for which no
2399 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
2400 @emph{-gnata} is given, which turns on all checks by default.
2401
2402 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
2403 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
2404 compatibility with the standard @code{Assertion_Policy} pragma. The check
2405 policy setting @code{DISABLE} causes the second argument of a corresponding
2406 @code{Check} pragma to be completely ignored and not analyzed.
2407
2408 @node Pragma Comment,Pragma Common_Object,Pragma Check_Policy,Implementation Defined Pragmas
2409 @anchor{gnat_rm/implementation_defined_pragmas pragma-comment}@anchor{3a}
2410 @section Pragma Comment
2411
2412
2413 Syntax:
2414
2415 @example
2416 pragma Comment (static_string_EXPRESSION);
2417 @end example
2418
2419 This is almost identical in effect to pragma @code{Ident}. It allows the
2420 placement of a comment into the object file and hence into the
2421 executable file if the operating system permits such usage. The
2422 difference is that @code{Comment}, unlike @code{Ident}, has
2423 no limitations on placement of the pragma (it can be placed
2424 anywhere in the main source unit), and if more than one pragma
2425 is used, all comments are retained.
2426
2427 @node Pragma Common_Object,Pragma Compile_Time_Error,Pragma Comment,Implementation Defined Pragmas
2428 @anchor{gnat_rm/implementation_defined_pragmas pragma-common-object}@anchor{3b}
2429 @section Pragma Common_Object
2430
2431
2432 Syntax:
2433
2434 @example
2435 pragma Common_Object (
2436 [Internal =>] LOCAL_NAME
2437 [, [External =>] EXTERNAL_SYMBOL]
2438 [, [Size =>] EXTERNAL_SYMBOL] );
2439
2440 EXTERNAL_SYMBOL ::=
2441 IDENTIFIER
2442 | static_string_EXPRESSION
2443 @end example
2444
2445 This pragma enables the shared use of variables stored in overlaid
2446 linker areas corresponding to the use of @code{COMMON}
2447 in Fortran. The single
2448 object @code{LOCAL_NAME} is assigned to the area designated by
2449 the @code{External} argument.
2450 You may define a record to correspond to a series
2451 of fields. The @code{Size} argument
2452 is syntax checked in GNAT, but otherwise ignored.
2453
2454 @code{Common_Object} is not supported on all platforms. If no
2455 support is available, then the code generator will issue a message
2456 indicating that the necessary attribute for implementation of this
2457 pragma is not available.
2458
2459 @node Pragma Compile_Time_Error,Pragma Compile_Time_Warning,Pragma Common_Object,Implementation Defined Pragmas
2460 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-error}@anchor{3c}
2461 @section Pragma Compile_Time_Error
2462
2463
2464 Syntax:
2465
2466 @example
2467 pragma Compile_Time_Error
2468 (boolean_EXPRESSION, static_string_EXPRESSION);
2469 @end example
2470
2471 This pragma can be used to generate additional compile time
2472 error messages. It
2473 is particularly useful in generics, where errors can be issued for
2474 specific problematic instantiations. The first parameter is a boolean
2475 expression. The pragma is effective only if the value of this expression
2476 is known at compile time, and has the value True. The set of expressions
2477 whose values are known at compile time includes all static boolean
2478 expressions, and also other values which the compiler can determine
2479 at compile time (e.g., the size of a record type set by an explicit
2480 size representation clause, or the value of a variable which was
2481 initialized to a constant and is known not to have been modified).
2482 If these conditions are met, an error message is generated using
2483 the value given as the second argument. This string value may contain
2484 embedded ASCII.LF characters to break the message into multiple lines.
2485
2486 @node Pragma Compile_Time_Warning,Pragma Compiler_Unit,Pragma Compile_Time_Error,Implementation Defined Pragmas
2487 @anchor{gnat_rm/implementation_defined_pragmas pragma-compile-time-warning}@anchor{3d}
2488 @section Pragma Compile_Time_Warning
2489
2490
2491 Syntax:
2492
2493 @example
2494 pragma Compile_Time_Warning
2495 (boolean_EXPRESSION, static_string_EXPRESSION);
2496 @end example
2497
2498 Same as pragma Compile_Time_Error, except a warning is issued instead
2499 of an error message. Note that if this pragma is used in a package that
2500 is with'ed by a client, the client will get the warning even though it
2501 is issued by a with'ed package (normally warnings in with'ed units are
2502 suppressed, but this is a special exception to that rule).
2503
2504 One typical use is within a generic where compile time known characteristics
2505 of formal parameters are tested, and warnings given appropriately. Another use
2506 with a first parameter of True is to warn a client about use of a package,
2507 for example that it is not fully implemented.
2508
2509 @node Pragma Compiler_Unit,Pragma Compiler_Unit_Warning,Pragma Compile_Time_Warning,Implementation Defined Pragmas
2510 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit}@anchor{3e}
2511 @section Pragma Compiler_Unit
2512
2513
2514 Syntax:
2515
2516 @example
2517 pragma Compiler_Unit;
2518 @end example
2519
2520 This pragma is obsolete. It is equivalent to Compiler_Unit_Warning. It is
2521 retained so that old versions of the GNAT run-time that use this pragma can
2522 be compiled with newer versions of the compiler.
2523
2524 @node Pragma Compiler_Unit_Warning,Pragma Complete_Representation,Pragma Compiler_Unit,Implementation Defined Pragmas
2525 @anchor{gnat_rm/implementation_defined_pragmas pragma-compiler-unit-warning}@anchor{3f}
2526 @section Pragma Compiler_Unit_Warning
2527
2528
2529 Syntax:
2530
2531 @example
2532 pragma Compiler_Unit_Warning;
2533 @end example
2534
2535 This pragma is intended only for internal use in the GNAT run-time library.
2536 It indicates that the unit is used as part of the compiler build. The effect
2537 is to generate warnings for the use of constructs (for example, conditional
2538 expressions) that would cause trouble when bootstrapping using an older
2539 version of GNAT. For the exact list of restrictions, see the compiler sources
2540 and references to Check_Compiler_Unit.
2541
2542 @node Pragma Complete_Representation,Pragma Complex_Representation,Pragma Compiler_Unit_Warning,Implementation Defined Pragmas
2543 @anchor{gnat_rm/implementation_defined_pragmas pragma-complete-representation}@anchor{40}
2544 @section Pragma Complete_Representation
2545
2546
2547 Syntax:
2548
2549 @example
2550 pragma Complete_Representation;
2551 @end example
2552
2553 This pragma must appear immediately within a record representation
2554 clause. Typical placements are before the first component clause
2555 or after the last component clause. The effect is to give an error
2556 message if any component is missing a component clause. This pragma
2557 may be used to ensure that a record representation clause is
2558 complete, and that this invariant is maintained if fields are
2559 added to the record in the future.
2560
2561 @node Pragma Complex_Representation,Pragma Component_Alignment,Pragma Complete_Representation,Implementation Defined Pragmas
2562 @anchor{gnat_rm/implementation_defined_pragmas pragma-complex-representation}@anchor{41}
2563 @section Pragma Complex_Representation
2564
2565
2566 Syntax:
2567
2568 @example
2569 pragma Complex_Representation
2570 ([Entity =>] LOCAL_NAME);
2571 @end example
2572
2573 The @code{Entity} argument must be the name of a record type which has
2574 two fields of the same floating-point type. The effect of this pragma is
2575 to force gcc to use the special internal complex representation form for
2576 this record, which may be more efficient. Note that this may result in
2577 the code for this type not conforming to standard ABI (application
2578 binary interface) requirements for the handling of record types. For
2579 example, in some environments, there is a requirement for passing
2580 records by pointer, and the use of this pragma may result in passing
2581 this type in floating-point registers.
2582
2583 @node Pragma Component_Alignment,Pragma Constant_After_Elaboration,Pragma Complex_Representation,Implementation Defined Pragmas
2584 @anchor{gnat_rm/implementation_defined_pragmas pragma-component-alignment}@anchor{42}
2585 @section Pragma Component_Alignment
2586
2587
2588 @geindex Alignments of components
2589
2590 @geindex Pragma Component_Alignment
2591
2592 Syntax:
2593
2594 @example
2595 pragma Component_Alignment (
2596 [Form =>] ALIGNMENT_CHOICE
2597 [, [Name =>] type_LOCAL_NAME]);
2598
2599 ALIGNMENT_CHOICE ::=
2600 Component_Size
2601 | Component_Size_4
2602 | Storage_Unit
2603 | Default
2604 @end example
2605
2606 Specifies the alignment of components in array or record types.
2607 The meaning of the @code{Form} argument is as follows:
2608
2609 @quotation
2610
2611 @geindex Component_Size (in pragma Component_Alignment)
2612 @end quotation
2613
2614
2615 @table @asis
2616
2617 @item @emph{Component_Size}
2618
2619 Aligns scalar components and subcomponents of the array or record type
2620 on boundaries appropriate to their inherent size (naturally
2621 aligned). For example, 1-byte components are aligned on byte boundaries,
2622 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2623 integer components are aligned on 4-byte boundaries and so on. These
2624 alignment rules correspond to the normal rules for C compilers on all
2625 machines except the VAX.
2626
2627 @geindex Component_Size_4 (in pragma Component_Alignment)
2628
2629 @item @emph{Component_Size_4}
2630
2631 Naturally aligns components with a size of four or fewer
2632 bytes. Components that are larger than 4 bytes are placed on the next
2633 4-byte boundary.
2634
2635 @geindex Storage_Unit (in pragma Component_Alignment)
2636
2637 @item @emph{Storage_Unit}
2638
2639 Specifies that array or record components are byte aligned, i.e.,
2640 aligned on boundaries determined by the value of the constant
2641 @code{System.Storage_Unit}.
2642
2643 @geindex Default (in pragma Component_Alignment)
2644
2645 @item @emph{Default}
2646
2647 Specifies that array or record components are aligned on default
2648 boundaries, appropriate to the underlying hardware or operating system or
2649 both. The @code{Default} choice is the same as @code{Component_Size} (natural
2650 alignment).
2651 @end table
2652
2653 If the @code{Name} parameter is present, @code{type_LOCAL_NAME} must
2654 refer to a local record or array type, and the specified alignment
2655 choice applies to the specified type. The use of
2656 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2657 @code{Component_Alignment} pragma to be ignored. The use of
2658 @code{Component_Alignment} together with a record representation clause
2659 is only effective for fields not specified by the representation clause.
2660
2661 If the @code{Name} parameter is absent, the pragma can be used as either
2662 a configuration pragma, in which case it applies to one or more units in
2663 accordance with the normal rules for configuration pragmas, or it can be
2664 used within a declarative part, in which case it applies to types that
2665 are declared within this declarative part, or within any nested scope
2666 within this declarative part. In either case it specifies the alignment
2667 to be applied to any record or array type which has otherwise standard
2668 representation.
2669
2670 If the alignment for a record or array type is not specified (using
2671 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2672 clause), the GNAT uses the default alignment as described previously.
2673
2674 @node Pragma Constant_After_Elaboration,Pragma Contract_Cases,Pragma Component_Alignment,Implementation Defined Pragmas
2675 @anchor{gnat_rm/implementation_defined_pragmas id6}@anchor{43}@anchor{gnat_rm/implementation_defined_pragmas pragma-constant-after-elaboration}@anchor{44}
2676 @section Pragma Constant_After_Elaboration
2677
2678
2679 Syntax:
2680
2681 @example
2682 pragma Constant_After_Elaboration [ (boolean_EXPRESSION) ];
2683 @end example
2684
2685 For the semantics of this pragma, see the entry for aspect
2686 @code{Constant_After_Elaboration} in the SPARK 2014 Reference Manual, section 3.3.1.
2687
2688 @node Pragma Contract_Cases,Pragma Convention_Identifier,Pragma Constant_After_Elaboration,Implementation Defined Pragmas
2689 @anchor{gnat_rm/implementation_defined_pragmas id7}@anchor{45}@anchor{gnat_rm/implementation_defined_pragmas pragma-contract-cases}@anchor{46}
2690 @section Pragma Contract_Cases
2691
2692
2693 @geindex Contract cases
2694
2695 Syntax:
2696
2697 @example
2698 pragma Contract_Cases ((CONTRACT_CASE @{, CONTRACT_CASE));
2699
2700 CONTRACT_CASE ::= CASE_GUARD => CONSEQUENCE
2701
2702 CASE_GUARD ::= boolean_EXPRESSION | others
2703
2704 CONSEQUENCE ::= boolean_EXPRESSION
2705 @end example
2706
2707 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2708 that can complement or replace the contract given by a precondition and a
2709 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2710 by testing and formal verification tools. The compiler checks its validity and,
2711 depending on the assertion policy at the point of declaration of the pragma,
2712 it may insert a check in the executable. For code generation, the contract
2713 cases
2714
2715 @example
2716 pragma Contract_Cases (
2717 Cond1 => Pred1,
2718 Cond2 => Pred2);
2719 @end example
2720
2721 are equivalent to
2722
2723 @example
2724 C1 : constant Boolean := Cond1; -- evaluated at subprogram entry
2725 C2 : constant Boolean := Cond2; -- evaluated at subprogram entry
2726 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2727 pragma Postcondition (if C1 then Pred1);
2728 pragma Postcondition (if C2 then Pred2);
2729 @end example
2730
2731 The precondition ensures that one and only one of the case guards is
2732 satisfied on entry to the subprogram.
2733 The postcondition ensures that for the case guard that was True on entry,
2734 the corrresponding consequence is True on exit. Other consequence expressions
2735 are not evaluated.
2736
2737 A precondition @code{P} and postcondition @code{Q} can also be
2738 expressed as contract cases:
2739
2740 @example
2741 pragma Contract_Cases (P => Q);
2742 @end example
2743
2744 The placement and visibility rules for @code{Contract_Cases} pragmas are
2745 identical to those described for preconditions and postconditions.
2746
2747 The compiler checks that boolean expressions given in case guards and
2748 consequences are valid, where the rules for case guards are the same as
2749 the rule for an expression in @code{Precondition} and the rules for
2750 consequences are the same as the rule for an expression in
2751 @code{Postcondition}. In particular, attributes @code{'Old} and
2752 @code{'Result} can only be used within consequence expressions.
2753 The case guard for the last contract case may be @code{others}, to denote
2754 any case not captured by the previous cases. The
2755 following is an example of use within a package spec:
2756
2757 @example
2758 package Math_Functions is
2759 ...
2760 function Sqrt (Arg : Float) return Float;
2761 pragma Contract_Cases (((Arg in 0.0 .. 99.0) => Sqrt'Result < 10.0,
2762 Arg >= 100.0 => Sqrt'Result >= 10.0,
2763 others => Sqrt'Result = 0.0));
2764 ...
2765 end Math_Functions;
2766 @end example
2767
2768 The meaning of contract cases is that only one case should apply at each
2769 call, as determined by the corresponding case guard evaluating to True,
2770 and that the consequence for this case should hold when the subprogram
2771 returns.
2772
2773 @node Pragma Convention_Identifier,Pragma CPP_Class,Pragma Contract_Cases,Implementation Defined Pragmas
2774 @anchor{gnat_rm/implementation_defined_pragmas pragma-convention-identifier}@anchor{47}
2775 @section Pragma Convention_Identifier
2776
2777
2778 @geindex Conventions
2779 @geindex synonyms
2780
2781 Syntax:
2782
2783 @example
2784 pragma Convention_Identifier (
2785 [Name =>] IDENTIFIER,
2786 [Convention =>] convention_IDENTIFIER);
2787 @end example
2788
2789 This pragma provides a mechanism for supplying synonyms for existing
2790 convention identifiers. The @code{Name} identifier can subsequently
2791 be used as a synonym for the given convention in other pragmas (including
2792 for example pragma @code{Import} or another @code{Convention_Identifier}
2793 pragma). As an example of the use of this, suppose you had legacy code
2794 which used Fortran77 as the identifier for Fortran. Then the pragma:
2795
2796 @example
2797 pragma Convention_Identifier (Fortran77, Fortran);
2798 @end example
2799
2800 would allow the use of the convention identifier @code{Fortran77} in
2801 subsequent code, avoiding the need to modify the sources. As another
2802 example, you could use this to parameterize convention requirements
2803 according to systems. Suppose you needed to use @code{Stdcall} on
2804 windows systems, and @code{C} on some other system, then you could
2805 define a convention identifier @code{Library} and use a single
2806 @code{Convention_Identifier} pragma to specify which convention
2807 would be used system-wide.
2808
2809 @node Pragma CPP_Class,Pragma CPP_Constructor,Pragma Convention_Identifier,Implementation Defined Pragmas
2810 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-class}@anchor{48}
2811 @section Pragma CPP_Class
2812
2813
2814 @geindex Interfacing with C++
2815
2816 Syntax:
2817
2818 @example
2819 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2820 @end example
2821
2822 The argument denotes an entity in the current declarative region that is
2823 declared as a record type. It indicates that the type corresponds to an
2824 externally declared C++ class type, and is to be laid out the same way
2825 that C++ would lay out the type. If the C++ class has virtual primitives
2826 then the record must be declared as a tagged record type.
2827
2828 Types for which @code{CPP_Class} is specified do not have assignment or
2829 equality operators defined (such operations can be imported or declared
2830 as subprograms as required). Initialization is allowed only by constructor
2831 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2832 limited if not explicitly declared as limited or derived from a limited
2833 type, and an error is issued in that case.
2834
2835 See @ref{49,,Interfacing to C++} for related information.
2836
2837 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2838 for backward compatibility but its functionality is available
2839 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2840
2841 @node Pragma CPP_Constructor,Pragma CPP_Virtual,Pragma CPP_Class,Implementation Defined Pragmas
2842 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-constructor}@anchor{4a}
2843 @section Pragma CPP_Constructor
2844
2845
2846 @geindex Interfacing with C++
2847
2848 Syntax:
2849
2850 @example
2851 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2852 [, [External_Name =>] static_string_EXPRESSION ]
2853 [, [Link_Name =>] static_string_EXPRESSION ]);
2854 @end example
2855
2856 This pragma identifies an imported function (imported in the usual way
2857 with pragma @code{Import}) as corresponding to a C++ constructor. If
2858 @code{External_Name} and @code{Link_Name} are not specified then the
2859 @code{Entity} argument is a name that must have been previously mentioned
2860 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2861 must be of one of the following forms:
2862
2863
2864 @itemize *
2865
2866 @item
2867 @strong{function} @code{Fname} @strong{return} T`
2868
2869 @item
2870 @strong{function} @code{Fname} @strong{return} T'Class
2871
2872 @item
2873 @strong{function} @code{Fname} (...) @strong{return} T`
2874
2875 @item
2876 @strong{function} @code{Fname} (...) @strong{return} T'Class
2877 @end itemize
2878
2879 where @code{T} is a limited record type imported from C++ with pragma
2880 @code{Import} and @code{Convention} = @code{CPP}.
2881
2882 The first two forms import the default constructor, used when an object
2883 of type @code{T} is created on the Ada side with no explicit constructor.
2884 The latter two forms cover all the non-default constructors of the type.
2885 See the GNAT User's Guide for details.
2886
2887 If no constructors are imported, it is impossible to create any objects
2888 on the Ada side and the type is implicitly declared abstract.
2889
2890 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2891 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2892 GCC switch).
2893 See @ref{49,,Interfacing to C++} for more related information.
2894
2895 Note: The use of functions returning class-wide types for constructors is
2896 currently obsolete. They are supported for backward compatibility. The
2897 use of functions returning the type T leave the Ada sources more clear
2898 because the imported C++ constructors always return an object of type T;
2899 that is, they never return an object whose type is a descendant of type T.
2900
2901 @node Pragma CPP_Virtual,Pragma CPP_Vtable,Pragma CPP_Constructor,Implementation Defined Pragmas
2902 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-virtual}@anchor{4b}
2903 @section Pragma CPP_Virtual
2904
2905
2906 @geindex Interfacing to C++
2907
2908 This pragma is now obsolete and, other than generating a warning if warnings
2909 on obsolescent features are enabled, is completely ignored.
2910 It is retained for compatibility
2911 purposes. It used to be required to ensure compoatibility with C++, but
2912 is no longer required for that purpose because GNAT generates
2913 the same object layout as the G++ compiler by default.
2914
2915 See @ref{49,,Interfacing to C++} for related information.
2916
2917 @node Pragma CPP_Vtable,Pragma CPU,Pragma CPP_Virtual,Implementation Defined Pragmas
2918 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpp-vtable}@anchor{4c}
2919 @section Pragma CPP_Vtable
2920
2921
2922 @geindex Interfacing with C++
2923
2924 This pragma is now obsolete and, other than generating a warning if warnings
2925 on obsolescent features are enabled, is completely ignored.
2926 It used to be required to ensure compatibility with C++, but
2927 is no longer required for that purpose because GNAT generates
2928 the same object layout as the G++ compiler by default.
2929
2930 See @ref{49,,Interfacing to C++} for related information.
2931
2932 @node Pragma CPU,Pragma Deadline_Floor,Pragma CPP_Vtable,Implementation Defined Pragmas
2933 @anchor{gnat_rm/implementation_defined_pragmas pragma-cpu}@anchor{4d}
2934 @section Pragma CPU
2935
2936
2937 Syntax:
2938
2939 @example
2940 pragma CPU (EXPRESSION);
2941 @end example
2942
2943 This pragma is standard in Ada 2012, but is available in all earlier
2944 versions of Ada as an implementation-defined pragma.
2945 See Ada 2012 Reference Manual for details.
2946
2947 @node Pragma Deadline_Floor,Pragma Default_Initial_Condition,Pragma CPU,Implementation Defined Pragmas
2948 @anchor{gnat_rm/implementation_defined_pragmas pragma-deadline-floor}@anchor{4e}
2949 @section Pragma Deadline_Floor
2950
2951
2952 Syntax:
2953
2954 @example
2955 pragma Deadline_Floor (time_span_EXPRESSION);
2956 @end example
2957
2958 This pragma applies only to protected types and specifies the floor
2959 deadline inherited by a task when the task enters a protected object.
2960 It is effective only when the EDF scheduling policy is used.
2961
2962 @node Pragma Default_Initial_Condition,Pragma Debug,Pragma Deadline_Floor,Implementation Defined Pragmas
2963 @anchor{gnat_rm/implementation_defined_pragmas id8}@anchor{4f}@anchor{gnat_rm/implementation_defined_pragmas pragma-default-initial-condition}@anchor{50}
2964 @section Pragma Default_Initial_Condition
2965
2966
2967 Syntax:
2968
2969 @example
2970 pragma Default_Initial_Condition [ (null | boolean_EXPRESSION) ];
2971 @end example
2972
2973 For the semantics of this pragma, see the entry for aspect
2974 @code{Default_Initial_Condition} in the SPARK 2014 Reference Manual, section 7.3.3.
2975
2976 @node Pragma Debug,Pragma Debug_Policy,Pragma Default_Initial_Condition,Implementation Defined Pragmas
2977 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug}@anchor{51}
2978 @section Pragma Debug
2979
2980
2981 Syntax:
2982
2983 @example
2984 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2985
2986 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2987 PROCEDURE_NAME
2988 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2989 @end example
2990
2991 The procedure call argument has the syntactic form of an expression, meeting
2992 the syntactic requirements for pragmas.
2993
2994 If debug pragmas are not enabled or if the condition is present and evaluates
2995 to False, this pragma has no effect. If debug pragmas are enabled, the
2996 semantics of the pragma is exactly equivalent to the procedure call statement
2997 corresponding to the argument with a terminating semicolon. Pragmas are
2998 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2999 intersperse calls to debug procedures in the middle of declarations. Debug
3000 pragmas can be enabled either by use of the command line switch @emph{-gnata}
3001 or by use of the pragma @code{Check_Policy} with a first argument of
3002 @code{Debug}.
3003
3004 @node Pragma Debug_Policy,Pragma Default_Scalar_Storage_Order,Pragma Debug,Implementation Defined Pragmas
3005 @anchor{gnat_rm/implementation_defined_pragmas pragma-debug-policy}@anchor{52}
3006 @section Pragma Debug_Policy
3007
3008
3009 Syntax:
3010
3011 @example
3012 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
3013 @end example
3014
3015 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
3016 with a first argument of @code{Debug}. It is retained for historical
3017 compatibility reasons.
3018
3019 @node Pragma Default_Scalar_Storage_Order,Pragma Default_Storage_Pool,Pragma Debug_Policy,Implementation Defined Pragmas
3020 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-scalar-storage-order}@anchor{53}
3021 @section Pragma Default_Scalar_Storage_Order
3022
3023
3024 @geindex Default_Scalar_Storage_Order
3025
3026 @geindex Scalar_Storage_Order
3027
3028 Syntax:
3029
3030 @example
3031 pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);
3032 @end example
3033
3034 Normally if no explicit @code{Scalar_Storage_Order} is given for a record
3035 type or array type, then the scalar storage order defaults to the ordinary
3036 default for the target. But this default may be overridden using this pragma.
3037 The pragma may appear as a configuration pragma, or locally within a package
3038 spec or declarative part. In the latter case, it applies to all subsequent
3039 types declared within that package spec or declarative part.
3040
3041 The following example shows the use of this pragma:
3042
3043 @example
3044 pragma Default_Scalar_Storage_Order (High_Order_First);
3045 with System; use System;
3046 package DSSO1 is
3047 type H1 is record
3048 a : Integer;
3049 end record;
3050
3051 type L2 is record
3052 a : Integer;
3053 end record;
3054 for L2'Scalar_Storage_Order use Low_Order_First;
3055
3056 type L2a is new L2;
3057
3058 package Inner is
3059 type H3 is record
3060 a : Integer;
3061 end record;
3062
3063 pragma Default_Scalar_Storage_Order (Low_Order_First);
3064
3065 type L4 is record
3066 a : Integer;
3067 end record;
3068 end Inner;
3069
3070 type H4a is new Inner.L4;
3071
3072 type H5 is record
3073 a : Integer;
3074 end record;
3075 end DSSO1;
3076 @end example
3077
3078 In this example record types with names starting with @emph{L} have @cite{Low_Order_First} scalar
3079 storage order, and record types with names starting with @emph{H} have @code{High_Order_First}.
3080 Note that in the case of @code{H4a}, the order is not inherited
3081 from the parent type. Only an explicitly set @code{Scalar_Storage_Order}
3082 gets inherited on type derivation.
3083
3084 If this pragma is used as a configuration pragma which appears within a
3085 configuration pragma file (as opposed to appearing explicitly at the start
3086 of a single unit), then the binder will require that all units in a partition
3087 be compiled in a similar manner, other than run-time units, which are not
3088 affected by this pragma. Note that the use of this form is discouraged because
3089 it may significantly degrade the run-time performance of the software, instead
3090 the default scalar storage order ought to be changed only on a local basis.
3091
3092 @node Pragma Default_Storage_Pool,Pragma Depends,Pragma Default_Scalar_Storage_Order,Implementation Defined Pragmas
3093 @anchor{gnat_rm/implementation_defined_pragmas pragma-default-storage-pool}@anchor{54}
3094 @section Pragma Default_Storage_Pool
3095
3096
3097 @geindex Default_Storage_Pool
3098
3099 Syntax:
3100
3101 @example
3102 pragma Default_Storage_Pool (storage_pool_NAME | null);
3103 @end example
3104
3105 This pragma is standard in Ada 2012, but is available in all earlier
3106 versions of Ada as an implementation-defined pragma.
3107 See Ada 2012 Reference Manual for details.
3108
3109 @node Pragma Depends,Pragma Detect_Blocking,Pragma Default_Storage_Pool,Implementation Defined Pragmas
3110 @anchor{gnat_rm/implementation_defined_pragmas pragma-depends}@anchor{55}@anchor{gnat_rm/implementation_defined_pragmas id9}@anchor{56}
3111 @section Pragma Depends
3112
3113
3114 Syntax:
3115
3116 @example
3117 pragma Depends (DEPENDENCY_RELATION);
3118
3119 DEPENDENCY_RELATION ::=
3120 null
3121 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
3122
3123 DEPENDENCY_CLAUSE ::=
3124 OUTPUT_LIST =>[+] INPUT_LIST
3125 | NULL_DEPENDENCY_CLAUSE
3126
3127 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
3128
3129 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
3130
3131 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
3132
3133 OUTPUT ::= NAME | FUNCTION_RESULT
3134 INPUT ::= NAME
3135
3136 where FUNCTION_RESULT is a function Result attribute_reference
3137 @end example
3138
3139 For the semantics of this pragma, see the entry for aspect @code{Depends} in the
3140 SPARK 2014 Reference Manual, section 6.1.5.
3141
3142 @node Pragma Detect_Blocking,Pragma Disable_Atomic_Synchronization,Pragma Depends,Implementation Defined Pragmas
3143 @anchor{gnat_rm/implementation_defined_pragmas pragma-detect-blocking}@anchor{57}
3144 @section Pragma Detect_Blocking
3145
3146
3147 Syntax:
3148
3149 @example
3150 pragma Detect_Blocking;
3151 @end example
3152
3153 This is a standard pragma in Ada 2005, that is available in all earlier
3154 versions of Ada as an implementation-defined pragma.
3155
3156 This is a configuration pragma that forces the detection of potentially
3157 blocking operations within a protected operation, and to raise Program_Error
3158 if that happens.
3159
3160 @node Pragma Disable_Atomic_Synchronization,Pragma Dispatching_Domain,Pragma Detect_Blocking,Implementation Defined Pragmas
3161 @anchor{gnat_rm/implementation_defined_pragmas pragma-disable-atomic-synchronization}@anchor{58}
3162 @section Pragma Disable_Atomic_Synchronization
3163
3164
3165 @geindex Atomic Synchronization
3166
3167 Syntax:
3168
3169 @example
3170 pragma Disable_Atomic_Synchronization [(Entity)];
3171 @end example
3172
3173 Ada requires that accesses (reads or writes) of an atomic variable be
3174 regarded as synchronization points in the case of multiple tasks.
3175 Particularly in the case of multi-processors this may require special
3176 handling, e.g. the generation of memory barriers. This capability may
3177 be turned off using this pragma in cases where it is known not to be
3178 required.
3179
3180 The placement and scope rules for this pragma are the same as those
3181 for @code{pragma Suppress}. In particular it can be used as a
3182 configuration pragma, or in a declaration sequence where it applies
3183 till the end of the scope. If an @code{Entity} argument is present,
3184 the action applies only to that entity.
3185
3186 @node Pragma Dispatching_Domain,Pragma Effective_Reads,Pragma Disable_Atomic_Synchronization,Implementation Defined Pragmas
3187 @anchor{gnat_rm/implementation_defined_pragmas pragma-dispatching-domain}@anchor{59}
3188 @section Pragma Dispatching_Domain
3189
3190
3191 Syntax:
3192
3193 @example
3194 pragma Dispatching_Domain (EXPRESSION);
3195 @end example
3196
3197 This pragma is standard in Ada 2012, but is available in all earlier
3198 versions of Ada as an implementation-defined pragma.
3199 See Ada 2012 Reference Manual for details.
3200
3201 @node Pragma Effective_Reads,Pragma Effective_Writes,Pragma Dispatching_Domain,Implementation Defined Pragmas
3202 @anchor{gnat_rm/implementation_defined_pragmas id10}@anchor{5a}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-reads}@anchor{5b}
3203 @section Pragma Effective_Reads
3204
3205
3206 Syntax:
3207
3208 @example
3209 pragma Effective_Reads [ (boolean_EXPRESSION) ];
3210 @end example
3211
3212 For the semantics of this pragma, see the entry for aspect @code{Effective_Reads} in
3213 the SPARK 2014 Reference Manual, section 7.1.2.
3214
3215 @node Pragma Effective_Writes,Pragma Elaboration_Checks,Pragma Effective_Reads,Implementation Defined Pragmas
3216 @anchor{gnat_rm/implementation_defined_pragmas id11}@anchor{5c}@anchor{gnat_rm/implementation_defined_pragmas pragma-effective-writes}@anchor{5d}
3217 @section Pragma Effective_Writes
3218
3219
3220 Syntax:
3221
3222 @example
3223 pragma Effective_Writes [ (boolean_EXPRESSION) ];
3224 @end example
3225
3226 For the semantics of this pragma, see the entry for aspect @code{Effective_Writes}
3227 in the SPARK 2014 Reference Manual, section 7.1.2.
3228
3229 @node Pragma Elaboration_Checks,Pragma Eliminate,Pragma Effective_Writes,Implementation Defined Pragmas
3230 @anchor{gnat_rm/implementation_defined_pragmas pragma-elaboration-checks}@anchor{5e}
3231 @section Pragma Elaboration_Checks
3232
3233
3234 @geindex Elaboration control
3235
3236 Syntax:
3237
3238 @example
3239 pragma Elaboration_Checks (Dynamic | Static);
3240 @end example
3241
3242 This is a configuration pragma which specifies the elaboration model to be
3243 used during compilation. For more information on the elaboration models of
3244 GNAT, consult the chapter on elaboration order handling in the @emph{GNAT User's
3245 Guide}.
3246
3247 The pragma may appear in the following contexts:
3248
3249
3250 @itemize *
3251
3252 @item
3253 Configuration pragmas file
3254
3255 @item
3256 Prior to the context clauses of a compilation unit's initial declaration
3257 @end itemize
3258
3259 Any other placement of the pragma will result in a warning and the effects of
3260 the offending pragma will be ignored.
3261
3262 If the pragma argument is @code{Dynamic}, then the dynamic elaboration model is in
3263 effect. If the pragma argument is @code{Static}, then the static elaboration model
3264 is in effect.
3265
3266 @node Pragma Eliminate,Pragma Enable_Atomic_Synchronization,Pragma Elaboration_Checks,Implementation Defined Pragmas
3267 @anchor{gnat_rm/implementation_defined_pragmas pragma-eliminate}@anchor{5f}
3268 @section Pragma Eliminate
3269
3270
3271 @geindex Elimination of unused subprograms
3272
3273 Syntax:
3274
3275 @example
3276 pragma Eliminate (
3277 [ Unit_Name => ] IDENTIFIER | SELECTED_COMPONENT ,
3278 [ Entity => ] IDENTIFIER |
3279 SELECTED_COMPONENT |
3280 STRING_LITERAL
3281 [, Source_Location => SOURCE_TRACE ] );
3282
3283 SOURCE_TRACE ::= STRING_LITERAL
3284 @end example
3285
3286 This pragma indicates that the given entity is not used in the program to be
3287 compiled and built, thus allowing the compiler to
3288 eliminate the code or data associated with the named entity. Any reference to
3289 an eliminated entity causes a compile-time or link-time error.
3290
3291 The pragma has the following semantics, where @code{U} is the unit specified by
3292 the @code{Unit_Name} argument and @code{E} is the entity specified by the @code{Entity}
3293 argument:
3294
3295
3296 @itemize *
3297
3298 @item
3299 @code{E} must be a subprogram that is explicitly declared either:
3300
3301 o Within @code{U}, or
3302
3303 o Within a generic package that is instantiated in @code{U}, or
3304
3305 o As an instance of generic subprogram instantiated in @code{U}.
3306
3307 Otherwise the pragma is ignored.
3308
3309 @item
3310 If @code{E} is overloaded within @code{U} then, in the absence of a
3311 @code{Source_Location} argument, all overloadings are eliminated.
3312
3313 @item
3314 If @code{E} is overloaded within @code{U} and only some overloadings
3315 are to be eliminated, then each overloading to be eliminated
3316 must be specified in a corresponding pragma @code{Eliminate}
3317 with a @code{Source_Location} argument identifying the line where the
3318 declaration appears, as described below.
3319
3320 @item
3321 If @code{E} is declared as the result of a generic instantiation, then
3322 a @code{Source_Location} argument is needed, as described below
3323 @end itemize
3324
3325 Pragma @code{Eliminate} allows a program to be compiled in a system-independent
3326 manner, so that unused entities are eliminated but without
3327 needing to modify the source text. Normally the required set of
3328 @code{Eliminate} pragmas is constructed automatically using the @code{gnatelim} tool.
3329
3330 Any source file change that removes, splits, or
3331 adds lines may make the set of @code{Eliminate} pragmas invalid because their
3332 @code{Source_Location} argument values may get out of date.
3333
3334 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
3335 operation. In this case all the subprograms to which the given operation can
3336 dispatch are considered to be unused (are never called as a result of a direct
3337 or a dispatching call).
3338
3339 The string literal given for the source location specifies the line number
3340 of the declaration of the entity, using the following syntax for @code{SOURCE_TRACE}:
3341
3342 @example
3343 SOURCE_TRACE ::= SOURCE_REFERENCE [ LBRACKET SOURCE_TRACE RBRACKET ]
3344
3345 LBRACKET ::= '['
3346 RBRACKET ::= ']'
3347
3348 SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
3349
3350 LINE_NUMBER ::= DIGIT @{DIGIT@}
3351 @end example
3352
3353 Spaces around the colon in a @code{SOURCE_REFERENCE} are optional.
3354
3355 The source trace that is given as the @code{Source_Location} must obey the
3356 following rules (or else the pragma is ignored), where @code{U} is
3357 the unit @code{U} specified by the @code{Unit_Name} argument and @code{E} is the
3358 subprogram specified by the @code{Entity} argument:
3359
3360
3361 @itemize *
3362
3363 @item
3364 @code{FILE_NAME} is the short name (with no directory
3365 information) of the Ada source file for @code{U}, using the required syntax
3366 for the underlying file system (e.g. case is significant if the underlying
3367 operating system is case sensitive).
3368 If @code{U} is a package and @code{E} is a subprogram declared in the package
3369 specification and its full declaration appears in the package body,
3370 then the relevant source file is the one for the package specification;
3371 analogously if @code{U} is a generic package.
3372
3373 @item
3374 If @code{E} is not declared in a generic instantiation (this includes
3375 generic subprogram instances), the source trace includes only one source
3376 line reference. @code{LINE_NUMBER} gives the line number of the occurrence
3377 of the declaration of @code{E} within the source file (as a decimal literal
3378 without an exponent or point).
3379
3380 @item
3381 If @code{E} is declared by a generic instantiation, its source trace
3382 (from left to right) starts with the source location of the
3383 declaration of @code{E} in the generic unit and ends with the source
3384 location of the instantiation, given in square brackets. This approach is
3385 applied recursively with nested instantiations: the rightmost (nested
3386 most deeply in square brackets) element of the source trace is the location
3387 of the outermost instantiation, and the leftmost element (that is, outside
3388 of any square brackets) is the location of the declaration of @code{E} in
3389 the generic unit.
3390 @end itemize
3391
3392 Examples:
3393
3394 @quotation
3395
3396 @example
3397 pragma Eliminate (Pkg0, Proc);
3398 -- Eliminate (all overloadings of) Proc in Pkg0
3399
3400 pragma Eliminate (Pkg1, Proc,
3401 Source_Location => "pkg1.ads:8");
3402 -- Eliminate overloading of Proc at line 8 in pkg1.ads
3403
3404 -- Assume the following file contents:
3405 -- gen_pkg.ads
3406 -- 1: generic
3407 -- 2: type T is private;
3408 -- 3: package Gen_Pkg is
3409 -- 4: procedure Proc(N : T);
3410 -- ... ...
3411 -- ... end Gen_Pkg;
3412 --
3413 -- q.adb
3414 -- 1: with Gen_Pkg;
3415 -- 2: procedure Q is
3416 -- 3: package Inst_Pkg is new Gen_Pkg(Integer);
3417 -- ... -- No calls on Inst_Pkg.Proc
3418 -- ... end Q;
3419
3420 -- The following pragma eliminates Inst_Pkg.Proc from Q
3421 pragma Eliminate (Q, Proc,
3422 Source_Location => "gen_pkg.ads:4[q.adb:3]");
3423 @end example
3424 @end quotation
3425
3426 @node Pragma Enable_Atomic_Synchronization,Pragma Export_Function,Pragma Eliminate,Implementation Defined Pragmas
3427 @anchor{gnat_rm/implementation_defined_pragmas pragma-enable-atomic-synchronization}@anchor{60}
3428 @section Pragma Enable_Atomic_Synchronization
3429
3430
3431 @geindex Atomic Synchronization
3432
3433 Syntax:
3434
3435 @example
3436 pragma Enable_Atomic_Synchronization [(Entity)];
3437 @end example
3438
3439 Ada requires that accesses (reads or writes) of an atomic variable be
3440 regarded as synchronization points in the case of multiple tasks.
3441 Particularly in the case of multi-processors this may require special
3442 handling, e.g. the generation of memory barriers. This synchronization
3443 is performed by default, but can be turned off using
3444 @code{pragma Disable_Atomic_Synchronization}. The
3445 @code{Enable_Atomic_Synchronization} pragma can be used to turn
3446 it back on.
3447
3448 The placement and scope rules for this pragma are the same as those
3449 for @code{pragma Unsuppress}. In particular it can be used as a
3450 configuration pragma, or in a declaration sequence where it applies
3451 till the end of the scope. If an @code{Entity} argument is present,
3452 the action applies only to that entity.
3453
3454 @node Pragma Export_Function,Pragma Export_Object,Pragma Enable_Atomic_Synchronization,Implementation Defined Pragmas
3455 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-function}@anchor{61}
3456 @section Pragma Export_Function
3457
3458
3459 @geindex Argument passing mechanisms
3460
3461 Syntax:
3462
3463 @example
3464 pragma Export_Function (
3465 [Internal =>] LOCAL_NAME
3466 [, [External =>] EXTERNAL_SYMBOL]
3467 [, [Parameter_Types =>] PARAMETER_TYPES]
3468 [, [Result_Type =>] result_SUBTYPE_MARK]
3469 [, [Mechanism =>] MECHANISM]
3470 [, [Result_Mechanism =>] MECHANISM_NAME]);
3471
3472 EXTERNAL_SYMBOL ::=
3473 IDENTIFIER
3474 | static_string_EXPRESSION
3475 | ""
3476
3477 PARAMETER_TYPES ::=
3478 null
3479 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3480
3481 TYPE_DESIGNATOR ::=
3482 subtype_NAME
3483 | subtype_Name ' Access
3484
3485 MECHANISM ::=
3486 MECHANISM_NAME
3487 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3488
3489 MECHANISM_ASSOCIATION ::=
3490 [formal_parameter_NAME =>] MECHANISM_NAME
3491
3492 MECHANISM_NAME ::= Value | Reference
3493 @end example
3494
3495 Use this pragma to make a function externally callable and optionally
3496 provide information on mechanisms to be used for passing parameter and
3497 result values. We recommend, for the purposes of improving portability,
3498 this pragma always be used in conjunction with a separate pragma
3499 @code{Export}, which must precede the pragma @code{Export_Function}.
3500 GNAT does not require a separate pragma @code{Export}, but if none is
3501 present, @code{Convention Ada} is assumed, which is usually
3502 not what is wanted, so it is usually appropriate to use this
3503 pragma in conjunction with a @code{Export} or @code{Convention}
3504 pragma that specifies the desired foreign convention.
3505 Pragma @code{Export_Function}
3506 (and @code{Export}, if present) must appear in the same declarative
3507 region as the function to which they apply.
3508
3509 The @code{internal_name} must uniquely designate the function to which the
3510 pragma applies. If more than one function name exists of this name in
3511 the declarative part you must use the @code{Parameter_Types} and
3512 @code{Result_Type} parameters to achieve the required
3513 unique designation. The @cite{subtype_mark}s in these parameters must
3514 exactly match the subtypes in the corresponding function specification,
3515 using positional notation to match parameters with subtype marks.
3516 The form with an @code{'Access} attribute can be used to match an
3517 anonymous access parameter.
3518
3519 @geindex Suppressing external name
3520
3521 Special treatment is given if the EXTERNAL is an explicit null
3522 string or a static string expressions that evaluates to the null
3523 string. In this case, no external name is generated. This form
3524 still allows the specification of parameter mechanisms.
3525
3526 @node Pragma Export_Object,Pragma Export_Procedure,Pragma Export_Function,Implementation Defined Pragmas
3527 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-object}@anchor{62}
3528 @section Pragma Export_Object
3529
3530
3531 Syntax:
3532
3533 @example
3534 pragma Export_Object
3535 [Internal =>] LOCAL_NAME
3536 [, [External =>] EXTERNAL_SYMBOL]
3537 [, [Size =>] EXTERNAL_SYMBOL]
3538
3539 EXTERNAL_SYMBOL ::=
3540 IDENTIFIER
3541 | static_string_EXPRESSION
3542 @end example
3543
3544 This pragma designates an object as exported, and apart from the
3545 extended rules for external symbols, is identical in effect to the use of
3546 the normal @code{Export} pragma applied to an object. You may use a
3547 separate Export pragma (and you probably should from the point of view
3548 of portability), but it is not required. @code{Size} is syntax checked,
3549 but otherwise ignored by GNAT.
3550
3551 @node Pragma Export_Procedure,Pragma Export_Value,Pragma Export_Object,Implementation Defined Pragmas
3552 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-procedure}@anchor{63}
3553 @section Pragma Export_Procedure
3554
3555
3556 Syntax:
3557
3558 @example
3559 pragma Export_Procedure (
3560 [Internal =>] LOCAL_NAME
3561 [, [External =>] EXTERNAL_SYMBOL]
3562 [, [Parameter_Types =>] PARAMETER_TYPES]
3563 [, [Mechanism =>] MECHANISM]);
3564
3565 EXTERNAL_SYMBOL ::=
3566 IDENTIFIER
3567 | static_string_EXPRESSION
3568 | ""
3569
3570 PARAMETER_TYPES ::=
3571 null
3572 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3573
3574 TYPE_DESIGNATOR ::=
3575 subtype_NAME
3576 | subtype_Name ' Access
3577
3578 MECHANISM ::=
3579 MECHANISM_NAME
3580 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3581
3582 MECHANISM_ASSOCIATION ::=
3583 [formal_parameter_NAME =>] MECHANISM_NAME
3584
3585 MECHANISM_NAME ::= Value | Reference
3586 @end example
3587
3588 This pragma is identical to @code{Export_Function} except that it
3589 applies to a procedure rather than a function and the parameters
3590 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3591 GNAT does not require a separate pragma @code{Export}, but if none is
3592 present, @code{Convention Ada} is assumed, which is usually
3593 not what is wanted, so it is usually appropriate to use this
3594 pragma in conjunction with a @code{Export} or @code{Convention}
3595 pragma that specifies the desired foreign convention.
3596
3597 @geindex Suppressing external name
3598
3599 Special treatment is given if the EXTERNAL is an explicit null
3600 string or a static string expressions that evaluates to the null
3601 string. In this case, no external name is generated. This form
3602 still allows the specification of parameter mechanisms.
3603
3604 @node Pragma Export_Value,Pragma Export_Valued_Procedure,Pragma Export_Procedure,Implementation Defined Pragmas
3605 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-value}@anchor{64}
3606 @section Pragma Export_Value
3607
3608
3609 Syntax:
3610
3611 @example
3612 pragma Export_Value (
3613 [Value =>] static_integer_EXPRESSION,
3614 [Link_Name =>] static_string_EXPRESSION);
3615 @end example
3616
3617 This pragma serves to export a static integer value for external use.
3618 The first argument specifies the value to be exported. The Link_Name
3619 argument specifies the symbolic name to be associated with the integer
3620 value. This pragma is useful for defining a named static value in Ada
3621 that can be referenced in assembly language units to be linked with
3622 the application. This pragma is currently supported only for the
3623 AAMP target and is ignored for other targets.
3624
3625 @node Pragma Export_Valued_Procedure,Pragma Extend_System,Pragma Export_Value,Implementation Defined Pragmas
3626 @anchor{gnat_rm/implementation_defined_pragmas pragma-export-valued-procedure}@anchor{65}
3627 @section Pragma Export_Valued_Procedure
3628
3629
3630 Syntax:
3631
3632 @example
3633 pragma Export_Valued_Procedure (
3634 [Internal =>] LOCAL_NAME
3635 [, [External =>] EXTERNAL_SYMBOL]
3636 [, [Parameter_Types =>] PARAMETER_TYPES]
3637 [, [Mechanism =>] MECHANISM]);
3638
3639 EXTERNAL_SYMBOL ::=
3640 IDENTIFIER
3641 | static_string_EXPRESSION
3642 | ""
3643
3644 PARAMETER_TYPES ::=
3645 null
3646 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3647
3648 TYPE_DESIGNATOR ::=
3649 subtype_NAME
3650 | subtype_Name ' Access
3651
3652 MECHANISM ::=
3653 MECHANISM_NAME
3654 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3655
3656 MECHANISM_ASSOCIATION ::=
3657 [formal_parameter_NAME =>] MECHANISM_NAME
3658
3659 MECHANISM_NAME ::= Value | Reference
3660 @end example
3661
3662 This pragma is identical to @code{Export_Procedure} except that the
3663 first parameter of @code{LOCAL_NAME}, which must be present, must be of
3664 mode @code{out}, and externally the subprogram is treated as a function
3665 with this parameter as the result of the function. GNAT provides for
3666 this capability to allow the use of @code{out} and @code{in out}
3667 parameters in interfacing to external functions (which are not permitted
3668 in Ada functions).
3669 GNAT does not require a separate pragma @code{Export}, but if none is
3670 present, @code{Convention Ada} is assumed, which is almost certainly
3671 not what is wanted since the whole point of this pragma is to interface
3672 with foreign language functions, so it is usually appropriate to use this
3673 pragma in conjunction with a @code{Export} or @code{Convention}
3674 pragma that specifies the desired foreign convention.
3675
3676 @geindex Suppressing external name
3677
3678 Special treatment is given if the EXTERNAL is an explicit null
3679 string or a static string expressions that evaluates to the null
3680 string. In this case, no external name is generated. This form
3681 still allows the specification of parameter mechanisms.
3682
3683 @node Pragma Extend_System,Pragma Extensions_Allowed,Pragma Export_Valued_Procedure,Implementation Defined Pragmas
3684 @anchor{gnat_rm/implementation_defined_pragmas pragma-extend-system}@anchor{66}
3685 @section Pragma Extend_System
3686
3687
3688 @geindex System
3689 @geindex extending
3690
3691 @geindex DEC Ada 83
3692
3693 Syntax:
3694
3695 @example
3696 pragma Extend_System ([Name =>] IDENTIFIER);
3697 @end example
3698
3699 This pragma is used to provide backwards compatibility with other
3700 implementations that extend the facilities of package @code{System}. In
3701 GNAT, @code{System} contains only the definitions that are present in
3702 the Ada RM. However, other implementations, notably the DEC Ada 83
3703 implementation, provide many extensions to package @code{System}.
3704
3705 For each such implementation accommodated by this pragma, GNAT provides a
3706 package @code{Aux_@emph{xxx}}, e.g., @code{Aux_DEC} for the DEC Ada 83
3707 implementation, which provides the required additional definitions. You
3708 can use this package in two ways. You can @code{with} it in the normal
3709 way and access entities either by selection or using a @code{use}
3710 clause. In this case no special processing is required.
3711
3712 However, if existing code contains references such as
3713 @code{System.@emph{xxx}} where @emph{xxx} is an entity in the extended
3714 definitions provided in package @code{System}, you may use this pragma
3715 to extend visibility in @code{System} in a non-standard way that
3716 provides greater compatibility with the existing code. Pragma
3717 @code{Extend_System} is a configuration pragma whose single argument is
3718 the name of the package containing the extended definition
3719 (e.g., @code{Aux_DEC} for the DEC Ada case). A unit compiled under
3720 control of this pragma will be processed using special visibility
3721 processing that looks in package @code{System.Aux_@emph{xxx}} where
3722 @code{Aux_@emph{xxx}} is the pragma argument for any entity referenced in
3723 package @code{System}, but not found in package @code{System}.
3724
3725 You can use this pragma either to access a predefined @code{System}
3726 extension supplied with the compiler, for example @code{Aux_DEC} or
3727 you can construct your own extension unit following the above
3728 definition. Note that such a package is a child of @code{System}
3729 and thus is considered part of the implementation.
3730 To compile it you will have to use the @emph{-gnatg} switch
3731 for compiling System units, as explained in the
3732 GNAT User's Guide.
3733
3734 @node Pragma Extensions_Allowed,Pragma Extensions_Visible,Pragma Extend_System,Implementation Defined Pragmas
3735 @anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-allowed}@anchor{67}
3736 @section Pragma Extensions_Allowed
3737
3738
3739 @geindex Ada Extensions
3740
3741 @geindex GNAT Extensions
3742
3743 Syntax:
3744
3745 @example
3746 pragma Extensions_Allowed (On | Off);
3747 @end example
3748
3749 This configuration pragma enables or disables the implementation
3750 extension mode (the use of Off as a parameter cancels the effect
3751 of the @emph{-gnatX} command switch).
3752
3753 In extension mode, the latest version of the Ada language is
3754 implemented (currently Ada 2012), and in addition a small number
3755 of GNAT specific extensions are recognized as follows:
3756
3757
3758 @table @asis
3759
3760 @item @emph{Constrained attribute for generic objects}
3761
3762 The @code{Constrained} attribute is permitted for objects of
3763 generic types. The result indicates if the corresponding actual
3764 is constrained.
3765 @end table
3766
3767 @node Pragma Extensions_Visible,Pragma External,Pragma Extensions_Allowed,Implementation Defined Pragmas
3768 @anchor{gnat_rm/implementation_defined_pragmas id12}@anchor{68}@anchor{gnat_rm/implementation_defined_pragmas pragma-extensions-visible}@anchor{69}
3769 @section Pragma Extensions_Visible
3770
3771
3772 Syntax:
3773
3774 @example
3775 pragma Extensions_Visible [ (boolean_EXPRESSION) ];
3776 @end example
3777
3778 For the semantics of this pragma, see the entry for aspect @code{Extensions_Visible}
3779 in the SPARK 2014 Reference Manual, section 6.1.7.
3780
3781 @node Pragma External,Pragma External_Name_Casing,Pragma Extensions_Visible,Implementation Defined Pragmas
3782 @anchor{gnat_rm/implementation_defined_pragmas pragma-external}@anchor{6a}
3783 @section Pragma External
3784
3785
3786 Syntax:
3787
3788 @example
3789 pragma External (
3790 [ Convention =>] convention_IDENTIFIER,
3791 [ Entity =>] LOCAL_NAME
3792 [, [External_Name =>] static_string_EXPRESSION ]
3793 [, [Link_Name =>] static_string_EXPRESSION ]);
3794 @end example
3795
3796 This pragma is identical in syntax and semantics to pragma
3797 @code{Export} as defined in the Ada Reference Manual. It is
3798 provided for compatibility with some Ada 83 compilers that
3799 used this pragma for exactly the same purposes as pragma
3800 @code{Export} before the latter was standardized.
3801
3802 @node Pragma External_Name_Casing,Pragma Fast_Math,Pragma External,Implementation Defined Pragmas
3803 @anchor{gnat_rm/implementation_defined_pragmas pragma-external-name-casing}@anchor{6b}
3804 @section Pragma External_Name_Casing
3805
3806
3807 @geindex Dec Ada 83 casing compatibility
3808
3809 @geindex External Names
3810 @geindex casing
3811
3812 @geindex Casing of External names
3813
3814 Syntax:
3815
3816 @example
3817 pragma External_Name_Casing (
3818 Uppercase | Lowercase
3819 [, Uppercase | Lowercase | As_Is]);
3820 @end example
3821
3822 This pragma provides control over the casing of external names associated
3823 with Import and Export pragmas. There are two cases to consider:
3824
3825
3826 @itemize *
3827
3828 @item
3829 Implicit external names
3830
3831 Implicit external names are derived from identifiers. The most common case
3832 arises when a standard Ada Import or Export pragma is used with only two
3833 arguments, as in:
3834
3835 @example
3836 pragma Import (C, C_Routine);
3837 @end example
3838
3839 Since Ada is a case-insensitive language, the spelling of the identifier in
3840 the Ada source program does not provide any information on the desired
3841 casing of the external name, and so a convention is needed. In GNAT the
3842 default treatment is that such names are converted to all lower case
3843 letters. This corresponds to the normal C style in many environments.
3844 The first argument of pragma @code{External_Name_Casing} can be used to
3845 control this treatment. If @code{Uppercase} is specified, then the name
3846 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3847 then the normal default of all lower case letters will be used.
3848
3849 This same implicit treatment is also used in the case of extended DEC Ada 83
3850 compatible Import and Export pragmas where an external name is explicitly
3851 specified using an identifier rather than a string.
3852
3853 @item
3854 Explicit external names
3855
3856 Explicit external names are given as string literals. The most common case
3857 arises when a standard Ada Import or Export pragma is used with three
3858 arguments, as in:
3859
3860 @example
3861 pragma Import (C, C_Routine, "C_routine");
3862 @end example
3863
3864 In this case, the string literal normally provides the exact casing required
3865 for the external name. The second argument of pragma
3866 @code{External_Name_Casing} may be used to modify this behavior.
3867 If @code{Uppercase} is specified, then the name
3868 will be forced to all uppercase letters. If @code{Lowercase} is specified,
3869 then the name will be forced to all lowercase letters. A specification of
3870 @code{As_Is} provides the normal default behavior in which the casing is
3871 taken from the string provided.
3872 @end itemize
3873
3874 This pragma may appear anywhere that a pragma is valid. In particular, it
3875 can be used as a configuration pragma in the @code{gnat.adc} file, in which
3876 case it applies to all subsequent compilations, or it can be used as a program
3877 unit pragma, in which case it only applies to the current unit, or it can
3878 be used more locally to control individual Import/Export pragmas.
3879
3880 It was primarily intended for use with OpenVMS systems, where many
3881 compilers convert all symbols to upper case by default. For interfacing to
3882 such compilers (e.g., the DEC C compiler), it may be convenient to use
3883 the pragma:
3884
3885 @example
3886 pragma External_Name_Casing (Uppercase, Uppercase);
3887 @end example
3888
3889 to enforce the upper casing of all external symbols.
3890
3891 @node Pragma Fast_Math,Pragma Favor_Top_Level,Pragma External_Name_Casing,Implementation Defined Pragmas
3892 @anchor{gnat_rm/implementation_defined_pragmas pragma-fast-math}@anchor{6c}
3893 @section Pragma Fast_Math
3894
3895
3896 Syntax:
3897
3898 @example
3899 pragma Fast_Math;
3900 @end example
3901
3902 This is a configuration pragma which activates a mode in which speed is
3903 considered more important for floating-point operations than absolutely
3904 accurate adherence to the requirements of the standard. Currently the
3905 following operations are affected:
3906
3907
3908 @table @asis
3909
3910 @item @emph{Complex Multiplication}
3911
3912 The normal simple formula for complex multiplication can result in intermediate
3913 overflows for numbers near the end of the range. The Ada standard requires that
3914 this situation be detected and corrected by scaling, but in Fast_Math mode such
3915 cases will simply result in overflow. Note that to take advantage of this you
3916 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3917 under control of the pragma, rather than use the preinstantiated versions.
3918 @end table
3919
3920 @node Pragma Favor_Top_Level,Pragma Finalize_Storage_Only,Pragma Fast_Math,Implementation Defined Pragmas
3921 @anchor{gnat_rm/implementation_defined_pragmas id13}@anchor{6d}@anchor{gnat_rm/implementation_defined_pragmas pragma-favor-top-level}@anchor{6e}
3922 @section Pragma Favor_Top_Level
3923
3924
3925 Syntax:
3926
3927 @example
3928 pragma Favor_Top_Level (type_NAME);
3929 @end example
3930
3931 The argument of pragma @code{Favor_Top_Level} must be a named access-to-subprogram
3932 type. This pragma is an efficiency hint to the compiler, regarding the use of
3933 @code{'Access} or @code{'Unrestricted_Access} on nested (non-library-level) subprograms.
3934 The pragma means that nested subprograms are not used with this type, or are
3935 rare, so that the generated code should be efficient in the top-level case.
3936 When this pragma is used, dynamically generated trampolines may be used on some
3937 targets for nested subprograms. See restriction @code{No_Implicit_Dynamic_Code}.
3938
3939 @node Pragma Finalize_Storage_Only,Pragma Float_Representation,Pragma Favor_Top_Level,Implementation Defined Pragmas
3940 @anchor{gnat_rm/implementation_defined_pragmas pragma-finalize-storage-only}@anchor{6f}
3941 @section Pragma Finalize_Storage_Only
3942
3943
3944 Syntax:
3945
3946 @example
3947 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3948 @end example
3949
3950 The argument of pragma @code{Finalize_Storage_Only} must denote a local type which
3951 is derived from @code{Ada.Finalization.Controlled} or @code{Limited_Controlled}. The
3952 pragma suppresses the call to @code{Finalize} for declared library-level objects
3953 of the argument type. This is mostly useful for types where finalization is
3954 only used to deal with storage reclamation since in most environments it is
3955 not necessary to reclaim memory just before terminating execution, hence the
3956 name. Note that this pragma does not suppress Finalize calls for library-level
3957 heap-allocated objects (see pragma @code{No_Heap_Finalization}).
3958
3959 @node Pragma Float_Representation,Pragma Ghost,Pragma Finalize_Storage_Only,Implementation Defined Pragmas
3960 @anchor{gnat_rm/implementation_defined_pragmas pragma-float-representation}@anchor{70}
3961 @section Pragma Float_Representation
3962
3963
3964 Syntax:
3965
3966 @example
3967 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3968
3969 FLOAT_REP ::= VAX_Float | IEEE_Float
3970 @end example
3971
3972 In the one argument form, this pragma is a configuration pragma which
3973 allows control over the internal representation chosen for the predefined
3974 floating point types declared in the packages @code{Standard} and
3975 @code{System}. This pragma is only provided for compatibility and has no effect.
3976
3977 The two argument form specifies the representation to be used for
3978 the specified floating-point type. The argument must
3979 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3980
3981
3982 @itemize *
3983
3984 @item
3985 For a digits value of 6, 32-bit IEEE short format will be used.
3986
3987 @item
3988 For a digits value of 15, 64-bit IEEE long format will be used.
3989
3990 @item
3991 No other value of digits is permitted.
3992 @end itemize
3993
3994 @node Pragma Ghost,Pragma Global,Pragma Float_Representation,Implementation Defined Pragmas
3995 @anchor{gnat_rm/implementation_defined_pragmas pragma-ghost}@anchor{71}@anchor{gnat_rm/implementation_defined_pragmas id14}@anchor{72}
3996 @section Pragma Ghost
3997
3998
3999 Syntax:
4000
4001 @example
4002 pragma Ghost [ (boolean_EXPRESSION) ];
4003 @end example
4004
4005 For the semantics of this pragma, see the entry for aspect @code{Ghost} in the SPARK
4006 2014 Reference Manual, section 6.9.
4007
4008 @node Pragma Global,Pragma Ident,Pragma Ghost,Implementation Defined Pragmas
4009 @anchor{gnat_rm/implementation_defined_pragmas pragma-global}@anchor{73}@anchor{gnat_rm/implementation_defined_pragmas id15}@anchor{74}
4010 @section Pragma Global
4011
4012
4013 Syntax:
4014
4015 @example
4016 pragma Global (GLOBAL_SPECIFICATION);
4017
4018 GLOBAL_SPECIFICATION ::=
4019 null
4020 | (GLOBAL_LIST)
4021 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
4022
4023 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
4024
4025 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
4026 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
4027 GLOBAL_ITEM ::= NAME
4028 @end example
4029
4030 For the semantics of this pragma, see the entry for aspect @code{Global} in the
4031 SPARK 2014 Reference Manual, section 6.1.4.
4032
4033 @node Pragma Ident,Pragma Ignore_Pragma,Pragma Global,Implementation Defined Pragmas
4034 @anchor{gnat_rm/implementation_defined_pragmas pragma-ident}@anchor{75}
4035 @section Pragma Ident
4036
4037
4038 Syntax:
4039
4040 @example
4041 pragma Ident (static_string_EXPRESSION);
4042 @end example
4043
4044 This pragma is identical in effect to pragma @code{Comment}. It is provided
4045 for compatibility with other Ada compilers providing this pragma.
4046
4047 @node Pragma Ignore_Pragma,Pragma Implementation_Defined,Pragma Ident,Implementation Defined Pragmas
4048 @anchor{gnat_rm/implementation_defined_pragmas pragma-ignore-pragma}@anchor{76}
4049 @section Pragma Ignore_Pragma
4050
4051
4052 Syntax:
4053
4054 @example
4055 pragma Ignore_Pragma (pragma_IDENTIFIER);
4056 @end example
4057
4058 This is a configuration pragma
4059 that takes a single argument that is a simple identifier. Any subsequent
4060 use of a pragma whose pragma identifier matches this argument will be
4061 silently ignored. This may be useful when legacy code or code intended
4062 for compilation with some other compiler contains pragmas that match the
4063 name, but not the exact implementation, of a GNAT pragma. The use of this
4064 pragma allows such pragmas to be ignored, which may be useful in CodePeer
4065 mode, or during porting of legacy code.
4066
4067 @node Pragma Implementation_Defined,Pragma Implemented,Pragma Ignore_Pragma,Implementation Defined Pragmas
4068 @anchor{gnat_rm/implementation_defined_pragmas pragma-implementation-defined}@anchor{77}
4069 @section Pragma Implementation_Defined
4070
4071
4072 Syntax:
4073
4074 @example
4075 pragma Implementation_Defined (local_NAME);
4076 @end example
4077
4078 This pragma marks a previously declared entity as implementation-defined.
4079 For an overloaded entity, applies to the most recent homonym.
4080
4081 @example
4082 pragma Implementation_Defined;
4083 @end example
4084
4085 The form with no arguments appears anywhere within a scope, most
4086 typically a package spec, and indicates that all entities that are
4087 defined within the package spec are Implementation_Defined.
4088
4089 This pragma is used within the GNAT runtime library to identify
4090 implementation-defined entities introduced in language-defined units,
4091 for the purpose of implementing the No_Implementation_Identifiers
4092 restriction.
4093
4094 @node Pragma Implemented,Pragma Implicit_Packing,Pragma Implementation_Defined,Implementation Defined Pragmas
4095 @anchor{gnat_rm/implementation_defined_pragmas pragma-implemented}@anchor{78}
4096 @section Pragma Implemented
4097
4098
4099 Syntax:
4100
4101 @example
4102 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
4103
4104 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
4105 @end example
4106
4107 This is an Ada 2012 representation pragma which applies to protected, task
4108 and synchronized interface primitives. The use of pragma Implemented provides
4109 a way to impose a static requirement on the overriding operation by adhering
4110 to one of the three implementation kinds: entry, protected procedure or any of
4111 the above. This pragma is available in all earlier versions of Ada as an
4112 implementation-defined pragma.
4113
4114 @example
4115 type Synch_Iface is synchronized interface;
4116 procedure Prim_Op (Obj : in out Iface) is abstract;
4117 pragma Implemented (Prim_Op, By_Protected_Procedure);
4118
4119 protected type Prot_1 is new Synch_Iface with
4120 procedure Prim_Op; -- Legal
4121 end Prot_1;
4122
4123 protected type Prot_2 is new Synch_Iface with
4124 entry Prim_Op; -- Illegal
4125 end Prot_2;
4126
4127 task type Task_Typ is new Synch_Iface with
4128 entry Prim_Op; -- Illegal
4129 end Task_Typ;
4130 @end example
4131
4132 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
4133 Implemented determines the runtime behavior of the requeue. Implementation kind
4134 By_Entry guarantees that the action of requeueing will proceed from an entry to
4135 another entry. Implementation kind By_Protected_Procedure transforms the
4136 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
4137 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
4138 the target's overriding subprogram kind.
4139
4140 @node Pragma Implicit_Packing,Pragma Import_Function,Pragma Implemented,Implementation Defined Pragmas
4141 @anchor{gnat_rm/implementation_defined_pragmas pragma-implicit-packing}@anchor{79}
4142 @section Pragma Implicit_Packing
4143
4144
4145 @geindex Rational Profile
4146
4147 Syntax:
4148
4149 @example
4150 pragma Implicit_Packing;
4151 @end example
4152
4153 This is a configuration pragma that requests implicit packing for packed
4154 arrays for which a size clause is given but no explicit pragma Pack or
4155 specification of Component_Size is present. It also applies to records
4156 where no record representation clause is present. Consider this example:
4157
4158 @example
4159 type R is array (0 .. 7) of Boolean;
4160 for R'Size use 8;
4161 @end example
4162
4163 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
4164 does not change the layout of a composite object. So the Size clause in the
4165 above example is normally rejected, since the default layout of the array uses
4166 8-bit components, and thus the array requires a minimum of 64 bits.
4167
4168 If this declaration is compiled in a region of code covered by an occurrence
4169 of the configuration pragma Implicit_Packing, then the Size clause in this
4170 and similar examples will cause implicit packing and thus be accepted. For
4171 this implicit packing to occur, the type in question must be an array of small
4172 components whose size is known at compile time, and the Size clause must
4173 specify the exact size that corresponds to the number of elements in the array
4174 multiplied by the size in bits of the component type (both single and
4175 multi-dimensioned arrays can be controlled with this pragma).
4176
4177 @geindex Array packing
4178
4179 Similarly, the following example shows the use in the record case
4180
4181 @example
4182 type r is record
4183 a, b, c, d, e, f, g, h : boolean;
4184 chr : character;
4185 end record;
4186 for r'size use 16;
4187 @end example
4188
4189 Without a pragma Pack, each Boolean field requires 8 bits, so the
4190 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
4191 sufficient. The use of pragma Implicit_Packing allows this record
4192 declaration to compile without an explicit pragma Pack.
4193
4194 @node Pragma Import_Function,Pragma Import_Object,Pragma Implicit_Packing,Implementation Defined Pragmas
4195 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-function}@anchor{7a}
4196 @section Pragma Import_Function
4197
4198
4199 Syntax:
4200
4201 @example
4202 pragma Import_Function (
4203 [Internal =>] LOCAL_NAME,
4204 [, [External =>] EXTERNAL_SYMBOL]
4205 [, [Parameter_Types =>] PARAMETER_TYPES]
4206 [, [Result_Type =>] SUBTYPE_MARK]
4207 [, [Mechanism =>] MECHANISM]
4208 [, [Result_Mechanism =>] MECHANISM_NAME]);
4209
4210 EXTERNAL_SYMBOL ::=
4211 IDENTIFIER
4212 | static_string_EXPRESSION
4213
4214 PARAMETER_TYPES ::=
4215 null
4216 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4217
4218 TYPE_DESIGNATOR ::=
4219 subtype_NAME
4220 | subtype_Name ' Access
4221
4222 MECHANISM ::=
4223 MECHANISM_NAME
4224 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4225
4226 MECHANISM_ASSOCIATION ::=
4227 [formal_parameter_NAME =>] MECHANISM_NAME
4228
4229 MECHANISM_NAME ::=
4230 Value
4231 | Reference
4232 @end example
4233
4234 This pragma is used in conjunction with a pragma @code{Import} to
4235 specify additional information for an imported function. The pragma
4236 @code{Import} (or equivalent pragma @code{Interface}) must precede the
4237 @code{Import_Function} pragma and both must appear in the same
4238 declarative part as the function specification.
4239
4240 The @code{Internal} argument must uniquely designate
4241 the function to which the
4242 pragma applies. If more than one function name exists of this name in
4243 the declarative part you must use the @code{Parameter_Types} and
4244 @code{Result_Type} parameters to achieve the required unique
4245 designation. Subtype marks in these parameters must exactly match the
4246 subtypes in the corresponding function specification, using positional
4247 notation to match parameters with subtype marks.
4248 The form with an @code{'Access} attribute can be used to match an
4249 anonymous access parameter.
4250
4251 You may optionally use the @code{Mechanism} and @code{Result_Mechanism}
4252 parameters to specify passing mechanisms for the
4253 parameters and result. If you specify a single mechanism name, it
4254 applies to all parameters. Otherwise you may specify a mechanism on a
4255 parameter by parameter basis using either positional or named
4256 notation. If the mechanism is not specified, the default mechanism
4257 is used.
4258
4259 @node Pragma Import_Object,Pragma Import_Procedure,Pragma Import_Function,Implementation Defined Pragmas
4260 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-object}@anchor{7b}
4261 @section Pragma Import_Object
4262
4263
4264 Syntax:
4265
4266 @example
4267 pragma Import_Object
4268 [Internal =>] LOCAL_NAME
4269 [, [External =>] EXTERNAL_SYMBOL]
4270 [, [Size =>] EXTERNAL_SYMBOL]);
4271
4272 EXTERNAL_SYMBOL ::=
4273 IDENTIFIER
4274 | static_string_EXPRESSION
4275 @end example
4276
4277 This pragma designates an object as imported, and apart from the
4278 extended rules for external symbols, is identical in effect to the use of
4279 the normal @code{Import} pragma applied to an object. Unlike the
4280 subprogram case, you need not use a separate @code{Import} pragma,
4281 although you may do so (and probably should do so from a portability
4282 point of view). @code{size} is syntax checked, but otherwise ignored by
4283 GNAT.
4284
4285 @node Pragma Import_Procedure,Pragma Import_Valued_Procedure,Pragma Import_Object,Implementation Defined Pragmas
4286 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-procedure}@anchor{7c}
4287 @section Pragma Import_Procedure
4288
4289
4290 Syntax:
4291
4292 @example
4293 pragma Import_Procedure (
4294 [Internal =>] LOCAL_NAME
4295 [, [External =>] EXTERNAL_SYMBOL]
4296 [, [Parameter_Types =>] PARAMETER_TYPES]
4297 [, [Mechanism =>] MECHANISM]);
4298
4299 EXTERNAL_SYMBOL ::=
4300 IDENTIFIER
4301 | static_string_EXPRESSION
4302
4303 PARAMETER_TYPES ::=
4304 null
4305 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4306
4307 TYPE_DESIGNATOR ::=
4308 subtype_NAME
4309 | subtype_Name ' Access
4310
4311 MECHANISM ::=
4312 MECHANISM_NAME
4313 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4314
4315 MECHANISM_ASSOCIATION ::=
4316 [formal_parameter_NAME =>] MECHANISM_NAME
4317
4318 MECHANISM_NAME ::= Value | Reference
4319 @end example
4320
4321 This pragma is identical to @code{Import_Function} except that it
4322 applies to a procedure rather than a function and the parameters
4323 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
4324
4325 @node Pragma Import_Valued_Procedure,Pragma Independent,Pragma Import_Procedure,Implementation Defined Pragmas
4326 @anchor{gnat_rm/implementation_defined_pragmas pragma-import-valued-procedure}@anchor{7d}
4327 @section Pragma Import_Valued_Procedure
4328
4329
4330 Syntax:
4331
4332 @example
4333 pragma Import_Valued_Procedure (
4334 [Internal =>] LOCAL_NAME
4335 [, [External =>] EXTERNAL_SYMBOL]
4336 [, [Parameter_Types =>] PARAMETER_TYPES]
4337 [, [Mechanism =>] MECHANISM]);
4338
4339 EXTERNAL_SYMBOL ::=
4340 IDENTIFIER
4341 | static_string_EXPRESSION
4342
4343 PARAMETER_TYPES ::=
4344 null
4345 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
4346
4347 TYPE_DESIGNATOR ::=
4348 subtype_NAME
4349 | subtype_Name ' Access
4350
4351 MECHANISM ::=
4352 MECHANISM_NAME
4353 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
4354
4355 MECHANISM_ASSOCIATION ::=
4356 [formal_parameter_NAME =>] MECHANISM_NAME
4357
4358 MECHANISM_NAME ::= Value | Reference
4359 @end example
4360
4361 This pragma is identical to @code{Import_Procedure} except that the
4362 first parameter of @code{LOCAL_NAME}, which must be present, must be of
4363 mode @code{out}, and externally the subprogram is treated as a function
4364 with this parameter as the result of the function. The purpose of this
4365 capability is to allow the use of @code{out} and @code{in out}
4366 parameters in interfacing to external functions (which are not permitted
4367 in Ada functions). You may optionally use the @code{Mechanism}
4368 parameters to specify passing mechanisms for the parameters.
4369 If you specify a single mechanism name, it applies to all parameters.
4370 Otherwise you may specify a mechanism on a parameter by parameter
4371 basis using either positional or named notation. If the mechanism is not
4372 specified, the default mechanism is used.
4373
4374 Note that it is important to use this pragma in conjunction with a separate
4375 pragma Import that specifies the desired convention, since otherwise the
4376 default convention is Ada, which is almost certainly not what is required.
4377
4378 @node Pragma Independent,Pragma Independent_Components,Pragma Import_Valued_Procedure,Implementation Defined Pragmas
4379 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent}@anchor{7e}
4380 @section Pragma Independent
4381
4382
4383 Syntax:
4384
4385 @example
4386 pragma Independent (Local_NAME);
4387 @end example
4388
4389 This pragma is standard in Ada 2012 mode (which also provides an aspect
4390 of the same name). It is also available as an implementation-defined
4391 pragma in all earlier versions. It specifies that the
4392 designated object or all objects of the designated type must be
4393 independently addressable. This means that separate tasks can safely
4394 manipulate such objects. For example, if two components of a record are
4395 independent, then two separate tasks may access these two components.
4396 This may place
4397 constraints on the representation of the object (for instance prohibiting
4398 tight packing).
4399
4400 @node Pragma Independent_Components,Pragma Initial_Condition,Pragma Independent,Implementation Defined Pragmas
4401 @anchor{gnat_rm/implementation_defined_pragmas pragma-independent-components}@anchor{7f}
4402 @section Pragma Independent_Components
4403
4404
4405 Syntax:
4406
4407 @example
4408 pragma Independent_Components (Local_NAME);
4409 @end example
4410
4411 This pragma is standard in Ada 2012 mode (which also provides an aspect
4412 of the same name). It is also available as an implementation-defined
4413 pragma in all earlier versions. It specifies that the components of the
4414 designated object, or the components of each object of the designated
4415 type, must be
4416 independently addressable. This means that separate tasks can safely
4417 manipulate separate components in the composite object. This may place
4418 constraints on the representation of the object (for instance prohibiting
4419 tight packing).
4420
4421 @node Pragma Initial_Condition,Pragma Initialize_Scalars,Pragma Independent_Components,Implementation Defined Pragmas
4422 @anchor{gnat_rm/implementation_defined_pragmas id16}@anchor{80}@anchor{gnat_rm/implementation_defined_pragmas pragma-initial-condition}@anchor{81}
4423 @section Pragma Initial_Condition
4424
4425
4426 Syntax:
4427
4428 @example
4429 pragma Initial_Condition (boolean_EXPRESSION);
4430 @end example
4431
4432 For the semantics of this pragma, see the entry for aspect @code{Initial_Condition}
4433 in the SPARK 2014 Reference Manual, section 7.1.6.
4434
4435 @node Pragma Initialize_Scalars,Pragma Initializes,Pragma Initial_Condition,Implementation Defined Pragmas
4436 @anchor{gnat_rm/implementation_defined_pragmas pragma-initialize-scalars}@anchor{82}
4437 @section Pragma Initialize_Scalars
4438
4439
4440 @geindex debugging with Initialize_Scalars
4441
4442 Syntax:
4443
4444 @example
4445 pragma Initialize_Scalars
4446 [ ( TYPE_VALUE_PAIR @{, TYPE_VALUE_PAIR@} ) ];
4447
4448 TYPE_VALUE_PAIR ::=
4449 SCALAR_TYPE => static_EXPRESSION
4450
4451 SCALAR_TYPE :=
4452 Short_Float
4453 | Float
4454 | Long_Float
4455 | Long_Long_Flat
4456 | Signed_8
4457 | Signed_16
4458 | Signed_32
4459 | Signed_64
4460 | Unsigned_8
4461 | Unsigned_16
4462 | Unsigned_32
4463 | Unsigned_64
4464 @end example
4465
4466 This pragma is similar to @code{Normalize_Scalars} conceptually but has two
4467 important differences.
4468
4469 First, there is no requirement for the pragma to be used uniformly in all units
4470 of a partition. In particular, it is fine to use this just for some or all of
4471 the application units of a partition, without needing to recompile the run-time
4472 library. In the case where some units are compiled with the pragma, and some
4473 without, then a declaration of a variable where the type is defined in package
4474 Standard or is locally declared will always be subject to initialization, as
4475 will any declaration of a scalar variable. For composite variables, whether the
4476 variable is initialized may also depend on whether the package in which the
4477 type of the variable is declared is compiled with the pragma.
4478
4479 The other important difference is that the programmer can control the value
4480 used for initializing scalar objects. This effect can be achieved in several
4481 different ways:
4482
4483
4484 @itemize *
4485
4486 @item
4487 At compile time, the programmer can specify the invalid value for a
4488 particular family of scalar types using the optional arguments of the pragma.
4489
4490 The compile-time approach is intended to optimize the generated code for the
4491 pragma, by possibly using fast operations such as @code{memset}.
4492
4493 @item
4494 At bind time, the programmer has several options:
4495
4496
4497 @itemize *
4498
4499 @item
4500 Initialization with invalid values (similar to Normalize_Scalars, though
4501 for Initialize_Scalars it is not always possible to determine the invalid
4502 values in complex cases like signed component fields with nonstandard
4503 sizes).
4504
4505 @item
4506 Initialization with high values.
4507
4508 @item
4509 Initialization with low values.
4510
4511 @item
4512 Initialization with a specific bit pattern.
4513 @end itemize
4514
4515 See the GNAT User's Guide for binder options for specifying these cases.
4516
4517 The bind-time approach is intended to provide fast turnaround for testing
4518 with different values, without having to recompile the program.
4519
4520 @item
4521 At execution time, the programmer can speify the invalid values using an
4522 environment variable. See the GNAT User's Guide for details.
4523
4524 The execution-time approach is intended to provide fast turnaround for
4525 testing with different values, without having to recompile and rebind the
4526 program.
4527 @end itemize
4528
4529 Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction
4530 with the enhanced validity checking that is now provided in GNAT, which checks
4531 for invalid values under more conditions. Using this feature (see description
4532 of the @emph{-gnatV} flag in the GNAT User's Guide) in conjunction with pragma
4533 @code{Initialize_Scalars} provides a powerful new tool to assist in the detection
4534 of problems caused by uninitialized variables.
4535
4536 Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the
4537 generated code. This may cause your code to be substantially larger. It may
4538 also cause an increase in the amount of stack required, so it is probably a
4539 good idea to turn on stack checking (see description of stack checking in the
4540 GNAT User's Guide) when using this pragma.
4541
4542 @node Pragma Initializes,Pragma Inline_Always,Pragma Initialize_Scalars,Implementation Defined Pragmas
4543 @anchor{gnat_rm/implementation_defined_pragmas pragma-initializes}@anchor{83}@anchor{gnat_rm/implementation_defined_pragmas id17}@anchor{84}
4544 @section Pragma Initializes
4545
4546
4547 Syntax:
4548
4549 @example
4550 pragma Initializes (INITIALIZATION_LIST);
4551
4552 INITIALIZATION_LIST ::=
4553 null
4554 | (INITIALIZATION_ITEM @{, INITIALIZATION_ITEM@})
4555
4556 INITIALIZATION_ITEM ::= name [=> INPUT_LIST]
4557
4558 INPUT_LIST ::=
4559 null
4560 | INPUT
4561 | (INPUT @{, INPUT@})
4562
4563 INPUT ::= name
4564 @end example
4565
4566 For the semantics of this pragma, see the entry for aspect @code{Initializes} in the
4567 SPARK 2014 Reference Manual, section 7.1.5.
4568
4569 @node Pragma Inline_Always,Pragma Inline_Generic,Pragma Initializes,Implementation Defined Pragmas
4570 @anchor{gnat_rm/implementation_defined_pragmas id18}@anchor{85}@anchor{gnat_rm/implementation_defined_pragmas pragma-inline-always}@anchor{86}
4571 @section Pragma Inline_Always
4572
4573
4574 Syntax:
4575
4576 @example
4577 pragma Inline_Always (NAME [, NAME]);
4578 @end example
4579
4580 Similar to pragma @code{Inline} except that inlining is unconditional.
4581 Inline_Always instructs the compiler to inline every direct call to the
4582 subprogram or else to emit a compilation error, independently of any
4583 option, in particular @emph{-gnatn} or @emph{-gnatN} or the optimization level.
4584 It is an error to take the address or access of @code{NAME}. It is also an error to
4585 apply this pragma to a primitive operation of a tagged type. Thanks to such
4586 restrictions, the compiler is allowed to remove the out-of-line body of @code{NAME}.
4587
4588 @node Pragma Inline_Generic,Pragma Interface,Pragma Inline_Always,Implementation Defined Pragmas
4589 @anchor{gnat_rm/implementation_defined_pragmas pragma-inline-generic}@anchor{87}
4590 @section Pragma Inline_Generic
4591
4592
4593 Syntax:
4594
4595 @example
4596 pragma Inline_Generic (GNAME @{, GNAME@});
4597
4598 GNAME ::= generic_unit_NAME | generic_instance_NAME
4599 @end example
4600
4601 This pragma is provided for compatibility with Dec Ada 83. It has
4602 no effect in GNAT (which always inlines generics), other
4603 than to check that the given names are all names of generic units or
4604 generic instances.
4605
4606 @node Pragma Interface,Pragma Interface_Name,Pragma Inline_Generic,Implementation Defined Pragmas
4607 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface}@anchor{88}
4608 @section Pragma Interface
4609
4610
4611 Syntax:
4612
4613 @example
4614 pragma Interface (
4615 [Convention =>] convention_identifier,
4616 [Entity =>] local_NAME
4617 [, [External_Name =>] static_string_expression]
4618 [, [Link_Name =>] static_string_expression]);
4619 @end example
4620
4621 This pragma is identical in syntax and semantics to
4622 the standard Ada pragma @code{Import}. It is provided for compatibility
4623 with Ada 83. The definition is upwards compatible both with pragma
4624 @code{Interface} as defined in the Ada 83 Reference Manual, and also
4625 with some extended implementations of this pragma in certain Ada 83
4626 implementations. The only difference between pragma @code{Interface}
4627 and pragma @code{Import} is that there is special circuitry to allow
4628 both pragmas to appear for the same subprogram entity (normally it
4629 is illegal to have multiple @code{Import} pragmas. This is useful in
4630 maintaining Ada 83/Ada 95 compatibility and is compatible with other
4631 Ada 83 compilers.
4632
4633 @node Pragma Interface_Name,Pragma Interrupt_Handler,Pragma Interface,Implementation Defined Pragmas
4634 @anchor{gnat_rm/implementation_defined_pragmas pragma-interface-name}@anchor{89}
4635 @section Pragma Interface_Name
4636
4637
4638 Syntax:
4639
4640 @example
4641 pragma Interface_Name (
4642 [Entity =>] LOCAL_NAME
4643 [, [External_Name =>] static_string_EXPRESSION]
4644 [, [Link_Name =>] static_string_EXPRESSION]);
4645 @end example
4646
4647 This pragma provides an alternative way of specifying the interface name
4648 for an interfaced subprogram, and is provided for compatibility with Ada
4649 83 compilers that use the pragma for this purpose. You must provide at
4650 least one of @code{External_Name} or @code{Link_Name}.
4651
4652 @node Pragma Interrupt_Handler,Pragma Interrupt_State,Pragma Interface_Name,Implementation Defined Pragmas
4653 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-handler}@anchor{8a}
4654 @section Pragma Interrupt_Handler
4655
4656
4657 Syntax:
4658
4659 @example
4660 pragma Interrupt_Handler (procedure_LOCAL_NAME);
4661 @end example
4662
4663 This program unit pragma is supported for parameterless protected procedures
4664 as described in Annex C of the Ada Reference Manual. On the AAMP target
4665 the pragma can also be specified for nonprotected parameterless procedures
4666 that are declared at the library level (which includes procedures
4667 declared at the top level of a library package). In the case of AAMP,
4668 when this pragma is applied to a nonprotected procedure, the instruction
4669 @code{IERET} is generated for returns from the procedure, enabling
4670 maskable interrupts, in place of the normal return instruction.
4671
4672 @node Pragma Interrupt_State,Pragma Invariant,Pragma Interrupt_Handler,Implementation Defined Pragmas
4673 @anchor{gnat_rm/implementation_defined_pragmas pragma-interrupt-state}@anchor{8b}
4674 @section Pragma Interrupt_State
4675
4676
4677 Syntax:
4678
4679 @example
4680 pragma Interrupt_State
4681 ([Name =>] value,
4682 [State =>] SYSTEM | RUNTIME | USER);
4683 @end example
4684
4685 Normally certain interrupts are reserved to the implementation. Any attempt
4686 to attach an interrupt causes Program_Error to be raised, as described in
4687 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
4688 many systems for an @code{Ctrl-C} interrupt. Normally this interrupt is
4689 reserved to the implementation, so that @code{Ctrl-C} can be used to
4690 interrupt execution. Additionally, signals such as @code{SIGSEGV},
4691 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
4692 Ada exceptions, or used to implement run-time functions such as the
4693 @code{abort} statement and stack overflow checking.
4694
4695 Pragma @code{Interrupt_State} provides a general mechanism for overriding
4696 such uses of interrupts. It subsumes the functionality of pragma
4697 @code{Unreserve_All_Interrupts}. Pragma @code{Interrupt_State} is not
4698 available on Windows or VMS. On all other platforms than VxWorks,
4699 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
4700 and may be used to mark interrupts required by the board support package
4701 as reserved.
4702
4703 Interrupts can be in one of three states:
4704
4705
4706 @itemize *
4707
4708 @item
4709 System
4710
4711 The interrupt is reserved (no Ada handler can be installed), and the
4712 Ada run-time may not install a handler. As a result you are guaranteed
4713 standard system default action if this interrupt is raised. This also allows
4714 installing a low level handler via C APIs such as sigaction(), outside
4715 of Ada control.
4716
4717 @item
4718 Runtime
4719
4720 The interrupt is reserved (no Ada handler can be installed). The run time
4721 is allowed to install a handler for internal control purposes, but is
4722 not required to do so.
4723
4724 @item
4725 User
4726
4727 The interrupt is unreserved. The user may install an Ada handler via
4728 Ada.Interrupts and pragma Interrupt_Handler or Attach_Handler to provide
4729 some other action.
4730 @end itemize
4731
4732 These states are the allowed values of the @code{State} parameter of the
4733 pragma. The @code{Name} parameter is a value of the type
4734 @code{Ada.Interrupts.Interrupt_ID}. Typically, it is a name declared in
4735 @code{Ada.Interrupts.Names}.
4736
4737 This is a configuration pragma, and the binder will check that there
4738 are no inconsistencies between different units in a partition in how a
4739 given interrupt is specified. It may appear anywhere a pragma is legal.
4740
4741 The effect is to move the interrupt to the specified state.
4742
4743 By declaring interrupts to be SYSTEM, you guarantee the standard system
4744 action, such as a core dump.
4745
4746 By declaring interrupts to be USER, you guarantee that you can install
4747 a handler.
4748
4749 Note that certain signals on many operating systems cannot be caught and
4750 handled by applications. In such cases, the pragma is ignored. See the
4751 operating system documentation, or the value of the array @code{Reserved}
4752 declared in the spec of package @code{System.OS_Interface}.
4753
4754 Overriding the default state of signals used by the Ada runtime may interfere
4755 with an application's runtime behavior in the cases of the synchronous signals,
4756 and in the case of the signal used to implement the @code{abort} statement.
4757
4758 @node Pragma Invariant,Pragma Keep_Names,Pragma Interrupt_State,Implementation Defined Pragmas
4759 @anchor{gnat_rm/implementation_defined_pragmas id19}@anchor{8c}@anchor{gnat_rm/implementation_defined_pragmas pragma-invariant}@anchor{8d}
4760 @section Pragma Invariant
4761
4762
4763 Syntax:
4764
4765 @example
4766 pragma Invariant
4767 ([Entity =>] private_type_LOCAL_NAME,
4768 [Check =>] EXPRESSION
4769 [,[Message =>] String_Expression]);
4770 @end example
4771
4772 This pragma provides exactly the same capabilities as the Type_Invariant aspect
4773 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
4774 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
4775 requires the use of the aspect syntax, which is not available except in 2012
4776 mode, it is not possible to use the Type_Invariant aspect in earlier versions
4777 of Ada. However the Invariant pragma may be used in any version of Ada. Also
4778 note that the aspect Invariant is a synonym in GNAT for the aspect
4779 Type_Invariant, but there is no pragma Type_Invariant.
4780
4781 The pragma must appear within the visible part of the package specification,
4782 after the type to which its Entity argument appears. As with the Invariant
4783 aspect, the Check expression is not analyzed until the end of the visible
4784 part of the package, so it may contain forward references. The Message
4785 argument, if present, provides the exception message used if the invariant
4786 is violated. If no Message parameter is provided, a default message that
4787 identifies the line on which the pragma appears is used.
4788
4789 It is permissible to have multiple Invariants for the same type entity, in
4790 which case they are and'ed together. It is permissible to use this pragma
4791 in Ada 2012 mode, but you cannot have both an invariant aspect and an
4792 invariant pragma for the same entity.
4793
4794 For further details on the use of this pragma, see the Ada 2012 documentation
4795 of the Type_Invariant aspect.
4796
4797 @node Pragma Keep_Names,Pragma License,Pragma Invariant,Implementation Defined Pragmas
4798 @anchor{gnat_rm/implementation_defined_pragmas pragma-keep-names}@anchor{8e}
4799 @section Pragma Keep_Names
4800
4801
4802 Syntax:
4803
4804 @example
4805 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4806 @end example
4807
4808 The @code{LOCAL_NAME} argument
4809 must refer to an enumeration first subtype
4810 in the current declarative part. The effect is to retain the enumeration
4811 literal names for use by @code{Image} and @code{Value} even if a global
4812 @code{Discard_Names} pragma applies. This is useful when you want to
4813 generally suppress enumeration literal names and for example you therefore
4814 use a @code{Discard_Names} pragma in the @code{gnat.adc} file, but you
4815 want to retain the names for specific enumeration types.
4816
4817 @node Pragma License,Pragma Link_With,Pragma Keep_Names,Implementation Defined Pragmas
4818 @anchor{gnat_rm/implementation_defined_pragmas pragma-license}@anchor{8f}
4819 @section Pragma License
4820
4821
4822 @geindex License checking
4823
4824 Syntax:
4825
4826 @example
4827 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4828 @end example
4829
4830 This pragma is provided to allow automated checking for appropriate license
4831 conditions with respect to the standard and modified GPL. A pragma
4832 @code{License}, which is a configuration pragma that typically appears at
4833 the start of a source file or in a separate @code{gnat.adc} file, specifies
4834 the licensing conditions of a unit as follows:
4835
4836
4837 @itemize *
4838
4839 @item
4840 Unrestricted
4841 This is used for a unit that can be freely used with no license restrictions.
4842 Examples of such units are public domain units, and units from the Ada
4843 Reference Manual.
4844
4845 @item
4846 GPL
4847 This is used for a unit that is licensed under the unmodified GPL, and which
4848 therefore cannot be @code{with}ed by a restricted unit.
4849
4850 @item
4851 Modified_GPL
4852 This is used for a unit licensed under the GNAT modified GPL that includes
4853 a special exception paragraph that specifically permits the inclusion of
4854 the unit in programs without requiring the entire program to be released
4855 under the GPL.
4856
4857 @item
4858 Restricted
4859 This is used for a unit that is restricted in that it is not permitted to
4860 depend on units that are licensed under the GPL. Typical examples are
4861 proprietary code that is to be released under more restrictive license
4862 conditions. Note that restricted units are permitted to @code{with} units
4863 which are licensed under the modified GPL (this is the whole point of the
4864 modified GPL).
4865 @end itemize
4866
4867 Normally a unit with no @code{License} pragma is considered to have an
4868 unknown license, and no checking is done. However, standard GNAT headers
4869 are recognized, and license information is derived from them as follows.
4870
4871 A GNAT license header starts with a line containing 78 hyphens. The following
4872 comment text is searched for the appearance of any of the following strings.
4873
4874 If the string 'GNU General Public License' is found, then the unit is assumed
4875 to have GPL license, unless the string 'As a special exception' follows, in
4876 which case the license is assumed to be modified GPL.
4877
4878 If one of the strings
4879 'This specification is adapted from the Ada Semantic Interface' or
4880 'This specification is derived from the Ada Reference Manual' is found
4881 then the unit is assumed to be unrestricted.
4882
4883 These default actions means that a program with a restricted license pragma
4884 will automatically get warnings if a GPL unit is inappropriately
4885 @code{with}ed. For example, the program:
4886
4887 @example
4888 with Sem_Ch3;
4889 with GNAT.Sockets;
4890 procedure Secret_Stuff is
4891 ...
4892 end Secret_Stuff
4893 @end example
4894
4895 if compiled with pragma @code{License} (@code{Restricted}) in a
4896 @code{gnat.adc} file will generate the warning:
4897
4898 @example
4899 1. with Sem_Ch3;
4900 |
4901 >>> license of withed unit "Sem_Ch3" is incompatible
4902
4903 2. with GNAT.Sockets;
4904 3. procedure Secret_Stuff is
4905 @end example
4906
4907 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4908 compiler and is licensed under the
4909 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4910 run time, and is therefore licensed under the modified GPL.
4911
4912 @node Pragma Link_With,Pragma Linker_Alias,Pragma License,Implementation Defined Pragmas
4913 @anchor{gnat_rm/implementation_defined_pragmas pragma-link-with}@anchor{90}
4914 @section Pragma Link_With
4915
4916
4917 Syntax:
4918
4919 @example
4920 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4921 @end example
4922
4923 This pragma is provided for compatibility with certain Ada 83 compilers.
4924 It has exactly the same effect as pragma @code{Linker_Options} except
4925 that spaces occurring within one of the string expressions are treated
4926 as separators. For example, in the following case:
4927
4928 @example
4929 pragma Link_With ("-labc -ldef");
4930 @end example
4931
4932 results in passing the strings @code{-labc} and @code{-ldef} as two
4933 separate arguments to the linker. In addition pragma Link_With allows
4934 multiple arguments, with the same effect as successive pragmas.
4935
4936 @node Pragma Linker_Alias,Pragma Linker_Constructor,Pragma Link_With,Implementation Defined Pragmas
4937 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-alias}@anchor{91}
4938 @section Pragma Linker_Alias
4939
4940
4941 Syntax:
4942
4943 @example
4944 pragma Linker_Alias (
4945 [Entity =>] LOCAL_NAME,
4946 [Target =>] static_string_EXPRESSION);
4947 @end example
4948
4949 @code{LOCAL_NAME} must refer to an object that is declared at the library
4950 level. This pragma establishes the given entity as a linker alias for the
4951 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4952 and causes @code{LOCAL_NAME} to be emitted as an alias for the symbol
4953 @code{static_string_EXPRESSION} in the object file, that is to say no space
4954 is reserved for @code{LOCAL_NAME} by the assembler and it will be resolved
4955 to the same address as @code{static_string_EXPRESSION} by the linker.
4956
4957 The actual linker name for the target must be used (e.g., the fully
4958 encoded name with qualification in Ada, or the mangled name in C++),
4959 or it must be declared using the C convention with @code{pragma Import}
4960 or @code{pragma Export}.
4961
4962 Not all target machines support this pragma. On some of them it is accepted
4963 only if @code{pragma Weak_External} has been applied to @code{LOCAL_NAME}.
4964
4965 @example
4966 -- Example of the use of pragma Linker_Alias
4967
4968 package p is
4969 i : Integer := 1;
4970 pragma Export (C, i);
4971
4972 new_name_for_i : Integer;
4973 pragma Linker_Alias (new_name_for_i, "i");
4974 end p;
4975 @end example
4976
4977 @node Pragma Linker_Constructor,Pragma Linker_Destructor,Pragma Linker_Alias,Implementation Defined Pragmas
4978 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-constructor}@anchor{92}
4979 @section Pragma Linker_Constructor
4980
4981
4982 Syntax:
4983
4984 @example
4985 pragma Linker_Constructor (procedure_LOCAL_NAME);
4986 @end example
4987
4988 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4989 is declared at the library level. A procedure to which this pragma is
4990 applied will be treated as an initialization routine by the linker.
4991 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4992 causes @code{procedure_LOCAL_NAME} to be invoked before the entry point
4993 of the executable is called (or immediately after the shared library is
4994 loaded if the procedure is linked in a shared library), in particular
4995 before the Ada run-time environment is set up.
4996
4997 Because of these specific contexts, the set of operations such a procedure
4998 can perform is very limited and the type of objects it can manipulate is
4999 essentially restricted to the elementary types. In particular, it must only
5000 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
5001
5002 This pragma is used by GNAT to implement auto-initialization of shared Stand
5003 Alone Libraries, which provides a related capability without the restrictions
5004 listed above. Where possible, the use of Stand Alone Libraries is preferable
5005 to the use of this pragma.
5006
5007 @node Pragma Linker_Destructor,Pragma Linker_Section,Pragma Linker_Constructor,Implementation Defined Pragmas
5008 @anchor{gnat_rm/implementation_defined_pragmas pragma-linker-destructor}@anchor{93}
5009 @section Pragma Linker_Destructor
5010
5011
5012 Syntax:
5013
5014 @example
5015 pragma Linker_Destructor (procedure_LOCAL_NAME);
5016 @end example
5017
5018 @code{procedure_LOCAL_NAME} must refer to a parameterless procedure that
5019 is declared at the library level. A procedure to which this pragma is
5020 applied will be treated as a finalization routine by the linker.
5021 It is equivalent to @code{__attribute__((destructor))} in GNU C and
5022 causes @code{procedure_LOCAL_NAME} to be invoked after the entry point
5023 of the executable has exited (or immediately before the shared library
5024 is unloaded if the procedure is linked in a shared library), in particular
5025 after the Ada run-time environment is shut down.
5026
5027 See @code{pragma Linker_Constructor} for the set of restrictions that apply
5028 because of these specific contexts.
5029
5030 @node Pragma Linker_Section,Pragma Lock_Free,Pragma Linker_Destructor,Implementation Defined Pragmas
5031 @anchor{gnat_rm/implementation_defined_pragmas id20}@anchor{94}@anchor{gnat_rm/implementation_defined_pragmas pragma-linker-section}@anchor{95}
5032 @section Pragma Linker_Section
5033
5034
5035 Syntax:
5036
5037 @example
5038 pragma Linker_Section (
5039 [Entity =>] LOCAL_NAME,
5040 [Section =>] static_string_EXPRESSION);
5041 @end example
5042
5043 @code{LOCAL_NAME} must refer to an object, type, or subprogram that is
5044 declared at the library level. This pragma specifies the name of the
5045 linker section for the given entity. It is equivalent to
5046 @code{__attribute__((section))} in GNU C and causes @code{LOCAL_NAME} to
5047 be placed in the @code{static_string_EXPRESSION} section of the
5048 executable (assuming the linker doesn't rename the section).
5049 GNAT also provides an implementation defined aspect of the same name.
5050
5051 In the case of specifying this aspect for a type, the effect is to
5052 specify the corresponding section for all library-level objects of
5053 the type that do not have an explicit linker section set. Note that
5054 this only applies to whole objects, not to components of composite objects.
5055
5056 In the case of a subprogram, the linker section applies to all previously
5057 declared matching overloaded subprograms in the current declarative part
5058 which do not already have a linker section assigned. The linker section
5059 aspect is useful in this case for specifying different linker sections
5060 for different elements of such an overloaded set.
5061
5062 Note that an empty string specifies that no linker section is specified.
5063 This is not quite the same as omitting the pragma or aspect, since it
5064 can be used to specify that one element of an overloaded set of subprograms
5065 has the default linker section, or that one object of a type for which a
5066 linker section is specified should has the default linker section.
5067
5068 The compiler normally places library-level entities in standard sections
5069 depending on the class: procedures and functions generally go in the
5070 @code{.text} section, initialized variables in the @code{.data} section
5071 and uninitialized variables in the @code{.bss} section.
5072
5073 Other, special sections may exist on given target machines to map special
5074 hardware, for example I/O ports or flash memory. This pragma is a means to
5075 defer the final layout of the executable to the linker, thus fully working
5076 at the symbolic level with the compiler.
5077
5078 Some file formats do not support arbitrary sections so not all target
5079 machines support this pragma. The use of this pragma may cause a program
5080 execution to be erroneous if it is used to place an entity into an
5081 inappropriate section (e.g., a modified variable into the @code{.text}
5082 section). See also @code{pragma Persistent_BSS}.
5083
5084 @example
5085 -- Example of the use of pragma Linker_Section
5086
5087 package IO_Card is
5088 Port_A : Integer;
5089 pragma Volatile (Port_A);
5090 pragma Linker_Section (Port_A, ".bss.port_a");
5091
5092 Port_B : Integer;
5093 pragma Volatile (Port_B);
5094 pragma Linker_Section (Port_B, ".bss.port_b");
5095
5096 type Port_Type is new Integer with Linker_Section => ".bss";
5097 PA : Port_Type with Linker_Section => ".bss.PA";
5098 PB : Port_Type; -- ends up in linker section ".bss"
5099
5100 procedure Q with Linker_Section => "Qsection";
5101 end IO_Card;
5102 @end example
5103
5104 @node Pragma Lock_Free,Pragma Loop_Invariant,Pragma Linker_Section,Implementation Defined Pragmas
5105 @anchor{gnat_rm/implementation_defined_pragmas id21}@anchor{96}@anchor{gnat_rm/implementation_defined_pragmas pragma-lock-free}@anchor{97}
5106 @section Pragma Lock_Free
5107
5108
5109 Syntax:
5110 This pragma may be specified for protected types or objects. It specifies that
5111 the implementation of protected operations must be implemented without locks.
5112 Compilation fails if the compiler cannot generate lock-free code for the
5113 operations.
5114
5115 @node Pragma Loop_Invariant,Pragma Loop_Optimize,Pragma Lock_Free,Implementation Defined Pragmas
5116 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-invariant}@anchor{98}
5117 @section Pragma Loop_Invariant
5118
5119
5120 Syntax:
5121
5122 @example
5123 pragma Loop_Invariant ( boolean_EXPRESSION );
5124 @end example
5125
5126 The effect of this pragma is similar to that of pragma @code{Assert},
5127 except that in an @code{Assertion_Policy} pragma, the identifier
5128 @code{Loop_Invariant} is used to control whether it is ignored or checked
5129 (or disabled).
5130
5131 @code{Loop_Invariant} can only appear as one of the items in the sequence
5132 of statements of a loop body, or nested inside block statements that
5133 appear in the sequence of statements of a loop body.
5134 The intention is that it be used to
5135 represent a "loop invariant" assertion, i.e. something that is true each
5136 time through the loop, and which can be used to show that the loop is
5137 achieving its purpose.
5138
5139 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5140 apply to the same loop should be grouped in the same sequence of
5141 statements.
5142
5143 To aid in writing such invariants, the special attribute @code{Loop_Entry}
5144 may be used to refer to the value of an expression on entry to the loop. This
5145 attribute can only be used within the expression of a @code{Loop_Invariant}
5146 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
5147
5148 @node Pragma Loop_Optimize,Pragma Loop_Variant,Pragma Loop_Invariant,Implementation Defined Pragmas
5149 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-optimize}@anchor{99}
5150 @section Pragma Loop_Optimize
5151
5152
5153 Syntax:
5154
5155 @example
5156 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
5157
5158 OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector
5159 @end example
5160
5161 This pragma must appear immediately within a loop statement. It allows the
5162 programmer to specify optimization hints for the enclosing loop. The hints
5163 are not mutually exclusive and can be freely mixed, but not all combinations
5164 will yield a sensible outcome.
5165
5166 There are five supported optimization hints for a loop:
5167
5168
5169 @itemize *
5170
5171 @item
5172 Ivdep
5173
5174 The programmer asserts that there are no loop-carried dependencies
5175 which would prevent consecutive iterations of the loop from being
5176 executed simultaneously.
5177
5178 @item
5179 No_Unroll
5180
5181 The loop must not be unrolled. This is a strong hint: the compiler will not
5182 unroll a loop marked with this hint.
5183
5184 @item
5185 Unroll
5186
5187 The loop should be unrolled. This is a weak hint: the compiler will try to
5188 apply unrolling to this loop preferably to other optimizations, notably
5189 vectorization, but there is no guarantee that the loop will be unrolled.
5190
5191 @item
5192 No_Vector
5193
5194 The loop must not be vectorized. This is a strong hint: the compiler will not
5195 vectorize a loop marked with this hint.
5196
5197 @item
5198 Vector
5199
5200 The loop should be vectorized. This is a weak hint: the compiler will try to
5201 apply vectorization to this loop preferably to other optimizations, notably
5202 unrolling, but there is no guarantee that the loop will be vectorized.
5203 @end itemize
5204
5205 These hints do not remove the need to pass the appropriate switches to the
5206 compiler in order to enable the relevant optimizations, that is to say
5207 @emph{-funroll-loops} for unrolling and @emph{-ftree-vectorize} for
5208 vectorization.
5209
5210 @node Pragma Loop_Variant,Pragma Machine_Attribute,Pragma Loop_Optimize,Implementation Defined Pragmas
5211 @anchor{gnat_rm/implementation_defined_pragmas pragma-loop-variant}@anchor{9a}
5212 @section Pragma Loop_Variant
5213
5214
5215 Syntax:
5216
5217 @example
5218 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
5219 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
5220 CHANGE_DIRECTION ::= Increases | Decreases
5221 @end example
5222
5223 @code{Loop_Variant} can only appear as one of the items in the sequence
5224 of statements of a loop body, or nested inside block statements that
5225 appear in the sequence of statements of a loop body.
5226 It allows the specification of quantities which must always
5227 decrease or increase in successive iterations of the loop. In its simplest
5228 form, just one expression is specified, whose value must increase or decrease
5229 on each iteration of the loop.
5230
5231 In a more complex form, multiple arguments can be given which are intepreted
5232 in a nesting lexicographic manner. For example:
5233
5234 @example
5235 pragma Loop_Variant (Increases => X, Decreases => Y);
5236 @end example
5237
5238 specifies that each time through the loop either X increases, or X stays
5239 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
5240 loop is making progress. It can be useful in helping to show informally
5241 or prove formally that the loop always terminates.
5242
5243 @code{Loop_Variant} is an assertion whose effect can be controlled using
5244 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
5245 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
5246 to ignore the check (in which case the pragma has no effect on the program),
5247 or @code{Disable} in which case the pragma is not even checked for correct
5248 syntax.
5249
5250 Multiple @code{Loop_Invariant} and @code{Loop_Variant} pragmas that
5251 apply to the same loop should be grouped in the same sequence of
5252 statements.
5253
5254 The @code{Loop_Entry} attribute may be used within the expressions of the
5255 @code{Loop_Variant} pragma to refer to values on entry to the loop.
5256
5257 @node Pragma Machine_Attribute,Pragma Main,Pragma Loop_Variant,Implementation Defined Pragmas
5258 @anchor{gnat_rm/implementation_defined_pragmas pragma-machine-attribute}@anchor{9b}
5259 @section Pragma Machine_Attribute
5260
5261
5262 Syntax:
5263
5264 @example
5265 pragma Machine_Attribute (
5266 [Entity =>] LOCAL_NAME,
5267 [Attribute_Name =>] static_string_EXPRESSION
5268 [, [Info =>] static_EXPRESSION @{, static_EXPRESSION@}] );
5269 @end example
5270
5271 Machine-dependent attributes can be specified for types and/or
5272 declarations. This pragma is semantically equivalent to
5273 @code{__attribute__((@emph{attribute_name}))} (if @code{info} is not
5274 specified) or @code{__attribute__((@emph{attribute_name(info})))}
5275 or @code{__attribute__((@emph{attribute_name(info,...})))} in GNU C,
5276 where @emph{attribute_name} is recognized by the compiler middle-end
5277 or the @code{TARGET_ATTRIBUTE_TABLE} machine specific macro. Note
5278 that a string literal for the optional parameter @code{info} or the
5279 following ones is transformed by default into an identifier,
5280 which may make this pragma unusable for some attributes.
5281 For further information see @cite{GNU Compiler Collection (GCC) Internals}.
5282
5283 @node Pragma Main,Pragma Main_Storage,Pragma Machine_Attribute,Implementation Defined Pragmas
5284 @anchor{gnat_rm/implementation_defined_pragmas pragma-main}@anchor{9c}
5285 @section Pragma Main
5286
5287
5288 Syntax:
5289
5290 @example
5291 pragma Main
5292 (MAIN_OPTION [, MAIN_OPTION]);
5293
5294 MAIN_OPTION ::=
5295 [Stack_Size =>] static_integer_EXPRESSION
5296 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
5297 | [Time_Slicing_Enabled =>] static_boolean_EXPRESSION
5298 @end example
5299
5300 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5301 no effect in GNAT, other than being syntax checked.
5302
5303 @node Pragma Main_Storage,Pragma Max_Queue_Length,Pragma Main,Implementation Defined Pragmas
5304 @anchor{gnat_rm/implementation_defined_pragmas pragma-main-storage}@anchor{9d}
5305 @section Pragma Main_Storage
5306
5307
5308 Syntax:
5309
5310 @example
5311 pragma Main_Storage
5312 (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
5313
5314 MAIN_STORAGE_OPTION ::=
5315 [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
5316 | [TOP_GUARD =>] static_SIMPLE_EXPRESSION
5317 @end example
5318
5319 This pragma is provided for compatibility with OpenVMS VAX Systems. It has
5320 no effect in GNAT, other than being syntax checked.
5321
5322 @node Pragma Max_Queue_Length,Pragma No_Body,Pragma Main_Storage,Implementation Defined Pragmas
5323 @anchor{gnat_rm/implementation_defined_pragmas id22}@anchor{9e}@anchor{gnat_rm/implementation_defined_pragmas pragma-max-queue-length}@anchor{9f}
5324 @section Pragma Max_Queue_Length
5325
5326
5327 Syntax:
5328
5329 @example
5330 pragma Max_Entry_Queue (static_integer_EXPRESSION);
5331 @end example
5332
5333 This pragma is used to specify the maximum callers per entry queue for
5334 individual protected entries and entry families. It accepts a single
5335 positive integer as a parameter and must appear after the declaration
5336 of an entry.
5337
5338 @node Pragma No_Body,Pragma No_Component_Reordering,Pragma Max_Queue_Length,Implementation Defined Pragmas
5339 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a0}
5340 @section Pragma No_Body
5341
5342
5343 Syntax:
5344
5345 @example
5346 pragma No_Body;
5347 @end example
5348
5349 There are a number of cases in which a package spec does not require a body,
5350 and in fact a body is not permitted. GNAT will not permit the spec to be
5351 compiled if there is a body around. The pragma No_Body allows you to provide
5352 a body file, even in a case where no body is allowed. The body file must
5353 contain only comments and a single No_Body pragma. This is recognized by
5354 the compiler as indicating that no body is logically present.
5355
5356 This is particularly useful during maintenance when a package is modified in
5357 such a way that a body needed before is no longer needed. The provision of a
5358 dummy body with a No_Body pragma ensures that there is no interference from
5359 earlier versions of the package body.
5360
5361 @node Pragma No_Component_Reordering,Pragma No_Elaboration_Code_All,Pragma No_Body,Implementation Defined Pragmas
5362 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-component-reordering}@anchor{a1}
5363 @section Pragma No_Component_Reordering
5364
5365
5366 Syntax:
5367
5368 @example
5369 pragma No_Component_Reordering [([Entity =>] type_LOCAL_NAME)];
5370 @end example
5371
5372 @code{type_LOCAL_NAME} must refer to a record type declaration in the current
5373 declarative part. The effect is to preclude any reordering of components
5374 for the layout of the record, i.e. the record is laid out by the compiler
5375 in the order in which the components are declared textually. The form with
5376 no argument is a configuration pragma which applies to all record types
5377 declared in units to which the pragma applies and there is a requirement
5378 that this pragma be used consistently within a partition.
5379
5380 @node Pragma No_Elaboration_Code_All,Pragma No_Heap_Finalization,Pragma No_Component_Reordering,Implementation Defined Pragmas
5381 @anchor{gnat_rm/implementation_defined_pragmas id23}@anchor{a2}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-elaboration-code-all}@anchor{a3}
5382 @section Pragma No_Elaboration_Code_All
5383
5384
5385 Syntax:
5386
5387 @example
5388 pragma No_Elaboration_Code_All [(program_unit_NAME)];
5389 @end example
5390
5391 This is a program unit pragma (there is also an equivalent aspect of the
5392 same name) that establishes the restriction @code{No_Elaboration_Code} for
5393 the current unit and any extended main source units (body and subunits).
5394 It also has the effect of enforcing a transitive application of this
5395 aspect, so that if any unit is implicitly or explicitly with'ed by the
5396 current unit, it must also have the No_Elaboration_Code_All aspect set.
5397 It may be applied to package or subprogram specs or their generic versions.
5398
5399 @node Pragma No_Heap_Finalization,Pragma No_Inline,Pragma No_Elaboration_Code_All,Implementation Defined Pragmas
5400 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-heap-finalization}@anchor{a4}
5401 @section Pragma No_Heap_Finalization
5402
5403
5404 Syntax:
5405
5406 @example
5407 pragma No_Heap_Finalization [ (first_subtype_LOCAL_NAME) ];
5408 @end example
5409
5410 Pragma @code{No_Heap_Finalization} may be used as a configuration pragma or as a
5411 type-specific pragma.
5412
5413 In its configuration form, the pragma must appear within a configuration file
5414 such as gnat.adc, without an argument. The pragma suppresses the call to
5415 @code{Finalize} for heap-allocated objects created through library-level named
5416 access-to-object types in cases where the designated type requires finalization
5417 actions.
5418
5419 In its type-specific form, the argument of the pragma must denote a
5420 library-level named access-to-object type. The pragma suppresses the call to
5421 @code{Finalize} for heap-allocated objects created through the specific access type
5422 in cases where the designated type requires finalization actions.
5423
5424 It is still possible to finalize such heap-allocated objects by explicitly
5425 deallocating them.
5426
5427 A library-level named access-to-object type declared within a generic unit will
5428 lose its @code{No_Heap_Finalization} pragma when the corresponding instance does not
5429 appear at the library level.
5430
5431 @node Pragma No_Inline,Pragma No_Return,Pragma No_Heap_Finalization,Implementation Defined Pragmas
5432 @anchor{gnat_rm/implementation_defined_pragmas id24}@anchor{a5}@anchor{gnat_rm/implementation_defined_pragmas pragma-no-inline}@anchor{a6}
5433 @section Pragma No_Inline
5434
5435
5436 Syntax:
5437
5438 @example
5439 pragma No_Inline (NAME @{, NAME@});
5440 @end example
5441
5442 This pragma suppresses inlining for the callable entity or the instances of
5443 the generic subprogram designated by @code{NAME}, including inlining that
5444 results from the use of pragma @code{Inline}. This pragma is always active,
5445 in particular it is not subject to the use of option @emph{-gnatn} or
5446 @emph{-gnatN}. It is illegal to specify both pragma @code{No_Inline} and
5447 pragma @code{Inline_Always} for the same @code{NAME}.
5448
5449 @node Pragma No_Return,Pragma No_Run_Time,Pragma No_Inline,Implementation Defined Pragmas
5450 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-return}@anchor{a7}
5451 @section Pragma No_Return
5452
5453
5454 Syntax:
5455
5456 @example
5457 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
5458 @end example
5459
5460 Each @code{procedure_LOCAL_NAME} argument must refer to one or more procedure
5461 declarations in the current declarative part. A procedure to which this
5462 pragma is applied may not contain any explicit @code{return} statements.
5463 In addition, if the procedure contains any implicit returns from falling
5464 off the end of a statement sequence, then execution of that implicit
5465 return will cause Program_Error to be raised.
5466
5467 One use of this pragma is to identify procedures whose only purpose is to raise
5468 an exception. Another use of this pragma is to suppress incorrect warnings
5469 about missing returns in functions, where the last statement of a function
5470 statement sequence is a call to such a procedure.
5471
5472 Note that in Ada 2005 mode, this pragma is part of the language. It is
5473 available in all earlier versions of Ada as an implementation-defined
5474 pragma.
5475
5476 @node Pragma No_Run_Time,Pragma No_Strict_Aliasing,Pragma No_Return,Implementation Defined Pragmas
5477 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-run-time}@anchor{a8}
5478 @section Pragma No_Run_Time
5479
5480
5481 Syntax:
5482
5483 @example
5484 pragma No_Run_Time;
5485 @end example
5486
5487 This is an obsolete configuration pragma that historically was used to
5488 set up a runtime library with no object code. It is now used only for
5489 internal testing. The pragma has been superseded by the reconfigurable
5490 runtime capability of GNAT.
5491
5492 @node Pragma No_Strict_Aliasing,Pragma No_Tagged_Streams,Pragma No_Run_Time,Implementation Defined Pragmas
5493 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-strict-aliasing}@anchor{a9}
5494 @section Pragma No_Strict_Aliasing
5495
5496
5497 Syntax:
5498
5499 @example
5500 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
5501 @end example
5502
5503 @code{type_LOCAL_NAME} must refer to an access type
5504 declaration in the current declarative part. The effect is to inhibit
5505 strict aliasing optimization for the given type. The form with no
5506 arguments is a configuration pragma which applies to all access types
5507 declared in units to which the pragma applies. For a detailed
5508 description of the strict aliasing optimization, and the situations
5509 in which it must be suppressed, see the section on Optimization and Strict Aliasing
5510 in the @cite{GNAT User's Guide}.
5511
5512 This pragma currently has no effects on access to unconstrained array types.
5513
5514 @node Pragma No_Tagged_Streams,Pragma Normalize_Scalars,Pragma No_Strict_Aliasing,Implementation Defined Pragmas
5515 @anchor{gnat_rm/implementation_defined_pragmas pragma-no-tagged-streams}@anchor{aa}@anchor{gnat_rm/implementation_defined_pragmas id25}@anchor{ab}
5516 @section Pragma No_Tagged_Streams
5517
5518
5519 Syntax:
5520
5521 @example
5522 pragma No_Tagged_Streams [([Entity =>] tagged_type_LOCAL_NAME)];
5523 @end example
5524
5525 Normally when a tagged type is introduced using a full type declaration,
5526 part of the processing includes generating stream access routines to be
5527 used by stream attributes referencing the type (or one of its subtypes
5528 or derived types). This can involve the generation of significant amounts
5529 of code which is wasted space if stream routines are not needed for the
5530 type in question.
5531
5532 The @code{No_Tagged_Streams} pragma causes the generation of these stream
5533 routines to be skipped, and any attempt to use stream operations on
5534 types subject to this pragma will be statically rejected as illegal.
5535
5536 There are two forms of the pragma. The form with no arguments must appear
5537 in a declarative sequence or in the declarations of a package spec. This
5538 pragma affects all subsequent root tagged types declared in the declaration
5539 sequence, and specifies that no stream routines be generated. The form with
5540 an argument (for which there is also a corresponding aspect) specifies a
5541 single root tagged type for which stream routines are not to be generated.
5542
5543 Once the pragma has been given for a particular root tagged type, all subtypes
5544 and derived types of this type inherit the pragma automatically, so the effect
5545 applies to a complete hierarchy (this is necessary to deal with the class-wide
5546 dispatching versions of the stream routines).
5547
5548 When pragmas @code{Discard_Names} and @code{No_Tagged_Streams} are simultaneously
5549 applied to a tagged type its Expanded_Name and External_Tag are initialized
5550 with empty strings. This is useful to avoid exposing entity names at binary
5551 level but has a negative impact on the debuggability of tagged types.
5552
5553 @node Pragma Normalize_Scalars,Pragma Obsolescent,Pragma No_Tagged_Streams,Implementation Defined Pragmas
5554 @anchor{gnat_rm/implementation_defined_pragmas pragma-normalize-scalars}@anchor{ac}
5555 @section Pragma Normalize_Scalars
5556
5557
5558 Syntax:
5559
5560 @example
5561 pragma Normalize_Scalars;
5562 @end example
5563
5564 This is a language defined pragma which is fully implemented in GNAT. The
5565 effect is to cause all scalar objects that are not otherwise initialized
5566 to be initialized. The initial values are implementation dependent and
5567 are as follows:
5568
5569
5570 @table @asis
5571
5572 @item @emph{Standard.Character}
5573
5574 Objects whose root type is Standard.Character are initialized to
5575 Character'Last unless the subtype range excludes NUL (in which case
5576 NUL is used). This choice will always generate an invalid value if
5577 one exists.
5578
5579 @item @emph{Standard.Wide_Character}
5580
5581 Objects whose root type is Standard.Wide_Character are initialized to
5582 Wide_Character'Last unless the subtype range excludes NUL (in which case
5583 NUL is used). This choice will always generate an invalid value if
5584 one exists.
5585
5586 @item @emph{Standard.Wide_Wide_Character}
5587
5588 Objects whose root type is Standard.Wide_Wide_Character are initialized to
5589 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
5590 which case NUL is used). This choice will always generate an invalid value if
5591 one exists.
5592
5593 @item @emph{Integer types}
5594
5595 Objects of an integer type are treated differently depending on whether
5596 negative values are present in the subtype. If no negative values are
5597 present, then all one bits is used as the initial value except in the
5598 special case where zero is excluded from the subtype, in which case
5599 all zero bits are used. This choice will always generate an invalid
5600 value if one exists.
5601
5602 For subtypes with negative values present, the largest negative number
5603 is used, except in the unusual case where this largest negative number
5604 is in the subtype, and the largest positive number is not, in which case
5605 the largest positive value is used. This choice will always generate
5606 an invalid value if one exists.
5607
5608 @item @emph{Floating-Point Types}
5609
5610 Objects of all floating-point types are initialized to all 1-bits. For
5611 standard IEEE format, this corresponds to a NaN (not a number) which is
5612 indeed an invalid value.
5613
5614 @item @emph{Fixed-Point Types}
5615
5616 Objects of all fixed-point types are treated as described above for integers,
5617 with the rules applying to the underlying integer value used to represent
5618 the fixed-point value.
5619
5620 @item @emph{Modular types}
5621
5622 Objects of a modular type are initialized to all one bits, except in
5623 the special case where zero is excluded from the subtype, in which
5624 case all zero bits are used. This choice will always generate an
5625 invalid value if one exists.
5626
5627 @item @emph{Enumeration types}
5628
5629 Objects of an enumeration type are initialized to all one-bits, i.e., to
5630 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
5631 whose Pos value is zero, in which case a code of zero is used. This choice
5632 will always generate an invalid value if one exists.
5633 @end table
5634
5635 @node Pragma Obsolescent,Pragma Optimize_Alignment,Pragma Normalize_Scalars,Implementation Defined Pragmas
5636 @anchor{gnat_rm/implementation_defined_pragmas pragma-obsolescent}@anchor{ad}@anchor{gnat_rm/implementation_defined_pragmas id26}@anchor{ae}
5637 @section Pragma Obsolescent
5638
5639
5640 Syntax:
5641
5642 @example
5643 pragma Obsolescent;
5644
5645 pragma Obsolescent (
5646 [Message =>] static_string_EXPRESSION
5647 [,[Version =>] Ada_05]]);
5648
5649 pragma Obsolescent (
5650 [Entity =>] NAME
5651 [,[Message =>] static_string_EXPRESSION
5652 [,[Version =>] Ada_05]] );
5653 @end example
5654
5655 This pragma can occur immediately following a declaration of an entity,
5656 including the case of a record component. If no Entity argument is present,
5657 then this declaration is the one to which the pragma applies. If an Entity
5658 parameter is present, it must either match the name of the entity in this
5659 declaration, or alternatively, the pragma can immediately follow an enumeration
5660 type declaration, where the Entity argument names one of the enumeration
5661 literals.
5662
5663 This pragma is used to indicate that the named entity
5664 is considered obsolescent and should not be used. Typically this is
5665 used when an API must be modified by eventually removing or modifying
5666 existing subprograms or other entities. The pragma can be used at an
5667 intermediate stage when the entity is still present, but will be
5668 removed later.
5669
5670 The effect of this pragma is to output a warning message on a reference to
5671 an entity thus marked that the subprogram is obsolescent if the appropriate
5672 warning option in the compiler is activated. If the @code{Message} parameter is
5673 present, then a second warning message is given containing this text. In
5674 addition, a reference to the entity is considered to be a violation of pragma
5675 @code{Restrictions (No_Obsolescent_Features)}.
5676
5677 This pragma can also be used as a program unit pragma for a package,
5678 in which case the entity name is the name of the package, and the
5679 pragma indicates that the entire package is considered
5680 obsolescent. In this case a client @code{with}ing such a package
5681 violates the restriction, and the @code{with} clause is
5682 flagged with warnings if the warning option is set.
5683
5684 If the @code{Version} parameter is present (which must be exactly
5685 the identifier @code{Ada_05}, no other argument is allowed), then the
5686 indication of obsolescence applies only when compiling in Ada 2005
5687 mode. This is primarily intended for dealing with the situations
5688 in the predefined library where subprograms or packages
5689 have become defined as obsolescent in Ada 2005
5690 (e.g., in @code{Ada.Characters.Handling}), but may be used anywhere.
5691
5692 The following examples show typical uses of this pragma:
5693
5694 @example
5695 package p is
5696 pragma Obsolescent (p, Message => "use pp instead of p");
5697 end p;
5698
5699 package q is
5700 procedure q2;
5701 pragma Obsolescent ("use q2new instead");
5702
5703 type R is new integer;
5704 pragma Obsolescent
5705 (Entity => R,
5706 Message => "use RR in Ada 2005",
5707 Version => Ada_05);
5708
5709 type M is record
5710 F1 : Integer;
5711 F2 : Integer;
5712 pragma Obsolescent;
5713 F3 : Integer;
5714 end record;
5715
5716 type E is (a, bc, 'd', quack);
5717 pragma Obsolescent (Entity => bc)
5718 pragma Obsolescent (Entity => 'd')
5719
5720 function "+"
5721 (a, b : character) return character;
5722 pragma Obsolescent (Entity => "+");
5723 end;
5724 @end example
5725
5726 Note that, as for all pragmas, if you use a pragma argument identifier,
5727 then all subsequent parameters must also use a pragma argument identifier.
5728 So if you specify @code{Entity =>} for the @code{Entity} argument, and a @code{Message}
5729 argument is present, it must be preceded by @code{Message =>}.
5730
5731 @node Pragma Optimize_Alignment,Pragma Ordered,Pragma Obsolescent,Implementation Defined Pragmas
5732 @anchor{gnat_rm/implementation_defined_pragmas pragma-optimize-alignment}@anchor{af}
5733 @section Pragma Optimize_Alignment
5734
5735
5736 @geindex Alignment
5737 @geindex default settings
5738
5739 Syntax:
5740
5741 @example
5742 pragma Optimize_Alignment (TIME | SPACE | OFF);
5743 @end example
5744
5745 This is a configuration pragma which affects the choice of default alignments
5746 for types and objects where no alignment is explicitly specified. There is a
5747 time/space trade-off in the selection of these values. Large alignments result
5748 in more efficient code, at the expense of larger data space, since sizes have
5749 to be increased to match these alignments. Smaller alignments save space, but
5750 the access code is slower. The normal choice of default alignments for types
5751 and individual alignment promotions for objects (which is what you get if you
5752 do not use this pragma, or if you use an argument of OFF), tries to balance
5753 these two requirements.
5754
5755 Specifying SPACE causes smaller default alignments to be chosen in two cases.
5756 First any packed record is given an alignment of 1. Second, if a size is given
5757 for the type, then the alignment is chosen to avoid increasing this size. For
5758 example, consider:
5759
5760 @example
5761 type R is record
5762 X : Integer;
5763 Y : Character;
5764 end record;
5765
5766 for R'Size use 5*8;
5767 @end example
5768
5769 In the default mode, this type gets an alignment of 4, so that access to the
5770 Integer field X are efficient. But this means that objects of the type end up
5771 with a size of 8 bytes. This is a valid choice, since sizes of objects are
5772 allowed to be bigger than the size of the type, but it can waste space if for
5773 example fields of type R appear in an enclosing record. If the above type is
5774 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
5775
5776 However, there is one case in which SPACE is ignored. If a variable length
5777 record (that is a discriminated record with a component which is an array
5778 whose length depends on a discriminant), has a pragma Pack, then it is not
5779 in general possible to set the alignment of such a record to one, so the
5780 pragma is ignored in this case (with a warning).
5781
5782 Specifying SPACE also disables alignment promotions for standalone objects,
5783 which occur when the compiler increases the alignment of a specific object
5784 without changing the alignment of its type.
5785
5786 Specifying SPACE also disables component reordering in unpacked record types,
5787 which can result in larger sizes in order to meet alignment requirements.
5788
5789 Specifying TIME causes larger default alignments to be chosen in the case of
5790 small types with sizes that are not a power of 2. For example, consider:
5791
5792 @example
5793 type R is record
5794 A : Character;
5795 B : Character;
5796 C : Boolean;
5797 end record;
5798
5799 pragma Pack (R);
5800 for R'Size use 17;
5801 @end example
5802
5803 The default alignment for this record is normally 1, but if this type is
5804 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
5805 to 4, which wastes space for objects of the type, since they are now 4 bytes
5806 long, but results in more efficient access when the whole record is referenced.
5807
5808 As noted above, this is a configuration pragma, and there is a requirement
5809 that all units in a partition be compiled with a consistent setting of the
5810 optimization setting. This would normally be achieved by use of a configuration
5811 pragma file containing the appropriate setting. The exception to this rule is
5812 that units with an explicit configuration pragma in the same file as the source
5813 unit are excluded from the consistency check, as are all predefined units. The
5814 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
5815 pragma appears at the start of the file.
5816
5817 @node Pragma Ordered,Pragma Overflow_Mode,Pragma Optimize_Alignment,Implementation Defined Pragmas
5818 @anchor{gnat_rm/implementation_defined_pragmas pragma-ordered}@anchor{b0}
5819 @section Pragma Ordered
5820
5821
5822 Syntax:
5823
5824 @example
5825 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
5826 @end example
5827
5828 Most enumeration types are from a conceptual point of view unordered.
5829 For example, consider:
5830
5831 @example
5832 type Color is (Red, Blue, Green, Yellow);
5833 @end example
5834
5835 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
5836 but really these relations make no sense; the enumeration type merely
5837 specifies a set of possible colors, and the order is unimportant.
5838
5839 For unordered enumeration types, it is generally a good idea if
5840 clients avoid comparisons (other than equality or inequality) and
5841 explicit ranges. (A @emph{client} is a unit where the type is referenced,
5842 other than the unit where the type is declared, its body, and its subunits.)
5843 For example, if code buried in some client says:
5844
5845 @example
5846 if Current_Color < Yellow then ...
5847 if Current_Color in Blue .. Green then ...
5848 @end example
5849
5850 then the client code is relying on the order, which is undesirable.
5851 It makes the code hard to read and creates maintenance difficulties if
5852 entries have to be added to the enumeration type. Instead,
5853 the code in the client should list the possibilities, or an
5854 appropriate subtype should be declared in the unit that declares
5855 the original enumeration type. E.g., the following subtype could
5856 be declared along with the type @code{Color}:
5857
5858 @example
5859 subtype RBG is Color range Red .. Green;
5860 @end example
5861
5862 and then the client could write:
5863
5864 @example
5865 if Current_Color in RBG then ...
5866 if Current_Color = Blue or Current_Color = Green then ...
5867 @end example
5868
5869 However, some enumeration types are legitimately ordered from a conceptual
5870 point of view. For example, if you declare:
5871
5872 @example
5873 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
5874 @end example
5875
5876 then the ordering imposed by the language is reasonable, and
5877 clients can depend on it, writing for example:
5878
5879 @example
5880 if D in Mon .. Fri then ...
5881 if D < Wed then ...
5882 @end example
5883
5884 The pragma @emph{Ordered} is provided to mark enumeration types that
5885 are conceptually ordered, alerting the reader that clients may depend
5886 on the ordering. GNAT provides a pragma to mark enumerations as ordered
5887 rather than one to mark them as unordered, since in our experience,
5888 the great majority of enumeration types are conceptually unordered.
5889
5890 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
5891 and @code{Wide_Wide_Character}
5892 are considered to be ordered types, so each is declared with a
5893 pragma @code{Ordered} in package @code{Standard}.
5894
5895 Normally pragma @code{Ordered} serves only as documentation and a guide for
5896 coding standards, but GNAT provides a warning switch @emph{-gnatw.u} that
5897 requests warnings for inappropriate uses (comparisons and explicit
5898 subranges) for unordered types. If this switch is used, then any
5899 enumeration type not marked with pragma @code{Ordered} will be considered
5900 as unordered, and will generate warnings for inappropriate uses.
5901
5902 Note that generic types are not considered ordered or unordered (since the
5903 template can be instantiated for both cases), so we never generate warnings
5904 for the case of generic enumerated types.
5905
5906 For additional information please refer to the description of the
5907 @emph{-gnatw.u} switch in the GNAT User's Guide.
5908
5909 @node Pragma Overflow_Mode,Pragma Overriding_Renamings,Pragma Ordered,Implementation Defined Pragmas
5910 @anchor{gnat_rm/implementation_defined_pragmas pragma-overflow-mode}@anchor{b1}
5911 @section Pragma Overflow_Mode
5912
5913
5914 Syntax:
5915
5916 @example
5917 pragma Overflow_Mode
5918 ( [General =>] MODE
5919 [,[Assertions =>] MODE]);
5920
5921 MODE ::= STRICT | MINIMIZED | ELIMINATED
5922 @end example
5923
5924 This pragma sets the current overflow mode to the given setting. For details
5925 of the meaning of these modes, please refer to the
5926 'Overflow Check Handling in GNAT' appendix in the
5927 GNAT User's Guide. If only the @code{General} parameter is present,
5928 the given mode applies to all expressions. If both parameters are present,
5929 the @code{General} mode applies to expressions outside assertions, and
5930 the @code{Eliminated} mode applies to expressions within assertions.
5931
5932 The case of the @code{MODE} parameter is ignored,
5933 so @code{MINIMIZED}, @code{Minimized} and
5934 @code{minimized} all have the same effect.
5935
5936 The @code{Overflow_Mode} pragma has the same scoping and placement
5937 rules as pragma @code{Suppress}, so it can occur either as a
5938 configuration pragma, specifying a default for the whole
5939 program, or in a declarative scope, where it applies to the
5940 remaining declarations and statements in that scope.
5941
5942 The pragma @code{Suppress (Overflow_Check)} suppresses
5943 overflow checking, but does not affect the overflow mode.
5944
5945 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
5946 overflow checking, but does not affect the overflow mode.
5947
5948 @node Pragma Overriding_Renamings,Pragma Partition_Elaboration_Policy,Pragma Overflow_Mode,Implementation Defined Pragmas
5949 @anchor{gnat_rm/implementation_defined_pragmas pragma-overriding-renamings}@anchor{b2}
5950 @section Pragma Overriding_Renamings
5951
5952
5953 @geindex Rational profile
5954
5955 @geindex Rational compatibility
5956
5957 Syntax:
5958
5959 @example
5960 pragma Overriding_Renamings;
5961 @end example
5962
5963 This is a GNAT configuration pragma to simplify porting
5964 legacy code accepted by the Rational
5965 Ada compiler. In the presence of this pragma, a renaming declaration that
5966 renames an inherited operation declared in the same scope is legal if selected
5967 notation is used as in:
5968
5969 @example
5970 pragma Overriding_Renamings;
5971 ...
5972 package R is
5973 function F (..);
5974 ...
5975 function F (..) renames R.F;
5976 end R;
5977 @end example
5978
5979 even though
5980 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5981 declaration of the overriding operation.
5982
5983 @node Pragma Partition_Elaboration_Policy,Pragma Part_Of,Pragma Overriding_Renamings,Implementation Defined Pragmas
5984 @anchor{gnat_rm/implementation_defined_pragmas pragma-partition-elaboration-policy}@anchor{b3}
5985 @section Pragma Partition_Elaboration_Policy
5986
5987
5988 Syntax:
5989
5990 @example
5991 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5992
5993 POLICY_IDENTIFIER ::= Concurrent | Sequential
5994 @end example
5995
5996 This pragma is standard in Ada 2005, but is available in all earlier
5997 versions of Ada as an implementation-defined pragma.
5998 See Ada 2012 Reference Manual for details.
5999
6000 @node Pragma Part_Of,Pragma Passive,Pragma Partition_Elaboration_Policy,Implementation Defined Pragmas
6001 @anchor{gnat_rm/implementation_defined_pragmas id27}@anchor{b4}@anchor{gnat_rm/implementation_defined_pragmas pragma-part-of}@anchor{b5}
6002 @section Pragma Part_Of
6003
6004
6005 Syntax:
6006
6007 @example
6008 pragma Part_Of (ABSTRACT_STATE);
6009
6010 ABSTRACT_STATE ::= NAME
6011 @end example
6012
6013 For the semantics of this pragma, see the entry for aspect @code{Part_Of} in the
6014 SPARK 2014 Reference Manual, section 7.2.6.
6015
6016 @node Pragma Passive,Pragma Persistent_BSS,Pragma Part_Of,Implementation Defined Pragmas
6017 @anchor{gnat_rm/implementation_defined_pragmas pragma-passive}@anchor{b6}
6018 @section Pragma Passive
6019
6020
6021 Syntax:
6022
6023 @example
6024 pragma Passive [(Semaphore | No)];
6025 @end example
6026
6027 Syntax checked, but otherwise ignored by GNAT. This is recognized for
6028 compatibility with DEC Ada 83 implementations, where it is used within a
6029 task definition to request that a task be made passive. If the argument
6030 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
6031 treats the pragma as an assertion that the containing task is passive
6032 and that optimization of context switch with this task is permitted and
6033 desired. If the argument @code{No} is present, the task must not be
6034 optimized. GNAT does not attempt to optimize any tasks in this manner
6035 (since protected objects are available in place of passive tasks).
6036
6037 For more information on the subject of passive tasks, see the section
6038 'Passive Task Optimization' in the GNAT Users Guide.
6039
6040 @node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
6041 @anchor{gnat_rm/implementation_defined_pragmas id28}@anchor{b7}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b8}
6042 @section Pragma Persistent_BSS
6043
6044
6045 Syntax:
6046
6047 @example
6048 pragma Persistent_BSS [(LOCAL_NAME)]
6049 @end example
6050
6051 This pragma allows selected objects to be placed in the @code{.persistent_bss}
6052 section. On some targets the linker and loader provide for special
6053 treatment of this section, allowing a program to be reloaded without
6054 affecting the contents of this data (hence the name persistent).
6055
6056 There are two forms of usage. If an argument is given, it must be the
6057 local name of a library-level object, with no explicit initialization
6058 and whose type is potentially persistent. If no argument is given, then
6059 the pragma is a configuration pragma, and applies to all library-level
6060 objects with no explicit initialization of potentially persistent types.
6061
6062 A potentially persistent type is a scalar type, or an untagged,
6063 non-discriminated record, all of whose components have no explicit
6064 initialization and are themselves of a potentially persistent type,
6065 or an array, all of whose constraints are static, and whose component
6066 type is potentially persistent.
6067
6068 If this pragma is used on a target where this feature is not supported,
6069 then the pragma will be ignored. See also @code{pragma Linker_Section}.
6070
6071 @node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
6072 @anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{b9}
6073 @section Pragma Polling
6074
6075
6076 Syntax:
6077
6078 @example
6079 pragma Polling (ON | OFF);
6080 @end example
6081
6082 This pragma controls the generation of polling code. This is normally off.
6083 If @code{pragma Polling (ON)} is used then periodic calls are generated to
6084 the routine @code{Ada.Exceptions.Poll}. This routine is a separate unit in the
6085 runtime library, and can be found in file @code{a-excpol.adb}.
6086
6087 Pragma @code{Polling} can appear as a configuration pragma (for example it
6088 can be placed in the @code{gnat.adc} file) to enable polling globally, or it
6089 can be used in the statement or declaration sequence to control polling
6090 more locally.
6091
6092 A call to the polling routine is generated at the start of every loop and
6093 at the start of every subprogram call. This guarantees that the @code{Poll}
6094 routine is called frequently, and places an upper bound (determined by
6095 the complexity of the code) on the period between two @code{Poll} calls.
6096
6097 The primary purpose of the polling interface is to enable asynchronous
6098 aborts on targets that cannot otherwise support it (for example Windows
6099 NT), but it may be used for any other purpose requiring periodic polling.
6100 The standard version is null, and can be replaced by a user program. This
6101 will require re-compilation of the @code{Ada.Exceptions} package that can
6102 be found in files @code{a-except.ads} and @code{a-except.adb}.
6103
6104 A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
6105 distribution) is used to enable the asynchronous abort capability on
6106 targets that do not normally support the capability. The version of
6107 @code{Poll} in this file makes a call to the appropriate runtime routine
6108 to test for an abort condition.
6109
6110 Note that polling can also be enabled by use of the @emph{-gnatP} switch.
6111 See the section on switches for gcc in the @cite{GNAT User's Guide}.
6112
6113 @node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
6114 @anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{ba}
6115 @section Pragma Post
6116
6117
6118 @geindex Post
6119
6120 @geindex Checks
6121 @geindex postconditions
6122
6123 Syntax:
6124
6125 @example
6126 pragma Post (Boolean_Expression);
6127 @end example
6128
6129 The @code{Post} pragma is intended to be an exact replacement for
6130 the language-defined
6131 @code{Post} aspect, and shares its restrictions and semantics.
6132 It must appear either immediately following the corresponding
6133 subprogram declaration (only other pragmas may intervene), or
6134 if there is no separate subprogram declaration, then it can
6135 appear at the start of the declarations in a subprogram body
6136 (preceded only by other pragmas).
6137
6138 @node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
6139 @anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{bb}
6140 @section Pragma Postcondition
6141
6142
6143 @geindex Postcondition
6144
6145 @geindex Checks
6146 @geindex postconditions
6147
6148 Syntax:
6149
6150 @example
6151 pragma Postcondition (
6152 [Check =>] Boolean_Expression
6153 [,[Message =>] String_Expression]);
6154 @end example
6155
6156 The @code{Postcondition} pragma allows specification of automatic
6157 postcondition checks for subprograms. These checks are similar to
6158 assertions, but are automatically inserted just prior to the return
6159 statements of the subprogram with which they are associated (including
6160 implicit returns at the end of procedure bodies and associated
6161 exception handlers).
6162
6163 In addition, the boolean expression which is the condition which
6164 must be true may contain references to function'Result in the case
6165 of a function to refer to the returned value.
6166
6167 @code{Postcondition} pragmas may appear either immediately following the
6168 (separate) declaration of a subprogram, or at the start of the
6169 declarations of a subprogram body. Only other pragmas may intervene
6170 (that is appear between the subprogram declaration and its
6171 postconditions, or appear before the postcondition in the
6172 declaration sequence in a subprogram body). In the case of a
6173 postcondition appearing after a subprogram declaration, the
6174 formal arguments of the subprogram are visible, and can be
6175 referenced in the postcondition expressions.
6176
6177 The postconditions are collected and automatically tested just
6178 before any return (implicit or explicit) in the subprogram body.
6179 A postcondition is only recognized if postconditions are active
6180 at the time the pragma is encountered. The compiler switch @emph{gnata}
6181 turns on all postconditions by default, and pragma @code{Check_Policy}
6182 with an identifier of @code{Postcondition} can also be used to
6183 control whether postconditions are active.
6184
6185 The general approach is that postconditions are placed in the spec
6186 if they represent functional aspects which make sense to the client.
6187 For example we might have:
6188
6189 @example
6190 function Direction return Integer;
6191 pragma Postcondition
6192 (Direction'Result = +1
6193 or else
6194 Direction'Result = -1);
6195 @end example
6196
6197 which serves to document that the result must be +1 or -1, and
6198 will test that this is the case at run time if postcondition
6199 checking is active.
6200
6201 Postconditions within the subprogram body can be used to
6202 check that some internal aspect of the implementation,
6203 not visible to the client, is operating as expected.
6204 For instance if a square root routine keeps an internal
6205 counter of the number of times it is called, then we
6206 might have the following postcondition:
6207
6208 @example
6209 Sqrt_Calls : Natural := 0;
6210
6211 function Sqrt (Arg : Float) return Float is
6212 pragma Postcondition
6213 (Sqrt_Calls = Sqrt_Calls'Old + 1);
6214 ...
6215 end Sqrt
6216 @end example
6217
6218 As this example, shows, the use of the @code{Old} attribute
6219 is often useful in postconditions to refer to the state on
6220 entry to the subprogram.
6221
6222 Note that postconditions are only checked on normal returns
6223 from the subprogram. If an abnormal return results from
6224 raising an exception, then the postconditions are not checked.
6225
6226 If a postcondition fails, then the exception
6227 @code{System.Assertions.Assert_Failure} is raised. If
6228 a message argument was supplied, then the given string
6229 will be used as the exception message. If no message
6230 argument was supplied, then the default message has
6231 the form "Postcondition failed at file_name:line". The
6232 exception is raised in the context of the subprogram
6233 body, so it is possible to catch postcondition failures
6234 within the subprogram body itself.
6235
6236 Within a package spec, normal visibility rules
6237 in Ada would prevent forward references within a
6238 postcondition pragma to functions defined later in
6239 the same package. This would introduce undesirable
6240 ordering constraints. To avoid this problem, all
6241 postcondition pragmas are analyzed at the end of
6242 the package spec, allowing forward references.
6243
6244 The following example shows that this even allows
6245 mutually recursive postconditions as in:
6246
6247 @example
6248 package Parity_Functions is
6249 function Odd (X : Natural) return Boolean;
6250 pragma Postcondition
6251 (Odd'Result =
6252 (x = 1
6253 or else
6254 (x /= 0 and then Even (X - 1))));
6255
6256 function Even (X : Natural) return Boolean;
6257 pragma Postcondition
6258 (Even'Result =
6259 (x = 0
6260 or else
6261 (x /= 1 and then Odd (X - 1))));
6262
6263 end Parity_Functions;
6264 @end example
6265
6266 There are no restrictions on the complexity or form of
6267 conditions used within @code{Postcondition} pragmas.
6268 The following example shows that it is even possible
6269 to verify performance behavior.
6270
6271 @example
6272 package Sort is
6273
6274 Performance : constant Float;
6275 -- Performance constant set by implementation
6276 -- to match target architecture behavior.
6277
6278 procedure Treesort (Arg : String);
6279 -- Sorts characters of argument using N*logN sort
6280 pragma Postcondition
6281 (Float (Clock - Clock'Old) <=
6282 Float (Arg'Length) *
6283 log (Float (Arg'Length)) *
6284 Performance);
6285 end Sort;
6286 @end example
6287
6288 Note: postcondition pragmas associated with subprograms that are
6289 marked as Inline_Always, or those marked as Inline with front-end
6290 inlining (-gnatN option set) are accepted and legality-checked
6291 by the compiler, but are ignored at run-time even if postcondition
6292 checking is enabled.
6293
6294 Note that pragma @code{Postcondition} differs from the language-defined
6295 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
6296 multiple occurrences, allowing occurences in the body even if there
6297 is a separate spec, and allowing a second string parameter, and the
6298 use of the pragma identifier @code{Check}. Historically, pragma
6299 @code{Postcondition} was implemented prior to the development of
6300 Ada 2012, and has been retained in its original form for
6301 compatibility purposes.
6302
6303 @node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
6304 @anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{bc}
6305 @section Pragma Post_Class
6306
6307
6308 @geindex Post
6309
6310 @geindex Checks
6311 @geindex postconditions
6312
6313 Syntax:
6314
6315 @example
6316 pragma Post_Class (Boolean_Expression);
6317 @end example
6318
6319 The @code{Post_Class} pragma is intended to be an exact replacement for
6320 the language-defined
6321 @code{Post'Class} aspect, and shares its restrictions and semantics.
6322 It must appear either immediately following the corresponding
6323 subprogram declaration (only other pragmas may intervene), or
6324 if there is no separate subprogram declaration, then it can
6325 appear at the start of the declarations in a subprogram body
6326 (preceded only by other pragmas).
6327
6328 Note: This pragma is called @code{Post_Class} rather than
6329 @code{Post'Class} because the latter would not be strictly
6330 conforming to the allowed syntax for pragmas. The motivation
6331 for provinding pragmas equivalent to the aspects is to allow a program
6332 to be written using the pragmas, and then compiled if necessary
6333 using an Ada compiler that does not recognize the pragmas or
6334 aspects, but is prepared to ignore the pragmas. The assertion
6335 policy that controls this pragma is @code{Post'Class}, not
6336 @code{Post_Class}.
6337
6338 @node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
6339 @anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{bd}
6340 @section Pragma Rename_Pragma
6341
6342
6343 @geindex Pragmas
6344 @geindex synonyms
6345
6346 Syntax:
6347
6348 @example
6349 pragma Rename_Pragma (
6350 [New_Name =>] IDENTIFIER,
6351 [Renamed =>] pragma_IDENTIFIER);
6352 @end example
6353
6354 This pragma provides a mechanism for supplying new names for existing
6355 pragmas. The @code{New_Name} identifier can subsequently be used as a synonym for
6356 the Renamed pragma. For example, suppose you have code that was originally
6357 developed on a compiler that supports Inline_Only as an implementation defined
6358 pragma. And suppose the semantics of pragma Inline_Only are identical to (or at
6359 least very similar to) the GNAT implementation defined pragma
6360 Inline_Always. You could globally replace Inline_Only with Inline_Always.
6361
6362 However, to avoid that source modification, you could instead add a
6363 configuration pragma:
6364
6365 @example
6366 pragma Rename_Pragma (
6367 New_Name => Inline_Only,
6368 Renamed => Inline_Always);
6369 @end example
6370
6371 Then GNAT will treat "pragma Inline_Only ..." as if you had written
6372 "pragma Inline_Always ...".
6373
6374 Pragma Inline_Only will not necessarily mean the same thing as the other Ada
6375 compiler; it's up to you to make sure the semantics are close enough.
6376
6377 @node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
6378 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{be}
6379 @section Pragma Pre
6380
6381
6382 @geindex Pre
6383
6384 @geindex Checks
6385 @geindex preconditions
6386
6387 Syntax:
6388
6389 @example
6390 pragma Pre (Boolean_Expression);
6391 @end example
6392
6393 The @code{Pre} pragma is intended to be an exact replacement for
6394 the language-defined
6395 @code{Pre} aspect, and shares its restrictions and semantics.
6396 It must appear either immediately following the corresponding
6397 subprogram declaration (only other pragmas may intervene), or
6398 if there is no separate subprogram declaration, then it can
6399 appear at the start of the declarations in a subprogram body
6400 (preceded only by other pragmas).
6401
6402 @node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
6403 @anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{bf}
6404 @section Pragma Precondition
6405
6406
6407 @geindex Preconditions
6408
6409 @geindex Checks
6410 @geindex preconditions
6411
6412 Syntax:
6413
6414 @example
6415 pragma Precondition (
6416 [Check =>] Boolean_Expression
6417 [,[Message =>] String_Expression]);
6418 @end example
6419
6420 The @code{Precondition} pragma is similar to @code{Postcondition}
6421 except that the corresponding checks take place immediately upon
6422 entry to the subprogram, and if a precondition fails, the exception
6423 is raised in the context of the caller, and the attribute 'Result
6424 cannot be used within the precondition expression.
6425
6426 Otherwise, the placement and visibility rules are identical to those
6427 described for postconditions. The following is an example of use
6428 within a package spec:
6429
6430 @example
6431 package Math_Functions is
6432 ...
6433 function Sqrt (Arg : Float) return Float;
6434 pragma Precondition (Arg >= 0.0)
6435 ...
6436 end Math_Functions;
6437 @end example
6438
6439 @code{Precondition} pragmas may appear either immediately following the
6440 (separate) declaration of a subprogram, or at the start of the
6441 declarations of a subprogram body. Only other pragmas may intervene
6442 (that is appear between the subprogram declaration and its
6443 postconditions, or appear before the postcondition in the
6444 declaration sequence in a subprogram body).
6445
6446 Note: precondition pragmas associated with subprograms that are
6447 marked as Inline_Always, or those marked as Inline with front-end
6448 inlining (-gnatN option set) are accepted and legality-checked
6449 by the compiler, but are ignored at run-time even if precondition
6450 checking is enabled.
6451
6452 Note that pragma @code{Precondition} differs from the language-defined
6453 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
6454 multiple occurrences, allowing occurences in the body even if there
6455 is a separate spec, and allowing a second string parameter, and the
6456 use of the pragma identifier @code{Check}. Historically, pragma
6457 @code{Precondition} was implemented prior to the development of
6458 Ada 2012, and has been retained in its original form for
6459 compatibility purposes.
6460
6461 @node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
6462 @anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{c0}@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{c1}
6463 @section Pragma Predicate
6464
6465
6466 Syntax:
6467
6468 @example
6469 pragma Predicate
6470 ([Entity =>] type_LOCAL_NAME,
6471 [Check =>] EXPRESSION);
6472 @end example
6473
6474 This pragma (available in all versions of Ada in GNAT) encompasses both
6475 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
6476 Ada 2012. A predicate is regarded as static if it has an allowed form
6477 for @code{Static_Predicate} and is otherwise treated as a
6478 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
6479 pragma behave exactly as described in the Ada 2012 reference manual.
6480 For example, if we have
6481
6482 @example
6483 type R is range 1 .. 10;
6484 subtype S is R;
6485 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
6486 subtype Q is R
6487 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
6488 @end example
6489
6490 the effect is identical to the following Ada 2012 code:
6491
6492 @example
6493 type R is range 1 .. 10;
6494 subtype S is R with
6495 Static_Predicate => S not in 4 .. 6;
6496 subtype Q is R with
6497 Dynamic_Predicate => F(Q) or G(Q);
6498 @end example
6499
6500 Note that there are no pragmas @code{Dynamic_Predicate}
6501 or @code{Static_Predicate}. That is
6502 because these pragmas would affect legality and semantics of
6503 the program and thus do not have a neutral effect if ignored.
6504 The motivation behind providing pragmas equivalent to
6505 corresponding aspects is to allow a program to be written
6506 using the pragmas, and then compiled with a compiler that
6507 will ignore the pragmas. That doesn't work in the case of
6508 static and dynamic predicates, since if the corresponding
6509 pragmas are ignored, then the behavior of the program is
6510 fundamentally changed (for example a membership test
6511 @code{A in B} would not take into account a predicate
6512 defined for subtype B). When following this approach, the
6513 use of predicates should be avoided.
6514
6515 @node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
6516 @anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c2}
6517 @section Pragma Predicate_Failure
6518
6519
6520 Syntax:
6521
6522 @example
6523 pragma Predicate_Failure
6524 ([Entity =>] type_LOCAL_NAME,
6525 [Message =>] String_Expression);
6526 @end example
6527
6528 The @code{Predicate_Failure} pragma is intended to be an exact replacement for
6529 the language-defined
6530 @code{Predicate_Failure} aspect, and shares its restrictions and semantics.
6531
6532 @node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
6533 @anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c3}
6534 @section Pragma Preelaborable_Initialization
6535
6536
6537 Syntax:
6538
6539 @example
6540 pragma Preelaborable_Initialization (DIRECT_NAME);
6541 @end example
6542
6543 This pragma is standard in Ada 2005, but is available in all earlier
6544 versions of Ada as an implementation-defined pragma.
6545 See Ada 2012 Reference Manual for details.
6546
6547 @node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
6548 @anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c4}
6549 @section Pragma Prefix_Exception_Messages
6550
6551
6552 @geindex Prefix_Exception_Messages
6553
6554 @geindex exception
6555
6556 @geindex Exception_Message
6557
6558 Syntax:
6559
6560 @example
6561 pragma Prefix_Exception_Messages;
6562 @end example
6563
6564 This is an implementation-defined configuration pragma that affects the
6565 behavior of raise statements with a message given as a static string
6566 constant (typically a string literal). In such cases, the string will
6567 be automatically prefixed by the name of the enclosing entity (giving
6568 the package and subprogram containing the raise statement). This helps
6569 to identify where messages are coming from, and this mode is automatic
6570 for the run-time library.
6571
6572 The pragma has no effect if the message is computed with an expression other
6573 than a static string constant, since the assumption in this case is that
6574 the program computes exactly the string it wants. If you still want the
6575 prefixing in this case, you can always call
6576 @code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
6577
6578 @node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
6579 @anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c5}
6580 @section Pragma Pre_Class
6581
6582
6583 @geindex Pre_Class
6584
6585 @geindex Checks
6586 @geindex preconditions
6587
6588 Syntax:
6589
6590 @example
6591 pragma Pre_Class (Boolean_Expression);
6592 @end example
6593
6594 The @code{Pre_Class} pragma is intended to be an exact replacement for
6595 the language-defined
6596 @code{Pre'Class} aspect, and shares its restrictions and semantics.
6597 It must appear either immediately following the corresponding
6598 subprogram declaration (only other pragmas may intervene), or
6599 if there is no separate subprogram declaration, then it can
6600 appear at the start of the declarations in a subprogram body
6601 (preceded only by other pragmas).
6602
6603 Note: This pragma is called @code{Pre_Class} rather than
6604 @code{Pre'Class} because the latter would not be strictly
6605 conforming to the allowed syntax for pragmas. The motivation
6606 for providing pragmas equivalent to the aspects is to allow a program
6607 to be written using the pragmas, and then compiled if necessary
6608 using an Ada compiler that does not recognize the pragmas or
6609 aspects, but is prepared to ignore the pragmas. The assertion
6610 policy that controls this pragma is @code{Pre'Class}, not
6611 @code{Pre_Class}.
6612
6613 @node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
6614 @anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c6}
6615 @section Pragma Priority_Specific_Dispatching
6616
6617
6618 Syntax:
6619
6620 @example
6621 pragma Priority_Specific_Dispatching (
6622 POLICY_IDENTIFIER,
6623 first_priority_EXPRESSION,
6624 last_priority_EXPRESSION)
6625
6626 POLICY_IDENTIFIER ::=
6627 EDF_Across_Priorities |
6628 FIFO_Within_Priorities |
6629 Non_Preemptive_Within_Priorities |
6630 Round_Robin_Within_Priorities
6631 @end example
6632
6633 This pragma is standard in Ada 2005, but is available in all earlier
6634 versions of Ada as an implementation-defined pragma.
6635 See Ada 2012 Reference Manual for details.
6636
6637 @node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
6638 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c7}
6639 @section Pragma Profile
6640
6641
6642 Syntax:
6643
6644 @example
6645 pragma Profile (Ravenscar | Restricted | Rational |
6646 GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
6647 @end example
6648
6649 This pragma is standard in Ada 2005, but is available in all earlier
6650 versions of Ada as an implementation-defined pragma. This is a
6651 configuration pragma that establishes a set of configuration pragmas
6652 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
6653 The other possibilities (@code{Restricted}, @code{Rational},
6654 @code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
6655 are implementation-defined. The set of configuration pragmas
6656 is defined in the following sections.
6657
6658
6659 @itemize *
6660
6661 @item
6662 Pragma Profile (Ravenscar)
6663
6664 The @code{Ravenscar} profile is standard in Ada 2005,
6665 but is available in all earlier
6666 versions of Ada as an implementation-defined pragma. This profile
6667 establishes the following set of configuration pragmas:
6668
6669
6670 @itemize *
6671
6672 @item
6673 @code{Task_Dispatching_Policy (FIFO_Within_Priorities)}
6674
6675 [RM D.2.2] Tasks are dispatched following a preemptive
6676 priority-ordered scheduling policy.
6677
6678 @item
6679 @code{Locking_Policy (Ceiling_Locking)}
6680
6681 [RM D.3] While tasks and interrupts execute a protected action, they inherit
6682 the ceiling priority of the corresponding protected object.
6683
6684 @item
6685 @code{Detect_Blocking}
6686
6687 This pragma forces the detection of potentially blocking operations within a
6688 protected operation, and to raise Program_Error if that happens.
6689 @end itemize
6690
6691 plus the following set of restrictions:
6692
6693
6694 @itemize *
6695
6696 @item
6697 @code{Max_Entry_Queue_Length => 1}
6698
6699 No task can be queued on a protected entry.
6700
6701 @item
6702 @code{Max_Protected_Entries => 1}
6703
6704 @item
6705 @code{Max_Task_Entries => 0}
6706
6707 No rendezvous statements are allowed.
6708
6709 @item
6710 @code{No_Abort_Statements}
6711
6712 @item
6713 @code{No_Dynamic_Attachment}
6714
6715 @item
6716 @code{No_Dynamic_Priorities}
6717
6718 @item
6719 @code{No_Implicit_Heap_Allocations}
6720
6721 @item
6722 @code{No_Local_Protected_Objects}
6723
6724 @item
6725 @code{No_Local_Timing_Events}
6726
6727 @item
6728 @code{No_Protected_Type_Allocators}
6729
6730 @item
6731 @code{No_Relative_Delay}
6732
6733 @item
6734 @code{No_Requeue_Statements}
6735
6736 @item
6737 @code{No_Select_Statements}
6738
6739 @item
6740 @code{No_Specific_Termination_Handlers}
6741
6742 @item
6743 @code{No_Task_Allocators}
6744
6745 @item
6746 @code{No_Task_Hierarchy}
6747
6748 @item
6749 @code{No_Task_Termination}
6750
6751 @item
6752 @code{Simple_Barriers}
6753 @end itemize
6754
6755 The Ravenscar profile also includes the following restrictions that specify
6756 that there are no semantic dependences on the corresponding predefined
6757 packages:
6758
6759
6760 @itemize *
6761
6762 @item
6763 @code{No_Dependence => Ada.Asynchronous_Task_Control}
6764
6765 @item
6766 @code{No_Dependence => Ada.Calendar}
6767
6768 @item
6769 @code{No_Dependence => Ada.Execution_Time.Group_Budget}
6770
6771 @item
6772 @code{No_Dependence => Ada.Execution_Time.Timers}
6773
6774 @item
6775 @code{No_Dependence => Ada.Task_Attributes}
6776
6777 @item
6778 @code{No_Dependence => System.Multiprocessors.Dispatching_Domains}
6779 @end itemize
6780
6781 This set of configuration pragmas and restrictions correspond to the
6782 definition of the 'Ravenscar Profile' for limited tasking, devised and
6783 published by the @cite{International Real-Time Ada Workshop@comma{} 1997}.
6784 A description is also available at
6785 @indicateurl{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
6786
6787 The original definition of the profile was revised at subsequent IRTAW
6788 meetings. It has been included in the ISO
6789 @cite{Guide for the Use of the Ada Programming Language in High Integrity Systems},
6790 and was made part of the Ada 2005 standard.
6791 The formal definition given by
6792 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
6793 AI-305) available at
6794 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
6795 @indicateurl{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
6796
6797 The above set is a superset of the restrictions provided by pragma
6798 @code{Profile (Restricted)}, it includes six additional restrictions
6799 (@code{Simple_Barriers}, @code{No_Select_Statements},
6800 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
6801 @code{No_Relative_Delay} and @code{No_Task_Termination}). This means
6802 that pragma @code{Profile (Ravenscar)}, like the pragma
6803 @code{Profile (Restricted)},
6804 automatically causes the use of a simplified,
6805 more efficient version of the tasking run-time library.
6806
6807 @item
6808 Pragma Profile (GNAT_Extended_Ravenscar)
6809
6810 This profile corresponds to a GNAT specific extension of the
6811 Ravenscar profile. The profile may change in the future although
6812 only in a compatible way: some restrictions may be removed or
6813 relaxed. It is defined as a variation of the Ravenscar profile.
6814
6815 The @code{No_Implicit_Heap_Allocations} restriction has been replaced
6816 by @code{No_Implicit_Task_Allocations} and
6817 @code{No_Implicit_Protected_Object_Allocations}.
6818
6819 The @code{Simple_Barriers} restriction has been replaced by
6820 @code{Pure_Barriers}.
6821
6822 The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
6823 @code{No_Relative_Delay} restrictions have been removed.
6824
6825 @item
6826 Pragma Profile (GNAT_Ravenscar_EDF)
6827
6828 This profile corresponds to the Ravenscar profile but using
6829 EDF_Across_Priority as the Task_Scheduling_Policy.
6830
6831 @item
6832 Pragma Profile (Restricted)
6833
6834 This profile corresponds to the GNAT restricted run time. It
6835 establishes the following set of restrictions:
6836
6837
6838 @itemize *
6839
6840 @item
6841 @code{No_Abort_Statements}
6842
6843 @item
6844 @code{No_Entry_Queue}
6845
6846 @item
6847 @code{No_Task_Hierarchy}
6848
6849 @item
6850 @code{No_Task_Allocators}
6851
6852 @item
6853 @code{No_Dynamic_Priorities}
6854
6855 @item
6856 @code{No_Terminate_Alternatives}
6857
6858 @item
6859 @code{No_Dynamic_Attachment}
6860
6861 @item
6862 @code{No_Protected_Type_Allocators}
6863
6864 @item
6865 @code{No_Local_Protected_Objects}
6866
6867 @item
6868 @code{No_Requeue_Statements}
6869
6870 @item
6871 @code{No_Task_Attributes_Package}
6872
6873 @item
6874 @code{Max_Asynchronous_Select_Nesting = 0}
6875
6876 @item
6877 @code{Max_Task_Entries = 0}
6878
6879 @item
6880 @code{Max_Protected_Entries = 1}
6881
6882 @item
6883 @code{Max_Select_Alternatives = 0}
6884 @end itemize
6885
6886 This set of restrictions causes the automatic selection of a simplified
6887 version of the run time that provides improved performance for the
6888 limited set of tasking functionality permitted by this set of restrictions.
6889
6890 @item
6891 Pragma Profile (Rational)
6892
6893 The Rational profile is intended to facilitate porting legacy code that
6894 compiles with the Rational APEX compiler, even when the code includes non-
6895 conforming Ada constructs. The profile enables the following three pragmas:
6896
6897
6898 @itemize *
6899
6900 @item
6901 @code{pragma Implicit_Packing}
6902
6903 @item
6904 @code{pragma Overriding_Renamings}
6905
6906 @item
6907 @code{pragma Use_VADS_Size}
6908 @end itemize
6909 @end itemize
6910
6911 @node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
6912 @anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c8}
6913 @section Pragma Profile_Warnings
6914
6915
6916 Syntax:
6917
6918 @example
6919 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
6920 @end example
6921
6922 This is an implementation-defined pragma that is similar in
6923 effect to @code{pragma Profile} except that instead of
6924 generating @code{Restrictions} pragmas, it generates
6925 @code{Restriction_Warnings} pragmas. The result is that
6926 violations of the profile generate warning messages instead
6927 of error messages.
6928
6929 @node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
6930 @anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c9}
6931 @section Pragma Propagate_Exceptions
6932
6933
6934 @geindex Interfacing to C++
6935
6936 Syntax:
6937
6938 @example
6939 pragma Propagate_Exceptions;
6940 @end example
6941
6942 This pragma is now obsolete and, other than generating a warning if warnings
6943 on obsolescent features are enabled, is ignored.
6944 It is retained for compatibility
6945 purposes. It used to be used in connection with optimization of
6946 a now-obsolete mechanism for implementation of exceptions.
6947
6948 @node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
6949 @anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{ca}
6950 @section Pragma Provide_Shift_Operators
6951
6952
6953 @geindex Shift operators
6954
6955 Syntax:
6956
6957 @example
6958 pragma Provide_Shift_Operators (integer_first_subtype_LOCAL_NAME);
6959 @end example
6960
6961 This pragma can be applied to a first subtype local name that specifies
6962 either an unsigned or signed type. It has the effect of providing the
6963 five shift operators (Shift_Left, Shift_Right, Shift_Right_Arithmetic,
6964 Rotate_Left and Rotate_Right) for the given type. It is similar to
6965 including the function declarations for these five operators, together
6966 with the pragma Import (Intrinsic, ...) statements.
6967
6968 @node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
6969 @anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{cb}
6970 @section Pragma Psect_Object
6971
6972
6973 Syntax:
6974
6975 @example
6976 pragma Psect_Object (
6977 [Internal =>] LOCAL_NAME,
6978 [, [External =>] EXTERNAL_SYMBOL]
6979 [, [Size =>] EXTERNAL_SYMBOL]);
6980
6981 EXTERNAL_SYMBOL ::=
6982 IDENTIFIER
6983 | static_string_EXPRESSION
6984 @end example
6985
6986 This pragma is identical in effect to pragma @code{Common_Object}.
6987
6988 @node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
6989 @anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{cc}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{cd}
6990 @section Pragma Pure_Function
6991
6992
6993 Syntax:
6994
6995 @example
6996 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
6997 @end example
6998
6999 This pragma appears in the same declarative part as a function
7000 declaration (or a set of function declarations if more than one
7001 overloaded declaration exists, in which case the pragma applies
7002 to all entities). It specifies that the function @code{Entity} is
7003 to be considered pure for the purposes of code generation. This means
7004 that the compiler can assume that there are no side effects, and
7005 in particular that two calls with identical arguments produce the
7006 same result. It also means that the function can be used in an
7007 address clause.
7008
7009 Note that, quite deliberately, there are no static checks to try
7010 to ensure that this promise is met, so @code{Pure_Function} can be used
7011 with functions that are conceptually pure, even if they do modify
7012 global variables. For example, a square root function that is
7013 instrumented to count the number of times it is called is still
7014 conceptually pure, and can still be optimized, even though it
7015 modifies a global variable (the count). Memo functions are another
7016 example (where a table of previous calls is kept and consulted to
7017 avoid re-computation).
7018
7019 Note also that the normal rules excluding optimization of subprograms
7020 in pure units (when parameter types are descended from System.Address,
7021 or when the full view of a parameter type is limited), do not apply
7022 for the Pure_Function case. If you explicitly specify Pure_Function,
7023 the compiler may optimize away calls with identical arguments, and
7024 if that results in unexpected behavior, the proper action is not to
7025 use the pragma for subprograms that are not (conceptually) pure.
7026
7027 Note: Most functions in a @code{Pure} package are automatically pure, and
7028 there is no need to use pragma @code{Pure_Function} for such functions. One
7029 exception is any function that has at least one formal of type
7030 @code{System.Address} or a type derived from it. Such functions are not
7031 considered pure by default, since the compiler assumes that the
7032 @code{Address} parameter may be functioning as a pointer and that the
7033 referenced data may change even if the address value does not.
7034 Similarly, imported functions are not considered to be pure by default,
7035 since there is no way of checking that they are in fact pure. The use
7036 of pragma @code{Pure_Function} for such a function will override these default
7037 assumption, and cause the compiler to treat a designated subprogram as pure
7038 in these cases.
7039
7040 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
7041 applies to the underlying renamed function. This can be used to
7042 disambiguate cases of overloading where some but not all functions
7043 in a set of overloaded functions are to be designated as pure.
7044
7045 If pragma @code{Pure_Function} is applied to a library-level function, the
7046 function is also considered pure from an optimization point of view, but the
7047 unit is not a Pure unit in the categorization sense. So for example, a function
7048 thus marked is free to @code{with} non-pure units.
7049
7050 @node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
7051 @anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{ce}
7052 @section Pragma Rational
7053
7054
7055 Syntax:
7056
7057 @example
7058 pragma Rational;
7059 @end example
7060
7061 This pragma is considered obsolescent, but is retained for
7062 compatibility purposes. It is equivalent to:
7063
7064 @example
7065 pragma Profile (Rational);
7066 @end example
7067
7068 @node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
7069 @anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{cf}
7070 @section Pragma Ravenscar
7071
7072
7073 Syntax:
7074
7075 @example
7076 pragma Ravenscar;
7077 @end example
7078
7079 This pragma is considered obsolescent, but is retained for
7080 compatibility purposes. It is equivalent to:
7081
7082 @example
7083 pragma Profile (Ravenscar);
7084 @end example
7085
7086 which is the preferred method of setting the @code{Ravenscar} profile.
7087
7088 @node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
7089 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{d0}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{d1}
7090 @section Pragma Refined_Depends
7091
7092
7093 Syntax:
7094
7095 @example
7096 pragma Refined_Depends (DEPENDENCY_RELATION);
7097
7098 DEPENDENCY_RELATION ::=
7099 null
7100 | (DEPENDENCY_CLAUSE @{, DEPENDENCY_CLAUSE@})
7101
7102 DEPENDENCY_CLAUSE ::=
7103 OUTPUT_LIST =>[+] INPUT_LIST
7104 | NULL_DEPENDENCY_CLAUSE
7105
7106 NULL_DEPENDENCY_CLAUSE ::= null => INPUT_LIST
7107
7108 OUTPUT_LIST ::= OUTPUT | (OUTPUT @{, OUTPUT@})
7109
7110 INPUT_LIST ::= null | INPUT | (INPUT @{, INPUT@})
7111
7112 OUTPUT ::= NAME | FUNCTION_RESULT
7113 INPUT ::= NAME
7114
7115 where FUNCTION_RESULT is a function Result attribute_reference
7116 @end example
7117
7118 For the semantics of this pragma, see the entry for aspect @code{Refined_Depends} in
7119 the SPARK 2014 Reference Manual, section 6.1.5.
7120
7121 @node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
7122 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{d3}
7123 @section Pragma Refined_Global
7124
7125
7126 Syntax:
7127
7128 @example
7129 pragma Refined_Global (GLOBAL_SPECIFICATION);
7130
7131 GLOBAL_SPECIFICATION ::=
7132 null
7133 | (GLOBAL_LIST)
7134 | (MODED_GLOBAL_LIST @{, MODED_GLOBAL_LIST@})
7135
7136 MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST
7137
7138 MODE_SELECTOR ::= In_Out | Input | Output | Proof_In
7139 GLOBAL_LIST ::= GLOBAL_ITEM | (GLOBAL_ITEM @{, GLOBAL_ITEM@})
7140 GLOBAL_ITEM ::= NAME
7141 @end example
7142
7143 For the semantics of this pragma, see the entry for aspect @code{Refined_Global} in
7144 the SPARK 2014 Reference Manual, section 6.1.4.
7145
7146 @node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
7147 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d4}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d5}
7148 @section Pragma Refined_Post
7149
7150
7151 Syntax:
7152
7153 @example
7154 pragma Refined_Post (boolean_EXPRESSION);
7155 @end example
7156
7157 For the semantics of this pragma, see the entry for aspect @code{Refined_Post} in
7158 the SPARK 2014 Reference Manual, section 7.2.7.
7159
7160 @node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
7161 @anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d6}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d7}
7162 @section Pragma Refined_State
7163
7164
7165 Syntax:
7166
7167 @example
7168 pragma Refined_State (REFINEMENT_LIST);
7169
7170 REFINEMENT_LIST ::=
7171 (REFINEMENT_CLAUSE @{, REFINEMENT_CLAUSE@})
7172
7173 REFINEMENT_CLAUSE ::= state_NAME => CONSTITUENT_LIST
7174
7175 CONSTITUENT_LIST ::=
7176 null
7177 | CONSTITUENT
7178 | (CONSTITUENT @{, CONSTITUENT@})
7179
7180 CONSTITUENT ::= object_NAME | state_NAME
7181 @end example
7182
7183 For the semantics of this pragma, see the entry for aspect @code{Refined_State} in
7184 the SPARK 2014 Reference Manual, section 7.2.2.
7185
7186 @node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
7187 @anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d8}
7188 @section Pragma Relative_Deadline
7189
7190
7191 Syntax:
7192
7193 @example
7194 pragma Relative_Deadline (time_span_EXPRESSION);
7195 @end example
7196
7197 This pragma is standard in Ada 2005, but is available in all earlier
7198 versions of Ada as an implementation-defined pragma.
7199 See Ada 2012 Reference Manual for details.
7200
7201 @node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
7202 @anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d9}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{da}
7203 @section Pragma Remote_Access_Type
7204
7205
7206 Syntax:
7207
7208 @example
7209 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
7210 @end example
7211
7212 This pragma appears in the formal part of a generic declaration.
7213 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
7214 the use of a remote access to class-wide type as actual for a formal
7215 access type.
7216
7217 When this pragma applies to a formal access type @code{Entity}, that
7218 type is treated as a remote access to class-wide type in the generic.
7219 It must be a formal general access type, and its designated type must
7220 be the class-wide type of a formal tagged limited private type from the
7221 same generic declaration.
7222
7223 In the generic unit, the formal type is subject to all restrictions
7224 pertaining to remote access to class-wide types. At instantiation, the
7225 actual type must be a remote access to class-wide type.
7226
7227 @node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
7228 @anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{db}
7229 @section Pragma Restricted_Run_Time
7230
7231
7232 Syntax:
7233
7234 @example
7235 pragma Restricted_Run_Time;
7236 @end example
7237
7238 This pragma is considered obsolescent, but is retained for
7239 compatibility purposes. It is equivalent to:
7240
7241 @example
7242 pragma Profile (Restricted);
7243 @end example
7244
7245 which is the preferred method of setting the restricted run time
7246 profile.
7247
7248 @node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
7249 @anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{dc}
7250 @section Pragma Restriction_Warnings
7251
7252
7253 Syntax:
7254
7255 @example
7256 pragma Restriction_Warnings
7257 (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
7258 @end example
7259
7260 This pragma allows a series of restriction identifiers to be
7261 specified (the list of allowed identifiers is the same as for
7262 pragma @code{Restrictions}). For each of these identifiers
7263 the compiler checks for violations of the restriction, but
7264 generates a warning message rather than an error message
7265 if the restriction is violated.
7266
7267 One use of this is in situations where you want to know
7268 about violations of a restriction, but you want to ignore some of
7269 these violations. Consider this example, where you want to set
7270 Ada_95 mode and enable style checks, but you want to know about
7271 any other use of implementation pragmas:
7272
7273 @example
7274 pragma Restriction_Warnings (No_Implementation_Pragmas);
7275 pragma Warnings (Off, "violation of No_Implementation_Pragmas");
7276 pragma Ada_95;
7277 pragma Style_Checks ("2bfhkM160");
7278 pragma Warnings (On, "violation of No_Implementation_Pragmas");
7279 @end example
7280
7281 By including the above lines in a configuration pragmas file,
7282 the Ada_95 and Style_Checks pragmas are accepted without
7283 generating a warning, but any other use of implementation
7284 defined pragmas will cause a warning to be generated.
7285
7286 @node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
7287 @anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{dd}
7288 @section Pragma Reviewable
7289
7290
7291 Syntax:
7292
7293 @example
7294 pragma Reviewable;
7295 @end example
7296
7297 This pragma is an RM-defined standard pragma, but has no effect on the
7298 program being compiled, or on the code generated for the program.
7299
7300 To obtain the required output specified in RM H.3.1, the compiler must be
7301 run with various special switches as follows:
7302
7303
7304 @itemize *
7305
7306 @item
7307 @emph{Where compiler-generated run-time checks remain}
7308
7309 The switch @emph{-gnatGL}
7310 may be used to list the expanded code in pseudo-Ada form.
7311 Runtime checks show up in the listing either as explicit
7312 checks or operators marked with @{@} to indicate a check is present.
7313
7314 @item
7315 @emph{An identification of known exceptions at compile time}
7316
7317 If the program is compiled with @emph{-gnatwa},
7318 the compiler warning messages will indicate all cases where the compiler
7319 detects that an exception is certain to occur at run time.
7320
7321 @item
7322 @emph{Possible reads of uninitialized variables}
7323
7324 The compiler warns of many such cases, but its output is incomplete.
7325 @end itemize
7326
7327
7328 A supplemental static analysis tool
7329 may be used to obtain a comprehensive list of all
7330 possible points at which uninitialized data may be read.
7331
7332
7333 @itemize *
7334
7335 @item
7336 @emph{Where run-time support routines are implicitly invoked}
7337
7338 In the output from @emph{-gnatGL},
7339 run-time calls are explicitly listed as calls to the relevant
7340 run-time routine.
7341
7342 @item
7343 @emph{Object code listing}
7344
7345 This may be obtained either by using the @emph{-S} switch,
7346 or the objdump utility.
7347
7348 @item
7349 @emph{Constructs known to be erroneous at compile time}
7350
7351 These are identified by warnings issued by the compiler (use @emph{-gnatwa}).
7352
7353 @item
7354 @emph{Stack usage information}
7355
7356 Static stack usage data (maximum per-subprogram) can be obtained via the
7357 @emph{-fstack-usage} switch to the compiler.
7358 Dynamic stack usage data (per task) can be obtained via the @emph{-u} switch
7359 to gnatbind
7360 @end itemize
7361
7362
7363
7364 @itemize *
7365
7366 @item
7367 @emph{Object code listing of entire partition}
7368
7369 This can be obtained by compiling the partition with @emph{-S},
7370 or by applying objdump
7371 to all the object files that are part of the partition.
7372
7373 @item
7374 @emph{A description of the run-time model}
7375
7376 The full sources of the run-time are available, and the documentation of
7377 these routines describes how these run-time routines interface to the
7378 underlying operating system facilities.
7379
7380 @item
7381 @emph{Control and data-flow information}
7382 @end itemize
7383
7384
7385 A supplemental static analysis tool
7386 may be used to obtain complete control and data-flow information, as well as
7387 comprehensive messages identifying possible problems based on this
7388 information.
7389
7390 @node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
7391 @anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{de}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{df}
7392 @section Pragma Secondary_Stack_Size
7393
7394
7395 Syntax:
7396
7397 @example
7398 pragma Secondary_Stack_Size (integer_EXPRESSION);
7399 @end example
7400
7401 This pragma appears within the task definition of a single task declaration
7402 or a task type declaration (like pragma @code{Storage_Size}) and applies to all
7403 task objects of that type. The argument specifies the size of the secondary
7404 stack to be used by these task objects, and must be of an integer type. The
7405 secondary stack is used to handle functions that return a variable-sized
7406 result, for example a function returning an unconstrained String.
7407
7408 Note this pragma only applies to targets using fixed secondary stacks, like
7409 VxWorks 653 and bare board targets, where a fixed block for the
7410 secondary stack is allocated from the primary stack of the task. By default,
7411 these targets assign a percentage of the primary stack for the secondary stack,
7412 as defined by @code{System.Parameter.Sec_Stack_Percentage}. With this pragma,
7413 an @code{integer_EXPRESSION} of bytes is assigned from the primary stack instead.
7414
7415 For most targets, the pragma does not apply as the secondary stack grows on
7416 demand: allocated as a chain of blocks in the heap. The default size of these
7417 blocks can be modified via the @code{-D} binder option as described in
7418 @cite{GNAT User's Guide}.
7419
7420 Note that no check is made to see if the secondary stack can fit inside the
7421 primary stack.
7422
7423 Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
7424 is in effect.
7425
7426 @node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
7427 @anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{e0}
7428 @section Pragma Share_Generic
7429
7430
7431 Syntax:
7432
7433 @example
7434 pragma Share_Generic (GNAME @{, GNAME@});
7435
7436 GNAME ::= generic_unit_NAME | generic_instance_NAME
7437 @end example
7438
7439 This pragma is provided for compatibility with Dec Ada 83. It has
7440 no effect in GNAT (which does not implement shared generics), other
7441 than to check that the given names are all names of generic units or
7442 generic instances.
7443
7444 @node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
7445 @anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{e1}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e2}
7446 @section Pragma Shared
7447
7448
7449 This pragma is provided for compatibility with Ada 83. The syntax and
7450 semantics are identical to pragma Atomic.
7451
7452 @node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
7453 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e3}
7454 @section Pragma Short_Circuit_And_Or
7455
7456
7457 Syntax:
7458
7459 @example
7460 pragma Short_Circuit_And_Or;
7461 @end example
7462
7463 This configuration pragma causes any occurrence of the AND operator applied to
7464 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
7465 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
7466 may be useful in the context of certification protocols requiring the use of
7467 short-circuited logical operators. If this configuration pragma occurs locally
7468 within the file being compiled, it applies only to the file being compiled.
7469 There is no requirement that all units in a partition use this option.
7470
7471 @node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
7472 @anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e4}
7473 @section Pragma Short_Descriptors
7474
7475
7476 Syntax:
7477
7478 @example
7479 pragma Short_Descriptors
7480 @end example
7481
7482 This pragma is provided for compatibility with other Ada implementations. It
7483 is recognized but ignored by all current versions of GNAT.
7484
7485 @node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
7486 @anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e5}@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e6}
7487 @section Pragma Simple_Storage_Pool_Type
7488
7489
7490 @geindex Storage pool
7491 @geindex simple
7492
7493 @geindex Simple storage pool
7494
7495 Syntax:
7496
7497 @example
7498 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
7499 @end example
7500
7501 A type can be established as a 'simple storage pool type' by applying
7502 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
7503 A type named in the pragma must be a library-level immutably limited record
7504 type or limited tagged type declared immediately within a package declaration.
7505 The type can also be a limited private type whose full type is allowed as
7506 a simple storage pool type.
7507
7508 For a simple storage pool type @code{SSP}, nonabstract primitive subprograms
7509 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
7510 are subtype conformant with the following subprogram declarations:
7511
7512 @example
7513 procedure Allocate
7514 (Pool : in out SSP;
7515 Storage_Address : out System.Address;
7516 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7517 Alignment : System.Storage_Elements.Storage_Count);
7518
7519 procedure Deallocate
7520 (Pool : in out SSP;
7521 Storage_Address : System.Address;
7522 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
7523 Alignment : System.Storage_Elements.Storage_Count);
7524
7525 function Storage_Size (Pool : SSP)
7526 return System.Storage_Elements.Storage_Count;
7527 @end example
7528
7529 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
7530 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
7531 applying an unchecked deallocation has no effect other than to set its actual
7532 parameter to null. If @code{Storage_Size} is not declared, then the
7533 @code{Storage_Size} attribute applied to an access type associated with
7534 a pool object of type SSP returns zero. Additional operations can be declared
7535 for a simple storage pool type (such as for supporting a mark/release
7536 storage-management discipline).
7537
7538 An object of a simple storage pool type can be associated with an access
7539 type by specifying the attribute
7540 @ref{e7,,Simple_Storage_Pool}. For example:
7541
7542 @example
7543 My_Pool : My_Simple_Storage_Pool_Type;
7544
7545 type Acc is access My_Data_Type;
7546
7547 for Acc'Simple_Storage_Pool use My_Pool;
7548 @end example
7549
7550 See attribute @ref{e7,,Simple_Storage_Pool}
7551 for further details.
7552
7553 @node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
7554 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e8}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e9}
7555 @section Pragma Source_File_Name
7556
7557
7558 Syntax:
7559
7560 @example
7561 pragma Source_File_Name (
7562 [Unit_Name =>] unit_NAME,
7563 Spec_File_Name => STRING_LITERAL,
7564 [Index => INTEGER_LITERAL]);
7565
7566 pragma Source_File_Name (
7567 [Unit_Name =>] unit_NAME,
7568 Body_File_Name => STRING_LITERAL,
7569 [Index => INTEGER_LITERAL]);
7570 @end example
7571
7572 Use this to override the normal naming convention. It is a configuration
7573 pragma, and so has the usual applicability of configuration pragmas
7574 (i.e., it applies to either an entire partition, or to all units in a
7575 compilation, or to a single unit, depending on how it is used.
7576 @code{unit_name} is mapped to @code{file_name_literal}. The identifier for
7577 the second argument is required, and indicates whether this is the file
7578 name for the spec or for the body.
7579
7580 The optional Index argument should be used when a file contains multiple
7581 units, and when you do not want to use @code{gnatchop} to separate then
7582 into multiple files (which is the recommended procedure to limit the
7583 number of recompilations that are needed when some sources change).
7584 For instance, if the source file @code{source.ada} contains
7585
7586 @example
7587 package B is
7588 ...
7589 end B;
7590
7591 with B;
7592 procedure A is
7593 begin
7594 ..
7595 end A;
7596 @end example
7597
7598 you could use the following configuration pragmas:
7599
7600 @example
7601 pragma Source_File_Name
7602 (B, Spec_File_Name => "source.ada", Index => 1);
7603 pragma Source_File_Name
7604 (A, Body_File_Name => "source.ada", Index => 2);
7605 @end example
7606
7607 Note that the @code{gnatname} utility can also be used to generate those
7608 configuration pragmas.
7609
7610 Another form of the @code{Source_File_Name} pragma allows
7611 the specification of patterns defining alternative file naming schemes
7612 to apply to all files.
7613
7614 @example
7615 pragma Source_File_Name
7616 ( [Spec_File_Name =>] STRING_LITERAL
7617 [,[Casing =>] CASING_SPEC]
7618 [,[Dot_Replacement =>] STRING_LITERAL]);
7619
7620 pragma Source_File_Name
7621 ( [Body_File_Name =>] STRING_LITERAL
7622 [,[Casing =>] CASING_SPEC]
7623 [,[Dot_Replacement =>] STRING_LITERAL]);
7624
7625 pragma Source_File_Name
7626 ( [Subunit_File_Name =>] STRING_LITERAL
7627 [,[Casing =>] CASING_SPEC]
7628 [,[Dot_Replacement =>] STRING_LITERAL]);
7629
7630 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
7631 @end example
7632
7633 The first argument is a pattern that contains a single asterisk indicating
7634 the point at which the unit name is to be inserted in the pattern string
7635 to form the file name. The second argument is optional. If present it
7636 specifies the casing of the unit name in the resulting file name string.
7637 The default is lower case. Finally the third argument allows for systematic
7638 replacement of any dots in the unit name by the specified string literal.
7639
7640 Note that Source_File_Name pragmas should not be used if you are using
7641 project files. The reason for this rule is that the project manager is not
7642 aware of these pragmas, and so other tools that use the projet file would not
7643 be aware of the intended naming conventions. If you are using project files,
7644 file naming is controlled by Source_File_Name_Project pragmas, which are
7645 usually supplied automatically by the project manager. A pragma
7646 Source_File_Name cannot appear after a @ref{ea,,Pragma Source_File_Name_Project}.
7647
7648 For more details on the use of the @code{Source_File_Name} pragma, see the
7649 sections on @code{Using Other File Names} and @cite{Alternative File Naming Schemes' in the :title:`GNAT User's Guide}.
7650
7651 @node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
7652 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{ea}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{eb}
7653 @section Pragma Source_File_Name_Project
7654
7655
7656 This pragma has the same syntax and semantics as pragma Source_File_Name.
7657 It is only allowed as a stand-alone configuration pragma.
7658 It cannot appear after a @ref{e8,,Pragma Source_File_Name}, and
7659 most importantly, once pragma Source_File_Name_Project appears,
7660 no further Source_File_Name pragmas are allowed.
7661
7662 The intention is that Source_File_Name_Project pragmas are always
7663 generated by the Project Manager in a manner consistent with the naming
7664 specified in a project file, and when naming is controlled in this manner,
7665 it is not permissible to attempt to modify this naming scheme using
7666 Source_File_Name or Source_File_Name_Project pragmas (which would not be
7667 known to the project manager).
7668
7669 @node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
7670 @anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{ec}
7671 @section Pragma Source_Reference
7672
7673
7674 Syntax:
7675
7676 @example
7677 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
7678 @end example
7679
7680 This pragma must appear as the first line of a source file.
7681 @code{integer_literal} is the logical line number of the line following
7682 the pragma line (for use in error messages and debugging
7683 information). @code{string_literal} is a static string constant that
7684 specifies the file name to be used in error messages and debugging
7685 information. This is most notably used for the output of @code{gnatchop}
7686 with the @emph{-r} switch, to make sure that the original unchopped
7687 source file is the one referred to.
7688
7689 The second argument must be a string literal, it cannot be a static
7690 string expression other than a string literal. This is because its value
7691 is needed for error messages issued by all phases of the compiler.
7692
7693 @node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
7694 @anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{ed}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{ee}
7695 @section Pragma SPARK_Mode
7696
7697
7698 Syntax:
7699
7700 @example
7701 pragma SPARK_Mode [(On | Off)] ;
7702 @end example
7703
7704 In general a program can have some parts that are in SPARK 2014 (and
7705 follow all the rules in the SPARK Reference Manual), and some parts
7706 that are full Ada 2012.
7707
7708 The SPARK_Mode pragma is used to identify which parts are in SPARK
7709 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
7710 be used in the following places:
7711
7712
7713 @itemize *
7714
7715 @item
7716 As a configuration pragma, in which case it sets the default mode for
7717 all units compiled with this pragma.
7718
7719 @item
7720 Immediately following a library-level subprogram spec
7721
7722 @item
7723 Immediately within a library-level package body
7724
7725 @item
7726 Immediately following the @code{private} keyword of a library-level
7727 package spec
7728
7729 @item
7730 Immediately following the @code{begin} keyword of a library-level
7731 package body
7732
7733 @item
7734 Immediately within a library-level subprogram body
7735 @end itemize
7736
7737 Normally a subprogram or package spec/body inherits the current mode
7738 that is active at the point it is declared. But this can be overridden
7739 by pragma within the spec or body as above.
7740
7741 The basic consistency rule is that you can't turn SPARK_Mode back
7742 @code{On}, once you have explicitly (with a pragma) turned if
7743 @code{Off}. So the following rules apply:
7744
7745 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
7746 also have SPARK_Mode @code{Off}.
7747
7748 For a package, we have four parts:
7749
7750
7751 @itemize *
7752
7753 @item
7754 the package public declarations
7755
7756 @item
7757 the package private part
7758
7759 @item
7760 the body of the package
7761
7762 @item
7763 the elaboration code after @code{begin}
7764 @end itemize
7765
7766 For a package, the rule is that if you explicitly turn SPARK_Mode
7767 @code{Off} for any part, then all the following parts must have
7768 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
7769 SPARK_Mode (@code{Off}) in the body. For example, if we have a
7770 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
7771 default everywhere, and one particular package spec has pragma
7772 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
7773 the package body.
7774
7775 @node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
7776 @anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{ef}
7777 @section Pragma Static_Elaboration_Desired
7778
7779
7780 Syntax:
7781
7782 @example
7783 pragma Static_Elaboration_Desired;
7784 @end example
7785
7786 This pragma is used to indicate that the compiler should attempt to initialize
7787 statically the objects declared in the library unit to which the pragma applies,
7788 when these objects are initialized (explicitly or implicitly) by an aggregate.
7789 In the absence of this pragma, aggregates in object declarations are expanded
7790 into assignments and loops, even when the aggregate components are static
7791 constants. When the aggregate is present the compiler builds a static expression
7792 that requires no run-time code, so that the initialized object can be placed in
7793 read-only data space. If the components are not static, or the aggregate has
7794 more that 100 components, the compiler emits a warning that the pragma cannot
7795 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
7796 construction of larger aggregates with static components that include an others
7797 choice.)
7798
7799 @node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
7800 @anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{f0}
7801 @section Pragma Stream_Convert
7802
7803
7804 Syntax:
7805
7806 @example
7807 pragma Stream_Convert (
7808 [Entity =>] type_LOCAL_NAME,
7809 [Read =>] function_NAME,
7810 [Write =>] function_NAME);
7811 @end example
7812
7813 This pragma provides an efficient way of providing user-defined stream
7814 attributes. Not only is it simpler to use than specifying the attributes
7815 directly, but more importantly, it allows the specification to be made in such
7816 a way that the predefined unit Ada.Streams is not loaded unless it is actually
7817 needed (i.e. unless the stream attributes are actually used); the use of
7818 the Stream_Convert pragma adds no overhead at all, unless the stream
7819 attributes are actually used on the designated type.
7820
7821 The first argument specifies the type for which stream functions are
7822 provided. The second parameter provides a function used to read values
7823 of this type. It must name a function whose argument type may be any
7824 subtype, and whose returned type must be the type given as the first
7825 argument to the pragma.
7826
7827 The meaning of the @code{Read} parameter is that if a stream attribute directly
7828 or indirectly specifies reading of the type given as the first parameter,
7829 then a value of the type given as the argument to the Read function is
7830 read from the stream, and then the Read function is used to convert this
7831 to the required target type.
7832
7833 Similarly the @code{Write} parameter specifies how to treat write attributes
7834 that directly or indirectly apply to the type given as the first parameter.
7835 It must have an input parameter of the type specified by the first parameter,
7836 and the return type must be the same as the input type of the Read function.
7837 The effect is to first call the Write function to convert to the given stream
7838 type, and then write the result type to the stream.
7839
7840 The Read and Write functions must not be overloaded subprograms. If necessary
7841 renamings can be supplied to meet this requirement.
7842 The usage of this attribute is best illustrated by a simple example, taken
7843 from the GNAT implementation of package Ada.Strings.Unbounded:
7844
7845 @example
7846 function To_Unbounded (S : String) return Unbounded_String
7847 renames To_Unbounded_String;
7848
7849 pragma Stream_Convert
7850 (Unbounded_String, To_Unbounded, To_String);
7851 @end example
7852
7853 The specifications of the referenced functions, as given in the Ada
7854 Reference Manual are:
7855
7856 @example
7857 function To_Unbounded_String (Source : String)
7858 return Unbounded_String;
7859
7860 function To_String (Source : Unbounded_String)
7861 return String;
7862 @end example
7863
7864 The effect is that if the value of an unbounded string is written to a stream,
7865 then the representation of the item in the stream is in the same format that
7866 would be used for @code{Standard.String'Output}, and this same representation
7867 is expected when a value of this type is read from the stream. Note that the
7868 value written always includes the bounds, even for Unbounded_String'Write,
7869 since Unbounded_String is not an array type.
7870
7871 Note that the @code{Stream_Convert} pragma is not effective in the case of
7872 a derived type of a non-limited tagged type. If such a type is specified then
7873 the pragma is silently ignored, and the default implementation of the stream
7874 attributes is used instead.
7875
7876 @node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
7877 @anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f1}
7878 @section Pragma Style_Checks
7879
7880
7881 Syntax:
7882
7883 @example
7884 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
7885 On | Off [, LOCAL_NAME]);
7886 @end example
7887
7888 This pragma is used in conjunction with compiler switches to control the
7889 built in style checking provided by GNAT. The compiler switches, if set,
7890 provide an initial setting for the switches, and this pragma may be used
7891 to modify these settings, or the settings may be provided entirely by
7892 the use of the pragma. This pragma can be used anywhere that a pragma
7893 is legal, including use as a configuration pragma (including use in
7894 the @code{gnat.adc} file).
7895
7896 The form with a string literal specifies which style options are to be
7897 activated. These are additive, so they apply in addition to any previously
7898 set style check options. The codes for the options are the same as those
7899 used in the @emph{-gnaty} switch to @emph{gcc} or @emph{gnatmake}.
7900 For example the following two methods can be used to enable
7901 layout checking:
7902
7903
7904 @itemize *
7905
7906 @item
7907 @example
7908 pragma Style_Checks ("l");
7909 @end example
7910
7911 @item
7912 @example
7913 gcc -c -gnatyl ...
7914 @end example
7915 @end itemize
7916
7917 The form @code{ALL_CHECKS} activates all standard checks (its use is equivalent
7918 to the use of the @code{gnaty} switch with no options.
7919 See the @cite{GNAT User's Guide} for details.)
7920
7921 Note: the behavior is slightly different in GNAT mode (@code{-gnatg} used).
7922 In this case, @code{ALL_CHECKS} implies the standard set of GNAT mode style check
7923 options (i.e. equivalent to @code{-gnatyg}).
7924
7925 The forms with @code{Off} and @code{On}
7926 can be used to temporarily disable style checks
7927 as shown in the following example:
7928
7929 @example
7930 pragma Style_Checks ("k"); -- requires keywords in lower case
7931 pragma Style_Checks (Off); -- turn off style checks
7932 NULL; -- this will not generate an error message
7933 pragma Style_Checks (On); -- turn style checks back on
7934 NULL; -- this will generate an error message
7935 @end example
7936
7937 Finally the two argument form is allowed only if the first argument is
7938 @code{On} or @code{Off}. The effect is to turn of semantic style checks
7939 for the specified entity, as shown in the following example:
7940
7941 @example
7942 pragma Style_Checks ("r"); -- require consistency of identifier casing
7943 Arg : Integer;
7944 Rf1 : Integer := ARG; -- incorrect, wrong case
7945 pragma Style_Checks (Off, Arg);
7946 Rf2 : Integer := ARG; -- OK, no error
7947 @end example
7948
7949 @node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
7950 @anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f2}
7951 @section Pragma Subtitle
7952
7953
7954 Syntax:
7955
7956 @example
7957 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
7958 @end example
7959
7960 This pragma is recognized for compatibility with other Ada compilers
7961 but is ignored by GNAT.
7962
7963 @node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
7964 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f3}
7965 @section Pragma Suppress
7966
7967
7968 Syntax:
7969
7970 @example
7971 pragma Suppress (Identifier [, [On =>] Name]);
7972 @end example
7973
7974 This is a standard pragma, and supports all the check names required in
7975 the RM. It is included here because GNAT recognizes some additional check
7976 names that are implementation defined (as permitted by the RM):
7977
7978
7979 @itemize *
7980
7981 @item
7982 @code{Alignment_Check} can be used to suppress alignment checks
7983 on addresses used in address clauses. Such checks can also be suppressed
7984 by suppressing range checks, but the specific use of @code{Alignment_Check}
7985 allows suppression of alignment checks without suppressing other range checks.
7986 Note that @code{Alignment_Check} is suppressed by default on machines (such as
7987 the x86) with non-strict alignment.
7988
7989 @item
7990 @code{Atomic_Synchronization} can be used to suppress the special memory
7991 synchronization instructions that are normally generated for access to
7992 @code{Atomic} variables to ensure correct synchronization between tasks
7993 that use such variables for synchronization purposes.
7994
7995 @item
7996 @code{Duplicated_Tag_Check} Can be used to suppress the check that is generated
7997 for a duplicated tag value when a tagged type is declared.
7998
7999 @item
8000 @code{Container_Checks} Can be used to suppress all checks within Ada.Containers
8001 and instances of its children, including Tampering_Check.
8002
8003 @item
8004 @code{Tampering_Check} Can be used to suppress tampering check in the containers.
8005
8006 @item
8007 @code{Predicate_Check} can be used to control whether predicate checks are
8008 active. It is applicable only to predicates for which the policy is
8009 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
8010 predicate is ignored or checked for the whole program, the use of
8011 @code{Suppress} and @code{Unsuppress} with this check name allows a given
8012 predicate to be turned on and off at specific points in the program.
8013
8014 @item
8015 @code{Validity_Check} can be used specifically to control validity checks.
8016 If @code{Suppress} is used to suppress validity checks, then no validity
8017 checks are performed, including those specified by the appropriate compiler
8018 switch or the @code{Validity_Checks} pragma.
8019
8020 @item
8021 Additional check names previously introduced by use of the @code{Check_Name}
8022 pragma are also allowed.
8023 @end itemize
8024
8025 Note that pragma Suppress gives the compiler permission to omit
8026 checks, but does not require the compiler to omit checks. The compiler
8027 will generate checks if they are essentially free, even when they are
8028 suppressed. In particular, if the compiler can prove that a certain
8029 check will necessarily fail, it will generate code to do an
8030 unconditional 'raise', even if checks are suppressed. The compiler
8031 warns in this case.
8032
8033 Of course, run-time checks are omitted whenever the compiler can prove
8034 that they will not fail, whether or not checks are suppressed.
8035
8036 @node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
8037 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f4}
8038 @section Pragma Suppress_All
8039
8040
8041 Syntax:
8042
8043 @example
8044 pragma Suppress_All;
8045 @end example
8046
8047 This pragma can appear anywhere within a unit.
8048 The effect is to apply @code{Suppress (All_Checks)} to the unit
8049 in which it appears. This pragma is implemented for compatibility with DEC
8050 Ada 83 usage where it appears at the end of a unit, and for compatibility
8051 with Rational Ada, where it appears as a program unit pragma.
8052 The use of the standard Ada pragma @code{Suppress (All_Checks)}
8053 as a normal configuration pragma is the preferred usage in GNAT.
8054
8055 @node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
8056 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f5}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{f6}
8057 @section Pragma Suppress_Debug_Info
8058
8059
8060 Syntax:
8061
8062 @example
8063 pragma Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
8064 @end example
8065
8066 This pragma can be used to suppress generation of debug information
8067 for the specified entity. It is intended primarily for use in debugging
8068 the debugger, and navigating around debugger problems.
8069
8070 @node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
8071 @anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f7}
8072 @section Pragma Suppress_Exception_Locations
8073
8074
8075 Syntax:
8076
8077 @example
8078 pragma Suppress_Exception_Locations;
8079 @end example
8080
8081 In normal mode, a raise statement for an exception by default generates
8082 an exception message giving the file name and line number for the location
8083 of the raise. This is useful for debugging and logging purposes, but this
8084 entails extra space for the strings for the messages. The configuration
8085 pragma @code{Suppress_Exception_Locations} can be used to suppress the
8086 generation of these strings, with the result that space is saved, but the
8087 exception message for such raises is null. This configuration pragma may
8088 appear in a global configuration pragma file, or in a specific unit as
8089 usual. It is not required that this pragma be used consistently within
8090 a partition, so it is fine to have some units within a partition compiled
8091 with this pragma and others compiled in normal mode without it.
8092
8093 @node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
8094 @anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f8}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f9}
8095 @section Pragma Suppress_Initialization
8096
8097
8098 @geindex Suppressing initialization
8099
8100 @geindex Initialization
8101 @geindex suppression of
8102
8103 Syntax:
8104
8105 @example
8106 pragma Suppress_Initialization ([Entity =>] variable_or_subtype_Name);
8107 @end example
8108
8109 Here variable_or_subtype_Name is the name introduced by a type declaration
8110 or subtype declaration or the name of a variable introduced by an
8111 object declaration.
8112
8113 In the case of a type or subtype
8114 this pragma suppresses any implicit or explicit initialization
8115 for all variables of the given type or subtype,
8116 including initialization resulting from the use of pragmas
8117 Normalize_Scalars or Initialize_Scalars.
8118
8119 This is considered a representation item, so it cannot be given after
8120 the type is frozen. It applies to all subsequent object declarations,
8121 and also any allocator that creates objects of the type.
8122
8123 If the pragma is given for the first subtype, then it is considered
8124 to apply to the base type and all its subtypes. If the pragma is given
8125 for other than a first subtype, then it applies only to the given subtype.
8126 The pragma may not be given after the type is frozen.
8127
8128 Note that this includes eliminating initialization of discriminants
8129 for discriminated types, and tags for tagged types. In these cases,
8130 you will have to use some non-portable mechanism (e.g. address
8131 overlays or unchecked conversion) to achieve required initialization
8132 of these fields before accessing any object of the corresponding type.
8133
8134 For the variable case, implicit initialization for the named variable
8135 is suppressed, just as though its subtype had been given in a pragma
8136 Suppress_Initialization, as described above.
8137
8138 @node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
8139 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{fa}
8140 @section Pragma Task_Name
8141
8142
8143 Syntax
8144
8145 @example
8146 pragma Task_Name (string_EXPRESSION);
8147 @end example
8148
8149 This pragma appears within a task definition (like pragma
8150 @code{Priority}) and applies to the task in which it appears. The
8151 argument must be of type String, and provides a name to be used for
8152 the task instance when the task is created. Note that this expression
8153 is not required to be static, and in particular, it can contain
8154 references to task discriminants. This facility can be used to
8155 provide different names for different tasks as they are created,
8156 as illustrated in the example below.
8157
8158 The task name is recorded internally in the run-time structures
8159 and is accessible to tools like the debugger. In addition the
8160 routine @code{Ada.Task_Identification.Image} will return this
8161 string, with a unique task address appended.
8162
8163 @example
8164 -- Example of the use of pragma Task_Name
8165
8166 with Ada.Task_Identification;
8167 use Ada.Task_Identification;
8168 with Text_IO; use Text_IO;
8169 procedure t3 is
8170
8171 type Astring is access String;
8172
8173 task type Task_Typ (Name : access String) is
8174 pragma Task_Name (Name.all);
8175 end Task_Typ;
8176
8177 task body Task_Typ is
8178 Nam : constant String := Image (Current_Task);
8179 begin
8180 Put_Line ("-->" & Nam (1 .. 14) & "<--");
8181 end Task_Typ;
8182
8183 type Ptr_Task is access Task_Typ;
8184 Task_Var : Ptr_Task;
8185
8186 begin
8187 Task_Var :=
8188 new Task_Typ (new String'("This is task 1"));
8189 Task_Var :=
8190 new Task_Typ (new String'("This is task 2"));
8191 end;
8192 @end example
8193
8194 @node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
8195 @anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{fb}
8196 @section Pragma Task_Storage
8197
8198
8199 Syntax:
8200
8201 @example
8202 pragma Task_Storage (
8203 [Task_Type =>] LOCAL_NAME,
8204 [Top_Guard =>] static_integer_EXPRESSION);
8205 @end example
8206
8207 This pragma specifies the length of the guard area for tasks. The guard
8208 area is an additional storage area allocated to a task. A value of zero
8209 means that either no guard area is created or a minimal guard area is
8210 created, depending on the target. This pragma can appear anywhere a
8211 @code{Storage_Size} attribute definition clause is allowed for a task
8212 type.
8213
8214 @node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
8215 @anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fc}@anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{fd}
8216 @section Pragma Test_Case
8217
8218
8219 @geindex Test cases
8220
8221 Syntax:
8222
8223 @example
8224 pragma Test_Case (
8225 [Name =>] static_string_Expression
8226 ,[Mode =>] (Nominal | Robustness)
8227 [, Requires => Boolean_Expression]
8228 [, Ensures => Boolean_Expression]);
8229 @end example
8230
8231 The @code{Test_Case} pragma allows defining fine-grain specifications
8232 for use by testing tools.
8233 The compiler checks the validity of the @code{Test_Case} pragma, but its
8234 presence does not lead to any modification of the code generated by the
8235 compiler.
8236
8237 @code{Test_Case} pragmas may only appear immediately following the
8238 (separate) declaration of a subprogram in a package declaration, inside
8239 a package spec unit. Only other pragmas may intervene (that is appear
8240 between the subprogram declaration and a test case).
8241
8242 The compiler checks that boolean expressions given in @code{Requires} and
8243 @code{Ensures} are valid, where the rules for @code{Requires} are the
8244 same as the rule for an expression in @code{Precondition} and the rules
8245 for @code{Ensures} are the same as the rule for an expression in
8246 @code{Postcondition}. In particular, attributes @code{'Old} and
8247 @code{'Result} can only be used within the @code{Ensures}
8248 expression. The following is an example of use within a package spec:
8249
8250 @example
8251 package Math_Functions is
8252 ...
8253 function Sqrt (Arg : Float) return Float;
8254 pragma Test_Case (Name => "Test 1",
8255 Mode => Nominal,
8256 Requires => Arg < 10000,
8257 Ensures => Sqrt'Result < 10);
8258 ...
8259 end Math_Functions;
8260 @end example
8261
8262 The meaning of a test case is that there is at least one context where
8263 @code{Requires} holds such that, if the associated subprogram is executed in
8264 that context, then @code{Ensures} holds when the subprogram returns.
8265 Mode @code{Nominal} indicates that the input context should also satisfy the
8266 precondition of the subprogram, and the output context should also satisfy its
8267 postcondition. Mode @code{Robustness} indicates that the precondition and
8268 postcondition of the subprogram should be ignored for this test case.
8269
8270 @node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
8271 @anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{fe}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{ff}
8272 @section Pragma Thread_Local_Storage
8273
8274
8275 @geindex Task specific storage
8276
8277 @geindex TLS (Thread Local Storage)
8278
8279 @geindex Task_Attributes
8280
8281 Syntax:
8282
8283 @example
8284 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
8285 @end example
8286
8287 This pragma specifies that the specified entity, which must be
8288 a variable declared in a library-level package, is to be marked as
8289 "Thread Local Storage" (@code{TLS}). On systems supporting this (which
8290 include Windows, Solaris, GNU/Linux, and VxWorks 6), this causes each
8291 thread (and hence each Ada task) to see a distinct copy of the variable.
8292
8293 The variable must not have default initialization, and if there is
8294 an explicit initialization, it must be either @code{null} for an
8295 access variable, a static expression for a scalar variable, or a fully
8296 static aggregate for a composite type, that is to say, an aggregate all
8297 of whose components are static, and which does not include packed or
8298 discriminated components.
8299
8300 This provides a low-level mechanism similar to that provided by
8301 the @code{Ada.Task_Attributes} package, but much more efficient
8302 and is also useful in writing interface code that will interact
8303 with foreign threads.
8304
8305 If this pragma is used on a system where @code{TLS} is not supported,
8306 then an error message will be generated and the program will be rejected.
8307
8308 @node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
8309 @anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{100}
8310 @section Pragma Time_Slice
8311
8312
8313 Syntax:
8314
8315 @example
8316 pragma Time_Slice (static_duration_EXPRESSION);
8317 @end example
8318
8319 For implementations of GNAT on operating systems where it is possible
8320 to supply a time slice value, this pragma may be used for this purpose.
8321 It is ignored if it is used in a system that does not allow this control,
8322 or if it appears in other than the main program unit.
8323
8324 @node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
8325 @anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{101}
8326 @section Pragma Title
8327
8328
8329 Syntax:
8330
8331 @example
8332 pragma Title (TITLING_OPTION [, TITLING OPTION]);
8333
8334 TITLING_OPTION ::=
8335 [Title =>] STRING_LITERAL,
8336 | [Subtitle =>] STRING_LITERAL
8337 @end example
8338
8339 Syntax checked but otherwise ignored by GNAT. This is a listing control
8340 pragma used in DEC Ada 83 implementations to provide a title and/or
8341 subtitle for the program listing. The program listing generated by GNAT
8342 does not have titles or subtitles.
8343
8344 Unlike other pragmas, the full flexibility of named notation is allowed
8345 for this pragma, i.e., the parameters may be given in any order if named
8346 notation is used, and named and positional notation can be mixed
8347 following the normal rules for procedure calls in Ada.
8348
8349 @node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
8350 @anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{102}
8351 @section Pragma Type_Invariant
8352
8353
8354 Syntax:
8355
8356 @example
8357 pragma Type_Invariant
8358 ([Entity =>] type_LOCAL_NAME,
8359 [Check =>] EXPRESSION);
8360 @end example
8361
8362 The @code{Type_Invariant} pragma is intended to be an exact
8363 replacement for the language-defined @code{Type_Invariant}
8364 aspect, and shares its restrictions and semantics. It differs
8365 from the language defined @code{Invariant} pragma in that it
8366 does not permit a string parameter, and it is
8367 controlled by the assertion identifier @code{Type_Invariant}
8368 rather than @code{Invariant}.
8369
8370 @node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
8371 @anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{103}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{104}
8372 @section Pragma Type_Invariant_Class
8373
8374
8375 Syntax:
8376
8377 @example
8378 pragma Type_Invariant_Class
8379 ([Entity =>] type_LOCAL_NAME,
8380 [Check =>] EXPRESSION);
8381 @end example
8382
8383 The @code{Type_Invariant_Class} pragma is intended to be an exact
8384 replacement for the language-defined @code{Type_Invariant'Class}
8385 aspect, and shares its restrictions and semantics.
8386
8387 Note: This pragma is called @code{Type_Invariant_Class} rather than
8388 @code{Type_Invariant'Class} because the latter would not be strictly
8389 conforming to the allowed syntax for pragmas. The motivation
8390 for providing pragmas equivalent to the aspects is to allow a program
8391 to be written using the pragmas, and then compiled if necessary
8392 using an Ada compiler that does not recognize the pragmas or
8393 aspects, but is prepared to ignore the pragmas. The assertion
8394 policy that controls this pragma is @code{Type_Invariant'Class},
8395 not @code{Type_Invariant_Class}.
8396
8397 @node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
8398 @anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{105}
8399 @section Pragma Unchecked_Union
8400
8401
8402 @geindex Unions in C
8403
8404 Syntax:
8405
8406 @example
8407 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
8408 @end example
8409
8410 This pragma is used to specify a representation of a record type that is
8411 equivalent to a C union. It was introduced as a GNAT implementation defined
8412 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
8413 pragma, making it language defined, and GNAT fully implements this extended
8414 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
8415 details, consult the Ada 2012 Reference Manual, section B.3.3.
8416
8417 @node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
8418 @anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{106}
8419 @section Pragma Unevaluated_Use_Of_Old
8420
8421
8422 @geindex Attribute Old
8423
8424 @geindex Attribute Loop_Entry
8425
8426 @geindex Unevaluated_Use_Of_Old
8427
8428 Syntax:
8429
8430 @example
8431 pragma Unevaluated_Use_Of_Old (Error | Warn | Allow);
8432 @end example
8433
8434 This pragma controls the processing of attributes Old and Loop_Entry.
8435 If either of these attributes is used in a potentially unevaluated
8436 expression (e.g. the then or else parts of an if expression), then
8437 normally this usage is considered illegal if the prefix of the attribute
8438 is other than an entity name. The language requires this
8439 behavior for Old, and GNAT copies the same rule for Loop_Entry.
8440
8441 The reason for this rule is that otherwise, we can have a situation
8442 where we save the Old value, and this results in an exception, even
8443 though we might not evaluate the attribute. Consider this example:
8444
8445 @example
8446 package UnevalOld is
8447 K : Character;
8448 procedure U (A : String; C : Boolean) -- ERROR
8449 with Post => (if C then A(1)'Old = K else True);
8450 end;
8451 @end example
8452
8453 If procedure U is called with a string with a lower bound of 2, and
8454 C false, then an exception would be raised trying to evaluate A(1)
8455 on entry even though the value would not be actually used.
8456
8457 Although the rule guarantees against this possibility, it is sometimes
8458 too restrictive. For example if we know that the string has a lower
8459 bound of 1, then we will never raise an exception.
8460 The pragma @code{Unevaluated_Use_Of_Old} can be
8461 used to modify this behavior. If the argument is @code{Error} then an
8462 error is given (this is the default RM behavior). If the argument is
8463 @code{Warn} then the usage is allowed as legal but with a warning
8464 that an exception might be raised. If the argument is @code{Allow}
8465 then the usage is allowed as legal without generating a warning.
8466
8467 This pragma may appear as a configuration pragma, or in a declarative
8468 part or package specification. In the latter case it applies to
8469 uses up to the end of the corresponding statement sequence or
8470 sequence of package declarations.
8471
8472 @node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
8473 @anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{107}
8474 @section Pragma Unimplemented_Unit
8475
8476
8477 Syntax:
8478
8479 @example
8480 pragma Unimplemented_Unit;
8481 @end example
8482
8483 If this pragma occurs in a unit that is processed by the compiler, GNAT
8484 aborts with the message @code{xxx not implemented}, where
8485 @code{xxx} is the name of the current compilation unit. This pragma is
8486 intended to allow the compiler to handle unimplemented library units in
8487 a clean manner.
8488
8489 The abort only happens if code is being generated. Thus you can use
8490 specs of unimplemented packages in syntax or semantic checking mode.
8491
8492 @node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
8493 @anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{108}@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{109}
8494 @section Pragma Universal_Aliasing
8495
8496
8497 Syntax:
8498
8499 @example
8500 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
8501 @end example
8502
8503 @code{type_LOCAL_NAME} must refer to a type declaration in the current
8504 declarative part. The effect is to inhibit strict type-based aliasing
8505 optimization for the given type. In other words, the effect is as though
8506 access types designating this type were subject to pragma No_Strict_Aliasing.
8507 For a detailed description of the strict aliasing optimization, and the
8508 situations in which it must be suppressed, see the section on
8509 @code{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
8510
8511 @node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
8512 @anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{10b}
8513 @section Pragma Universal_Data
8514
8515
8516 Syntax:
8517
8518 @example
8519 pragma Universal_Data [(library_unit_Name)];
8520 @end example
8521
8522 This pragma is supported only for the AAMP target and is ignored for
8523 other targets. The pragma specifies that all library-level objects
8524 (Counter 0 data) associated with the library unit are to be accessed
8525 and updated using universal addressing (24-bit addresses for AAMP5)
8526 rather than the default of 16-bit Data Environment (DENV) addressing.
8527 Use of this pragma will generally result in less efficient code for
8528 references to global data associated with the library unit, but
8529 allows such data to be located anywhere in memory. This pragma is
8530 a library unit pragma, but can also be used as a configuration pragma
8531 (including use in the @code{gnat.adc} file). The functionality
8532 of this pragma is also available by applying the -univ switch on the
8533 compilations of units where universal addressing of the data is desired.
8534
8535 @node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
8536 @anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{10d}
8537 @section Pragma Unmodified
8538
8539
8540 @geindex Warnings
8541 @geindex unmodified
8542
8543 Syntax:
8544
8545 @example
8546 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
8547 @end example
8548
8549 This pragma signals that the assignable entities (variables,
8550 @code{out} parameters, @code{in out} parameters) whose names are listed are
8551 deliberately not assigned in the current source unit. This
8552 suppresses warnings about the
8553 entities being referenced but not assigned, and in addition a warning will be
8554 generated if one of these entities is in fact assigned in the
8555 same unit as the pragma (or in the corresponding body, or one
8556 of its subunits).
8557
8558 This is particularly useful for clearly signaling that a particular
8559 parameter is not modified, even though the spec suggests that it might
8560 be.
8561
8562 For the variable case, warnings are never given for unreferenced variables
8563 whose name contains one of the substrings
8564 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8565 are typically to be used in cases where such warnings are expected.
8566 Thus it is never necessary to use @code{pragma Unmodified} for such
8567 variables, though it is harmless to do so.
8568
8569 @node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
8570 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10f}
8571 @section Pragma Unreferenced
8572
8573
8574 @geindex Warnings
8575 @geindex unreferenced
8576
8577 Syntax:
8578
8579 @example
8580 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
8581 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
8582 @end example
8583
8584 This pragma signals that the entities whose names are listed are
8585 deliberately not referenced in the current source unit after the
8586 occurrence of the pragma. This
8587 suppresses warnings about the
8588 entities being unreferenced, and in addition a warning will be
8589 generated if one of these entities is in fact subsequently referenced in the
8590 same unit as the pragma (or in the corresponding body, or one
8591 of its subunits).
8592
8593 This is particularly useful for clearly signaling that a particular
8594 parameter is not referenced in some particular subprogram implementation
8595 and that this is deliberate. It can also be useful in the case of
8596 objects declared only for their initialization or finalization side
8597 effects.
8598
8599 If @code{LOCAL_NAME} identifies more than one matching homonym in the
8600 current scope, then the entity most recently declared is the one to which
8601 the pragma applies. Note that in the case of accept formals, the pragma
8602 Unreferenced may appear immediately after the keyword @code{do} which
8603 allows the indication of whether or not accept formals are referenced
8604 or not to be given individually for each accept statement.
8605
8606 The left hand side of an assignment does not count as a reference for the
8607 purpose of this pragma. Thus it is fine to assign to an entity for which
8608 pragma Unreferenced is given.
8609
8610 Note that if a warning is desired for all calls to a given subprogram,
8611 regardless of whether they occur in the same unit as the subprogram
8612 declaration, then this pragma should not be used (calls from another
8613 unit would not be flagged); pragma Obsolescent can be used instead
8614 for this purpose, see @ref{ad,,Pragma Obsolescent}.
8615
8616 The second form of pragma @code{Unreferenced} is used within a context
8617 clause. In this case the arguments must be unit names of units previously
8618 mentioned in @code{with} clauses (similar to the usage of pragma
8619 @code{Elaborate_All}. The effect is to suppress warnings about unreferenced
8620 units and unreferenced entities within these units.
8621
8622 For the variable case, warnings are never given for unreferenced variables
8623 whose name contains one of the substrings
8624 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8625 are typically to be used in cases where such warnings are expected.
8626 Thus it is never necessary to use @code{pragma Unreferenced} for such
8627 variables, though it is harmless to do so.
8628
8629 @node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
8630 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{110}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{111}
8631 @section Pragma Unreferenced_Objects
8632
8633
8634 @geindex Warnings
8635 @geindex unreferenced
8636
8637 Syntax:
8638
8639 @example
8640 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
8641 @end example
8642
8643 This pragma signals that for the types or subtypes whose names are
8644 listed, objects which are declared with one of these types or subtypes may
8645 not be referenced, and if no references appear, no warnings are given.
8646
8647 This is particularly useful for objects which are declared solely for their
8648 initialization and finalization effect. Such variables are sometimes referred
8649 to as RAII variables (Resource Acquisition Is Initialization). Using this
8650 pragma on the relevant type (most typically a limited controlled type), the
8651 compiler will automatically suppress unwanted warnings about these variables
8652 not being referenced.
8653
8654 @node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
8655 @anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{112}
8656 @section Pragma Unreserve_All_Interrupts
8657
8658
8659 Syntax:
8660
8661 @example
8662 pragma Unreserve_All_Interrupts;
8663 @end example
8664
8665 Normally certain interrupts are reserved to the implementation. Any attempt
8666 to attach an interrupt causes Program_Error to be raised, as described in
8667 RM C.3.2(22). A typical example is the @code{SIGINT} interrupt used in
8668 many systems for a @code{Ctrl-C} interrupt. Normally this interrupt is
8669 reserved to the implementation, so that @code{Ctrl-C} can be used to
8670 interrupt execution.
8671
8672 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
8673 a program, then all such interrupts are unreserved. This allows the
8674 program to handle these interrupts, but disables their standard
8675 functions. For example, if this pragma is used, then pressing
8676 @code{Ctrl-C} will not automatically interrupt execution. However,
8677 a program can then handle the @code{SIGINT} interrupt as it chooses.
8678
8679 For a full list of the interrupts handled in a specific implementation,
8680 see the source code for the spec of @code{Ada.Interrupts.Names} in
8681 file @code{a-intnam.ads}. This is a target dependent file that contains the
8682 list of interrupts recognized for a given target. The documentation in
8683 this file also specifies what interrupts are affected by the use of
8684 the @code{Unreserve_All_Interrupts} pragma.
8685
8686 For a more general facility for controlling what interrupts can be
8687 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
8688 of the @code{Unreserve_All_Interrupts} pragma.
8689
8690 @node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
8691 @anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{113}
8692 @section Pragma Unsuppress
8693
8694
8695 Syntax:
8696
8697 @example
8698 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
8699 @end example
8700
8701 This pragma undoes the effect of a previous pragma @code{Suppress}. If
8702 there is no corresponding pragma @code{Suppress} in effect, it has no
8703 effect. The range of the effect is the same as for pragma
8704 @code{Suppress}. The meaning of the arguments is identical to that used
8705 in pragma @code{Suppress}.
8706
8707 One important application is to ensure that checks are on in cases where
8708 code depends on the checks for its correct functioning, so that the code
8709 will compile correctly even if the compiler switches are set to suppress
8710 checks. For example, in a program that depends on external names of tagged
8711 types and wants to ensure that the duplicated tag check occurs even if all
8712 run-time checks are suppressed by a compiler switch, the following
8713 configuration pragma will ensure this test is not suppressed:
8714
8715 @example
8716 pragma Unsuppress (Duplicated_Tag_Check);
8717 @end example
8718
8719 This pragma is standard in Ada 2005. It is available in all earlier versions
8720 of Ada as an implementation-defined pragma.
8721
8722 Note that in addition to the checks defined in the Ada RM, GNAT recogizes a
8723 number of implementation-defined check names. See the description of pragma
8724 @code{Suppress} for full details.
8725
8726 @node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
8727 @anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{114}
8728 @section Pragma Use_VADS_Size
8729
8730
8731 @geindex Size
8732 @geindex VADS compatibility
8733
8734 @geindex Rational profile
8735
8736 Syntax:
8737
8738 @example
8739 pragma Use_VADS_Size;
8740 @end example
8741
8742 This is a configuration pragma. In a unit to which it applies, any use
8743 of the 'Size attribute is automatically interpreted as a use of the
8744 'VADS_Size attribute. Note that this may result in incorrect semantic
8745 processing of valid Ada 95 or Ada 2005 programs. This is intended to aid in
8746 the handling of existing code which depends on the interpretation of Size
8747 as implemented in the VADS compiler. See description of the VADS_Size
8748 attribute for further details.
8749
8750 @node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
8751 @anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{115}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{116}
8752 @section Pragma Unused
8753
8754
8755 @geindex Warnings
8756 @geindex unused
8757
8758 Syntax:
8759
8760 @example
8761 pragma Unused (LOCAL_NAME @{, LOCAL_NAME@});
8762 @end example
8763
8764 This pragma signals that the assignable entities (variables,
8765 @code{out} parameters, and @code{in out} parameters) whose names are listed
8766 deliberately do not get assigned or referenced in the current source unit
8767 after the occurrence of the pragma in the current source unit. This
8768 suppresses warnings about the entities that are unreferenced and/or not
8769 assigned, and, in addition, a warning will be generated if one of these
8770 entities gets assigned or subsequently referenced in the same unit as the
8771 pragma (in the corresponding body or one of its subunits).
8772
8773 This is particularly useful for clearly signaling that a particular
8774 parameter is not modified or referenced, even though the spec suggests
8775 that it might be.
8776
8777 For the variable case, warnings are never given for unreferenced
8778 variables whose name contains one of the substrings
8779 @code{DISCARD, DUMMY, IGNORE, JUNK, UNUSED} in any casing. Such names
8780 are typically to be used in cases where such warnings are expected.
8781 Thus it is never necessary to use @code{pragma Unmodified} for such
8782 variables, though it is harmless to do so.
8783
8784 @node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
8785 @anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{117}
8786 @section Pragma Validity_Checks
8787
8788
8789 Syntax:
8790
8791 @example
8792 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
8793 @end example
8794
8795 This pragma is used in conjunction with compiler switches to control the
8796 built-in validity checking provided by GNAT. The compiler switches, if set
8797 provide an initial setting for the switches, and this pragma may be used
8798 to modify these settings, or the settings may be provided entirely by
8799 the use of the pragma. This pragma can be used anywhere that a pragma
8800 is legal, including use as a configuration pragma (including use in
8801 the @code{gnat.adc} file).
8802
8803 The form with a string literal specifies which validity options are to be
8804 activated. The validity checks are first set to include only the default
8805 reference manual settings, and then a string of letters in the string
8806 specifies the exact set of options required. The form of this string
8807 is exactly as described for the @emph{-gnatVx} compiler switch (see the
8808 GNAT User's Guide for details). For example the following two
8809 methods can be used to enable validity checking for mode @code{in} and
8810 @code{in out} subprogram parameters:
8811
8812
8813 @itemize *
8814
8815 @item
8816 @example
8817 pragma Validity_Checks ("im");
8818 @end example
8819
8820 @item
8821 @example
8822 $ gcc -c -gnatVim ...
8823 @end example
8824 @end itemize
8825
8826 The form ALL_CHECKS activates all standard checks (its use is equivalent
8827 to the use of the @code{gnatVa} switch).
8828
8829 The forms with @code{Off} and @code{On} can be used to temporarily disable
8830 validity checks as shown in the following example:
8831
8832 @example
8833 pragma Validity_Checks ("c"); -- validity checks for copies
8834 pragma Validity_Checks (Off); -- turn off validity checks
8835 A := B; -- B will not be validity checked
8836 pragma Validity_Checks (On); -- turn validity checks back on
8837 A := C; -- C will be validity checked
8838 @end example
8839
8840 @node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
8841 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{118}
8842 @section Pragma Volatile
8843
8844
8845 Syntax:
8846
8847 @example
8848 pragma Volatile (LOCAL_NAME);
8849 @end example
8850
8851 This pragma is defined by the Ada Reference Manual, and the GNAT
8852 implementation is fully conformant with this definition. The reason it
8853 is mentioned in this section is that a pragma of the same name was supplied
8854 in some Ada 83 compilers, including DEC Ada 83. The Ada 95 / Ada 2005
8855 implementation of pragma Volatile is upwards compatible with the
8856 implementation in DEC Ada 83.
8857
8858 @node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
8859 @anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{119}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{11a}
8860 @section Pragma Volatile_Full_Access
8861
8862
8863 Syntax:
8864
8865 @example
8866 pragma Volatile_Full_Access (LOCAL_NAME);
8867 @end example
8868
8869 This is similar in effect to pragma Volatile, except that any reference to the
8870 object is guaranteed to be done only with instructions that read or write all
8871 the bits of the object. Furthermore, if the object is of a composite type,
8872 then any reference to a component of the object is guaranteed to read and/or
8873 write all the bits of the object.
8874
8875 The intention is that this be suitable for use with memory-mapped I/O devices
8876 on some machines. Note that there are two important respects in which this is
8877 different from @code{pragma Atomic}. First a reference to a @code{Volatile_Full_Access}
8878 object is not a sequential action in the RM 9.10 sense and, therefore, does
8879 not create a synchronization point. Second, in the case of @code{pragma Atomic},
8880 there is no guarantee that all the bits will be accessed if the reference
8881 is not to the whole object; the compiler is allowed (and generally will)
8882 access only part of the object in this case.
8883
8884 It is not permissible to specify @code{Atomic} and @code{Volatile_Full_Access} for
8885 the same object.
8886
8887 It is not permissible to specify @code{Volatile_Full_Access} for a composite
8888 (record or array) type or object that has at least one @code{Aliased} component.
8889
8890 @node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
8891 @anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{11b}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11c}
8892 @section Pragma Volatile_Function
8893
8894
8895 Syntax:
8896
8897 @example
8898 pragma Volatile_Function [ (boolean_EXPRESSION) ];
8899 @end example
8900
8901 For the semantics of this pragma, see the entry for aspect @code{Volatile_Function}
8902 in the SPARK 2014 Reference Manual, section 7.1.2.
8903
8904 @node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
8905 @anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{11d}
8906 @section Pragma Warning_As_Error
8907
8908
8909 Syntax:
8910
8911 @example
8912 pragma Warning_As_Error (static_string_EXPRESSION);
8913 @end example
8914
8915 This configuration pragma allows the programmer to specify a set
8916 of warnings that will be treated as errors. Any warning which
8917 matches the pattern given by the pragma argument will be treated
8918 as an error. This gives much more precise control that -gnatwe
8919 which treats all warnings as errors.
8920
8921 The pattern may contain asterisks, which match zero or more characters in
8922 the message. For example, you can use
8923 @code{pragma Warning_As_Error ("bits of*unused")} to treat the warning
8924 message @code{warning: 960 bits of "a" unused} as an error. No other regular
8925 expression notations are permitted. All characters other than asterisk in
8926 these three specific cases are treated as literal characters in the match.
8927 The match is case insensitive, for example XYZ matches xyz.
8928
8929 Note that the pattern matches if it occurs anywhere within the warning
8930 message string (it is not necessary to put an asterisk at the start and
8931 the end of the message, since this is implied).
8932
8933 Another possibility for the static_string_EXPRESSION which works whether
8934 or not error tags are enabled (@emph{-gnatw.d}) is to use the
8935 @emph{-gnatw} tag string, enclosed in brackets,
8936 as shown in the example below, to treat a class of warnings as errors.
8937
8938 The above use of patterns to match the message applies only to warning
8939 messages generated by the front end. This pragma can also be applied to
8940 warnings provided by the back end and mentioned in @ref{11e,,Pragma Warnings}.
8941 By using a single full @emph{-Wxxx} switch in the pragma, such warnings
8942 can also be treated as errors.
8943
8944 The pragma can appear either in a global configuration pragma file
8945 (e.g. @code{gnat.adc}), or at the start of a file. Given a global
8946 configuration pragma file containing:
8947
8948 @example
8949 pragma Warning_As_Error ("[-gnatwj]");
8950 @end example
8951
8952 which will treat all obsolescent feature warnings as errors, the
8953 following program compiles as shown (compile options here are
8954 @emph{-gnatwa.d -gnatl -gnatj55}).
8955
8956 @example
8957 1. pragma Warning_As_Error ("*never assigned*");
8958 2. function Warnerr return String is
8959 3. X : Integer;
8960 |
8961 >>> error: variable "X" is never read and
8962 never assigned [-gnatwv] [warning-as-error]
8963
8964 4. Y : Integer;
8965 |
8966 >>> warning: variable "Y" is assigned but
8967 never read [-gnatwu]
8968
8969 5. begin
8970 6. Y := 0;
8971 7. return %ABC%;
8972 |
8973 >>> error: use of "%" is an obsolescent
8974 feature (RM J.2(4)), use """ instead
8975 [-gnatwj] [warning-as-error]
8976
8977 8. end;
8978
8979 8 lines: No errors, 3 warnings (2 treated as errors)
8980 @end example
8981
8982 Note that this pragma does not affect the set of warnings issued in
8983 any way, it merely changes the effect of a matching warning if one
8984 is produced as a result of other warnings options. As shown in this
8985 example, if the pragma results in a warning being treated as an error,
8986 the tag is changed from "warning:" to "error:" and the string
8987 "[warning-as-error]" is appended to the end of the message.
8988
8989 @node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
8990 @anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{11f}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11e}
8991 @section Pragma Warnings
8992
8993
8994 Syntax:
8995
8996 @example
8997 pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
8998
8999 DETAILS ::= On | Off
9000 DETAILS ::= On | Off, local_NAME
9001 DETAILS ::= static_string_EXPRESSION
9002 DETAILS ::= On | Off, static_string_EXPRESSION
9003
9004 TOOL_NAME ::= GNAT | GNATProve
9005
9006 REASON ::= Reason => STRING_LITERAL @{& STRING_LITERAL@}
9007 @end example
9008
9009 Note: in Ada 83 mode, a string literal may be used in place of a static string
9010 expression (which does not exist in Ada 83).
9011
9012 Note if the second argument of @code{DETAILS} is a @code{local_NAME} then the
9013 second form is always understood. If the intention is to use
9014 the fourth form, then you can write @code{NAME & ""} to force the
9015 intepretation as a @emph{static_string_EXPRESSION}.
9016
9017 Note: if the first argument is a valid @code{TOOL_NAME}, it will be interpreted
9018 that way. The use of the @code{TOOL_NAME} argument is relevant only to users
9019 of SPARK and GNATprove, see last part of this section for details.
9020
9021 Normally warnings are enabled, with the output being controlled by
9022 the command line switch. Warnings (@code{Off}) turns off generation of
9023 warnings until a Warnings (@code{On}) is encountered or the end of the
9024 current unit. If generation of warnings is turned off using this
9025 pragma, then some or all of the warning messages are suppressed,
9026 regardless of the setting of the command line switches.
9027
9028 The @code{Reason} parameter may optionally appear as the last argument
9029 in any of the forms of this pragma. It is intended purely for the
9030 purposes of documenting the reason for the @code{Warnings} pragma.
9031 The compiler will check that the argument is a static string but
9032 otherwise ignore this argument. Other tools may provide specialized
9033 processing for this string.
9034
9035 The form with a single argument (or two arguments if Reason present),
9036 where the first argument is @code{ON} or @code{OFF}
9037 may be used as a configuration pragma.
9038
9039 If the @code{LOCAL_NAME} parameter is present, warnings are suppressed for
9040 the specified entity. This suppression is effective from the point where
9041 it occurs till the end of the extended scope of the variable (similar to
9042 the scope of @code{Suppress}). This form cannot be used as a configuration
9043 pragma.
9044
9045 In the case where the first argument is other than @code{ON} or
9046 @code{OFF},
9047 the third form with a single static_string_EXPRESSION argument (and possible
9048 reason) provides more precise
9049 control over which warnings are active. The string is a list of letters
9050 specifying which warnings are to be activated and which deactivated. The
9051 code for these letters is the same as the string used in the command
9052 line switch controlling warnings. For a brief summary, use the gnatmake
9053 command with no arguments, which will generate usage information containing
9054 the list of warnings switches supported. For
9055 full details see the section on @code{Warning Message Control} in the
9056 @cite{GNAT User's Guide}.
9057 This form can also be used as a configuration pragma.
9058
9059 The warnings controlled by the @code{-gnatw} switch are generated by the
9060 front end of the compiler. The GCC back end can provide additional warnings
9061 and they are controlled by the @code{-W} switch. Such warnings can be
9062 identified by the appearance of a string of the form @code{[-W@{xxx@}]} in the
9063 message which designates the @code{-W@emph{xxx}} switch that controls the message.
9064 The form with a single @emph{static_string_EXPRESSION} argument also works for these
9065 warnings, but the string must be a single full @code{-W@emph{xxx}} switch in this
9066 case. The above reference lists a few examples of these additional warnings.
9067
9068 The specified warnings will be in effect until the end of the program
9069 or another pragma @code{Warnings} is encountered. The effect of the pragma is
9070 cumulative. Initially the set of warnings is the standard default set
9071 as possibly modified by compiler switches. Then each pragma Warning
9072 modifies this set of warnings as specified. This form of the pragma may
9073 also be used as a configuration pragma.
9074
9075 The fourth form, with an @code{On|Off} parameter and a string, is used to
9076 control individual messages, based on their text. The string argument
9077 is a pattern that is used to match against the text of individual
9078 warning messages (not including the initial "warning: " tag).
9079
9080 The pattern may contain asterisks, which match zero or more characters in
9081 the message. For example, you can use
9082 @code{pragma Warnings (Off, "bits of*unused")} to suppress the warning
9083 message @code{warning: 960 bits of "a" unused}. No other regular
9084 expression notations are permitted. All characters other than asterisk in
9085 these three specific cases are treated as literal characters in the match.
9086 The match is case insensitive, for example XYZ matches xyz.
9087
9088 Note that the pattern matches if it occurs anywhere within the warning
9089 message string (it is not necessary to put an asterisk at the start and
9090 the end of the message, since this is implied).
9091
9092 The above use of patterns to match the message applies only to warning
9093 messages generated by the front end. This form of the pragma with a string
9094 argument can also be used to control warnings provided by the back end and
9095 mentioned above. By using a single full @code{-W@emph{xxx}} switch in the pragma,
9096 such warnings can be turned on and off.
9097
9098 There are two ways to use the pragma in this form. The OFF form can be used
9099 as a configuration pragma. The effect is to suppress all warnings (if any)
9100 that match the pattern string throughout the compilation (or match the
9101 -W switch in the back end case).
9102
9103 The second usage is to suppress a warning locally, and in this case, two
9104 pragmas must appear in sequence:
9105
9106 @example
9107 pragma Warnings (Off, Pattern);
9108 ... code where given warning is to be suppressed
9109 pragma Warnings (On, Pattern);
9110 @end example
9111
9112 In this usage, the pattern string must match in the Off and On
9113 pragmas, and (if @emph{-gnatw.w} is given) at least one matching
9114 warning must be suppressed.
9115
9116 Note: if the ON form is not found, then the effect of the OFF form extends
9117 until the end of the file (pragma Warnings is purely textual, so its effect
9118 does not stop at the end of the enclosing scope).
9119
9120 Note: to write a string that will match any warning, use the string
9121 @code{"***"}. It will not work to use a single asterisk or two
9122 asterisks since this looks like an operator name. This form with three
9123 asterisks is similar in effect to specifying @code{pragma Warnings (Off)} except (if @code{-gnatw.w} is given) that a matching
9124 @code{pragma Warnings (On, "***")} will be required. This can be
9125 helpful in avoiding forgetting to turn warnings back on.
9126
9127 Note: the debug flag @code{-gnatd.i} (@code{/NOWARNINGS_PRAGMAS} in VMS) can be
9128 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
9129 be useful in checking whether obsolete pragmas in existing programs are hiding
9130 real problems.
9131
9132 Note: pragma Warnings does not affect the processing of style messages. See
9133 separate entry for pragma Style_Checks for control of style messages.
9134
9135 Users of the formal verification tool GNATprove for the SPARK subset of Ada may
9136 use the version of the pragma with a @code{TOOL_NAME} parameter.
9137
9138 If present, @code{TOOL_NAME} is the name of a tool, currently either @code{GNAT} for the
9139 compiler or @code{GNATprove} for the formal verification tool. A given tool only
9140 takes into account pragma Warnings that do not specify a tool name, or that
9141 specify the matching tool name. This makes it possible to disable warnings
9142 selectively for each tool, and as a consequence to detect useless pragma
9143 Warnings with switch @code{-gnatw.w}.
9144
9145 @node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
9146 @anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{120}
9147 @section Pragma Weak_External
9148
9149
9150 Syntax:
9151
9152 @example
9153 pragma Weak_External ([Entity =>] LOCAL_NAME);
9154 @end example
9155
9156 @code{LOCAL_NAME} must refer to an object that is declared at the library
9157 level. This pragma specifies that the given entity should be marked as a
9158 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
9159 in GNU C and causes @code{LOCAL_NAME} to be emitted as a weak symbol instead
9160 of a regular symbol, that is to say a symbol that does not have to be
9161 resolved by the linker if used in conjunction with a pragma Import.
9162
9163 When a weak symbol is not resolved by the linker, its address is set to
9164 zero. This is useful in writing interfaces to external modules that may
9165 or may not be linked in the final executable, for example depending on
9166 configuration settings.
9167
9168 If a program references at run time an entity to which this pragma has been
9169 applied, and the corresponding symbol was not resolved at link time, then
9170 the execution of the program is erroneous. It is not erroneous to take the
9171 Address of such an entity, for example to guard potential references,
9172 as shown in the example below.
9173
9174 Some file formats do not support weak symbols so not all target machines
9175 support this pragma.
9176
9177 @example
9178 -- Example of the use of pragma Weak_External
9179
9180 package External_Module is
9181 key : Integer;
9182 pragma Import (C, key);
9183 pragma Weak_External (key);
9184 function Present return boolean;
9185 end External_Module;
9186
9187 with System; use System;
9188 package body External_Module is
9189 function Present return boolean is
9190 begin
9191 return key'Address /= System.Null_Address;
9192 end Present;
9193 end External_Module;
9194 @end example
9195
9196 @node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
9197 @anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{121}
9198 @section Pragma Wide_Character_Encoding
9199
9200
9201 Syntax:
9202
9203 @example
9204 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
9205 @end example
9206
9207 This pragma specifies the wide character encoding to be used in program
9208 source text appearing subsequently. It is a configuration pragma, but may
9209 also be used at any point that a pragma is allowed, and it is permissible
9210 to have more than one such pragma in a file, allowing multiple encodings
9211 to appear within the same file.
9212
9213 However, note that the pragma cannot immediately precede the relevant
9214 wide character, because then the previous encoding will still be in
9215 effect, causing "illegal character" errors.
9216
9217 The argument can be an identifier or a character literal. In the identifier
9218 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
9219 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
9220 case it is correspondingly one of the characters @code{h}, @code{u},
9221 @code{s}, @code{e}, @code{8}, or @code{b}.
9222
9223 Note that when the pragma is used within a file, it affects only the
9224 encoding within that file, and does not affect withed units, specs,
9225 or subunits.
9226
9227 @node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
9228 @anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{122}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{123}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{124}
9229 @chapter Implementation Defined Aspects
9230
9231
9232 Ada defines (throughout the Ada 2012 reference manual, summarized
9233 in Annex K) a set of aspects that can be specified for certain entities.
9234 These language defined aspects are implemented in GNAT in Ada 2012 mode
9235 and work as described in the Ada 2012 Reference Manual.
9236
9237 In addition, Ada 2012 allows implementations to define additional aspects
9238 whose meaning is defined by the implementation. GNAT provides
9239 a number of these implementation-defined aspects which can be used
9240 to extend and enhance the functionality of the compiler. This section of
9241 the GNAT reference manual describes these additional aspects.
9242
9243 Note that any program using these aspects may not be portable to
9244 other compilers (although GNAT implements this set of aspects on all
9245 platforms). Therefore if portability to other compilers is an important
9246 consideration, you should minimize the use of these aspects.
9247
9248 Note that for many of these aspects, the effect is essentially similar
9249 to the use of a pragma or attribute specification with the same name
9250 applied to the entity. For example, if we write:
9251
9252 @example
9253 type R is range 1 .. 100
9254 with Value_Size => 10;
9255 @end example
9256
9257 then the effect is the same as:
9258
9259 @example
9260 type R is range 1 .. 100;
9261 for R'Value_Size use 10;
9262 @end example
9263
9264 and if we write:
9265
9266 @example
9267 type R is new Integer
9268 with Shared => True;
9269 @end example
9270
9271 then the effect is the same as:
9272
9273 @example
9274 type R is new Integer;
9275 pragma Shared (R);
9276 @end example
9277
9278 In the documentation below, such cases are simply marked
9279 as being boolean aspects equivalent to the corresponding pragma
9280 or attribute definition clause.
9281
9282 @menu
9283 * Aspect Abstract_State::
9284 * Aspect Annotate::
9285 * Aspect Async_Readers::
9286 * Aspect Async_Writers::
9287 * Aspect Constant_After_Elaboration::
9288 * Aspect Contract_Cases::
9289 * Aspect Depends::
9290 * Aspect Default_Initial_Condition::
9291 * Aspect Dimension::
9292 * Aspect Dimension_System::
9293 * Aspect Disable_Controlled::
9294 * Aspect Effective_Reads::
9295 * Aspect Effective_Writes::
9296 * Aspect Extensions_Visible::
9297 * Aspect Favor_Top_Level::
9298 * Aspect Ghost::
9299 * Aspect Global::
9300 * Aspect Initial_Condition::
9301 * Aspect Initializes::
9302 * Aspect Inline_Always::
9303 * Aspect Invariant::
9304 * Aspect Invariant'Class::
9305 * Aspect Iterable::
9306 * Aspect Linker_Section::
9307 * Aspect Lock_Free::
9308 * Aspect Max_Queue_Length::
9309 * Aspect No_Elaboration_Code_All::
9310 * Aspect No_Inline::
9311 * Aspect No_Tagged_Streams::
9312 * Aspect Object_Size::
9313 * Aspect Obsolescent::
9314 * Aspect Part_Of::
9315 * Aspect Persistent_BSS::
9316 * Aspect Predicate::
9317 * Aspect Pure_Function::
9318 * Aspect Refined_Depends::
9319 * Aspect Refined_Global::
9320 * Aspect Refined_Post::
9321 * Aspect Refined_State::
9322 * Aspect Remote_Access_Type::
9323 * Aspect Secondary_Stack_Size::
9324 * Aspect Scalar_Storage_Order::
9325 * Aspect Shared::
9326 * Aspect Simple_Storage_Pool::
9327 * Aspect Simple_Storage_Pool_Type::
9328 * Aspect SPARK_Mode::
9329 * Aspect Suppress_Debug_Info::
9330 * Aspect Suppress_Initialization::
9331 * Aspect Test_Case::
9332 * Aspect Thread_Local_Storage::
9333 * Aspect Universal_Aliasing::
9334 * Aspect Universal_Data::
9335 * Aspect Unmodified::
9336 * Aspect Unreferenced::
9337 * Aspect Unreferenced_Objects::
9338 * Aspect Value_Size::
9339 * Aspect Volatile_Full_Access::
9340 * Aspect Volatile_Function::
9341 * Aspect Warnings::
9342
9343 @end menu
9344
9345 @node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
9346 @anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{125}
9347 @section Aspect Abstract_State
9348
9349
9350 @geindex Abstract_State
9351
9352 This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
9353
9354 @node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
9355 @anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{126}
9356 @section Aspect Annotate
9357
9358
9359 @geindex Annotate
9360
9361 There are three forms of this aspect (where ID is an identifier,
9362 and ARG is a general expression),
9363 corresponding to @ref{29,,pragma Annotate}.
9364
9365
9366 @table @asis
9367
9368 @item @emph{Annotate => ID}
9369
9370 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9371
9372 @item @emph{Annotate => (ID)}
9373
9374 Equivalent to @code{pragma Annotate (ID, Entity => Name);}
9375
9376 @item @emph{Annotate => (ID ,ID @{, ARG@})}
9377
9378 Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
9379 @end table
9380
9381 @node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
9382 @anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{127}
9383 @section Aspect Async_Readers
9384
9385
9386 @geindex Async_Readers
9387
9388 This boolean aspect is equivalent to @ref{30,,pragma Async_Readers}.
9389
9390 @node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
9391 @anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{128}
9392 @section Aspect Async_Writers
9393
9394
9395 @geindex Async_Writers
9396
9397 This boolean aspect is equivalent to @ref{33,,pragma Async_Writers}.
9398
9399 @node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
9400 @anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{129}
9401 @section Aspect Constant_After_Elaboration
9402
9403
9404 @geindex Constant_After_Elaboration
9405
9406 This aspect is equivalent to @ref{44,,pragma Constant_After_Elaboration}.
9407
9408 @node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
9409 @anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{12a}
9410 @section Aspect Contract_Cases
9411
9412
9413 @geindex Contract_Cases
9414
9415 This aspect is equivalent to @ref{46,,pragma Contract_Cases}, the sequence
9416 of clauses being enclosed in parentheses so that syntactically it is an
9417 aggregate.
9418
9419 @node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
9420 @anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12b}
9421 @section Aspect Depends
9422
9423
9424 @geindex Depends
9425
9426 This aspect is equivalent to @ref{55,,pragma Depends}.
9427
9428 @node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
9429 @anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12c}
9430 @section Aspect Default_Initial_Condition
9431
9432
9433 @geindex Default_Initial_Condition
9434
9435 This aspect is equivalent to @ref{50,,pragma Default_Initial_Condition}.
9436
9437 @node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
9438 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{12d}
9439 @section Aspect Dimension
9440
9441
9442 @geindex Dimension
9443
9444 The @code{Dimension} aspect is used to specify the dimensions of a given
9445 subtype of a dimensioned numeric type. The aspect also specifies a symbol
9446 used when doing formatted output of dimensioned quantities. The syntax is:
9447
9448 @example
9449 with Dimension =>
9450 ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
9451
9452 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
9453
9454 DIMENSION_VALUE ::=
9455 RATIONAL
9456 | others => RATIONAL
9457 | DISCRETE_CHOICE_LIST => RATIONAL
9458
9459 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
9460 @end example
9461
9462 This aspect can only be applied to a subtype whose parent type has
9463 a @code{Dimension_System} aspect. The aspect must specify values for
9464 all dimensions of the system. The rational values are the powers of the
9465 corresponding dimensions that are used by the compiler to verify that
9466 physical (numeric) computations are dimensionally consistent. For example,
9467 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
9468 For further examples of the usage
9469 of this aspect, see package @code{System.Dim.Mks}.
9470 Note that when the dimensioned type is an integer type, then any
9471 dimension value must be an integer literal.
9472
9473 @node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
9474 @anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12e}
9475 @section Aspect Dimension_System
9476
9477
9478 @geindex Dimension_System
9479
9480 The @code{Dimension_System} aspect is used to define a system of
9481 dimensions that will be used in subsequent subtype declarations with
9482 @code{Dimension} aspects that reference this system. The syntax is:
9483
9484 @example
9485 with Dimension_System => (DIMENSION @{, DIMENSION@});
9486
9487 DIMENSION ::= ([Unit_Name =>] IDENTIFIER,
9488 [Unit_Symbol =>] SYMBOL,
9489 [Dim_Symbol =>] SYMBOL)
9490
9491 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
9492 @end example
9493
9494 This aspect is applied to a type, which must be a numeric derived type
9495 (typically a floating-point type), that
9496 will represent values within the dimension system. Each @code{DIMENSION}
9497 corresponds to one particular dimension. A maximum of 7 dimensions may
9498 be specified. @code{Unit_Name} is the name of the dimension (for example
9499 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
9500 of this dimension (for example @code{m} for @code{Meter}).
9501 @code{Dim_Symbol} gives
9502 the identification within the dimension system (typically this is a
9503 single letter, e.g. @code{L} standing for length for unit name @code{Meter}).
9504 The @code{Unit_Symbol} is used in formatted output of dimensioned quantities.
9505 The @code{Dim_Symbol} is used in error messages when numeric operations have
9506 inconsistent dimensions.
9507
9508 GNAT provides the standard definition of the International MKS system in
9509 the run-time package @code{System.Dim.Mks}. You can easily define
9510 similar packages for cgs units or British units, and define conversion factors
9511 between values in different systems. The MKS system is characterized by the
9512 following aspect:
9513
9514 @example
9515 type Mks_Type is new Long_Long_Float with
9516 Dimension_System => (
9517 (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
9518 (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
9519 (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
9520 (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
9521 (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@@'),
9522 (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
9523 (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
9524 @end example
9525
9526 Note that in the above type definition, we use the @code{at} symbol (@code{@@}) to
9527 represent a theta character (avoiding the use of extended Latin-1
9528 characters in this context).
9529
9530 See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
9531 Guide for detailed examples of use of the dimension system.
9532
9533 @node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
9534 @anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12f}
9535 @section Aspect Disable_Controlled
9536
9537
9538 @geindex Disable_Controlled
9539
9540 The aspect @code{Disable_Controlled} is defined for controlled record types. If
9541 active, this aspect causes suppression of all related calls to @code{Initialize},
9542 @code{Adjust}, and @code{Finalize}. The intended use is for conditional compilation,
9543 where for example you might want a record to be controlled or not depending on
9544 whether some run-time check is enabled or suppressed.
9545
9546 @node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
9547 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{130}
9548 @section Aspect Effective_Reads
9549
9550
9551 @geindex Effective_Reads
9552
9553 This aspect is equivalent to @ref{5b,,pragma Effective_Reads}.
9554
9555 @node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
9556 @anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{131}
9557 @section Aspect Effective_Writes
9558
9559
9560 @geindex Effective_Writes
9561
9562 This aspect is equivalent to @ref{5d,,pragma Effective_Writes}.
9563
9564 @node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
9565 @anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{132}
9566 @section Aspect Extensions_Visible
9567
9568
9569 @geindex Extensions_Visible
9570
9571 This aspect is equivalent to @ref{69,,pragma Extensions_Visible}.
9572
9573 @node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
9574 @anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{133}
9575 @section Aspect Favor_Top_Level
9576
9577
9578 @geindex Favor_Top_Level
9579
9580 This boolean aspect is equivalent to @ref{6e,,pragma Favor_Top_Level}.
9581
9582 @node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
9583 @anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{134}
9584 @section Aspect Ghost
9585
9586
9587 @geindex Ghost
9588
9589 This aspect is equivalent to @ref{71,,pragma Ghost}.
9590
9591 @node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
9592 @anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{135}
9593 @section Aspect Global
9594
9595
9596 @geindex Global
9597
9598 This aspect is equivalent to @ref{73,,pragma Global}.
9599
9600 @node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
9601 @anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{136}
9602 @section Aspect Initial_Condition
9603
9604
9605 @geindex Initial_Condition
9606
9607 This aspect is equivalent to @ref{81,,pragma Initial_Condition}.
9608
9609 @node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
9610 @anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{137}
9611 @section Aspect Initializes
9612
9613
9614 @geindex Initializes
9615
9616 This aspect is equivalent to @ref{83,,pragma Initializes}.
9617
9618 @node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
9619 @anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{138}
9620 @section Aspect Inline_Always
9621
9622
9623 @geindex Inline_Always
9624
9625 This boolean aspect is equivalent to @ref{86,,pragma Inline_Always}.
9626
9627 @node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
9628 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{139}
9629 @section Aspect Invariant
9630
9631
9632 @geindex Invariant
9633
9634 This aspect is equivalent to @ref{8d,,pragma Invariant}. It is a
9635 synonym for the language defined aspect @code{Type_Invariant} except
9636 that it is separately controllable using pragma @code{Assertion_Policy}.
9637
9638 @node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
9639 @anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13a}
9640 @section Aspect Invariant'Class
9641
9642
9643 @geindex Invariant'Class
9644
9645 This aspect is equivalent to @ref{104,,pragma Type_Invariant_Class}. It is a
9646 synonym for the language defined aspect @code{Type_Invariant'Class} except
9647 that it is separately controllable using pragma @code{Assertion_Policy}.
9648
9649 @node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
9650 @anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13b}
9651 @section Aspect Iterable
9652
9653
9654 @geindex Iterable
9655
9656 This aspect provides a light-weight mechanism for loops and quantified
9657 expressions over container types, without the overhead imposed by the tampering
9658 checks of standard Ada 2012 iterators. The value of the aspect is an aggregate
9659 with six named components, of which the last three are optional: @code{First},
9660 @code{Next}, @code{Has_Element}, @code{Element}, @code{Last}, and @code{Previous}.
9661 When only the first three components are specified, only the
9662 @code{for .. in} form of iteration over cursors is available. When @code{Element}
9663 is specified, both this form and the @code{for .. of} form of iteration over
9664 elements are available. If the last two components are specified, reverse
9665 iterations over the container can be specified (analogous to what can be done
9666 over predefined containers that support the @code{Reverse_Iterator} interface).
9667 The following is a typical example of use:
9668
9669 @example
9670 type List is private with
9671 Iterable => (First => First_Cursor,
9672 Next => Advance,
9673 Has_Element => Cursor_Has_Element,
9674 [Element => Get_Element]);
9675 @end example
9676
9677
9678 @itemize *
9679
9680 @item
9681 The value denoted by @code{First} must denote a primitive operation of the
9682 container type that returns a @code{Cursor}, which must a be a type declared in
9683 the container package or visible from it. For example:
9684 @end itemize
9685
9686 @example
9687 function First_Cursor (Cont : Container) return Cursor;
9688 @end example
9689
9690
9691 @itemize *
9692
9693 @item
9694 The value of @code{Next} is a primitive operation of the container type that takes
9695 both a container and a cursor and yields a cursor. For example:
9696 @end itemize
9697
9698 @example
9699 function Advance (Cont : Container; Position : Cursor) return Cursor;
9700 @end example
9701
9702
9703 @itemize *
9704
9705 @item
9706 The value of @code{Has_Element} is a primitive operation of the container type
9707 that takes both a container and a cursor and yields a boolean. For example:
9708 @end itemize
9709
9710 @example
9711 function Cursor_Has_Element (Cont : Container; Position : Cursor) return Boolean;
9712 @end example
9713
9714
9715 @itemize *
9716
9717 @item
9718 The value of @code{Element} is a primitive operation of the container type that
9719 takes both a container and a cursor and yields an @code{Element_Type}, which must
9720 be a type declared in the container package or visible from it. For example:
9721 @end itemize
9722
9723 @example
9724 function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
9725 @end example
9726
9727 This aspect is used in the GNAT-defined formal container packages.
9728
9729 @node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
9730 @anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13c}
9731 @section Aspect Linker_Section
9732
9733
9734 @geindex Linker_Section
9735
9736 This aspect is equivalent to @ref{95,,pragma Linker_Section}.
9737
9738 @node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
9739 @anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13d}
9740 @section Aspect Lock_Free
9741
9742
9743 @geindex Lock_Free
9744
9745 This boolean aspect is equivalent to @ref{97,,pragma Lock_Free}.
9746
9747 @node Aspect Max_Queue_Length,Aspect No_Elaboration_Code_All,Aspect Lock_Free,Implementation Defined Aspects
9748 @anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13e}
9749 @section Aspect Max_Queue_Length
9750
9751
9752 @geindex Max_Queue_Length
9753
9754 This aspect is equivalent to @ref{9f,,pragma Max_Queue_Length}.
9755
9756 @node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect Max_Queue_Length,Implementation Defined Aspects
9757 @anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{13f}
9758 @section Aspect No_Elaboration_Code_All
9759
9760
9761 @geindex No_Elaboration_Code_All
9762
9763 This aspect is equivalent to @ref{a3,,pragma No_Elaboration_Code_All}
9764 for a program unit.
9765
9766 @node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
9767 @anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{140}
9768 @section Aspect No_Inline
9769
9770
9771 @geindex No_Inline
9772
9773 This boolean aspect is equivalent to @ref{a6,,pragma No_Inline}.
9774
9775 @node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Inline,Implementation Defined Aspects
9776 @anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{141}
9777 @section Aspect No_Tagged_Streams
9778
9779
9780 @geindex No_Tagged_Streams
9781
9782 This aspect is equivalent to @ref{aa,,pragma No_Tagged_Streams} with an
9783 argument specifying a root tagged type (thus this aspect can only be
9784 applied to such a type).
9785
9786 @node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
9787 @anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{142}
9788 @section Aspect Object_Size
9789
9790
9791 @geindex Object_Size
9792
9793 This aspect is equivalent to @ref{143,,attribute Object_Size}.
9794
9795 @node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
9796 @anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{144}
9797 @section Aspect Obsolescent
9798
9799
9800 @geindex Obsolsecent
9801
9802 This aspect is equivalent to @ref{ad,,pragma Obsolescent}. Note that the
9803 evaluation of this aspect happens at the point of occurrence, it is not
9804 delayed until the freeze point.
9805
9806 @node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
9807 @anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{145}
9808 @section Aspect Part_Of
9809
9810
9811 @geindex Part_Of
9812
9813 This aspect is equivalent to @ref{b5,,pragma Part_Of}.
9814
9815 @node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
9816 @anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{146}
9817 @section Aspect Persistent_BSS
9818
9819
9820 @geindex Persistent_BSS
9821
9822 This boolean aspect is equivalent to @ref{b8,,pragma Persistent_BSS}.
9823
9824 @node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
9825 @anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{147}
9826 @section Aspect Predicate
9827
9828
9829 @geindex Predicate
9830
9831 This aspect is equivalent to @ref{c1,,pragma Predicate}. It is thus
9832 similar to the language defined aspects @code{Dynamic_Predicate}
9833 and @code{Static_Predicate} except that whether the resulting
9834 predicate is static or dynamic is controlled by the form of the
9835 expression. It is also separately controllable using pragma
9836 @code{Assertion_Policy}.
9837
9838 @node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
9839 @anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{148}
9840 @section Aspect Pure_Function
9841
9842
9843 @geindex Pure_Function
9844
9845 This boolean aspect is equivalent to @ref{cc,,pragma Pure_Function}.
9846
9847 @node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
9848 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{149}
9849 @section Aspect Refined_Depends
9850
9851
9852 @geindex Refined_Depends
9853
9854 This aspect is equivalent to @ref{d0,,pragma Refined_Depends}.
9855
9856 @node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
9857 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14a}
9858 @section Aspect Refined_Global
9859
9860
9861 @geindex Refined_Global
9862
9863 This aspect is equivalent to @ref{d2,,pragma Refined_Global}.
9864
9865 @node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
9866 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14b}
9867 @section Aspect Refined_Post
9868
9869
9870 @geindex Refined_Post
9871
9872 This aspect is equivalent to @ref{d4,,pragma Refined_Post}.
9873
9874 @node Aspect Refined_State,Aspect Remote_Access_Type,Aspect Refined_Post,Implementation Defined Aspects
9875 @anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14c}
9876 @section Aspect Refined_State
9877
9878
9879 @geindex Refined_State
9880
9881 This aspect is equivalent to @ref{d6,,pragma Refined_State}.
9882
9883 @node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Refined_State,Implementation Defined Aspects
9884 @anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{14d}
9885 @section Aspect Remote_Access_Type
9886
9887
9888 @geindex Remote_Access_Type
9889
9890 This aspect is equivalent to @ref{da,,pragma Remote_Access_Type}.
9891
9892 @node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
9893 @anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{14e}
9894 @section Aspect Secondary_Stack_Size
9895
9896
9897 @geindex Secondary_Stack_Size
9898
9899 This aspect is equivalent to @ref{df,,pragma Secondary_Stack_Size}.
9900
9901 @node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
9902 @anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{14f}
9903 @section Aspect Scalar_Storage_Order
9904
9905
9906 @geindex Scalar_Storage_Order
9907
9908 This aspect is equivalent to a @ref{150,,attribute Scalar_Storage_Order}.
9909
9910 @node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
9911 @anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{151}
9912 @section Aspect Shared
9913
9914
9915 @geindex Shared
9916
9917 This boolean aspect is equivalent to @ref{e2,,pragma Shared}
9918 and is thus a synonym for aspect @code{Atomic}.
9919
9920 @node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
9921 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{152}
9922 @section Aspect Simple_Storage_Pool
9923
9924
9925 @geindex Simple_Storage_Pool
9926
9927 This aspect is equivalent to @ref{e7,,attribute Simple_Storage_Pool}.
9928
9929 @node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
9930 @anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{153}
9931 @section Aspect Simple_Storage_Pool_Type
9932
9933
9934 @geindex Simple_Storage_Pool_Type
9935
9936 This boolean aspect is equivalent to @ref{e5,,pragma Simple_Storage_Pool_Type}.
9937
9938 @node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
9939 @anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{154}
9940 @section Aspect SPARK_Mode
9941
9942
9943 @geindex SPARK_Mode
9944
9945 This aspect is equivalent to @ref{ed,,pragma SPARK_Mode} and
9946 may be specified for either or both of the specification and body
9947 of a subprogram or package.
9948
9949 @node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
9950 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{155}
9951 @section Aspect Suppress_Debug_Info
9952
9953
9954 @geindex Suppress_Debug_Info
9955
9956 This boolean aspect is equivalent to @ref{f5,,pragma Suppress_Debug_Info}.
9957
9958 @node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
9959 @anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{156}
9960 @section Aspect Suppress_Initialization
9961
9962
9963 @geindex Suppress_Initialization
9964
9965 This boolean aspect is equivalent to @ref{f9,,pragma Suppress_Initialization}.
9966
9967 @node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
9968 @anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{157}
9969 @section Aspect Test_Case
9970
9971
9972 @geindex Test_Case
9973
9974 This aspect is equivalent to @ref{fc,,pragma Test_Case}.
9975
9976 @node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
9977 @anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{158}
9978 @section Aspect Thread_Local_Storage
9979
9980
9981 @geindex Thread_Local_Storage
9982
9983 This boolean aspect is equivalent to @ref{fe,,pragma Thread_Local_Storage}.
9984
9985 @node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
9986 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{159}
9987 @section Aspect Universal_Aliasing
9988
9989
9990 @geindex Universal_Aliasing
9991
9992 This boolean aspect is equivalent to @ref{109,,pragma Universal_Aliasing}.
9993
9994 @node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
9995 @anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{15a}
9996 @section Aspect Universal_Data
9997
9998
9999 @geindex Universal_Data
10000
10001 This aspect is equivalent to @ref{10a,,pragma Universal_Data}.
10002
10003 @node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
10004 @anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15b}
10005 @section Aspect Unmodified
10006
10007
10008 @geindex Unmodified
10009
10010 This boolean aspect is equivalent to @ref{10c,,pragma Unmodified}.
10011
10012 @node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
10013 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15c}
10014 @section Aspect Unreferenced
10015
10016
10017 @geindex Unreferenced
10018
10019 This boolean aspect is equivalent to @ref{10e,,pragma Unreferenced}. Note that
10020 in the case of formal parameters, it is not permitted to have aspects for
10021 a formal parameter, so in this case the pragma form must be used.
10022
10023 @node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
10024 @anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15d}
10025 @section Aspect Unreferenced_Objects
10026
10027
10028 @geindex Unreferenced_Objects
10029
10030 This boolean aspect is equivalent to @ref{110,,pragma Unreferenced_Objects}.
10031
10032 @node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
10033 @anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{15e}
10034 @section Aspect Value_Size
10035
10036
10037 @geindex Value_Size
10038
10039 This aspect is equivalent to @ref{15f,,attribute Value_Size}.
10040
10041 @node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
10042 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{160}
10043 @section Aspect Volatile_Full_Access
10044
10045
10046 @geindex Volatile_Full_Access
10047
10048 This boolean aspect is equivalent to @ref{119,,pragma Volatile_Full_Access}.
10049
10050 @node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
10051 @anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{161}
10052 @section Aspect Volatile_Function
10053
10054
10055 @geindex Volatile_Function
10056
10057 This boolean aspect is equivalent to @ref{11c,,pragma Volatile_Function}.
10058
10059 @node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
10060 @anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{162}
10061 @section Aspect Warnings
10062
10063
10064 @geindex Warnings
10065
10066 This aspect is equivalent to the two argument form of @ref{11e,,pragma Warnings},
10067 where the first argument is @code{ON} or @code{OFF} and the second argument
10068 is the entity.
10069
10070 @node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
10071 @anchor{gnat_rm/implementation_defined_attributes doc}@anchor{163}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{164}
10072 @chapter Implementation Defined Attributes
10073
10074
10075 Ada defines (throughout the Ada reference manual,
10076 summarized in Annex K),
10077 a set of attributes that provide useful additional functionality in all
10078 areas of the language. These language defined attributes are implemented
10079 in GNAT and work as described in the Ada Reference Manual.
10080
10081 In addition, Ada allows implementations to define additional
10082 attributes whose meaning is defined by the implementation. GNAT provides
10083 a number of these implementation-dependent attributes which can be used
10084 to extend and enhance the functionality of the compiler. This section of
10085 the GNAT reference manual describes these additional attributes. It also
10086 describes additional implementation-dependent features of standard
10087 language-defined attributes.
10088
10089 Note that any program using these attributes may not be portable to
10090 other compilers (although GNAT implements this set of attributes on all
10091 platforms). Therefore if portability to other compilers is an important
10092 consideration, you should minimize the use of these attributes.
10093
10094 @menu
10095 * Attribute Abort_Signal::
10096 * Attribute Address_Size::
10097 * Attribute Asm_Input::
10098 * Attribute Asm_Output::
10099 * Attribute Atomic_Always_Lock_Free::
10100 * Attribute Bit::
10101 * Attribute Bit_Position::
10102 * Attribute Code_Address::
10103 * Attribute Compiler_Version::
10104 * Attribute Constrained::
10105 * Attribute Default_Bit_Order::
10106 * Attribute Default_Scalar_Storage_Order::
10107 * Attribute Deref::
10108 * Attribute Descriptor_Size::
10109 * Attribute Elaborated::
10110 * Attribute Elab_Body::
10111 * Attribute Elab_Spec::
10112 * Attribute Elab_Subp_Body::
10113 * Attribute Emax::
10114 * Attribute Enabled::
10115 * Attribute Enum_Rep::
10116 * Attribute Enum_Val::
10117 * Attribute Epsilon::
10118 * Attribute Fast_Math::
10119 * Attribute Finalization_Size::
10120 * Attribute Fixed_Value::
10121 * Attribute From_Any::
10122 * Attribute Has_Access_Values::
10123 * Attribute Has_Discriminants::
10124 * Attribute Img::
10125 * Attribute Integer_Value::
10126 * Attribute Invalid_Value::
10127 * Attribute Iterable::
10128 * Attribute Large::
10129 * Attribute Library_Level::
10130 * Attribute Lock_Free::
10131 * Attribute Loop_Entry::
10132 * Attribute Machine_Size::
10133 * Attribute Mantissa::
10134 * Attribute Maximum_Alignment::
10135 * Attribute Mechanism_Code::
10136 * Attribute Null_Parameter::
10137 * Attribute Object_Size::
10138 * Attribute Old::
10139 * Attribute Passed_By_Reference::
10140 * Attribute Pool_Address::
10141 * Attribute Range_Length::
10142 * Attribute Restriction_Set::
10143 * Attribute Result::
10144 * Attribute Safe_Emax::
10145 * Attribute Safe_Large::
10146 * Attribute Safe_Small::
10147 * Attribute Scalar_Storage_Order::
10148 * Attribute Simple_Storage_Pool::
10149 * Attribute Small::
10150 * Attribute Storage_Unit::
10151 * Attribute Stub_Type::
10152 * Attribute System_Allocator_Alignment::
10153 * Attribute Target_Name::
10154 * Attribute To_Address::
10155 * Attribute To_Any::
10156 * Attribute Type_Class::
10157 * Attribute Type_Key::
10158 * Attribute TypeCode::
10159 * Attribute Unconstrained_Array::
10160 * Attribute Universal_Literal_String::
10161 * Attribute Unrestricted_Access::
10162 * Attribute Update::
10163 * Attribute Valid_Scalars::
10164 * Attribute VADS_Size::
10165 * Attribute Value_Size::
10166 * Attribute Wchar_T_Size::
10167 * Attribute Word_Size::
10168
10169 @end menu
10170
10171 @node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
10172 @anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{165}
10173 @section Attribute Abort_Signal
10174
10175
10176 @geindex Abort_Signal
10177
10178 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
10179 prefix) provides the entity for the special exception used to signal
10180 task abort or asynchronous transfer of control. Normally this attribute
10181 should only be used in the tasking runtime (it is highly peculiar, and
10182 completely outside the normal semantics of Ada, for a user program to
10183 intercept the abort exception).
10184
10185 @node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
10186 @anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{166}
10187 @section Attribute Address_Size
10188
10189
10190 @geindex Size of `@w{`}Address`@w{`}
10191
10192 @geindex Address_Size
10193
10194 @code{Standard'Address_Size} (@code{Standard} is the only allowed
10195 prefix) is a static constant giving the number of bits in an
10196 @code{Address}. It is the same value as System.Address'Size,
10197 but has the advantage of being static, while a direct
10198 reference to System.Address'Size is nonstatic because Address
10199 is a private type.
10200
10201 @node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
10202 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{167}
10203 @section Attribute Asm_Input
10204
10205
10206 @geindex Asm_Input
10207
10208 The @code{Asm_Input} attribute denotes a function that takes two
10209 parameters. The first is a string, the second is an expression of the
10210 type designated by the prefix. The first (string) argument is required
10211 to be a static expression, and is the constraint for the parameter,
10212 (e.g., what kind of register is required). The second argument is the
10213 value to be used as the input argument. The possible values for the
10214 constant are the same as those used in the RTL, and are dependent on
10215 the configuration file used to built the GCC back end.
10216 @ref{168,,Machine Code Insertions}
10217
10218 @node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
10219 @anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{169}
10220 @section Attribute Asm_Output
10221
10222
10223 @geindex Asm_Output
10224
10225 The @code{Asm_Output} attribute denotes a function that takes two
10226 parameters. The first is a string, the second is the name of a variable
10227 of the type designated by the attribute prefix. The first (string)
10228 argument is required to be a static expression and designates the
10229 constraint for the parameter (e.g., what kind of register is
10230 required). The second argument is the variable to be updated with the
10231 result. The possible values for constraint are the same as those used in
10232 the RTL, and are dependent on the configuration file used to build the
10233 GCC back end. If there are no output operands, then this argument may
10234 either be omitted, or explicitly given as @code{No_Output_Operands}.
10235 @ref{168,,Machine Code Insertions}
10236
10237 @node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
10238 @anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16a}
10239 @section Attribute Atomic_Always_Lock_Free
10240
10241
10242 @geindex Atomic_Always_Lock_Free
10243
10244 The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type.
10245 The result is a Boolean value which is True if the type has discriminants,
10246 and False otherwise. The result indicate whether atomic operations are
10247 supported by the target for the given type.
10248
10249 @node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
10250 @anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16b}
10251 @section Attribute Bit
10252
10253
10254 @geindex Bit
10255
10256 @code{obj'Bit}, where @code{obj} is any object, yields the bit
10257 offset within the storage unit (byte) that contains the first bit of
10258 storage allocated for the object. The value of this attribute is of the
10259 type @emph{universal_integer}, and is always a non-negative number not
10260 exceeding the value of @code{System.Storage_Unit}.
10261
10262 For an object that is a variable or a constant allocated in a register,
10263 the value is zero. (The use of this attribute does not force the
10264 allocation of a variable to memory).
10265
10266 For an object that is a formal parameter, this attribute applies
10267 to either the matching actual parameter or to a copy of the
10268 matching actual parameter.
10269
10270 For an access object the value is zero. Note that
10271 @code{obj.all'Bit} is subject to an @code{Access_Check} for the
10272 designated object. Similarly for a record component
10273 @code{X.C'Bit} is subject to a discriminant check and
10274 @code{X(I).Bit} and @code{X(I1..I2)'Bit}
10275 are subject to index checks.
10276
10277 This attribute is designed to be compatible with the DEC Ada 83 definition
10278 and implementation of the @code{Bit} attribute.
10279
10280 @node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
10281 @anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16c}
10282 @section Attribute Bit_Position
10283
10284
10285 @geindex Bit_Position
10286
10287 @code{R.C'Bit_Position}, where @code{R} is a record object and @code{C} is one
10288 of the fields of the record type, yields the bit
10289 offset within the record contains the first bit of
10290 storage allocated for the object. The value of this attribute is of the
10291 type @emph{universal_integer}. The value depends only on the field
10292 @code{C} and is independent of the alignment of
10293 the containing record @code{R}.
10294
10295 @node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
10296 @anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16d}
10297 @section Attribute Code_Address
10298
10299
10300 @geindex Code_Address
10301
10302 @geindex Subprogram address
10303
10304 @geindex Address of subprogram code
10305
10306 The @code{'Address}
10307 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
10308 intended effect seems to be to provide
10309 an address value which can be used to call the subprogram by means of
10310 an address clause as in the following example:
10311
10312 @example
10313 procedure K is ...
10314
10315 procedure L;
10316 for L'Address use K'Address;
10317 pragma Import (Ada, L);
10318 @end example
10319
10320 A call to @code{L} is then expected to result in a call to @code{K}.
10321 In Ada 83, where there were no access-to-subprogram values, this was
10322 a common work-around for getting the effect of an indirect call.
10323 GNAT implements the above use of @code{Address} and the technique
10324 illustrated by the example code works correctly.
10325
10326 However, for some purposes, it is useful to have the address of the start
10327 of the generated code for the subprogram. On some architectures, this is
10328 not necessarily the same as the @code{Address} value described above.
10329 For example, the @code{Address} value may reference a subprogram
10330 descriptor rather than the subprogram itself.
10331
10332 The @code{'Code_Address} attribute, which can only be applied to
10333 subprogram entities, always returns the address of the start of the
10334 generated code of the specified subprogram, which may or may not be
10335 the same value as is returned by the corresponding @code{'Address}
10336 attribute.
10337
10338 @node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
10339 @anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{16e}
10340 @section Attribute Compiler_Version
10341
10342
10343 @geindex Compiler_Version
10344
10345 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
10346 prefix) yields a static string identifying the version of the compiler
10347 being used to compile the unit containing the attribute reference.
10348
10349 @node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
10350 @anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{16f}
10351 @section Attribute Constrained
10352
10353
10354 @geindex Constrained
10355
10356 In addition to the usage of this attribute in the Ada RM, GNAT
10357 also permits the use of the @code{'Constrained} attribute
10358 in a generic template
10359 for any type, including types without discriminants. The value of this
10360 attribute in the generic instance when applied to a scalar type or a
10361 record type without discriminants is always @code{True}. This usage is
10362 compatible with older Ada compilers, including notably DEC Ada.
10363
10364 @node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
10365 @anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{170}
10366 @section Attribute Default_Bit_Order
10367
10368
10369 @geindex Big endian
10370
10371 @geindex Little endian
10372
10373 @geindex Default_Bit_Order
10374
10375 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
10376 permissible prefix), provides the value @code{System.Default_Bit_Order}
10377 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
10378 @code{Low_Order_First}). This is used to construct the definition of
10379 @code{Default_Bit_Order} in package @code{System}.
10380
10381 @node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
10382 @anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{171}
10383 @section Attribute Default_Scalar_Storage_Order
10384
10385
10386 @geindex Big endian
10387
10388 @geindex Little endian
10389
10390 @geindex Default_Scalar_Storage_Order
10391
10392 @code{Standard'Default_Scalar_Storage_Order} (@code{Standard} is the only
10393 permissible prefix), provides the current value of the default scalar storage
10394 order (as specified using pragma @code{Default_Scalar_Storage_Order}, or
10395 equal to @code{Default_Bit_Order} if unspecified) as a
10396 @code{System.Bit_Order} value. This is a static attribute.
10397
10398 @node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
10399 @anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{172}
10400 @section Attribute Deref
10401
10402
10403 @geindex Deref
10404
10405 The attribute @code{typ'Deref(expr)} where @code{expr} is of type @code{System.Address} yields
10406 the variable of type @code{typ} that is located at the given address. It is similar
10407 to @code{(totyp (expr).all)}, where @code{totyp} is an unchecked conversion from address to
10408 a named access-to-@cite{typ} type, except that it yields a variable, so it can be
10409 used on the left side of an assignment.
10410
10411 @node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
10412 @anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{173}
10413 @section Attribute Descriptor_Size
10414
10415
10416 @geindex Descriptor
10417
10418 @geindex Dope vector
10419
10420 @geindex Descriptor_Size
10421
10422 Nonstatic attribute @code{Descriptor_Size} returns the size in bits of the
10423 descriptor allocated for a type. The result is non-zero only for unconstrained
10424 array types and the returned value is of type universal integer. In GNAT, an
10425 array descriptor contains bounds information and is located immediately before
10426 the first element of the array.
10427
10428 @example
10429 type Unconstr_Array is array (Positive range <>) of Boolean;
10430 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
10431 @end example
10432
10433 The attribute takes into account any additional padding due to type alignment.
10434 In the example above, the descriptor contains two values of type
10435 @code{Positive} representing the low and high bound. Since @code{Positive} has
10436 a size of 31 bits and an alignment of 4, the descriptor size is @code{2 * Positive'Size + 2} or 64 bits.
10437
10438 @node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
10439 @anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{174}
10440 @section Attribute Elaborated
10441
10442
10443 @geindex Elaborated
10444
10445 The prefix of the @code{'Elaborated} attribute must be a unit name. The
10446 value is a Boolean which indicates whether or not the given unit has been
10447 elaborated. This attribute is primarily intended for internal use by the
10448 generated code for dynamic elaboration checking, but it can also be used
10449 in user programs. The value will always be True once elaboration of all
10450 units has been completed. An exception is for units which need no
10451 elaboration, the value is always False for such units.
10452
10453 @node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
10454 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{175}
10455 @section Attribute Elab_Body
10456
10457
10458 @geindex Elab_Body
10459
10460 This attribute can only be applied to a program unit name. It returns
10461 the entity for the corresponding elaboration procedure for elaborating
10462 the body of the referenced unit. This is used in the main generated
10463 elaboration procedure by the binder and is not normally used in any
10464 other context. However, there may be specialized situations in which it
10465 is useful to be able to call this elaboration procedure from Ada code,
10466 e.g., if it is necessary to do selective re-elaboration to fix some
10467 error.
10468
10469 @node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
10470 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{176}
10471 @section Attribute Elab_Spec
10472
10473
10474 @geindex Elab_Spec
10475
10476 This attribute can only be applied to a program unit name. It returns
10477 the entity for the corresponding elaboration procedure for elaborating
10478 the spec of the referenced unit. This is used in the main
10479 generated elaboration procedure by the binder and is not normally used
10480 in any other context. However, there may be specialized situations in
10481 which it is useful to be able to call this elaboration procedure from
10482 Ada code, e.g., if it is necessary to do selective re-elaboration to fix
10483 some error.
10484
10485 @node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
10486 @anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{177}
10487 @section Attribute Elab_Subp_Body
10488
10489
10490 @geindex Elab_Subp_Body
10491
10492 This attribute can only be applied to a library level subprogram
10493 name and is only allowed in CodePeer mode. It returns the entity
10494 for the corresponding elaboration procedure for elaborating the body
10495 of the referenced subprogram unit. This is used in the main generated
10496 elaboration procedure by the binder in CodePeer mode only and is unrecognized
10497 otherwise.
10498
10499 @node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
10500 @anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{178}
10501 @section Attribute Emax
10502
10503
10504 @geindex Ada 83 attributes
10505
10506 @geindex Emax
10507
10508 The @code{Emax} attribute is provided for compatibility with Ada 83. See
10509 the Ada 83 reference manual for an exact description of the semantics of
10510 this attribute.
10511
10512 @node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
10513 @anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{179}
10514 @section Attribute Enabled
10515
10516
10517 @geindex Enabled
10518
10519 The @code{Enabled} attribute allows an application program to check at compile
10520 time to see if the designated check is currently enabled. The prefix is a
10521 simple identifier, referencing any predefined check name (other than
10522 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
10523 no argument is given for the attribute, the check is for the general state
10524 of the check, if an argument is given, then it is an entity name, and the
10525 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
10526 given naming the entity (if not, then the argument is ignored).
10527
10528 Note that instantiations inherit the check status at the point of the
10529 instantiation, so a useful idiom is to have a library package that
10530 introduces a check name with @code{pragma Check_Name}, and then contains
10531 generic packages or subprograms which use the @code{Enabled} attribute
10532 to see if the check is enabled. A user of this package can then issue
10533 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
10534 the package or subprogram, controlling whether the check will be present.
10535
10536 @node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
10537 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17a}
10538 @section Attribute Enum_Rep
10539
10540
10541 @geindex Representation of enums
10542
10543 @geindex Enum_Rep
10544
10545 For every enumeration subtype @code{S}, @code{S'Enum_Rep} denotes a
10546 function with the following spec:
10547
10548 @example
10549 function S'Enum_Rep (Arg : S'Base) return <Universal_Integer>;
10550 @end example
10551
10552 It is also allowable to apply @code{Enum_Rep} directly to an object of an
10553 enumeration type or to a non-overloaded enumeration
10554 literal. In this case @code{S'Enum_Rep} is equivalent to
10555 @code{typ'Enum_Rep(S)} where @code{typ} is the type of the
10556 enumeration literal or object.
10557
10558 The function returns the representation value for the given enumeration
10559 value. This will be equal to value of the @code{Pos} attribute in the
10560 absence of an enumeration representation clause. This is a static
10561 attribute (i.e.,:the result is static if the argument is static).
10562
10563 @code{S'Enum_Rep} can also be used with integer types and objects,
10564 in which case it simply returns the integer value. The reason for this
10565 is to allow it to be used for @code{(<>)} discrete formal arguments in
10566 a generic unit that can be instantiated with either enumeration types
10567 or integer types. Note that if @code{Enum_Rep} is used on a modular
10568 type whose upper bound exceeds the upper bound of the largest signed
10569 integer type, and the argument is a variable, so that the universal
10570 integer calculation is done at run time, then the call to @code{Enum_Rep}
10571 may raise @code{Constraint_Error}.
10572
10573 @node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
10574 @anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17b}
10575 @section Attribute Enum_Val
10576
10577
10578 @geindex Representation of enums
10579
10580 @geindex Enum_Val
10581
10582 For every enumeration subtype @code{S}, @code{S'Enum_Val} denotes a
10583 function with the following spec:
10584
10585 @example
10586 function S'Enum_Val (Arg : <Universal_Integer>) return S'Base;
10587 @end example
10588
10589 The function returns the enumeration value whose representation matches the
10590 argument, or raises Constraint_Error if no enumeration literal of the type
10591 has the matching value.
10592 This will be equal to value of the @code{Val} attribute in the
10593 absence of an enumeration representation clause. This is a static
10594 attribute (i.e., the result is static if the argument is static).
10595
10596 @node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
10597 @anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17c}
10598 @section Attribute Epsilon
10599
10600
10601 @geindex Ada 83 attributes
10602
10603 @geindex Epsilon
10604
10605 The @code{Epsilon} attribute is provided for compatibility with Ada 83. See
10606 the Ada 83 reference manual for an exact description of the semantics of
10607 this attribute.
10608
10609 @node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
10610 @anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17d}
10611 @section Attribute Fast_Math
10612
10613
10614 @geindex Fast_Math
10615
10616 @code{Standard'Fast_Math} (@code{Standard} is the only allowed
10617 prefix) yields a static Boolean value that is True if pragma
10618 @code{Fast_Math} is active, and False otherwise.
10619
10620 @node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
10621 @anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{17e}
10622 @section Attribute Finalization_Size
10623
10624
10625 @geindex Finalization_Size
10626
10627 The prefix of attribute @code{Finalization_Size} must be an object or
10628 a non-class-wide type. This attribute returns the size of any hidden data
10629 reserved by the compiler to handle finalization-related actions. The type of
10630 the attribute is @emph{universal_integer}.
10631
10632 @code{Finalization_Size} yields a value of zero for a type with no controlled
10633 parts, an object whose type has no controlled parts, or an object of a
10634 class-wide type whose tag denotes a type with no controlled parts.
10635
10636 Note that only heap-allocated objects contain finalization data.
10637
10638 @node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
10639 @anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{17f}
10640 @section Attribute Fixed_Value
10641
10642
10643 @geindex Fixed_Value
10644
10645 For every fixed-point type @code{S}, @code{S'Fixed_Value} denotes a
10646 function with the following specification:
10647
10648 @example
10649 function S'Fixed_Value (Arg : <Universal_Integer>) return S;
10650 @end example
10651
10652 The value returned is the fixed-point value @code{V} such that:
10653
10654 @example
10655 V = Arg * S'Small
10656 @end example
10657
10658 The effect is thus similar to first converting the argument to the
10659 integer type used to represent @code{S}, and then doing an unchecked
10660 conversion to the fixed-point type. The difference is
10661 that there are full range checks, to ensure that the result is in range.
10662 This attribute is primarily intended for use in implementation of the
10663 input-output functions for fixed-point values.
10664
10665 @node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
10666 @anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{180}
10667 @section Attribute From_Any
10668
10669
10670 @geindex From_Any
10671
10672 This internal attribute is used for the generation of remote subprogram
10673 stubs in the context of the Distributed Systems Annex.
10674
10675 @node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
10676 @anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{181}
10677 @section Attribute Has_Access_Values
10678
10679
10680 @geindex Access values
10681 @geindex testing for
10682
10683 @geindex Has_Access_Values
10684
10685 The prefix of the @code{Has_Access_Values} attribute is a type. The result
10686 is a Boolean value which is True if the is an access type, or is a composite
10687 type with a component (at any nesting depth) that is an access type, and is
10688 False otherwise.
10689 The intended use of this attribute is in conjunction with generic
10690 definitions. If the attribute is applied to a generic private type, it
10691 indicates whether or not the corresponding actual type has access values.
10692
10693 @node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
10694 @anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{182}
10695 @section Attribute Has_Discriminants
10696
10697
10698 @geindex Discriminants
10699 @geindex testing for
10700
10701 @geindex Has_Discriminants
10702
10703 The prefix of the @code{Has_Discriminants} attribute is a type. The result
10704 is a Boolean value which is True if the type has discriminants, and False
10705 otherwise. The intended use of this attribute is in conjunction with generic
10706 definitions. If the attribute is applied to a generic private type, it
10707 indicates whether or not the corresponding actual type has discriminants.
10708
10709 @node Attribute Img,Attribute Integer_Value,Attribute Has_Discriminants,Implementation Defined Attributes
10710 @anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{183}
10711 @section Attribute Img
10712
10713
10714 @geindex Img
10715
10716 The @code{Img} attribute differs from @code{Image} in that it is applied
10717 directly to an object, and yields the same result as
10718 @code{Image} for the subtype of the object. This is convenient for
10719 debugging:
10720
10721 @example
10722 Put_Line ("X = " & X'Img);
10723 @end example
10724
10725 has the same meaning as the more verbose:
10726
10727 @example
10728 Put_Line ("X = " & T'Image (X));
10729 @end example
10730
10731 where @code{T} is the (sub)type of the object @code{X}.
10732
10733 Note that technically, in analogy to @code{Image},
10734 @code{X'Img} returns a parameterless function
10735 that returns the appropriate string when called. This means that
10736 @code{X'Img} can be renamed as a function-returning-string, or used
10737 in an instantiation as a function parameter.
10738
10739 @node Attribute Integer_Value,Attribute Invalid_Value,Attribute Img,Implementation Defined Attributes
10740 @anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{184}
10741 @section Attribute Integer_Value
10742
10743
10744 @geindex Integer_Value
10745
10746 For every integer type @code{S}, @code{S'Integer_Value} denotes a
10747 function with the following spec:
10748
10749 @example
10750 function S'Integer_Value (Arg : <Universal_Fixed>) return S;
10751 @end example
10752
10753 The value returned is the integer value @code{V}, such that:
10754
10755 @example
10756 Arg = V * T'Small
10757 @end example
10758
10759 where @code{T} is the type of @code{Arg}.
10760 The effect is thus similar to first doing an unchecked conversion from
10761 the fixed-point type to its corresponding implementation type, and then
10762 converting the result to the target integer type. The difference is
10763 that there are full range checks, to ensure that the result is in range.
10764 This attribute is primarily intended for use in implementation of the
10765 standard input-output functions for fixed-point values.
10766
10767 @node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
10768 @anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{185}
10769 @section Attribute Invalid_Value
10770
10771
10772 @geindex Invalid_Value
10773
10774 For every scalar type S, S'Invalid_Value returns an undefined value of the
10775 type. If possible this value is an invalid representation for the type. The
10776 value returned is identical to the value used to initialize an otherwise
10777 uninitialized value of the type if pragma Initialize_Scalars is used,
10778 including the ability to modify the value with the binder -Sxx flag and
10779 relevant environment variables at run time.
10780
10781 @node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
10782 @anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{186}
10783 @section Attribute Iterable
10784
10785
10786 @geindex Iterable
10787
10788 Equivalent to Aspect Iterable.
10789
10790 @node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
10791 @anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{187}
10792 @section Attribute Large
10793
10794
10795 @geindex Ada 83 attributes
10796
10797 @geindex Large
10798
10799 The @code{Large} attribute is provided for compatibility with Ada 83. See
10800 the Ada 83 reference manual for an exact description of the semantics of
10801 this attribute.
10802
10803 @node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
10804 @anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{188}
10805 @section Attribute Library_Level
10806
10807
10808 @geindex Library_Level
10809
10810 @code{P'Library_Level}, where P is an entity name,
10811 returns a Boolean value which is True if the entity is declared
10812 at the library level, and False otherwise. Note that within a
10813 generic instantition, the name of the generic unit denotes the
10814 instance, which means that this attribute can be used to test
10815 if a generic is instantiated at the library level, as shown
10816 in this example:
10817
10818 @example
10819 generic
10820 ...
10821 package Gen is
10822 pragma Compile_Time_Error
10823 (not Gen'Library_Level,
10824 "Gen can only be instantiated at library level");
10825 ...
10826 end Gen;
10827 @end example
10828
10829 @node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
10830 @anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{189}
10831 @section Attribute Lock_Free
10832
10833
10834 @geindex Lock_Free
10835
10836 @code{P'Lock_Free}, where P is a protected object, returns True if a
10837 pragma @code{Lock_Free} applies to P.
10838
10839 @node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
10840 @anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18a}
10841 @section Attribute Loop_Entry
10842
10843
10844 @geindex Loop_Entry
10845
10846 Syntax:
10847
10848 @example
10849 X'Loop_Entry [(loop_name)]
10850 @end example
10851
10852 The @code{Loop_Entry} attribute is used to refer to the value that an
10853 expression had upon entry to a given loop in much the same way that the
10854 @code{Old} attribute in a subprogram postcondition can be used to refer
10855 to the value an expression had upon entry to the subprogram. The
10856 relevant loop is either identified by the given loop name, or it is the
10857 innermost enclosing loop when no loop name is given.
10858
10859 A @code{Loop_Entry} attribute can only occur within a
10860 @code{Loop_Variant} or @code{Loop_Invariant} pragma. A common use of
10861 @code{Loop_Entry} is to compare the current value of objects with their
10862 initial value at loop entry, in a @code{Loop_Invariant} pragma.
10863
10864 The effect of using @code{X'Loop_Entry} is the same as declaring
10865 a constant initialized with the initial value of @code{X} at loop
10866 entry. This copy is not performed if the loop is not entered, or if the
10867 corresponding pragmas are ignored or disabled.
10868
10869 @node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
10870 @anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18b}
10871 @section Attribute Machine_Size
10872
10873
10874 @geindex Machine_Size
10875
10876 This attribute is identical to the @code{Object_Size} attribute. It is
10877 provided for compatibility with the DEC Ada 83 attribute of this name.
10878
10879 @node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
10880 @anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18c}
10881 @section Attribute Mantissa
10882
10883
10884 @geindex Ada 83 attributes
10885
10886 @geindex Mantissa
10887
10888 The @code{Mantissa} attribute is provided for compatibility with Ada 83. See
10889 the Ada 83 reference manual for an exact description of the semantics of
10890 this attribute.
10891
10892 @node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
10893 @anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{18d}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{18e}
10894 @section Attribute Maximum_Alignment
10895
10896
10897 @geindex Alignment
10898 @geindex maximum
10899
10900 @geindex Maximum_Alignment
10901
10902 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
10903 permissible prefix) provides the maximum useful alignment value for the
10904 target. This is a static value that can be used to specify the alignment
10905 for an object, guaranteeing that it is properly aligned in all
10906 cases.
10907
10908 @node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
10909 @anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{18f}
10910 @section Attribute Mechanism_Code
10911
10912
10913 @geindex Return values
10914 @geindex passing mechanism
10915
10916 @geindex Parameters
10917 @geindex passing mechanism
10918
10919 @geindex Mechanism_Code
10920
10921 @code{func'Mechanism_Code} yields an integer code for the
10922 mechanism used for the result of function @code{func}, and
10923 @code{subprog'Mechanism_Code (n)} yields the mechanism
10924 used for formal parameter number @emph{n} (a static integer value, with 1
10925 meaning the first parameter) of subprogram @code{subprog}. The code returned is:
10926
10927
10928 @table @asis
10929
10930 @item @emph{1}
10931
10932 by copy (value)
10933
10934 @item @emph{2}
10935
10936 by reference
10937 @end table
10938
10939 @node Attribute Null_Parameter,Attribute Object_Size,Attribute Mechanism_Code,Implementation Defined Attributes
10940 @anchor{gnat_rm/implementation_defined_attributes attribute-null-parameter}@anchor{190}
10941 @section Attribute Null_Parameter
10942
10943
10944 @geindex Zero address
10945 @geindex passing
10946
10947 @geindex Null_Parameter
10948
10949 A reference @code{T'Null_Parameter} denotes an imaginary object of
10950 type or subtype @code{T} allocated at machine address zero. The attribute
10951 is allowed only as the default expression of a formal parameter, or as
10952 an actual expression of a subprogram call. In either case, the
10953 subprogram must be imported.
10954
10955 The identity of the object is represented by the address zero in the
10956 argument list, independent of the passing mechanism (explicit or
10957 default).
10958
10959 This capability is needed to specify that a zero address should be
10960 passed for a record or other composite object passed by reference.
10961 There is no way of indicating this without the @code{Null_Parameter}
10962 attribute.
10963
10964 @node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
10965 @anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{143}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{191}
10966 @section Attribute Object_Size
10967
10968
10969 @geindex Size
10970 @geindex used for objects
10971
10972 @geindex Object_Size
10973
10974 The size of an object is not necessarily the same as the size of the type
10975 of an object. This is because by default object sizes are increased to be
10976 a multiple of the alignment of the object. For example,
10977 @code{Natural'Size} is
10978 31, but by default objects of type @code{Natural} will have a size of 32 bits.
10979 Similarly, a record containing an integer and a character:
10980
10981 @example
10982 type Rec is record
10983 I : Integer;
10984 C : Character;
10985 end record;
10986 @end example
10987
10988 will have a size of 40 (that is @code{Rec'Size} will be 40). The
10989 alignment will be 4, because of the
10990 integer field, and so the default size of record objects for this type
10991 will be 64 (8 bytes).
10992
10993 If the alignment of the above record is specified to be 1, then the
10994 object size will be 40 (5 bytes). This is true by default, and also
10995 an object size of 40 can be explicitly specified in this case.
10996
10997 A consequence of this capability is that different object sizes can be
10998 given to subtypes that would otherwise be considered in Ada to be
10999 statically matching. But it makes no sense to consider such subtypes
11000 as statically matching. Consequently, GNAT adds a rule
11001 to the static matching rules that requires object sizes to match.
11002 Consider this example:
11003
11004 @example
11005 1. procedure BadAVConvert is
11006 2. type R is new Integer;
11007 3. subtype R1 is R range 1 .. 10;
11008 4. subtype R2 is R range 1 .. 10;
11009 5. for R1'Object_Size use 8;
11010 6. for R2'Object_Size use 16;
11011 7. type R1P is access all R1;
11012 8. type R2P is access all R2;
11013 9. R1PV : R1P := new R1'(4);
11014 10. R2PV : R2P;
11015 11. begin
11016 12. R2PV := R2P (R1PV);
11017 |
11018 >>> target designated subtype not compatible with
11019 type "R1" defined at line 3
11020
11021 13. end;
11022 @end example
11023
11024 In the absence of lines 5 and 6,
11025 types @code{R1} and @code{R2} statically match and
11026 hence the conversion on line 12 is legal. But since lines 5 and 6
11027 cause the object sizes to differ, GNAT considers that types
11028 @code{R1} and @code{R2} are not statically matching, and line 12
11029 generates the diagnostic shown above.
11030
11031 Similar additional checks are performed in other contexts requiring
11032 statically matching subtypes.
11033
11034 @node Attribute Old,Attribute Passed_By_Reference,Attribute Object_Size,Implementation Defined Attributes
11035 @anchor{gnat_rm/implementation_defined_attributes attribute-old}@anchor{192}
11036 @section Attribute Old
11037
11038
11039 @geindex Old
11040
11041 In addition to the usage of @code{Old} defined in the Ada 2012 RM (usage
11042 within @code{Post} aspect), GNAT also permits the use of this attribute
11043 in implementation defined pragmas @code{Postcondition},
11044 @code{Contract_Cases} and @code{Test_Case}. Also usages of
11045 @code{Old} which would be illegal according to the Ada 2012 RM
11046 definition are allowed under control of
11047 implementation defined pragma @code{Unevaluated_Use_Of_Old}.
11048
11049 @node Attribute Passed_By_Reference,Attribute Pool_Address,Attribute Old,Implementation Defined Attributes
11050 @anchor{gnat_rm/implementation_defined_attributes attribute-passed-by-reference}@anchor{193}
11051 @section Attribute Passed_By_Reference
11052
11053
11054 @geindex Parameters
11055 @geindex when passed by reference
11056
11057 @geindex Passed_By_Reference
11058
11059 @code{typ'Passed_By_Reference} for any subtype @cite{typ} returns
11060 a value of type @code{Boolean} value that is @code{True} if the type is
11061 normally passed by reference and @code{False} if the type is normally
11062 passed by copy in calls. For scalar types, the result is always @code{False}
11063 and is static. For non-scalar types, the result is nonstatic.
11064
11065 @node Attribute Pool_Address,Attribute Range_Length,Attribute Passed_By_Reference,Implementation Defined Attributes
11066 @anchor{gnat_rm/implementation_defined_attributes attribute-pool-address}@anchor{194}
11067 @section Attribute Pool_Address
11068
11069
11070 @geindex Parameters
11071 @geindex when passed by reference
11072
11073 @geindex Pool_Address
11074
11075 @code{X'Pool_Address} for any object @code{X} returns the address
11076 of X within its storage pool. This is the same as
11077 @code{X'Address}, except that for an unconstrained array whose
11078 bounds are allocated just before the first component,
11079 @code{X'Pool_Address} returns the address of those bounds,
11080 whereas @code{X'Address} returns the address of the first
11081 component.
11082
11083 Here, we are interpreting 'storage pool' broadly to mean
11084 @code{wherever the object is allocated}, which could be a
11085 user-defined storage pool,
11086 the global heap, on the stack, or in a static memory area.
11087 For an object created by @code{new}, @code{Ptr.all'Pool_Address} is
11088 what is passed to @code{Allocate} and returned from @code{Deallocate}.
11089
11090 @node Attribute Range_Length,Attribute Restriction_Set,Attribute Pool_Address,Implementation Defined Attributes
11091 @anchor{gnat_rm/implementation_defined_attributes attribute-range-length}@anchor{195}
11092 @section Attribute Range_Length
11093
11094
11095 @geindex Range_Length
11096
11097 @code{typ'Range_Length} for any discrete type @cite{typ} yields
11098 the number of values represented by the subtype (zero for a null
11099 range). The result is static for static subtypes. @code{Range_Length}
11100 applied to the index subtype of a one dimensional array always gives the
11101 same result as @code{Length} applied to the array itself.
11102
11103 @node Attribute Restriction_Set,Attribute Result,Attribute Range_Length,Implementation Defined Attributes
11104 @anchor{gnat_rm/implementation_defined_attributes attribute-restriction-set}@anchor{196}
11105 @section Attribute Restriction_Set
11106
11107
11108 @geindex Restriction_Set
11109
11110 @geindex Restrictions
11111
11112 This attribute allows compile time testing of restrictions that
11113 are currently in effect. It is primarily intended for specializing
11114 code in the run-time based on restrictions that are active (e.g.
11115 don't need to save fpt registers if restriction No_Floating_Point
11116 is known to be in effect), but can be used anywhere.
11117
11118 There are two forms:
11119
11120 @example
11121 System'Restriction_Set (partition_boolean_restriction_NAME)
11122 System'Restriction_Set (No_Dependence => library_unit_NAME);
11123 @end example
11124
11125 In the case of the first form, the only restriction names
11126 allowed are parameterless restrictions that are checked
11127 for consistency at bind time. For a complete list see the
11128 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
11129
11130 The result returned is True if the restriction is known to
11131 be in effect, and False if the restriction is known not to
11132 be in effect. An important guarantee is that the value of
11133 a Restriction_Set attribute is known to be consistent throughout
11134 all the code of a partition.
11135
11136 This is trivially achieved if the entire partition is compiled
11137 with a consistent set of restriction pragmas. However, the
11138 compilation model does not require this. It is possible to
11139 compile one set of units with one set of pragmas, and another
11140 set of units with another set of pragmas. It is even possible
11141 to compile a spec with one set of pragmas, and then WITH the
11142 same spec with a different set of pragmas. Inconsistencies
11143 in the actual use of the restriction are checked at bind time.
11144
11145 In order to achieve the guarantee of consistency for the
11146 Restriction_Set pragma, we consider that a use of the pragma
11147 that yields False is equivalent to a violation of the
11148 restriction.
11149
11150 So for example if you write
11151
11152 @example
11153 if System'Restriction_Set (No_Floating_Point) then
11154 ...
11155 else
11156 ...
11157 end if;
11158 @end example
11159
11160 And the result is False, so that the else branch is executed,
11161 you can assume that this restriction is not set for any unit
11162 in the partition. This is checked by considering this use of
11163 the restriction pragma to be a violation of the restriction
11164 No_Floating_Point. This means that no other unit can attempt
11165 to set this restriction (if some unit does attempt to set it,
11166 the binder will refuse to bind the partition).
11167
11168 Technical note: The restriction name and the unit name are
11169 intepreted entirely syntactically, as in the corresponding
11170 Restrictions pragma, they are not analyzed semantically,
11171 so they do not have a type.
11172
11173 @node Attribute Result,Attribute Safe_Emax,Attribute Restriction_Set,Implementation Defined Attributes
11174 @anchor{gnat_rm/implementation_defined_attributes attribute-result}@anchor{197}
11175 @section Attribute Result
11176
11177
11178 @geindex Result
11179
11180 @code{function'Result} can only be used with in a Postcondition pragma
11181 for a function. The prefix must be the name of the corresponding function. This
11182 is used to refer to the result of the function in the postcondition expression.
11183 For a further discussion of the use of this attribute and examples of its use,
11184 see the description of pragma Postcondition.
11185
11186 @node Attribute Safe_Emax,Attribute Safe_Large,Attribute Result,Implementation Defined Attributes
11187 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-emax}@anchor{198}
11188 @section Attribute Safe_Emax
11189
11190
11191 @geindex Ada 83 attributes
11192
11193 @geindex Safe_Emax
11194
11195 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83. See
11196 the Ada 83 reference manual for an exact description of the semantics of
11197 this attribute.
11198
11199 @node Attribute Safe_Large,Attribute Safe_Small,Attribute Safe_Emax,Implementation Defined Attributes
11200 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-large}@anchor{199}
11201 @section Attribute Safe_Large
11202
11203
11204 @geindex Ada 83 attributes
11205
11206 @geindex Safe_Large
11207
11208 The @code{Safe_Large} attribute is provided for compatibility with Ada 83. See
11209 the Ada 83 reference manual for an exact description of the semantics of
11210 this attribute.
11211
11212 @node Attribute Safe_Small,Attribute Scalar_Storage_Order,Attribute Safe_Large,Implementation Defined Attributes
11213 @anchor{gnat_rm/implementation_defined_attributes attribute-safe-small}@anchor{19a}
11214 @section Attribute Safe_Small
11215
11216
11217 @geindex Ada 83 attributes
11218
11219 @geindex Safe_Small
11220
11221 The @code{Safe_Small} attribute is provided for compatibility with Ada 83. See
11222 the Ada 83 reference manual for an exact description of the semantics of
11223 this attribute.
11224
11225 @node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
11226 @anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19b}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{150}
11227 @section Attribute Scalar_Storage_Order
11228
11229
11230 @geindex Endianness
11231
11232 @geindex Scalar storage order
11233
11234 @geindex Scalar_Storage_Order
11235
11236 For every array or record type @code{S}, the representation attribute
11237 @code{Scalar_Storage_Order} denotes the order in which storage elements
11238 that make up scalar components are ordered within S. The value given must
11239 be a static expression of type System.Bit_Order. The following is an example
11240 of the use of this feature:
11241
11242 @example
11243 -- Component type definitions
11244
11245 subtype Yr_Type is Natural range 0 .. 127;
11246 subtype Mo_Type is Natural range 1 .. 12;
11247 subtype Da_Type is Natural range 1 .. 31;
11248
11249 -- Record declaration
11250
11251 type Date is record
11252 Years_Since_1980 : Yr_Type;
11253 Month : Mo_Type;
11254 Day_Of_Month : Da_Type;
11255 end record;
11256
11257 -- Record representation clause
11258
11259 for Date use record
11260 Years_Since_1980 at 0 range 0 .. 6;
11261 Month at 0 range 7 .. 10;
11262 Day_Of_Month at 0 range 11 .. 15;
11263 end record;
11264
11265 -- Attribute definition clauses
11266
11267 for Date'Bit_Order use System.High_Order_First;
11268 for Date'Scalar_Storage_Order use System.High_Order_First;
11269 -- If Scalar_Storage_Order is specified, it must be consistent with
11270 -- Bit_Order, so it's best to always define the latter explicitly if
11271 -- the former is used.
11272 @end example
11273
11274 Other properties are as for the standard representation attribute @code{Bit_Order}
11275 defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
11276
11277 For a record type @code{T}, if @code{T'Scalar_Storage_Order} is
11278 specified explicitly, it shall be equal to @code{T'Bit_Order}. Note:
11279 this means that if a @code{Scalar_Storage_Order} attribute definition
11280 clause is not confirming, then the type's @code{Bit_Order} shall be
11281 specified explicitly and set to the same value.
11282
11283 Derived types inherit an explicitly set scalar storage order from their parent
11284 types. This may be overridden for the derived type by giving an explicit scalar
11285 storage order for it. However, for a record extension, the derived type must
11286 have the same scalar storage order as the parent type.
11287
11288 A component of a record type that is itself a record or an array and that does
11289 not start and end on a byte boundary must have have the same scalar storage
11290 order as the record type. A component of a bit-packed array type that is itself
11291 a record or an array must have the same scalar storage order as the array type.
11292
11293 No component of a type that has an explicit @code{Scalar_Storage_Order}
11294 attribute definition may be aliased.
11295
11296 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
11297 with a value equal to @code{System.Default_Bit_Order}) has no effect.
11298
11299 If the opposite storage order is specified, then whenever the value of
11300 a scalar component of an object of type @code{S} is read, the storage
11301 elements of the enclosing machine scalar are first reversed (before
11302 retrieving the component value, possibly applying some shift and mask
11303 operatings on the enclosing machine scalar), and the opposite operation
11304 is done for writes.
11305
11306 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
11307 are relaxed. Instead, the following rules apply:
11308
11309
11310 @itemize *
11311
11312 @item
11313 the underlying storage elements are those at positions
11314 @code{(position + first_bit / storage_element_size) .. (position + (last_bit + storage_element_size - 1) / storage_element_size)}
11315
11316 @item
11317 the sequence of underlying storage elements shall have
11318 a size no greater than the largest machine scalar
11319
11320 @item
11321 the enclosing machine scalar is defined as the smallest machine
11322 scalar starting at a position no greater than
11323 @code{position + first_bit / storage_element_size} and covering
11324 storage elements at least up to @code{position + (last_bit + storage_element_size - 1) / storage_element_size`}
11325
11326 @item
11327 the position of the component is interpreted relative to that machine
11328 scalar.
11329 @end itemize
11330
11331 If no scalar storage order is specified for a type (either directly, or by
11332 inheritance in the case of a derived type), then the default is normally
11333 the native ordering of the target, but this default can be overridden using
11334 pragma @code{Default_Scalar_Storage_Order}.
11335
11336 If a component of @code{T} is itself of a record or array type, the specfied
11337 @code{Scalar_Storage_Order} does @emph{not} apply to that nested type: an explicit
11338 attribute definition clause must be provided for the component type as well
11339 if desired.
11340
11341 Note that the scalar storage order only affects the in-memory data
11342 representation. It has no effect on the representation used by stream
11343 attributes.
11344
11345 Note that debuggers may be unable to display the correct value of scalar
11346 components of a type for which the opposite storage order is specified.
11347
11348 @node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
11349 @anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e7}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{19c}
11350 @section Attribute Simple_Storage_Pool
11351
11352
11353 @geindex Storage pool
11354 @geindex simple
11355
11356 @geindex Simple storage pool
11357
11358 @geindex Simple_Storage_Pool
11359
11360 For every nonformal, nonderived access-to-object type @code{Acc}, the
11361 representation attribute @code{Simple_Storage_Pool} may be specified
11362 via an attribute_definition_clause (or by specifying the equivalent aspect):
11363
11364 @example
11365 My_Pool : My_Simple_Storage_Pool_Type;
11366
11367 type Acc is access My_Data_Type;
11368
11369 for Acc'Simple_Storage_Pool use My_Pool;
11370 @end example
11371
11372 The name given in an attribute_definition_clause for the
11373 @code{Simple_Storage_Pool} attribute shall denote a variable of
11374 a 'simple storage pool type' (see pragma @cite{Simple_Storage_Pool_Type}).
11375
11376 The use of this attribute is only allowed for a prefix denoting a type
11377 for which it has been specified. The type of the attribute is the type
11378 of the variable specified as the simple storage pool of the access type,
11379 and the attribute denotes that variable.
11380
11381 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
11382 for the same access type.
11383
11384 If the @code{Simple_Storage_Pool} attribute has been specified for an access
11385 type, then applying the @code{Storage_Pool} attribute to the type is flagged
11386 with a warning and its evaluation raises the exception @code{Program_Error}.
11387
11388 If the Simple_Storage_Pool attribute has been specified for an access
11389 type @code{S}, then the evaluation of the attribute @code{S'Storage_Size}
11390 returns the result of calling @code{Storage_Size (S'Simple_Storage_Pool)},
11391 which is intended to indicate the number of storage elements reserved for
11392 the simple storage pool. If the Storage_Size function has not been defined
11393 for the simple storage pool type, then this attribute returns zero.
11394
11395 If an access type @code{S} has a specified simple storage pool of type
11396 @code{SSP}, then the evaluation of an allocator for that access type calls
11397 the primitive @code{Allocate} procedure for type @code{SSP}, passing
11398 @code{S'Simple_Storage_Pool} as the pool parameter. The detailed
11399 semantics of such allocators is the same as those defined for allocators
11400 in section 13.11 of the @cite{Ada Reference Manual}, with the term
11401 @emph{simple storage pool} substituted for @emph{storage pool}.
11402
11403 If an access type @code{S} has a specified simple storage pool of type
11404 @code{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
11405 for that access type invokes the primitive @code{Deallocate} procedure
11406 for type @code{SSP}, passing @code{S'Simple_Storage_Pool} as the pool
11407 parameter. The detailed semantics of such unchecked deallocations is the same
11408 as defined in section 13.11.2 of the Ada Reference Manual, except that the
11409 term @emph{simple storage pool} is substituted for @emph{storage pool}.
11410
11411 @node Attribute Small,Attribute Storage_Unit,Attribute Simple_Storage_Pool,Implementation Defined Attributes
11412 @anchor{gnat_rm/implementation_defined_attributes attribute-small}@anchor{19d}
11413 @section Attribute Small
11414
11415
11416 @geindex Ada 83 attributes
11417
11418 @geindex Small
11419
11420 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
11421 fixed-point types.
11422 GNAT also allows this attribute to be applied to floating-point types
11423 for compatibility with Ada 83. See
11424 the Ada 83 reference manual for an exact description of the semantics of
11425 this attribute when applied to floating-point types.
11426
11427 @node Attribute Storage_Unit,Attribute Stub_Type,Attribute Small,Implementation Defined Attributes
11428 @anchor{gnat_rm/implementation_defined_attributes attribute-storage-unit}@anchor{19e}
11429 @section Attribute Storage_Unit
11430
11431
11432 @geindex Storage_Unit
11433
11434 @code{Standard'Storage_Unit} (@code{Standard} is the only permissible
11435 prefix) provides the same value as @code{System.Storage_Unit}.
11436
11437 @node Attribute Stub_Type,Attribute System_Allocator_Alignment,Attribute Storage_Unit,Implementation Defined Attributes
11438 @anchor{gnat_rm/implementation_defined_attributes attribute-stub-type}@anchor{19f}
11439 @section Attribute Stub_Type
11440
11441
11442 @geindex Stub_Type
11443
11444 The GNAT implementation of remote access-to-classwide types is
11445 organized as described in AARM section E.4 (20.t): a value of an RACW type
11446 (designating a remote object) is represented as a normal access
11447 value, pointing to a "stub" object which in turn contains the
11448 necessary information to contact the designated remote object. A
11449 call on any dispatching operation of such a stub object does the
11450 remote call, if necessary, using the information in the stub object
11451 to locate the target partition, etc.
11452
11453 For a prefix @code{T} that denotes a remote access-to-classwide type,
11454 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
11455
11456 By construction, the layout of @code{T'Stub_Type} is identical to that of
11457 type @code{RACW_Stub_Type} declared in the internal implementation-defined
11458 unit @code{System.Partition_Interface}. Use of this attribute will create
11459 an implicit dependency on this unit.
11460
11461 @node Attribute System_Allocator_Alignment,Attribute Target_Name,Attribute Stub_Type,Implementation Defined Attributes
11462 @anchor{gnat_rm/implementation_defined_attributes attribute-system-allocator-alignment}@anchor{1a0}
11463 @section Attribute System_Allocator_Alignment
11464
11465
11466 @geindex Alignment
11467 @geindex allocator
11468
11469 @geindex System_Allocator_Alignment
11470
11471 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
11472 permissible prefix) provides the observable guaranted to be honored by
11473 the system allocator (malloc). This is a static value that can be used
11474 in user storage pools based on malloc either to reject allocation
11475 with alignment too large or to enable a realignment circuitry if the
11476 alignment request is larger than this value.
11477
11478 @node Attribute Target_Name,Attribute To_Address,Attribute System_Allocator_Alignment,Implementation Defined Attributes
11479 @anchor{gnat_rm/implementation_defined_attributes attribute-target-name}@anchor{1a1}
11480 @section Attribute Target_Name
11481
11482
11483 @geindex Target_Name
11484
11485 @code{Standard'Target_Name} (@code{Standard} is the only permissible
11486 prefix) provides a static string value that identifies the target
11487 for the current compilation. For GCC implementations, this is the
11488 standard gcc target name without the terminating slash (for
11489 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
11490
11491 @node Attribute To_Address,Attribute To_Any,Attribute Target_Name,Implementation Defined Attributes
11492 @anchor{gnat_rm/implementation_defined_attributes attribute-to-address}@anchor{1a2}
11493 @section Attribute To_Address
11494
11495
11496 @geindex To_Address
11497
11498 The @code{System'To_Address}
11499 (@code{System} is the only permissible prefix)
11500 denotes a function identical to
11501 @code{System.Storage_Elements.To_Address} except that
11502 it is a static attribute. This means that if its argument is
11503 a static expression, then the result of the attribute is a
11504 static expression. This means that such an expression can be
11505 used in contexts (e.g., preelaborable packages) which require a
11506 static expression and where the function call could not be used
11507 (since the function call is always nonstatic, even if its
11508 argument is static). The argument must be in the range
11509 -(2**(m-1)) .. 2**m-1, where m is the memory size
11510 (typically 32 or 64). Negative values are intepreted in a
11511 modular manner (e.g., -1 means the same as 16#FFFF_FFFF# on
11512 a 32 bits machine).
11513
11514 @node Attribute To_Any,Attribute Type_Class,Attribute To_Address,Implementation Defined Attributes
11515 @anchor{gnat_rm/implementation_defined_attributes attribute-to-any}@anchor{1a3}
11516 @section Attribute To_Any
11517
11518
11519 @geindex To_Any
11520
11521 This internal attribute is used for the generation of remote subprogram
11522 stubs in the context of the Distributed Systems Annex.
11523
11524 @node Attribute Type_Class,Attribute Type_Key,Attribute To_Any,Implementation Defined Attributes
11525 @anchor{gnat_rm/implementation_defined_attributes attribute-type-class}@anchor{1a4}
11526 @section Attribute Type_Class
11527
11528
11529 @geindex Type_Class
11530
11531 @code{typ'Type_Class} for any type or subtype @cite{typ} yields
11532 the value of the type class for the full type of @cite{typ}. If
11533 @cite{typ} is a generic formal type, the value is the value for the
11534 corresponding actual subtype. The value of this attribute is of type
11535 @code{System.Aux_DEC.Type_Class}, which has the following definition:
11536
11537 @example
11538 type Type_Class is
11539 (Type_Class_Enumeration,
11540 Type_Class_Integer,
11541 Type_Class_Fixed_Point,
11542 Type_Class_Floating_Point,
11543 Type_Class_Array,
11544 Type_Class_Record,
11545 Type_Class_Access,
11546 Type_Class_Task,
11547 Type_Class_Address);
11548 @end example
11549
11550 Protected types yield the value @code{Type_Class_Task}, which thus
11551 applies to all concurrent types. This attribute is designed to
11552 be compatible with the DEC Ada 83 attribute of the same name.
11553
11554 @node Attribute Type_Key,Attribute TypeCode,Attribute Type_Class,Implementation Defined Attributes
11555 @anchor{gnat_rm/implementation_defined_attributes attribute-type-key}@anchor{1a5}
11556 @section Attribute Type_Key
11557
11558
11559 @geindex Type_Key
11560
11561 The @code{Type_Key} attribute is applicable to a type or subtype and
11562 yields a value of type Standard.String containing encoded information
11563 about the type or subtype. This provides improved compatibility with
11564 other implementations that support this attribute.
11565
11566 @node Attribute TypeCode,Attribute Unconstrained_Array,Attribute Type_Key,Implementation Defined Attributes
11567 @anchor{gnat_rm/implementation_defined_attributes attribute-typecode}@anchor{1a6}
11568 @section Attribute TypeCode
11569
11570
11571 @geindex TypeCode
11572
11573 This internal attribute is used for the generation of remote subprogram
11574 stubs in the context of the Distributed Systems Annex.
11575
11576 @node Attribute Unconstrained_Array,Attribute Universal_Literal_String,Attribute TypeCode,Implementation Defined Attributes
11577 @anchor{gnat_rm/implementation_defined_attributes attribute-unconstrained-array}@anchor{1a7}
11578 @section Attribute Unconstrained_Array
11579
11580
11581 @geindex Unconstrained_Array
11582
11583 The @code{Unconstrained_Array} attribute can be used with a prefix that
11584 denotes any type or subtype. It is a static attribute that yields
11585 @code{True} if the prefix designates an unconstrained array,
11586 and @code{False} otherwise. In a generic instance, the result is
11587 still static, and yields the result of applying this test to the
11588 generic actual.
11589
11590 @node Attribute Universal_Literal_String,Attribute Unrestricted_Access,Attribute Unconstrained_Array,Implementation Defined Attributes
11591 @anchor{gnat_rm/implementation_defined_attributes attribute-universal-literal-string}@anchor{1a8}
11592 @section Attribute Universal_Literal_String
11593
11594
11595 @geindex Named numbers
11596 @geindex representation of
11597
11598 @geindex Universal_Literal_String
11599
11600 The prefix of @code{Universal_Literal_String} must be a named
11601 number. The static result is the string consisting of the characters of
11602 the number as defined in the original source. This allows the user
11603 program to access the actual text of named numbers without intermediate
11604 conversions and without the need to enclose the strings in quotes (which
11605 would preclude their use as numbers).
11606
11607 For example, the following program prints the first 50 digits of pi:
11608
11609 @example
11610 with Text_IO; use Text_IO;
11611 with Ada.Numerics;
11612 procedure Pi is
11613 begin
11614 Put (Ada.Numerics.Pi'Universal_Literal_String);
11615 end;
11616 @end example
11617
11618 @node Attribute Unrestricted_Access,Attribute Update,Attribute Universal_Literal_String,Implementation Defined Attributes
11619 @anchor{gnat_rm/implementation_defined_attributes attribute-unrestricted-access}@anchor{1a9}
11620 @section Attribute Unrestricted_Access
11621
11622
11623 @geindex Access
11624 @geindex unrestricted
11625
11626 @geindex Unrestricted_Access
11627
11628 The @code{Unrestricted_Access} attribute is similar to @code{Access}
11629 except that all accessibility and aliased view checks are omitted. This
11630 is a user-beware attribute.
11631
11632 For objects, it is similar to @code{Address}, for which it is a
11633 desirable replacement where the value desired is an access type.
11634 In other words, its effect is similar to first applying the
11635 @code{Address} attribute and then doing an unchecked conversion to a
11636 desired access type.
11637
11638 For subprograms, @code{P'Unrestricted_Access} may be used where
11639 @code{P'Access} would be illegal, to construct a value of a
11640 less-nested named access type that designates a more-nested
11641 subprogram. This value may be used in indirect calls, so long as the
11642 more-nested subprogram still exists; once the subprogram containing it
11643 has returned, such calls are erroneous. For example:
11644
11645 @example
11646 package body P is
11647
11648 type Less_Nested is not null access procedure;
11649 Global : Less_Nested;
11650
11651 procedure P1 is
11652 begin
11653 Global.all;
11654 end P1;
11655
11656 procedure P2 is
11657 Local_Var : Integer;
11658
11659 procedure More_Nested is
11660 begin
11661 ... Local_Var ...
11662 end More_Nested;
11663 begin
11664 Global := More_Nested'Unrestricted_Access;
11665 P1;
11666 end P2;
11667
11668 end P;
11669 @end example
11670
11671 When P1 is called from P2, the call via Global is OK, but if P1 were
11672 called after P2 returns, it would be an erroneous use of a dangling
11673 pointer.
11674
11675 For objects, it is possible to use @code{Unrestricted_Access} for any
11676 type. However, if the result is of an access-to-unconstrained array
11677 subtype, then the resulting pointer has the same scope as the context
11678 of the attribute, and must not be returned to some enclosing scope.
11679 For instance, if a function uses @code{Unrestricted_Access} to create
11680 an access-to-unconstrained-array and returns that value to the caller,
11681 the result will involve dangling pointers. In addition, it is only
11682 valid to create pointers to unconstrained arrays using this attribute
11683 if the pointer has the normal default 'fat' representation where a
11684 pointer has two components, one points to the array and one points to
11685 the bounds. If a size clause is used to force 'thin' representation
11686 for a pointer to unconstrained where there is only space for a single
11687 pointer, then the resulting pointer is not usable.
11688
11689 In the simple case where a direct use of Unrestricted_Access attempts
11690 to make a thin pointer for a non-aliased object, the compiler will
11691 reject the use as illegal, as shown in the following example:
11692
11693 @example
11694 with System; use System;
11695 procedure SliceUA2 is
11696 type A is access all String;
11697 for A'Size use Standard'Address_Size;
11698
11699 procedure P (Arg : A) is
11700 begin
11701 null;
11702 end P;
11703
11704 X : String := "hello world!";
11705 X2 : aliased String := "hello world!";
11706
11707 AV : A := X'Unrestricted_Access; -- ERROR
11708 |
11709 >>> illegal use of Unrestricted_Access attribute
11710 >>> attempt to generate thin pointer to unaliased object
11711
11712 begin
11713 P (X'Unrestricted_Access); -- ERROR
11714 |
11715 >>> illegal use of Unrestricted_Access attribute
11716 >>> attempt to generate thin pointer to unaliased object
11717
11718 P (X(7 .. 12)'Unrestricted_Access); -- ERROR
11719 |
11720 >>> illegal use of Unrestricted_Access attribute
11721 >>> attempt to generate thin pointer to unaliased object
11722
11723 P (X2'Unrestricted_Access); -- OK
11724 end;
11725 @end example
11726
11727 but other cases cannot be detected by the compiler, and are
11728 considered to be erroneous. Consider the following example:
11729
11730 @example
11731 with System; use System;
11732 with System; use System;
11733 procedure SliceUA is
11734 type AF is access all String;
11735
11736 type A is access all String;
11737 for A'Size use Standard'Address_Size;
11738
11739 procedure P (Arg : A) is
11740 begin
11741 if Arg'Length /= 6 then
11742 raise Program_Error;
11743 end if;
11744 end P;
11745
11746 X : String := "hello world!";
11747 Y : AF := X (7 .. 12)'Unrestricted_Access;
11748
11749 begin
11750 P (A (Y));
11751 end;
11752 @end example
11753
11754 A normal unconstrained array value
11755 or a constrained array object marked as aliased has the bounds in memory
11756 just before the array, so a thin pointer can retrieve both the data and
11757 the bounds. But in this case, the non-aliased object @code{X} does not have the
11758 bounds before the string. If the size clause for type @code{A}
11759 were not present, then the pointer
11760 would be a fat pointer, where one component is a pointer to the bounds,
11761 and all would be well. But with the size clause present, the conversion from
11762 fat pointer to thin pointer in the call loses the bounds, and so this
11763 is erroneous, and the program likely raises a @code{Program_Error} exception.
11764
11765 In general, it is advisable to completely
11766 avoid mixing the use of thin pointers and the use of
11767 @code{Unrestricted_Access} where the designated type is an
11768 unconstrained array. The use of thin pointers should be restricted to
11769 cases of porting legacy code that implicitly assumes the size of pointers,
11770 and such code should not in any case be using this attribute.
11771
11772 Another erroneous situation arises if the attribute is
11773 applied to a constant. The resulting pointer can be used to access the
11774 constant, but the effect of trying to modify a constant in this manner
11775 is not well-defined. Consider this example:
11776
11777 @example
11778 P : constant Integer := 4;
11779 type R is access all Integer;
11780 RV : R := P'Unrestricted_Access;
11781 ..
11782 RV.all := 3;
11783 @end example
11784
11785 Here we attempt to modify the constant P from 4 to 3, but the compiler may
11786 or may not notice this attempt, and subsequent references to P may yield
11787 either the value 3 or the value 4 or the assignment may blow up if the
11788 compiler decides to put P in read-only memory. One particular case where
11789 @code{Unrestricted_Access} can be used in this way is to modify the
11790 value of an @code{in} parameter:
11791
11792 @example
11793 procedure K (S : in String) is
11794 type R is access all Character;
11795 RV : R := S (3)'Unrestricted_Access;
11796 begin
11797 RV.all := 'a';
11798 end;
11799 @end example
11800
11801 In general this is a risky approach. It may appear to "work" but such uses of
11802 @code{Unrestricted_Access} are potentially non-portable, even from one version
11803 of GNAT to another, so are best avoided if possible.
11804
11805 @node Attribute Update,Attribute Valid_Scalars,Attribute Unrestricted_Access,Implementation Defined Attributes
11806 @anchor{gnat_rm/implementation_defined_attributes attribute-update}@anchor{1aa}
11807 @section Attribute Update
11808
11809
11810 @geindex Update
11811
11812 The @code{Update} attribute creates a copy of an array or record value
11813 with one or more modified components. The syntax is:
11814
11815 @example
11816 PREFIX'Update ( RECORD_COMPONENT_ASSOCIATION_LIST )
11817 PREFIX'Update ( ARRAY_COMPONENT_ASSOCIATION @{, ARRAY_COMPONENT_ASSOCIATION @} )
11818 PREFIX'Update ( MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION
11819 @{, MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION @} )
11820
11821 MULTIDIMENSIONAL_ARRAY_COMPONENT_ASSOCIATION ::= INDEX_EXPRESSION_LIST_LIST => EXPRESSION
11822 INDEX_EXPRESSION_LIST_LIST ::= INDEX_EXPRESSION_LIST @{| INDEX_EXPRESSION_LIST @}
11823 INDEX_EXPRESSION_LIST ::= ( EXPRESSION @{, EXPRESSION @} )
11824 @end example
11825
11826 where @code{PREFIX} is the name of an array or record object, the
11827 association list in parentheses does not contain an @code{others}
11828 choice and the box symbol @code{<>} may not appear in any
11829 expression. The effect is to yield a copy of the array or record value
11830 which is unchanged apart from the components mentioned in the
11831 association list, which are changed to the indicated value. The
11832 original value of the array or record value is not affected. For
11833 example:
11834
11835 @example
11836 type Arr is Array (1 .. 5) of Integer;
11837 ...
11838 Avar1 : Arr := (1,2,3,4,5);
11839 Avar2 : Arr := Avar1'Update (2 => 10, 3 .. 4 => 20);
11840 @end example
11841
11842 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
11843 begin unmodified. Similarly:
11844
11845 @example
11846 type Rec is A, B, C : Integer;
11847 ...
11848 Rvar1 : Rec := (A => 1, B => 2, C => 3);
11849 Rvar2 : Rec := Rvar1'Update (B => 20);
11850 @end example
11851
11852 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
11853 with @code{Rvar1} being unmodifed.
11854 Note that the value of the attribute reference is computed
11855 completely before it is used. This means that if you write:
11856
11857 @example
11858 Avar1 := Avar1'Update (1 => 10, 2 => Function_Call);
11859 @end example
11860
11861 then the value of @code{Avar1} is not modified if @code{Function_Call}
11862 raises an exception, unlike the effect of a series of direct assignments
11863 to elements of @code{Avar1}. In general this requires that
11864 two extra complete copies of the object are required, which should be
11865 kept in mind when considering efficiency.
11866
11867 The @code{Update} attribute cannot be applied to prefixes of a limited
11868 type, and cannot reference discriminants in the case of a record type.
11869 The accessibility level of an Update attribute result object is defined
11870 as for an aggregate.
11871
11872 In the record case, no component can be mentioned more than once. In
11873 the array case, two overlapping ranges can appear in the association list,
11874 in which case the modifications are processed left to right.
11875
11876 Multi-dimensional arrays can be modified, as shown by this example:
11877
11878 @example
11879 A : array (1 .. 10, 1 .. 10) of Integer;
11880 ..
11881 A := A'Update ((1, 2) => 20, (3, 4) => 30);
11882 @end example
11883
11884 which changes element (1,2) to 20 and (3,4) to 30.
11885
11886 @node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Update,Implementation Defined Attributes
11887 @anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1ab}
11888 @section Attribute Valid_Scalars
11889
11890
11891 @geindex Valid_Scalars
11892
11893 The @code{'Valid_Scalars} attribute is intended to make it easier to check the
11894 validity of scalar subcomponents of composite objects. The attribute is defined
11895 for any prefix @code{P} which denotes an object. Prefix @code{P} can be any type
11896 except for tagged private or @code{Unchecked_Union} types. The value of the
11897 attribute is of type @code{Boolean}.
11898
11899 @code{P'Valid_Scalars} yields @code{True} if and only if the evaluation of
11900 @code{C'Valid} yields @code{True} for every scalar subcomponent @code{C} of @code{P}, or if
11901 @code{P} has no scalar subcomponents. Attribute @code{'Valid_Scalars} is equivalent
11902 to attribute @code{'Valid} for scalar types.
11903
11904 It is not specified in what order the subcomponents are checked, nor whether
11905 any more are checked after any one of them is determined to be invalid. If the
11906 prefix @code{P} is of a class-wide type @code{T'Class} (where @code{T} is the associated
11907 specific type), or if the prefix @code{P} is of a specific tagged type @code{T}, then
11908 only the subcomponents of @code{T} are checked; in other words, components of
11909 extensions of @code{T} are not checked even if @code{T'Class (P)'Tag /= T'Tag}.
11910
11911 The compiler will issue a warning if it can be determined at compile time that
11912 the prefix of the attribute has no scalar subcomponents.
11913
11914 Note: @code{Valid_Scalars} can generate a lot of code, especially in the case of
11915 a large variant record. If the attribute is called in many places in the same
11916 program applied to objects of the same type, it can reduce program size to
11917 write a function with a single use of the attribute, and then call that
11918 function from multiple places.
11919
11920 @node Attribute VADS_Size,Attribute Value_Size,Attribute Valid_Scalars,Implementation Defined Attributes
11921 @anchor{gnat_rm/implementation_defined_attributes attribute-vads-size}@anchor{1ac}
11922 @section Attribute VADS_Size
11923
11924
11925 @geindex Size
11926 @geindex VADS compatibility
11927
11928 @geindex VADS_Size
11929
11930 The @code{'VADS_Size} attribute is intended to make it easier to port
11931 legacy code which relies on the semantics of @code{'Size} as implemented
11932 by the VADS Ada 83 compiler. GNAT makes a best effort at duplicating the
11933 same semantic interpretation. In particular, @code{'VADS_Size} applied
11934 to a predefined or other primitive type with no Size clause yields the
11935 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
11936 typical machines). In addition @code{'VADS_Size} applied to an object
11937 gives the result that would be obtained by applying the attribute to
11938 the corresponding type.
11939
11940 @node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
11941 @anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1ad}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{15f}
11942 @section Attribute Value_Size
11943
11944
11945 @geindex Size
11946 @geindex setting for not-first subtype
11947
11948 @geindex Value_Size
11949
11950 @code{type'Value_Size} is the number of bits required to represent
11951 a value of the given subtype. It is the same as @code{type'Size},
11952 but, unlike @code{Size}, may be set for non-first subtypes.
11953
11954 @node Attribute Wchar_T_Size,Attribute Word_Size,Attribute Value_Size,Implementation Defined Attributes
11955 @anchor{gnat_rm/implementation_defined_attributes attribute-wchar-t-size}@anchor{1ae}
11956 @section Attribute Wchar_T_Size
11957
11958
11959 @geindex Wchar_T_Size
11960
11961 @code{Standard'Wchar_T_Size} (@code{Standard} is the only permissible
11962 prefix) provides the size in bits of the C @code{wchar_t} type
11963 primarily for constructing the definition of this type in
11964 package @code{Interfaces.C}. The result is a static constant.
11965
11966 @node Attribute Word_Size,,Attribute Wchar_T_Size,Implementation Defined Attributes
11967 @anchor{gnat_rm/implementation_defined_attributes attribute-word-size}@anchor{1af}
11968 @section Attribute Word_Size
11969
11970
11971 @geindex Word_Size
11972
11973 @code{Standard'Word_Size} (@code{Standard} is the only permissible
11974 prefix) provides the value @code{System.Word_Size}. The result is
11975 a static constant.
11976
11977 @node Standard and Implementation Defined Restrictions,Implementation Advice,Implementation Defined Attributes,Top
11978 @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{1b0}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id1}@anchor{1b1}
11979 @chapter Standard and Implementation Defined Restrictions
11980
11981
11982 All Ada Reference Manual-defined Restriction identifiers are implemented:
11983
11984
11985 @itemize *
11986
11987 @item
11988 language-defined restrictions (see 13.12.1)
11989
11990 @item
11991 tasking restrictions (see D.7)
11992
11993 @item
11994 high integrity restrictions (see H.4)
11995 @end itemize
11996
11997 GNAT implements additional restriction identifiers. All restrictions, whether
11998 language defined or GNAT-specific, are listed in the following.
11999
12000 @menu
12001 * Partition-Wide Restrictions::
12002 * Program Unit Level Restrictions::
12003
12004 @end menu
12005
12006 @node Partition-Wide Restrictions,Program Unit Level Restrictions,,Standard and Implementation Defined Restrictions
12007 @anchor{gnat_rm/standard_and_implementation_defined_restrictions partition-wide-restrictions}@anchor{1b2}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id2}@anchor{1b3}
12008 @section Partition-Wide Restrictions
12009
12010
12011 There are two separate lists of restriction identifiers. The first
12012 set requires consistency throughout a partition (in other words, if the
12013 restriction identifier is used for any compilation unit in the partition,
12014 then all compilation units in the partition must obey the restriction).
12015
12016 @menu
12017 * Immediate_Reclamation::
12018 * Max_Asynchronous_Select_Nesting::
12019 * Max_Entry_Queue_Length::
12020 * Max_Protected_Entries::
12021 * Max_Select_Alternatives::
12022 * Max_Storage_At_Blocking::
12023 * Max_Task_Entries::
12024 * Max_Tasks::
12025 * No_Abort_Statements::
12026 * No_Access_Parameter_Allocators::
12027 * No_Access_Subprograms::
12028 * No_Allocators::
12029 * No_Anonymous_Allocators::
12030 * No_Asynchronous_Control::
12031 * No_Calendar::
12032 * No_Coextensions::
12033 * No_Default_Initialization::
12034 * No_Delay::
12035 * No_Dependence::
12036 * No_Direct_Boolean_Operators::
12037 * No_Dispatch::
12038 * No_Dispatching_Calls::
12039 * No_Dynamic_Attachment::
12040 * No_Dynamic_Priorities::
12041 * No_Entry_Calls_In_Elaboration_Code::
12042 * No_Enumeration_Maps::
12043 * No_Exception_Handlers::
12044 * No_Exception_Propagation::
12045 * No_Exception_Registration::
12046 * No_Exceptions::
12047 * No_Finalization::
12048 * No_Fixed_Point::
12049 * No_Floating_Point::
12050 * No_Implicit_Conditionals::
12051 * No_Implicit_Dynamic_Code::
12052 * No_Implicit_Heap_Allocations::
12053 * No_Implicit_Protected_Object_Allocations::
12054 * No_Implicit_Task_Allocations::
12055 * No_Initialize_Scalars::
12056 * No_IO::
12057 * No_Local_Allocators::
12058 * No_Local_Protected_Objects::
12059 * No_Local_Timing_Events::
12060 * No_Long_Long_Integers::
12061 * No_Multiple_Elaboration::
12062 * No_Nested_Finalization::
12063 * No_Protected_Type_Allocators::
12064 * No_Protected_Types::
12065 * No_Recursion::
12066 * No_Reentrancy::
12067 * No_Relative_Delay::
12068 * No_Requeue_Statements::
12069 * No_Secondary_Stack::
12070 * No_Select_Statements::
12071 * No_Specific_Termination_Handlers::
12072 * No_Specification_of_Aspect::
12073 * No_Standard_Allocators_After_Elaboration::
12074 * No_Standard_Storage_Pools::
12075 * No_Stream_Optimizations::
12076 * No_Streams::
12077 * No_Task_Allocators::
12078 * No_Task_At_Interrupt_Priority::
12079 * No_Task_Attributes_Package::
12080 * No_Task_Hierarchy::
12081 * No_Task_Termination::
12082 * No_Tasking::
12083 * No_Terminate_Alternatives::
12084 * No_Unchecked_Access::
12085 * No_Unchecked_Conversion::
12086 * No_Unchecked_Deallocation::
12087 * No_Use_Of_Entity::
12088 * Pure_Barriers::
12089 * Simple_Barriers::
12090 * Static_Priorities::
12091 * Static_Storage_Size::
12092
12093 @end menu
12094
12095 @node Immediate_Reclamation,Max_Asynchronous_Select_Nesting,,Partition-Wide Restrictions
12096 @anchor{gnat_rm/standard_and_implementation_defined_restrictions immediate-reclamation}@anchor{1b4}
12097 @subsection Immediate_Reclamation
12098
12099
12100 @geindex Immediate_Reclamation
12101
12102 [RM H.4] This restriction ensures that, except for storage occupied by
12103 objects created by allocators and not deallocated via unchecked
12104 deallocation, any storage reserved at run time for an object is
12105 immediately reclaimed when the object no longer exists.
12106
12107 @node Max_Asynchronous_Select_Nesting,Max_Entry_Queue_Length,Immediate_Reclamation,Partition-Wide Restrictions
12108 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-asynchronous-select-nesting}@anchor{1b5}
12109 @subsection Max_Asynchronous_Select_Nesting
12110
12111
12112 @geindex Max_Asynchronous_Select_Nesting
12113
12114 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
12115 selects. Violations of this restriction with a value of zero are
12116 detected at compile time. Violations of this restriction with values
12117 other than zero cause Storage_Error to be raised.
12118
12119 @node Max_Entry_Queue_Length,Max_Protected_Entries,Max_Asynchronous_Select_Nesting,Partition-Wide Restrictions
12120 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-entry-queue-length}@anchor{1b6}
12121 @subsection Max_Entry_Queue_Length
12122
12123
12124 @geindex Max_Entry_Queue_Length
12125
12126 [RM D.7] This restriction is a declaration that any protected entry compiled in
12127 the scope of the restriction has at most the specified number of
12128 tasks waiting on the entry at any one time, and so no queue is required.
12129 Note that this restriction is checked at run time. Violation of this
12130 restriction results in the raising of Program_Error exception at the point of
12131 the call.
12132
12133 @geindex Max_Entry_Queue_Depth
12134
12135 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
12136 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
12137 compatibility purposes (and a warning will be generated for its use if
12138 warnings on obsolescent features are activated).
12139
12140 @node Max_Protected_Entries,Max_Select_Alternatives,Max_Entry_Queue_Length,Partition-Wide Restrictions
12141 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-protected-entries}@anchor{1b7}
12142 @subsection Max_Protected_Entries
12143
12144
12145 @geindex Max_Protected_Entries
12146
12147 [RM D.7] Specifies the maximum number of entries per protected type. The
12148 bounds of every entry family of a protected unit shall be static, or shall be
12149 defined by a discriminant of a subtype whose corresponding bound is static.
12150
12151 @node Max_Select_Alternatives,Max_Storage_At_Blocking,Max_Protected_Entries,Partition-Wide Restrictions
12152 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-select-alternatives}@anchor{1b8}
12153 @subsection Max_Select_Alternatives
12154
12155
12156 @geindex Max_Select_Alternatives
12157
12158 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
12159
12160 @node Max_Storage_At_Blocking,Max_Task_Entries,Max_Select_Alternatives,Partition-Wide Restrictions
12161 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-storage-at-blocking}@anchor{1b9}
12162 @subsection Max_Storage_At_Blocking
12163
12164
12165 @geindex Max_Storage_At_Blocking
12166
12167 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
12168 Storage_Size that can be retained by a blocked task. A violation of this
12169 restriction causes Storage_Error to be raised.
12170
12171 @node Max_Task_Entries,Max_Tasks,Max_Storage_At_Blocking,Partition-Wide Restrictions
12172 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-task-entries}@anchor{1ba}
12173 @subsection Max_Task_Entries
12174
12175
12176 @geindex Max_Task_Entries
12177
12178 [RM D.7] Specifies the maximum number of entries
12179 per task. The bounds of every entry family
12180 of a task unit shall be static, or shall be
12181 defined by a discriminant of a subtype whose
12182 corresponding bound is static.
12183
12184 @node Max_Tasks,No_Abort_Statements,Max_Task_Entries,Partition-Wide Restrictions
12185 @anchor{gnat_rm/standard_and_implementation_defined_restrictions max-tasks}@anchor{1bb}
12186 @subsection Max_Tasks
12187
12188
12189 @geindex Max_Tasks
12190
12191 [RM D.7] Specifies the maximum number of task that may be created, not
12192 counting the creation of the environment task. Violations of this
12193 restriction with a value of zero are detected at compile
12194 time. Violations of this restriction with values other than zero cause
12195 Storage_Error to be raised.
12196
12197 @node No_Abort_Statements,No_Access_Parameter_Allocators,Max_Tasks,Partition-Wide Restrictions
12198 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-abort-statements}@anchor{1bc}
12199 @subsection No_Abort_Statements
12200
12201
12202 @geindex No_Abort_Statements
12203
12204 [RM D.7] There are no abort_statements, and there are
12205 no calls to Task_Identification.Abort_Task.
12206
12207 @node No_Access_Parameter_Allocators,No_Access_Subprograms,No_Abort_Statements,Partition-Wide Restrictions
12208 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-parameter-allocators}@anchor{1bd}
12209 @subsection No_Access_Parameter_Allocators
12210
12211
12212 @geindex No_Access_Parameter_Allocators
12213
12214 [RM H.4] This restriction ensures at compile time that there are no
12215 occurrences of an allocator as the actual parameter to an access
12216 parameter.
12217
12218 @node No_Access_Subprograms,No_Allocators,No_Access_Parameter_Allocators,Partition-Wide Restrictions
12219 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-access-subprograms}@anchor{1be}
12220 @subsection No_Access_Subprograms
12221
12222
12223 @geindex No_Access_Subprograms
12224
12225 [RM H.4] This restriction ensures at compile time that there are no
12226 declarations of access-to-subprogram types.
12227
12228 @node No_Allocators,No_Anonymous_Allocators,No_Access_Subprograms,Partition-Wide Restrictions
12229 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-allocators}@anchor{1bf}
12230 @subsection No_Allocators
12231
12232
12233 @geindex No_Allocators
12234
12235 [RM H.4] This restriction ensures at compile time that there are no
12236 occurrences of an allocator.
12237
12238 @node No_Anonymous_Allocators,No_Asynchronous_Control,No_Allocators,Partition-Wide Restrictions
12239 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-anonymous-allocators}@anchor{1c0}
12240 @subsection No_Anonymous_Allocators
12241
12242
12243 @geindex No_Anonymous_Allocators
12244
12245 [RM H.4] This restriction ensures at compile time that there are no
12246 occurrences of an allocator of anonymous access type.
12247
12248 @node No_Asynchronous_Control,No_Calendar,No_Anonymous_Allocators,Partition-Wide Restrictions
12249 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-asynchronous-control}@anchor{1c1}
12250 @subsection No_Asynchronous_Control
12251
12252
12253 @geindex No_Asynchronous_Control
12254
12255 [RM J.13] This restriction ensures at compile time that there are no semantic
12256 dependences on the predefined package Asynchronous_Task_Control.
12257
12258 @node No_Calendar,No_Coextensions,No_Asynchronous_Control,Partition-Wide Restrictions
12259 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-calendar}@anchor{1c2}
12260 @subsection No_Calendar
12261
12262
12263 @geindex No_Calendar
12264
12265 [GNAT] This restriction ensures at compile time that there are no semantic
12266 dependences on package Calendar.
12267
12268 @node No_Coextensions,No_Default_Initialization,No_Calendar,Partition-Wide Restrictions
12269 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-coextensions}@anchor{1c3}
12270 @subsection No_Coextensions
12271
12272
12273 @geindex No_Coextensions
12274
12275 [RM H.4] This restriction ensures at compile time that there are no
12276 coextensions. See 3.10.2.
12277
12278 @node No_Default_Initialization,No_Delay,No_Coextensions,Partition-Wide Restrictions
12279 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-default-initialization}@anchor{1c4}
12280 @subsection No_Default_Initialization
12281
12282
12283 @geindex No_Default_Initialization
12284
12285 [GNAT] This restriction prohibits any instance of default initialization
12286 of variables. The binder implements a consistency rule which prevents
12287 any unit compiled without the restriction from with'ing a unit with the
12288 restriction (this allows the generation of initialization procedures to
12289 be skipped, since you can be sure that no call is ever generated to an
12290 initialization procedure in a unit with the restriction active). If used
12291 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
12292 is to prohibit all cases of variables declared without a specific
12293 initializer (including the case of OUT scalar parameters).
12294
12295 @node No_Delay,No_Dependence,No_Default_Initialization,Partition-Wide Restrictions
12296 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-delay}@anchor{1c5}
12297 @subsection No_Delay
12298
12299
12300 @geindex No_Delay
12301
12302 [RM H.4] This restriction ensures at compile time that there are no
12303 delay statements and no semantic dependences on package Calendar.
12304
12305 @node No_Dependence,No_Direct_Boolean_Operators,No_Delay,Partition-Wide Restrictions
12306 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dependence}@anchor{1c6}
12307 @subsection No_Dependence
12308
12309
12310 @geindex No_Dependence
12311
12312 [RM 13.12.1] This restriction ensures at compile time that there are no
12313 dependences on a library unit.
12314
12315 @node No_Direct_Boolean_Operators,No_Dispatch,No_Dependence,Partition-Wide Restrictions
12316 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-direct-boolean-operators}@anchor{1c7}
12317 @subsection No_Direct_Boolean_Operators
12318
12319
12320 @geindex No_Direct_Boolean_Operators
12321
12322 [GNAT] This restriction ensures that no logical operators (and/or/xor)
12323 are used on operands of type Boolean (or any type derived from Boolean).
12324 This is intended for use in safety critical programs where the certification
12325 protocol requires the use of short-circuit (and then, or else) forms for all
12326 composite boolean operations.
12327
12328 @node No_Dispatch,No_Dispatching_Calls,No_Direct_Boolean_Operators,Partition-Wide Restrictions
12329 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatch}@anchor{1c8}
12330 @subsection No_Dispatch
12331
12332
12333 @geindex No_Dispatch
12334
12335 [RM H.4] This restriction ensures at compile time that there are no
12336 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
12337
12338 @node No_Dispatching_Calls,No_Dynamic_Attachment,No_Dispatch,Partition-Wide Restrictions
12339 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dispatching-calls}@anchor{1c9}
12340 @subsection No_Dispatching_Calls
12341
12342
12343 @geindex No_Dispatching_Calls
12344
12345 [GNAT] This restriction ensures at compile time that the code generated by the
12346 compiler involves no dispatching calls. The use of this restriction allows the
12347 safe use of record extensions, classwide membership tests and other classwide
12348 features not involving implicit dispatching. This restriction ensures that
12349 the code contains no indirect calls through a dispatching mechanism. Note that
12350 this includes internally-generated calls created by the compiler, for example
12351 in the implementation of class-wide objects assignments. The
12352 membership test is allowed in the presence of this restriction, because its
12353 implementation requires no dispatching.
12354 This restriction is comparable to the official Ada restriction
12355 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
12356 all classwide constructs that do not imply dispatching.
12357 The following example indicates constructs that violate this restriction.
12358
12359 @example
12360 package Pkg is
12361 type T is tagged record
12362 Data : Natural;
12363 end record;
12364 procedure P (X : T);
12365
12366 type DT is new T with record
12367 More_Data : Natural;
12368 end record;
12369 procedure Q (X : DT);
12370 end Pkg;
12371
12372 with Pkg; use Pkg;
12373 procedure Example is
12374 procedure Test (O : T'Class) is
12375 N : Natural := O'Size;-- Error: Dispatching call
12376 C : T'Class := O; -- Error: implicit Dispatching Call
12377 begin
12378 if O in DT'Class then -- OK : Membership test
12379 Q (DT (O)); -- OK : Type conversion plus direct call
12380 else
12381 P (O); -- Error: Dispatching call
12382 end if;
12383 end Test;
12384
12385 Obj : DT;
12386 begin
12387 P (Obj); -- OK : Direct call
12388 P (T (Obj)); -- OK : Type conversion plus direct call
12389 P (T'Class (Obj)); -- Error: Dispatching call
12390
12391 Test (Obj); -- OK : Type conversion
12392
12393 if Obj in T'Class then -- OK : Membership test
12394 null;
12395 end if;
12396 end Example;
12397 @end example
12398
12399 @node No_Dynamic_Attachment,No_Dynamic_Priorities,No_Dispatching_Calls,Partition-Wide Restrictions
12400 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-attachment}@anchor{1ca}
12401 @subsection No_Dynamic_Attachment
12402
12403
12404 @geindex No_Dynamic_Attachment
12405
12406 [RM D.7] This restriction ensures that there is no call to any of the
12407 operations defined in package Ada.Interrupts
12408 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
12409 Detach_Handler, and Reference).
12410
12411 @geindex No_Dynamic_Interrupts
12412
12413 The restriction @code{No_Dynamic_Interrupts} is recognized as a
12414 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
12415 compatibility purposes (and a warning will be generated for its use if
12416 warnings on obsolescent features are activated).
12417
12418 @node No_Dynamic_Priorities,No_Entry_Calls_In_Elaboration_Code,No_Dynamic_Attachment,Partition-Wide Restrictions
12419 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-priorities}@anchor{1cb}
12420 @subsection No_Dynamic_Priorities
12421
12422
12423 @geindex No_Dynamic_Priorities
12424
12425 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
12426
12427 @node No_Entry_Calls_In_Elaboration_Code,No_Enumeration_Maps,No_Dynamic_Priorities,Partition-Wide Restrictions
12428 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-calls-in-elaboration-code}@anchor{1cc}
12429 @subsection No_Entry_Calls_In_Elaboration_Code
12430
12431
12432 @geindex No_Entry_Calls_In_Elaboration_Code
12433
12434 [GNAT] This restriction ensures at compile time that no task or protected entry
12435 calls are made during elaboration code. As a result of the use of this
12436 restriction, the compiler can assume that no code past an accept statement
12437 in a task can be executed at elaboration time.
12438
12439 @node No_Enumeration_Maps,No_Exception_Handlers,No_Entry_Calls_In_Elaboration_Code,Partition-Wide Restrictions
12440 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-enumeration-maps}@anchor{1cd}
12441 @subsection No_Enumeration_Maps
12442
12443
12444 @geindex No_Enumeration_Maps
12445
12446 [GNAT] This restriction ensures at compile time that no operations requiring
12447 enumeration maps are used (that is Image and Value attributes applied
12448 to enumeration types).
12449
12450 @node No_Exception_Handlers,No_Exception_Propagation,No_Enumeration_Maps,Partition-Wide Restrictions
12451 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-handlers}@anchor{1ce}
12452 @subsection No_Exception_Handlers
12453
12454
12455 @geindex No_Exception_Handlers
12456
12457 [GNAT] This restriction ensures at compile time that there are no explicit
12458 exception handlers. It also indicates that no exception propagation will
12459 be provided. In this mode, exceptions may be raised but will result in
12460 an immediate call to the last chance handler, a routine that the user
12461 must define with the following profile:
12462
12463 @example
12464 procedure Last_Chance_Handler
12465 (Source_Location : System.Address; Line : Integer);
12466 pragma Export (C, Last_Chance_Handler,
12467 "__gnat_last_chance_handler");
12468 @end example
12469
12470 The parameter is a C null-terminated string representing a message to be
12471 associated with the exception (typically the source location of the raise
12472 statement generated by the compiler). The Line parameter when nonzero
12473 represents the line number in the source program where the raise occurs.
12474
12475 @node No_Exception_Propagation,No_Exception_Registration,No_Exception_Handlers,Partition-Wide Restrictions
12476 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-propagation}@anchor{1cf}
12477 @subsection No_Exception_Propagation
12478
12479
12480 @geindex No_Exception_Propagation
12481
12482 [GNAT] This restriction guarantees that exceptions are never propagated
12483 to an outer subprogram scope. The only case in which an exception may
12484 be raised is when the handler is statically in the same subprogram, so
12485 that the effect of a raise is essentially like a goto statement. Any
12486 other raise statement (implicit or explicit) will be considered
12487 unhandled. Exception handlers are allowed, but may not contain an
12488 exception occurrence identifier (exception choice). In addition, use of
12489 the package GNAT.Current_Exception is not permitted, and reraise
12490 statements (raise with no operand) are not permitted.
12491
12492 @node No_Exception_Registration,No_Exceptions,No_Exception_Propagation,Partition-Wide Restrictions
12493 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exception-registration}@anchor{1d0}
12494 @subsection No_Exception_Registration
12495
12496
12497 @geindex No_Exception_Registration
12498
12499 [GNAT] This restriction ensures at compile time that no stream operations for
12500 types Exception_Id or Exception_Occurrence are used. This also makes it
12501 impossible to pass exceptions to or from a partition with this restriction
12502 in a distributed environment. If this restriction is active, the generated
12503 code is simplified by omitting the otherwise-required global registration
12504 of exceptions when they are declared.
12505
12506 @node No_Exceptions,No_Finalization,No_Exception_Registration,Partition-Wide Restrictions
12507 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-exceptions}@anchor{1d1}
12508 @subsection No_Exceptions
12509
12510
12511 @geindex No_Exceptions
12512
12513 [RM H.4] This restriction ensures at compile time that there are no
12514 raise statements and no exception handlers and also suppresses the
12515 generation of language-defined run-time checks.
12516
12517 @node No_Finalization,No_Fixed_Point,No_Exceptions,Partition-Wide Restrictions
12518 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-finalization}@anchor{1d2}
12519 @subsection No_Finalization
12520
12521
12522 @geindex No_Finalization
12523
12524 [GNAT] This restriction disables the language features described in
12525 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
12526 performed by the compiler to support these features. The following types
12527 are no longer considered controlled when this restriction is in effect:
12528
12529
12530 @itemize *
12531
12532 @item
12533 @code{Ada.Finalization.Controlled}
12534
12535 @item
12536 @code{Ada.Finalization.Limited_Controlled}
12537
12538 @item
12539 Derivations from @code{Controlled} or @code{Limited_Controlled}
12540
12541 @item
12542 Class-wide types
12543
12544 @item
12545 Protected types
12546
12547 @item
12548 Task types
12549
12550 @item
12551 Array and record types with controlled components
12552 @end itemize
12553
12554 The compiler no longer generates code to initialize, finalize or adjust an
12555 object or a nested component, either declared on the stack or on the heap. The
12556 deallocation of a controlled object no longer finalizes its contents.
12557
12558 @node No_Fixed_Point,No_Floating_Point,No_Finalization,Partition-Wide Restrictions
12559 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-fixed-point}@anchor{1d3}
12560 @subsection No_Fixed_Point
12561
12562
12563 @geindex No_Fixed_Point
12564
12565 [RM H.4] This restriction ensures at compile time that there are no
12566 occurrences of fixed point types and operations.
12567
12568 @node No_Floating_Point,No_Implicit_Conditionals,No_Fixed_Point,Partition-Wide Restrictions
12569 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-floating-point}@anchor{1d4}
12570 @subsection No_Floating_Point
12571
12572
12573 @geindex No_Floating_Point
12574
12575 [RM H.4] This restriction ensures at compile time that there are no
12576 occurrences of floating point types and operations.
12577
12578 @node No_Implicit_Conditionals,No_Implicit_Dynamic_Code,No_Floating_Point,Partition-Wide Restrictions
12579 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-conditionals}@anchor{1d5}
12580 @subsection No_Implicit_Conditionals
12581
12582
12583 @geindex No_Implicit_Conditionals
12584
12585 [GNAT] This restriction ensures that the generated code does not contain any
12586 implicit conditionals, either by modifying the generated code where possible,
12587 or by rejecting any construct that would otherwise generate an implicit
12588 conditional. Note that this check does not include run time constraint
12589 checks, which on some targets may generate implicit conditionals as
12590 well. To control the latter, constraint checks can be suppressed in the
12591 normal manner. Constructs generating implicit conditionals include comparisons
12592 of composite objects and the Max/Min attributes.
12593
12594 @node No_Implicit_Dynamic_Code,No_Implicit_Heap_Allocations,No_Implicit_Conditionals,Partition-Wide Restrictions
12595 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-dynamic-code}@anchor{1d6}
12596 @subsection No_Implicit_Dynamic_Code
12597
12598
12599 @geindex No_Implicit_Dynamic_Code
12600
12601 @geindex trampoline
12602
12603 [GNAT] This restriction prevents the compiler from building 'trampolines'.
12604 This is a structure that is built on the stack and contains dynamic
12605 code to be executed at run time. On some targets, a trampoline is
12606 built for the following features: @code{Access},
12607 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
12608 nested task bodies; primitive operations of nested tagged types.
12609 Trampolines do not work on machines that prevent execution of stack
12610 data. For example, on windows systems, enabling DEP (data execution
12611 protection) will cause trampolines to raise an exception.
12612 Trampolines are also quite slow at run time.
12613
12614 On many targets, trampolines have been largely eliminated. Look at the
12615 version of system.ads for your target --- if it has
12616 Always_Compatible_Rep equal to False, then trampolines are largely
12617 eliminated. In particular, a trampoline is built for the following
12618 features: @code{Address} of a nested subprogram;
12619 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
12620 but only if pragma Favor_Top_Level applies, or the access type has a
12621 foreign-language convention; primitive operations of nested tagged
12622 types.
12623
12624 @node No_Implicit_Heap_Allocations,No_Implicit_Protected_Object_Allocations,No_Implicit_Dynamic_Code,Partition-Wide Restrictions
12625 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-heap-allocations}@anchor{1d7}
12626 @subsection No_Implicit_Heap_Allocations
12627
12628
12629 @geindex No_Implicit_Heap_Allocations
12630
12631 [RM D.7] No constructs are allowed to cause implicit heap allocation.
12632
12633 @node No_Implicit_Protected_Object_Allocations,No_Implicit_Task_Allocations,No_Implicit_Heap_Allocations,Partition-Wide Restrictions
12634 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-protected-object-allocations}@anchor{1d8}
12635 @subsection No_Implicit_Protected_Object_Allocations
12636
12637
12638 @geindex No_Implicit_Protected_Object_Allocations
12639
12640 [GNAT] No constructs are allowed to cause implicit heap allocation of a
12641 protected object.
12642
12643 @node No_Implicit_Task_Allocations,No_Initialize_Scalars,No_Implicit_Protected_Object_Allocations,Partition-Wide Restrictions
12644 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-task-allocations}@anchor{1d9}
12645 @subsection No_Implicit_Task_Allocations
12646
12647
12648 @geindex No_Implicit_Task_Allocations
12649
12650 [GNAT] No constructs are allowed to cause implicit heap allocation of a task.
12651
12652 @node No_Initialize_Scalars,No_IO,No_Implicit_Task_Allocations,Partition-Wide Restrictions
12653 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-initialize-scalars}@anchor{1da}
12654 @subsection No_Initialize_Scalars
12655
12656
12657 @geindex No_Initialize_Scalars
12658
12659 [GNAT] This restriction ensures that no unit in the partition is compiled with
12660 pragma Initialize_Scalars. This allows the generation of more efficient
12661 code, and in particular eliminates dummy null initialization routines that
12662 are otherwise generated for some record and array types.
12663
12664 @node No_IO,No_Local_Allocators,No_Initialize_Scalars,Partition-Wide Restrictions
12665 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-io}@anchor{1db}
12666 @subsection No_IO
12667
12668
12669 @geindex No_IO
12670
12671 [RM H.4] This restriction ensures at compile time that there are no
12672 dependences on any of the library units Sequential_IO, Direct_IO,
12673 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
12674
12675 @node No_Local_Allocators,No_Local_Protected_Objects,No_IO,Partition-Wide Restrictions
12676 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-allocators}@anchor{1dc}
12677 @subsection No_Local_Allocators
12678
12679
12680 @geindex No_Local_Allocators
12681
12682 [RM H.4] This restriction ensures at compile time that there are no
12683 occurrences of an allocator in subprograms, generic subprograms, tasks,
12684 and entry bodies.
12685
12686 @node No_Local_Protected_Objects,No_Local_Timing_Events,No_Local_Allocators,Partition-Wide Restrictions
12687 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-protected-objects}@anchor{1dd}
12688 @subsection No_Local_Protected_Objects
12689
12690
12691 @geindex No_Local_Protected_Objects
12692
12693 [RM D.7] This restriction ensures at compile time that protected objects are
12694 only declared at the library level.
12695
12696 @node No_Local_Timing_Events,No_Long_Long_Integers,No_Local_Protected_Objects,Partition-Wide Restrictions
12697 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-local-timing-events}@anchor{1de}
12698 @subsection No_Local_Timing_Events
12699
12700
12701 @geindex No_Local_Timing_Events
12702
12703 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
12704 declared at the library level.
12705
12706 @node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
12707 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-long-long-integers}@anchor{1df}
12708 @subsection No_Long_Long_Integers
12709
12710
12711 @geindex No_Long_Long_Integers
12712
12713 [GNAT] This partition-wide restriction forbids any explicit reference to
12714 type Standard.Long_Long_Integer, and also forbids declaring range types whose
12715 implicit base type is Long_Long_Integer, and modular types whose size exceeds
12716 Long_Integer'Size.
12717
12718 @node No_Multiple_Elaboration,No_Nested_Finalization,No_Long_Long_Integers,Partition-Wide Restrictions
12719 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-multiple-elaboration}@anchor{1e0}
12720 @subsection No_Multiple_Elaboration
12721
12722
12723 @geindex No_Multiple_Elaboration
12724
12725 [GNAT] When this restriction is active and the static elaboration model is
12726 used, and -fpreserve-control-flow is not used, the compiler is allowed to
12727 suppress the elaboration counter normally associated with the unit, even if
12728 the unit has elaboration code. This counter is typically used to check for
12729 access before elaboration and to control multiple elaboration attempts. If the
12730 restriction is used, then the situations in which multiple elaboration is
12731 possible, including non-Ada main programs and Stand Alone libraries, are not
12732 permitted and will be diagnosed by the binder.
12733
12734 @node No_Nested_Finalization,No_Protected_Type_Allocators,No_Multiple_Elaboration,Partition-Wide Restrictions
12735 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-nested-finalization}@anchor{1e1}
12736 @subsection No_Nested_Finalization
12737
12738
12739 @geindex No_Nested_Finalization
12740
12741 [RM D.7] All objects requiring finalization are declared at the library level.
12742
12743 @node No_Protected_Type_Allocators,No_Protected_Types,No_Nested_Finalization,Partition-Wide Restrictions
12744 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-type-allocators}@anchor{1e2}
12745 @subsection No_Protected_Type_Allocators
12746
12747
12748 @geindex No_Protected_Type_Allocators
12749
12750 [RM D.7] This restriction ensures at compile time that there are no allocator
12751 expressions that attempt to allocate protected objects.
12752
12753 @node No_Protected_Types,No_Recursion,No_Protected_Type_Allocators,Partition-Wide Restrictions
12754 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-protected-types}@anchor{1e3}
12755 @subsection No_Protected_Types
12756
12757
12758 @geindex No_Protected_Types
12759
12760 [RM H.4] This restriction ensures at compile time that there are no
12761 declarations of protected types or protected objects.
12762
12763 @node No_Recursion,No_Reentrancy,No_Protected_Types,Partition-Wide Restrictions
12764 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-recursion}@anchor{1e4}
12765 @subsection No_Recursion
12766
12767
12768 @geindex No_Recursion
12769
12770 [RM H.4] A program execution is erroneous if a subprogram is invoked as
12771 part of its execution.
12772
12773 @node No_Reentrancy,No_Relative_Delay,No_Recursion,Partition-Wide Restrictions
12774 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-reentrancy}@anchor{1e5}
12775 @subsection No_Reentrancy
12776
12777
12778 @geindex No_Reentrancy
12779
12780 [RM H.4] A program execution is erroneous if a subprogram is executed by
12781 two tasks at the same time.
12782
12783 @node No_Relative_Delay,No_Requeue_Statements,No_Reentrancy,Partition-Wide Restrictions
12784 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-relative-delay}@anchor{1e6}
12785 @subsection No_Relative_Delay
12786
12787
12788 @geindex No_Relative_Delay
12789
12790 [RM D.7] This restriction ensures at compile time that there are no delay
12791 relative statements and prevents expressions such as @code{delay 1.23;} from
12792 appearing in source code.
12793
12794 @node No_Requeue_Statements,No_Secondary_Stack,No_Relative_Delay,Partition-Wide Restrictions
12795 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-requeue-statements}@anchor{1e7}
12796 @subsection No_Requeue_Statements
12797
12798
12799 @geindex No_Requeue_Statements
12800
12801 [RM D.7] This restriction ensures at compile time that no requeue statements
12802 are permitted and prevents keyword @code{requeue} from being used in source
12803 code.
12804
12805 @geindex No_Requeue
12806
12807 The restriction @code{No_Requeue} is recognized as a
12808 synonym for @code{No_Requeue_Statements}. This is retained for historical
12809 compatibility purposes (and a warning will be generated for its use if
12810 warnings on oNobsolescent features are activated).
12811
12812 @node No_Secondary_Stack,No_Select_Statements,No_Requeue_Statements,Partition-Wide Restrictions
12813 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-secondary-stack}@anchor{1e8}
12814 @subsection No_Secondary_Stack
12815
12816
12817 @geindex No_Secondary_Stack
12818
12819 [GNAT] This restriction ensures at compile time that the generated code
12820 does not contain any reference to the secondary stack. The secondary
12821 stack is used to implement functions returning unconstrained objects
12822 (arrays or records) on some targets. Suppresses the allocation of
12823 secondary stacks for tasks (excluding the environment task) at run time.
12824
12825 @node No_Select_Statements,No_Specific_Termination_Handlers,No_Secondary_Stack,Partition-Wide Restrictions
12826 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-select-statements}@anchor{1e9}
12827 @subsection No_Select_Statements
12828
12829
12830 @geindex No_Select_Statements
12831
12832 [RM D.7] This restriction ensures at compile time no select statements of any
12833 kind are permitted, that is the keyword @code{select} may not appear.
12834
12835 @node No_Specific_Termination_Handlers,No_Specification_of_Aspect,No_Select_Statements,Partition-Wide Restrictions
12836 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specific-termination-handlers}@anchor{1ea}
12837 @subsection No_Specific_Termination_Handlers
12838
12839
12840 @geindex No_Specific_Termination_Handlers
12841
12842 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
12843 or to Ada.Task_Termination.Specific_Handler.
12844
12845 @node No_Specification_of_Aspect,No_Standard_Allocators_After_Elaboration,No_Specific_Termination_Handlers,Partition-Wide Restrictions
12846 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-specification-of-aspect}@anchor{1eb}
12847 @subsection No_Specification_of_Aspect
12848
12849
12850 @geindex No_Specification_of_Aspect
12851
12852 [RM 13.12.1] This restriction checks at compile time that no aspect
12853 specification, attribute definition clause, or pragma is given for a
12854 given aspect.
12855
12856 @node No_Standard_Allocators_After_Elaboration,No_Standard_Storage_Pools,No_Specification_of_Aspect,Partition-Wide Restrictions
12857 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-allocators-after-elaboration}@anchor{1ec}
12858 @subsection No_Standard_Allocators_After_Elaboration
12859
12860
12861 @geindex No_Standard_Allocators_After_Elaboration
12862
12863 [RM D.7] Specifies that an allocator using a standard storage pool
12864 should never be evaluated at run time after the elaboration of the
12865 library items of the partition has completed. Otherwise, Storage_Error
12866 is raised.
12867
12868 @node No_Standard_Storage_Pools,No_Stream_Optimizations,No_Standard_Allocators_After_Elaboration,Partition-Wide Restrictions
12869 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-standard-storage-pools}@anchor{1ed}
12870 @subsection No_Standard_Storage_Pools
12871
12872
12873 @geindex No_Standard_Storage_Pools
12874
12875 [GNAT] This restriction ensures at compile time that no access types
12876 use the standard default storage pool. Any access type declared must
12877 have an explicit Storage_Pool attribute defined specifying a
12878 user-defined storage pool.
12879
12880 @node No_Stream_Optimizations,No_Streams,No_Standard_Storage_Pools,Partition-Wide Restrictions
12881 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-stream-optimizations}@anchor{1ee}
12882 @subsection No_Stream_Optimizations
12883
12884
12885 @geindex No_Stream_Optimizations
12886
12887 [GNAT] This restriction affects the performance of stream operations on types
12888 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
12889 compiler uses block reads and writes when manipulating @code{String} objects
12890 due to their superior performance. When this restriction is in effect, the
12891 compiler performs all IO operations on a per-character basis.
12892
12893 @node No_Streams,No_Task_Allocators,No_Stream_Optimizations,Partition-Wide Restrictions
12894 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-streams}@anchor{1ef}
12895 @subsection No_Streams
12896
12897
12898 @geindex No_Streams
12899
12900 [GNAT] This restriction ensures at compile/bind time that there are no
12901 stream objects created and no use of stream attributes.
12902 This restriction does not forbid dependences on the package
12903 @code{Ada.Streams}. So it is permissible to with
12904 @code{Ada.Streams} (or another package that does so itself)
12905 as long as no actual stream objects are created and no
12906 stream attributes are used.
12907
12908 Note that the use of restriction allows optimization of tagged types,
12909 since they do not need to worry about dispatching stream operations.
12910 To take maximum advantage of this space-saving optimization, any
12911 unit declaring a tagged type should be compiled with the restriction,
12912 though this is not required.
12913
12914 @node No_Task_Allocators,No_Task_At_Interrupt_Priority,No_Streams,Partition-Wide Restrictions
12915 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-allocators}@anchor{1f0}
12916 @subsection No_Task_Allocators
12917
12918
12919 @geindex No_Task_Allocators
12920
12921 [RM D.7] There are no allocators for task types
12922 or types containing task subcomponents.
12923
12924 @node No_Task_At_Interrupt_Priority,No_Task_Attributes_Package,No_Task_Allocators,Partition-Wide Restrictions
12925 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-at-interrupt-priority}@anchor{1f1}
12926 @subsection No_Task_At_Interrupt_Priority
12927
12928
12929 @geindex No_Task_At_Interrupt_Priority
12930
12931 [GNAT] This restriction ensures at compile time that there is no
12932 Interrupt_Priority aspect or pragma for a task or a task type. As
12933 a consequence, the tasks are always created with a priority below
12934 that an interrupt priority.
12935
12936 @node No_Task_Attributes_Package,No_Task_Hierarchy,No_Task_At_Interrupt_Priority,Partition-Wide Restrictions
12937 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-attributes-package}@anchor{1f2}
12938 @subsection No_Task_Attributes_Package
12939
12940
12941 @geindex No_Task_Attributes_Package
12942
12943 [GNAT] This restriction ensures at compile time that there are no implicit or
12944 explicit dependencies on the package @code{Ada.Task_Attributes}.
12945
12946 @geindex No_Task_Attributes
12947
12948 The restriction @code{No_Task_Attributes} is recognized as a synonym
12949 for @code{No_Task_Attributes_Package}. This is retained for historical
12950 compatibility purposes (and a warning will be generated for its use if
12951 warnings on obsolescent features are activated).
12952
12953 @node No_Task_Hierarchy,No_Task_Termination,No_Task_Attributes_Package,Partition-Wide Restrictions
12954 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-hierarchy}@anchor{1f3}
12955 @subsection No_Task_Hierarchy
12956
12957
12958 @geindex No_Task_Hierarchy
12959
12960 [RM D.7] All (non-environment) tasks depend
12961 directly on the environment task of the partition.
12962
12963 @node No_Task_Termination,No_Tasking,No_Task_Hierarchy,Partition-Wide Restrictions
12964 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-task-termination}@anchor{1f4}
12965 @subsection No_Task_Termination
12966
12967
12968 @geindex No_Task_Termination
12969
12970 [RM D.7] Tasks that terminate are erroneous.
12971
12972 @node No_Tasking,No_Terminate_Alternatives,No_Task_Termination,Partition-Wide Restrictions
12973 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-tasking}@anchor{1f5}
12974 @subsection No_Tasking
12975
12976
12977 @geindex No_Tasking
12978
12979 [GNAT] This restriction prevents the declaration of tasks or task types
12980 throughout the partition. It is similar in effect to the use of
12981 @code{Max_Tasks => 0} except that violations are caught at compile time
12982 and cause an error message to be output either by the compiler or
12983 binder.
12984
12985 @node No_Terminate_Alternatives,No_Unchecked_Access,No_Tasking,Partition-Wide Restrictions
12986 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-terminate-alternatives}@anchor{1f6}
12987 @subsection No_Terminate_Alternatives
12988
12989
12990 @geindex No_Terminate_Alternatives
12991
12992 [RM D.7] There are no selective accepts with terminate alternatives.
12993
12994 @node No_Unchecked_Access,No_Unchecked_Conversion,No_Terminate_Alternatives,Partition-Wide Restrictions
12995 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-access}@anchor{1f7}
12996 @subsection No_Unchecked_Access
12997
12998
12999 @geindex No_Unchecked_Access
13000
13001 [RM H.4] This restriction ensures at compile time that there are no
13002 occurrences of the Unchecked_Access attribute.
13003
13004 @node No_Unchecked_Conversion,No_Unchecked_Deallocation,No_Unchecked_Access,Partition-Wide Restrictions
13005 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-conversion}@anchor{1f8}
13006 @subsection No_Unchecked_Conversion
13007
13008
13009 @geindex No_Unchecked_Conversion
13010
13011 [RM J.13] This restriction ensures at compile time that there are no semantic
13012 dependences on the predefined generic function Unchecked_Conversion.
13013
13014 @node No_Unchecked_Deallocation,No_Use_Of_Entity,No_Unchecked_Conversion,Partition-Wide Restrictions
13015 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-unchecked-deallocation}@anchor{1f9}
13016 @subsection No_Unchecked_Deallocation
13017
13018
13019 @geindex No_Unchecked_Deallocation
13020
13021 [RM J.13] This restriction ensures at compile time that there are no semantic
13022 dependences on the predefined generic procedure Unchecked_Deallocation.
13023
13024 @node No_Use_Of_Entity,Pure_Barriers,No_Unchecked_Deallocation,Partition-Wide Restrictions
13025 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-use-of-entity}@anchor{1fa}
13026 @subsection No_Use_Of_Entity
13027
13028
13029 @geindex No_Use_Of_Entity
13030
13031 [GNAT] This restriction ensures at compile time that there are no references
13032 to the entity given in the form
13033
13034 @example
13035 No_Use_Of_Entity => Name
13036 @end example
13037
13038 where @code{Name} is the fully qualified entity, for example
13039
13040 @example
13041 No_Use_Of_Entity => Ada.Text_IO.Put_Line
13042 @end example
13043
13044 @node Pure_Barriers,Simple_Barriers,No_Use_Of_Entity,Partition-Wide Restrictions
13045 @anchor{gnat_rm/standard_and_implementation_defined_restrictions pure-barriers}@anchor{1fb}
13046 @subsection Pure_Barriers
13047
13048
13049 @geindex Pure_Barriers
13050
13051 [GNAT] This restriction ensures at compile time that protected entry
13052 barriers are restricted to:
13053
13054
13055 @itemize *
13056
13057 @item
13058 components of the protected object (excluding selection from dereferences),
13059
13060 @item
13061 constant declarations,
13062
13063 @item
13064 named numbers,
13065
13066 @item
13067 enumeration literals,
13068
13069 @item
13070 integer literals,
13071
13072 @item
13073 real literals,
13074
13075 @item
13076 character literals,
13077
13078 @item
13079 implicitly defined comparison operators,
13080
13081 @item
13082 uses of the Standard."not" operator,
13083
13084 @item
13085 short-circuit operator,
13086
13087 @item
13088 the Count attribute
13089 @end itemize
13090
13091 This restriction is a relaxation of the Simple_Barriers restriction,
13092 but still ensures absence of side effects, exceptions, and recursion
13093 during the evaluation of the barriers.
13094
13095 @node Simple_Barriers,Static_Priorities,Pure_Barriers,Partition-Wide Restrictions
13096 @anchor{gnat_rm/standard_and_implementation_defined_restrictions simple-barriers}@anchor{1fc}
13097 @subsection Simple_Barriers
13098
13099
13100 @geindex Simple_Barriers
13101
13102 [RM D.7] This restriction ensures at compile time that barriers in entry
13103 declarations for protected types are restricted to either static boolean
13104 expressions or references to simple boolean variables defined in the private
13105 part of the protected type. No other form of entry barriers is permitted.
13106
13107 @geindex Boolean_Entry_Barriers
13108
13109 The restriction @code{Boolean_Entry_Barriers} is recognized as a
13110 synonym for @code{Simple_Barriers}. This is retained for historical
13111 compatibility purposes (and a warning will be generated for its use if
13112 warnings on obsolescent features are activated).
13113
13114 @node Static_Priorities,Static_Storage_Size,Simple_Barriers,Partition-Wide Restrictions
13115 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-priorities}@anchor{1fd}
13116 @subsection Static_Priorities
13117
13118
13119 @geindex Static_Priorities
13120
13121 [GNAT] This restriction ensures at compile time that all priority expressions
13122 are static, and that there are no dependences on the package
13123 @code{Ada.Dynamic_Priorities}.
13124
13125 @node Static_Storage_Size,,Static_Priorities,Partition-Wide Restrictions
13126 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-storage-size}@anchor{1fe}
13127 @subsection Static_Storage_Size
13128
13129
13130 @geindex Static_Storage_Size
13131
13132 [GNAT] This restriction ensures at compile time that any expression appearing
13133 in a Storage_Size pragma or attribute definition clause is static.
13134
13135 @node Program Unit Level Restrictions,,Partition-Wide Restrictions,Standard and Implementation Defined Restrictions
13136 @anchor{gnat_rm/standard_and_implementation_defined_restrictions program-unit-level-restrictions}@anchor{1ff}@anchor{gnat_rm/standard_and_implementation_defined_restrictions id3}@anchor{200}
13137 @section Program Unit Level Restrictions
13138
13139
13140 The second set of restriction identifiers
13141 does not require partition-wide consistency.
13142 The restriction may be enforced for a single
13143 compilation unit without any effect on any of the
13144 other compilation units in the partition.
13145
13146 @menu
13147 * No_Elaboration_Code::
13148 * No_Dynamic_Sized_Objects::
13149 * No_Entry_Queue::
13150 * No_Implementation_Aspect_Specifications::
13151 * No_Implementation_Attributes::
13152 * No_Implementation_Identifiers::
13153 * No_Implementation_Pragmas::
13154 * No_Implementation_Restrictions::
13155 * No_Implementation_Units::
13156 * No_Implicit_Aliasing::
13157 * No_Implicit_Loops::
13158 * No_Obsolescent_Features::
13159 * No_Wide_Characters::
13160 * Static_Dispatch_Tables::
13161 * SPARK_05::
13162
13163 @end menu
13164
13165 @node No_Elaboration_Code,No_Dynamic_Sized_Objects,,Program Unit Level Restrictions
13166 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-elaboration-code}@anchor{201}
13167 @subsection No_Elaboration_Code
13168
13169
13170 @geindex No_Elaboration_Code
13171
13172 [GNAT] This restriction ensures at compile time that no elaboration code is
13173 generated. Note that this is not the same condition as is enforced
13174 by pragma @code{Preelaborate}. There are cases in which pragma
13175 @code{Preelaborate} still permits code to be generated (e.g., code
13176 to initialize a large array to all zeroes), and there are cases of units
13177 which do not meet the requirements for pragma @code{Preelaborate},
13178 but for which no elaboration code is generated. Generally, it is
13179 the case that preelaborable units will meet the restrictions, with
13180 the exception of large aggregates initialized with an others_clause,
13181 and exception declarations (which generate calls to a run-time
13182 registry procedure). This restriction is enforced on
13183 a unit by unit basis, it need not be obeyed consistently
13184 throughout a partition.
13185
13186 In the case of aggregates with others, if the aggregate has a dynamic
13187 size, there is no way to eliminate the elaboration code (such dynamic
13188 bounds would be incompatible with @code{Preelaborate} in any case). If
13189 the bounds are static, then use of this restriction actually modifies
13190 the code choice of the compiler to avoid generating a loop, and instead
13191 generate the aggregate statically if possible, no matter how many times
13192 the data for the others clause must be repeatedly generated.
13193
13194 It is not possible to precisely document
13195 the constructs which are compatible with this restriction, since,
13196 unlike most other restrictions, this is not a restriction on the
13197 source code, but a restriction on the generated object code. For
13198 example, if the source contains a declaration:
13199
13200 @example
13201 Val : constant Integer := X;
13202 @end example
13203
13204 where X is not a static constant, it may be possible, depending
13205 on complex optimization circuitry, for the compiler to figure
13206 out the value of X at compile time, in which case this initialization
13207 can be done by the loader, and requires no initialization code. It
13208 is not possible to document the precise conditions under which the
13209 optimizer can figure this out.
13210
13211 Note that this the implementation of this restriction requires full
13212 code generation. If it is used in conjunction with "semantics only"
13213 checking, then some cases of violations may be missed.
13214
13215 When this restriction is active, we are not requesting control-flow
13216 preservation with -fpreserve-control-flow, and the static elaboration model is
13217 used, the compiler is allowed to suppress the elaboration counter normally
13218 associated with the unit. This counter is typically used to check for access
13219 before elaboration and to control multiple elaboration attempts.
13220
13221 @node No_Dynamic_Sized_Objects,No_Entry_Queue,No_Elaboration_Code,Program Unit Level Restrictions
13222 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-dynamic-sized-objects}@anchor{202}
13223 @subsection No_Dynamic_Sized_Objects
13224
13225
13226 @geindex No_Dynamic_Sized_Objects
13227
13228 [GNAT] This restriction disallows certain constructs that might lead to the
13229 creation of dynamic-sized composite objects (or array or discriminated type).
13230 An array subtype indication is illegal if the bounds are not static
13231 or references to discriminants of an enclosing type.
13232 A discriminated subtype indication is illegal if the type has
13233 discriminant-dependent array components or a variant part, and the
13234 discriminants are not static. In addition, array and record aggregates are
13235 illegal in corresponding cases. Note that this restriction does not forbid
13236 access discriminants. It is often a good idea to combine this restriction
13237 with No_Secondary_Stack.
13238
13239 @node No_Entry_Queue,No_Implementation_Aspect_Specifications,No_Dynamic_Sized_Objects,Program Unit Level Restrictions
13240 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-entry-queue}@anchor{203}
13241 @subsection No_Entry_Queue
13242
13243
13244 @geindex No_Entry_Queue
13245
13246 [GNAT] This restriction is a declaration that any protected entry compiled in
13247 the scope of the restriction has at most one task waiting on the entry
13248 at any one time, and so no queue is required. This restriction is not
13249 checked at compile time. A program execution is erroneous if an attempt
13250 is made to queue a second task on such an entry.
13251
13252 @node No_Implementation_Aspect_Specifications,No_Implementation_Attributes,No_Entry_Queue,Program Unit Level Restrictions
13253 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-aspect-specifications}@anchor{204}
13254 @subsection No_Implementation_Aspect_Specifications
13255
13256
13257 @geindex No_Implementation_Aspect_Specifications
13258
13259 [RM 13.12.1] This restriction checks at compile time that no
13260 GNAT-defined aspects are present. With this restriction, the only
13261 aspects that can be used are those defined in the Ada Reference Manual.
13262
13263 @node No_Implementation_Attributes,No_Implementation_Identifiers,No_Implementation_Aspect_Specifications,Program Unit Level Restrictions
13264 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-attributes}@anchor{205}
13265 @subsection No_Implementation_Attributes
13266
13267
13268 @geindex No_Implementation_Attributes
13269
13270 [RM 13.12.1] This restriction checks at compile time that no
13271 GNAT-defined attributes are present. With this restriction, the only
13272 attributes that can be used are those defined in the Ada Reference
13273 Manual.
13274
13275 @node No_Implementation_Identifiers,No_Implementation_Pragmas,No_Implementation_Attributes,Program Unit Level Restrictions
13276 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-identifiers}@anchor{206}
13277 @subsection No_Implementation_Identifiers
13278
13279
13280 @geindex No_Implementation_Identifiers
13281
13282 [RM 13.12.1] This restriction checks at compile time that no
13283 implementation-defined identifiers (marked with pragma Implementation_Defined)
13284 occur within language-defined packages.
13285
13286 @node No_Implementation_Pragmas,No_Implementation_Restrictions,No_Implementation_Identifiers,Program Unit Level Restrictions
13287 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-pragmas}@anchor{207}
13288 @subsection No_Implementation_Pragmas
13289
13290
13291 @geindex No_Implementation_Pragmas
13292
13293 [RM 13.12.1] This restriction checks at compile time that no
13294 GNAT-defined pragmas are present. With this restriction, the only
13295 pragmas that can be used are those defined in the Ada Reference Manual.
13296
13297 @node No_Implementation_Restrictions,No_Implementation_Units,No_Implementation_Pragmas,Program Unit Level Restrictions
13298 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-restrictions}@anchor{208}
13299 @subsection No_Implementation_Restrictions
13300
13301
13302 @geindex No_Implementation_Restrictions
13303
13304 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
13305 identifiers (other than @code{No_Implementation_Restrictions} itself)
13306 are present. With this restriction, the only other restriction identifiers
13307 that can be used are those defined in the Ada Reference Manual.
13308
13309 @node No_Implementation_Units,No_Implicit_Aliasing,No_Implementation_Restrictions,Program Unit Level Restrictions
13310 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implementation-units}@anchor{209}
13311 @subsection No_Implementation_Units
13312
13313
13314 @geindex No_Implementation_Units
13315
13316 [RM 13.12.1] This restriction checks at compile time that there is no
13317 mention in the context clause of any implementation-defined descendants
13318 of packages Ada, Interfaces, or System.
13319
13320 @node No_Implicit_Aliasing,No_Implicit_Loops,No_Implementation_Units,Program Unit Level Restrictions
13321 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-aliasing}@anchor{20a}
13322 @subsection No_Implicit_Aliasing
13323
13324
13325 @geindex No_Implicit_Aliasing
13326
13327 [GNAT] This restriction, which is not required to be partition-wide consistent,
13328 requires an explicit aliased keyword for an object to which 'Access,
13329 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
13330 the 'Unrestricted_Access attribute for objects. Note: the reason that
13331 Unrestricted_Access is forbidden is that it would require the prefix
13332 to be aliased, and in such cases, it can always be replaced by
13333 the standard attribute Unchecked_Access which is preferable.
13334
13335 @node No_Implicit_Loops,No_Obsolescent_Features,No_Implicit_Aliasing,Program Unit Level Restrictions
13336 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-implicit-loops}@anchor{20b}
13337 @subsection No_Implicit_Loops
13338
13339
13340 @geindex No_Implicit_Loops
13341
13342 [GNAT] This restriction ensures that the generated code of the unit marked
13343 with this restriction does not contain any implicit @code{for} loops, either by
13344 modifying the generated code where possible, or by rejecting any construct
13345 that would otherwise generate an implicit @code{for} loop. If this restriction is
13346 active, it is possible to build large array aggregates with all static
13347 components without generating an intermediate temporary, and without generating
13348 a loop to initialize individual components. Otherwise, a loop is created for
13349 arrays larger than about 5000 scalar components. Note that if this restriction
13350 is set in the spec of a package, it will not apply to its body.
13351
13352 @node No_Obsolescent_Features,No_Wide_Characters,No_Implicit_Loops,Program Unit Level Restrictions
13353 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-obsolescent-features}@anchor{20c}
13354 @subsection No_Obsolescent_Features
13355
13356
13357 @geindex No_Obsolescent_Features
13358
13359 [RM 13.12.1] This restriction checks at compile time that no obsolescent
13360 features are used, as defined in Annex J of the Ada Reference Manual.
13361
13362 @node No_Wide_Characters,Static_Dispatch_Tables,No_Obsolescent_Features,Program Unit Level Restrictions
13363 @anchor{gnat_rm/standard_and_implementation_defined_restrictions no-wide-characters}@anchor{20d}
13364 @subsection No_Wide_Characters
13365
13366
13367 @geindex No_Wide_Characters
13368
13369 [GNAT] This restriction ensures at compile time that no uses of the types
13370 @code{Wide_Character} or @code{Wide_String} or corresponding wide
13371 wide types
13372 appear, and that no wide or wide wide string or character literals
13373 appear in the program (that is literals representing characters not in
13374 type @code{Character}).
13375
13376 @node Static_Dispatch_Tables,SPARK_05,No_Wide_Characters,Program Unit Level Restrictions
13377 @anchor{gnat_rm/standard_and_implementation_defined_restrictions static-dispatch-tables}@anchor{20e}
13378 @subsection Static_Dispatch_Tables
13379
13380
13381 @geindex Static_Dispatch_Tables
13382
13383 [GNAT] This restriction checks at compile time that all the artifacts
13384 associated with dispatch tables can be placed in read-only memory.
13385
13386 @node SPARK_05,,Static_Dispatch_Tables,Program Unit Level Restrictions
13387 @anchor{gnat_rm/standard_and_implementation_defined_restrictions spark-05}@anchor{20f}
13388 @subsection SPARK_05
13389
13390
13391 @geindex SPARK_05
13392
13393 [GNAT] This restriction checks at compile time that some constructs forbidden
13394 in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
13395 SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
13396 a codebase respects SPARK 2014 restrictions, mark the code with pragma or
13397 aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
13398 follows:
13399
13400 @example
13401 gnatprove -P project.gpr --mode=stone
13402 @end example
13403
13404 or equivalently:
13405
13406 @example
13407 gnatprove -P project.gpr --mode=check_all
13408 @end example
13409
13410 With restriction @code{SPARK_05}, error messages related to SPARK 2005 restriction
13411 have the form:
13412
13413 @example
13414 violation of restriction "SPARK_05" at <source-location>
13415 <error message>
13416 @end example
13417
13418 @geindex SPARK
13419
13420 The restriction @code{SPARK} is recognized as a synonym for @code{SPARK_05}. This is
13421 retained for historical compatibility purposes (and an unconditional warning
13422 will be generated for its use, advising replacement by @code{SPARK_05}).
13423
13424 This is not a replacement for the semantic checks performed by the
13425 SPARK Examiner tool, as the compiler currently only deals with code,
13426 not SPARK 2005 annotations, and does not guarantee catching all
13427 cases of constructs forbidden by SPARK 2005.
13428
13429 Thus it may well be the case that code which passes the compiler with
13430 the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
13431 the different visibility rules of the Examiner based on SPARK 2005
13432 @code{inherit} annotations.
13433
13434 This restriction can be useful in providing an initial filter for code
13435 developed using SPARK 2005, or in examining legacy code to see how far
13436 it is from meeting SPARK 2005 restrictions.
13437
13438 The list below summarizes the checks that are performed when this
13439 restriction is in force:
13440
13441
13442 @itemize *
13443
13444 @item
13445 No block statements
13446
13447 @item
13448 No case statements with only an others clause
13449
13450 @item
13451 Exit statements in loops must respect the SPARK 2005 language restrictions
13452
13453 @item
13454 No goto statements
13455
13456 @item
13457 Return can only appear as last statement in function
13458
13459 @item
13460 Function must have return statement
13461
13462 @item
13463 Loop parameter specification must include subtype mark
13464
13465 @item
13466 Prefix of expanded name cannot be a loop statement
13467
13468 @item
13469 Abstract subprogram not allowed
13470
13471 @item
13472 User-defined operators not allowed
13473
13474 @item
13475 Access type parameters not allowed
13476
13477 @item
13478 Default expressions for parameters not allowed
13479
13480 @item
13481 Default expressions for record fields not allowed
13482
13483 @item
13484 No tasking constructs allowed
13485
13486 @item
13487 Label needed at end of subprograms and packages
13488
13489 @item
13490 No mixing of positional and named parameter association
13491
13492 @item
13493 No access types as result type
13494
13495 @item
13496 No unconstrained arrays as result types
13497
13498 @item
13499 No null procedures
13500
13501 @item
13502 Initial and later declarations must be in correct order (declaration can't come after body)
13503
13504 @item
13505 No attributes on private types if full declaration not visible
13506
13507 @item
13508 No package declaration within package specification
13509
13510 @item
13511 No controlled types
13512
13513 @item
13514 No discriminant types
13515
13516 @item
13517 No overloading
13518
13519 @item
13520 Selector name cannot be operator symbol (i.e. operator symbol cannot be prefixed)
13521
13522 @item
13523 Access attribute not allowed
13524
13525 @item
13526 Allocator not allowed
13527
13528 @item
13529 Result of catenation must be String
13530
13531 @item
13532 Operands of catenation must be string literal, static char or another catenation
13533
13534 @item
13535 No conditional expressions
13536
13537 @item
13538 No explicit dereference
13539
13540 @item
13541 Quantified expression not allowed
13542
13543 @item
13544 Slicing not allowed
13545
13546 @item
13547 No exception renaming
13548
13549 @item
13550 No generic renaming
13551
13552 @item
13553 No object renaming
13554
13555 @item
13556 No use clause
13557
13558 @item
13559 Aggregates must be qualified
13560
13561 @item
13562 Nonstatic choice in array aggregates not allowed
13563
13564 @item
13565 The only view conversions which are allowed as in-out parameters are conversions of a tagged type to an ancestor type
13566
13567 @item
13568 No mixing of positional and named association in aggregate, no multi choice
13569
13570 @item
13571 AND, OR and XOR for arrays only allowed when operands have same static bounds
13572
13573 @item
13574 Fixed point operands to * or / must be qualified or converted
13575
13576 @item
13577 Comparison operators not allowed for Booleans or arrays (except strings)
13578
13579 @item
13580 Equality not allowed for arrays with non-matching static bounds (except strings)
13581
13582 @item
13583 Conversion / qualification not allowed for arrays with non-matching static bounds
13584
13585 @item
13586 Subprogram declaration only allowed in package spec (unless followed by import)
13587
13588 @item
13589 Access types not allowed
13590
13591 @item
13592 Incomplete type declaration not allowed
13593
13594 @item
13595 Object and subtype declarations must respect SPARK 2005 restrictions
13596
13597 @item
13598 Digits or delta constraint not allowed
13599
13600 @item
13601 Decimal fixed point type not allowed
13602
13603 @item
13604 Aliasing of objects not allowed
13605
13606 @item
13607 Modular type modulus must be power of 2
13608
13609 @item
13610 Base not allowed on subtype mark
13611
13612 @item
13613 Unary operators not allowed on modular types (except not)
13614
13615 @item
13616 Untagged record cannot be null
13617
13618 @item
13619 No class-wide operations
13620
13621 @item
13622 Initialization expressions must respect SPARK 2005 restrictions
13623
13624 @item
13625 Nonstatic ranges not allowed except in iteration schemes
13626
13627 @item
13628 String subtypes must have lower bound of 1
13629
13630 @item
13631 Subtype of Boolean cannot have constraint
13632
13633 @item
13634 At most one tagged type or extension per package
13635
13636 @item
13637 Interface is not allowed
13638
13639 @item
13640 Character literal cannot be prefixed (selector name cannot be character literal)
13641
13642 @item
13643 Record aggregate cannot contain 'others'
13644
13645 @item
13646 Component association in record aggregate must contain a single choice
13647
13648 @item
13649 Ancestor part cannot be a type mark
13650
13651 @item
13652 Attributes 'Image, 'Width and 'Value not allowed
13653
13654 @item
13655 Functions may not update globals
13656
13657 @item
13658 Subprograms may not contain direct calls to themselves (prevents recursion within unit)
13659
13660 @item
13661 Call to subprogram not allowed in same unit before body has been seen (prevents recursion within unit)
13662 @end itemize
13663
13664 The following restrictions are enforced, but note that they are actually more
13665 strict that the latest SPARK 2005 language definition:
13666
13667
13668 @itemize *
13669
13670 @item
13671 No derived types other than tagged type extensions
13672
13673 @item
13674 Subtype of unconstrained array must have constraint
13675 @end itemize
13676
13677 This list summarises the main SPARK 2005 language rules that are not
13678 currently checked by the SPARK_05 restriction:
13679
13680
13681 @itemize *
13682
13683 @item
13684 SPARK 2005 annotations are treated as comments so are not checked at all
13685
13686 @item
13687 Based real literals not allowed
13688
13689 @item
13690 Objects cannot be initialized at declaration by calls to user-defined functions
13691
13692 @item
13693 Objects cannot be initialized at declaration by assignments from variables
13694
13695 @item
13696 Objects cannot be initialized at declaration by assignments from indexed/selected components
13697
13698 @item
13699 Ranges shall not be null
13700
13701 @item
13702 A fixed point delta expression must be a simple expression
13703
13704 @item
13705 Restrictions on where renaming declarations may be placed
13706
13707 @item
13708 Externals of mode 'out' cannot be referenced
13709
13710 @item
13711 Externals of mode 'in' cannot be updated
13712
13713 @item
13714 Loop with no iteration scheme or exits only allowed as last statement in main program or task
13715
13716 @item
13717 Subprogram cannot have parent unit name
13718
13719 @item
13720 SPARK 2005 inherited subprogram must be prefixed with overriding
13721
13722 @item
13723 External variables (or functions that reference them) may not be passed as actual parameters
13724
13725 @item
13726 Globals must be explicitly mentioned in contract
13727
13728 @item
13729 Deferred constants cannot be completed by pragma Import
13730
13731 @item
13732 Package initialization cannot read/write variables from other packages
13733
13734 @item
13735 Prefix not allowed for entities that are directly visible
13736
13737 @item
13738 Identifier declaration can't override inherited package name
13739
13740 @item
13741 Cannot use Standard or other predefined packages as identifiers
13742
13743 @item
13744 After renaming, cannot use the original name
13745
13746 @item
13747 Subprograms can only be renamed to remove package prefix
13748
13749 @item
13750 Pragma import must be immediately after entity it names
13751
13752 @item
13753 No mutual recursion between multiple units (this can be checked with gnatcheck)
13754 @end itemize
13755
13756 Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
13757 violations will be reported for constructs forbidden in SPARK 95,
13758 instead of SPARK 2005.
13759
13760 @node Implementation Advice,Implementation Defined Characteristics,Standard and Implementation Defined Restrictions,Top
13761 @anchor{gnat_rm/implementation_advice doc}@anchor{210}@anchor{gnat_rm/implementation_advice implementation-advice}@anchor{a}@anchor{gnat_rm/implementation_advice id1}@anchor{211}
13762 @chapter Implementation Advice
13763
13764
13765 The main text of the Ada Reference Manual describes the required
13766 behavior of all Ada compilers, and the GNAT compiler conforms to
13767 these requirements.
13768
13769 In addition, there are sections throughout the Ada Reference Manual headed
13770 by the phrase 'Implementation advice'. These sections are not normative,
13771 i.e., they do not specify requirements that all compilers must
13772 follow. Rather they provide advice on generally desirable behavior.
13773 They are not requirements, because they describe behavior that cannot
13774 be provided on all systems, or may be undesirable on some systems.
13775
13776 As far as practical, GNAT follows the implementation advice in
13777 the Ada Reference Manual. Each such RM section corresponds to a section
13778 in this chapter whose title specifies the
13779 RM section number and paragraph number and the subject of
13780 the advice. The contents of each section consists of the RM text within
13781 quotation marks,
13782 followed by the GNAT interpretation of the advice. Most often, this simply says
13783 'followed', which means that GNAT follows the advice. However, in a
13784 number of cases, GNAT deliberately deviates from this advice, in which
13785 case the text describes what GNAT does and why.
13786
13787 @geindex Error detection
13788
13789 @menu
13790 * RM 1.1.3(20); Error Detection: RM 1 1 3 20 Error Detection.
13791 * RM 1.1.3(31); Child Units: RM 1 1 3 31 Child Units.
13792 * RM 1.1.5(12); Bounded Errors: RM 1 1 5 12 Bounded Errors.
13793 * RM 2.8(16); Pragmas: RM 2 8 16 Pragmas.
13794 * RM 2.8(17-19); Pragmas: RM 2 8 17-19 Pragmas.
13795 * RM 3.5.2(5); Alternative Character Sets: RM 3 5 2 5 Alternative Character Sets.
13796 * RM 3.5.4(28); Integer Types: RM 3 5 4 28 Integer Types.
13797 * RM 3.5.4(29); Integer Types: RM 3 5 4 29 Integer Types.
13798 * RM 3.5.5(8); Enumeration Values: RM 3 5 5 8 Enumeration Values.
13799 * RM 3.5.7(17); Float Types: RM 3 5 7 17 Float Types.
13800 * RM 3.6.2(11); Multidimensional Arrays: RM 3 6 2 11 Multidimensional Arrays.
13801 * RM 9.6(30-31); Duration'Small: RM 9 6 30-31 Duration'Small.
13802 * RM 10.2.1(12); Consistent Representation: RM 10 2 1 12 Consistent Representation.
13803 * RM 11.4.1(19); Exception Information: RM 11 4 1 19 Exception Information.
13804 * RM 11.5(28); Suppression of Checks: RM 11 5 28 Suppression of Checks.
13805 * RM 13.1 (21-24); Representation Clauses: RM 13 1 21-24 Representation Clauses.
13806 * RM 13.2(6-8); Packed Types: RM 13 2 6-8 Packed Types.
13807 * RM 13.3(14-19); Address Clauses: RM 13 3 14-19 Address Clauses.
13808 * RM 13.3(29-35); Alignment Clauses: RM 13 3 29-35 Alignment Clauses.
13809 * RM 13.3(42-43); Size Clauses: RM 13 3 42-43 Size Clauses.
13810 * RM 13.3(50-56); Size Clauses: RM 13 3 50-56 Size Clauses.
13811 * RM 13.3(71-73); Component Size Clauses: RM 13 3 71-73 Component Size Clauses.
13812 * RM 13.4(9-10); Enumeration Representation Clauses: RM 13 4 9-10 Enumeration Representation Clauses.
13813 * RM 13.5.1(17-22); Record Representation Clauses: RM 13 5 1 17-22 Record Representation Clauses.
13814 * RM 13.5.2(5); Storage Place Attributes: RM 13 5 2 5 Storage Place Attributes.
13815 * RM 13.5.3(7-8); Bit Ordering: RM 13 5 3 7-8 Bit Ordering.
13816 * RM 13.7(37); Address as Private: RM 13 7 37 Address as Private.
13817 * RM 13.7.1(16); Address Operations: RM 13 7 1 16 Address Operations.
13818 * RM 13.9(14-17); Unchecked Conversion: RM 13 9 14-17 Unchecked Conversion.
13819 * RM 13.11(23-25); Implicit Heap Usage: RM 13 11 23-25 Implicit Heap Usage.
13820 * RM 13.11.2(17); Unchecked Deallocation: RM 13 11 2 17 Unchecked Deallocation.
13821 * RM 13.13.2(17); Stream Oriented Attributes: RM 13 13 2 17 Stream Oriented Attributes.
13822 * RM A.1(52); Names of Predefined Numeric Types: RM A 1 52 Names of Predefined Numeric Types.
13823 * RM A.3.2(49); Ada.Characters.Handling: RM A 3 2 49 Ada Characters Handling.
13824 * RM A.4.4(106); Bounded-Length String Handling: RM A 4 4 106 Bounded-Length String Handling.
13825 * RM A.5.2(46-47); Random Number Generation: RM A 5 2 46-47 Random Number Generation.
13826 * RM A.10.7(23); Get_Immediate: RM A 10 7 23 Get_Immediate.
13827 * RM B.1(39-41); Pragma Export: RM B 1 39-41 Pragma Export.
13828 * RM B.2(12-13); Package Interfaces: RM B 2 12-13 Package Interfaces.
13829 * RM B.3(63-71); Interfacing with C: RM B 3 63-71 Interfacing with C.
13830 * RM B.4(95-98); Interfacing with COBOL: RM B 4 95-98 Interfacing with COBOL.
13831 * RM B.5(22-26); Interfacing with Fortran: RM B 5 22-26 Interfacing with Fortran.
13832 * RM C.1(3-5); Access to Machine Operations: RM C 1 3-5 Access to Machine Operations.
13833 * RM C.1(10-16); Access to Machine Operations: RM C 1 10-16 Access to Machine Operations.
13834 * RM C.3(28); Interrupt Support: RM C 3 28 Interrupt Support.
13835 * RM C.3.1(20-21); Protected Procedure Handlers: RM C 3 1 20-21 Protected Procedure Handlers.
13836 * RM C.3.2(25); Package Interrupts: RM C 3 2 25 Package Interrupts.
13837 * RM C.4(14); Pre-elaboration Requirements: RM C 4 14 Pre-elaboration Requirements.
13838 * RM C.5(8); Pragma Discard_Names: RM C 5 8 Pragma Discard_Names.
13839 * RM C.7.2(30); The Package Task_Attributes: RM C 7 2 30 The Package Task_Attributes.
13840 * RM D.3(17); Locking Policies: RM D 3 17 Locking Policies.
13841 * RM D.4(16); Entry Queuing Policies: RM D 4 16 Entry Queuing Policies.
13842 * RM D.6(9-10); Preemptive Abort: RM D 6 9-10 Preemptive Abort.
13843 * RM D.7(21); Tasking Restrictions: RM D 7 21 Tasking Restrictions.
13844 * RM D.8(47-49); Monotonic Time: RM D 8 47-49 Monotonic Time.
13845 * RM E.5(28-29); Partition Communication Subsystem: RM E 5 28-29 Partition Communication Subsystem.
13846 * RM F(7); COBOL Support: RM F 7 COBOL Support.
13847 * RM F.1(2); Decimal Radix Support: RM F 1 2 Decimal Radix Support.
13848 * RM G; Numerics: RM G Numerics.
13849 * RM G.1.1(56-58); Complex Types: RM G 1 1 56-58 Complex Types.
13850 * RM G.1.2(49); Complex Elementary Functions: RM G 1 2 49 Complex Elementary Functions.
13851 * RM G.2.4(19); Accuracy Requirements: RM G 2 4 19 Accuracy Requirements.
13852 * RM G.2.6(15); Complex Arithmetic Accuracy: RM G 2 6 15 Complex Arithmetic Accuracy.
13853 * RM H.6(15/2); Pragma Partition_Elaboration_Policy: RM H 6 15/2 Pragma Partition_Elaboration_Policy.
13854
13855 @end menu
13856
13857 @node RM 1 1 3 20 Error Detection,RM 1 1 3 31 Child Units,,Implementation Advice
13858 @anchor{gnat_rm/implementation_advice rm-1-1-3-20-error-detection}@anchor{212}
13859 @section RM 1.1.3(20): Error Detection
13860
13861
13862 @quotation
13863
13864 "If an implementation detects the use of an unsupported Specialized Needs
13865 Annex feature at run time, it should raise @code{Program_Error} if
13866 feasible."
13867 @end quotation
13868
13869 Not relevant. All specialized needs annex features are either supported,
13870 or diagnosed at compile time.
13871
13872 @geindex Child Units
13873
13874 @node RM 1 1 3 31 Child Units,RM 1 1 5 12 Bounded Errors,RM 1 1 3 20 Error Detection,Implementation Advice
13875 @anchor{gnat_rm/implementation_advice rm-1-1-3-31-child-units}@anchor{213}
13876 @section RM 1.1.3(31): Child Units
13877
13878
13879 @quotation
13880
13881 "If an implementation wishes to provide implementation-defined
13882 extensions to the functionality of a language-defined library unit, it
13883 should normally do so by adding children to the library unit."
13884 @end quotation
13885
13886 Followed.
13887
13888 @geindex Bounded errors
13889
13890 @node RM 1 1 5 12 Bounded Errors,RM 2 8 16 Pragmas,RM 1 1 3 31 Child Units,Implementation Advice
13891 @anchor{gnat_rm/implementation_advice rm-1-1-5-12-bounded-errors}@anchor{214}
13892 @section RM 1.1.5(12): Bounded Errors
13893
13894
13895 @quotation
13896
13897 "If an implementation detects a bounded error or erroneous
13898 execution, it should raise @code{Program_Error}."
13899 @end quotation
13900
13901 Followed in all cases in which the implementation detects a bounded
13902 error or erroneous execution. Not all such situations are detected at
13903 runtime.
13904
13905 @geindex Pragmas
13906
13907 @node RM 2 8 16 Pragmas,RM 2 8 17-19 Pragmas,RM 1 1 5 12 Bounded Errors,Implementation Advice
13908 @anchor{gnat_rm/implementation_advice id2}@anchor{215}@anchor{gnat_rm/implementation_advice rm-2-8-16-pragmas}@anchor{216}
13909 @section RM 2.8(16): Pragmas
13910
13911
13912 @quotation
13913
13914 "Normally, implementation-defined pragmas should have no semantic effect
13915 for error-free programs; that is, if the implementation-defined pragmas
13916 are removed from a working program, the program should still be legal,
13917 and should still have the same semantics."
13918 @end quotation
13919
13920 The following implementation defined pragmas are exceptions to this
13921 rule:
13922
13923
13924 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxx}
13925 @headitem
13926
13927 Pragma
13928
13929 @tab
13930
13931 Explanation
13932
13933 @item
13934
13935 @emph{Abort_Defer}
13936
13937 @tab
13938
13939 Affects semantics
13940
13941 @item
13942
13943 @emph{Ada_83}
13944
13945 @tab
13946
13947 Affects legality
13948
13949 @item
13950
13951 @emph{Assert}
13952
13953 @tab
13954
13955 Affects semantics
13956
13957 @item
13958
13959 @emph{CPP_Class}
13960
13961 @tab
13962
13963 Affects semantics
13964
13965 @item
13966
13967 @emph{CPP_Constructor}
13968
13969 @tab
13970
13971 Affects semantics
13972
13973 @item
13974
13975 @emph{Debug}
13976
13977 @tab
13978
13979 Affects semantics
13980
13981 @item
13982
13983 @emph{Interface_Name}
13984
13985 @tab
13986
13987 Affects semantics
13988
13989 @item
13990
13991 @emph{Machine_Attribute}
13992
13993 @tab
13994
13995 Affects semantics
13996
13997 @item
13998
13999 @emph{Unimplemented_Unit}
14000
14001 @tab
14002
14003 Affects legality
14004
14005 @item
14006
14007 @emph{Unchecked_Union}
14008
14009 @tab
14010
14011 Affects semantics
14012
14013 @end multitable
14014
14015
14016 In each of the above cases, it is essential to the purpose of the pragma
14017 that this advice not be followed. For details see
14018 @ref{7,,Implementation Defined Pragmas}.
14019
14020 @node RM 2 8 17-19 Pragmas,RM 3 5 2 5 Alternative Character Sets,RM 2 8 16 Pragmas,Implementation Advice
14021 @anchor{gnat_rm/implementation_advice rm-2-8-17-19-pragmas}@anchor{217}
14022 @section RM 2.8(17-19): Pragmas
14023
14024
14025 @quotation
14026
14027 "Normally, an implementation should not define pragmas that can
14028 make an illegal program legal, except as follows:
14029
14030
14031 @itemize *
14032
14033 @item
14034 A pragma used to complete a declaration, such as a pragma @code{Import};
14035
14036 @item
14037 A pragma used to configure the environment by adding, removing, or
14038 replacing @code{library_items}."
14039 @end itemize
14040 @end quotation
14041
14042 See @ref{216,,RM 2.8(16); Pragmas}.
14043
14044 @geindex Character Sets
14045
14046 @geindex Alternative Character Sets
14047
14048 @node RM 3 5 2 5 Alternative Character Sets,RM 3 5 4 28 Integer Types,RM 2 8 17-19 Pragmas,Implementation Advice
14049 @anchor{gnat_rm/implementation_advice rm-3-5-2-5-alternative-character-sets}@anchor{218}
14050 @section RM 3.5.2(5): Alternative Character Sets
14051
14052
14053 @quotation
14054
14055 "If an implementation supports a mode with alternative interpretations
14056 for @code{Character} and @code{Wide_Character}, the set of graphic
14057 characters of @code{Character} should nevertheless remain a proper
14058 subset of the set of graphic characters of @code{Wide_Character}. Any
14059 character set 'localizations' should be reflected in the results of
14060 the subprograms defined in the language-defined package
14061 @code{Characters.Handling} (see A.3) available in such a mode. In a mode with
14062 an alternative interpretation of @code{Character}, the implementation should
14063 also support a corresponding change in what is a legal
14064 @code{identifier_letter}."
14065 @end quotation
14066
14067 Not all wide character modes follow this advice, in particular the JIS
14068 and IEC modes reflect standard usage in Japan, and in these encoding,
14069 the upper half of the Latin-1 set is not part of the wide-character
14070 subset, since the most significant bit is used for wide character
14071 encoding. However, this only applies to the external forms. Internally
14072 there is no such restriction.
14073
14074 @geindex Integer types
14075
14076 @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
14077 @anchor{gnat_rm/implementation_advice rm-3-5-4-28-integer-types}@anchor{219}
14078 @section RM 3.5.4(28): Integer Types
14079
14080
14081 @quotation
14082
14083 "An implementation should support @code{Long_Integer} in addition to
14084 @code{Integer} if the target machine supports 32-bit (or longer)
14085 arithmetic. No other named integer subtypes are recommended for package
14086 @code{Standard}. Instead, appropriate named integer subtypes should be
14087 provided in the library package @code{Interfaces} (see B.2)."
14088 @end quotation
14089
14090 @code{Long_Integer} is supported. Other standard integer types are supported
14091 so this advice is not fully followed. These types
14092 are supported for convenient interface to C, and so that all hardware
14093 types of the machine are easily available.
14094
14095 @node RM 3 5 4 29 Integer Types,RM 3 5 5 8 Enumeration Values,RM 3 5 4 28 Integer Types,Implementation Advice
14096 @anchor{gnat_rm/implementation_advice rm-3-5-4-29-integer-types}@anchor{21a}
14097 @section RM 3.5.4(29): Integer Types
14098
14099
14100 @quotation
14101
14102 "An implementation for a two's complement machine should support
14103 modular types with a binary modulus up to @code{System.Max_Int*2+2}. An
14104 implementation should support a non-binary modules up to @code{Integer'Last}."
14105 @end quotation
14106
14107 Followed.
14108
14109 @geindex Enumeration values
14110
14111 @node RM 3 5 5 8 Enumeration Values,RM 3 5 7 17 Float Types,RM 3 5 4 29 Integer Types,Implementation Advice
14112 @anchor{gnat_rm/implementation_advice rm-3-5-5-8-enumeration-values}@anchor{21b}
14113 @section RM 3.5.5(8): Enumeration Values
14114
14115
14116 @quotation
14117
14118 "For the evaluation of a call on @code{S'Pos} for an enumeration
14119 subtype, if the value of the operand does not correspond to the internal
14120 code for any enumeration literal of its type (perhaps due to an
14121 un-initialized variable), then the implementation should raise
14122 @code{Program_Error}. This is particularly important for enumeration
14123 types with noncontiguous internal codes specified by an
14124 enumeration_representation_clause."
14125 @end quotation
14126
14127 Followed.
14128
14129 @geindex Float types
14130
14131 @node RM 3 5 7 17 Float Types,RM 3 6 2 11 Multidimensional Arrays,RM 3 5 5 8 Enumeration Values,Implementation Advice
14132 @anchor{gnat_rm/implementation_advice rm-3-5-7-17-float-types}@anchor{21c}
14133 @section RM 3.5.7(17): Float Types
14134
14135
14136 @quotation
14137
14138 "An implementation should support @code{Long_Float} in addition to
14139 @code{Float} if the target machine supports 11 or more digits of
14140 precision. No other named floating point subtypes are recommended for
14141 package @code{Standard}. Instead, appropriate named floating point subtypes
14142 should be provided in the library package @code{Interfaces} (see B.2)."
14143 @end quotation
14144
14145 @code{Short_Float} and @code{Long_Long_Float} are also provided. The
14146 former provides improved compatibility with other implementations
14147 supporting this type. The latter corresponds to the highest precision
14148 floating-point type supported by the hardware. On most machines, this
14149 will be the same as @code{Long_Float}, but on some machines, it will
14150 correspond to the IEEE extended form. The notable case is all ia32
14151 (x86) implementations, where @code{Long_Long_Float} corresponds to
14152 the 80-bit extended precision format supported in hardware on this
14153 processor. Note that the 128-bit format on SPARC is not supported,
14154 since this is a software rather than a hardware format.
14155
14156 @geindex Multidimensional arrays
14157
14158 @geindex Arrays
14159 @geindex multidimensional
14160
14161 @node RM 3 6 2 11 Multidimensional Arrays,RM 9 6 30-31 Duration'Small,RM 3 5 7 17 Float Types,Implementation Advice
14162 @anchor{gnat_rm/implementation_advice rm-3-6-2-11-multidimensional-arrays}@anchor{21d}
14163 @section RM 3.6.2(11): Multidimensional Arrays
14164
14165
14166 @quotation
14167
14168 "An implementation should normally represent multidimensional arrays in
14169 row-major order, consistent with the notation used for multidimensional
14170 array aggregates (see 4.3.3). However, if a pragma @code{Convention}
14171 (@code{Fortran}, ...) applies to a multidimensional array type, then
14172 column-major order should be used instead (see B.5, @emph{Interfacing with Fortran})."
14173 @end quotation
14174
14175 Followed.
14176
14177 @geindex Duration'Small
14178
14179 @node RM 9 6 30-31 Duration'Small,RM 10 2 1 12 Consistent Representation,RM 3 6 2 11 Multidimensional Arrays,Implementation Advice
14180 @anchor{gnat_rm/implementation_advice rm-9-6-30-31-duration-small}@anchor{21e}
14181 @section RM 9.6(30-31): Duration'Small
14182
14183
14184 @quotation
14185
14186 "Whenever possible in an implementation, the value of @code{Duration'Small}
14187 should be no greater than 100 microseconds."
14188 @end quotation
14189
14190 Followed. (@code{Duration'Small} = 10**(-9)).
14191
14192 @quotation
14193
14194 "The time base for @code{delay_relative_statements} should be monotonic;
14195 it need not be the same time base as used for @code{Calendar.Clock}."
14196 @end quotation
14197
14198 Followed.
14199
14200 @node RM 10 2 1 12 Consistent Representation,RM 11 4 1 19 Exception Information,RM 9 6 30-31 Duration'Small,Implementation Advice
14201 @anchor{gnat_rm/implementation_advice rm-10-2-1-12-consistent-representation}@anchor{21f}
14202 @section RM 10.2.1(12): Consistent Representation
14203
14204
14205 @quotation
14206
14207 "In an implementation, a type declared in a pre-elaborated package should
14208 have the same representation in every elaboration of a given version of
14209 the package, whether the elaborations occur in distinct executions of
14210 the same program, or in executions of distinct programs or partitions
14211 that include the given version."
14212 @end quotation
14213
14214 Followed, except in the case of tagged types. Tagged types involve
14215 implicit pointers to a local copy of a dispatch table, and these pointers
14216 have representations which thus depend on a particular elaboration of the
14217 package. It is not easy to see how it would be possible to follow this
14218 advice without severely impacting efficiency of execution.
14219
14220 @geindex Exception information
14221
14222 @node RM 11 4 1 19 Exception Information,RM 11 5 28 Suppression of Checks,RM 10 2 1 12 Consistent Representation,Implementation Advice
14223 @anchor{gnat_rm/implementation_advice rm-11-4-1-19-exception-information}@anchor{220}
14224 @section RM 11.4.1(19): Exception Information
14225
14226
14227 @quotation
14228
14229 "@code{Exception_Message} by default and @code{Exception_Information}
14230 should produce information useful for
14231 debugging. @code{Exception_Message} should be short, about one
14232 line. @code{Exception_Information} can be long. @code{Exception_Message}
14233 should not include the
14234 @code{Exception_Name}. @code{Exception_Information} should include both
14235 the @code{Exception_Name} and the @code{Exception_Message}."
14236 @end quotation
14237
14238 Followed. For each exception that doesn't have a specified
14239 @code{Exception_Message}, the compiler generates one containing the location
14240 of the raise statement. This location has the form 'file_name:line', where
14241 file_name is the short file name (without path information) and line is the line
14242 number in the file. Note that in the case of the Zero Cost Exception
14243 mechanism, these messages become redundant with the Exception_Information that
14244 contains a full backtrace of the calling sequence, so they are disabled.
14245 To disable explicitly the generation of the source location message, use the
14246 Pragma @code{Discard_Names}.
14247
14248 @geindex Suppression of checks
14249
14250 @geindex Checks
14251 @geindex suppression of
14252
14253 @node RM 11 5 28 Suppression of Checks,RM 13 1 21-24 Representation Clauses,RM 11 4 1 19 Exception Information,Implementation Advice
14254 @anchor{gnat_rm/implementation_advice rm-11-5-28-suppression-of-checks}@anchor{221}
14255 @section RM 11.5(28): Suppression of Checks
14256
14257
14258 @quotation
14259
14260 "The implementation should minimize the code executed for checks that
14261 have been suppressed."
14262 @end quotation
14263
14264 Followed.
14265
14266 @geindex Representation clauses
14267
14268 @node RM 13 1 21-24 Representation Clauses,RM 13 2 6-8 Packed Types,RM 11 5 28 Suppression of Checks,Implementation Advice
14269 @anchor{gnat_rm/implementation_advice rm-13-1-21-24-representation-clauses}@anchor{222}
14270 @section RM 13.1 (21-24): Representation Clauses
14271
14272
14273 @quotation
14274
14275 "The recommended level of support for all representation items is
14276 qualified as follows:
14277
14278 An implementation need not support representation items containing
14279 nonstatic expressions, except that an implementation should support a
14280 representation item for a given entity if each nonstatic expression in
14281 the representation item is a name that statically denotes a constant
14282 declared before the entity."
14283 @end quotation
14284
14285 Followed. In fact, GNAT goes beyond the recommended level of support
14286 by allowing nonstatic expressions in some representation clauses even
14287 without the need to declare constants initialized with the values of
14288 such expressions.
14289 For example:
14290
14291 @example
14292 X : Integer;
14293 Y : Float;
14294 for Y'Address use X'Address;>>
14295
14296
14297 "An implementation need not support a specification for the `@w{`}Size`@w{`}
14298 for a given composite subtype, nor the size or storage place for an
14299 object (including a component) of a given composite subtype, unless the
14300 constraints on the subtype and its composite subcomponents (if any) are
14301 all static constraints."
14302 @end example
14303
14304 Followed. Size Clauses are not permitted on nonstatic components, as
14305 described above.
14306
14307 @quotation
14308
14309 "An aliased component, or a component whose type is by-reference, should
14310 always be allocated at an addressable location."
14311 @end quotation
14312
14313 Followed.
14314
14315 @geindex Packed types
14316
14317 @node RM 13 2 6-8 Packed Types,RM 13 3 14-19 Address Clauses,RM 13 1 21-24 Representation Clauses,Implementation Advice
14318 @anchor{gnat_rm/implementation_advice rm-13-2-6-8-packed-types}@anchor{223}
14319 @section RM 13.2(6-8): Packed Types
14320
14321
14322 @quotation
14323
14324 "If a type is packed, then the implementation should try to minimize
14325 storage allocated to objects of the type, possibly at the expense of
14326 speed of accessing components, subject to reasonable complexity in
14327 addressing calculations.
14328
14329 The recommended level of support pragma @code{Pack} is:
14330
14331 For a packed record type, the components should be packed as tightly as
14332 possible subject to the Sizes of the component subtypes, and subject to
14333 any @emph{record_representation_clause} that applies to the type; the
14334 implementation may, but need not, reorder components or cross aligned
14335 word boundaries to improve the packing. A component whose @code{Size} is
14336 greater than the word size may be allocated an integral number of words."
14337 @end quotation
14338
14339 Followed. Tight packing of arrays is supported for all component sizes
14340 up to 64-bits. If the array component size is 1 (that is to say, if
14341 the component is a boolean type or an enumeration type with two values)
14342 then values of the type are implicitly initialized to zero. This
14343 happens both for objects of the packed type, and for objects that have a
14344 subcomponent of the packed type.
14345
14346 @quotation
14347
14348 "An implementation should support Address clauses for imported
14349 subprograms."
14350 @end quotation
14351
14352 Followed.
14353
14354 @geindex Address clauses
14355
14356 @node RM 13 3 14-19 Address Clauses,RM 13 3 29-35 Alignment Clauses,RM 13 2 6-8 Packed Types,Implementation Advice
14357 @anchor{gnat_rm/implementation_advice rm-13-3-14-19-address-clauses}@anchor{224}
14358 @section RM 13.3(14-19): Address Clauses
14359
14360
14361 @quotation
14362
14363 "For an array @code{X}, @code{X'Address} should point at the first
14364 component of the array, and not at the array bounds."
14365 @end quotation
14366
14367 Followed.
14368
14369 @quotation
14370
14371 "The recommended level of support for the @code{Address} attribute is:
14372
14373 @code{X'Address} should produce a useful result if @code{X} is an
14374 object that is aliased or of a by-reference type, or is an entity whose
14375 @code{Address} has been specified."
14376 @end quotation
14377
14378 Followed. A valid address will be produced even if none of those
14379 conditions have been met. If necessary, the object is forced into
14380 memory to ensure the address is valid.
14381
14382 @quotation
14383
14384 "An implementation should support @code{Address} clauses for imported
14385 subprograms."
14386 @end quotation
14387
14388 Followed.
14389
14390 @quotation
14391
14392 "Objects (including subcomponents) that are aliased or of a by-reference
14393 type should be allocated on storage element boundaries."
14394 @end quotation
14395
14396 Followed.
14397
14398 @quotation
14399
14400 "If the @code{Address} of an object is specified, or it is imported or exported,
14401 then the implementation should not perform optimizations based on
14402 assumptions of no aliases."
14403 @end quotation
14404
14405 Followed.
14406
14407 @geindex Alignment clauses
14408
14409 @node RM 13 3 29-35 Alignment Clauses,RM 13 3 42-43 Size Clauses,RM 13 3 14-19 Address Clauses,Implementation Advice
14410 @anchor{gnat_rm/implementation_advice rm-13-3-29-35-alignment-clauses}@anchor{225}
14411 @section RM 13.3(29-35): Alignment Clauses
14412
14413
14414 @quotation
14415
14416 "The recommended level of support for the @code{Alignment} attribute for
14417 subtypes is:
14418
14419 An implementation should support specified Alignments that are factors
14420 and multiples of the number of storage elements per word, subject to the
14421 following:"
14422 @end quotation
14423
14424 Followed.
14425
14426 @quotation
14427
14428 "An implementation need not support specified Alignments for
14429 combinations of Sizes and Alignments that cannot be easily
14430 loaded and stored by available machine instructions."
14431 @end quotation
14432
14433 Followed.
14434
14435 @quotation
14436
14437 "An implementation need not support specified Alignments that are
14438 greater than the maximum @code{Alignment} the implementation ever returns by
14439 default."
14440 @end quotation
14441
14442 Followed.
14443
14444 @quotation
14445
14446 "The recommended level of support for the @code{Alignment} attribute for
14447 objects is:
14448
14449 Same as above, for subtypes, but in addition:"
14450 @end quotation
14451
14452 Followed.
14453
14454 @quotation
14455
14456 "For stand-alone library-level objects of statically constrained
14457 subtypes, the implementation should support all alignments
14458 supported by the target linker. For example, page alignment is likely to
14459 be supported for such objects, but not for subtypes."
14460 @end quotation
14461
14462 Followed.
14463
14464 @geindex Size clauses
14465
14466 @node RM 13 3 42-43 Size Clauses,RM 13 3 50-56 Size Clauses,RM 13 3 29-35 Alignment Clauses,Implementation Advice
14467 @anchor{gnat_rm/implementation_advice rm-13-3-42-43-size-clauses}@anchor{226}
14468 @section RM 13.3(42-43): Size Clauses
14469
14470
14471 @quotation
14472
14473 "The recommended level of support for the @code{Size} attribute of
14474 objects is:
14475
14476 A @code{Size} clause should be supported for an object if the specified
14477 @code{Size} is at least as large as its subtype's @code{Size}, and
14478 corresponds to a size in storage elements that is a multiple of the
14479 object's @code{Alignment} (if the @code{Alignment} is nonzero)."
14480 @end quotation
14481
14482 Followed.
14483
14484 @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
14485 @anchor{gnat_rm/implementation_advice rm-13-3-50-56-size-clauses}@anchor{227}
14486 @section RM 13.3(50-56): Size Clauses
14487
14488
14489 @quotation
14490
14491 "If the @code{Size} of a subtype is specified, and allows for efficient
14492 independent addressability (see 9.10) on the target architecture, then
14493 the @code{Size} of the following objects of the subtype should equal the
14494 @code{Size} of the subtype:
14495
14496 Aliased objects (including components)."
14497 @end quotation
14498
14499 Followed.
14500
14501 @quotation
14502
14503 "@cite{Size} clause on a composite subtype should not affect the
14504 internal layout of components."
14505 @end quotation
14506
14507 Followed. But note that this can be overridden by use of the implementation
14508 pragma Implicit_Packing in the case of packed arrays.
14509
14510 @quotation
14511
14512 "The recommended level of support for the @code{Size} attribute of subtypes is:
14513
14514 The @code{Size} (if not specified) of a static discrete or fixed point
14515 subtype should be the number of bits needed to represent each value
14516 belonging to the subtype using an unbiased representation, leaving space
14517 for a sign bit only if the subtype contains negative values. If such a
14518 subtype is a first subtype, then an implementation should support a
14519 specified @code{Size} for it that reflects this representation."
14520 @end quotation
14521
14522 Followed.
14523
14524 @quotation
14525
14526 "For a subtype implemented with levels of indirection, the @code{Size}
14527 should include the size of the pointers, but not the size of what they
14528 point at."
14529 @end quotation
14530
14531 Followed.
14532
14533 @geindex Component_Size clauses
14534
14535 @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
14536 @anchor{gnat_rm/implementation_advice rm-13-3-71-73-component-size-clauses}@anchor{228}
14537 @section RM 13.3(71-73): Component Size Clauses
14538
14539
14540 @quotation
14541
14542 "The recommended level of support for the @code{Component_Size}
14543 attribute is:
14544
14545 An implementation need not support specified @code{Component_Sizes} that are
14546 less than the @code{Size} of the component subtype."
14547 @end quotation
14548
14549 Followed.
14550
14551 @quotation
14552
14553 "An implementation should support specified Component_Sizes that
14554 are factors and multiples of the word size. For such
14555 Component_Sizes, the array should contain no gaps between
14556 components. For other Component_Sizes (if supported), the array
14557 should contain no gaps between components when packing is also
14558 specified; the implementation should forbid this combination in cases
14559 where it cannot support a no-gaps representation."
14560 @end quotation
14561
14562 Followed.
14563
14564 @geindex Enumeration representation clauses
14565
14566 @geindex Representation clauses
14567 @geindex enumeration
14568
14569 @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
14570 @anchor{gnat_rm/implementation_advice rm-13-4-9-10-enumeration-representation-clauses}@anchor{229}
14571 @section RM 13.4(9-10): Enumeration Representation Clauses
14572
14573
14574 @quotation
14575
14576 "The recommended level of support for enumeration representation clauses
14577 is:
14578
14579 An implementation need not support enumeration representation clauses
14580 for boolean types, but should at minimum support the internal codes in
14581 the range @code{System.Min_Int .. System.Max_Int}."
14582 @end quotation
14583
14584 Followed.
14585
14586 @geindex Record representation clauses
14587
14588 @geindex Representation clauses
14589 @geindex records
14590
14591 @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
14592 @anchor{gnat_rm/implementation_advice rm-13-5-1-17-22-record-representation-clauses}@anchor{22a}
14593 @section RM 13.5.1(17-22): Record Representation Clauses
14594
14595
14596 @quotation
14597
14598 "The recommended level of support for
14599 @emph{record_representation_clause}s is:
14600
14601 An implementation should support storage places that can be extracted
14602 with a load, mask, shift sequence of machine code, and set with a load,
14603 shift, mask, store sequence, given the available machine instructions
14604 and run-time model."
14605 @end quotation
14606
14607 Followed.
14608
14609 @quotation
14610
14611 "A storage place should be supported if its size is equal to the
14612 @code{Size} of the component subtype, and it starts and ends on a
14613 boundary that obeys the @code{Alignment} of the component subtype."
14614 @end quotation
14615
14616 Followed.
14617
14618 @quotation
14619
14620 "If the default bit ordering applies to the declaration of a given type,
14621 then for a component whose subtype's @code{Size} is less than the word
14622 size, any storage place that does not cross an aligned word boundary
14623 should be supported."
14624 @end quotation
14625
14626 Followed.
14627
14628 @quotation
14629
14630 "An implementation may reserve a storage place for the tag field of a
14631 tagged type, and disallow other components from overlapping that place."
14632 @end quotation
14633
14634 Followed. The storage place for the tag field is the beginning of the tagged
14635 record, and its size is Address'Size. GNAT will reject an explicit component
14636 clause for the tag field.
14637
14638 @quotation
14639
14640 "An implementation need not support a @emph{component_clause} for a
14641 component of an extension part if the storage place is not after the
14642 storage places of all components of the parent type, whether or not
14643 those storage places had been specified."
14644 @end quotation
14645
14646 Followed. The above advice on record representation clauses is followed,
14647 and all mentioned features are implemented.
14648
14649 @geindex Storage place attributes
14650
14651 @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
14652 @anchor{gnat_rm/implementation_advice rm-13-5-2-5-storage-place-attributes}@anchor{22b}
14653 @section RM 13.5.2(5): Storage Place Attributes
14654
14655
14656 @quotation
14657
14658 "If a component is represented using some form of pointer (such as an
14659 offset) to the actual data of the component, and this data is contiguous
14660 with the rest of the object, then the storage place attributes should
14661 reflect the place of the actual data, not the pointer. If a component is
14662 allocated discontinuously from the rest of the object, then a warning
14663 should be generated upon reference to one of its storage place
14664 attributes."
14665 @end quotation
14666
14667 Followed. There are no such components in GNAT.
14668
14669 @geindex Bit ordering
14670
14671 @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
14672 @anchor{gnat_rm/implementation_advice rm-13-5-3-7-8-bit-ordering}@anchor{22c}
14673 @section RM 13.5.3(7-8): Bit Ordering
14674
14675
14676 @quotation
14677
14678 "The recommended level of support for the non-default bit ordering is:
14679
14680 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
14681 should support the non-default bit ordering in addition to the default
14682 bit ordering."
14683 @end quotation
14684
14685 Followed. Word size does not equal storage size in this implementation.
14686 Thus non-default bit ordering is not supported.
14687
14688 @geindex Address
14689 @geindex as private type
14690
14691 @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
14692 @anchor{gnat_rm/implementation_advice rm-13-7-37-address-as-private}@anchor{22d}
14693 @section RM 13.7(37): Address as Private
14694
14695
14696 @quotation
14697
14698 "@cite{Address} should be of a private type."
14699 @end quotation
14700
14701 Followed.
14702
14703 @geindex Operations
14704 @geindex on `@w{`}Address`@w{`}
14705
14706 @geindex Address
14707 @geindex operations of
14708
14709 @node RM 13 7 1 16 Address Operations,RM 13 9 14-17 Unchecked Conversion,RM 13 7 37 Address as Private,Implementation Advice
14710 @anchor{gnat_rm/implementation_advice rm-13-7-1-16-address-operations}@anchor{22e}
14711 @section RM 13.7.1(16): Address Operations
14712
14713
14714 @quotation
14715
14716 "Operations in @code{System} and its children should reflect the target
14717 environment semantics as closely as is reasonable. For example, on most
14718 machines, it makes sense for address arithmetic to 'wrap around'.
14719 Operations that do not make sense should raise @code{Program_Error}."
14720 @end quotation
14721
14722 Followed. Address arithmetic is modular arithmetic that wraps around. No
14723 operation raises @code{Program_Error}, since all operations make sense.
14724
14725 @geindex Unchecked conversion
14726
14727 @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
14728 @anchor{gnat_rm/implementation_advice rm-13-9-14-17-unchecked-conversion}@anchor{22f}
14729 @section RM 13.9(14-17): Unchecked Conversion
14730
14731
14732 @quotation
14733
14734 "The @code{Size} of an array object should not include its bounds; hence,
14735 the bounds should not be part of the converted data."
14736 @end quotation
14737
14738 Followed.
14739
14740 @quotation
14741
14742 "The implementation should not generate unnecessary run-time checks to
14743 ensure that the representation of @code{S} is a representation of the
14744 target type. It should take advantage of the permission to return by
14745 reference when possible. Restrictions on unchecked conversions should be
14746 avoided unless required by the target environment."
14747 @end quotation
14748
14749 Followed. There are no restrictions on unchecked conversion. A warning is
14750 generated if the source and target types do not have the same size since
14751 the semantics in this case may be target dependent.
14752
14753 @quotation
14754
14755 "The recommended level of support for unchecked conversions is:
14756
14757 Unchecked conversions should be supported and should be reversible in
14758 the cases where this clause defines the result. To enable meaningful use
14759 of unchecked conversion, a contiguous representation should be used for
14760 elementary subtypes, for statically constrained array subtypes whose
14761 component subtype is one of the subtypes described in this paragraph,
14762 and for record subtypes without discriminants whose component subtypes
14763 are described in this paragraph."
14764 @end quotation
14765
14766 Followed.
14767
14768 @geindex Heap usage
14769 @geindex implicit
14770
14771 @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
14772 @anchor{gnat_rm/implementation_advice rm-13-11-23-25-implicit-heap-usage}@anchor{230}
14773 @section RM 13.11(23-25): Implicit Heap Usage
14774
14775
14776 @quotation
14777
14778 "An implementation should document any cases in which it dynamically
14779 allocates heap storage for a purpose other than the evaluation of an
14780 allocator."
14781 @end quotation
14782
14783 Followed, the only other points at which heap storage is dynamically
14784 allocated are as follows:
14785
14786
14787 @itemize *
14788
14789 @item
14790 At initial elaboration time, to allocate dynamically sized global
14791 objects.
14792
14793 @item
14794 To allocate space for a task when a task is created.
14795
14796 @item
14797 To extend the secondary stack dynamically when needed. The secondary
14798 stack is used for returning variable length results.
14799 @end itemize
14800
14801
14802 @quotation
14803
14804 "A default (implementation-provided) storage pool for an
14805 access-to-constant type should not have overhead to support deallocation of
14806 individual objects."
14807 @end quotation
14808
14809 Followed.
14810
14811 @quotation
14812
14813 "A storage pool for an anonymous access type should be created at the
14814 point of an allocator for the type, and be reclaimed when the designated
14815 object becomes inaccessible."
14816 @end quotation
14817
14818 Followed.
14819
14820 @geindex Unchecked deallocation
14821
14822 @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
14823 @anchor{gnat_rm/implementation_advice rm-13-11-2-17-unchecked-deallocation}@anchor{231}
14824 @section RM 13.11.2(17): Unchecked Deallocation
14825
14826
14827 @quotation
14828
14829 "For a standard storage pool, @code{Free} should actually reclaim the
14830 storage."
14831 @end quotation
14832
14833 Followed.
14834
14835 @geindex Stream oriented attributes
14836
14837 @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
14838 @anchor{gnat_rm/implementation_advice rm-13-13-2-17-stream-oriented-attributes}@anchor{232}
14839 @section RM 13.13.2(17): Stream Oriented Attributes
14840
14841
14842 @quotation
14843
14844 "If a stream element is the same size as a storage element, then the
14845 normal in-memory representation should be used by @code{Read} and
14846 @code{Write} for scalar objects. Otherwise, @code{Read} and @code{Write}
14847 should use the smallest number of stream elements needed to represent
14848 all values in the base range of the scalar type."
14849 @end quotation
14850
14851 Followed. By default, GNAT uses the interpretation suggested by AI-195,
14852 which specifies using the size of the first subtype.
14853 However, such an implementation is based on direct binary
14854 representations and is therefore target- and endianness-dependent.
14855 To address this issue, GNAT also supplies an alternate implementation
14856 of the stream attributes @code{Read} and @code{Write},
14857 which uses the target-independent XDR standard representation
14858 for scalar types.
14859
14860 @geindex XDR representation
14861
14862 @geindex Read attribute
14863
14864 @geindex Write attribute
14865
14866 @geindex Stream oriented attributes
14867
14868 The XDR implementation is provided as an alternative body of the
14869 @code{System.Stream_Attributes} package, in the file
14870 @code{s-stratt-xdr.adb} in the GNAT library.
14871 There is no @code{s-stratt-xdr.ads} file.
14872 In order to install the XDR implementation, do the following:
14873
14874
14875 @itemize *
14876
14877 @item
14878 Replace the default implementation of the
14879 @code{System.Stream_Attributes} package with the XDR implementation.
14880 For example on a Unix platform issue the commands:
14881
14882 @example
14883 $ mv s-stratt.adb s-stratt-default.adb
14884 $ mv s-stratt-xdr.adb s-stratt.adb
14885 @end example
14886
14887 @item
14888 Rebuild the GNAT run-time library as documented in
14889 the @emph{GNAT and Libraries} section of the @cite{GNAT User's Guide}.
14890 @end itemize
14891
14892 @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
14893 @anchor{gnat_rm/implementation_advice rm-a-1-52-names-of-predefined-numeric-types}@anchor{233}
14894 @section RM A.1(52): Names of Predefined Numeric Types
14895
14896
14897 @quotation
14898
14899 "If an implementation provides additional named predefined integer types,
14900 then the names should end with @code{Integer} as in
14901 @code{Long_Integer}. If an implementation provides additional named
14902 predefined floating point types, then the names should end with
14903 @code{Float} as in @code{Long_Float}."
14904 @end quotation
14905
14906 Followed.
14907
14908 @geindex Ada.Characters.Handling
14909
14910 @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
14911 @anchor{gnat_rm/implementation_advice rm-a-3-2-49-ada-characters-handling}@anchor{234}
14912 @section RM A.3.2(49): @code{Ada.Characters.Handling}
14913
14914
14915 @quotation
14916
14917 "If an implementation provides a localized definition of @code{Character}
14918 or @code{Wide_Character}, then the effects of the subprograms in
14919 @code{Characters.Handling} should reflect the localizations.
14920 See also 3.5.2."
14921 @end quotation
14922
14923 Followed. GNAT provides no such localized definitions.
14924
14925 @geindex Bounded-length strings
14926
14927 @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
14928 @anchor{gnat_rm/implementation_advice rm-a-4-4-106-bounded-length-string-handling}@anchor{235}
14929 @section RM A.4.4(106): Bounded-Length String Handling
14930
14931
14932 @quotation
14933
14934 "Bounded string objects should not be implemented by implicit pointers
14935 and dynamic allocation."
14936 @end quotation
14937
14938 Followed. No implicit pointers or dynamic allocation are used.
14939
14940 @geindex Random number generation
14941
14942 @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
14943 @anchor{gnat_rm/implementation_advice rm-a-5-2-46-47-random-number-generation}@anchor{236}
14944 @section RM A.5.2(46-47): Random Number Generation
14945
14946
14947 @quotation
14948
14949 "Any storage associated with an object of type @code{Generator} should be
14950 reclaimed on exit from the scope of the object."
14951 @end quotation
14952
14953 Followed.
14954
14955 @quotation
14956
14957 "If the generator period is sufficiently long in relation to the number
14958 of distinct initiator values, then each possible value of
14959 @code{Initiator} passed to @code{Reset} should initiate a sequence of
14960 random numbers that does not, in a practical sense, overlap the sequence
14961 initiated by any other value. If this is not possible, then the mapping
14962 between initiator values and generator states should be a rapidly
14963 varying function of the initiator value."
14964 @end quotation
14965
14966 Followed. The generator period is sufficiently long for the first
14967 condition here to hold true.
14968
14969 @geindex Get_Immediate
14970
14971 @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
14972 @anchor{gnat_rm/implementation_advice rm-a-10-7-23-get-immediate}@anchor{237}
14973 @section RM A.10.7(23): @code{Get_Immediate}
14974
14975
14976 @quotation
14977
14978 "The @code{Get_Immediate} procedures should be implemented with
14979 unbuffered input. For a device such as a keyboard, input should be
14980 available if a key has already been typed, whereas for a disk
14981 file, input should always be available except at end of file. For a file
14982 associated with a keyboard-like device, any line-editing features of the
14983 underlying operating system should be disabled during the execution of
14984 @code{Get_Immediate}."
14985 @end quotation
14986
14987 Followed on all targets except VxWorks. For VxWorks, there is no way to
14988 provide this functionality that does not result in the input buffer being
14989 flushed before the @code{Get_Immediate} call. A special unit
14990 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
14991 this functionality.
14992
14993 @geindex Export
14994
14995 @node RM B 1 39-41 Pragma Export,RM B 2 12-13 Package Interfaces,RM A 10 7 23 Get_Immediate,Implementation Advice
14996 @anchor{gnat_rm/implementation_advice rm-b-1-39-41-pragma-export}@anchor{238}
14997 @section RM B.1(39-41): Pragma @code{Export}
14998
14999
15000 @quotation
15001
15002 "If an implementation supports pragma @code{Export} to a given language,
15003 then it should also allow the main subprogram to be written in that
15004 language. It should support some mechanism for invoking the elaboration
15005 of the Ada library units included in the system, and for invoking the
15006 finalization of the environment task. On typical systems, the
15007 recommended mechanism is to provide two subprograms whose link names are
15008 @code{adainit} and @code{adafinal}. @code{adainit} should contain the
15009 elaboration code for library units. @code{adafinal} should contain the
15010 finalization code. These subprograms should have no effect the second
15011 and subsequent time they are called."
15012 @end quotation
15013
15014 Followed.
15015
15016 @quotation
15017
15018 "Automatic elaboration of pre-elaborated packages should be
15019 provided when pragma @code{Export} is supported."
15020 @end quotation
15021
15022 Followed when the main program is in Ada. If the main program is in a
15023 foreign language, then
15024 @code{adainit} must be called to elaborate pre-elaborated
15025 packages.
15026
15027 @quotation
15028
15029 "For each supported convention @emph{L} other than @code{Intrinsic}, an
15030 implementation should support @code{Import} and @code{Export} pragmas
15031 for objects of @emph{L}-compatible types and for subprograms, and pragma
15032 @cite{Convention} for @emph{L}-eligible types and for subprograms,
15033 presuming the other language has corresponding features. Pragma
15034 @code{Convention} need not be supported for scalar types."
15035 @end quotation
15036
15037 Followed.
15038
15039 @geindex Package Interfaces
15040
15041 @geindex Interfaces
15042
15043 @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
15044 @anchor{gnat_rm/implementation_advice rm-b-2-12-13-package-interfaces}@anchor{239}
15045 @section RM B.2(12-13): Package @code{Interfaces}
15046
15047
15048 @quotation
15049
15050 "For each implementation-defined convention identifier, there should be a
15051 child package of package Interfaces with the corresponding name. This
15052 package should contain any declarations that would be useful for
15053 interfacing to the language (implementation) represented by the
15054 convention. Any declarations useful for interfacing to any language on
15055 the given hardware architecture should be provided directly in
15056 @code{Interfaces}."
15057 @end quotation
15058
15059 Followed.
15060
15061 @quotation
15062
15063 "An implementation supporting an interface to C, COBOL, or Fortran should
15064 provide the corresponding package or packages described in the following
15065 clauses."
15066 @end quotation
15067
15068 Followed. GNAT provides all the packages described in this section.
15069
15070 @geindex C
15071 @geindex interfacing with
15072
15073 @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
15074 @anchor{gnat_rm/implementation_advice rm-b-3-63-71-interfacing-with-c}@anchor{23a}
15075 @section RM B.3(63-71): Interfacing with C
15076
15077
15078 @quotation
15079
15080 "An implementation should support the following interface correspondences
15081 between Ada and C."
15082 @end quotation
15083
15084 Followed.
15085
15086 @quotation
15087
15088 "An Ada procedure corresponds to a void-returning C function."
15089 @end quotation
15090
15091 Followed.
15092
15093 @quotation
15094
15095 "An Ada function corresponds to a non-void C function."
15096 @end quotation
15097
15098 Followed.
15099
15100 @quotation
15101
15102 "An Ada @code{in} scalar parameter is passed as a scalar argument to a C
15103 function."
15104 @end quotation
15105
15106 Followed.
15107
15108 @quotation
15109
15110 "An Ada @code{in} parameter of an access-to-object type with designated
15111 type @code{T} is passed as a @code{t*} argument to a C function,
15112 where @code{t} is the C type corresponding to the Ada type @code{T}."
15113 @end quotation
15114
15115 Followed.
15116
15117 @quotation
15118
15119 "An Ada access @code{T} parameter, or an Ada @code{out} or @code{in out}
15120 parameter of an elementary type @code{T}, is passed as a @code{t*}
15121 argument to a C function, where @code{t} is the C type corresponding to
15122 the Ada type @code{T}. In the case of an elementary @code{out} or
15123 @code{in out} parameter, a pointer to a temporary copy is used to
15124 preserve by-copy semantics."
15125 @end quotation
15126
15127 Followed.
15128
15129 @quotation
15130
15131 "An Ada parameter of a record type @code{T}, of any mode, is passed as a
15132 @code{t*} argument to a C function, where @code{t} is the C
15133 structure corresponding to the Ada type @code{T}."
15134 @end quotation
15135
15136 Followed. This convention may be overridden by the use of the C_Pass_By_Copy
15137 pragma, or Convention, or by explicitly specifying the mechanism for a given
15138 call using an extended import or export pragma.
15139
15140 @quotation
15141
15142 "An Ada parameter of an array type with component type @code{T}, of any
15143 mode, is passed as a @code{t*} argument to a C function, where
15144 @code{t} is the C type corresponding to the Ada type @code{T}."
15145 @end quotation
15146
15147 Followed.
15148
15149 @quotation
15150
15151 "An Ada parameter of an access-to-subprogram type is passed as a pointer
15152 to a C function whose prototype corresponds to the designated
15153 subprogram's specification."
15154 @end quotation
15155
15156 Followed.
15157
15158 @geindex COBOL
15159 @geindex interfacing with
15160
15161 @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
15162 @anchor{gnat_rm/implementation_advice rm-b-4-95-98-interfacing-with-cobol}@anchor{23b}
15163 @section RM B.4(95-98): Interfacing with COBOL
15164
15165
15166 @quotation
15167
15168 "An Ada implementation should support the following interface
15169 correspondences between Ada and COBOL."
15170 @end quotation
15171
15172 Followed.
15173
15174 @quotation
15175
15176 "An Ada access @code{T} parameter is passed as a @code{BY REFERENCE} data item of
15177 the COBOL type corresponding to @code{T}."
15178 @end quotation
15179
15180 Followed.
15181
15182 @quotation
15183
15184 "An Ada in scalar parameter is passed as a @code{BY CONTENT} data item of
15185 the corresponding COBOL type."
15186 @end quotation
15187
15188 Followed.
15189
15190 @quotation
15191
15192 "Any other Ada parameter is passed as a @code{BY REFERENCE} data item of the
15193 COBOL type corresponding to the Ada parameter type; for scalars, a local
15194 copy is used if necessary to ensure by-copy semantics."
15195 @end quotation
15196
15197 Followed.
15198
15199 @geindex Fortran
15200 @geindex interfacing with
15201
15202 @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
15203 @anchor{gnat_rm/implementation_advice rm-b-5-22-26-interfacing-with-fortran}@anchor{23c}
15204 @section RM B.5(22-26): Interfacing with Fortran
15205
15206
15207 @quotation
15208
15209 "An Ada implementation should support the following interface
15210 correspondences between Ada and Fortran:"
15211 @end quotation
15212
15213 Followed.
15214
15215 @quotation
15216
15217 "An Ada procedure corresponds to a Fortran subroutine."
15218 @end quotation
15219
15220 Followed.
15221
15222 @quotation
15223
15224 "An Ada function corresponds to a Fortran function."
15225 @end quotation
15226
15227 Followed.
15228
15229 @quotation
15230
15231 "An Ada parameter of an elementary, array, or record type @code{T} is
15232 passed as a @code{T} argument to a Fortran procedure, where @code{T} is
15233 the Fortran type corresponding to the Ada type @code{T}, and where the
15234 INTENT attribute of the corresponding dummy argument matches the Ada
15235 formal parameter mode; the Fortran implementation's parameter passing
15236 conventions are used. For elementary types, a local copy is used if
15237 necessary to ensure by-copy semantics."
15238 @end quotation
15239
15240 Followed.
15241
15242 @quotation
15243
15244 "An Ada parameter of an access-to-subprogram type is passed as a
15245 reference to a Fortran procedure whose interface corresponds to the
15246 designated subprogram's specification."
15247 @end quotation
15248
15249 Followed.
15250
15251 @geindex Machine operations
15252
15253 @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
15254 @anchor{gnat_rm/implementation_advice rm-c-1-3-5-access-to-machine-operations}@anchor{23d}
15255 @section RM C.1(3-5): Access to Machine Operations
15256
15257
15258 @quotation
15259
15260 "The machine code or intrinsic support should allow access to all
15261 operations normally available to assembly language programmers for the
15262 target environment, including privileged instructions, if any."
15263 @end quotation
15264
15265 Followed.
15266
15267 @quotation
15268
15269 "The interfacing pragmas (see Annex B) should support interface to
15270 assembler; the default assembler should be associated with the
15271 convention identifier @code{Assembler}."
15272 @end quotation
15273
15274 Followed.
15275
15276 @quotation
15277
15278 "If an entity is exported to assembly language, then the implementation
15279 should allocate it at an addressable location, and should ensure that it
15280 is retained by the linking process, even if not otherwise referenced
15281 from the Ada code. The implementation should assume that any call to a
15282 machine code or assembler subprogram is allowed to read or update every
15283 object that is specified as exported."
15284 @end quotation
15285
15286 Followed.
15287
15288 @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
15289 @anchor{gnat_rm/implementation_advice rm-c-1-10-16-access-to-machine-operations}@anchor{23e}
15290 @section RM C.1(10-16): Access to Machine Operations
15291
15292
15293 @quotation
15294
15295 "The implementation should ensure that little or no overhead is
15296 associated with calling intrinsic and machine-code subprograms."
15297 @end quotation
15298
15299 Followed for both intrinsics and machine-code subprograms.
15300
15301 @quotation
15302
15303 "It is recommended that intrinsic subprograms be provided for convenient
15304 access to any machine operations that provide special capabilities or
15305 efficiency and that are not otherwise available through the language
15306 constructs."
15307 @end quotation
15308
15309 Followed. A full set of machine operation intrinsic subprograms is provided.
15310
15311 @quotation
15312
15313 "Atomic read-modify-write operations---e.g., test and set, compare and
15314 swap, decrement and test, enqueue/dequeue."
15315 @end quotation
15316
15317 Followed on any target supporting such operations.
15318
15319 @quotation
15320
15321 "Standard numeric functions---e.g.:, sin, log."
15322 @end quotation
15323
15324 Followed on any target supporting such operations.
15325
15326 @quotation
15327
15328 "String manipulation operations---e.g.:, translate and test."
15329 @end quotation
15330
15331 Followed on any target supporting such operations.
15332
15333 @quotation
15334
15335 "Vector operations---e.g.:, compare vector against thresholds."
15336 @end quotation
15337
15338 Followed on any target supporting such operations.
15339
15340 @quotation
15341
15342 "Direct operations on I/O ports."
15343 @end quotation
15344
15345 Followed on any target supporting such operations.
15346
15347 @geindex Interrupt support
15348
15349 @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
15350 @anchor{gnat_rm/implementation_advice rm-c-3-28-interrupt-support}@anchor{23f}
15351 @section RM C.3(28): Interrupt Support
15352
15353
15354 @quotation
15355
15356 "If the @code{Ceiling_Locking} policy is not in effect, the
15357 implementation should provide means for the application to specify which
15358 interrupts are to be blocked during protected actions, if the underlying
15359 system allows for a finer-grain control of interrupt blocking."
15360 @end quotation
15361
15362 Followed. The underlying system does not allow for finer-grain control
15363 of interrupt blocking.
15364
15365 @geindex Protected procedure handlers
15366
15367 @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
15368 @anchor{gnat_rm/implementation_advice rm-c-3-1-20-21-protected-procedure-handlers}@anchor{240}
15369 @section RM C.3.1(20-21): Protected Procedure Handlers
15370
15371
15372 @quotation
15373
15374 "Whenever possible, the implementation should allow interrupt handlers to
15375 be called directly by the hardware."
15376 @end quotation
15377
15378 Followed on any target where the underlying operating system permits
15379 such direct calls.
15380
15381 @quotation
15382
15383 "Whenever practical, violations of any
15384 implementation-defined restrictions should be detected before run time."
15385 @end quotation
15386
15387 Followed. Compile time warnings are given when possible.
15388
15389 @geindex Package `@w{`}Interrupts`@w{`}
15390
15391 @geindex Interrupts
15392
15393 @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
15394 @anchor{gnat_rm/implementation_advice rm-c-3-2-25-package-interrupts}@anchor{241}
15395 @section RM C.3.2(25): Package @code{Interrupts}
15396
15397
15398 @quotation
15399
15400 "If implementation-defined forms of interrupt handler procedures are
15401 supported, such as protected procedures with parameters, then for each
15402 such form of a handler, a type analogous to @code{Parameterless_Handler}
15403 should be specified in a child package of @code{Interrupts}, with the
15404 same operations as in the predefined package Interrupts."
15405 @end quotation
15406
15407 Followed.
15408
15409 @geindex Pre-elaboration requirements
15410
15411 @node RM C 4 14 Pre-elaboration Requirements,RM C 5 8 Pragma Discard_Names,RM C 3 2 25 Package Interrupts,Implementation Advice
15412 @anchor{gnat_rm/implementation_advice rm-c-4-14-pre-elaboration-requirements}@anchor{242}
15413 @section RM C.4(14): Pre-elaboration Requirements
15414
15415
15416 @quotation
15417
15418 "It is recommended that pre-elaborated packages be implemented in such a
15419 way that there should be little or no code executed at run time for the
15420 elaboration of entities not already covered by the Implementation
15421 Requirements."
15422 @end quotation
15423
15424 Followed. Executable code is generated in some cases, e.g., loops
15425 to initialize large arrays.
15426
15427 @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
15428 @anchor{gnat_rm/implementation_advice rm-c-5-8-pragma-discard-names}@anchor{243}
15429 @section RM C.5(8): Pragma @code{Discard_Names}
15430
15431
15432 @quotation
15433
15434 "If the pragma applies to an entity, then the implementation should
15435 reduce the amount of storage used for storing names associated with that
15436 entity."
15437 @end quotation
15438
15439 Followed.
15440
15441 @geindex Package Task_Attributes
15442
15443 @geindex Task_Attributes
15444
15445 @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
15446 @anchor{gnat_rm/implementation_advice rm-c-7-2-30-the-package-task-attributes}@anchor{244}
15447 @section RM C.7.2(30): The Package Task_Attributes
15448
15449
15450 @quotation
15451
15452 "Some implementations are targeted to domains in which memory use at run
15453 time must be completely deterministic. For such implementations, it is
15454 recommended that the storage for task attributes will be pre-allocated
15455 statically and not from the heap. This can be accomplished by either
15456 placing restrictions on the number and the size of the task's
15457 attributes, or by using the pre-allocated storage for the first @code{N}
15458 attribute objects, and the heap for the others. In the latter case,
15459 @code{N} should be documented."
15460 @end quotation
15461
15462 Not followed. This implementation is not targeted to such a domain.
15463
15464 @geindex Locking Policies
15465
15466 @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
15467 @anchor{gnat_rm/implementation_advice rm-d-3-17-locking-policies}@anchor{245}
15468 @section RM D.3(17): Locking Policies
15469
15470
15471 @quotation
15472
15473 "The implementation should use names that end with @code{_Locking} for
15474 locking policies defined by the implementation."
15475 @end quotation
15476
15477 Followed. Two implementation-defined locking policies are defined,
15478 whose names (@code{Inheritance_Locking} and
15479 @code{Concurrent_Readers_Locking}) follow this suggestion.
15480
15481 @geindex Entry queuing policies
15482
15483 @node RM D 4 16 Entry Queuing Policies,RM D 6 9-10 Preemptive Abort,RM D 3 17 Locking Policies,Implementation Advice
15484 @anchor{gnat_rm/implementation_advice rm-d-4-16-entry-queuing-policies}@anchor{246}
15485 @section RM D.4(16): Entry Queuing Policies
15486
15487
15488 @quotation
15489
15490 "Names that end with @code{_Queuing} should be used
15491 for all implementation-defined queuing policies."
15492 @end quotation
15493
15494 Followed. No such implementation-defined queuing policies exist.
15495
15496 @geindex Preemptive abort
15497
15498 @node RM D 6 9-10 Preemptive Abort,RM D 7 21 Tasking Restrictions,RM D 4 16 Entry Queuing Policies,Implementation Advice
15499 @anchor{gnat_rm/implementation_advice rm-d-6-9-10-preemptive-abort}@anchor{247}
15500 @section RM D.6(9-10): Preemptive Abort
15501
15502
15503 @quotation
15504
15505 "Even though the @emph{abort_statement} is included in the list of
15506 potentially blocking operations (see 9.5.1), it is recommended that this
15507 statement be implemented in a way that never requires the task executing
15508 the @emph{abort_statement} to block."
15509 @end quotation
15510
15511 Followed.
15512
15513 @quotation
15514
15515 "On a multi-processor, the delay associated with aborting a task on
15516 another processor should be bounded; the implementation should use
15517 periodic polling, if necessary, to achieve this."
15518 @end quotation
15519
15520 Followed.
15521
15522 @geindex Tasking restrictions
15523
15524 @node RM D 7 21 Tasking Restrictions,RM D 8 47-49 Monotonic Time,RM D 6 9-10 Preemptive Abort,Implementation Advice
15525 @anchor{gnat_rm/implementation_advice rm-d-7-21-tasking-restrictions}@anchor{248}
15526 @section RM D.7(21): Tasking Restrictions
15527
15528
15529 @quotation
15530
15531 "When feasible, the implementation should take advantage of the specified
15532 restrictions to produce a more efficient implementation."
15533 @end quotation
15534
15535 GNAT currently takes advantage of these restrictions by providing an optimized
15536 run time when the Ravenscar profile and the GNAT restricted run time set
15537 of restrictions are specified. See pragma @code{Profile (Ravenscar)} and
15538 pragma @code{Profile (Restricted)} for more details.
15539
15540 @geindex Time
15541 @geindex monotonic
15542
15543 @node RM D 8 47-49 Monotonic Time,RM E 5 28-29 Partition Communication Subsystem,RM D 7 21 Tasking Restrictions,Implementation Advice
15544 @anchor{gnat_rm/implementation_advice rm-d-8-47-49-monotonic-time}@anchor{249}
15545 @section RM D.8(47-49): Monotonic Time
15546
15547
15548 @quotation
15549
15550 "When appropriate, implementations should provide configuration
15551 mechanisms to change the value of @code{Tick}."
15552 @end quotation
15553
15554 Such configuration mechanisms are not appropriate to this implementation
15555 and are thus not supported.
15556
15557 @quotation
15558
15559 "It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
15560 be implemented as transformations of the same time base."
15561 @end quotation
15562
15563 Followed.
15564
15565 @quotation
15566
15567 "It is recommended that the best time base which exists in
15568 the underlying system be available to the application through
15569 @code{Clock}. @cite{Best} may mean highest accuracy or largest range."
15570 @end quotation
15571
15572 Followed.
15573
15574 @geindex Partition communication subsystem
15575
15576 @geindex PCS
15577
15578 @node RM E 5 28-29 Partition Communication Subsystem,RM F 7 COBOL Support,RM D 8 47-49 Monotonic Time,Implementation Advice
15579 @anchor{gnat_rm/implementation_advice rm-e-5-28-29-partition-communication-subsystem}@anchor{24a}
15580 @section RM E.5(28-29): Partition Communication Subsystem
15581
15582
15583 @quotation
15584
15585 "Whenever possible, the PCS on the called partition should allow for
15586 multiple tasks to call the RPC-receiver with different messages and
15587 should allow them to block until the corresponding subprogram body
15588 returns."
15589 @end quotation
15590
15591 Followed by GLADE, a separately supplied PCS that can be used with
15592 GNAT.
15593
15594 @quotation
15595
15596 "The @code{Write} operation on a stream of type @code{Params_Stream_Type}
15597 should raise @code{Storage_Error} if it runs out of space trying to
15598 write the @code{Item} into the stream."
15599 @end quotation
15600
15601 Followed by GLADE, a separately supplied PCS that can be used with
15602 GNAT.
15603
15604 @geindex COBOL support
15605
15606 @node RM F 7 COBOL Support,RM F 1 2 Decimal Radix Support,RM E 5 28-29 Partition Communication Subsystem,Implementation Advice
15607 @anchor{gnat_rm/implementation_advice rm-f-7-cobol-support}@anchor{24b}
15608 @section RM F(7): COBOL Support
15609
15610
15611 @quotation
15612
15613 "If COBOL (respectively, C) is widely supported in the target
15614 environment, implementations supporting the Information Systems Annex
15615 should provide the child package @code{Interfaces.COBOL} (respectively,
15616 @code{Interfaces.C}) specified in Annex B and should support a
15617 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
15618 pragmas (see Annex B), thus allowing Ada programs to interface with
15619 programs written in that language."
15620 @end quotation
15621
15622 Followed.
15623
15624 @geindex Decimal radix support
15625
15626 @node RM F 1 2 Decimal Radix Support,RM G Numerics,RM F 7 COBOL Support,Implementation Advice
15627 @anchor{gnat_rm/implementation_advice rm-f-1-2-decimal-radix-support}@anchor{24c}
15628 @section RM F.1(2): Decimal Radix Support
15629
15630
15631 @quotation
15632
15633 "Packed decimal should be used as the internal representation for objects
15634 of subtype @code{S} when @code{S}'Machine_Radix = 10."
15635 @end quotation
15636
15637 Not followed. GNAT ignores @code{S}'Machine_Radix and always uses binary
15638 representations.
15639
15640 @geindex Numerics
15641
15642 @node RM G Numerics,RM G 1 1 56-58 Complex Types,RM F 1 2 Decimal Radix Support,Implementation Advice
15643 @anchor{gnat_rm/implementation_advice rm-g-numerics}@anchor{24d}
15644 @section RM G: Numerics
15645
15646
15647 @quotation
15648
15649 "If Fortran (respectively, C) is widely supported in the target
15650 environment, implementations supporting the Numerics Annex
15651 should provide the child package @code{Interfaces.Fortran} (respectively,
15652 @code{Interfaces.C}) specified in Annex B and should support a
15653 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
15654 pragmas (see Annex B), thus allowing Ada programs to interface with
15655 programs written in that language."
15656 @end quotation
15657
15658 Followed.
15659
15660 @geindex Complex types
15661
15662 @node RM G 1 1 56-58 Complex Types,RM G 1 2 49 Complex Elementary Functions,RM G Numerics,Implementation Advice
15663 @anchor{gnat_rm/implementation_advice rm-g-1-1-56-58-complex-types}@anchor{24e}
15664 @section RM G.1.1(56-58): Complex Types
15665
15666
15667 @quotation
15668
15669 "Because the usual mathematical meaning of multiplication of a complex
15670 operand and a real operand is that of the scaling of both components of
15671 the former by the latter, an implementation should not perform this
15672 operation by first promoting the real operand to complex type and then
15673 performing a full complex multiplication. In systems that, in the
15674 future, support an Ada binding to IEC 559:1989, the latter technique
15675 will not generate the required result when one of the components of the
15676 complex operand is infinite. (Explicit multiplication of the infinite
15677 component by the zero component obtained during promotion yields a NaN
15678 that propagates into the final result.) Analogous advice applies in the
15679 case of multiplication of a complex operand and a pure-imaginary
15680 operand, and in the case of division of a complex operand by a real or
15681 pure-imaginary operand."
15682 @end quotation
15683
15684 Not followed.
15685
15686 @quotation
15687
15688 "Similarly, because the usual mathematical meaning of addition of a
15689 complex operand and a real operand is that the imaginary operand remains
15690 unchanged, an implementation should not perform this operation by first
15691 promoting the real operand to complex type and then performing a full
15692 complex addition. In implementations in which the @code{Signed_Zeros}
15693 attribute of the component type is @code{True} (and which therefore
15694 conform to IEC 559:1989 in regard to the handling of the sign of zero in
15695 predefined arithmetic operations), the latter technique will not
15696 generate the required result when the imaginary component of the complex
15697 operand is a negatively signed zero. (Explicit addition of the negative
15698 zero to the zero obtained during promotion yields a positive zero.)
15699 Analogous advice applies in the case of addition of a complex operand
15700 and a pure-imaginary operand, and in the case of subtraction of a
15701 complex operand and a real or pure-imaginary operand."
15702 @end quotation
15703
15704 Not followed.
15705
15706 @quotation
15707
15708 "Implementations in which @code{Real'Signed_Zeros} is @code{True} should
15709 attempt to provide a rational treatment of the signs of zero results and
15710 result components. As one example, the result of the @code{Argument}
15711 function should have the sign of the imaginary component of the
15712 parameter @code{X} when the point represented by that parameter lies on
15713 the positive real axis; as another, the sign of the imaginary component
15714 of the @code{Compose_From_Polar} function should be the same as
15715 (respectively, the opposite of) that of the @code{Argument} parameter when that
15716 parameter has a value of zero and the @code{Modulus} parameter has a
15717 nonnegative (respectively, negative) value."
15718 @end quotation
15719
15720 Followed.
15721
15722 @geindex Complex elementary functions
15723
15724 @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
15725 @anchor{gnat_rm/implementation_advice rm-g-1-2-49-complex-elementary-functions}@anchor{24f}
15726 @section RM G.1.2(49): Complex Elementary Functions
15727
15728
15729 @quotation
15730
15731 "Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
15732 @code{True} should attempt to provide a rational treatment of the signs
15733 of zero results and result components. For example, many of the complex
15734 elementary functions have components that are odd functions of one of
15735 the parameter components; in these cases, the result component should
15736 have the sign of the parameter component at the origin. Other complex
15737 elementary functions have zero components whose sign is opposite that of
15738 a parameter component at the origin, or is always positive or always
15739 negative."
15740 @end quotation
15741
15742 Followed.
15743
15744 @geindex Accuracy requirements
15745
15746 @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
15747 @anchor{gnat_rm/implementation_advice rm-g-2-4-19-accuracy-requirements}@anchor{250}
15748 @section RM G.2.4(19): Accuracy Requirements
15749
15750
15751 @quotation
15752
15753 "The versions of the forward trigonometric functions without a
15754 @code{Cycle} parameter should not be implemented by calling the
15755 corresponding version with a @code{Cycle} parameter of
15756 @code{2.0*Numerics.Pi}, since this will not provide the required
15757 accuracy in some portions of the domain. For the same reason, the
15758 version of @code{Log} without a @code{Base} parameter should not be
15759 implemented by calling the corresponding version with a @code{Base}
15760 parameter of @code{Numerics.e}."
15761 @end quotation
15762
15763 Followed.
15764
15765 @geindex Complex arithmetic accuracy
15766
15767 @geindex Accuracy
15768 @geindex complex arithmetic
15769
15770 @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
15771 @anchor{gnat_rm/implementation_advice rm-g-2-6-15-complex-arithmetic-accuracy}@anchor{251}
15772 @section RM G.2.6(15): Complex Arithmetic Accuracy
15773
15774
15775 @quotation
15776
15777 "The version of the @code{Compose_From_Polar} function without a
15778 @code{Cycle} parameter should not be implemented by calling the
15779 corresponding version with a @code{Cycle} parameter of
15780 @code{2.0*Numerics.Pi}, since this will not provide the required
15781 accuracy in some portions of the domain."
15782 @end quotation
15783
15784 Followed.
15785
15786 @geindex Sequential elaboration policy
15787
15788 @node RM H 6 15/2 Pragma Partition_Elaboration_Policy,,RM G 2 6 15 Complex Arithmetic Accuracy,Implementation Advice
15789 @anchor{gnat_rm/implementation_advice rm-h-6-15-2-pragma-partition-elaboration-policy}@anchor{252}
15790 @section RM H.6(15/2): Pragma Partition_Elaboration_Policy
15791
15792
15793 @quotation
15794
15795 "If the partition elaboration policy is @code{Sequential} and the
15796 Environment task becomes permanently blocked during elaboration then the
15797 partition is deadlocked and it is recommended that the partition be
15798 immediately terminated."
15799 @end quotation
15800
15801 Not followed.
15802
15803 @node Implementation Defined Characteristics,Intrinsic Subprograms,Implementation Advice,Top
15804 @anchor{gnat_rm/implementation_defined_characteristics implementation-defined-characteristics}@anchor{b}@anchor{gnat_rm/implementation_defined_characteristics doc}@anchor{253}@anchor{gnat_rm/implementation_defined_characteristics id1}@anchor{254}
15805 @chapter Implementation Defined Characteristics
15806
15807
15808 In addition to the implementation dependent pragmas and attributes, and the
15809 implementation advice, there are a number of other Ada features that are
15810 potentially implementation dependent and are designated as
15811 implementation-defined. These are mentioned throughout the Ada Reference
15812 Manual, and are summarized in Annex M.
15813
15814 A requirement for conforming Ada compilers is that they provide
15815 documentation describing how the implementation deals with each of these
15816 issues. In this chapter you will find each point in Annex M listed,
15817 followed by a description of how GNAT
15818 handles the implementation dependence.
15819
15820 You can use this chapter as a guide to minimizing implementation
15821 dependent features in your programs if portability to other compilers
15822 and other operating systems is an important consideration. The numbers
15823 in each entry below correspond to the paragraph numbers in the Ada
15824 Reference Manual.
15825
15826
15827 @itemize *
15828
15829 @item
15830 "Whether or not each recommendation given in Implementation
15831 Advice is followed. See 1.1.2(37)."
15832 @end itemize
15833
15834 See @ref{a,,Implementation Advice}.
15835
15836
15837 @itemize *
15838
15839 @item
15840 "Capacity limitations of the implementation. See 1.1.3(3)."
15841 @end itemize
15842
15843 The complexity of programs that can be processed is limited only by the
15844 total amount of available virtual memory, and disk space for the
15845 generated object files.
15846
15847
15848 @itemize *
15849
15850 @item
15851 "Variations from the standard that are impractical to avoid
15852 given the implementation's execution environment. See 1.1.3(6)."
15853 @end itemize
15854
15855 There are no variations from the standard.
15856
15857
15858 @itemize *
15859
15860 @item
15861 "Which code_statements cause external
15862 interactions. See 1.1.3(10)."
15863 @end itemize
15864
15865 Any @emph{code_statement} can potentially cause external interactions.
15866
15867
15868 @itemize *
15869
15870 @item
15871 "The coded representation for the text of an Ada
15872 program. See 2.1(4)."
15873 @end itemize
15874
15875 See separate section on source representation.
15876
15877
15878 @itemize *
15879
15880 @item
15881 "The control functions allowed in comments. See 2.1(14)."
15882 @end itemize
15883
15884 See separate section on source representation.
15885
15886
15887 @itemize *
15888
15889 @item
15890 "The representation for an end of line. See 2.2(2)."
15891 @end itemize
15892
15893 See separate section on source representation.
15894
15895
15896 @itemize *
15897
15898 @item
15899 "Maximum supported line length and lexical element
15900 length. See 2.2(15)."
15901 @end itemize
15902
15903 The maximum line length is 255 characters and the maximum length of
15904 a lexical element is also 255 characters. This is the default setting
15905 if not overridden by the use of compiler switch @emph{-gnaty} (which
15906 sets the maximum to 79) or @emph{-gnatyMnn} which allows the maximum
15907 line length to be specified to be any value up to 32767. The maximum
15908 length of a lexical element is the same as the maximum line length.
15909
15910
15911 @itemize *
15912
15913 @item
15914 "Implementation defined pragmas. See 2.8(14)."
15915 @end itemize
15916
15917 See @ref{7,,Implementation Defined Pragmas}.
15918
15919
15920 @itemize *
15921
15922 @item
15923 "Effect of pragma @code{Optimize}. See 2.8(27)."
15924 @end itemize
15925
15926 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
15927 parameter, checks that the optimization flag is set, and aborts if it is
15928 not.
15929
15930
15931 @itemize *
15932
15933 @item
15934 "The sequence of characters of the value returned by
15935 @code{S'Image} when some of the graphic characters of
15936 @code{S'Wide_Image} are not defined in @code{Character}. See
15937 3.5(37)."
15938 @end itemize
15939
15940 The sequence of characters is as defined by the wide character encoding
15941 method used for the source. See section on source representation for
15942 further details.
15943
15944
15945 @itemize *
15946
15947 @item
15948 "The predefined integer types declared in
15949 @code{Standard}. See 3.5.4(25)."
15950 @end itemize
15951
15952
15953 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
15954 @headitem
15955
15956 Type
15957
15958 @tab
15959
15960 Representation
15961
15962 @item
15963
15964 @emph{Short_Short_Integer}
15965
15966 @tab
15967
15968 8 bit signed
15969
15970 @item
15971
15972 @emph{Short_Integer}
15973
15974 @tab
15975
15976 (Short) 16 bit signed
15977
15978 @item
15979
15980 @emph{Integer}
15981
15982 @tab
15983
15984 32 bit signed
15985
15986 @item
15987
15988 @emph{Long_Integer}
15989
15990 @tab
15991
15992 64 bit signed (on most 64 bit targets,
15993 depending on the C definition of long).
15994 32 bit signed (all other targets)
15995
15996 @item
15997
15998 @emph{Long_Long_Integer}
15999
16000 @tab
16001
16002 64 bit signed
16003
16004 @end multitable
16005
16006
16007
16008 @itemize *
16009
16010 @item
16011 "Any nonstandard integer types and the operators defined
16012 for them. See 3.5.4(26)."
16013 @end itemize
16014
16015 There are no nonstandard integer types.
16016
16017
16018 @itemize *
16019
16020 @item
16021 "Any nonstandard real types and the operators defined for
16022 them. See 3.5.6(8)."
16023 @end itemize
16024
16025 There are no nonstandard real types.
16026
16027
16028 @itemize *
16029
16030 @item
16031 "What combinations of requested decimal precision and range
16032 are supported for floating point types. See 3.5.7(7)."
16033 @end itemize
16034
16035 The precision and range is as defined by the IEEE standard.
16036
16037
16038 @itemize *
16039
16040 @item
16041 "The predefined floating point types declared in
16042 @code{Standard}. See 3.5.7(16)."
16043 @end itemize
16044
16045
16046 @multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16047 @headitem
16048
16049 Type
16050
16051 @tab
16052
16053 Representation
16054
16055 @item
16056
16057 @emph{Short_Float}
16058
16059 @tab
16060
16061 32 bit IEEE short
16062
16063 @item
16064
16065 @emph{Float}
16066
16067 @tab
16068
16069 (Short) 32 bit IEEE short
16070
16071 @item
16072
16073 @emph{Long_Float}
16074
16075 @tab
16076
16077 64 bit IEEE long
16078
16079 @item
16080
16081 @emph{Long_Long_Float}
16082
16083 @tab
16084
16085 64 bit IEEE long (80 bit IEEE long on x86 processors)
16086
16087 @end multitable
16088
16089
16090
16091 @itemize *
16092
16093 @item
16094 "The small of an ordinary fixed point type. See 3.5.9(8)."
16095 @end itemize
16096
16097 @code{Fine_Delta} is 2**(-63)
16098
16099
16100 @itemize *
16101
16102 @item
16103 "What combinations of small, range, and digits are
16104 supported for fixed point types. See 3.5.9(10)."
16105 @end itemize
16106
16107 Any combinations are permitted that do not result in a small less than
16108 @code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
16109 If the mantissa is larger than 53 bits on machines where Long_Long_Float
16110 is 64 bits (true of all architectures except ia32), then the output from
16111 Text_IO is accurate to only 53 bits, rather than the full mantissa. This
16112 is because floating-point conversions are used to convert fixed point.
16113
16114
16115 @itemize *
16116
16117 @item
16118 "The result of @code{Tags.Expanded_Name} for types declared
16119 within an unnamed @emph{block_statement}. See 3.9(10)."
16120 @end itemize
16121
16122 Block numbers of the form @code{B@emph{nnn}}, where @emph{nnn} is a
16123 decimal integer are allocated.
16124
16125
16126 @itemize *
16127
16128 @item
16129 "Implementation-defined attributes. See 4.1.4(12)."
16130 @end itemize
16131
16132 See @ref{8,,Implementation Defined Attributes}.
16133
16134
16135 @itemize *
16136
16137 @item
16138 "Any implementation-defined time types. See 9.6(6)."
16139 @end itemize
16140
16141 There are no implementation-defined time types.
16142
16143
16144 @itemize *
16145
16146 @item
16147 "The time base associated with relative delays."
16148 @end itemize
16149
16150 See 9.6(20). The time base used is that provided by the C library
16151 function @code{gettimeofday}.
16152
16153
16154 @itemize *
16155
16156 @item
16157 "The time base of the type @code{Calendar.Time}. See
16158 9.6(23)."
16159 @end itemize
16160
16161 The time base used is that provided by the C library function
16162 @code{gettimeofday}.
16163
16164
16165 @itemize *
16166
16167 @item
16168 "The time zone used for package @code{Calendar}
16169 operations. See 9.6(24)."
16170 @end itemize
16171
16172 The time zone used by package @code{Calendar} is the current system time zone
16173 setting for local time, as accessed by the C library function
16174 @code{localtime}.
16175
16176
16177 @itemize *
16178
16179 @item
16180 "Any limit on @emph{delay_until_statements} of
16181 @emph{select_statements}. See 9.6(29)."
16182 @end itemize
16183
16184 There are no such limits.
16185
16186
16187 @itemize *
16188
16189 @item
16190 "Whether or not two non-overlapping parts of a composite
16191 object are independently addressable, in the case where packing, record
16192 layout, or @code{Component_Size} is specified for the object. See
16193 9.10(1)."
16194 @end itemize
16195
16196 Separate components are independently addressable if they do not share
16197 overlapping storage units.
16198
16199
16200 @itemize *
16201
16202 @item
16203 "The representation for a compilation. See 10.1(2)."
16204 @end itemize
16205
16206 A compilation is represented by a sequence of files presented to the
16207 compiler in a single invocation of the @emph{gcc} command.
16208
16209
16210 @itemize *
16211
16212 @item
16213 "Any restrictions on compilations that contain multiple
16214 compilation_units. See 10.1(4)."
16215 @end itemize
16216
16217 No single file can contain more than one compilation unit, but any
16218 sequence of files can be presented to the compiler as a single
16219 compilation.
16220
16221
16222 @itemize *
16223
16224 @item
16225 "The mechanisms for creating an environment and for adding
16226 and replacing compilation units. See 10.1.4(3)."
16227 @end itemize
16228
16229 See separate section on compilation model.
16230
16231
16232 @itemize *
16233
16234 @item
16235 "The manner of explicitly assigning library units to a
16236 partition. See 10.2(2)."
16237 @end itemize
16238
16239 If a unit contains an Ada main program, then the Ada units for the partition
16240 are determined by recursive application of the rules in the Ada Reference
16241 Manual section 10.2(2-6). In other words, the Ada units will be those that
16242 are needed by the main program, and then this definition of need is applied
16243 recursively to those units, and the partition contains the transitive
16244 closure determined by this relationship. In short, all the necessary units
16245 are included, with no need to explicitly specify the list. If additional
16246 units are required, e.g., by foreign language units, then all units must be
16247 mentioned in the context clause of one of the needed Ada units.
16248
16249 If the partition contains no main program, or if the main program is in
16250 a language other than Ada, then GNAT
16251 provides the binder options @emph{-z} and @emph{-n} respectively, and in
16252 this case a list of units can be explicitly supplied to the binder for
16253 inclusion in the partition (all units needed by these units will also
16254 be included automatically). For full details on the use of these
16255 options, refer to @emph{GNAT Make Program gnatmake} in the
16256 @cite{GNAT User's Guide}.
16257
16258
16259 @itemize *
16260
16261 @item
16262 "The implementation-defined means, if any, of specifying
16263 which compilation units are needed by a given compilation unit. See
16264 10.2(2)."
16265 @end itemize
16266
16267 The units needed by a given compilation unit are as defined in
16268 the Ada Reference Manual section 10.2(2-6). There are no
16269 implementation-defined pragmas or other implementation-defined
16270 means for specifying needed units.
16271
16272
16273 @itemize *
16274
16275 @item
16276 "The manner of designating the main subprogram of a
16277 partition. See 10.2(7)."
16278 @end itemize
16279
16280 The main program is designated by providing the name of the
16281 corresponding @code{ALI} file as the input parameter to the binder.
16282
16283
16284 @itemize *
16285
16286 @item
16287 "The order of elaboration of @emph{library_items}. See
16288 10.2(18)."
16289 @end itemize
16290
16291 The first constraint on ordering is that it meets the requirements of
16292 Chapter 10 of the Ada Reference Manual. This still leaves some
16293 implementation dependent choices, which are resolved by first
16294 elaborating bodies as early as possible (i.e., in preference to specs
16295 where there is a choice), and second by evaluating the immediate with
16296 clauses of a unit to determine the probably best choice, and
16297 third by elaborating in alphabetical order of unit names
16298 where a choice still remains.
16299
16300
16301 @itemize *
16302
16303 @item
16304 "Parameter passing and function return for the main
16305 subprogram. See 10.2(21)."
16306 @end itemize
16307
16308 The main program has no parameters. It may be a procedure, or a function
16309 returning an integer type. In the latter case, the returned integer
16310 value is the return code of the program (overriding any value that
16311 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
16312
16313
16314 @itemize *
16315
16316 @item
16317 "The mechanisms for building and running partitions. See
16318 10.2(24)."
16319 @end itemize
16320
16321 GNAT itself supports programs with only a single partition. The GNATDIST
16322 tool provided with the GLADE package (which also includes an implementation
16323 of the PCS) provides a completely flexible method for building and running
16324 programs consisting of multiple partitions. See the separate GLADE manual
16325 for details.
16326
16327
16328 @itemize *
16329
16330 @item
16331 "The details of program execution, including program
16332 termination. See 10.2(25)."
16333 @end itemize
16334
16335 See separate section on compilation model.
16336
16337
16338 @itemize *
16339
16340 @item
16341 "The semantics of any non-active partitions supported by the
16342 implementation. See 10.2(28)."
16343 @end itemize
16344
16345 Passive partitions are supported on targets where shared memory is
16346 provided by the operating system. See the GLADE reference manual for
16347 further details.
16348
16349
16350 @itemize *
16351
16352 @item
16353 "The information returned by @code{Exception_Message}. See
16354 11.4.1(10)."
16355 @end itemize
16356
16357 Exception message returns the null string unless a specific message has
16358 been passed by the program.
16359
16360
16361 @itemize *
16362
16363 @item
16364 "The result of @code{Exceptions.Exception_Name} for types
16365 declared within an unnamed @emph{block_statement}. See 11.4.1(12)."
16366 @end itemize
16367
16368 Blocks have implementation defined names of the form @code{B@emph{nnn}}
16369 where @emph{nnn} is an integer.
16370
16371
16372 @itemize *
16373
16374 @item
16375 "The information returned by
16376 @code{Exception_Information}. See 11.4.1(13)."
16377 @end itemize
16378
16379 @code{Exception_Information} returns a string in the following format:
16380
16381 @example
16382 *Exception_Name:* nnnnn
16383 *Message:* mmmmm
16384 *PID:* ppp
16385 *Load address:* 0xhhhh
16386 *Call stack traceback locations:*
16387 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
16388 @end example
16389
16390 where
16391
16392 @quotation
16393
16394
16395 @itemize *
16396
16397 @item
16398 @code{nnnn} is the fully qualified name of the exception in all upper
16399 case letters. This line is always present.
16400
16401 @item
16402 @code{mmmm} is the message (this line present only if message is non-null)
16403
16404 @item
16405 @code{ppp} is the Process Id value as a decimal integer (this line is
16406 present only if the Process Id is nonzero). Currently we are
16407 not making use of this field.
16408
16409 @item
16410 The Load address line, the Call stack traceback locations line and the
16411 following values are present only if at least one traceback location was
16412 recorded. The Load address indicates the address at which the main executable
16413 was loaded; this line may not be present if operating system hasn't relocated
16414 the main executable. The values are given in C style format, with lower case
16415 letters for a-f, and only as many digits present as are necessary.
16416 The line terminator sequence at the end of each line, including
16417 the last line is a single @code{LF} character (@code{16#0A#}).
16418 @end itemize
16419 @end quotation
16420
16421
16422 @itemize *
16423
16424 @item
16425 "Implementation-defined check names. See 11.5(27)."
16426 @end itemize
16427
16428 The implementation defined check names include Alignment_Check,
16429 Atomic_Synchronization, Duplicated_Tag_Check, Container_Checks,
16430 Tampering_Check, Predicate_Check, and Validity_Check. In addition, a user
16431 program can add implementation-defined check names by means of the pragma
16432 Check_Name. See the description of pragma @code{Suppress} for full details.
16433
16434
16435 @itemize *
16436
16437 @item
16438 "The interpretation of each aspect of representation. See
16439 13.1(20)."
16440 @end itemize
16441
16442 See separate section on data representations.
16443
16444
16445 @itemize *
16446
16447 @item
16448 "Any restrictions placed upon representation items. See
16449 13.1(20)."
16450 @end itemize
16451
16452 See separate section on data representations.
16453
16454
16455 @itemize *
16456
16457 @item
16458 "The meaning of @code{Size} for indefinite subtypes. See
16459 13.3(48)."
16460 @end itemize
16461
16462 Size for an indefinite subtype is the maximum possible size, except that
16463 for the case of a subprogram parameter, the size of the parameter object
16464 is the actual size.
16465
16466
16467 @itemize *
16468
16469 @item
16470 "The default external representation for a type tag. See
16471 13.3(75)."
16472 @end itemize
16473
16474 The default external representation for a type tag is the fully expanded
16475 name of the type in upper case letters.
16476
16477
16478 @itemize *
16479
16480 @item
16481 "What determines whether a compilation unit is the same in
16482 two different partitions. See 13.3(76)."
16483 @end itemize
16484
16485 A compilation unit is the same in two different partitions if and only
16486 if it derives from the same source file.
16487
16488
16489 @itemize *
16490
16491 @item
16492 "Implementation-defined components. See 13.5.1(15)."
16493 @end itemize
16494
16495 The only implementation defined component is the tag for a tagged type,
16496 which contains a pointer to the dispatching table.
16497
16498
16499 @itemize *
16500
16501 @item
16502 "If @code{Word_Size} = @code{Storage_Unit}, the default bit
16503 ordering. See 13.5.3(5)."
16504 @end itemize
16505
16506 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
16507 implementation, so no non-default bit ordering is supported. The default
16508 bit ordering corresponds to the natural endianness of the target architecture.
16509
16510
16511 @itemize *
16512
16513 @item
16514 "The contents of the visible part of package @code{System}
16515 and its language-defined children. See 13.7(2)."
16516 @end itemize
16517
16518 See the definition of these packages in files @code{system.ads} and
16519 @code{s-stoele.ads}. Note that two declarations are added to package
16520 System.
16521
16522 @example
16523 Max_Priority : constant Positive := Priority'Last;
16524 Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;
16525 @end example
16526
16527
16528 @itemize *
16529
16530 @item
16531 "The contents of the visible part of package
16532 @code{System.Machine_Code}, and the meaning of
16533 @emph{code_statements}. See 13.8(7)."
16534 @end itemize
16535
16536 See the definition and documentation in file @code{s-maccod.ads}.
16537
16538
16539 @itemize *
16540
16541 @item
16542 "The effect of unchecked conversion. See 13.9(11)."
16543 @end itemize
16544
16545 Unchecked conversion between types of the same size
16546 results in an uninterpreted transmission of the bits from one type
16547 to the other. If the types are of unequal sizes, then in the case of
16548 discrete types, a shorter source is first zero or sign extended as
16549 necessary, and a shorter target is simply truncated on the left.
16550 For all non-discrete types, the source is first copied if necessary
16551 to ensure that the alignment requirements of the target are met, then
16552 a pointer is constructed to the source value, and the result is obtained
16553 by dereferencing this pointer after converting it to be a pointer to the
16554 target type. Unchecked conversions where the target subtype is an
16555 unconstrained array are not permitted. If the target alignment is
16556 greater than the source alignment, then a copy of the result is
16557 made with appropriate alignment
16558
16559
16560 @itemize *
16561
16562 @item
16563 "The semantics of operations on invalid representations.
16564 See 13.9.2(10-11)."
16565 @end itemize
16566
16567 For assignments and other operations where the use of invalid values cannot
16568 result in erroneous behavior, the compiler ignores the possibility of invalid
16569 values. An exception is raised at the point where an invalid value would
16570 result in erroneous behavior. For example executing:
16571
16572 @example
16573 procedure invalidvals is
16574 X : Integer := -1;
16575 Y : Natural range 1 .. 10;
16576 for Y'Address use X'Address;
16577 Z : Natural range 1 .. 10;
16578 A : array (Natural range 1 .. 10) of Integer;
16579 begin
16580 Z := Y; -- no exception
16581 A (Z) := 3; -- exception raised;
16582 end;
16583 @end example
16584
16585 As indicated, an exception is raised on the array assignment, but not
16586 on the simple assignment of the invalid negative value from Y to Z.
16587
16588
16589 @itemize *
16590
16591 @item
16592 "The manner of choosing a storage pool for an access type
16593 when @code{Storage_Pool} is not specified for the type. See 13.11(17)."
16594 @end itemize
16595
16596 There are 3 different standard pools used by the compiler when
16597 @code{Storage_Pool} is not specified depending whether the type is local
16598 to a subprogram or defined at the library level and whether
16599 @code{Storage_Size`@w{`}is specified or not. See documentation in the runtime
16600 library units `@w{`}System.Pool_Global}, @code{System.Pool_Size} and
16601 @code{System.Pool_Local} in files @code{s-poosiz.ads},
16602 @code{s-pooglo.ads} and @code{s-pooloc.ads} for full details on the
16603 default pools used.
16604
16605
16606 @itemize *
16607
16608 @item
16609 "Whether or not the implementation provides user-accessible
16610 names for the standard pool type(s). See 13.11(17)."
16611 @end itemize
16612
16613 See documentation in the sources of the run time mentioned in the previous
16614 paragraph. All these pools are accessible by means of @cite{with}ing
16615 these units.
16616
16617
16618 @itemize *
16619
16620 @item
16621 "The meaning of @code{Storage_Size}. See 13.11(18)."
16622 @end itemize
16623
16624 @code{Storage_Size} is measured in storage units, and refers to the
16625 total space available for an access type collection, or to the primary
16626 stack space for a task.
16627
16628
16629 @itemize *
16630
16631 @item
16632 "Implementation-defined aspects of storage pools. See
16633 13.11(22)."
16634 @end itemize
16635
16636 See documentation in the sources of the run time mentioned in the
16637 paragraph about standard storage pools above
16638 for details on GNAT-defined aspects of storage pools.
16639
16640
16641 @itemize *
16642
16643 @item
16644 "The set of restrictions allowed in a pragma
16645 @code{Restrictions}. See 13.12(7)."
16646 @end itemize
16647
16648 See @ref{9,,Standard and Implementation Defined Restrictions}.
16649
16650
16651 @itemize *
16652
16653 @item
16654 "The consequences of violating limitations on
16655 @code{Restrictions} pragmas. See 13.12(9)."
16656 @end itemize
16657
16658 Restrictions that can be checked at compile time result in illegalities
16659 if violated. Currently there are no other consequences of violating
16660 restrictions.
16661
16662
16663 @itemize *
16664
16665 @item
16666 "The representation used by the @code{Read} and
16667 @code{Write} attributes of elementary types in terms of stream
16668 elements. See 13.13.2(9)."
16669 @end itemize
16670
16671 The representation is the in-memory representation of the base type of
16672 the type, using the number of bits corresponding to the
16673 @code{type'Size} value, and the natural ordering of the machine.
16674
16675
16676 @itemize *
16677
16678 @item
16679 "The names and characteristics of the numeric subtypes
16680 declared in the visible part of package @code{Standard}. See A.1(3)."
16681 @end itemize
16682
16683 See items describing the integer and floating-point types supported.
16684
16685
16686 @itemize *
16687
16688 @item
16689 "The string returned by @code{Character_Set_Version}.
16690 See A.3.5(3)."
16691 @end itemize
16692
16693 @code{Ada.Wide_Characters.Handling.Character_Set_Version} returns
16694 the string "Unicode 4.0", referring to version 4.0 of the
16695 Unicode specification.
16696
16697
16698 @itemize *
16699
16700 @item
16701 "The accuracy actually achieved by the elementary
16702 functions. See A.5.1(1)."
16703 @end itemize
16704
16705 The elementary functions correspond to the functions available in the C
16706 library. Only fast math mode is implemented.
16707
16708
16709 @itemize *
16710
16711 @item
16712 "The sign of a zero result from some of the operators or
16713 functions in @code{Numerics.Generic_Elementary_Functions}, when
16714 @code{Float_Type'Signed_Zeros} is @code{True}. See A.5.1(46)."
16715 @end itemize
16716
16717 The sign of zeroes follows the requirements of the IEEE 754 standard on
16718 floating-point.
16719
16720
16721 @itemize *
16722
16723 @item
16724 "The value of
16725 @code{Numerics.Float_Random.Max_Image_Width}. See A.5.2(27)."
16726 @end itemize
16727
16728 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16729
16730
16731 @itemize *
16732
16733 @item
16734 "The value of
16735 @code{Numerics.Discrete_Random.Max_Image_Width}. See A.5.2(27)."
16736 @end itemize
16737
16738 Maximum image width is 6864, see library file @code{s-rannum.ads}.
16739
16740
16741 @itemize *
16742
16743 @item
16744 "The algorithms for random number generation. See
16745 A.5.2(32)."
16746 @end itemize
16747
16748 The algorithm is the Mersenne Twister, as documented in the source file
16749 @code{s-rannum.adb}. This version of the algorithm has a period of
16750 2**19937-1.
16751
16752
16753 @itemize *
16754
16755 @item
16756 "The string representation of a random number generator's
16757 state. See A.5.2(38)."
16758 @end itemize
16759
16760 The value returned by the Image function is the concatenation of
16761 the fixed-width decimal representations of the 624 32-bit integers
16762 of the state vector.
16763
16764
16765 @itemize *
16766
16767 @item
16768 "The minimum time interval between calls to the
16769 time-dependent Reset procedure that are guaranteed to initiate different
16770 random number sequences. See A.5.2(45)."
16771 @end itemize
16772
16773 The minimum period between reset calls to guarantee distinct series of
16774 random numbers is one microsecond.
16775
16776
16777 @itemize *
16778
16779 @item
16780 "The values of the @code{Model_Mantissa},
16781 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
16782 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
16783 Annex is not supported. See A.5.3(72)."
16784 @end itemize
16785
16786 Run the compiler with @emph{-gnatS} to produce a listing of package
16787 @code{Standard}, has the values of all numeric attributes.
16788
16789
16790 @itemize *
16791
16792 @item
16793 "Any implementation-defined characteristics of the
16794 input-output packages. See A.7(14)."
16795 @end itemize
16796
16797 There are no special implementation defined characteristics for these
16798 packages.
16799
16800
16801 @itemize *
16802
16803 @item
16804 "The value of @code{Buffer_Size} in @code{Storage_IO}. See
16805 A.9(10)."
16806 @end itemize
16807
16808 All type representations are contiguous, and the @code{Buffer_Size} is
16809 the value of @code{type'Size} rounded up to the next storage unit
16810 boundary.
16811
16812
16813 @itemize *
16814
16815 @item
16816 "External files for standard input, standard output, and
16817 standard error See A.10(5)."
16818 @end itemize
16819
16820 These files are mapped onto the files provided by the C streams
16821 libraries. See source file @code{i-cstrea.ads} for further details.
16822
16823
16824 @itemize *
16825
16826 @item
16827 "The accuracy of the value produced by @code{Put}. See
16828 A.10.9(36)."
16829 @end itemize
16830
16831 If more digits are requested in the output than are represented by the
16832 precision of the value, zeroes are output in the corresponding least
16833 significant digit positions.
16834
16835
16836 @itemize *
16837
16838 @item
16839 "The meaning of @code{Argument_Count}, @code{Argument}, and
16840 @code{Command_Name}. See A.15(1)."
16841 @end itemize
16842
16843 These are mapped onto the @code{argv} and @code{argc} parameters of the
16844 main program in the natural manner.
16845
16846
16847 @itemize *
16848
16849 @item
16850 "The interpretation of the @code{Form} parameter in procedure
16851 @code{Create_Directory}. See A.16(56)."
16852 @end itemize
16853
16854 The @code{Form} parameter is not used.
16855
16856
16857 @itemize *
16858
16859 @item
16860 "The interpretation of the @code{Form} parameter in procedure
16861 @code{Create_Path}. See A.16(60)."
16862 @end itemize
16863
16864 The @code{Form} parameter is not used.
16865
16866
16867 @itemize *
16868
16869 @item
16870 "The interpretation of the @code{Form} parameter in procedure
16871 @code{Copy_File}. See A.16(68)."
16872 @end itemize
16873
16874 The @code{Form} parameter is case-insensitive.
16875 Two fields are recognized in the @code{Form} parameter:
16876
16877 @example
16878 *preserve=<value>*
16879 *mode=<value>*
16880 @end example
16881
16882 <value> starts immediately after the character '=' and ends with the
16883 character immediately preceding the next comma (',') or with the last
16884 character of the parameter.
16885
16886 The only possible values for preserve= are:
16887
16888
16889 @multitable {xxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16890 @headitem
16891
16892 Value
16893
16894 @tab
16895
16896 Meaning
16897
16898 @item
16899
16900 @emph{no_attributes}
16901
16902 @tab
16903
16904 Do not try to preserve any file attributes. This is the
16905 default if no preserve= is found in Form.
16906
16907 @item
16908
16909 @emph{all_attributes}
16910
16911 @tab
16912
16913 Try to preserve all file attributes (timestamps, access rights).
16914
16915 @item
16916
16917 @emph{timestamps}
16918
16919 @tab
16920
16921 Preserve the timestamp of the copied file, but not the other
16922 file attributes.
16923
16924 @end multitable
16925
16926
16927 The only possible values for mode= are:
16928
16929
16930 @multitable {xxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
16931 @headitem
16932
16933 Value
16934
16935 @tab
16936
16937 Meaning
16938
16939 @item
16940
16941 @emph{copy}
16942
16943 @tab
16944
16945 Only do the copy if the destination file does not already exist.
16946 If it already exists, Copy_File fails.
16947
16948 @item
16949
16950 @emph{overwrite}
16951
16952 @tab
16953
16954 Copy the file in all cases. Overwrite an already existing destination file.
16955
16956 @item
16957
16958 @emph{append}
16959
16960 @tab
16961
16962 Append the original file to the destination file. If the destination file
16963 does not exist, the destination file is a copy of the source file.
16964 When mode=append, the field preserve=, if it exists, is not taken into account.
16965
16966 @end multitable
16967
16968
16969 If the Form parameter includes one or both of the fields and the value or
16970 values are incorrect, Copy_file fails with Use_Error.
16971
16972 Examples of correct Forms:
16973
16974 @example
16975 Form => "preserve=no_attributes,mode=overwrite" (the default)
16976 Form => "mode=append"
16977 Form => "mode=copy, preserve=all_attributes"
16978 @end example
16979
16980 Examples of incorrect Forms:
16981
16982 @example
16983 Form => "preserve=junk"
16984 Form => "mode=internal, preserve=timestamps"
16985 @end example
16986
16987
16988 @itemize *
16989
16990 @item
16991 "The interpretation of the @code{Pattern} parameter, when not the null string,
16992 in the @code{Start_Search} and @code{Search} procedures.
16993 See A.16(104) and A.16(112)."
16994 @end itemize
16995
16996 When the @code{Pattern} parameter is not the null string, it is interpreted
16997 according to the syntax of regular expressions as defined in the
16998 @code{GNAT.Regexp} package.
16999
17000 See @ref{255,,GNAT.Regexp (g-regexp.ads)}.
17001
17002
17003 @itemize *
17004
17005 @item
17006 "Implementation-defined convention names. See B.1(11)."
17007 @end itemize
17008
17009 The following convention names are supported
17010
17011
17012 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17013 @headitem
17014
17015 Convention Name
17016
17017 @tab
17018
17019 Interpretation
17020
17021 @item
17022
17023 @emph{Ada}
17024
17025 @tab
17026
17027 Ada
17028
17029 @item
17030
17031 @emph{Ada_Pass_By_Copy}
17032
17033 @tab
17034
17035 Allowed for any types except by-reference types such as limited
17036 records. Compatible with convention Ada, but causes any parameters
17037 with this convention to be passed by copy.
17038
17039 @item
17040
17041 @emph{Ada_Pass_By_Reference}
17042
17043 @tab
17044
17045 Allowed for any types except by-copy types such as scalars.
17046 Compatible with convention Ada, but causes any parameters
17047 with this convention to be passed by reference.
17048
17049 @item
17050
17051 @emph{Assembler}
17052
17053 @tab
17054
17055 Assembly language
17056
17057 @item
17058
17059 @emph{Asm}
17060
17061 @tab
17062
17063 Synonym for Assembler
17064
17065 @item
17066
17067 @emph{Assembly}
17068
17069 @tab
17070
17071 Synonym for Assembler
17072
17073 @item
17074
17075 @emph{C}
17076
17077 @tab
17078
17079 C
17080
17081 @item
17082
17083 @emph{C_Pass_By_Copy}
17084
17085 @tab
17086
17087 Allowed only for record types, like C, but also notes that record
17088 is to be passed by copy rather than reference.
17089
17090 @item
17091
17092 @emph{COBOL}
17093
17094 @tab
17095
17096 COBOL
17097
17098 @item
17099
17100 @emph{C_Plus_Plus (or CPP)}
17101
17102 @tab
17103
17104 C++
17105
17106 @item
17107
17108 @emph{Default}
17109
17110 @tab
17111
17112 Treated the same as C
17113
17114 @item
17115
17116 @emph{External}
17117
17118 @tab
17119
17120 Treated the same as C
17121
17122 @item
17123
17124 @emph{Fortran}
17125
17126 @tab
17127
17128 Fortran
17129
17130 @item
17131
17132 @emph{Intrinsic}
17133
17134 @tab
17135
17136 For support of pragma @code{Import} with convention Intrinsic, see
17137 separate section on Intrinsic Subprograms.
17138
17139 @item
17140
17141 @emph{Stdcall}
17142
17143 @tab
17144
17145 Stdcall (used for Windows implementations only). This convention correspond
17146 to the WINAPI (previously called Pascal convention) C/C++ convention under
17147 Windows. A routine with this convention cleans the stack before
17148 exit. This pragma cannot be applied to a dispatching call.
17149
17150 @item
17151
17152 @emph{DLL}
17153
17154 @tab
17155
17156 Synonym for Stdcall
17157
17158 @item
17159
17160 @emph{Win32}
17161
17162 @tab
17163
17164 Synonym for Stdcall
17165
17166 @item
17167
17168 @emph{Stubbed}
17169
17170 @tab
17171
17172 Stubbed is a special convention used to indicate that the body of the
17173 subprogram will be entirely ignored. Any call to the subprogram
17174 is converted into a raise of the @code{Program_Error} exception. If a
17175 pragma @code{Import} specifies convention @code{stubbed} then no body need
17176 be present at all. This convention is useful during development for the
17177 inclusion of subprograms whose body has not yet been written.
17178 In addition, all otherwise unrecognized convention names are also
17179 treated as being synonymous with convention C. In all implementations
17180 except for VMS, use of such other names results in a warning. In VMS
17181 implementations, these names are accepted silently.
17182
17183 @end multitable
17184
17185
17186
17187 @itemize *
17188
17189 @item
17190 "The meaning of link names. See B.1(36)."
17191 @end itemize
17192
17193 Link names are the actual names used by the linker.
17194
17195
17196 @itemize *
17197
17198 @item
17199 "The manner of choosing link names when neither the link
17200 name nor the address of an imported or exported entity is specified. See
17201 B.1(36)."
17202 @end itemize
17203
17204 The default linker name is that which would be assigned by the relevant
17205 external language, interpreting the Ada name as being in all lower case
17206 letters.
17207
17208
17209 @itemize *
17210
17211 @item
17212 "The effect of pragma @code{Linker_Options}. See B.1(37)."
17213 @end itemize
17214
17215 The string passed to @code{Linker_Options} is presented uninterpreted as
17216 an argument to the link command, unless it contains ASCII.NUL characters.
17217 NUL characters if they appear act as argument separators, so for example
17218
17219 @example
17220 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
17221 @end example
17222
17223 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
17224 linker. The order of linker options is preserved for a given unit. The final
17225 list of options passed to the linker is in reverse order of the elaboration
17226 order. For example, linker options for a body always appear before the options
17227 from the corresponding package spec.
17228
17229
17230 @itemize *
17231
17232 @item
17233 "The contents of the visible part of package
17234 @code{Interfaces} and its language-defined descendants. See B.2(1)."
17235 @end itemize
17236
17237 See files with prefix @code{i-} in the distributed library.
17238
17239
17240 @itemize *
17241
17242 @item
17243 "Implementation-defined children of package
17244 @code{Interfaces}. The contents of the visible part of package
17245 @code{Interfaces}. See B.2(11)."
17246 @end itemize
17247
17248 See files with prefix @code{i-} in the distributed library.
17249
17250
17251 @itemize *
17252
17253 @item
17254 "The types @code{Floating}, @code{Long_Floating},
17255 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
17256 @code{COBOL_Character}; and the initialization of the variables
17257 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
17258 @code{Interfaces.COBOL}. See B.4(50)."
17259 @end itemize
17260
17261
17262 @multitable {xxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
17263 @headitem
17264
17265 COBOL
17266
17267 @tab
17268
17269 Ada
17270
17271 @item
17272
17273 @emph{Floating}
17274
17275 @tab
17276
17277 Float
17278
17279 @item
17280
17281 @emph{Long_Floating}
17282
17283 @tab
17284
17285 (Floating) Long_Float
17286
17287 @item
17288
17289 @emph{Binary}
17290
17291 @tab
17292
17293 Integer
17294
17295 @item
17296
17297 @emph{Long_Binary}
17298
17299 @tab
17300
17301 Long_Long_Integer
17302
17303 @item
17304
17305 @emph{Decimal_Element}
17306
17307 @tab
17308
17309 Character
17310
17311 @item
17312
17313 @emph{COBOL_Character}
17314
17315 @tab
17316
17317 Character
17318
17319 @end multitable
17320
17321
17322 For initialization, see the file @code{i-cobol.ads} in the distributed library.
17323
17324
17325 @itemize *
17326
17327 @item
17328 "Support for access to machine instructions. See C.1(1)."
17329 @end itemize
17330
17331 See documentation in file @code{s-maccod.ads} in the distributed library.
17332
17333
17334 @itemize *
17335
17336 @item
17337 "Implementation-defined aspects of access to machine
17338 operations. See C.1(9)."
17339 @end itemize
17340
17341 See documentation in file @code{s-maccod.ads} in the distributed library.
17342
17343
17344 @itemize *
17345
17346 @item
17347 "Implementation-defined aspects of interrupts. See C.3(2)."
17348 @end itemize
17349
17350 Interrupts are mapped to signals or conditions as appropriate. See
17351 definition of unit
17352 @code{Ada.Interrupt_Names} in source file @code{a-intnam.ads} for details
17353 on the interrupts supported on a particular target.
17354
17355
17356 @itemize *
17357
17358 @item
17359 "Implementation-defined aspects of pre-elaboration. See
17360 C.4(13)."
17361 @end itemize
17362
17363 GNAT does not permit a partition to be restarted without reloading,
17364 except under control of the debugger.
17365
17366
17367 @itemize *
17368
17369 @item
17370 "The semantics of pragma @code{Discard_Names}. See C.5(7)."
17371 @end itemize
17372
17373 Pragma @code{Discard_Names} causes names of enumeration literals to
17374 be suppressed. In the presence of this pragma, the Image attribute
17375 provides the image of the Pos of the literal, and Value accepts
17376 Pos values.
17377
17378 For tagged types, when pragmas @code{Discard_Names} and @code{No_Tagged_Streams}
17379 simultaneously apply, their Expanded_Name and External_Tag are initialized
17380 with empty strings. This is useful to avoid exposing entity names at binary
17381 level.
17382
17383
17384 @itemize *
17385
17386 @item
17387 "The result of the @code{Task_Identification.Image}
17388 attribute. See C.7.1(7)."
17389 @end itemize
17390
17391 The result of this attribute is a string that identifies
17392 the object or component that denotes a given task. If a variable @code{Var}
17393 has a task type, the image for this task will have the form @code{Var_@emph{XXXXXXXX}},
17394 where the suffix @emph{XXXXXXXX}
17395 is the hexadecimal representation of the virtual address of the corresponding
17396 task control block. If the variable is an array of tasks, the image of each
17397 task will have the form of an indexed component indicating the position of a
17398 given task in the array, e.g., @code{Group(5)_@emph{XXXXXXX}}. If the task is a
17399 component of a record, the image of the task will have the form of a selected
17400 component. These rules are fully recursive, so that the image of a task that
17401 is a subcomponent of a composite object corresponds to the expression that
17402 designates this task.
17403
17404 If a task is created by an allocator, its image depends on the context. If the
17405 allocator is part of an object declaration, the rules described above are used
17406 to construct its image, and this image is not affected by subsequent
17407 assignments. If the allocator appears within an expression, the image
17408 includes only the name of the task type.
17409
17410 If the configuration pragma Discard_Names is present, or if the restriction
17411 No_Implicit_Heap_Allocation is in effect, the image reduces to
17412 the numeric suffix, that is to say the hexadecimal representation of the
17413 virtual address of the control block of the task.
17414
17415
17416 @itemize *
17417
17418 @item
17419 "The value of @code{Current_Task} when in a protected entry
17420 or interrupt handler. See C.7.1(17)."
17421 @end itemize
17422
17423 Protected entries or interrupt handlers can be executed by any
17424 convenient thread, so the value of @code{Current_Task} is undefined.
17425
17426
17427 @itemize *
17428
17429 @item
17430 "The effect of calling @code{Current_Task} from an entry
17431 body or interrupt handler. See C.7.1(19)."
17432 @end itemize
17433
17434 When GNAT can determine statically that @code{Current_Task} is called directly in
17435 the body of an entry (or barrier) then a warning is emitted and @code{Program_Error}
17436 is raised at run time. Otherwise, the effect of calling @code{Current_Task} from an
17437 entry body or interrupt handler is to return the identification of the task
17438 currently executing the code.
17439
17440
17441 @itemize *
17442
17443 @item
17444 "Implementation-defined aspects of
17445 @code{Task_Attributes}. See C.7.2(19)."
17446 @end itemize
17447
17448 There are no implementation-defined aspects of @code{Task_Attributes}.
17449
17450
17451 @itemize *
17452
17453 @item
17454 "Values of all @code{Metrics}. See D(2)."
17455 @end itemize
17456
17457 The metrics information for GNAT depends on the performance of the
17458 underlying operating system. The sources of the run-time for tasking
17459 implementation, together with the output from @emph{-gnatG} can be
17460 used to determine the exact sequence of operating systems calls made
17461 to implement various tasking constructs. Together with appropriate
17462 information on the performance of the underlying operating system,
17463 on the exact target in use, this information can be used to determine
17464 the required metrics.
17465
17466
17467 @itemize *
17468
17469 @item
17470 "The declarations of @code{Any_Priority} and
17471 @code{Priority}. See D.1(11)."
17472 @end itemize
17473
17474 See declarations in file @code{system.ads}.
17475
17476
17477 @itemize *
17478
17479 @item
17480 "Implementation-defined execution resources. See D.1(15)."
17481 @end itemize
17482
17483 There are no implementation-defined execution resources.
17484
17485
17486 @itemize *
17487
17488 @item
17489 "Whether, on a multiprocessor, a task that is waiting for
17490 access to a protected object keeps its processor busy. See D.2.1(3)."
17491 @end itemize
17492
17493 On a multi-processor, a task that is waiting for access to a protected
17494 object does not keep its processor busy.
17495
17496
17497 @itemize *
17498
17499 @item
17500 "The affect of implementation defined execution resources
17501 on task dispatching. See D.2.1(9)."
17502 @end itemize
17503
17504 Tasks map to threads in the threads package used by GNAT. Where possible
17505 and appropriate, these threads correspond to native threads of the
17506 underlying operating system.
17507
17508
17509 @itemize *
17510
17511 @item
17512 "Implementation-defined @emph{policy_identifiers} allowed
17513 in a pragma @code{Task_Dispatching_Policy}. See D.2.2(3)."
17514 @end itemize
17515
17516 There are no implementation-defined policy-identifiers allowed in this
17517 pragma.
17518
17519
17520 @itemize *
17521
17522 @item
17523 "Implementation-defined aspects of priority inversion. See
17524 D.2.2(16)."
17525 @end itemize
17526
17527 Execution of a task cannot be preempted by the implementation processing
17528 of delay expirations for lower priority tasks.
17529
17530
17531 @itemize *
17532
17533 @item
17534 "Implementation-defined task dispatching. See D.2.2(18)."
17535 @end itemize
17536
17537 The policy is the same as that of the underlying threads implementation.
17538
17539
17540 @itemize *
17541
17542 @item
17543 "Implementation-defined @emph{policy_identifiers} allowed
17544 in a pragma @code{Locking_Policy}. See D.3(4)."
17545 @end itemize
17546
17547 The two implementation defined policies permitted in GNAT are
17548 @code{Inheritance_Locking} and @code{Concurrent_Readers_Locking}. On
17549 targets that support the @code{Inheritance_Locking} policy, locking is
17550 implemented by inheritance, i.e., the task owning the lock operates
17551 at a priority equal to the highest priority of any task currently
17552 requesting the lock. On targets that support the
17553 @code{Concurrent_Readers_Locking} policy, locking is implemented with a
17554 read/write lock allowing multiple protected object functions to enter
17555 concurrently.
17556
17557
17558 @itemize *
17559
17560 @item
17561 "Default ceiling priorities. See D.3(10)."
17562 @end itemize
17563
17564 The ceiling priority of protected objects of the type
17565 @code{System.Interrupt_Priority'Last} as described in the Ada
17566 Reference Manual D.3(10),
17567
17568
17569 @itemize *
17570
17571 @item
17572 "The ceiling of any protected object used internally by
17573 the implementation. See D.3(16)."
17574 @end itemize
17575
17576 The ceiling priority of internal protected objects is
17577 @code{System.Priority'Last}.
17578
17579
17580 @itemize *
17581
17582 @item
17583 "Implementation-defined queuing policies. See D.4(1)."
17584 @end itemize
17585
17586 There are no implementation-defined queuing policies.
17587
17588
17589 @itemize *
17590
17591 @item
17592 "On a multiprocessor, any conditions that cause the
17593 completion of an aborted construct to be delayed later than what is
17594 specified for a single processor. See D.6(3)."
17595 @end itemize
17596
17597 The semantics for abort on a multi-processor is the same as on a single
17598 processor, there are no further delays.
17599
17600
17601 @itemize *
17602
17603 @item
17604 "Any operations that implicitly require heap storage
17605 allocation. See D.7(8)."
17606 @end itemize
17607
17608 The only operation that implicitly requires heap storage allocation is
17609 task creation.
17610
17611
17612 @itemize *
17613
17614 @item
17615 "What happens when a task terminates in the presence of
17616 pragma @code{No_Task_Termination}. See D.7(15)."
17617 @end itemize
17618
17619 Execution is erroneous in that case.
17620
17621
17622 @itemize *
17623
17624 @item
17625 "Implementation-defined aspects of pragma
17626 @code{Restrictions}. See D.7(20)."
17627 @end itemize
17628
17629 There are no such implementation-defined aspects.
17630
17631
17632 @itemize *
17633
17634 @item
17635 "Implementation-defined aspects of package
17636 @code{Real_Time}. See D.8(17)."
17637 @end itemize
17638
17639 There are no implementation defined aspects of package @code{Real_Time}.
17640
17641
17642 @itemize *
17643
17644 @item
17645 "Implementation-defined aspects of
17646 @emph{delay_statements}. See D.9(8)."
17647 @end itemize
17648
17649 Any difference greater than one microsecond will cause the task to be
17650 delayed (see D.9(7)).
17651
17652
17653 @itemize *
17654
17655 @item
17656 "The upper bound on the duration of interrupt blocking
17657 caused by the implementation. See D.12(5)."
17658 @end itemize
17659
17660 The upper bound is determined by the underlying operating system. In
17661 no cases is it more than 10 milliseconds.
17662
17663
17664 @itemize *
17665
17666 @item
17667 "The means for creating and executing distributed
17668 programs. See E(5)."
17669 @end itemize
17670
17671 The GLADE package provides a utility GNATDIST for creating and executing
17672 distributed programs. See the GLADE reference manual for further details.
17673
17674
17675 @itemize *
17676
17677 @item
17678 "Any events that can result in a partition becoming
17679 inaccessible. See E.1(7)."
17680 @end itemize
17681
17682 See the GLADE reference manual for full details on such events.
17683
17684
17685 @itemize *
17686
17687 @item
17688 "The scheduling policies, treatment of priorities, and
17689 management of shared resources between partitions in certain cases. See
17690 E.1(11)."
17691 @end itemize
17692
17693 See the GLADE reference manual for full details on these aspects of
17694 multi-partition execution.
17695
17696
17697 @itemize *
17698
17699 @item
17700 "Events that cause the version of a compilation unit to
17701 change. See E.3(5)."
17702 @end itemize
17703
17704 Editing the source file of a compilation unit, or the source files of
17705 any units on which it is dependent in a significant way cause the version
17706 to change. No other actions cause the version number to change. All changes
17707 are significant except those which affect only layout, capitalization or
17708 comments.
17709
17710
17711 @itemize *
17712
17713 @item
17714 "Whether the execution of the remote subprogram is
17715 immediately aborted as a result of cancellation. See E.4(13)."
17716 @end itemize
17717
17718 See the GLADE reference manual for details on the effect of abort in
17719 a distributed application.
17720
17721
17722 @itemize *
17723
17724 @item
17725 "Implementation-defined aspects of the PCS. See E.5(25)."
17726 @end itemize
17727
17728 See the GLADE reference manual for a full description of all implementation
17729 defined aspects of the PCS.
17730
17731
17732 @itemize *
17733
17734 @item
17735 "Implementation-defined interfaces in the PCS. See
17736 E.5(26)."
17737 @end itemize
17738
17739 See the GLADE reference manual for a full description of all
17740 implementation defined interfaces.
17741
17742
17743 @itemize *
17744
17745 @item
17746 "The values of named numbers in the package
17747 @code{Decimal}. See F.2(7)."
17748 @end itemize
17749
17750
17751 @multitable {xxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxx}
17752 @headitem
17753
17754 Named Number
17755
17756 @tab
17757
17758 Value
17759
17760 @item
17761
17762 @emph{Max_Scale}
17763
17764 @tab
17765
17766 +18
17767
17768 @item
17769
17770 @emph{Min_Scale}
17771
17772 @tab
17773
17774 -18
17775
17776 @item
17777
17778 @emph{Min_Delta}
17779
17780 @tab
17781
17782 1.0E-18
17783
17784 @item
17785
17786 @emph{Max_Delta}
17787
17788 @tab
17789
17790 1.0E+18
17791
17792 @item
17793
17794 @emph{Max_Decimal_Digits}
17795
17796 @tab
17797
17798 18
17799
17800 @end multitable
17801
17802
17803
17804 @itemize *
17805
17806 @item
17807 "The value of @code{Max_Picture_Length} in the package
17808 @code{Text_IO.Editing}. See F.3.3(16)."
17809 @end itemize
17810
17811 64
17812
17813
17814 @itemize *
17815
17816 @item
17817 "The value of @code{Max_Picture_Length} in the package
17818 @code{Wide_Text_IO.Editing}. See F.3.4(5)."
17819 @end itemize
17820
17821 64
17822
17823
17824 @itemize *
17825
17826 @item
17827 "The accuracy actually achieved by the complex elementary
17828 functions and by other complex arithmetic operations. See G.1(1)."
17829 @end itemize
17830
17831 Standard library functions are used for the complex arithmetic
17832 operations. Only fast math mode is currently supported.
17833
17834
17835 @itemize *
17836
17837 @item
17838 "The sign of a zero result (or a component thereof) from
17839 any operator or function in @code{Numerics.Generic_Complex_Types}, when
17840 @code{Real'Signed_Zeros} is True. See G.1.1(53)."
17841 @end itemize
17842
17843 The signs of zero values are as recommended by the relevant
17844 implementation advice.
17845
17846
17847 @itemize *
17848
17849 @item
17850 "The sign of a zero result (or a component thereof) from
17851 any operator or function in
17852 @code{Numerics.Generic_Complex_Elementary_Functions}, when
17853 @code{Real'Signed_Zeros} is @code{True}. See G.1.2(45)."
17854 @end itemize
17855
17856 The signs of zero values are as recommended by the relevant
17857 implementation advice.
17858
17859
17860 @itemize *
17861
17862 @item
17863 "Whether the strict mode or the relaxed mode is the
17864 default. See G.2(2)."
17865 @end itemize
17866
17867 The strict mode is the default. There is no separate relaxed mode. GNAT
17868 provides a highly efficient implementation of strict mode.
17869
17870
17871 @itemize *
17872
17873 @item
17874 "The result interval in certain cases of fixed-to-float
17875 conversion. See G.2.1(10)."
17876 @end itemize
17877
17878 For cases where the result interval is implementation dependent, the
17879 accuracy is that provided by performing all operations in 64-bit IEEE
17880 floating-point format.
17881
17882
17883 @itemize *
17884
17885 @item
17886 "The result of a floating point arithmetic operation in
17887 overflow situations, when the @code{Machine_Overflows} attribute of the
17888 result type is @code{False}. See G.2.1(13)."
17889 @end itemize
17890
17891 Infinite and NaN values are produced as dictated by the IEEE
17892 floating-point standard.
17893 Note that on machines that are not fully compliant with the IEEE
17894 floating-point standard, such as Alpha, the @emph{-mieee} compiler flag
17895 must be used for achieving IEEE conforming behavior (although at the cost
17896 of a significant performance penalty), so infinite and NaN values are
17897 properly generated.
17898
17899
17900 @itemize *
17901
17902 @item
17903 "The result interval for division (or exponentiation by a
17904 negative exponent), when the floating point hardware implements division
17905 as multiplication by a reciprocal. See G.2.1(16)."
17906 @end itemize
17907
17908 Not relevant, division is IEEE exact.
17909
17910
17911 @itemize *
17912
17913 @item
17914 "The definition of close result set, which determines the
17915 accuracy of certain fixed point multiplications and divisions. See
17916 G.2.3(5)."
17917 @end itemize
17918
17919 Operations in the close result set are performed using IEEE long format
17920 floating-point arithmetic. The input operands are converted to
17921 floating-point, the operation is done in floating-point, and the result
17922 is converted to the target type.
17923
17924
17925 @itemize *
17926
17927 @item
17928 "Conditions on a @emph{universal_real} operand of a fixed
17929 point multiplication or division for which the result shall be in the
17930 perfect result set. See G.2.3(22)."
17931 @end itemize
17932
17933 The result is only defined to be in the perfect result set if the result
17934 can be computed by a single scaling operation involving a scale factor
17935 representable in 64-bits.
17936
17937
17938 @itemize *
17939
17940 @item
17941 "The result of a fixed point arithmetic operation in
17942 overflow situations, when the @code{Machine_Overflows} attribute of the
17943 result type is @code{False}. See G.2.3(27)."
17944 @end itemize
17945
17946 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
17947 types.
17948
17949
17950 @itemize *
17951
17952 @item
17953 "The result of an elementary function reference in
17954 overflow situations, when the @code{Machine_Overflows} attribute of the
17955 result type is @code{False}. See G.2.4(4)."
17956 @end itemize
17957
17958 IEEE infinite and Nan values are produced as appropriate.
17959
17960
17961 @itemize *
17962
17963 @item
17964 "The value of the angle threshold, within which certain
17965 elementary functions, complex arithmetic operations, and complex
17966 elementary functions yield results conforming to a maximum relative
17967 error bound. See G.2.4(10)."
17968 @end itemize
17969
17970 Information on this subject is not yet available.
17971
17972
17973 @itemize *
17974
17975 @item
17976 "The accuracy of certain elementary functions for
17977 parameters beyond the angle threshold. See G.2.4(10)."
17978 @end itemize
17979
17980 Information on this subject is not yet available.
17981
17982
17983 @itemize *
17984
17985 @item
17986 "The result of a complex arithmetic operation or complex
17987 elementary function reference in overflow situations, when the
17988 @code{Machine_Overflows} attribute of the corresponding real type is
17989 @code{False}. See G.2.6(5)."
17990 @end itemize
17991
17992 IEEE infinite and Nan values are produced as appropriate.
17993
17994
17995 @itemize *
17996
17997 @item
17998 "The accuracy of certain complex arithmetic operations and
17999 certain complex elementary functions for parameters (or components
18000 thereof) beyond the angle threshold. See G.2.6(8)."
18001 @end itemize
18002
18003 Information on those subjects is not yet available.
18004
18005
18006 @itemize *
18007
18008 @item
18009 "Information regarding bounded errors and erroneous
18010 execution. See H.2(1)."
18011 @end itemize
18012
18013 Information on this subject is not yet available.
18014
18015
18016 @itemize *
18017
18018 @item
18019 "Implementation-defined aspects of pragma
18020 @code{Inspection_Point}. See H.3.2(8)."
18021 @end itemize
18022
18023 Pragma @code{Inspection_Point} ensures that the variable is live and can
18024 be examined by the debugger at the inspection point.
18025
18026
18027 @itemize *
18028
18029 @item
18030 "Implementation-defined aspects of pragma
18031 @code{Restrictions}. See H.4(25)."
18032 @end itemize
18033
18034 There are no implementation-defined aspects of pragma @code{Restrictions}. The
18035 use of pragma @code{Restrictions [No_Exceptions]} has no effect on the
18036 generated code. Checks must suppressed by use of pragma @code{Suppress}.
18037
18038
18039 @itemize *
18040
18041 @item
18042 "Any restrictions on pragma @code{Restrictions}. See
18043 H.4(27)."
18044 @end itemize
18045
18046 There are no restrictions on pragma @code{Restrictions}.
18047
18048 @node Intrinsic Subprograms,Representation Clauses and Pragmas,Implementation Defined Characteristics,Top
18049 @anchor{gnat_rm/intrinsic_subprograms doc}@anchor{256}@anchor{gnat_rm/intrinsic_subprograms intrinsic-subprograms}@anchor{c}@anchor{gnat_rm/intrinsic_subprograms id1}@anchor{257}
18050 @chapter Intrinsic Subprograms
18051
18052
18053 @geindex Intrinsic Subprograms
18054
18055 GNAT allows a user application program to write the declaration:
18056
18057 @example
18058 pragma Import (Intrinsic, name);
18059 @end example
18060
18061 providing that the name corresponds to one of the implemented intrinsic
18062 subprograms in GNAT, and that the parameter profile of the referenced
18063 subprogram meets the requirements. This chapter describes the set of
18064 implemented intrinsic subprograms, and the requirements on parameter profiles.
18065 Note that no body is supplied; as with other uses of pragma Import, the
18066 body is supplied elsewhere (in this case by the compiler itself). Note
18067 that any use of this feature is potentially non-portable, since the
18068 Ada standard does not require Ada compilers to implement this feature.
18069
18070 @menu
18071 * Intrinsic Operators::
18072 * Compilation_ISO_Date::
18073 * Compilation_Date::
18074 * Compilation_Time::
18075 * Enclosing_Entity::
18076 * Exception_Information::
18077 * Exception_Message::
18078 * Exception_Name::
18079 * File::
18080 * Line::
18081 * Shifts and Rotates::
18082 * Source_Location::
18083
18084 @end menu
18085
18086 @node Intrinsic Operators,Compilation_ISO_Date,,Intrinsic Subprograms
18087 @anchor{gnat_rm/intrinsic_subprograms id2}@anchor{258}@anchor{gnat_rm/intrinsic_subprograms intrinsic-operators}@anchor{259}
18088 @section Intrinsic Operators
18089
18090
18091 @geindex Intrinsic operator
18092
18093 All the predefined numeric operators in package Standard
18094 in @code{pragma Import (Intrinsic,..)}
18095 declarations. In the binary operator case, the operands must have the same
18096 size. The operand or operands must also be appropriate for
18097 the operator. For example, for addition, the operands must
18098 both be floating-point or both be fixed-point, and the
18099 right operand for @code{"**"} must have a root type of
18100 @code{Standard.Integer'Base}.
18101 You can use an intrinsic operator declaration as in the following example:
18102
18103 @example
18104 type Int1 is new Integer;
18105 type Int2 is new Integer;
18106
18107 function "+" (X1 : Int1; X2 : Int2) return Int1;
18108 function "+" (X1 : Int1; X2 : Int2) return Int2;
18109 pragma Import (Intrinsic, "+");
18110 @end example
18111
18112 This declaration would permit 'mixed mode' arithmetic on items
18113 of the differing types @code{Int1} and @code{Int2}.
18114 It is also possible to specify such operators for private types, if the
18115 full views are appropriate arithmetic types.
18116
18117 @node Compilation_ISO_Date,Compilation_Date,Intrinsic Operators,Intrinsic Subprograms
18118 @anchor{gnat_rm/intrinsic_subprograms id3}@anchor{25a}@anchor{gnat_rm/intrinsic_subprograms compilation-iso-date}@anchor{25b}
18119 @section Compilation_ISO_Date
18120
18121
18122 @geindex Compilation_ISO_Date
18123
18124 This intrinsic subprogram is used in the implementation of the
18125 library package @code{GNAT.Source_Info}. The only useful use of the
18126 intrinsic import in this case is the one in this unit, so an
18127 application program should simply call the function
18128 @code{GNAT.Source_Info.Compilation_ISO_Date} to obtain the date of
18129 the current compilation (in local time format YYYY-MM-DD).
18130
18131 @node Compilation_Date,Compilation_Time,Compilation_ISO_Date,Intrinsic Subprograms
18132 @anchor{gnat_rm/intrinsic_subprograms compilation-date}@anchor{25c}@anchor{gnat_rm/intrinsic_subprograms id4}@anchor{25d}
18133 @section Compilation_Date
18134
18135
18136 @geindex Compilation_Date
18137
18138 Same as Compilation_ISO_Date, except the string is in the form
18139 MMM DD YYYY.
18140
18141 @node Compilation_Time,Enclosing_Entity,Compilation_Date,Intrinsic Subprograms
18142 @anchor{gnat_rm/intrinsic_subprograms compilation-time}@anchor{25e}@anchor{gnat_rm/intrinsic_subprograms id5}@anchor{25f}
18143 @section Compilation_Time
18144
18145
18146 @geindex Compilation_Time
18147
18148 This intrinsic subprogram is used in the implementation of the
18149 library package @code{GNAT.Source_Info}. The only useful use of the
18150 intrinsic import in this case is the one in this unit, so an
18151 application program should simply call the function
18152 @code{GNAT.Source_Info.Compilation_Time} to obtain the time of
18153 the current compilation (in local time format HH:MM:SS).
18154
18155 @node Enclosing_Entity,Exception_Information,Compilation_Time,Intrinsic Subprograms
18156 @anchor{gnat_rm/intrinsic_subprograms id6}@anchor{260}@anchor{gnat_rm/intrinsic_subprograms enclosing-entity}@anchor{261}
18157 @section Enclosing_Entity
18158
18159
18160 @geindex Enclosing_Entity
18161
18162 This intrinsic subprogram is used in the implementation of the
18163 library package @code{GNAT.Source_Info}. The only useful use of the
18164 intrinsic import in this case is the one in this unit, so an
18165 application program should simply call the function
18166 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
18167 the current subprogram, package, task, entry, or protected subprogram.
18168
18169 @node Exception_Information,Exception_Message,Enclosing_Entity,Intrinsic Subprograms
18170 @anchor{gnat_rm/intrinsic_subprograms id7}@anchor{262}@anchor{gnat_rm/intrinsic_subprograms exception-information}@anchor{263}
18171 @section Exception_Information
18172
18173
18174 @geindex Exception_Information'
18175
18176 This intrinsic subprogram is used in the implementation of the
18177 library package @code{GNAT.Current_Exception}. The only useful
18178 use of the intrinsic import in this case is the one in this unit,
18179 so an application program should simply call the function
18180 @code{GNAT.Current_Exception.Exception_Information} to obtain
18181 the exception information associated with the current exception.
18182
18183 @node Exception_Message,Exception_Name,Exception_Information,Intrinsic Subprograms
18184 @anchor{gnat_rm/intrinsic_subprograms exception-message}@anchor{264}@anchor{gnat_rm/intrinsic_subprograms id8}@anchor{265}
18185 @section Exception_Message
18186
18187
18188 @geindex Exception_Message
18189
18190 This intrinsic subprogram is used in the implementation of the
18191 library package @code{GNAT.Current_Exception}. The only useful
18192 use of the intrinsic import in this case is the one in this unit,
18193 so an application program should simply call the function
18194 @code{GNAT.Current_Exception.Exception_Message} to obtain
18195 the message associated with the current exception.
18196
18197 @node Exception_Name,File,Exception_Message,Intrinsic Subprograms
18198 @anchor{gnat_rm/intrinsic_subprograms exception-name}@anchor{266}@anchor{gnat_rm/intrinsic_subprograms id9}@anchor{267}
18199 @section Exception_Name
18200
18201
18202 @geindex Exception_Name
18203
18204 This intrinsic subprogram is used in the implementation of the
18205 library package @code{GNAT.Current_Exception}. The only useful
18206 use of the intrinsic import in this case is the one in this unit,
18207 so an application program should simply call the function
18208 @code{GNAT.Current_Exception.Exception_Name} to obtain
18209 the name of the current exception.
18210
18211 @node File,Line,Exception_Name,Intrinsic Subprograms
18212 @anchor{gnat_rm/intrinsic_subprograms id10}@anchor{268}@anchor{gnat_rm/intrinsic_subprograms file}@anchor{269}
18213 @section File
18214
18215
18216 @geindex File
18217
18218 This intrinsic subprogram is used in the implementation of the
18219 library package @code{GNAT.Source_Info}. The only useful use of the
18220 intrinsic import in this case is the one in this unit, so an
18221 application program should simply call the function
18222 @code{GNAT.Source_Info.File} to obtain the name of the current
18223 file.
18224
18225 @node Line,Shifts and Rotates,File,Intrinsic Subprograms
18226 @anchor{gnat_rm/intrinsic_subprograms id11}@anchor{26a}@anchor{gnat_rm/intrinsic_subprograms line}@anchor{26b}
18227 @section Line
18228
18229
18230 @geindex Line
18231
18232 This intrinsic subprogram is used in the implementation of the
18233 library package @code{GNAT.Source_Info}. The only useful use of the
18234 intrinsic import in this case is the one in this unit, so an
18235 application program should simply call the function
18236 @code{GNAT.Source_Info.Line} to obtain the number of the current
18237 source line.
18238
18239 @node Shifts and Rotates,Source_Location,Line,Intrinsic Subprograms
18240 @anchor{gnat_rm/intrinsic_subprograms shifts-and-rotates}@anchor{26c}@anchor{gnat_rm/intrinsic_subprograms id12}@anchor{26d}
18241 @section Shifts and Rotates
18242
18243
18244 @geindex Shift_Left
18245
18246 @geindex Shift_Right
18247
18248 @geindex Shift_Right_Arithmetic
18249
18250 @geindex Rotate_Left
18251
18252 @geindex Rotate_Right
18253
18254 In standard Ada, the shift and rotate functions are available only
18255 for the predefined modular types in package @code{Interfaces}. However, in
18256 GNAT it is possible to define these functions for any integer
18257 type (signed or modular), as in this example:
18258
18259 @example
18260 function Shift_Left
18261 (Value : T;
18262 Amount : Natural) return T;
18263 @end example
18264
18265 The function name must be one of
18266 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
18267 Rotate_Right. T must be an integer type. T'Size must be
18268 8, 16, 32 or 64 bits; if T is modular, the modulus
18269 must be 2**8, 2**16, 2**32 or 2**64.
18270 The result type must be the same as the type of @code{Value}.
18271 The shift amount must be Natural.
18272 The formal parameter names can be anything.
18273
18274 A more convenient way of providing these shift operators is to use
18275 the Provide_Shift_Operators pragma, which provides the function declarations
18276 and corresponding pragma Import's for all five shift functions.
18277
18278 @node Source_Location,,Shifts and Rotates,Intrinsic Subprograms
18279 @anchor{gnat_rm/intrinsic_subprograms source-location}@anchor{26e}@anchor{gnat_rm/intrinsic_subprograms id13}@anchor{26f}
18280 @section Source_Location
18281
18282
18283 @geindex Source_Location
18284
18285 This intrinsic subprogram is used in the implementation of the
18286 library routine @code{GNAT.Source_Info}. The only useful use of the
18287 intrinsic import in this case is the one in this unit, so an
18288 application program should simply call the function
18289 @code{GNAT.Source_Info.Source_Location} to obtain the current
18290 source file location.
18291
18292 @node Representation Clauses and Pragmas,Standard Library Routines,Intrinsic Subprograms,Top
18293 @anchor{gnat_rm/representation_clauses_and_pragmas representation-clauses-and-pragmas}@anchor{d}@anchor{gnat_rm/representation_clauses_and_pragmas doc}@anchor{270}@anchor{gnat_rm/representation_clauses_and_pragmas id1}@anchor{271}
18294 @chapter Representation Clauses and Pragmas
18295
18296
18297 @geindex Representation Clauses
18298
18299 @geindex Representation Clause
18300
18301 @geindex Representation Pragma
18302
18303 @geindex Pragma
18304 @geindex representation
18305
18306 This section describes the representation clauses accepted by GNAT, and
18307 their effect on the representation of corresponding data objects.
18308
18309 GNAT fully implements Annex C (Systems Programming). This means that all
18310 the implementation advice sections in chapter 13 are fully implemented.
18311 However, these sections only require a minimal level of support for
18312 representation clauses. GNAT provides much more extensive capabilities,
18313 and this section describes the additional capabilities provided.
18314
18315 @menu
18316 * Alignment Clauses::
18317 * Size Clauses::
18318 * Storage_Size Clauses::
18319 * Size of Variant Record Objects::
18320 * Biased Representation::
18321 * Value_Size and Object_Size Clauses::
18322 * Component_Size Clauses::
18323 * Bit_Order Clauses::
18324 * Effect of Bit_Order on Byte Ordering::
18325 * Pragma Pack for Arrays::
18326 * Pragma Pack for Records::
18327 * Record Representation Clauses::
18328 * Handling of Records with Holes::
18329 * Enumeration Clauses::
18330 * Address Clauses::
18331 * Use of Address Clauses for Memory-Mapped I/O::
18332 * Effect of Convention on Representation::
18333 * Conventions and Anonymous Access Types::
18334 * Determining the Representations chosen by GNAT::
18335
18336 @end menu
18337
18338 @node Alignment Clauses,Size Clauses,,Representation Clauses and Pragmas
18339 @anchor{gnat_rm/representation_clauses_and_pragmas id2}@anchor{272}@anchor{gnat_rm/representation_clauses_and_pragmas alignment-clauses}@anchor{273}
18340 @section Alignment Clauses
18341
18342
18343 @geindex Alignment Clause
18344
18345 GNAT requires that all alignment clauses specify a power of 2, and all
18346 default alignments are always a power of 2. The default alignment
18347 values are as follows:
18348
18349
18350 @itemize *
18351
18352 @item
18353 @emph{Elementary Types}.
18354
18355 For elementary types, the alignment is the minimum of the actual size of
18356 objects of the type divided by @code{Storage_Unit},
18357 and the maximum alignment supported by the target.
18358 (This maximum alignment is given by the GNAT-specific attribute
18359 @code{Standard'Maximum_Alignment}; see @ref{18d,,Attribute Maximum_Alignment}.)
18360
18361 @geindex Maximum_Alignment attribute
18362
18363 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
18364 default alignment will be 8 on any target that supports alignments
18365 this large, but on some targets, the maximum alignment may be smaller
18366 than 8, in which case objects of type @code{Long_Float} will be maximally
18367 aligned.
18368
18369 @item
18370 @emph{Arrays}.
18371
18372 For arrays, the alignment is equal to the alignment of the component type
18373 for the normal case where no packing or component size is given. If the
18374 array is packed, and the packing is effective (see separate section on
18375 packed arrays), then the alignment will be either 4, 2, or 1 for long packed
18376 arrays or arrays whose length is not known at compile time, depending on
18377 whether the component size is divisible by 4, 2, or is odd. For short packed
18378 arrays, which are handled internally as modular types, the alignment
18379 will be as described for elementary types, e.g. a packed array of length
18380 31 bits will have an object size of four bytes, and an alignment of 4.
18381
18382 @item
18383 @emph{Records}.
18384
18385 For the normal unpacked case, the alignment of a record is equal to
18386 the maximum alignment of any of its components. For tagged records, this
18387 includes the implicit access type used for the tag. If a pragma @code{Pack}
18388 is used and all components are packable (see separate section on pragma
18389 @code{Pack}), then the resulting alignment is 1, unless the layout of the
18390 record makes it profitable to increase it.
18391
18392 A special case is when:
18393
18394
18395 @itemize *
18396
18397 @item
18398 the size of the record is given explicitly, or a
18399 full record representation clause is given, and
18400
18401 @item
18402 the size of the record is 2, 4, or 8 bytes.
18403 @end itemize
18404
18405 In this case, an alignment is chosen to match the
18406 size of the record. For example, if we have:
18407
18408 @example
18409 type Small is record
18410 A, B : Character;
18411 end record;
18412 for Small'Size use 16;
18413 @end example
18414
18415 then the default alignment of the record type @code{Small} is 2, not 1. This
18416 leads to more efficient code when the record is treated as a unit, and also
18417 allows the type to specified as @code{Atomic} on architectures requiring
18418 strict alignment.
18419 @end itemize
18420
18421 An alignment clause may specify a larger alignment than the default value
18422 up to some maximum value dependent on the target (obtainable by using the
18423 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
18424 a smaller alignment than the default value for enumeration, integer and
18425 fixed point types, as well as for record types, for example
18426
18427 @example
18428 type V is record
18429 A : Integer;
18430 end record;
18431
18432 for V'alignment use 1;
18433 @end example
18434
18435 @geindex Alignment
18436 @geindex default
18437
18438 The default alignment for the type @code{V} is 4, as a result of the
18439 Integer field in the record, but it is permissible, as shown, to
18440 override the default alignment of the record with a smaller value.
18441
18442 @geindex Alignment
18443 @geindex subtypes
18444
18445 Note that according to the Ada standard, an alignment clause applies only
18446 to the first named subtype. If additional subtypes are declared, then the
18447 compiler is allowed to choose any alignment it likes, and there is no way
18448 to control this choice. Consider:
18449
18450 @example
18451 type R is range 1 .. 10_000;
18452 for R'Alignment use 1;
18453 subtype RS is R range 1 .. 1000;
18454 @end example
18455
18456 The alignment clause specifies an alignment of 1 for the first named subtype
18457 @code{R} but this does not necessarily apply to @code{RS}. When writing
18458 portable Ada code, you should avoid writing code that explicitly or
18459 implicitly relies on the alignment of such subtypes.
18460
18461 For the GNAT compiler, if an explicit alignment clause is given, this
18462 value is also used for any subsequent subtypes. So for GNAT, in the
18463 above example, you can count on the alignment of @code{RS} being 1. But this
18464 assumption is non-portable, and other compilers may choose different
18465 alignments for the subtype @code{RS}.
18466
18467 @node Size Clauses,Storage_Size Clauses,Alignment Clauses,Representation Clauses and Pragmas
18468 @anchor{gnat_rm/representation_clauses_and_pragmas id3}@anchor{274}@anchor{gnat_rm/representation_clauses_and_pragmas size-clauses}@anchor{275}
18469 @section Size Clauses
18470
18471
18472 @geindex Size Clause
18473
18474 The default size for a type @code{T} is obtainable through the
18475 language-defined attribute @code{T'Size} and also through the
18476 equivalent GNAT-defined attribute @code{T'Value_Size}.
18477 For objects of type @code{T}, GNAT will generally increase the type size
18478 so that the object size (obtainable through the GNAT-defined attribute
18479 @code{T'Object_Size})
18480 is a multiple of @code{T'Alignment * Storage_Unit}.
18481
18482 For example:
18483
18484 @example
18485 type Smallint is range 1 .. 6;
18486
18487 type Rec is record
18488 Y1 : integer;
18489 Y2 : boolean;
18490 end record;
18491 @end example
18492
18493 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
18494 as specified by the RM rules,
18495 but objects of this type will have a size of 8
18496 (@code{Smallint'Object_Size} = 8),
18497 since objects by default occupy an integral number
18498 of storage units. On some targets, notably older
18499 versions of the Digital Alpha, the size of stand
18500 alone objects of this type may be 32, reflecting
18501 the inability of the hardware to do byte load/stores.
18502
18503 Similarly, the size of type @code{Rec} is 40 bits
18504 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
18505 the alignment is 4, so objects of this type will have
18506 their size increased to 64 bits so that it is a multiple
18507 of the alignment (in bits). This decision is
18508 in accordance with the specific Implementation Advice in RM 13.3(43):
18509
18510 @quotation
18511
18512 "A @code{Size} clause should be supported for an object if the specified
18513 @code{Size} is at least as large as its subtype's @code{Size}, and corresponds
18514 to a size in storage elements that is a multiple of the object's
18515 @code{Alignment} (if the @code{Alignment} is nonzero)."
18516 @end quotation
18517
18518 An explicit size clause may be used to override the default size by
18519 increasing it. For example, if we have:
18520
18521 @example
18522 type My_Boolean is new Boolean;
18523 for My_Boolean'Size use 32;
18524 @end example
18525
18526 then values of this type will always be 32 bits long. In the case of
18527 discrete types, the size can be increased up to 64 bits, with the effect
18528 that the entire specified field is used to hold the value, sign- or
18529 zero-extended as appropriate. If more than 64 bits is specified, then
18530 padding space is allocated after the value, and a warning is issued that
18531 there are unused bits.
18532
18533 Similarly the size of records and arrays may be increased, and the effect
18534 is to add padding bits after the value. This also causes a warning message
18535 to be generated.
18536
18537 The largest Size value permitted in GNAT is 2**31-1. Since this is a
18538 Size in bits, this corresponds to an object of size 256 megabytes (minus
18539 one). This limitation is true on all targets. The reason for this
18540 limitation is that it improves the quality of the code in many cases
18541 if it is known that a Size value can be accommodated in an object of
18542 type Integer.
18543
18544 @node Storage_Size Clauses,Size of Variant Record Objects,Size Clauses,Representation Clauses and Pragmas
18545 @anchor{gnat_rm/representation_clauses_and_pragmas storage-size-clauses}@anchor{276}@anchor{gnat_rm/representation_clauses_and_pragmas id4}@anchor{277}
18546 @section Storage_Size Clauses
18547
18548
18549 @geindex Storage_Size Clause
18550
18551 For tasks, the @code{Storage_Size} clause specifies the amount of space
18552 to be allocated for the task stack. This cannot be extended, and if the
18553 stack is exhausted, then @code{Storage_Error} will be raised (if stack
18554 checking is enabled). Use a @code{Storage_Size} attribute definition clause,
18555 or a @code{Storage_Size} pragma in the task definition to set the
18556 appropriate required size. A useful technique is to include in every
18557 task definition a pragma of the form:
18558
18559 @example
18560 pragma Storage_Size (Default_Stack_Size);
18561 @end example
18562
18563 Then @code{Default_Stack_Size} can be defined in a global package, and
18564 modified as required. Any tasks requiring stack sizes different from the
18565 default can have an appropriate alternative reference in the pragma.
18566
18567 You can also use the @emph{-d} binder switch to modify the default stack
18568 size.
18569
18570 For access types, the @code{Storage_Size} clause specifies the maximum
18571 space available for allocation of objects of the type. If this space is
18572 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
18573 In the case where the access type is declared local to a subprogram, the
18574 use of a @code{Storage_Size} clause triggers automatic use of a special
18575 predefined storage pool (@code{System.Pool_Size}) that ensures that all
18576 space for the pool is automatically reclaimed on exit from the scope in
18577 which the type is declared.
18578
18579 A special case recognized by the compiler is the specification of a
18580 @code{Storage_Size} of zero for an access type. This means that no
18581 items can be allocated from the pool, and this is recognized at compile
18582 time, and all the overhead normally associated with maintaining a fixed
18583 size storage pool is eliminated. Consider the following example:
18584
18585 @example
18586 procedure p is
18587 type R is array (Natural) of Character;
18588 type P is access all R;
18589 for P'Storage_Size use 0;
18590 -- Above access type intended only for interfacing purposes
18591
18592 y : P;
18593
18594 procedure g (m : P);
18595 pragma Import (C, g);
18596
18597 -- ...
18598
18599 begin
18600 -- ...
18601 y := new R;
18602 end;
18603 @end example
18604
18605 As indicated in this example, these dummy storage pools are often useful in
18606 connection with interfacing where no object will ever be allocated. If you
18607 compile the above example, you get the warning:
18608
18609 @example
18610 p.adb:16:09: warning: allocation from empty storage pool
18611 p.adb:16:09: warning: Storage_Error will be raised at run time
18612 @end example
18613
18614 Of course in practice, there will not be any explicit allocators in the
18615 case of such an access declaration.
18616
18617 @node Size of Variant Record Objects,Biased Representation,Storage_Size Clauses,Representation Clauses and Pragmas
18618 @anchor{gnat_rm/representation_clauses_and_pragmas id5}@anchor{278}@anchor{gnat_rm/representation_clauses_and_pragmas size-of-variant-record-objects}@anchor{279}
18619 @section Size of Variant Record Objects
18620
18621
18622 @geindex Size
18623 @geindex variant record objects
18624
18625 @geindex Variant record objects
18626 @geindex size
18627
18628 In the case of variant record objects, there is a question whether Size gives
18629 information about a particular variant, or the maximum size required
18630 for any variant. Consider the following program
18631
18632 @example
18633 with Text_IO; use Text_IO;
18634 procedure q is
18635 type R1 (A : Boolean := False) is record
18636 case A is
18637 when True => X : Character;
18638 when False => null;
18639 end case;
18640 end record;
18641
18642 V1 : R1 (False);
18643 V2 : R1;
18644
18645 begin
18646 Put_Line (Integer'Image (V1'Size));
18647 Put_Line (Integer'Image (V2'Size));
18648 end q;
18649 @end example
18650
18651 Here we are dealing with a variant record, where the True variant
18652 requires 16 bits, and the False variant requires 8 bits.
18653 In the above example, both V1 and V2 contain the False variant,
18654 which is only 8 bits long. However, the result of running the
18655 program is:
18656
18657 @example
18658 8
18659 16
18660 @end example
18661
18662 The reason for the difference here is that the discriminant value of
18663 V1 is fixed, and will always be False. It is not possible to assign
18664 a True variant value to V1, therefore 8 bits is sufficient. On the
18665 other hand, in the case of V2, the initial discriminant value is
18666 False (from the default), but it is possible to assign a True
18667 variant value to V2, therefore 16 bits must be allocated for V2
18668 in the general case, even fewer bits may be needed at any particular
18669 point during the program execution.
18670
18671 As can be seen from the output of this program, the @code{'Size}
18672 attribute applied to such an object in GNAT gives the actual allocated
18673 size of the variable, which is the largest size of any of the variants.
18674 The Ada Reference Manual is not completely clear on what choice should
18675 be made here, but the GNAT behavior seems most consistent with the
18676 language in the RM.
18677
18678 In some cases, it may be desirable to obtain the size of the current
18679 variant, rather than the size of the largest variant. This can be
18680 achieved in GNAT by making use of the fact that in the case of a
18681 subprogram parameter, GNAT does indeed return the size of the current
18682 variant (because a subprogram has no way of knowing how much space
18683 is actually allocated for the actual).
18684
18685 Consider the following modified version of the above program:
18686
18687 @example
18688 with Text_IO; use Text_IO;
18689 procedure q is
18690 type R1 (A : Boolean := False) is record
18691 case A is
18692 when True => X : Character;
18693 when False => null;
18694 end case;
18695 end record;
18696
18697 V2 : R1;
18698
18699 function Size (V : R1) return Integer is
18700 begin
18701 return V'Size;
18702 end Size;
18703
18704 begin
18705 Put_Line (Integer'Image (V2'Size));
18706 Put_Line (Integer'Image (Size (V2)));
18707 V2 := (True, 'x');
18708 Put_Line (Integer'Image (V2'Size));
18709 Put_Line (Integer'Image (Size (V2)));
18710 end q;
18711 @end example
18712
18713 The output from this program is
18714
18715 @example
18716 16
18717 8
18718 16
18719 16
18720 @end example
18721
18722 Here we see that while the @code{'Size} attribute always returns
18723 the maximum size, regardless of the current variant value, the
18724 @code{Size} function does indeed return the size of the current
18725 variant value.
18726
18727 @node Biased Representation,Value_Size and Object_Size Clauses,Size of Variant Record Objects,Representation Clauses and Pragmas
18728 @anchor{gnat_rm/representation_clauses_and_pragmas id6}@anchor{27a}@anchor{gnat_rm/representation_clauses_and_pragmas biased-representation}@anchor{27b}
18729 @section Biased Representation
18730
18731
18732 @geindex Size for biased representation
18733
18734 @geindex Biased representation
18735
18736 In the case of scalars with a range starting at other than zero, it is
18737 possible in some cases to specify a size smaller than the default minimum
18738 value, and in such cases, GNAT uses an unsigned biased representation,
18739 in which zero is used to represent the lower bound, and successive values
18740 represent successive values of the type.
18741
18742 For example, suppose we have the declaration:
18743
18744 @example
18745 type Small is range -7 .. -4;
18746 for Small'Size use 2;
18747 @end example
18748
18749 Although the default size of type @code{Small} is 4, the @code{Size}
18750 clause is accepted by GNAT and results in the following representation
18751 scheme:
18752
18753 @example
18754 -7 is represented as 2#00#
18755 -6 is represented as 2#01#
18756 -5 is represented as 2#10#
18757 -4 is represented as 2#11#
18758 @end example
18759
18760 Biased representation is only used if the specified @code{Size} clause
18761 cannot be accepted in any other manner. These reduced sizes that force
18762 biased representation can be used for all discrete types except for
18763 enumeration types for which a representation clause is given.
18764
18765 @node Value_Size and Object_Size Clauses,Component_Size Clauses,Biased Representation,Representation Clauses and Pragmas
18766 @anchor{gnat_rm/representation_clauses_and_pragmas id7}@anchor{27c}@anchor{gnat_rm/representation_clauses_and_pragmas value-size-and-object-size-clauses}@anchor{27d}
18767 @section Value_Size and Object_Size Clauses
18768
18769
18770 @geindex Value_Size
18771
18772 @geindex Object_Size
18773
18774 @geindex Size
18775 @geindex of objects
18776
18777 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
18778 number of bits required to hold values of type @code{T}.
18779 Although this interpretation was allowed in Ada 83, it was not required,
18780 and this requirement in practice can cause some significant difficulties.
18781 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
18782 However, in Ada 95 and Ada 2005,
18783 @code{Natural'Size} is
18784 typically 31. This means that code may change in behavior when moving
18785 from Ada 83 to Ada 95 or Ada 2005. For example, consider:
18786
18787 @example
18788 type Rec is record;
18789 A : Natural;
18790 B : Natural;
18791 end record;
18792
18793 for Rec use record
18794 at 0 range 0 .. Natural'Size - 1;
18795 at 0 range Natural'Size .. 2 * Natural'Size - 1;
18796 end record;
18797 @end example
18798
18799 In the above code, since the typical size of @code{Natural} objects
18800 is 32 bits and @code{Natural'Size} is 31, the above code can cause
18801 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
18802 there are cases where the fact that the object size can exceed the
18803 size of the type causes surprises.
18804
18805 To help get around this problem GNAT provides two implementation
18806 defined attributes, @code{Value_Size} and @code{Object_Size}. When
18807 applied to a type, these attributes yield the size of the type
18808 (corresponding to the RM defined size attribute), and the size of
18809 objects of the type respectively.
18810
18811 The @code{Object_Size} is used for determining the default size of
18812 objects and components. This size value can be referred to using the
18813 @code{Object_Size} attribute. The phrase 'is used' here means that it is
18814 the basis of the determination of the size. The backend is free to
18815 pad this up if necessary for efficiency, e.g., an 8-bit stand-alone
18816 character might be stored in 32 bits on a machine with no efficient
18817 byte access instructions such as the Alpha.
18818
18819 The default rules for the value of @code{Object_Size} for
18820 discrete types are as follows:
18821
18822
18823 @itemize *
18824
18825 @item
18826 The @code{Object_Size} for base subtypes reflect the natural hardware
18827 size in bits (run the compiler with @emph{-gnatS} to find those values
18828 for numeric types). Enumeration types and fixed-point base subtypes have
18829 8, 16, 32, or 64 bits for this size, depending on the range of values
18830 to be stored.
18831
18832 @item
18833 The @code{Object_Size} of a subtype is the same as the
18834 @code{Object_Size} of
18835 the type from which it is obtained.
18836
18837 @item
18838 The @code{Object_Size} of a derived base type is copied from the parent
18839 base type, and the @code{Object_Size} of a derived first subtype is copied
18840 from the parent first subtype.
18841 @end itemize
18842
18843 The @code{Value_Size} attribute
18844 is the (minimum) number of bits required to store a value
18845 of the type.
18846 This value is used to determine how tightly to pack
18847 records or arrays with components of this type, and also affects
18848 the semantics of unchecked conversion (unchecked conversions where
18849 the @code{Value_Size} values differ generate a warning, and are potentially
18850 target dependent).
18851
18852 The default rules for the value of @code{Value_Size} are as follows:
18853
18854
18855 @itemize *
18856
18857 @item
18858 The @code{Value_Size} for a base subtype is the minimum number of bits
18859 required to store all values of the type (including the sign bit
18860 only if negative values are possible).
18861
18862 @item
18863 If a subtype statically matches the first subtype of a given type, then it has
18864 by default the same @code{Value_Size} as the first subtype. This is a
18865 consequence of RM 13.1(14): "if two subtypes statically match,
18866 then their subtype-specific aspects are the same".)
18867
18868 @item
18869 All other subtypes have a @code{Value_Size} corresponding to the minimum
18870 number of bits required to store all values of the subtype. For
18871 dynamic bounds, it is assumed that the value can range down or up
18872 to the corresponding bound of the ancestor
18873 @end itemize
18874
18875 The RM defined attribute @code{Size} corresponds to the
18876 @code{Value_Size} attribute.
18877
18878 The @code{Size} attribute may be defined for a first-named subtype. This sets
18879 the @code{Value_Size} of
18880 the first-named subtype to the given value, and the
18881 @code{Object_Size} of this first-named subtype to the given value padded up
18882 to an appropriate boundary. It is a consequence of the default rules
18883 above that this @code{Object_Size} will apply to all further subtypes. On the
18884 other hand, @code{Value_Size} is affected only for the first subtype, any
18885 dynamic subtypes obtained from it directly, and any statically matching
18886 subtypes. The @code{Value_Size} of any other static subtypes is not affected.
18887
18888 @code{Value_Size} and
18889 @code{Object_Size} may be explicitly set for any subtype using
18890 an attribute definition clause. Note that the use of these attributes
18891 can cause the RM 13.1(14) rule to be violated. If two access types
18892 reference aliased objects whose subtypes have differing @code{Object_Size}
18893 values as a result of explicit attribute definition clauses, then it
18894 is illegal to convert from one access subtype to the other. For a more
18895 complete description of this additional legality rule, see the
18896 description of the @code{Object_Size} attribute.
18897
18898 To get a feel for the difference, consider the following examples (note
18899 that in each case the base is @code{Short_Short_Integer} with a size of 8):
18900
18901
18902 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxx}
18903 @headitem
18904
18905 Type or subtype declaration
18906
18907 @tab
18908
18909 Object_Size
18910
18911 @tab
18912
18913 Value_Size
18914
18915 @item
18916
18917 @code{type x1 is range 0 .. 5;}
18918
18919 @tab
18920
18921 8
18922
18923 @tab
18924
18925 3
18926
18927 @item
18928
18929 @code{type x2 is range 0 .. 5;}
18930 @code{for x2'size use 12;}
18931
18932 @tab
18933
18934 16
18935
18936 @tab
18937
18938 12
18939
18940 @item
18941
18942 @code{subtype x3 is x2 range 0 .. 3;}
18943
18944 @tab
18945
18946 16
18947
18948 @tab
18949
18950 2
18951
18952 @item
18953
18954 @code{subtype x4 is x2'base range 0 .. 10;}
18955
18956 @tab
18957
18958 8
18959
18960 @tab
18961
18962 4
18963
18964 @item
18965
18966 @code{dynamic : x2'Base range -64 .. +63;}
18967
18968 @tab
18969
18970 @tab
18971
18972 @item
18973
18974 @code{subtype x5 is x2 range 0 .. dynamic;}
18975
18976 @tab
18977
18978 16
18979
18980 @tab
18981
18982 3*
18983
18984 @item
18985
18986 @code{subtype x6 is x2'base range 0 .. dynamic;}
18987
18988 @tab
18989
18990 8
18991
18992 @tab
18993
18994 7*
18995
18996 @end multitable
18997
18998
18999 Note: the entries marked '*' are not actually specified by the Ada
19000 Reference Manual, which has nothing to say about size in the dynamic
19001 case. What GNAT does is to allocate sufficient bits to accomodate any
19002 possible dynamic values for the bounds at run-time.
19003
19004 So far, so good, but GNAT has to obey the RM rules, so the question is
19005 under what conditions must the RM @code{Size} be used.
19006 The following is a list
19007 of the occasions on which the RM @code{Size} must be used:
19008
19009
19010 @itemize *
19011
19012 @item
19013 Component size for packed arrays or records
19014
19015 @item
19016 Value of the attribute @code{Size} for a type
19017
19018 @item
19019 Warning about sizes not matching for unchecked conversion
19020 @end itemize
19021
19022 For record types, the @code{Object_Size} is always a multiple of the
19023 alignment of the type (this is true for all types). In some cases the
19024 @code{Value_Size} can be smaller. Consider:
19025
19026 @example
19027 type R is record
19028 X : Integer;
19029 Y : Character;
19030 end record;
19031 @end example
19032
19033 On a typical 32-bit architecture, the X component will occupy four bytes
19034 and the Y component will occupy one byte, for a total of 5 bytes. As a
19035 result @code{R'Value_Size} will be 40 (bits) since this is the minimum size
19036 required to store a value of this type. For example, it is permissible
19037 to have a component of type R in an array whose component size is
19038 specified to be 40 bits.
19039
19040 However, @code{R'Object_Size} will be 64 (bits). The difference is due to
19041 the alignment requirement for objects of the record type. The X
19042 component will require four-byte alignment because that is what type
19043 Integer requires, whereas the Y component, a Character, will only
19044 require 1-byte alignment. Since the alignment required for X is the
19045 greatest of all the components' alignments, that is the alignment
19046 required for the enclosing record type, i.e., 4 bytes or 32 bits. As
19047 indicated above, the actual object size must be rounded up so that it is
19048 a multiple of the alignment value. Therefore, 40 bits rounded up to the
19049 next multiple of 32 yields 64 bits.
19050
19051 For all other types, the @code{Object_Size}
19052 and @code{Value_Size} are the same (and equivalent to the RM attribute @code{Size}).
19053 Only @code{Size} may be specified for such types.
19054
19055 Note that @code{Value_Size} can be used to force biased representation
19056 for a particular subtype. Consider this example:
19057
19058 @example
19059 type R is (A, B, C, D, E, F);
19060 subtype RAB is R range A .. B;
19061 subtype REF is R range E .. F;
19062 @end example
19063
19064 By default, @code{RAB}
19065 has a size of 1 (sufficient to accommodate the representation
19066 of @code{A} and @code{B}, 0 and 1), and @code{REF}
19067 has a size of 3 (sufficient to accommodate the representation
19068 of @code{E} and @code{F}, 4 and 5). But if we add the
19069 following @code{Value_Size} attribute definition clause:
19070
19071 @example
19072 for REF'Value_Size use 1;
19073 @end example
19074
19075 then biased representation is forced for @code{REF},
19076 and 0 will represent @code{E} and 1 will represent @code{F}.
19077 A warning is issued when a @code{Value_Size} attribute
19078 definition clause forces biased representation. This
19079 warning can be turned off using @code{-gnatw.B}.
19080
19081 @node Component_Size Clauses,Bit_Order Clauses,Value_Size and Object_Size Clauses,Representation Clauses and Pragmas
19082 @anchor{gnat_rm/representation_clauses_and_pragmas id8}@anchor{27e}@anchor{gnat_rm/representation_clauses_and_pragmas component-size-clauses}@anchor{27f}
19083 @section Component_Size Clauses
19084
19085
19086 @geindex Component_Size Clause
19087
19088 Normally, the value specified in a component size clause must be consistent
19089 with the subtype of the array component with regard to size and alignment.
19090 In other words, the value specified must be at least equal to the size
19091 of this subtype, and must be a multiple of the alignment value.
19092
19093 In addition, component size clauses are allowed which cause the array
19094 to be packed, by specifying a smaller value. A first case is for
19095 component size values in the range 1 through 63. The value specified
19096 must not be smaller than the Size of the subtype. GNAT will accurately
19097 honor all packing requests in this range. For example, if we have:
19098
19099 @example
19100 type r is array (1 .. 8) of Natural;
19101 for r'Component_Size use 31;
19102 @end example
19103
19104 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
19105 Of course access to the components of such an array is considerably
19106 less efficient than if the natural component size of 32 is used.
19107 A second case is when the subtype of the component is a record type
19108 padded because of its default alignment. For example, if we have:
19109
19110 @example
19111 type r is record
19112 i : Integer;
19113 j : Integer;
19114 b : Boolean;
19115 end record;
19116
19117 type a is array (1 .. 8) of r;
19118 for a'Component_Size use 72;
19119 @end example
19120
19121 then the resulting array has a length of 72 bytes, instead of 96 bytes
19122 if the alignment of the record (4) was obeyed.
19123
19124 Note that there is no point in giving both a component size clause
19125 and a pragma Pack for the same array type. if such duplicate
19126 clauses are given, the pragma Pack will be ignored.
19127
19128 @node Bit_Order Clauses,Effect of Bit_Order on Byte Ordering,Component_Size Clauses,Representation Clauses and Pragmas
19129 @anchor{gnat_rm/representation_clauses_and_pragmas bit-order-clauses}@anchor{280}@anchor{gnat_rm/representation_clauses_and_pragmas id9}@anchor{281}
19130 @section Bit_Order Clauses
19131
19132
19133 @geindex Bit_Order Clause
19134
19135 @geindex bit ordering
19136
19137 @geindex ordering
19138 @geindex of bits
19139
19140 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
19141 attribute. The specification may either correspond to the default bit
19142 order for the target, in which case the specification has no effect and
19143 places no additional restrictions, or it may be for the non-standard
19144 setting (that is the opposite of the default).
19145
19146 In the case where the non-standard value is specified, the effect is
19147 to renumber bits within each byte, but the ordering of bytes is not
19148 affected. There are certain
19149 restrictions placed on component clauses as follows:
19150
19151
19152 @itemize *
19153
19154 @item
19155 Components fitting within a single storage unit.
19156
19157 These are unrestricted, and the effect is merely to renumber bits. For
19158 example if we are on a little-endian machine with @code{Low_Order_First}
19159 being the default, then the following two declarations have exactly
19160 the same effect:
19161
19162 @example
19163 type R1 is record
19164 A : Boolean;
19165 B : Integer range 1 .. 120;
19166 end record;
19167
19168 for R1 use record
19169 A at 0 range 0 .. 0;
19170 B at 0 range 1 .. 7;
19171 end record;
19172
19173 type R2 is record
19174 A : Boolean;
19175 B : Integer range 1 .. 120;
19176 end record;
19177
19178 for R2'Bit_Order use High_Order_First;
19179
19180 for R2 use record
19181 A at 0 range 7 .. 7;
19182 B at 0 range 0 .. 6;
19183 end record;
19184 @end example
19185
19186 The useful application here is to write the second declaration with the
19187 @code{Bit_Order} attribute definition clause, and know that it will be treated
19188 the same, regardless of whether the target is little-endian or big-endian.
19189
19190 @item
19191 Components occupying an integral number of bytes.
19192
19193 These are components that exactly fit in two or more bytes. Such component
19194 declarations are allowed, but have no effect, since it is important to realize
19195 that the @code{Bit_Order} specification does not affect the ordering of bytes.
19196 In particular, the following attempt at getting an endian-independent integer
19197 does not work:
19198
19199 @example
19200 type R2 is record
19201 A : Integer;
19202 end record;
19203
19204 for R2'Bit_Order use High_Order_First;
19205
19206 for R2 use record
19207 A at 0 range 0 .. 31;
19208 end record;
19209 @end example
19210
19211 This declaration will result in a little-endian integer on a
19212 little-endian machine, and a big-endian integer on a big-endian machine.
19213 If byte flipping is required for interoperability between big- and
19214 little-endian machines, this must be explicitly programmed. This capability
19215 is not provided by @code{Bit_Order}.
19216
19217 @item
19218 Components that are positioned across byte boundaries.
19219
19220 but do not occupy an integral number of bytes. Given that bytes are not
19221 reordered, such fields would occupy a non-contiguous sequence of bits
19222 in memory, requiring non-trivial code to reassemble. They are for this
19223 reason not permitted, and any component clause specifying such a layout
19224 will be flagged as illegal by GNAT.
19225 @end itemize
19226
19227 Since the misconception that Bit_Order automatically deals with all
19228 endian-related incompatibilities is a common one, the specification of
19229 a component field that is an integral number of bytes will always
19230 generate a warning. This warning may be suppressed using @code{pragma Warnings (Off)}
19231 if desired. The following section contains additional
19232 details regarding the issue of byte ordering.
19233
19234 @node Effect of Bit_Order on Byte Ordering,Pragma Pack for Arrays,Bit_Order Clauses,Representation Clauses and Pragmas
19235 @anchor{gnat_rm/representation_clauses_and_pragmas id10}@anchor{282}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-bit-order-on-byte-ordering}@anchor{283}
19236 @section Effect of Bit_Order on Byte Ordering
19237
19238
19239 @geindex byte ordering
19240
19241 @geindex ordering
19242 @geindex of bytes
19243
19244 In this section we will review the effect of the @code{Bit_Order} attribute
19245 definition clause on byte ordering. Briefly, it has no effect at all, but
19246 a detailed example will be helpful. Before giving this
19247 example, let us review the precise
19248 definition of the effect of defining @code{Bit_Order}. The effect of a
19249 non-standard bit order is described in section 13.5.3 of the Ada
19250 Reference Manual:
19251
19252 @quotation
19253
19254 "2 A bit ordering is a method of interpreting the meaning of
19255 the storage place attributes."
19256 @end quotation
19257
19258 To understand the precise definition of storage place attributes in
19259 this context, we visit section 13.5.1 of the manual:
19260
19261 @quotation
19262
19263 "13 A record_representation_clause (without the mod_clause)
19264 specifies the layout. The storage place attributes (see 13.5.2)
19265 are taken from the values of the position, first_bit, and last_bit
19266 expressions after normalizing those values so that first_bit is
19267 less than Storage_Unit."
19268 @end quotation
19269
19270 The critical point here is that storage places are taken from
19271 the values after normalization, not before. So the @code{Bit_Order}
19272 interpretation applies to normalized values. The interpretation
19273 is described in the later part of the 13.5.3 paragraph:
19274
19275 @quotation
19276
19277 "2 A bit ordering is a method of interpreting the meaning of
19278 the storage place attributes. High_Order_First (known in the
19279 vernacular as 'big endian') means that the first bit of a
19280 storage element (bit 0) is the most significant bit (interpreting
19281 the sequence of bits that represent a component as an unsigned
19282 integer value). Low_Order_First (known in the vernacular as
19283 'little endian') means the opposite: the first bit is the
19284 least significant."
19285 @end quotation
19286
19287 Note that the numbering is with respect to the bits of a storage
19288 unit. In other words, the specification affects only the numbering
19289 of bits within a single storage unit.
19290
19291 We can make the effect clearer by giving an example.
19292
19293 Suppose that we have an external device which presents two bytes, the first
19294 byte presented, which is the first (low addressed byte) of the two byte
19295 record is called Master, and the second byte is called Slave.
19296
19297 The left most (most significant bit is called Control for each byte, and
19298 the remaining 7 bits are called V1, V2, ... V7, where V7 is the rightmost
19299 (least significant) bit.
19300
19301 On a big-endian machine, we can write the following representation clause
19302
19303 @example
19304 type Data is record
19305 Master_Control : Bit;
19306 Master_V1 : Bit;
19307 Master_V2 : Bit;
19308 Master_V3 : Bit;
19309 Master_V4 : Bit;
19310 Master_V5 : Bit;
19311 Master_V6 : Bit;
19312 Master_V7 : Bit;
19313 Slave_Control : Bit;
19314 Slave_V1 : Bit;
19315 Slave_V2 : Bit;
19316 Slave_V3 : Bit;
19317 Slave_V4 : Bit;
19318 Slave_V5 : Bit;
19319 Slave_V6 : Bit;
19320 Slave_V7 : Bit;
19321 end record;
19322
19323 for Data use record
19324 Master_Control at 0 range 0 .. 0;
19325 Master_V1 at 0 range 1 .. 1;
19326 Master_V2 at 0 range 2 .. 2;
19327 Master_V3 at 0 range 3 .. 3;
19328 Master_V4 at 0 range 4 .. 4;
19329 Master_V5 at 0 range 5 .. 5;
19330 Master_V6 at 0 range 6 .. 6;
19331 Master_V7 at 0 range 7 .. 7;
19332 Slave_Control at 1 range 0 .. 0;
19333 Slave_V1 at 1 range 1 .. 1;
19334 Slave_V2 at 1 range 2 .. 2;
19335 Slave_V3 at 1 range 3 .. 3;
19336 Slave_V4 at 1 range 4 .. 4;
19337 Slave_V5 at 1 range 5 .. 5;
19338 Slave_V6 at 1 range 6 .. 6;
19339 Slave_V7 at 1 range 7 .. 7;
19340 end record;
19341 @end example
19342
19343 Now if we move this to a little endian machine, then the bit ordering within
19344 the byte is backwards, so we have to rewrite the record rep clause as:
19345
19346 @example
19347 for Data use record
19348 Master_Control at 0 range 7 .. 7;
19349 Master_V1 at 0 range 6 .. 6;
19350 Master_V2 at 0 range 5 .. 5;
19351 Master_V3 at 0 range 4 .. 4;
19352 Master_V4 at 0 range 3 .. 3;
19353 Master_V5 at 0 range 2 .. 2;
19354 Master_V6 at 0 range 1 .. 1;
19355 Master_V7 at 0 range 0 .. 0;
19356 Slave_Control at 1 range 7 .. 7;
19357 Slave_V1 at 1 range 6 .. 6;
19358 Slave_V2 at 1 range 5 .. 5;
19359 Slave_V3 at 1 range 4 .. 4;
19360 Slave_V4 at 1 range 3 .. 3;
19361 Slave_V5 at 1 range 2 .. 2;
19362 Slave_V6 at 1 range 1 .. 1;
19363 Slave_V7 at 1 range 0 .. 0;
19364 end record;
19365 @end example
19366
19367 It is a nuisance to have to rewrite the clause, especially if
19368 the code has to be maintained on both machines. However,
19369 this is a case that we can handle with the
19370 @code{Bit_Order} attribute if it is implemented.
19371 Note that the implementation is not required on byte addressed
19372 machines, but it is indeed implemented in GNAT.
19373 This means that we can simply use the
19374 first record clause, together with the declaration
19375
19376 @example
19377 for Data'Bit_Order use High_Order_First;
19378 @end example
19379
19380 and the effect is what is desired, namely the layout is exactly the same,
19381 independent of whether the code is compiled on a big-endian or little-endian
19382 machine.
19383
19384 The important point to understand is that byte ordering is not affected.
19385 A @code{Bit_Order} attribute definition never affects which byte a field
19386 ends up in, only where it ends up in that byte.
19387 To make this clear, let us rewrite the record rep clause of the previous
19388 example as:
19389
19390 @example
19391 for Data'Bit_Order use High_Order_First;
19392 for Data use record
19393 Master_Control at 0 range 0 .. 0;
19394 Master_V1 at 0 range 1 .. 1;
19395 Master_V2 at 0 range 2 .. 2;
19396 Master_V3 at 0 range 3 .. 3;
19397 Master_V4 at 0 range 4 .. 4;
19398 Master_V5 at 0 range 5 .. 5;
19399 Master_V6 at 0 range 6 .. 6;
19400 Master_V7 at 0 range 7 .. 7;
19401 Slave_Control at 0 range 8 .. 8;
19402 Slave_V1 at 0 range 9 .. 9;
19403 Slave_V2 at 0 range 10 .. 10;
19404 Slave_V3 at 0 range 11 .. 11;
19405 Slave_V4 at 0 range 12 .. 12;
19406 Slave_V5 at 0 range 13 .. 13;
19407 Slave_V6 at 0 range 14 .. 14;
19408 Slave_V7 at 0 range 15 .. 15;
19409 end record;
19410 @end example
19411
19412 This is exactly equivalent to saying (a repeat of the first example):
19413
19414 @example
19415 for Data'Bit_Order use High_Order_First;
19416 for Data use record
19417 Master_Control at 0 range 0 .. 0;
19418 Master_V1 at 0 range 1 .. 1;
19419 Master_V2 at 0 range 2 .. 2;
19420 Master_V3 at 0 range 3 .. 3;
19421 Master_V4 at 0 range 4 .. 4;
19422 Master_V5 at 0 range 5 .. 5;
19423 Master_V6 at 0 range 6 .. 6;
19424 Master_V7 at 0 range 7 .. 7;
19425 Slave_Control at 1 range 0 .. 0;
19426 Slave_V1 at 1 range 1 .. 1;
19427 Slave_V2 at 1 range 2 .. 2;
19428 Slave_V3 at 1 range 3 .. 3;
19429 Slave_V4 at 1 range 4 .. 4;
19430 Slave_V5 at 1 range 5 .. 5;
19431 Slave_V6 at 1 range 6 .. 6;
19432 Slave_V7 at 1 range 7 .. 7;
19433 end record;
19434 @end example
19435
19436 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
19437 field. The storage place attributes are obtained by normalizing the
19438 values given so that the @code{First_Bit} value is less than 8. After
19439 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
19440 we specified in the other case.
19441
19442 Now one might expect that the @code{Bit_Order} attribute might affect
19443 bit numbering within the entire record component (two bytes in this
19444 case, thus affecting which byte fields end up in), but that is not
19445 the way this feature is defined, it only affects numbering of bits,
19446 not which byte they end up in.
19447
19448 Consequently it never makes sense to specify a starting bit number
19449 greater than 7 (for a byte addressable field) if an attribute
19450 definition for @code{Bit_Order} has been given, and indeed it
19451 may be actively confusing to specify such a value, so the compiler
19452 generates a warning for such usage.
19453
19454 If you do need to control byte ordering then appropriate conditional
19455 values must be used. If in our example, the slave byte came first on
19456 some machines we might write:
19457
19458 @example
19459 Master_Byte_First constant Boolean := ...;
19460
19461 Master_Byte : constant Natural :=
19462 1 - Boolean'Pos (Master_Byte_First);
19463 Slave_Byte : constant Natural :=
19464 Boolean'Pos (Master_Byte_First);
19465
19466 for Data'Bit_Order use High_Order_First;
19467 for Data use record
19468 Master_Control at Master_Byte range 0 .. 0;
19469 Master_V1 at Master_Byte range 1 .. 1;
19470 Master_V2 at Master_Byte range 2 .. 2;
19471 Master_V3 at Master_Byte range 3 .. 3;
19472 Master_V4 at Master_Byte range 4 .. 4;
19473 Master_V5 at Master_Byte range 5 .. 5;
19474 Master_V6 at Master_Byte range 6 .. 6;
19475 Master_V7 at Master_Byte range 7 .. 7;
19476 Slave_Control at Slave_Byte range 0 .. 0;
19477 Slave_V1 at Slave_Byte range 1 .. 1;
19478 Slave_V2 at Slave_Byte range 2 .. 2;
19479 Slave_V3 at Slave_Byte range 3 .. 3;
19480 Slave_V4 at Slave_Byte range 4 .. 4;
19481 Slave_V5 at Slave_Byte range 5 .. 5;
19482 Slave_V6 at Slave_Byte range 6 .. 6;
19483 Slave_V7 at Slave_Byte range 7 .. 7;
19484 end record;
19485 @end example
19486
19487 Now to switch between machines, all that is necessary is
19488 to set the boolean constant @code{Master_Byte_First} in
19489 an appropriate manner.
19490
19491 @node Pragma Pack for Arrays,Pragma Pack for Records,Effect of Bit_Order on Byte Ordering,Representation Clauses and Pragmas
19492 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-arrays}@anchor{284}@anchor{gnat_rm/representation_clauses_and_pragmas id11}@anchor{285}
19493 @section Pragma Pack for Arrays
19494
19495
19496 @geindex Pragma Pack (for arrays)
19497
19498 Pragma @code{Pack} applied to an array has an effect that depends upon whether the
19499 component type is @emph{packable}. For a component type to be @emph{packable}, it must
19500 be one of the following cases:
19501
19502
19503 @itemize *
19504
19505 @item
19506 Any elementary type.
19507
19508 @item
19509 Any small packed array type with a static size.
19510
19511 @item
19512 Any small simple record type with a static size.
19513 @end itemize
19514
19515 For all these cases, if the component subtype size is in the range
19516 1 through 64, then the effect of the pragma @code{Pack} is exactly as though a
19517 component size were specified giving the component subtype size.
19518
19519 All other types are non-packable, they occupy an integral number of storage
19520 units and the only effect of pragma Pack is to remove alignment gaps.
19521
19522 For example if we have:
19523
19524 @example
19525 type r is range 0 .. 17;
19526
19527 type ar is array (1 .. 8) of r;
19528 pragma Pack (ar);
19529 @end example
19530
19531 Then the component size of @code{ar} will be set to 5 (i.e., to @code{r'size},
19532 and the size of the array @code{ar} will be exactly 40 bits).
19533
19534 Note that in some cases this rather fierce approach to packing can produce
19535 unexpected effects. For example, in Ada 95 and Ada 2005,
19536 subtype @code{Natural} typically has a size of 31, meaning that if you
19537 pack an array of @code{Natural}, you get 31-bit
19538 close packing, which saves a few bits, but results in far less efficient
19539 access. Since many other Ada compilers will ignore such a packing request,
19540 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
19541 might not be what is intended. You can easily remove this warning by
19542 using an explicit @code{Component_Size} setting instead, which never generates
19543 a warning, since the intention of the programmer is clear in this case.
19544
19545 GNAT treats packed arrays in one of two ways. If the size of the array is
19546 known at compile time and is less than 64 bits, then internally the array
19547 is represented as a single modular type, of exactly the appropriate number
19548 of bits. If the length is greater than 63 bits, or is not known at compile
19549 time, then the packed array is represented as an array of bytes, and the
19550 length is always a multiple of 8 bits.
19551
19552 Note that to represent a packed array as a modular type, the alignment must
19553 be suitable for the modular type involved. For example, on typical machines
19554 a 32-bit packed array will be represented by a 32-bit modular integer with
19555 an alignment of four bytes. If you explicitly override the default alignment
19556 with an alignment clause that is too small, the modular representation
19557 cannot be used. For example, consider the following set of declarations:
19558
19559 @example
19560 type R is range 1 .. 3;
19561 type S is array (1 .. 31) of R;
19562 for S'Component_Size use 2;
19563 for S'Size use 62;
19564 for S'Alignment use 1;
19565 @end example
19566
19567 If the alignment clause were not present, then a 62-bit modular
19568 representation would be chosen (typically with an alignment of 4 or 8
19569 bytes depending on the target). But the default alignment is overridden
19570 with the explicit alignment clause. This means that the modular
19571 representation cannot be used, and instead the array of bytes
19572 representation must be used, meaning that the length must be a multiple
19573 of 8. Thus the above set of declarations will result in a diagnostic
19574 rejecting the size clause and noting that the minimum size allowed is 64.
19575
19576 @geindex Pragma Pack (for type Natural)
19577
19578 @geindex Pragma Pack warning
19579
19580 One special case that is worth noting occurs when the base type of the
19581 component size is 8/16/32 and the subtype is one bit less. Notably this
19582 occurs with subtype @code{Natural}. Consider:
19583
19584 @example
19585 type Arr is array (1 .. 32) of Natural;
19586 pragma Pack (Arr);
19587 @end example
19588
19589 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
19590 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
19591 Ada 83 compilers did not attempt 31 bit packing.
19592
19593 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
19594 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
19595 substantial unintended performance penalty when porting legacy Ada 83 code.
19596 To help prevent this, GNAT generates a warning in such cases. If you really
19597 want 31 bit packing in a case like this, you can set the component size
19598 explicitly:
19599
19600 @example
19601 type Arr is array (1 .. 32) of Natural;
19602 for Arr'Component_Size use 31;
19603 @end example
19604
19605 Here 31-bit packing is achieved as required, and no warning is generated,
19606 since in this case the programmer intention is clear.
19607
19608 @node Pragma Pack for Records,Record Representation Clauses,Pragma Pack for Arrays,Representation Clauses and Pragmas
19609 @anchor{gnat_rm/representation_clauses_and_pragmas pragma-pack-for-records}@anchor{286}@anchor{gnat_rm/representation_clauses_and_pragmas id12}@anchor{287}
19610 @section Pragma Pack for Records
19611
19612
19613 @geindex Pragma Pack (for records)
19614
19615 Pragma @code{Pack} applied to a record will pack the components to reduce
19616 wasted space from alignment gaps and by reducing the amount of space
19617 taken by components. We distinguish between @emph{packable} components and
19618 @emph{non-packable} components.
19619 Components of the following types are considered packable:
19620
19621
19622 @itemize *
19623
19624 @item
19625 Components of an elementary type are packable unless they are aliased,
19626 independent, or of an atomic type.
19627
19628 @item
19629 Small packed arrays, where the size is statically known, are represented
19630 internally as modular integers, and so they are also packable.
19631
19632 @item
19633 Small simple records, where the size is statically known, are also packable.
19634 @end itemize
19635
19636 For all these cases, if the @code{'Size} value is in the range 1 through 64, the
19637 components occupy the exact number of bits corresponding to this value
19638 and are packed with no padding bits, i.e. they can start on an arbitrary
19639 bit boundary.
19640
19641 All other types are non-packable, they occupy an integral number of storage
19642 units and the only effect of pragma @code{Pack} is to remove alignment gaps.
19643
19644 For example, consider the record
19645
19646 @example
19647 type Rb1 is array (1 .. 13) of Boolean;
19648 pragma Pack (Rb1);
19649
19650 type Rb2 is array (1 .. 65) of Boolean;
19651 pragma Pack (Rb2);
19652
19653 type AF is new Float with Atomic;
19654
19655 type X2 is record
19656 L1 : Boolean;
19657 L2 : Duration;
19658 L3 : AF;
19659 L4 : Boolean;
19660 L5 : Rb1;
19661 L6 : Rb2;
19662 end record;
19663 pragma Pack (X2);
19664 @end example
19665
19666 The representation for the record @code{X2} is as follows:
19667
19668 @example
19669 for X2'Size use 224;
19670 for X2 use record
19671 L1 at 0 range 0 .. 0;
19672 L2 at 0 range 1 .. 64;
19673 L3 at 12 range 0 .. 31;
19674 L4 at 16 range 0 .. 0;
19675 L5 at 16 range 1 .. 13;
19676 L6 at 18 range 0 .. 71;
19677 end record;
19678 @end example
19679
19680 Studying this example, we see that the packable fields @code{L1}
19681 and @code{L2} are
19682 of length equal to their sizes, and placed at specific bit boundaries (and
19683 not byte boundaries) to
19684 eliminate padding. But @code{L3} is of a non-packable float type (because
19685 it is aliased), so it is on the next appropriate alignment boundary.
19686
19687 The next two fields are fully packable, so @code{L4} and @code{L5} are
19688 minimally packed with no gaps. However, type @code{Rb2} is a packed
19689 array that is longer than 64 bits, so it is itself non-packable. Thus
19690 the @code{L6} field is aligned to the next byte boundary, and takes an
19691 integral number of bytes, i.e., 72 bits.
19692
19693 @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
19694 @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{288}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{289}
19695 @section Record Representation Clauses
19696
19697
19698 @geindex Record Representation Clause
19699
19700 Record representation clauses may be given for all record types, including
19701 types obtained by record extension. Component clauses are allowed for any
19702 static component. The restrictions on component clauses depend on the type
19703 of the component.
19704
19705 @geindex Component Clause
19706
19707 For all components of an elementary type, the only restriction on component
19708 clauses is that the size must be at least the @code{'Size} value of the type
19709 (actually the Value_Size). There are no restrictions due to alignment,
19710 and such components may freely cross storage boundaries.
19711
19712 Packed arrays with a size up to and including 64 bits are represented
19713 internally using a modular type with the appropriate number of bits, and
19714 thus the same lack of restriction applies. For example, if you declare:
19715
19716 @example
19717 type R is array (1 .. 49) of Boolean;
19718 pragma Pack (R);
19719 for R'Size use 49;
19720 @end example
19721
19722 then a component clause for a component of type @code{R} may start on any
19723 specified bit boundary, and may specify a value of 49 bits or greater.
19724
19725 For packed bit arrays that are longer than 64 bits, there are two
19726 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
19727 including the important case of single bits or boolean values, then
19728 there are no limitations on placement of such components, and they
19729 may start and end at arbitrary bit boundaries.
19730
19731 If the component size is not a power of 2 (e.g., 3 or 5), then
19732 an array of this type longer than 64 bits must always be placed on
19733 on a storage unit (byte) boundary and occupy an integral number
19734 of storage units (bytes). Any component clause that does not
19735 meet this requirement will be rejected.
19736
19737 Any aliased component, or component of an aliased type, must
19738 have its normal alignment and size. A component clause that
19739 does not meet this requirement will be rejected.
19740
19741 The tag field of a tagged type always occupies an address sized field at
19742 the start of the record. No component clause may attempt to overlay this
19743 tag. When a tagged type appears as a component, the tag field must have
19744 proper alignment
19745
19746 In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied
19747 to the type @code{T1} can specify a storage location that would overlap the first
19748 @code{T'Size} bytes of the record.
19749
19750 For all other component types, including non-bit-packed arrays,
19751 the component can be placed at an arbitrary bit boundary,
19752 so for example, the following is permitted:
19753
19754 @example
19755 type R is array (1 .. 10) of Boolean;
19756 for R'Size use 80;
19757
19758 type Q is record
19759 G, H : Boolean;
19760 L, M : R;
19761 end record;
19762
19763 for Q use record
19764 G at 0 range 0 .. 0;
19765 H at 0 range 1 .. 1;
19766 L at 0 range 2 .. 81;
19767 R at 0 range 82 .. 161;
19768 end record;
19769 @end example
19770
19771 @node Handling of Records with Holes,Enumeration Clauses,Record Representation Clauses,Representation Clauses and Pragmas
19772 @anchor{gnat_rm/representation_clauses_and_pragmas handling-of-records-with-holes}@anchor{28a}@anchor{gnat_rm/representation_clauses_and_pragmas id14}@anchor{28b}
19773 @section Handling of Records with Holes
19774
19775
19776 @geindex Handling of Records with Holes
19777
19778 As a result of alignment considerations, records may contain "holes"
19779 or gaps
19780 which do not correspond to the data bits of any of the components.
19781 Record representation clauses can also result in holes in records.
19782
19783 GNAT does not attempt to clear these holes, so in record objects,
19784 they should be considered to hold undefined rubbish. The generated
19785 equality routine just tests components so does not access these
19786 undefined bits, and assignment and copy operations may or may not
19787 preserve the contents of these holes (for assignments, the holes
19788 in the target will in practice contain either the bits that are
19789 present in the holes in the source, or the bits that were present
19790 in the target before the assignment).
19791
19792 If it is necessary to ensure that holes in records have all zero
19793 bits, then record objects for which this initialization is desired
19794 should be explicitly set to all zero values using Unchecked_Conversion
19795 or address overlays. For example
19796
19797 @example
19798 type HRec is record
19799 C : Character;
19800 I : Integer;
19801 end record;
19802 @end example
19803
19804 On typical machines, integers need to be aligned on a four-byte
19805 boundary, resulting in three bytes of undefined rubbish following
19806 the 8-bit field for C. To ensure that the hole in a variable of
19807 type HRec is set to all zero bits,
19808 you could for example do:
19809
19810 @example
19811 type Base is record
19812 Dummy1, Dummy2 : Integer := 0;
19813 end record;
19814
19815 BaseVar : Base;
19816 RealVar : Hrec;
19817 for RealVar'Address use BaseVar'Address;
19818 @end example
19819
19820 Now the 8-bytes of the value of RealVar start out containing all zero
19821 bits. A safer approach is to just define dummy fields, avoiding the
19822 holes, as in:
19823
19824 @example
19825 type HRec is record
19826 C : Character;
19827 Dummy1 : Short_Short_Integer := 0;
19828 Dummy2 : Short_Short_Integer := 0;
19829 Dummy3 : Short_Short_Integer := 0;
19830 I : Integer;
19831 end record;
19832 @end example
19833
19834 And to make absolutely sure that the intent of this is followed, you
19835 can use representation clauses:
19836
19837 @example
19838 for Hrec use record
19839 C at 0 range 0 .. 7;
19840 Dummy1 at 1 range 0 .. 7;
19841 Dummy2 at 2 range 0 .. 7;
19842 Dummy3 at 3 range 0 .. 7;
19843 I at 4 range 0 .. 31;
19844 end record;
19845 for Hrec'Size use 64;
19846 @end example
19847
19848 @node Enumeration Clauses,Address Clauses,Handling of Records with Holes,Representation Clauses and Pragmas
19849 @anchor{gnat_rm/representation_clauses_and_pragmas enumeration-clauses}@anchor{28c}@anchor{gnat_rm/representation_clauses_and_pragmas id15}@anchor{28d}
19850 @section Enumeration Clauses
19851
19852
19853 The only restriction on enumeration clauses is that the range of values
19854 must be representable. For the signed case, if one or more of the
19855 representation values are negative, all values must be in the range:
19856
19857 @example
19858 System.Min_Int .. System.Max_Int
19859 @end example
19860
19861 For the unsigned case, where all values are nonnegative, the values must
19862 be in the range:
19863
19864 @example
19865 0 .. System.Max_Binary_Modulus;
19866 @end example
19867
19868 A @emph{confirming} representation clause is one in which the values range
19869 from 0 in sequence, i.e., a clause that confirms the default representation
19870 for an enumeration type.
19871 Such a confirming representation
19872 is permitted by these rules, and is specially recognized by the compiler so
19873 that no extra overhead results from the use of such a clause.
19874
19875 If an array has an index type which is an enumeration type to which an
19876 enumeration clause has been applied, then the array is stored in a compact
19877 manner. Consider the declarations:
19878
19879 @example
19880 type r is (A, B, C);
19881 for r use (A => 1, B => 5, C => 10);
19882 type t is array (r) of Character;
19883 @end example
19884
19885 The array type t corresponds to a vector with exactly three elements and
19886 has a default size equal to @code{3*Character'Size}. This ensures efficient
19887 use of space, but means that accesses to elements of the array will incur
19888 the overhead of converting representation values to the corresponding
19889 positional values, (i.e., the value delivered by the @code{Pos} attribute).
19890
19891 @node Address Clauses,Use of Address Clauses for Memory-Mapped I/O,Enumeration Clauses,Representation Clauses and Pragmas
19892 @anchor{gnat_rm/representation_clauses_and_pragmas id16}@anchor{28e}@anchor{gnat_rm/representation_clauses_and_pragmas address-clauses}@anchor{28f}
19893 @section Address Clauses
19894
19895
19896 @geindex Address Clause
19897
19898 The reference manual allows a general restriction on representation clauses,
19899 as found in RM 13.1(22):
19900
19901 @quotation
19902
19903 "An implementation need not support representation
19904 items containing nonstatic expressions, except that
19905 an implementation should support a representation item
19906 for a given entity if each nonstatic expression in the
19907 representation item is a name that statically denotes
19908 a constant declared before the entity."
19909 @end quotation
19910
19911 In practice this is applicable only to address clauses, since this is the
19912 only case in which a nonstatic expression is permitted by the syntax. As
19913 the AARM notes in sections 13.1 (22.a-22.h):
19914
19915 @quotation
19916
19917 22.a Reason: This is to avoid the following sort of thing:
19918
19919 22.b X : Integer := F(...);
19920 Y : Address := G(...);
19921 for X'Address use Y;
19922
19923 22.c In the above, we have to evaluate the
19924 initialization expression for X before we
19925 know where to put the result. This seems
19926 like an unreasonable implementation burden.
19927
19928 22.d The above code should instead be written
19929 like this:
19930
19931 22.e Y : constant Address := G(...);
19932 X : Integer := F(...);
19933 for X'Address use Y;
19934
19935 22.f This allows the expression 'Y' to be safely
19936 evaluated before X is created.
19937
19938 22.g The constant could be a formal parameter of mode in.
19939
19940 22.h An implementation can support other nonstatic
19941 expressions if it wants to. Expressions of type
19942 Address are hardly ever static, but their value
19943 might be known at compile time anyway in many
19944 cases.
19945 @end quotation
19946
19947 GNAT does indeed permit many additional cases of nonstatic expressions. In
19948 particular, if the type involved is elementary there are no restrictions
19949 (since in this case, holding a temporary copy of the initialization value,
19950 if one is present, is inexpensive). In addition, if there is no implicit or
19951 explicit initialization, then there are no restrictions. GNAT will reject
19952 only the case where all three of these conditions hold:
19953
19954
19955 @itemize *
19956
19957 @item
19958 The type of the item is non-elementary (e.g., a record or array).
19959
19960 @item
19961 There is explicit or implicit initialization required for the object.
19962 Note that access values are always implicitly initialized.
19963
19964 @item
19965 The address value is nonstatic. Here GNAT is more permissive than the
19966 RM, and allows the address value to be the address of a previously declared
19967 stand-alone variable, as long as it does not itself have an address clause.
19968
19969 @example
19970 Anchor : Some_Initialized_Type;
19971 Overlay : Some_Initialized_Type;
19972 for Overlay'Address use Anchor'Address;
19973 @end example
19974
19975 However, the prefix of the address clause cannot be an array component, or
19976 a component of a discriminated record.
19977 @end itemize
19978
19979 As noted above in section 22.h, address values are typically nonstatic. In
19980 particular the To_Address function, even if applied to a literal value, is
19981 a nonstatic function call. To avoid this minor annoyance, GNAT provides
19982 the implementation defined attribute 'To_Address. The following two
19983 expressions have identical values:
19984
19985 @geindex Attribute
19986
19987 @geindex To_Address
19988
19989 @example
19990 To_Address (16#1234_0000#)
19991 System'To_Address (16#1234_0000#);
19992 @end example
19993
19994 except that the second form is considered to be a static expression, and
19995 thus when used as an address clause value is always permitted.
19996
19997 Additionally, GNAT treats as static an address clause that is an
19998 unchecked_conversion of a static integer value. This simplifies the porting
19999 of legacy code, and provides a portable equivalent to the GNAT attribute
20000 @code{To_Address}.
20001
20002 Another issue with address clauses is the interaction with alignment
20003 requirements. When an address clause is given for an object, the address
20004 value must be consistent with the alignment of the object (which is usually
20005 the same as the alignment of the type of the object). If an address clause
20006 is given that specifies an inappropriately aligned address value, then the
20007 program execution is erroneous.
20008
20009 Since this source of erroneous behavior can have unfortunate effects on
20010 machines with strict alignment requirements, GNAT
20011 checks (at compile time if possible, generating a warning, or at execution
20012 time with a run-time check) that the alignment is appropriate. If the
20013 run-time check fails, then @code{Program_Error} is raised. This run-time
20014 check is suppressed if range checks are suppressed, or if the special GNAT
20015 check Alignment_Check is suppressed, or if
20016 @code{pragma Restrictions (No_Elaboration_Code)} is in effect. It is also
20017 suppressed by default on non-strict alignment machines (such as the x86).
20018
20019 Finally, GNAT does not permit overlaying of objects of class-wide types. In
20020 most cases, the compiler can detect an attempt at such overlays and will
20021 generate a warning at compile time and a Program_Error exception at run time.
20022
20023 @geindex Export
20024
20025 An address clause cannot be given for an exported object. More
20026 understandably the real restriction is that objects with an address
20027 clause cannot be exported. This is because such variables are not
20028 defined by the Ada program, so there is no external object to export.
20029
20030 @geindex Import
20031
20032 It is permissible to give an address clause and a pragma Import for the
20033 same object. In this case, the variable is not really defined by the
20034 Ada program, so there is no external symbol to be linked. The link name
20035 and the external name are ignored in this case. The reason that we allow this
20036 combination is that it provides a useful idiom to avoid unwanted
20037 initializations on objects with address clauses.
20038
20039 When an address clause is given for an object that has implicit or
20040 explicit initialization, then by default initialization takes place. This
20041 means that the effect of the object declaration is to overwrite the
20042 memory at the specified address. This is almost always not what the
20043 programmer wants, so GNAT will output a warning:
20044
20045 @example
20046 with System;
20047 package G is
20048 type R is record
20049 M : Integer := 0;
20050 end record;
20051
20052 Ext : R;
20053 for Ext'Address use System'To_Address (16#1234_1234#);
20054 |
20055 >>> warning: implicit initialization of "Ext" may
20056 modify overlaid storage
20057 >>> warning: use pragma Import for "Ext" to suppress
20058 initialization (RM B(24))
20059
20060 end G;
20061 @end example
20062
20063 As indicated by the warning message, the solution is to use a (dummy) pragma
20064 Import to suppress this initialization. The pragma tell the compiler that the
20065 object is declared and initialized elsewhere. The following package compiles
20066 without warnings (and the initialization is suppressed):
20067
20068 @example
20069 with System;
20070 package G is
20071 type R is record
20072 M : Integer := 0;
20073 end record;
20074
20075 Ext : R;
20076 for Ext'Address use System'To_Address (16#1234_1234#);
20077 pragma Import (Ada, Ext);
20078 end G;
20079 @end example
20080
20081 A final issue with address clauses involves their use for overlaying
20082 variables, as in the following example:
20083
20084 @geindex Overlaying of objects
20085
20086 @example
20087 A : Integer;
20088 B : Integer;
20089 for B'Address use A'Address;
20090 @end example
20091
20092 or alternatively, using the form recommended by the RM:
20093
20094 @example
20095 A : Integer;
20096 Addr : constant Address := A'Address;
20097 B : Integer;
20098 for B'Address use Addr;
20099 @end example
20100
20101 In both of these cases, @code{A} and @code{B} become aliased to one another
20102 via the address clause. This use of address clauses to overlay
20103 variables, achieving an effect similar to unchecked conversion
20104 was erroneous in Ada 83, but in Ada 95 and Ada 2005
20105 the effect is implementation defined. Furthermore, the
20106 Ada RM specifically recommends that in a situation
20107 like this, @code{B} should be subject to the following
20108 implementation advice (RM 13.3(19)):
20109
20110 @quotation
20111
20112 "19 If the Address of an object is specified, or it is imported
20113 or exported, then the implementation should not perform
20114 optimizations based on assumptions of no aliases."
20115 @end quotation
20116
20117 GNAT follows this recommendation, and goes further by also applying
20118 this recommendation to the overlaid variable (@code{A} in the above example)
20119 in this case. This means that the overlay works "as expected", in that
20120 a modification to one of the variables will affect the value of the other.
20121
20122 More generally, GNAT interprets this recommendation conservatively for
20123 address clauses: in the cases other than overlays, it considers that the
20124 object is effectively subject to pragma @code{Volatile} and implements the
20125 associated semantics.
20126
20127 Note that when address clause overlays are used in this way, there is an
20128 issue of unintentional initialization, as shown by this example:
20129
20130 @example
20131 package Overwrite_Record is
20132 type R is record
20133 A : Character := 'C';
20134 B : Character := 'A';
20135 end record;
20136 X : Short_Integer := 3;
20137 Y : R;
20138 for Y'Address use X'Address;
20139 |
20140 >>> warning: default initialization of "Y" may
20141 modify "X", use pragma Import for "Y" to
20142 suppress initialization (RM B.1(24))
20143
20144 end Overwrite_Record;
20145 @end example
20146
20147 Here the default initialization of @code{Y} will clobber the value
20148 of @code{X}, which justifies the warning. The warning notes that
20149 this effect can be eliminated by adding a @code{pragma Import}
20150 which suppresses the initialization:
20151
20152 @example
20153 package Overwrite_Record is
20154 type R is record
20155 A : Character := 'C';
20156 B : Character := 'A';
20157 end record;
20158 X : Short_Integer := 3;
20159 Y : R;
20160 for Y'Address use X'Address;
20161 pragma Import (Ada, Y);
20162 end Overwrite_Record;
20163 @end example
20164
20165 Note that the use of @code{pragma Initialize_Scalars} may cause variables to
20166 be initialized when they would not otherwise have been in the absence
20167 of the use of this pragma. This may cause an overlay to have this
20168 unintended clobbering effect. The compiler avoids this for scalar
20169 types, but not for composite objects (where in general the effect
20170 of @code{Initialize_Scalars} is part of the initialization routine
20171 for the composite object:
20172
20173 @example
20174 pragma Initialize_Scalars;
20175 with Ada.Text_IO; use Ada.Text_IO;
20176 procedure Overwrite_Array is
20177 type Arr is array (1 .. 5) of Integer;
20178 X : Arr := (others => 1);
20179 A : Arr;
20180 for A'Address use X'Address;
20181 |
20182 >>> warning: default initialization of "A" may
20183 modify "X", use pragma Import for "A" to
20184 suppress initialization (RM B.1(24))
20185
20186 begin
20187 if X /= Arr'(others => 1) then
20188 Put_Line ("X was clobbered");
20189 else
20190 Put_Line ("X was not clobbered");
20191 end if;
20192 end Overwrite_Array;
20193 @end example
20194
20195 The above program generates the warning as shown, and at execution
20196 time, prints @code{X was clobbered}. If the @code{pragma Import} is
20197 added as suggested:
20198
20199 @example
20200 pragma Initialize_Scalars;
20201 with Ada.Text_IO; use Ada.Text_IO;
20202 procedure Overwrite_Array is
20203 type Arr is array (1 .. 5) of Integer;
20204 X : Arr := (others => 1);
20205 A : Arr;
20206 for A'Address use X'Address;
20207 pragma Import (Ada, A);
20208 begin
20209 if X /= Arr'(others => 1) then
20210 Put_Line ("X was clobbered");
20211 else
20212 Put_Line ("X was not clobbered");
20213 end if;
20214 end Overwrite_Array;
20215 @end example
20216
20217 then the program compiles without the warning and when run will generate
20218 the output @code{X was not clobbered}.
20219
20220 @node Use of Address Clauses for Memory-Mapped I/O,Effect of Convention on Representation,Address Clauses,Representation Clauses and Pragmas
20221 @anchor{gnat_rm/representation_clauses_and_pragmas id17}@anchor{290}@anchor{gnat_rm/representation_clauses_and_pragmas use-of-address-clauses-for-memory-mapped-i-o}@anchor{291}
20222 @section Use of Address Clauses for Memory-Mapped I/O
20223
20224
20225 @geindex Memory-mapped I/O
20226
20227 A common pattern is to use an address clause to map an atomic variable to
20228 a location in memory that corresponds to a memory-mapped I/O operation or
20229 operations, for example:
20230
20231 @example
20232 type Mem_Word is record
20233 A,B,C,D : Byte;
20234 end record;
20235 pragma Atomic (Mem_Word);
20236 for Mem_Word_Size use 32;
20237
20238 Mem : Mem_Word;
20239 for Mem'Address use some-address;
20240 ...
20241 Temp := Mem;
20242 Temp.A := 32;
20243 Mem := Temp;
20244 @end example
20245
20246 For a full access (reference or modification) of the variable (Mem) in this
20247 case, as in the above examples, GNAT guarantees that the entire atomic word
20248 will be accessed, in accordance with the RM C.6(15) clause.
20249
20250 A problem arises with a component access such as:
20251
20252 @example
20253 Mem.A := 32;
20254 @end example
20255
20256 Note that the component A is not declared as atomic. This means that it is
20257 not clear what this assignment means. It could correspond to full word read
20258 and write as given in the first example, or on architectures that supported
20259 such an operation it might be a single byte store instruction. The RM does
20260 not have anything to say in this situation, and GNAT does not make any
20261 guarantee. The code generated may vary from target to target. GNAT will issue
20262 a warning in such a case:
20263
20264 @example
20265 Mem.A := 32;
20266 |
20267 >>> warning: access to non-atomic component of atomic array,
20268 may cause unexpected accesses to atomic object
20269 @end example
20270
20271 It is best to be explicit in this situation, by either declaring the
20272 components to be atomic if you want the byte store, or explicitly writing
20273 the full word access sequence if that is what the hardware requires.
20274 Alternatively, if the full word access sequence is required, GNAT also
20275 provides the pragma @code{Volatile_Full_Access} which can be used in lieu of
20276 pragma @code{Atomic} and will give the additional guarantee.
20277
20278 @node Effect of Convention on Representation,Conventions and Anonymous Access Types,Use of Address Clauses for Memory-Mapped I/O,Representation Clauses and Pragmas
20279 @anchor{gnat_rm/representation_clauses_and_pragmas id18}@anchor{292}@anchor{gnat_rm/representation_clauses_and_pragmas effect-of-convention-on-representation}@anchor{293}
20280 @section Effect of Convention on Representation
20281
20282
20283 @geindex Convention
20284 @geindex effect on representation
20285
20286 Normally the specification of a foreign language convention for a type or
20287 an object has no effect on the chosen representation. In particular, the
20288 representation chosen for data in GNAT generally meets the standard system
20289 conventions, and for example records are laid out in a manner that is
20290 consistent with C. This means that specifying convention C (for example)
20291 has no effect.
20292
20293 There are four exceptions to this general rule:
20294
20295
20296 @itemize *
20297
20298 @item
20299 @emph{Convention Fortran and array subtypes}.
20300
20301 If pragma Convention Fortran is specified for an array subtype, then in
20302 accordance with the implementation advice in section 3.6.2(11) of the
20303 Ada Reference Manual, the array will be stored in a Fortran-compatible
20304 column-major manner, instead of the normal default row-major order.
20305
20306 @item
20307 @emph{Convention C and enumeration types}
20308
20309 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
20310 to accommodate all values of the type. For example, for the enumeration
20311 type declared by:
20312
20313 @example
20314 type Color is (Red, Green, Blue);
20315 @end example
20316
20317 8 bits is sufficient to store all values of the type, so by default, objects
20318 of type @code{Color} will be represented using 8 bits. However, normal C
20319 convention is to use 32 bits for all enum values in C, since enum values
20320 are essentially of type int. If pragma @code{Convention C} is specified for an
20321 Ada enumeration type, then the size is modified as necessary (usually to
20322 32 bits) to be consistent with the C convention for enum values.
20323
20324 Note that this treatment applies only to types. If Convention C is given for
20325 an enumeration object, where the enumeration type is not Convention C, then
20326 Object_Size bits are allocated. For example, for a normal enumeration type,
20327 with less than 256 elements, only 8 bits will be allocated for the object.
20328 Since this may be a surprise in terms of what C expects, GNAT will issue a
20329 warning in this situation. The warning can be suppressed by giving an explicit
20330 size clause specifying the desired size.
20331
20332 @item
20333 @emph{Convention C/Fortran and Boolean types}
20334
20335 In C, the usual convention for boolean values, that is values used for
20336 conditions, is that zero represents false, and nonzero values represent
20337 true. In Ada, the normal convention is that two specific values, typically
20338 0/1, are used to represent false/true respectively.
20339
20340 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
20341 value represents true).
20342
20343 To accommodate the Fortran and C conventions, if a pragma Convention specifies
20344 C or Fortran convention for a derived Boolean, as in the following example:
20345
20346 @example
20347 type C_Switch is new Boolean;
20348 pragma Convention (C, C_Switch);
20349 @end example
20350
20351 then the GNAT generated code will treat any nonzero value as true. For truth
20352 values generated by GNAT, the conventional value 1 will be used for True, but
20353 when one of these values is read, any nonzero value is treated as True.
20354 @end itemize
20355
20356 @node Conventions and Anonymous Access Types,Determining the Representations chosen by GNAT,Effect of Convention on Representation,Representation Clauses and Pragmas
20357 @anchor{gnat_rm/representation_clauses_and_pragmas conventions-and-anonymous-access-types}@anchor{294}@anchor{gnat_rm/representation_clauses_and_pragmas id19}@anchor{295}
20358 @section Conventions and Anonymous Access Types
20359
20360
20361 @geindex Anonymous access types
20362
20363 @geindex Convention for anonymous access types
20364
20365 The RM is not entirely clear on convention handling in a number of cases,
20366 and in particular, it is not clear on the convention to be given to
20367 anonymous access types in general, and in particular what is to be
20368 done for the case of anonymous access-to-subprogram.
20369
20370 In GNAT, we decide that if an explicit Convention is applied
20371 to an object or component, and its type is such an anonymous type,
20372 then the convention will apply to this anonymous type as well. This
20373 seems to make sense since it is anomolous in any case to have a
20374 different convention for an object and its type, and there is clearly
20375 no way to explicitly specify a convention for an anonymous type, since
20376 it doesn't have a name to specify!
20377
20378 Furthermore, we decide that if a convention is applied to a record type,
20379 then this convention is inherited by any of its components that are of an
20380 anonymous access type which do not have an explicitly specified convention.
20381
20382 The following program shows these conventions in action:
20383
20384 @example
20385 package ConvComp is
20386 type Foo is range 1 .. 10;
20387 type T1 is record
20388 A : access function (X : Foo) return Integer;
20389 B : Integer;
20390 end record;
20391 pragma Convention (C, T1);
20392
20393 type T2 is record
20394 A : access function (X : Foo) return Integer;
20395 pragma Convention (C, A);
20396 B : Integer;
20397 end record;
20398 pragma Convention (COBOL, T2);
20399
20400 type T3 is record
20401 A : access function (X : Foo) return Integer;
20402 pragma Convention (COBOL, A);
20403 B : Integer;
20404 end record;
20405 pragma Convention (C, T3);
20406
20407 type T4 is record
20408 A : access function (X : Foo) return Integer;
20409 B : Integer;
20410 end record;
20411 pragma Convention (COBOL, T4);
20412
20413 function F (X : Foo) return Integer;
20414 pragma Convention (C, F);
20415
20416 function F (X : Foo) return Integer is (13);
20417
20418 TV1 : T1 := (F'Access, 12); -- OK
20419 TV2 : T2 := (F'Access, 13); -- OK
20420
20421 TV3 : T3 := (F'Access, 13); -- ERROR
20422 |
20423 >>> subprogram "F" has wrong convention
20424 >>> does not match access to subprogram declared at line 17
20425 38. TV4 : T4 := (F'Access, 13); -- ERROR
20426 |
20427 >>> subprogram "F" has wrong convention
20428 >>> does not match access to subprogram declared at line 24
20429 39. end ConvComp;
20430 @end example
20431
20432 @node Determining the Representations chosen by GNAT,,Conventions and Anonymous Access Types,Representation Clauses and Pragmas
20433 @anchor{gnat_rm/representation_clauses_and_pragmas id20}@anchor{296}@anchor{gnat_rm/representation_clauses_and_pragmas determining-the-representations-chosen-by-gnat}@anchor{297}
20434 @section Determining the Representations chosen by GNAT
20435
20436
20437 @geindex Representation
20438 @geindex determination of
20439
20440 @geindex -gnatR (gcc)
20441
20442 Although the descriptions in this section are intended to be complete, it is
20443 often easier to simply experiment to see what GNAT accepts and what the
20444 effect is on the layout of types and objects.
20445
20446 As required by the Ada RM, if a representation clause is not accepted, then
20447 it must be rejected as illegal by the compiler. However, when a
20448 representation clause or pragma is accepted, there can still be questions
20449 of what the compiler actually does. For example, if a partial record
20450 representation clause specifies the location of some components and not
20451 others, then where are the non-specified components placed? Or if pragma
20452 @code{Pack} is used on a record, then exactly where are the resulting
20453 fields placed? The section on pragma @code{Pack} in this chapter can be
20454 used to answer the second question, but it is often easier to just see
20455 what the compiler does.
20456
20457 For this purpose, GNAT provides the option @emph{-gnatR}. If you compile
20458 with this option, then the compiler will output information on the actual
20459 representations chosen, in a format similar to source representation
20460 clauses. For example, if we compile the package:
20461
20462 @example
20463 package q is
20464 type r (x : boolean) is tagged record
20465 case x is
20466 when True => S : String (1 .. 100);
20467 when False => null;
20468 end case;
20469 end record;
20470
20471 type r2 is new r (false) with record
20472 y2 : integer;
20473 end record;
20474
20475 for r2 use record
20476 y2 at 16 range 0 .. 31;
20477 end record;
20478
20479 type x is record
20480 y : character;
20481 end record;
20482
20483 type x1 is array (1 .. 10) of x;
20484 for x1'component_size use 11;
20485
20486 type ia is access integer;
20487
20488 type Rb1 is array (1 .. 13) of Boolean;
20489 pragma Pack (rb1);
20490
20491 type Rb2 is array (1 .. 65) of Boolean;
20492 pragma Pack (rb2);
20493
20494 type x2 is record
20495 l1 : Boolean;
20496 l2 : Duration;
20497 l3 : Float;
20498 l4 : Boolean;
20499 l5 : Rb1;
20500 l6 : Rb2;
20501 end record;
20502 pragma Pack (x2);
20503 end q;
20504 @end example
20505
20506 using the switch @emph{-gnatR} we obtain the following output:
20507
20508 @example
20509 Representation information for unit q
20510 -------------------------------------
20511
20512 for r'Size use ??;
20513 for r'Alignment use 4;
20514 for r use record
20515 x at 4 range 0 .. 7;
20516 _tag at 0 range 0 .. 31;
20517 s at 5 range 0 .. 799;
20518 end record;
20519
20520 for r2'Size use 160;
20521 for r2'Alignment use 4;
20522 for r2 use record
20523 x at 4 range 0 .. 7;
20524 _tag at 0 range 0 .. 31;
20525 _parent at 0 range 0 .. 63;
20526 y2 at 16 range 0 .. 31;
20527 end record;
20528
20529 for x'Size use 8;
20530 for x'Alignment use 1;
20531 for x use record
20532 y at 0 range 0 .. 7;
20533 end record;
20534
20535 for x1'Size use 112;
20536 for x1'Alignment use 1;
20537 for x1'Component_Size use 11;
20538
20539 for rb1'Size use 13;
20540 for rb1'Alignment use 2;
20541 for rb1'Component_Size use 1;
20542
20543 for rb2'Size use 72;
20544 for rb2'Alignment use 1;
20545 for rb2'Component_Size use 1;
20546
20547 for x2'Size use 224;
20548 for x2'Alignment use 4;
20549 for x2 use record
20550 l1 at 0 range 0 .. 0;
20551 l2 at 0 range 1 .. 64;
20552 l3 at 12 range 0 .. 31;
20553 l4 at 16 range 0 .. 0;
20554 l5 at 16 range 1 .. 13;
20555 l6 at 18 range 0 .. 71;
20556 end record;
20557 @end example
20558
20559 The Size values are actually the Object_Size, i.e., the default size that
20560 will be allocated for objects of the type.
20561 The @code{??} size for type r indicates that we have a variant record, and the
20562 actual size of objects will depend on the discriminant value.
20563
20564 The Alignment values show the actual alignment chosen by the compiler
20565 for each record or array type.
20566
20567 The record representation clause for type r shows where all fields
20568 are placed, including the compiler generated tag field (whose location
20569 cannot be controlled by the programmer).
20570
20571 The record representation clause for the type extension r2 shows all the
20572 fields present, including the parent field, which is a copy of the fields
20573 of the parent type of r2, i.e., r1.
20574
20575 The component size and size clauses for types rb1 and rb2 show
20576 the exact effect of pragma @code{Pack} on these arrays, and the record
20577 representation clause for type x2 shows how pragma @cite{Pack} affects
20578 this record type.
20579
20580 In some cases, it may be useful to cut and paste the representation clauses
20581 generated by the compiler into the original source to fix and guarantee
20582 the actual representation to be used.
20583
20584 @node Standard Library Routines,The Implementation of Standard I/O,Representation Clauses and Pragmas,Top
20585 @anchor{gnat_rm/standard_library_routines standard-library-routines}@anchor{e}@anchor{gnat_rm/standard_library_routines doc}@anchor{298}@anchor{gnat_rm/standard_library_routines id1}@anchor{299}
20586 @chapter Standard Library Routines
20587
20588
20589 The Ada Reference Manual contains in Annex A a full description of an
20590 extensive set of standard library routines that can be used in any Ada
20591 program, and which must be provided by all Ada compilers. They are
20592 analogous to the standard C library used by C programs.
20593
20594 GNAT implements all of the facilities described in annex A, and for most
20595 purposes the description in the Ada Reference Manual, or appropriate Ada
20596 text book, will be sufficient for making use of these facilities.
20597
20598 In the case of the input-output facilities,
20599 @ref{f,,The Implementation of Standard I/O},
20600 gives details on exactly how GNAT interfaces to the
20601 file system. For the remaining packages, the Ada Reference Manual
20602 should be sufficient. The following is a list of the packages included,
20603 together with a brief description of the functionality that is provided.
20604
20605 For completeness, references are included to other predefined library
20606 routines defined in other sections of the Ada Reference Manual (these are
20607 cross-indexed from Annex A). For further details see the relevant
20608 package declarations in the run-time library. In particular, a few units
20609 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
20610 and in this case the package declaration contains comments explaining why
20611 the unit is not implemented.
20612
20613
20614 @table @asis
20615
20616 @item @code{Ada} @emph{(A.2)}
20617
20618 This is a parent package for all the standard library packages. It is
20619 usually included implicitly in your program, and itself contains no
20620 useful data or routines.
20621
20622 @item @code{Ada.Assertions} @emph{(11.4.2)}
20623
20624 @code{Assertions} provides the @code{Assert} subprograms, and also
20625 the declaration of the @code{Assertion_Error} exception.
20626
20627 @item @code{Ada.Asynchronous_Task_Control} @emph{(D.11)}
20628
20629 @code{Asynchronous_Task_Control} provides low level facilities for task
20630 synchronization. It is typically not implemented. See package spec for details.
20631
20632 @item @code{Ada.Calendar} @emph{(9.6)}
20633
20634 @code{Calendar} provides time of day access, and routines for
20635 manipulating times and durations.
20636
20637 @item @code{Ada.Calendar.Arithmetic} @emph{(9.6.1)}
20638
20639 This package provides additional arithmetic
20640 operations for @code{Calendar}.
20641
20642 @item @code{Ada.Calendar.Formatting} @emph{(9.6.1)}
20643
20644 This package provides formatting operations for @code{Calendar}.
20645
20646 @item @code{Ada.Calendar.Time_Zones} @emph{(9.6.1)}
20647
20648 This package provides additional @code{Calendar} facilities
20649 for handling time zones.
20650
20651 @item @code{Ada.Characters} @emph{(A.3.1)}
20652
20653 This is a dummy parent package that contains no useful entities
20654
20655 @item @code{Ada.Characters.Conversions} @emph{(A.3.2)}
20656
20657 This package provides character conversion functions.
20658
20659 @item @code{Ada.Characters.Handling} @emph{(A.3.2)}
20660
20661 This package provides some basic character handling capabilities,
20662 including classification functions for classes of characters (e.g., test
20663 for letters, or digits).
20664
20665 @item @code{Ada.Characters.Latin_1} @emph{(A.3.3)}
20666
20667 This package includes a complete set of definitions of the characters
20668 that appear in type CHARACTER. It is useful for writing programs that
20669 will run in international environments. For example, if you want an
20670 upper case E with an acute accent in a string, it is often better to use
20671 the definition of @code{UC_E_Acute} in this package. Then your program
20672 will print in an understandable manner even if your environment does not
20673 support these extended characters.
20674
20675 @item @code{Ada.Command_Line} @emph{(A.15)}
20676
20677 This package provides access to the command line parameters and the name
20678 of the current program (analogous to the use of @code{argc} and @code{argv}
20679 in C), and also allows the exit status for the program to be set in a
20680 system-independent manner.
20681
20682 @item @code{Ada.Complex_Text_IO} @emph{(G.1.3)}
20683
20684 This package provides text input and output of complex numbers.
20685
20686 @item @code{Ada.Containers} @emph{(A.18.1)}
20687
20688 A top level package providing a few basic definitions used by all the
20689 following specific child packages that provide specific kinds of
20690 containers.
20691 @end table
20692
20693 @code{Ada.Containers.Bounded_Priority_Queues} @emph{(A.18.31)}
20694
20695 @code{Ada.Containers.Bounded_Synchronized_Queues} @emph{(A.18.29)}
20696
20697 @code{Ada.Containers.Doubly_Linked_Lists} @emph{(A.18.3)}
20698
20699 @code{Ada.Containers.Generic_Array_Sort} @emph{(A.18.26)}
20700
20701 @code{Ada.Containers.Generic_Constrained_Array_Sort} @emph{(A.18.26)}
20702
20703 @code{Ada.Containers.Generic_Sort} @emph{(A.18.26)}
20704
20705 @code{Ada.Containers.Hashed_Maps} @emph{(A.18.5)}
20706
20707 @code{Ada.Containers.Hashed_Sets} @emph{(A.18.8)}
20708
20709 @code{Ada.Containers.Indefinite_Doubly_Linked_Lists} @emph{(A.18.12)}
20710
20711 @code{Ada.Containers.Indefinite_Hashed_Maps} @emph{(A.18.13)}
20712
20713 @code{Ada.Containers.Indefinite_Hashed_Sets} @emph{(A.18.15)}
20714
20715 @code{Ada.Containers.Indefinite_Holders} @emph{(A.18.18)}
20716
20717 @code{Ada.Containers.Indefinite_Multiway_Trees} @emph{(A.18.17)}
20718
20719 @code{Ada.Containers.Indefinite_Ordered_Maps} @emph{(A.18.14)}
20720
20721 @code{Ada.Containers.Indefinite_Ordered_Sets} @emph{(A.18.16)}
20722
20723 @code{Ada.Containers.Indefinite_Vectors} @emph{(A.18.11)}
20724
20725 @code{Ada.Containers.Multiway_Trees} @emph{(A.18.10)}
20726
20727 @code{Ada.Containers.Ordered_Maps} @emph{(A.18.6)}
20728
20729 @code{Ada.Containers.Ordered_Sets} @emph{(A.18.9)}
20730
20731 @code{Ada.Containers.Synchronized_Queue_Interfaces} @emph{(A.18.27)}
20732
20733 @code{Ada.Containers.Unbounded_Priority_Queues} @emph{(A.18.30)}
20734
20735 @code{Ada.Containers.Unbounded_Synchronized_Queues} @emph{(A.18.28)}
20736
20737 @code{Ada.Containers.Vectors} @emph{(A.18.2)}
20738
20739
20740 @table @asis
20741
20742 @item @code{Ada.Directories} @emph{(A.16)}
20743
20744 This package provides operations on directories.
20745
20746 @item @code{Ada.Directories.Hierarchical_File_Names} @emph{(A.16.1)}
20747
20748 This package provides additional directory operations handling
20749 hiearchical file names.
20750
20751 @item @code{Ada.Directories.Information} @emph{(A.16)}
20752
20753 This is an implementation defined package for additional directory
20754 operations, which is not implemented in GNAT.
20755
20756 @item @code{Ada.Decimal} @emph{(F.2)}
20757
20758 This package provides constants describing the range of decimal numbers
20759 implemented, and also a decimal divide routine (analogous to the COBOL
20760 verb DIVIDE ... GIVING ... REMAINDER ...)
20761
20762 @item @code{Ada.Direct_IO} @emph{(A.8.4)}
20763
20764 This package provides input-output using a model of a set of records of
20765 fixed-length, containing an arbitrary definite Ada type, indexed by an
20766 integer record number.
20767
20768 @item @code{Ada.Dispatching} @emph{(D.2.1)}
20769
20770 A parent package containing definitions for task dispatching operations.
20771
20772 @item @code{Ada.Dispatching.EDF} @emph{(D.2.6)}
20773
20774 Not implemented in GNAT.
20775
20776 @item @code{Ada.Dispatching.Non_Preemptive} @emph{(D.2.4)}
20777
20778 Not implemented in GNAT.
20779
20780 @item @code{Ada.Dispatching.Round_Robin} @emph{(D.2.5)}
20781
20782 Not implemented in GNAT.
20783
20784 @item @code{Ada.Dynamic_Priorities} @emph{(D.5)}
20785
20786 This package allows the priorities of a task to be adjusted dynamically
20787 as the task is running.
20788
20789 @item @code{Ada.Environment_Variables} @emph{(A.17)}
20790
20791 This package provides facilities for accessing environment variables.
20792
20793 @item @code{Ada.Exceptions} @emph{(11.4.1)}
20794
20795 This package provides additional information on exceptions, and also
20796 contains facilities for treating exceptions as data objects, and raising
20797 exceptions with associated messages.
20798
20799 @item @code{Ada.Execution_Time} @emph{(D.14)}
20800
20801 This package provides CPU clock functionalities. It is not implemented on
20802 all targets (see package spec for details).
20803
20804 @item @code{Ada.Execution_Time.Group_Budgets} @emph{(D.14.2)}
20805
20806 Not implemented in GNAT.
20807
20808 @item @code{Ada.Execution_Time.Timers} @emph{(D.14.1)'}
20809
20810 Not implemented in GNAT.
20811
20812 @item @code{Ada.Finalization} @emph{(7.6)}
20813
20814 This package contains the declarations and subprograms to support the
20815 use of controlled types, providing for automatic initialization and
20816 finalization (analogous to the constructors and destructors of C++).
20817
20818 @item @code{Ada.Float_Text_IO} @emph{(A.10.9)}
20819
20820 A library level instantiation of Text_IO.Float_IO for type Float.
20821
20822 @item @code{Ada.Float_Wide_Text_IO} @emph{(A.10.9)}
20823
20824 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
20825
20826 @item @code{Ada.Float_Wide_Wide_Text_IO} @emph{(A.10.9)}
20827
20828 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
20829
20830 @item @code{Ada.Integer_Text_IO} @emph{(A.10.9)}
20831
20832 A library level instantiation of Text_IO.Integer_IO for type Integer.
20833
20834 @item @code{Ada.Integer_Wide_Text_IO} @emph{(A.10.9)}
20835
20836 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
20837
20838 @item @code{Ada.Integer_Wide_Wide_Text_IO} @emph{(A.10.9)}
20839
20840 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
20841
20842 @item @code{Ada.Interrupts} @emph{(C.3.2)}
20843
20844 This package provides facilities for interfacing to interrupts, which
20845 includes the set of signals or conditions that can be raised and
20846 recognized as interrupts.
20847
20848 @item @code{Ada.Interrupts.Names} @emph{(C.3.2)}
20849
20850 This package provides the set of interrupt names (actually signal
20851 or condition names) that can be handled by GNAT.
20852
20853 @item @code{Ada.IO_Exceptions} @emph{(A.13)}
20854
20855 This package defines the set of exceptions that can be raised by use of
20856 the standard IO packages.
20857
20858 @item @code{Ada.Iterator_Interfaces} @emph{(5.5.1)}
20859
20860 This package provides a generic interface to generalized iterators.
20861
20862 @item @code{Ada.Locales} @emph{(A.19)}
20863
20864 This package provides declarations providing information (Language
20865 and Country) about the current locale.
20866
20867 @item @code{Ada.Numerics}
20868
20869 This package contains some standard constants and exceptions used
20870 throughout the numerics packages. Note that the constants pi and e are
20871 defined here, and it is better to use these definitions than rolling
20872 your own.
20873
20874 @item @code{Ada.Numerics.Complex_Arrays} @emph{(G.3.2)}
20875
20876 Provides operations on arrays of complex numbers.
20877
20878 @item @code{Ada.Numerics.Complex_Elementary_Functions}
20879
20880 Provides the implementation of standard elementary functions (such as
20881 log and trigonometric functions) operating on complex numbers using the
20882 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
20883 created by the package @code{Numerics.Complex_Types}.
20884
20885 @item @code{Ada.Numerics.Complex_Types}
20886
20887 This is a predefined instantiation of
20888 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
20889 build the type @code{Complex} and @code{Imaginary}.
20890
20891 @item @code{Ada.Numerics.Discrete_Random}
20892
20893 This generic package provides a random number generator suitable for generating
20894 uniformly distributed values of a specified discrete subtype.
20895
20896 @item @code{Ada.Numerics.Float_Random}
20897
20898 This package provides a random number generator suitable for generating
20899 uniformly distributed floating point values in the unit interval.
20900
20901 @item @code{Ada.Numerics.Generic_Complex_Elementary_Functions}
20902
20903 This is a generic version of the package that provides the
20904 implementation of standard elementary functions (such as log and
20905 trigonometric functions) for an arbitrary complex type.
20906
20907 The following predefined instantiations of this package are provided:
20908
20909
20910 @itemize *
20911
20912 @item
20913 @code{Short_Float}
20914
20915 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
20916
20917 @item
20918 @code{Float}
20919
20920 @code{Ada.Numerics.Complex_Elementary_Functions}
20921
20922 @item
20923 @code{Long_Float}
20924
20925 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
20926 @end itemize
20927
20928 @item @code{Ada.Numerics.Generic_Complex_Types}
20929
20930 This is a generic package that allows the creation of complex types,
20931 with associated complex arithmetic operations.
20932
20933 The following predefined instantiations of this package exist
20934
20935
20936 @itemize *
20937
20938 @item
20939 @code{Short_Float}
20940
20941 @code{Ada.Numerics.Short_Complex_Complex_Types}
20942
20943 @item
20944 @code{Float}
20945
20946 @code{Ada.Numerics.Complex_Complex_Types}
20947
20948 @item
20949 @code{Long_Float}
20950
20951 @code{Ada.Numerics.Long_Complex_Complex_Types}
20952 @end itemize
20953
20954 @item @code{Ada.Numerics.Generic_Elementary_Functions}
20955
20956 This is a generic package that provides the implementation of standard
20957 elementary functions (such as log an trigonometric functions) for an
20958 arbitrary float type.
20959
20960 The following predefined instantiations of this package exist
20961
20962
20963 @itemize *
20964
20965 @item
20966 @code{Short_Float}
20967
20968 @code{Ada.Numerics.Short_Elementary_Functions}
20969
20970 @item
20971 @code{Float}
20972
20973 @code{Ada.Numerics.Elementary_Functions}
20974
20975 @item
20976 @code{Long_Float}
20977
20978 @code{Ada.Numerics.Long_Elementary_Functions}
20979 @end itemize
20980
20981 @item @code{Ada.Numerics.Generic_Real_Arrays} @emph{(G.3.1)}
20982
20983 Generic operations on arrays of reals
20984
20985 @item @code{Ada.Numerics.Real_Arrays} @emph{(G.3.1)}
20986
20987 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
20988
20989 @item @code{Ada.Real_Time} @emph{(D.8)}
20990
20991 This package provides facilities similar to those of @code{Calendar}, but
20992 operating with a finer clock suitable for real time control. Note that
20993 annex D requires that there be no backward clock jumps, and GNAT generally
20994 guarantees this behavior, but of course if the external clock on which
20995 the GNAT runtime depends is deliberately reset by some external event,
20996 then such a backward jump may occur.
20997
20998 @item @code{Ada.Real_Time.Timing_Events} @emph{(D.15)}
20999
21000 Not implemented in GNAT.
21001
21002 @item @code{Ada.Sequential_IO} @emph{(A.8.1)}
21003
21004 This package provides input-output facilities for sequential files,
21005 which can contain a sequence of values of a single type, which can be
21006 any Ada type, including indefinite (unconstrained) types.
21007
21008 @item @code{Ada.Storage_IO} @emph{(A.9)}
21009
21010 This package provides a facility for mapping arbitrary Ada types to and
21011 from a storage buffer. It is primarily intended for the creation of new
21012 IO packages.
21013
21014 @item @code{Ada.Streams} @emph{(13.13.1)}
21015
21016 This is a generic package that provides the basic support for the
21017 concept of streams as used by the stream attributes (@code{Input},
21018 @code{Output}, @code{Read} and @code{Write}).
21019
21020 @item @code{Ada.Streams.Stream_IO} @emph{(A.12.1)}
21021
21022 This package is a specialization of the type @code{Streams} defined in
21023 package @code{Streams} together with a set of operations providing
21024 Stream_IO capability. The Stream_IO model permits both random and
21025 sequential access to a file which can contain an arbitrary set of values
21026 of one or more Ada types.
21027
21028 @item @code{Ada.Strings} @emph{(A.4.1)}
21029
21030 This package provides some basic constants used by the string handling
21031 packages.
21032
21033 @item @code{Ada.Strings.Bounded} @emph{(A.4.4)}
21034
21035 This package provides facilities for handling variable length
21036 strings. The bounded model requires a maximum length. It is thus
21037 somewhat more limited than the unbounded model, but avoids the use of
21038 dynamic allocation or finalization.
21039
21040 @item @code{Ada.Strings.Bounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21041
21042 Provides case-insensitive comparisons of bounded strings
21043
21044 @item @code{Ada.Strings.Bounded.Hash} @emph{(A.4.9)}
21045
21046 This package provides a generic hash function for bounded strings
21047
21048 @item @code{Ada.Strings.Bounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21049
21050 This package provides a generic hash function for bounded strings that
21051 converts the string to be hashed to lower case.
21052
21053 @item @code{Ada.Strings.Bounded.Less_Case_Insensitive} @emph{(A.4.10)}
21054
21055 This package provides a comparison function for bounded strings that works
21056 in a case insensitive manner by converting to lower case before the comparison.
21057
21058 @item @code{Ada.Strings.Fixed} @emph{(A.4.3)}
21059
21060 This package provides facilities for handling fixed length strings.
21061
21062 @item @code{Ada.Strings.Fixed.Equal_Case_Insensitive} @emph{(A.4.10)}
21063
21064 This package provides an equality function for fixed strings that compares
21065 the strings after converting both to lower case.
21066
21067 @item @code{Ada.Strings.Fixed.Hash_Case_Insensitive} @emph{(A.4.9)}
21068
21069 This package provides a case insensitive hash function for fixed strings that
21070 converts the string to lower case before computing the hash.
21071
21072 @item @code{Ada.Strings.Fixed.Less_Case_Insensitive} @emph{(A.4.10)}
21073
21074 This package provides a comparison function for fixed strings that works
21075 in a case insensitive manner by converting to lower case before the comparison.
21076
21077 @item @code{Ada.Strings.Hash} @emph{(A.4.9)}
21078
21079 This package provides a hash function for strings.
21080
21081 @item @code{Ada.Strings.Hash_Case_Insensitive} @emph{(A.4.9)}
21082
21083 This package provides a hash function for strings that is case insensitive.
21084 The string is converted to lower case before computing the hash.
21085
21086 @item @code{Ada.Strings.Less_Case_Insensitive} @emph{(A.4.10)}
21087
21088 This package provides a comparison function for\strings that works
21089 in a case insensitive manner by converting to lower case before the comparison.
21090
21091 @item @code{Ada.Strings.Maps} @emph{(A.4.2)}
21092
21093 This package provides facilities for handling character mappings and
21094 arbitrarily defined subsets of characters. For instance it is useful in
21095 defining specialized translation tables.
21096
21097 @item @code{Ada.Strings.Maps.Constants} @emph{(A.4.6)}
21098
21099 This package provides a standard set of predefined mappings and
21100 predefined character sets. For example, the standard upper to lower case
21101 conversion table is found in this package. Note that upper to lower case
21102 conversion is non-trivial if you want to take the entire set of
21103 characters, including extended characters like E with an acute accent,
21104 into account. You should use the mappings in this package (rather than
21105 adding 32 yourself) to do case mappings.
21106
21107 @item @code{Ada.Strings.Unbounded} @emph{(A.4.5)}
21108
21109 This package provides facilities for handling variable length
21110 strings. The unbounded model allows arbitrary length strings, but
21111 requires the use of dynamic allocation and finalization.
21112
21113 @item @code{Ada.Strings.Unbounded.Equal_Case_Insensitive} @emph{(A.4.10)}
21114
21115 Provides case-insensitive comparisons of unbounded strings
21116
21117 @item @code{Ada.Strings.Unbounded.Hash} @emph{(A.4.9)}
21118
21119 This package provides a generic hash function for unbounded strings
21120
21121 @item @code{Ada.Strings.Unbounded.Hash_Case_Insensitive} @emph{(A.4.9)}
21122
21123 This package provides a generic hash function for unbounded strings that
21124 converts the string to be hashed to lower case.
21125
21126 @item @code{Ada.Strings.Unbounded.Less_Case_Insensitive} @emph{(A.4.10)}
21127
21128 This package provides a comparison function for unbounded strings that works
21129 in a case insensitive manner by converting to lower case before the comparison.
21130
21131 @item @code{Ada.Strings.UTF_Encoding} @emph{(A.4.11)}
21132
21133 This package provides basic definitions for dealing with UTF-encoded strings.
21134
21135 @item @code{Ada.Strings.UTF_Encoding.Conversions} @emph{(A.4.11)}
21136
21137 This package provides conversion functions for UTF-encoded strings.
21138 @end table
21139
21140 @code{Ada.Strings.UTF_Encoding.Strings} @emph{(A.4.11)}
21141
21142 @code{Ada.Strings.UTF_Encoding.Wide_Strings} @emph{(A.4.11)}
21143
21144
21145 @table @asis
21146
21147 @item @code{Ada.Strings.UTF_Encoding.Wide_Wide_Strings} @emph{(A.4.11)}
21148
21149 These packages provide facilities for handling UTF encodings for
21150 Strings, Wide_Strings and Wide_Wide_Strings.
21151 @end table
21152
21153 @code{Ada.Strings.Wide_Bounded} @emph{(A.4.7)}
21154
21155 @code{Ada.Strings.Wide_Fixed} @emph{(A.4.7)}
21156
21157 @code{Ada.Strings.Wide_Maps} @emph{(A.4.7)}
21158
21159
21160 @table @asis
21161
21162 @item @code{Ada.Strings.Wide_Unbounded} @emph{(A.4.7)}
21163
21164 These packages provide analogous capabilities to the corresponding
21165 packages without @code{Wide_} in the name, but operate with the types
21166 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
21167 and @code{Character}. Versions of all the child packages are available.
21168 @end table
21169
21170 @code{Ada.Strings.Wide_Wide_Bounded} @emph{(A.4.7)}
21171
21172 @code{Ada.Strings.Wide_Wide_Fixed} @emph{(A.4.7)}
21173
21174 @code{Ada.Strings.Wide_Wide_Maps} @emph{(A.4.7)}
21175
21176
21177 @table @asis
21178
21179 @item @code{Ada.Strings.Wide_Wide_Unbounded} @emph{(A.4.7)}
21180
21181 These packages provide analogous capabilities to the corresponding
21182 packages without @code{Wide_} in the name, but operate with the types
21183 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
21184 of @code{String} and @code{Character}.
21185
21186 @item @code{Ada.Synchronous_Barriers} @emph{(D.10.1)}
21187
21188 This package provides facilities for synchronizing tasks at a low level
21189 with barriers.
21190
21191 @item @code{Ada.Synchronous_Task_Control} @emph{(D.10)}
21192
21193 This package provides some standard facilities for controlling task
21194 communication in a synchronous manner.
21195
21196 @item @code{Ada.Synchronous_Task_Control.EDF} @emph{(D.10)}
21197
21198 Not implemented in GNAT.
21199
21200 @item @code{Ada.Tags}
21201
21202 This package contains definitions for manipulation of the tags of tagged
21203 values.
21204
21205 @item @code{Ada.Tags.Generic_Dispatching_Constructor} @emph{(3.9)}
21206
21207 This package provides a way of constructing tagged class-wide values given
21208 only the tag value.
21209
21210 @item @code{Ada.Task_Attributes} @emph{(C.7.2)}
21211
21212 This package provides the capability of associating arbitrary
21213 task-specific data with separate tasks.
21214
21215 @item @code{Ada.Task_Identifification} @emph{(C.7.1)}
21216
21217 This package provides capabilities for task identification.
21218
21219 @item @code{Ada.Task_Termination} @emph{(C.7.3)}
21220
21221 This package provides control over task termination.
21222
21223 @item @code{Ada.Text_IO}
21224
21225 This package provides basic text input-output capabilities for
21226 character, string and numeric data. The subpackages of this
21227 package are listed next. Note that although these are defined
21228 as subpackages in the RM, they are actually transparently
21229 implemented as child packages in GNAT, meaning that they
21230 are only loaded if needed.
21231
21232 @item @code{Ada.Text_IO.Decimal_IO}
21233
21234 Provides input-output facilities for decimal fixed-point types
21235
21236 @item @code{Ada.Text_IO.Enumeration_IO}
21237
21238 Provides input-output facilities for enumeration types.
21239
21240 @item @code{Ada.Text_IO.Fixed_IO}
21241
21242 Provides input-output facilities for ordinary fixed-point types.
21243
21244 @item @code{Ada.Text_IO.Float_IO}
21245
21246 Provides input-output facilities for float types. The following
21247 predefined instantiations of this generic package are available:
21248
21249
21250 @itemize *
21251
21252 @item
21253 @code{Short_Float}
21254
21255 @code{Short_Float_Text_IO}
21256
21257 @item
21258 @code{Float}
21259
21260 @code{Float_Text_IO}
21261
21262 @item
21263 @code{Long_Float}
21264
21265 @code{Long_Float_Text_IO}
21266 @end itemize
21267
21268 @item @code{Ada.Text_IO.Integer_IO}
21269
21270 Provides input-output facilities for integer types. The following
21271 predefined instantiations of this generic package are available:
21272
21273
21274 @itemize *
21275
21276 @item
21277 @code{Short_Short_Integer}
21278
21279 @code{Ada.Short_Short_Integer_Text_IO}
21280
21281 @item
21282 @code{Short_Integer}
21283
21284 @code{Ada.Short_Integer_Text_IO}
21285
21286 @item
21287 @code{Integer}
21288
21289 @code{Ada.Integer_Text_IO}
21290
21291 @item
21292 @code{Long_Integer}
21293
21294 @code{Ada.Long_Integer_Text_IO}
21295
21296 @item
21297 @code{Long_Long_Integer}
21298
21299 @code{Ada.Long_Long_Integer_Text_IO}
21300 @end itemize
21301
21302 @item @code{Ada.Text_IO.Modular_IO}
21303
21304 Provides input-output facilities for modular (unsigned) types.
21305
21306 @item @code{Ada.Text_IO.Bounded_IO (A.10.11)}
21307
21308 Provides input-output facilities for bounded strings.
21309
21310 @item @code{Ada.Text_IO.Complex_IO (G.1.3)}
21311
21312 This package provides basic text input-output capabilities for complex
21313 data.
21314
21315 @item @code{Ada.Text_IO.Editing (F.3.3)}
21316
21317 This package contains routines for edited output, analogous to the use
21318 of pictures in COBOL. The picture formats used by this package are a
21319 close copy of the facility in COBOL.
21320
21321 @item @code{Ada.Text_IO.Text_Streams (A.12.2)}
21322
21323 This package provides a facility that allows Text_IO files to be treated
21324 as streams, so that the stream attributes can be used for writing
21325 arbitrary data, including binary data, to Text_IO files.
21326
21327 @item @code{Ada.Text_IO.Unbounded_IO (A.10.12)}
21328
21329 This package provides input-output facilities for unbounded strings.
21330
21331 @item @code{Ada.Unchecked_Conversion (13.9)}
21332
21333 This generic package allows arbitrary conversion from one type to
21334 another of the same size, providing for breaking the type safety in
21335 special circumstances.
21336
21337 If the types have the same Size (more accurately the same Value_Size),
21338 then the effect is simply to transfer the bits from the source to the
21339 target type without any modification. This usage is well defined, and
21340 for simple types whose representation is typically the same across
21341 all implementations, gives a portable method of performing such
21342 conversions.
21343
21344 If the types do not have the same size, then the result is implementation
21345 defined, and thus may be non-portable. The following describes how GNAT
21346 handles such unchecked conversion cases.
21347
21348 If the types are of different sizes, and are both discrete types, then
21349 the effect is of a normal type conversion without any constraint checking.
21350 In particular if the result type has a larger size, the result will be
21351 zero or sign extended. If the result type has a smaller size, the result
21352 will be truncated by ignoring high order bits.
21353
21354 If the types are of different sizes, and are not both discrete types,
21355 then the conversion works as though pointers were created to the source
21356 and target, and the pointer value is converted. The effect is that bits
21357 are copied from successive low order storage units and bits of the source
21358 up to the length of the target type.
21359
21360 A warning is issued if the lengths differ, since the effect in this
21361 case is implementation dependent, and the above behavior may not match
21362 that of some other compiler.
21363
21364 A pointer to one type may be converted to a pointer to another type using
21365 unchecked conversion. The only case in which the effect is undefined is
21366 when one or both pointers are pointers to unconstrained array types. In
21367 this case, the bounds information may get incorrectly transferred, and in
21368 particular, GNAT uses double size pointers for such types, and it is
21369 meaningless to convert between such pointer types. GNAT will issue a
21370 warning if the alignment of the target designated type is more strict
21371 than the alignment of the source designated type (since the result may
21372 be unaligned in this case).
21373
21374 A pointer other than a pointer to an unconstrained array type may be
21375 converted to and from System.Address. Such usage is common in Ada 83
21376 programs, but note that Ada.Address_To_Access_Conversions is the
21377 preferred method of performing such conversions in Ada 95 and Ada 2005.
21378 Neither
21379 unchecked conversion nor Ada.Address_To_Access_Conversions should be
21380 used in conjunction with pointers to unconstrained objects, since
21381 the bounds information cannot be handled correctly in this case.
21382
21383 @item @code{Ada.Unchecked_Deallocation} @emph{(13.11.2)}
21384
21385 This generic package allows explicit freeing of storage previously
21386 allocated by use of an allocator.
21387
21388 @item @code{Ada.Wide_Text_IO} @emph{(A.11)}
21389
21390 This package is similar to @code{Ada.Text_IO}, except that the external
21391 file supports wide character representations, and the internal types are
21392 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21393 and @code{String}. The corresponding set of nested packages and child
21394 packages are defined.
21395
21396 @item @code{Ada.Wide_Wide_Text_IO} @emph{(A.11)}
21397
21398 This package is similar to @code{Ada.Text_IO}, except that the external
21399 file supports wide character representations, and the internal types are
21400 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
21401 and @code{String}. The corresponding set of nested packages and child
21402 packages are defined.
21403 @end table
21404
21405 For packages in Interfaces and System, all the RM defined packages are
21406 available in GNAT, see the Ada 2012 RM for full details.
21407
21408 @node The Implementation of Standard I/O,The GNAT Library,Standard Library Routines,Top
21409 @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{29a}@anchor{gnat_rm/the_implementation_of_standard_i_o id1}@anchor{29b}
21410 @chapter The Implementation of Standard I/O
21411
21412
21413 GNAT implements all the required input-output facilities described in
21414 A.6 through A.14. These sections of the Ada Reference Manual describe the
21415 required behavior of these packages from the Ada point of view, and if
21416 you are writing a portable Ada program that does not need to know the
21417 exact manner in which Ada maps to the outside world when it comes to
21418 reading or writing external files, then you do not need to read this
21419 chapter. As long as your files are all regular files (not pipes or
21420 devices), and as long as you write and read the files only from Ada, the
21421 description in the Ada Reference Manual is sufficient.
21422
21423 However, if you want to do input-output to pipes or other devices, such
21424 as the keyboard or screen, or if the files you are dealing with are
21425 either generated by some other language, or to be read by some other
21426 language, then you need to know more about the details of how the GNAT
21427 implementation of these input-output facilities behaves.
21428
21429 In this chapter we give a detailed description of exactly how GNAT
21430 interfaces to the file system. As always, the sources of the system are
21431 available to you for answering questions at an even more detailed level,
21432 but for most purposes the information in this chapter will suffice.
21433
21434 Another reason that you may need to know more about how input-output is
21435 implemented arises when you have a program written in mixed languages
21436 where, for example, files are shared between the C and Ada sections of
21437 the same program. GNAT provides some additional facilities, in the form
21438 of additional child library packages, that facilitate this sharing, and
21439 these additional facilities are also described in this chapter.
21440
21441 @menu
21442 * Standard I/O Packages::
21443 * FORM Strings::
21444 * Direct_IO::
21445 * Sequential_IO::
21446 * Text_IO::
21447 * Wide_Text_IO::
21448 * Wide_Wide_Text_IO::
21449 * Stream_IO::
21450 * Text Translation::
21451 * Shared Files::
21452 * Filenames encoding::
21453 * File content encoding::
21454 * Open Modes::
21455 * Operations on C Streams::
21456 * Interfacing to C Streams::
21457
21458 @end menu
21459
21460 @node Standard I/O Packages,FORM Strings,,The Implementation of Standard I/O
21461 @anchor{gnat_rm/the_implementation_of_standard_i_o standard-i-o-packages}@anchor{29c}@anchor{gnat_rm/the_implementation_of_standard_i_o id2}@anchor{29d}
21462 @section Standard I/O Packages
21463
21464
21465 The Standard I/O packages described in Annex A for
21466
21467
21468 @itemize *
21469
21470 @item
21471 Ada.Text_IO
21472
21473 @item
21474 Ada.Text_IO.Complex_IO
21475
21476 @item
21477 Ada.Text_IO.Text_Streams
21478
21479 @item
21480 Ada.Wide_Text_IO
21481
21482 @item
21483 Ada.Wide_Text_IO.Complex_IO
21484
21485 @item
21486 Ada.Wide_Text_IO.Text_Streams
21487
21488 @item
21489 Ada.Wide_Wide_Text_IO
21490
21491 @item
21492 Ada.Wide_Wide_Text_IO.Complex_IO
21493
21494 @item
21495 Ada.Wide_Wide_Text_IO.Text_Streams
21496
21497 @item
21498 Ada.Stream_IO
21499
21500 @item
21501 Ada.Sequential_IO
21502
21503 @item
21504 Ada.Direct_IO
21505 @end itemize
21506
21507 are implemented using the C
21508 library streams facility; where
21509
21510
21511 @itemize *
21512
21513 @item
21514 All files are opened using @code{fopen}.
21515
21516 @item
21517 All input/output operations use @code{fread}/@cite{fwrite}.
21518 @end itemize
21519
21520 There is no internal buffering of any kind at the Ada library level. The only
21521 buffering is that provided at the system level in the implementation of the
21522 library routines that support streams. This facilitates shared use of these
21523 streams by mixed language programs. Note though that system level buffering is
21524 explicitly enabled at elaboration of the standard I/O packages and that can
21525 have an impact on mixed language programs, in particular those using I/O before
21526 calling the Ada elaboration routine (e.g., adainit). It is recommended to call
21527 the Ada elaboration routine before performing any I/O or when impractical,
21528 flush the common I/O streams and in particular Standard_Output before
21529 elaborating the Ada code.
21530
21531 @node FORM Strings,Direct_IO,Standard I/O Packages,The Implementation of Standard I/O
21532 @anchor{gnat_rm/the_implementation_of_standard_i_o form-strings}@anchor{29e}@anchor{gnat_rm/the_implementation_of_standard_i_o id3}@anchor{29f}
21533 @section FORM Strings
21534
21535
21536 The format of a FORM string in GNAT is:
21537
21538 @example
21539 "keyword=value,keyword=value,...,keyword=value"
21540 @end example
21541
21542 where letters may be in upper or lower case, and there are no spaces
21543 between values. The order of the entries is not important. Currently
21544 the following keywords defined.
21545
21546 @example
21547 TEXT_TRANSLATION=[YES|NO|TEXT|BINARY|U8TEXT|WTEXT|U16TEXT]
21548 SHARED=[YES|NO]
21549 WCEM=[n|h|u|s|e|8|b]
21550 ENCODING=[UTF8|8BITS]
21551 @end example
21552
21553 The use of these parameters is described later in this section. If an
21554 unrecognized keyword appears in a form string, it is silently ignored
21555 and not considered invalid.
21556
21557 @node Direct_IO,Sequential_IO,FORM Strings,The Implementation of Standard I/O
21558 @anchor{gnat_rm/the_implementation_of_standard_i_o direct-io}@anchor{2a0}@anchor{gnat_rm/the_implementation_of_standard_i_o id4}@anchor{2a1}
21559 @section Direct_IO
21560
21561
21562 Direct_IO can only be instantiated for definite types. This is a
21563 restriction of the Ada language, which means that the records are fixed
21564 length (the length being determined by @code{type'Size}, rounded
21565 up to the next storage unit boundary if necessary).
21566
21567 The records of a Direct_IO file are simply written to the file in index
21568 sequence, with the first record starting at offset zero, and subsequent
21569 records following. There is no control information of any kind. For
21570 example, if 32-bit integers are being written, each record takes
21571 4-bytes, so the record at index @code{K} starts at offset
21572 (@code{K}-1)*4.
21573
21574 There is no limit on the size of Direct_IO files, they are expanded as
21575 necessary to accommodate whatever records are written to the file.
21576
21577 @node Sequential_IO,Text_IO,Direct_IO,The Implementation of Standard I/O
21578 @anchor{gnat_rm/the_implementation_of_standard_i_o sequential-io}@anchor{2a2}@anchor{gnat_rm/the_implementation_of_standard_i_o id5}@anchor{2a3}
21579 @section Sequential_IO
21580
21581
21582 Sequential_IO may be instantiated with either a definite (constrained)
21583 or indefinite (unconstrained) type.
21584
21585 For the definite type case, the elements written to the file are simply
21586 the memory images of the data values with no control information of any
21587 kind. The resulting file should be read using the same type, no validity
21588 checking is performed on input.
21589
21590 For the indefinite type case, the elements written consist of two
21591 parts. First is the size of the data item, written as the memory image
21592 of a @code{Interfaces.C.size_t} value, followed by the memory image of
21593 the data value. The resulting file can only be read using the same
21594 (unconstrained) type. Normal assignment checks are performed on these
21595 read operations, and if these checks fail, @code{Data_Error} is
21596 raised. In particular, in the array case, the lengths must match, and in
21597 the variant record case, if the variable for a particular read operation
21598 is constrained, the discriminants must match.
21599
21600 Note that it is not possible to use Sequential_IO to write variable
21601 length array items, and then read the data back into different length
21602 arrays. For example, the following will raise @code{Data_Error}:
21603
21604 @example
21605 package IO is new Sequential_IO (String);
21606 F : IO.File_Type;
21607 S : String (1..4);
21608 ...
21609 IO.Create (F)
21610 IO.Write (F, "hello!")
21611 IO.Reset (F, Mode=>In_File);
21612 IO.Read (F, S);
21613 Put_Line (S);
21614 @end example
21615
21616 On some Ada implementations, this will print @code{hell}, but the program is
21617 clearly incorrect, since there is only one element in the file, and that
21618 element is the string @code{hello!}.
21619
21620 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
21621 using Stream_IO, and this is the preferred mechanism. In particular, the
21622 above program fragment rewritten to use Stream_IO will work correctly.
21623
21624 @node Text_IO,Wide_Text_IO,Sequential_IO,The Implementation of Standard I/O
21625 @anchor{gnat_rm/the_implementation_of_standard_i_o id6}@anchor{2a4}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io}@anchor{2a5}
21626 @section Text_IO
21627
21628
21629 Text_IO files consist of a stream of characters containing the following
21630 special control characters:
21631
21632 @example
21633 LF (line feed, 16#0A#) Line Mark
21634 FF (form feed, 16#0C#) Page Mark
21635 @end example
21636
21637 A canonical Text_IO file is defined as one in which the following
21638 conditions are met:
21639
21640
21641 @itemize *
21642
21643 @item
21644 The character @code{LF} is used only as a line mark, i.e., to mark the end
21645 of the line.
21646
21647 @item
21648 The character @code{FF} is used only as a page mark, i.e., to mark the
21649 end of a page and consequently can appear only immediately following a
21650 @code{LF} (line mark) character.
21651
21652 @item
21653 The file ends with either @code{LF} (line mark) or @code{LF}-@cite{FF}
21654 (line mark, page mark). In the former case, the page mark is implicitly
21655 assumed to be present.
21656 @end itemize
21657
21658 A file written using Text_IO will be in canonical form provided that no
21659 explicit @code{LF} or @code{FF} characters are written using @code{Put}
21660 or @code{Put_Line}. There will be no @code{FF} character at the end of
21661 the file unless an explicit @code{New_Page} operation was performed
21662 before closing the file.
21663
21664 A canonical Text_IO file that is a regular file (i.e., not a device or a
21665 pipe) can be read using any of the routines in Text_IO. The
21666 semantics in this case will be exactly as defined in the Ada Reference
21667 Manual, and all the routines in Text_IO are fully implemented.
21668
21669 A text file that does not meet the requirements for a canonical Text_IO
21670 file has one of the following:
21671
21672
21673 @itemize *
21674
21675 @item
21676 The file contains @code{FF} characters not immediately following a
21677 @code{LF} character.
21678
21679 @item
21680 The file contains @code{LF} or @code{FF} characters written by
21681 @code{Put} or @code{Put_Line}, which are not logically considered to be
21682 line marks or page marks.
21683
21684 @item
21685 The file ends in a character other than @code{LF} or @code{FF},
21686 i.e., there is no explicit line mark or page mark at the end of the file.
21687 @end itemize
21688
21689 Text_IO can be used to read such non-standard text files but subprograms
21690 to do with line or page numbers do not have defined meanings. In
21691 particular, a @code{FF} character that does not follow a @code{LF}
21692 character may or may not be treated as a page mark from the point of
21693 view of page and line numbering. Every @code{LF} character is considered
21694 to end a line, and there is an implied @code{LF} character at the end of
21695 the file.
21696
21697 @menu
21698 * Stream Pointer Positioning::
21699 * Reading and Writing Non-Regular Files::
21700 * Get_Immediate::
21701 * Treating Text_IO Files as Streams::
21702 * Text_IO Extensions::
21703 * Text_IO Facilities for Unbounded Strings::
21704
21705 @end menu
21706
21707 @node Stream Pointer Positioning,Reading and Writing Non-Regular Files,,Text_IO
21708 @anchor{gnat_rm/the_implementation_of_standard_i_o id7}@anchor{2a6}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning}@anchor{2a7}
21709 @subsection Stream Pointer Positioning
21710
21711
21712 @code{Ada.Text_IO} has a definition of current position for a file that
21713 is being read. No internal buffering occurs in Text_IO, and usually the
21714 physical position in the stream used to implement the file corresponds
21715 to this logical position defined by Text_IO. There are two exceptions:
21716
21717
21718 @itemize *
21719
21720 @item
21721 After a call to @code{End_Of_Page} that returns @code{True}, the stream
21722 is positioned past the @code{LF} (line mark) that precedes the page
21723 mark. Text_IO maintains an internal flag so that subsequent read
21724 operations properly handle the logical position which is unchanged by
21725 the @code{End_Of_Page} call.
21726
21727 @item
21728 After a call to @code{End_Of_File} that returns @code{True}, if the
21729 Text_IO file was positioned before the line mark at the end of file
21730 before the call, then the logical position is unchanged, but the stream
21731 is physically positioned right at the end of file (past the line mark,
21732 and past a possible page mark following the line mark. Again Text_IO
21733 maintains internal flags so that subsequent read operations properly
21734 handle the logical position.
21735 @end itemize
21736
21737 These discrepancies have no effect on the observable behavior of
21738 Text_IO, but if a single Ada stream is shared between a C program and
21739 Ada program, or shared (using @code{shared=yes} in the form string)
21740 between two Ada files, then the difference may be observable in some
21741 situations.
21742
21743 @node Reading and Writing Non-Regular Files,Get_Immediate,Stream Pointer Positioning,Text_IO
21744 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files}@anchor{2a8}@anchor{gnat_rm/the_implementation_of_standard_i_o id8}@anchor{2a9}
21745 @subsection Reading and Writing Non-Regular Files
21746
21747
21748 A non-regular file is a device (such as a keyboard), or a pipe. Text_IO
21749 can be used for reading and writing. Writing is not affected and the
21750 sequence of characters output is identical to the normal file case, but
21751 for reading, the behavior of Text_IO is modified to avoid undesirable
21752 look-ahead as follows:
21753
21754 An input file that is not a regular file is considered to have no page
21755 marks. Any @code{Ascii.FF} characters (the character normally used for a
21756 page mark) appearing in the file are considered to be data
21757 characters. In particular:
21758
21759
21760 @itemize *
21761
21762 @item
21763 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
21764 following a line mark. If a page mark appears, it will be treated as a
21765 data character.
21766
21767 @item
21768 This avoids the need to wait for an extra character to be typed or
21769 entered from the pipe to complete one of these operations.
21770
21771 @item
21772 @code{End_Of_Page} always returns @code{False}
21773
21774 @item
21775 @code{End_Of_File} will return @code{False} if there is a page mark at
21776 the end of the file.
21777 @end itemize
21778
21779 Output to non-regular files is the same as for regular files. Page marks
21780 may be written to non-regular files using @code{New_Page}, but as noted
21781 above they will not be treated as page marks on input if the output is
21782 piped to another Ada program.
21783
21784 Another important discrepancy when reading non-regular files is that the end
21785 of file indication is not 'sticky'. If an end of file is entered, e.g., by
21786 pressing the @code{EOT} key,
21787 then end of file
21788 is signaled once (i.e., the test @code{End_Of_File}
21789 will yield @code{True}, or a read will
21790 raise @code{End_Error}), but then reading can resume
21791 to read data past that end of
21792 file indication, until another end of file indication is entered.
21793
21794 @node Get_Immediate,Treating Text_IO Files as Streams,Reading and Writing Non-Regular Files,Text_IO
21795 @anchor{gnat_rm/the_implementation_of_standard_i_o get-immediate}@anchor{2aa}@anchor{gnat_rm/the_implementation_of_standard_i_o id9}@anchor{2ab}
21796 @subsection Get_Immediate
21797
21798
21799 @geindex Get_Immediate
21800
21801 Get_Immediate returns the next character (including control characters)
21802 from the input file. In particular, Get_Immediate will return LF or FF
21803 characters used as line marks or page marks. Such operations leave the
21804 file positioned past the control character, and it is thus not treated
21805 as having its normal function. This means that page, line and column
21806 counts after this kind of Get_Immediate call are set as though the mark
21807 did not occur. In the case where a Get_Immediate leaves the file
21808 positioned between the line mark and page mark (which is not normally
21809 possible), it is undefined whether the FF character will be treated as a
21810 page mark.
21811
21812 @node Treating Text_IO Files as Streams,Text_IO Extensions,Get_Immediate,Text_IO
21813 @anchor{gnat_rm/the_implementation_of_standard_i_o id10}@anchor{2ac}@anchor{gnat_rm/the_implementation_of_standard_i_o treating-text-io-files-as-streams}@anchor{2ad}
21814 @subsection Treating Text_IO Files as Streams
21815
21816
21817 @geindex Stream files
21818
21819 The package @code{Text_IO.Streams} allows a @code{Text_IO} file to be treated
21820 as a stream. Data written to a @code{Text_IO} file in this stream mode is
21821 binary data. If this binary data contains bytes 16#0A# (@code{LF}) or
21822 16#0C# (@code{FF}), the resulting file may have non-standard
21823 format. Similarly if read operations are used to read from a Text_IO
21824 file treated as a stream, then @code{LF} and @code{FF} characters may be
21825 skipped and the effect is similar to that described above for
21826 @code{Get_Immediate}.
21827
21828 @node Text_IO Extensions,Text_IO Facilities for Unbounded Strings,Treating Text_IO Files as Streams,Text_IO
21829 @anchor{gnat_rm/the_implementation_of_standard_i_o id11}@anchor{2ae}@anchor{gnat_rm/the_implementation_of_standard_i_o text-io-extensions}@anchor{2af}
21830 @subsection Text_IO Extensions
21831
21832
21833 @geindex Text_IO extensions
21834
21835 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
21836 to the standard @code{Text_IO} package:
21837
21838
21839 @itemize *
21840
21841 @item
21842 function File_Exists (Name : String) return Boolean;
21843 Determines if a file of the given name exists.
21844
21845 @item
21846 function Get_Line return String;
21847 Reads a string from the standard input file. The value returned is exactly
21848 the length of the line that was read.
21849
21850 @item
21851 function Get_Line (File : Ada.Text_IO.File_Type) return String;
21852 Similar, except that the parameter File specifies the file from which
21853 the string is to be read.
21854 @end itemize
21855
21856 @node Text_IO Facilities for Unbounded Strings,,Text_IO Extensions,Text_IO
21857 @anchor{gnat_rm/the_implementation_of_standard_i_o text-io-facilities-for-unbounded-strings}@anchor{2b0}@anchor{gnat_rm/the_implementation_of_standard_i_o id12}@anchor{2b1}
21858 @subsection Text_IO Facilities for Unbounded Strings
21859
21860
21861 @geindex Text_IO for unbounded strings
21862
21863 @geindex Unbounded_String
21864 @geindex Text_IO operations
21865
21866 The package @code{Ada.Strings.Unbounded.Text_IO}
21867 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
21868 subprograms useful for Text_IO operations on unbounded strings:
21869
21870
21871 @itemize *
21872
21873 @item
21874 function Get_Line (File : File_Type) return Unbounded_String;
21875 Reads a line from the specified file
21876 and returns the result as an unbounded string.
21877
21878 @item
21879 procedure Put (File : File_Type; U : Unbounded_String);
21880 Writes the value of the given unbounded string to the specified file
21881 Similar to the effect of
21882 @code{Put (To_String (U))} except that an extra copy is avoided.
21883
21884 @item
21885 procedure Put_Line (File : File_Type; U : Unbounded_String);
21886 Writes the value of the given unbounded string to the specified file,
21887 followed by a @code{New_Line}.
21888 Similar to the effect of @code{Put_Line (To_String (U))} except
21889 that an extra copy is avoided.
21890 @end itemize
21891
21892 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
21893 and is optional. If the parameter is omitted, then the standard input or
21894 output file is referenced as appropriate.
21895
21896 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
21897 files @code{a-swuwti.ads} and @code{a-swuwti.adb} provides similar extended
21898 @code{Wide_Text_IO} functionality for unbounded wide strings.
21899
21900 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
21901 files @code{a-szuzti.ads} and @code{a-szuzti.adb} provides similar extended
21902 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
21903
21904 @node Wide_Text_IO,Wide_Wide_Text_IO,Text_IO,The Implementation of Standard I/O
21905 @anchor{gnat_rm/the_implementation_of_standard_i_o wide-text-io}@anchor{2b2}@anchor{gnat_rm/the_implementation_of_standard_i_o id13}@anchor{2b3}
21906 @section Wide_Text_IO
21907
21908
21909 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
21910 both input and output files may contain special sequences that represent
21911 wide character values. The encoding scheme for a given file may be
21912 specified using a FORM parameter:
21913
21914 @example
21915 WCEM=`x`
21916 @end example
21917
21918 as part of the FORM string (WCEM = wide character encoding method),
21919 where @code{x} is one of the following characters
21920
21921
21922 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
21923 @headitem
21924
21925 Character
21926
21927 @tab
21928
21929 Encoding
21930
21931 @item
21932
21933 @emph{h}
21934
21935 @tab
21936
21937 Hex ESC encoding
21938
21939 @item
21940
21941 @emph{u}
21942
21943 @tab
21944
21945 Upper half encoding
21946
21947 @item
21948
21949 @emph{s}
21950
21951 @tab
21952
21953 Shift-JIS encoding
21954
21955 @item
21956
21957 @emph{e}
21958
21959 @tab
21960
21961 EUC Encoding
21962
21963 @item
21964
21965 @emph{8}
21966
21967 @tab
21968
21969 UTF-8 encoding
21970
21971 @item
21972
21973 @emph{b}
21974
21975 @tab
21976
21977 Brackets encoding
21978
21979 @end multitable
21980
21981
21982 The encoding methods match those that
21983 can be used in a source
21984 program, but there is no requirement that the encoding method used for
21985 the source program be the same as the encoding method used for files,
21986 and different files may use different encoding methods.
21987
21988 The default encoding method for the standard files, and for opened files
21989 for which no WCEM parameter is given in the FORM string matches the
21990 wide character encoding specified for the main program (the default
21991 being brackets encoding if no coding method was specified with -gnatW).
21992
21993
21994 @table @asis
21995
21996 @item @emph{Hex Coding}
21997
21998 In this encoding, a wide character is represented by a five character
21999 sequence:
22000 @end table
22001
22002 @example
22003 ESC a b c d
22004 @end example
22005
22006
22007 @quotation
22008
22009 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22010 characters (using upper case letters) of the wide character code. For
22011 example, ESC A345 is used to represent the wide character with code
22012 16#A345#. This scheme is compatible with use of the full
22013 @code{Wide_Character} set.
22014 @end quotation
22015
22016
22017 @table @asis
22018
22019 @item @emph{Upper Half Coding}
22020
22021 The wide character with encoding 16#abcd#, where the upper bit is on
22022 (i.e., a is in the range 8-F) is represented as two bytes 16#ab# and
22023 16#cd#. The second byte may never be a format control character, but is
22024 not required to be in the upper half. This method can be also used for
22025 shift-JIS or EUC where the internal coding matches the external coding.
22026
22027 @item @emph{Shift JIS Coding}
22028
22029 A wide character is represented by a two character sequence 16#ab# and
22030 16#cd#, with the restrictions described for upper half encoding as
22031 described above. The internal character code is the corresponding JIS
22032 character according to the standard algorithm for Shift-JIS
22033 conversion. Only characters defined in the JIS code set table can be
22034 used with this encoding method.
22035
22036 @item @emph{EUC Coding}
22037
22038 A wide character is represented by a two character sequence 16#ab# and
22039 16#cd#, with both characters being in the upper half. The internal
22040 character code is the corresponding JIS character according to the EUC
22041 encoding algorithm. Only characters defined in the JIS code set table
22042 can be used with this encoding method.
22043
22044 @item @emph{UTF-8 Coding}
22045
22046 A wide character is represented using
22047 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22048 10646-1/Am.2. Depending on the character value, the representation
22049 is a one, two, or three byte sequence:
22050 @end table
22051
22052 @example
22053 16#0000#-16#007f#: 2#0xxxxxxx#
22054 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
22055 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22056 @end example
22057
22058
22059 @quotation
22060
22061 where the @code{xxx} bits correspond to the left-padded bits of the
22062 16-bit character value. Note that all lower half ASCII characters
22063 are represented as ASCII bytes and all upper half characters and
22064 other wide characters are represented as sequences of upper-half
22065 (The full UTF-8 scheme allows for encoding 31-bit characters as
22066 6-byte sequences, but in this implementation, all UTF-8 sequences
22067 of four or more bytes length will raise a Constraint_Error, as
22068 will all invalid UTF-8 sequences.)
22069 @end quotation
22070
22071
22072 @table @asis
22073
22074 @item @emph{Brackets Coding}
22075
22076 In this encoding, a wide character is represented by the following eight
22077 character sequence:
22078 @end table
22079
22080 @example
22081 [ " a b c d " ]
22082 @end example
22083
22084
22085 @quotation
22086
22087 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
22088 characters (using uppercase letters) of the wide character code. For
22089 example, @code{["A345"]} is used to represent the wide character with code
22090 @code{16#A345#}.
22091 This scheme is compatible with use of the full Wide_Character set.
22092 On input, brackets coding can also be used for upper half characters,
22093 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22094 is only used for wide characters with a code greater than @code{16#FF#}.
22095
22096 Note that brackets coding is not normally used in the context of
22097 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
22098 a portable way of encoding source files. In the context of Wide_Text_IO
22099 or Wide_Wide_Text_IO, it can only be used if the file does not contain
22100 any instance of the left bracket character other than to encode wide
22101 character values using the brackets encoding method. In practice it is
22102 expected that some standard wide character encoding method such
22103 as UTF-8 will be used for text input output.
22104
22105 If brackets notation is used, then any occurrence of a left bracket
22106 in the input file which is not the start of a valid wide character
22107 sequence will cause Constraint_Error to be raised. It is possible to
22108 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
22109 input will interpret this as a left bracket.
22110
22111 However, when a left bracket is output, it will be output as a left bracket
22112 and not as ["5B"]. We make this decision because for normal use of
22113 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
22114 brackets. For example, if we write:
22115
22116 @example
22117 Put_Line ("Start of output [first run]");
22118 @end example
22119
22120 we really do not want to have the left bracket in this message clobbered so
22121 that the output reads:
22122 @end quotation
22123
22124 @example
22125 Start of output ["5B"]first run]
22126 @end example
22127
22128
22129 @quotation
22130
22131 In practice brackets encoding is reasonably useful for normal Put_Line use
22132 since we won't get confused between left brackets and wide character
22133 sequences in the output. But for input, or when files are written out
22134 and read back in, it really makes better sense to use one of the standard
22135 encoding methods such as UTF-8.
22136 @end quotation
22137
22138 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
22139 not all wide character
22140 values can be represented. An attempt to output a character that cannot
22141 be represented using the encoding scheme for the file causes
22142 Constraint_Error to be raised. An invalid wide character sequence on
22143 input also causes Constraint_Error to be raised.
22144
22145 @menu
22146 * Stream Pointer Positioning: Stream Pointer Positioning<2>.
22147 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<2>.
22148
22149 @end menu
22150
22151 @node Stream Pointer Positioning<2>,Reading and Writing Non-Regular Files<2>,,Wide_Text_IO
22152 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-1}@anchor{2b4}@anchor{gnat_rm/the_implementation_of_standard_i_o id14}@anchor{2b5}
22153 @subsection Stream Pointer Positioning
22154
22155
22156 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22157 of stream pointer positioning (@ref{2a5,,Text_IO}). There is one additional
22158 case:
22159
22160 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
22161 normal lower ASCII set (i.e., a character in the range:
22162
22163 @example
22164 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
22165 @end example
22166
22167 then although the logical position of the file pointer is unchanged by
22168 the @code{Look_Ahead} call, the stream is physically positioned past the
22169 wide character sequence. Again this is to avoid the need for buffering
22170 or backup, and all @code{Wide_Text_IO} routines check the internal
22171 indication that this situation has occurred so that this is not visible
22172 to a normal program using @code{Wide_Text_IO}. However, this discrepancy
22173 can be observed if the wide text file shares a stream with another file.
22174
22175 @node Reading and Writing Non-Regular Files<2>,,Stream Pointer Positioning<2>,Wide_Text_IO
22176 @anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-1}@anchor{2b6}@anchor{gnat_rm/the_implementation_of_standard_i_o id15}@anchor{2b7}
22177 @subsection Reading and Writing Non-Regular Files
22178
22179
22180 As in the case of Text_IO, when a non-regular file is read, it is
22181 assumed that the file contains no page marks (any form characters are
22182 treated as data characters), and @code{End_Of_Page} always returns
22183 @code{False}. Similarly, the end of file indication is not sticky, so
22184 it is possible to read beyond an end of file.
22185
22186 @node Wide_Wide_Text_IO,Stream_IO,Wide_Text_IO,The Implementation of Standard I/O
22187 @anchor{gnat_rm/the_implementation_of_standard_i_o id16}@anchor{2b8}@anchor{gnat_rm/the_implementation_of_standard_i_o wide-wide-text-io}@anchor{2b9}
22188 @section Wide_Wide_Text_IO
22189
22190
22191 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
22192 both input and output files may contain special sequences that represent
22193 wide wide character values. The encoding scheme for a given file may be
22194 specified using a FORM parameter:
22195
22196 @example
22197 WCEM=`x`
22198 @end example
22199
22200 as part of the FORM string (WCEM = wide character encoding method),
22201 where @code{x} is one of the following characters
22202
22203
22204 @multitable {xxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxx}
22205 @headitem
22206
22207 Character
22208
22209 @tab
22210
22211 Encoding
22212
22213 @item
22214
22215 @emph{h}
22216
22217 @tab
22218
22219 Hex ESC encoding
22220
22221 @item
22222
22223 @emph{u}
22224
22225 @tab
22226
22227 Upper half encoding
22228
22229 @item
22230
22231 @emph{s}
22232
22233 @tab
22234
22235 Shift-JIS encoding
22236
22237 @item
22238
22239 @emph{e}
22240
22241 @tab
22242
22243 EUC Encoding
22244
22245 @item
22246
22247 @emph{8}
22248
22249 @tab
22250
22251 UTF-8 encoding
22252
22253 @item
22254
22255 @emph{b}
22256
22257 @tab
22258
22259 Brackets encoding
22260
22261 @end multitable
22262
22263
22264 The encoding methods match those that
22265 can be used in a source
22266 program, but there is no requirement that the encoding method used for
22267 the source program be the same as the encoding method used for files,
22268 and different files may use different encoding methods.
22269
22270 The default encoding method for the standard files, and for opened files
22271 for which no WCEM parameter is given in the FORM string matches the
22272 wide character encoding specified for the main program (the default
22273 being brackets encoding if no coding method was specified with -gnatW).
22274
22275
22276 @table @asis
22277
22278 @item @emph{UTF-8 Coding}
22279
22280 A wide character is represented using
22281 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
22282 10646-1/Am.2. Depending on the character value, the representation
22283 is a one, two, three, or four byte sequence:
22284 @end table
22285
22286 @example
22287 16#000000#-16#00007f#: 2#0xxxxxxx#
22288 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
22289 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
22290 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
22291 @end example
22292
22293
22294 @quotation
22295
22296 where the @code{xxx} bits correspond to the left-padded bits of the
22297 21-bit character value. Note that all lower half ASCII characters
22298 are represented as ASCII bytes and all upper half characters and
22299 other wide characters are represented as sequences of upper-half
22300 characters.
22301 @end quotation
22302
22303
22304 @table @asis
22305
22306 @item @emph{Brackets Coding}
22307
22308 In this encoding, a wide wide character is represented by the following eight
22309 character sequence if is in wide character range
22310 @end table
22311
22312 @example
22313 [ " a b c d " ]
22314 @end example
22315
22316
22317 @quotation
22318
22319 and by the following ten character sequence if not
22320 @end quotation
22321
22322 @example
22323 [ " a b c d e f " ]
22324 @end example
22325
22326
22327 @quotation
22328
22329 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
22330 are the four or six hexadecimal
22331 characters (using uppercase letters) of the wide wide character code. For
22332 example, @code{["01A345"]} is used to represent the wide wide character
22333 with code @code{16#01A345#}.
22334
22335 This scheme is compatible with use of the full Wide_Wide_Character set.
22336 On input, brackets coding can also be used for upper half characters,
22337 e.g., @code{["C1"]} for lower case a. However, on output, brackets notation
22338 is only used for wide characters with a code greater than @code{16#FF#}.
22339 @end quotation
22340
22341 If is also possible to use the other Wide_Character encoding methods,
22342 such as Shift-JIS, but the other schemes cannot support the full range
22343 of wide wide characters.
22344 An attempt to output a character that cannot
22345 be represented using the encoding scheme for the file causes
22346 Constraint_Error to be raised. An invalid wide character sequence on
22347 input also causes Constraint_Error to be raised.
22348
22349 @menu
22350 * Stream Pointer Positioning: Stream Pointer Positioning<3>.
22351 * Reading and Writing Non-Regular Files: Reading and Writing Non-Regular Files<3>.
22352
22353 @end menu
22354
22355 @node Stream Pointer Positioning<3>,Reading and Writing Non-Regular Files<3>,,Wide_Wide_Text_IO
22356 @anchor{gnat_rm/the_implementation_of_standard_i_o stream-pointer-positioning-2}@anchor{2ba}@anchor{gnat_rm/the_implementation_of_standard_i_o id17}@anchor{2bb}
22357 @subsection Stream Pointer Positioning
22358
22359
22360 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
22361 of stream pointer positioning (@ref{2a5,,Text_IO}). There is one additional
22362 case:
22363
22364 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
22365 normal lower ASCII set (i.e., a character in the range:
22366
22367 @example
22368 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
22369 @end example
22370
22371 then although the logical position of the file pointer is unchanged by
22372 the @code{Look_Ahead} call, the stream is physically positioned past the
22373 wide character sequence. Again this is to avoid the need for buffering
22374 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
22375 indication that this situation has occurred so that this is not visible
22376 to a normal program using @code{Wide_Wide_Text_IO}. However, this discrepancy
22377 can be observed if the wide text file shares a stream with another file.
22378
22379 @node Reading and Writing Non-Regular Files<3>,,Stream Pointer Positioning<3>,Wide_Wide_Text_IO
22380 @anchor{gnat_rm/the_implementation_of_standard_i_o id18}@anchor{2bc}@anchor{gnat_rm/the_implementation_of_standard_i_o reading-and-writing-non-regular-files-2}@anchor{2bd}
22381 @subsection Reading and Writing Non-Regular Files
22382
22383
22384 As in the case of Text_IO, when a non-regular file is read, it is
22385 assumed that the file contains no page marks (any form characters are
22386 treated as data characters), and @code{End_Of_Page} always returns
22387 @code{False}. Similarly, the end of file indication is not sticky, so
22388 it is possible to read beyond an end of file.
22389
22390 @node Stream_IO,Text Translation,Wide_Wide_Text_IO,The Implementation of Standard I/O
22391 @anchor{gnat_rm/the_implementation_of_standard_i_o id19}@anchor{2be}@anchor{gnat_rm/the_implementation_of_standard_i_o stream-io}@anchor{2bf}
22392 @section Stream_IO
22393
22394
22395 A stream file is a sequence of bytes, where individual elements are
22396 written to the file as described in the Ada Reference Manual. The type
22397 @code{Stream_Element} is simply a byte. There are two ways to read or
22398 write a stream file.
22399
22400
22401 @itemize *
22402
22403 @item
22404 The operations @code{Read} and @code{Write} directly read or write a
22405 sequence of stream elements with no control information.
22406
22407 @item
22408 The stream attributes applied to a stream file transfer data in the
22409 manner described for stream attributes.
22410 @end itemize
22411
22412 @node Text Translation,Shared Files,Stream_IO,The Implementation of Standard I/O
22413 @anchor{gnat_rm/the_implementation_of_standard_i_o id20}@anchor{2c0}@anchor{gnat_rm/the_implementation_of_standard_i_o text-translation}@anchor{2c1}
22414 @section Text Translation
22415
22416
22417 @code{Text_Translation=xxx} may be used as the Form parameter
22418 passed to Text_IO.Create and Text_IO.Open. @code{Text_Translation=xxx}
22419 has no effect on Unix systems. Possible values are:
22420
22421
22422 @itemize *
22423
22424 @item
22425 @code{Yes} or @code{Text} is the default, which means to
22426 translate LF to/from CR/LF on Windows systems.
22427
22428 @code{No} disables this translation; i.e. it
22429 uses binary mode. For output files, @code{Text_Translation=No}
22430 may be used to create Unix-style files on
22431 Windows.
22432
22433 @item
22434 @code{wtext} translation enabled in Unicode mode.
22435 (corresponds to _O_WTEXT).
22436
22437 @item
22438 @code{u8text} translation enabled in Unicode UTF-8 mode.
22439 (corresponds to O_U8TEXT).
22440
22441 @item
22442 @code{u16text} translation enabled in Unicode UTF-16
22443 mode. (corresponds to_O_U16TEXT).
22444 @end itemize
22445
22446 @node Shared Files,Filenames encoding,Text Translation,The Implementation of Standard I/O
22447 @anchor{gnat_rm/the_implementation_of_standard_i_o id21}@anchor{2c2}@anchor{gnat_rm/the_implementation_of_standard_i_o shared-files}@anchor{2c3}
22448 @section Shared Files
22449
22450
22451 Section A.14 of the Ada Reference Manual allows implementations to
22452 provide a wide variety of behavior if an attempt is made to access the
22453 same external file with two or more internal files.
22454
22455 To provide a full range of functionality, while at the same time
22456 minimizing the problems of portability caused by this implementation
22457 dependence, GNAT handles file sharing as follows:
22458
22459
22460 @itemize *
22461
22462 @item
22463 In the absence of a @code{shared=xxx} form parameter, an attempt
22464 to open two or more files with the same full name is considered an error
22465 and is not supported. The exception @code{Use_Error} will be
22466 raised. Note that a file that is not explicitly closed by the program
22467 remains open until the program terminates.
22468
22469 @item
22470 If the form parameter @code{shared=no} appears in the form string, the
22471 file can be opened or created with its own separate stream identifier,
22472 regardless of whether other files sharing the same external file are
22473 opened. The exact effect depends on how the C stream routines handle
22474 multiple accesses to the same external files using separate streams.
22475
22476 @item
22477 If the form parameter @code{shared=yes} appears in the form string for
22478 each of two or more files opened using the same full name, the same
22479 stream is shared between these files, and the semantics are as described
22480 in Ada Reference Manual, Section A.14.
22481 @end itemize
22482
22483 When a program that opens multiple files with the same name is ported
22484 from another Ada compiler to GNAT, the effect will be that
22485 @code{Use_Error} is raised.
22486
22487 The documentation of the original compiler and the documentation of the
22488 program should then be examined to determine if file sharing was
22489 expected, and @code{shared=xxx} parameters added to @code{Open}
22490 and @code{Create} calls as required.
22491
22492 When a program is ported from GNAT to some other Ada compiler, no
22493 special attention is required unless the @code{shared=xxx} form
22494 parameter is used in the program. In this case, you must examine the
22495 documentation of the new compiler to see if it supports the required
22496 file sharing semantics, and form strings modified appropriately. Of
22497 course it may be the case that the program cannot be ported if the
22498 target compiler does not support the required functionality. The best
22499 approach in writing portable code is to avoid file sharing (and hence
22500 the use of the @code{shared=xxx} parameter in the form string)
22501 completely.
22502
22503 One common use of file sharing in Ada 83 is the use of instantiations of
22504 Sequential_IO on the same file with different types, to achieve
22505 heterogeneous input-output. Although this approach will work in GNAT if
22506 @code{shared=yes} is specified, it is preferable in Ada to use Stream_IO
22507 for this purpose (using the stream attributes)
22508
22509 @node Filenames encoding,File content encoding,Shared Files,The Implementation of Standard I/O
22510 @anchor{gnat_rm/the_implementation_of_standard_i_o filenames-encoding}@anchor{2c4}@anchor{gnat_rm/the_implementation_of_standard_i_o id22}@anchor{2c5}
22511 @section Filenames encoding
22512
22513
22514 An encoding form parameter can be used to specify the filename
22515 encoding @code{encoding=xxx}.
22516
22517
22518 @itemize *
22519
22520 @item
22521 If the form parameter @code{encoding=utf8} appears in the form string, the
22522 filename must be encoded in UTF-8.
22523
22524 @item
22525 If the form parameter @code{encoding=8bits} appears in the form
22526 string, the filename must be a standard 8bits string.
22527 @end itemize
22528
22529 In the absence of a @code{encoding=xxx} form parameter, the
22530 encoding is controlled by the @code{GNAT_CODE_PAGE} environment
22531 variable. And if not set @code{utf8} is assumed.
22532
22533
22534 @table @asis
22535
22536 @item @emph{CP_ACP}
22537
22538 The current system Windows ANSI code page.
22539
22540 @item @emph{CP_UTF8}
22541
22542 UTF-8 encoding
22543 @end table
22544
22545 This encoding form parameter is only supported on the Windows
22546 platform. On the other Operating Systems the run-time is supporting
22547 UTF-8 natively.
22548
22549 @node File content encoding,Open Modes,Filenames encoding,The Implementation of Standard I/O
22550 @anchor{gnat_rm/the_implementation_of_standard_i_o file-content-encoding}@anchor{2c6}@anchor{gnat_rm/the_implementation_of_standard_i_o id23}@anchor{2c7}
22551 @section File content encoding
22552
22553
22554 For text files it is possible to specify the encoding to use. This is
22555 controlled by the by the @code{GNAT_CCS_ENCODING} environment
22556 variable. And if not set @code{TEXT} is assumed.
22557
22558 The possible values are those supported on Windows:
22559
22560
22561 @table @asis
22562
22563 @item @emph{TEXT}
22564
22565 Translated text mode
22566
22567 @item @emph{WTEXT}
22568
22569 Translated unicode encoding
22570
22571 @item @emph{U16TEXT}
22572
22573 Unicode 16-bit encoding
22574
22575 @item @emph{U8TEXT}
22576
22577 Unicode 8-bit encoding
22578 @end table
22579
22580 This encoding is only supported on the Windows platform.
22581
22582 @node Open Modes,Operations on C Streams,File content encoding,The Implementation of Standard I/O
22583 @anchor{gnat_rm/the_implementation_of_standard_i_o open-modes}@anchor{2c8}@anchor{gnat_rm/the_implementation_of_standard_i_o id24}@anchor{2c9}
22584 @section Open Modes
22585
22586
22587 @code{Open} and @code{Create} calls result in a call to @code{fopen}
22588 using the mode shown in the following table:
22589
22590
22591 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxx}
22592 @headitem
22593
22594 @code{Open} and @code{Create} Call Modes
22595
22596 @tab
22597
22598 @tab
22599
22600 @item
22601
22602 @tab
22603
22604 @strong{OPEN}
22605
22606 @tab
22607
22608 @strong{CREATE}
22609
22610 @item
22611
22612 Append_File
22613
22614 @tab
22615
22616 "r+"
22617
22618 @tab
22619
22620 "w+"
22621
22622 @item
22623
22624 In_File
22625
22626 @tab
22627
22628 "r"
22629
22630 @tab
22631
22632 "w+"
22633
22634 @item
22635
22636 Out_File (Direct_IO)
22637
22638 @tab
22639
22640 "r+"
22641
22642 @tab
22643
22644 "w"
22645
22646 @item
22647
22648 Out_File (all other cases)
22649
22650 @tab
22651
22652 "w"
22653
22654 @tab
22655
22656 "w"
22657
22658 @item
22659
22660 Inout_File
22661
22662 @tab
22663
22664 "r+"
22665
22666 @tab
22667
22668 "w+"
22669
22670 @end multitable
22671
22672
22673 If text file translation is required, then either @code{b} or @code{t}
22674 is added to the mode, depending on the setting of Text. Text file
22675 translation refers to the mapping of CR/LF sequences in an external file
22676 to LF characters internally. This mapping only occurs in DOS and
22677 DOS-like systems, and is not relevant to other systems.
22678
22679 A special case occurs with Stream_IO. As shown in the above table, the
22680 file is initially opened in @code{r} or @code{w} mode for the
22681 @code{In_File} and @code{Out_File} cases. If a @code{Set_Mode} operation
22682 subsequently requires switching from reading to writing or vice-versa,
22683 then the file is reopened in @code{r+} mode to permit the required operation.
22684
22685 @node Operations on C Streams,Interfacing to C Streams,Open Modes,The Implementation of Standard I/O
22686 @anchor{gnat_rm/the_implementation_of_standard_i_o operations-on-c-streams}@anchor{2ca}@anchor{gnat_rm/the_implementation_of_standard_i_o id25}@anchor{2cb}
22687 @section Operations on C Streams
22688
22689
22690 The package @code{Interfaces.C_Streams} provides an Ada program with direct
22691 access to the C library functions for operations on C streams:
22692
22693 @example
22694 package Interfaces.C_Streams is
22695 -- Note: the reason we do not use the types that are in
22696 -- Interfaces.C is that we want to avoid dragging in the
22697 -- code in this unit if possible.
22698 subtype chars is System.Address;
22699 -- Pointer to null-terminated array of characters
22700 subtype FILEs is System.Address;
22701 -- Corresponds to the C type FILE*
22702 subtype voids is System.Address;
22703 -- Corresponds to the C type void*
22704 subtype int is Integer;
22705 subtype long is Long_Integer;
22706 -- Note: the above types are subtypes deliberately, and it
22707 -- is part of this spec that the above correspondences are
22708 -- guaranteed. This means that it is legitimate to, for
22709 -- example, use Integer instead of int. We provide these
22710 -- synonyms for clarity, but in some cases it may be
22711 -- convenient to use the underlying types (for example to
22712 -- avoid an unnecessary dependency of a spec on the spec
22713 -- of this unit).
22714 type size_t is mod 2 ** Standard'Address_Size;
22715 NULL_Stream : constant FILEs;
22716 -- Value returned (NULL in C) to indicate an
22717 -- fdopen/fopen/tmpfile error
22718 ----------------------------------
22719 -- Constants Defined in stdio.h --
22720 ----------------------------------
22721 EOF : constant int;
22722 -- Used by a number of routines to indicate error or
22723 -- end of file
22724 IOFBF : constant int;
22725 IOLBF : constant int;
22726 IONBF : constant int;
22727 -- Used to indicate buffering mode for setvbuf call
22728 SEEK_CUR : constant int;
22729 SEEK_END : constant int;
22730 SEEK_SET : constant int;
22731 -- Used to indicate origin for fseek call
22732 function stdin return FILEs;
22733 function stdout return FILEs;
22734 function stderr return FILEs;
22735 -- Streams associated with standard files
22736 --------------------------
22737 -- Standard C functions --
22738 --------------------------
22739 -- The functions selected below are ones that are
22740 -- available in UNIX (but not necessarily in ANSI C).
22741 -- These are very thin interfaces
22742 -- which copy exactly the C headers. For more
22743 -- documentation on these functions, see the Microsoft C
22744 -- "Run-Time Library Reference" (Microsoft Press, 1990,
22745 -- ISBN 1-55615-225-6), which includes useful information
22746 -- on system compatibility.
22747 procedure clearerr (stream : FILEs);
22748 function fclose (stream : FILEs) return int;
22749 function fdopen (handle : int; mode : chars) return FILEs;
22750 function feof (stream : FILEs) return int;
22751 function ferror (stream : FILEs) return int;
22752 function fflush (stream : FILEs) return int;
22753 function fgetc (stream : FILEs) return int;
22754 function fgets (strng : chars; n : int; stream : FILEs)
22755 return chars;
22756 function fileno (stream : FILEs) return int;
22757 function fopen (filename : chars; Mode : chars)
22758 return FILEs;
22759 -- Note: to maintain target independence, use
22760 -- text_translation_required, a boolean variable defined in
22761 -- a-sysdep.c to deal with the target dependent text
22762 -- translation requirement. If this variable is set,
22763 -- then b/t should be appended to the standard mode
22764 -- argument to set the text translation mode off or on
22765 -- as required.
22766 function fputc (C : int; stream : FILEs) return int;
22767 function fputs (Strng : chars; Stream : FILEs) return int;
22768 function fread
22769 (buffer : voids;
22770 size : size_t;
22771 count : size_t;
22772 stream : FILEs)
22773 return size_t;
22774 function freopen
22775 (filename : chars;
22776 mode : chars;
22777 stream : FILEs)
22778 return FILEs;
22779 function fseek
22780 (stream : FILEs;
22781 offset : long;
22782 origin : int)
22783 return int;
22784 function ftell (stream : FILEs) return long;
22785 function fwrite
22786 (buffer : voids;
22787 size : size_t;
22788 count : size_t;
22789 stream : FILEs)
22790 return size_t;
22791 function isatty (handle : int) return int;
22792 procedure mktemp (template : chars);
22793 -- The return value (which is just a pointer to template)
22794 -- is discarded
22795 procedure rewind (stream : FILEs);
22796 function rmtmp return int;
22797 function setvbuf
22798 (stream : FILEs;
22799 buffer : chars;
22800 mode : int;
22801 size : size_t)
22802 return int;
22803
22804 function tmpfile return FILEs;
22805 function ungetc (c : int; stream : FILEs) return int;
22806 function unlink (filename : chars) return int;
22807 ---------------------
22808 -- Extra functions --
22809 ---------------------
22810 -- These functions supply slightly thicker bindings than
22811 -- those above. They are derived from functions in the
22812 -- C Run-Time Library, but may do a bit more work than
22813 -- just directly calling one of the Library functions.
22814 function is_regular_file (handle : int) return int;
22815 -- Tests if given handle is for a regular file (result 1)
22816 -- or for a non-regular file (pipe or device, result 0).
22817 ---------------------------------
22818 -- Control of Text/Binary Mode --
22819 ---------------------------------
22820 -- If text_translation_required is true, then the following
22821 -- functions may be used to dynamically switch a file from
22822 -- binary to text mode or vice versa. These functions have
22823 -- no effect if text_translation_required is false (i.e., in
22824 -- normal UNIX mode). Use fileno to get a stream handle.
22825 procedure set_binary_mode (handle : int);
22826 procedure set_text_mode (handle : int);
22827 ----------------------------
22828 -- Full Path Name support --
22829 ----------------------------
22830 procedure full_name (nam : chars; buffer : chars);
22831 -- Given a NUL terminated string representing a file
22832 -- name, returns in buffer a NUL terminated string
22833 -- representing the full path name for the file name.
22834 -- On systems where it is relevant the drive is also
22835 -- part of the full path name. It is the responsibility
22836 -- of the caller to pass an actual parameter for buffer
22837 -- that is big enough for any full path name. Use
22838 -- max_path_len given below as the size of buffer.
22839 max_path_len : integer;
22840 -- Maximum length of an allowable full path name on the
22841 -- system, including a terminating NUL character.
22842 end Interfaces.C_Streams;
22843 @end example
22844
22845 @node Interfacing to C Streams,,Operations on C Streams,The Implementation of Standard I/O
22846 @anchor{gnat_rm/the_implementation_of_standard_i_o interfacing-to-c-streams}@anchor{2cc}@anchor{gnat_rm/the_implementation_of_standard_i_o id26}@anchor{2cd}
22847 @section Interfacing to C Streams
22848
22849
22850 The packages in this section permit interfacing Ada files to C Stream
22851 operations.
22852
22853 @example
22854 with Interfaces.C_Streams;
22855 package Ada.Sequential_IO.C_Streams is
22856 function C_Stream (F : File_Type)
22857 return Interfaces.C_Streams.FILEs;
22858 procedure Open
22859 (File : in out File_Type;
22860 Mode : in File_Mode;
22861 C_Stream : in Interfaces.C_Streams.FILEs;
22862 Form : in String := "");
22863 end Ada.Sequential_IO.C_Streams;
22864
22865 with Interfaces.C_Streams;
22866 package Ada.Direct_IO.C_Streams is
22867 function C_Stream (F : File_Type)
22868 return Interfaces.C_Streams.FILEs;
22869 procedure Open
22870 (File : in out File_Type;
22871 Mode : in File_Mode;
22872 C_Stream : in Interfaces.C_Streams.FILEs;
22873 Form : in String := "");
22874 end Ada.Direct_IO.C_Streams;
22875
22876 with Interfaces.C_Streams;
22877 package Ada.Text_IO.C_Streams is
22878 function C_Stream (F : File_Type)
22879 return Interfaces.C_Streams.FILEs;
22880 procedure Open
22881 (File : in out File_Type;
22882 Mode : in File_Mode;
22883 C_Stream : in Interfaces.C_Streams.FILEs;
22884 Form : in String := "");
22885 end Ada.Text_IO.C_Streams;
22886
22887 with Interfaces.C_Streams;
22888 package Ada.Wide_Text_IO.C_Streams is
22889 function C_Stream (F : File_Type)
22890 return Interfaces.C_Streams.FILEs;
22891 procedure Open
22892 (File : in out File_Type;
22893 Mode : in File_Mode;
22894 C_Stream : in Interfaces.C_Streams.FILEs;
22895 Form : in String := "");
22896 end Ada.Wide_Text_IO.C_Streams;
22897
22898 with Interfaces.C_Streams;
22899 package Ada.Wide_Wide_Text_IO.C_Streams is
22900 function C_Stream (F : File_Type)
22901 return Interfaces.C_Streams.FILEs;
22902 procedure Open
22903 (File : in out File_Type;
22904 Mode : in File_Mode;
22905 C_Stream : in Interfaces.C_Streams.FILEs;
22906 Form : in String := "");
22907 end Ada.Wide_Wide_Text_IO.C_Streams;
22908
22909 with Interfaces.C_Streams;
22910 package Ada.Stream_IO.C_Streams is
22911 function C_Stream (F : File_Type)
22912 return Interfaces.C_Streams.FILEs;
22913 procedure Open
22914 (File : in out File_Type;
22915 Mode : in File_Mode;
22916 C_Stream : in Interfaces.C_Streams.FILEs;
22917 Form : in String := "");
22918 end Ada.Stream_IO.C_Streams;
22919 @end example
22920
22921 In each of these six packages, the @code{C_Stream} function obtains the
22922 @code{FILE} pointer from a currently opened Ada file. It is then
22923 possible to use the @code{Interfaces.C_Streams} package to operate on
22924 this stream, or the stream can be passed to a C program which can
22925 operate on it directly. Of course the program is responsible for
22926 ensuring that only appropriate sequences of operations are executed.
22927
22928 One particular use of relevance to an Ada program is that the
22929 @code{setvbuf} function can be used to control the buffering of the
22930 stream used by an Ada file. In the absence of such a call the standard
22931 default buffering is used.
22932
22933 The @code{Open} procedures in these packages open a file giving an
22934 existing C Stream instead of a file name. Typically this stream is
22935 imported from a C program, allowing an Ada file to operate on an
22936 existing C file.
22937
22938 @node The GNAT Library,Interfacing to Other Languages,The Implementation of Standard I/O,Top
22939 @anchor{gnat_rm/the_gnat_library the-gnat-library}@anchor{10}@anchor{gnat_rm/the_gnat_library doc}@anchor{2ce}@anchor{gnat_rm/the_gnat_library id1}@anchor{2cf}
22940 @chapter The GNAT Library
22941
22942
22943 The GNAT library contains a number of general and special purpose packages.
22944 It represents functionality that the GNAT developers have found useful, and
22945 which is made available to GNAT users. The packages described here are fully
22946 supported, and upwards compatibility will be maintained in future releases,
22947 so you can use these facilities with the confidence that the same functionality
22948 will be available in future releases.
22949
22950 The chapter here simply gives a brief summary of the facilities available.
22951 The full documentation is found in the spec file for the package. The full
22952 sources of these library packages, including both spec and body, are provided
22953 with all GNAT releases. For example, to find out the full specifications of
22954 the SPITBOL pattern matching capability, including a full tutorial and
22955 extensive examples, look in the @code{g-spipat.ads} file in the library.
22956
22957 For each entry here, the package name (as it would appear in a @code{with}
22958 clause) is given, followed by the name of the corresponding spec file in
22959 parentheses. The packages are children in four hierarchies, @code{Ada},
22960 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
22961 GNAT-specific hierarchy.
22962
22963 Note that an application program should only use packages in one of these
22964 four hierarchies if the package is defined in the Ada Reference Manual,
22965 or is listed in this section of the GNAT Programmers Reference Manual.
22966 All other units should be considered internal implementation units and
22967 should not be directly @code{with}ed by application code. The use of
22968 a @code{with} clause that references one of these internal implementation
22969 units makes an application potentially dependent on changes in versions
22970 of GNAT, and will generate a warning message.
22971
22972 @menu
22973 * Ada.Characters.Latin_9 (a-chlat9.ads): Ada Characters Latin_9 a-chlat9 ads.
22974 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads): Ada Characters Wide_Latin_1 a-cwila1 ads.
22975 * Ada.Characters.Wide_Latin_9 (a-cwila1.ads): Ada Characters Wide_Latin_9 a-cwila1 ads.
22976 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads): Ada Characters Wide_Wide_Latin_1 a-chzla1 ads.
22977 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads): Ada Characters Wide_Wide_Latin_9 a-chzla9 ads.
22978 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads): Ada Containers Formal_Doubly_Linked_Lists a-cfdlli ads.
22979 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads): Ada Containers Formal_Hashed_Maps a-cfhama ads.
22980 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads): Ada Containers Formal_Hashed_Sets a-cfhase ads.
22981 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads): Ada Containers Formal_Ordered_Maps a-cforma ads.
22982 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads): Ada Containers Formal_Ordered_Sets a-cforse ads.
22983 * Ada.Containers.Formal_Vectors (a-cofove.ads): Ada Containers Formal_Vectors a-cofove ads.
22984 * Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads): Ada Containers Formal_Indefinite_Vectors a-cfinve ads.
22985 * Ada.Containers.Functional_Vectors (a-cofuve.ads): Ada Containers Functional_Vectors a-cofuve ads.
22986 * Ada.Containers.Functional_Sets (a-cofuse.ads): Ada Containers Functional_Sets a-cofuse ads.
22987 * Ada.Containers.Functional_Maps (a-cofuma.ads): Ada Containers Functional_Maps a-cofuma ads.
22988 * Ada.Containers.Bounded_Holders (a-coboho.ads): Ada Containers Bounded_Holders a-coboho ads.
22989 * Ada.Command_Line.Environment (a-colien.ads): Ada Command_Line Environment a-colien ads.
22990 * Ada.Command_Line.Remove (a-colire.ads): Ada Command_Line Remove a-colire ads.
22991 * Ada.Command_Line.Response_File (a-clrefi.ads): Ada Command_Line Response_File a-clrefi ads.
22992 * Ada.Direct_IO.C_Streams (a-diocst.ads): Ada Direct_IO C_Streams a-diocst ads.
22993 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads): Ada Exceptions Is_Null_Occurrence a-einuoc ads.
22994 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads): Ada Exceptions Last_Chance_Handler a-elchha ads.
22995 * Ada.Exceptions.Traceback (a-exctra.ads): Ada Exceptions Traceback a-exctra ads.
22996 * Ada.Sequential_IO.C_Streams (a-siocst.ads): Ada Sequential_IO C_Streams a-siocst ads.
22997 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads): Ada Streams Stream_IO C_Streams a-ssicst ads.
22998 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
22999 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
23000 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
23001 * Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
23002 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
23003 * Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
23004 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads): Ada Wide_Text_IO C_Streams a-wtcstr ads.
23005 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads): Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads.
23006 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads): Ada Wide_Wide_Characters Unicode a-zchuni ads.
23007 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads): Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads.
23008 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads): Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads.
23009 * GNAT.Altivec (g-altive.ads): GNAT Altivec g-altive ads.
23010 * GNAT.Altivec.Conversions (g-altcon.ads): GNAT Altivec Conversions g-altcon ads.
23011 * GNAT.Altivec.Vector_Operations (g-alveop.ads): GNAT Altivec Vector_Operations g-alveop ads.
23012 * GNAT.Altivec.Vector_Types (g-alvety.ads): GNAT Altivec Vector_Types g-alvety ads.
23013 * GNAT.Altivec.Vector_Views (g-alvevi.ads): GNAT Altivec Vector_Views g-alvevi ads.
23014 * GNAT.Array_Split (g-arrspl.ads): GNAT Array_Split g-arrspl ads.
23015 * GNAT.AWK (g-awk.ads): GNAT AWK g-awk ads.
23016 * GNAT.Bind_Environment (g-binenv.ads): GNAT Bind_Environment g-binenv ads.
23017 * GNAT.Branch_Prediction (g-brapre.ads): GNAT Branch_Prediction g-brapre ads.
23018 * GNAT.Bounded_Buffers (g-boubuf.ads): GNAT Bounded_Buffers g-boubuf ads.
23019 * GNAT.Bounded_Mailboxes (g-boumai.ads): GNAT Bounded_Mailboxes g-boumai ads.
23020 * GNAT.Bubble_Sort (g-bubsor.ads): GNAT Bubble_Sort g-bubsor ads.
23021 * GNAT.Bubble_Sort_A (g-busora.ads): GNAT Bubble_Sort_A g-busora ads.
23022 * GNAT.Bubble_Sort_G (g-busorg.ads): GNAT Bubble_Sort_G g-busorg ads.
23023 * GNAT.Byte_Order_Mark (g-byorma.ads): GNAT Byte_Order_Mark g-byorma ads.
23024 * GNAT.Byte_Swapping (g-bytswa.ads): GNAT Byte_Swapping g-bytswa ads.
23025 * GNAT.Calendar (g-calend.ads): GNAT Calendar g-calend ads.
23026 * GNAT.Calendar.Time_IO (g-catiio.ads): GNAT Calendar Time_IO g-catiio ads.
23027 * GNAT.CRC32 (g-crc32.ads): GNAT CRC32 g-crc32 ads.
23028 * GNAT.Case_Util (g-casuti.ads): GNAT Case_Util g-casuti ads.
23029 * GNAT.CGI (g-cgi.ads): GNAT CGI g-cgi ads.
23030 * GNAT.CGI.Cookie (g-cgicoo.ads): GNAT CGI Cookie g-cgicoo ads.
23031 * GNAT.CGI.Debug (g-cgideb.ads): GNAT CGI Debug g-cgideb ads.
23032 * GNAT.Command_Line (g-comlin.ads): GNAT Command_Line g-comlin ads.
23033 * GNAT.Compiler_Version (g-comver.ads): GNAT Compiler_Version g-comver ads.
23034 * GNAT.Ctrl_C (g-ctrl_c.ads): GNAT Ctrl_C g-ctrl_c ads.
23035 * GNAT.Current_Exception (g-curexc.ads): GNAT Current_Exception g-curexc ads.
23036 * GNAT.Debug_Pools (g-debpoo.ads): GNAT Debug_Pools g-debpoo ads.
23037 * GNAT.Debug_Utilities (g-debuti.ads): GNAT Debug_Utilities g-debuti ads.
23038 * GNAT.Decode_String (g-decstr.ads): GNAT Decode_String g-decstr ads.
23039 * GNAT.Decode_UTF8_String (g-deutst.ads): GNAT Decode_UTF8_String g-deutst ads.
23040 * GNAT.Directory_Operations (g-dirope.ads): GNAT Directory_Operations g-dirope ads.
23041 * GNAT.Directory_Operations.Iteration (g-diopit.ads): GNAT Directory_Operations Iteration g-diopit ads.
23042 * GNAT.Dynamic_HTables (g-dynhta.ads): GNAT Dynamic_HTables g-dynhta ads.
23043 * GNAT.Dynamic_Tables (g-dyntab.ads): GNAT Dynamic_Tables g-dyntab ads.
23044 * GNAT.Encode_String (g-encstr.ads): GNAT Encode_String g-encstr ads.
23045 * GNAT.Encode_UTF8_String (g-enutst.ads): GNAT Encode_UTF8_String g-enutst ads.
23046 * GNAT.Exception_Actions (g-excact.ads): GNAT Exception_Actions g-excact ads.
23047 * GNAT.Exception_Traces (g-exctra.ads): GNAT Exception_Traces g-exctra ads.
23048 * GNAT.Exceptions (g-except.ads): GNAT Exceptions g-except ads.
23049 * GNAT.Expect (g-expect.ads): GNAT Expect g-expect ads.
23050 * GNAT.Expect.TTY (g-exptty.ads): GNAT Expect TTY g-exptty ads.
23051 * GNAT.Float_Control (g-flocon.ads): GNAT Float_Control g-flocon ads.
23052 * GNAT.Formatted_String (g-forstr.ads): GNAT Formatted_String g-forstr ads.
23053 * GNAT.Heap_Sort (g-heasor.ads): GNAT Heap_Sort g-heasor ads.
23054 * GNAT.Heap_Sort_A (g-hesora.ads): GNAT Heap_Sort_A g-hesora ads.
23055 * GNAT.Heap_Sort_G (g-hesorg.ads): GNAT Heap_Sort_G g-hesorg ads.
23056 * GNAT.HTable (g-htable.ads): GNAT HTable g-htable ads.
23057 * GNAT.IO (g-io.ads): GNAT IO g-io ads.
23058 * GNAT.IO_Aux (g-io_aux.ads): GNAT IO_Aux g-io_aux ads.
23059 * GNAT.Lock_Files (g-locfil.ads): GNAT Lock_Files g-locfil ads.
23060 * GNAT.MBBS_Discrete_Random (g-mbdira.ads): GNAT MBBS_Discrete_Random g-mbdira ads.
23061 * GNAT.MBBS_Float_Random (g-mbflra.ads): GNAT MBBS_Float_Random g-mbflra ads.
23062 * GNAT.MD5 (g-md5.ads): GNAT MD5 g-md5 ads.
23063 * GNAT.Memory_Dump (g-memdum.ads): GNAT Memory_Dump g-memdum ads.
23064 * GNAT.Most_Recent_Exception (g-moreex.ads): GNAT Most_Recent_Exception g-moreex ads.
23065 * GNAT.OS_Lib (g-os_lib.ads): GNAT OS_Lib g-os_lib ads.
23066 * GNAT.Perfect_Hash_Generators (g-pehage.ads): GNAT Perfect_Hash_Generators g-pehage ads.
23067 * GNAT.Random_Numbers (g-rannum.ads): GNAT Random_Numbers g-rannum ads.
23068 * GNAT.Regexp (g-regexp.ads): GNAT Regexp g-regexp ads.
23069 * GNAT.Registry (g-regist.ads): GNAT Registry g-regist ads.
23070 * GNAT.Regpat (g-regpat.ads): GNAT Regpat g-regpat ads.
23071 * GNAT.Rewrite_Data (g-rewdat.ads): GNAT Rewrite_Data g-rewdat ads.
23072 * GNAT.Secondary_Stack_Info (g-sestin.ads): GNAT Secondary_Stack_Info g-sestin ads.
23073 * GNAT.Semaphores (g-semaph.ads): GNAT Semaphores g-semaph ads.
23074 * GNAT.Serial_Communications (g-sercom.ads): GNAT Serial_Communications g-sercom ads.
23075 * GNAT.SHA1 (g-sha1.ads): GNAT SHA1 g-sha1 ads.
23076 * GNAT.SHA224 (g-sha224.ads): GNAT SHA224 g-sha224 ads.
23077 * GNAT.SHA256 (g-sha256.ads): GNAT SHA256 g-sha256 ads.
23078 * GNAT.SHA384 (g-sha384.ads): GNAT SHA384 g-sha384 ads.
23079 * GNAT.SHA512 (g-sha512.ads): GNAT SHA512 g-sha512 ads.
23080 * GNAT.Signals (g-signal.ads): GNAT Signals g-signal ads.
23081 * GNAT.Sockets (g-socket.ads): GNAT Sockets g-socket ads.
23082 * GNAT.Source_Info (g-souinf.ads): GNAT Source_Info g-souinf ads.
23083 * GNAT.Spelling_Checker (g-speche.ads): GNAT Spelling_Checker g-speche ads.
23084 * GNAT.Spelling_Checker_Generic (g-spchge.ads): GNAT Spelling_Checker_Generic g-spchge ads.
23085 * GNAT.Spitbol.Patterns (g-spipat.ads): GNAT Spitbol Patterns g-spipat ads.
23086 * GNAT.Spitbol (g-spitbo.ads): GNAT Spitbol g-spitbo ads.
23087 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads): GNAT Spitbol Table_Boolean g-sptabo ads.
23088 * GNAT.Spitbol.Table_Integer (g-sptain.ads): GNAT Spitbol Table_Integer g-sptain ads.
23089 * GNAT.Spitbol.Table_VString (g-sptavs.ads): GNAT Spitbol Table_VString g-sptavs ads.
23090 * GNAT.SSE (g-sse.ads): GNAT SSE g-sse ads.
23091 * GNAT.SSE.Vector_Types (g-ssvety.ads): GNAT SSE Vector_Types g-ssvety ads.
23092 * GNAT.String_Hash (g-strhas.ads): GNAT String_Hash g-strhas ads.
23093 * GNAT.Strings (g-string.ads): GNAT Strings g-string ads.
23094 * GNAT.String_Split (g-strspl.ads): GNAT String_Split g-strspl ads.
23095 * GNAT.Table (g-table.ads): GNAT Table g-table ads.
23096 * GNAT.Task_Lock (g-tasloc.ads): GNAT Task_Lock g-tasloc ads.
23097 * GNAT.Time_Stamp (g-timsta.ads): GNAT Time_Stamp g-timsta ads.
23098 * GNAT.Threads (g-thread.ads): GNAT Threads g-thread ads.
23099 * GNAT.Traceback (g-traceb.ads): GNAT Traceback g-traceb ads.
23100 * GNAT.Traceback.Symbolic (g-trasym.ads): GNAT Traceback Symbolic g-trasym ads.
23101 * GNAT.UTF_32 (g-table.ads): GNAT UTF_32 g-table ads.
23102 * GNAT.Wide_Spelling_Checker (g-u3spch.ads): GNAT Wide_Spelling_Checker g-u3spch ads.
23103 * GNAT.Wide_Spelling_Checker (g-wispch.ads): GNAT Wide_Spelling_Checker g-wispch ads.
23104 * GNAT.Wide_String_Split (g-wistsp.ads): GNAT Wide_String_Split g-wistsp ads.
23105 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads): GNAT Wide_Wide_Spelling_Checker g-zspche ads.
23106 * GNAT.Wide_Wide_String_Split (g-zistsp.ads): GNAT Wide_Wide_String_Split g-zistsp ads.
23107 * Interfaces.C.Extensions (i-cexten.ads): Interfaces C Extensions i-cexten ads.
23108 * Interfaces.C.Streams (i-cstrea.ads): Interfaces C Streams i-cstrea ads.
23109 * Interfaces.Packed_Decimal (i-pacdec.ads): Interfaces Packed_Decimal i-pacdec ads.
23110 * Interfaces.VxWorks (i-vxwork.ads): Interfaces VxWorks i-vxwork ads.
23111 * Interfaces.VxWorks.Int_Connection (i-vxinco.ads): Interfaces VxWorks Int_Connection i-vxinco ads.
23112 * Interfaces.VxWorks.IO (i-vxwoio.ads): Interfaces VxWorks IO i-vxwoio ads.
23113 * System.Address_Image (s-addima.ads): System Address_Image s-addima ads.
23114 * System.Assertions (s-assert.ads): System Assertions s-assert ads.
23115 * System.Atomic_Counters (s-atocou.ads): System Atomic_Counters s-atocou ads.
23116 * System.Memory (s-memory.ads): System Memory s-memory ads.
23117 * System.Multiprocessors (s-multip.ads): System Multiprocessors s-multip ads.
23118 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads): System Multiprocessors Dispatching_Domains s-mudido ads.
23119 * System.Partition_Interface (s-parint.ads): System Partition_Interface s-parint ads.
23120 * System.Pool_Global (s-pooglo.ads): System Pool_Global s-pooglo ads.
23121 * System.Pool_Local (s-pooloc.ads): System Pool_Local s-pooloc ads.
23122 * System.Restrictions (s-restri.ads): System Restrictions s-restri ads.
23123 * System.Rident (s-rident.ads): System Rident s-rident ads.
23124 * System.Strings.Stream_Ops (s-ststop.ads): System Strings Stream_Ops s-ststop ads.
23125 * System.Unsigned_Types (s-unstyp.ads): System Unsigned_Types s-unstyp ads.
23126 * System.Wch_Cnv (s-wchcnv.ads): System Wch_Cnv s-wchcnv ads.
23127 * System.Wch_Con (s-wchcon.ads): System Wch_Con s-wchcon ads.
23128
23129 @end menu
23130
23131 @node Ada Characters Latin_9 a-chlat9 ads,Ada Characters Wide_Latin_1 a-cwila1 ads,,The GNAT Library
23132 @anchor{gnat_rm/the_gnat_library id2}@anchor{2d0}@anchor{gnat_rm/the_gnat_library ada-characters-latin-9-a-chlat9-ads}@anchor{2d1}
23133 @section @code{Ada.Characters.Latin_9} (@code{a-chlat9.ads})
23134
23135
23136 @geindex Ada.Characters.Latin_9 (a-chlat9.ads)
23137
23138 @geindex Latin_9 constants for Character
23139
23140 This child of @code{Ada.Characters}
23141 provides a set of definitions corresponding to those in the
23142 RM-defined package @code{Ada.Characters.Latin_1} but with the
23143 few modifications required for @code{Latin-9}
23144 The provision of such a package
23145 is specifically authorized by the Ada Reference Manual
23146 (RM A.3.3(27)).
23147
23148 @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
23149 @anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-1-a-cwila1-ads}@anchor{2d2}@anchor{gnat_rm/the_gnat_library id3}@anchor{2d3}
23150 @section @code{Ada.Characters.Wide_Latin_1} (@code{a-cwila1.ads})
23151
23152
23153 @geindex Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
23154
23155 @geindex Latin_1 constants for Wide_Character
23156
23157 This child of @code{Ada.Characters}
23158 provides a set of definitions corresponding to those in the
23159 RM-defined package @code{Ada.Characters.Latin_1} but with the
23160 types of the constants being @code{Wide_Character}
23161 instead of @code{Character}. The provision of such a package
23162 is specifically authorized by the Ada Reference Manual
23163 (RM A.3.3(27)).
23164
23165 @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
23166 @anchor{gnat_rm/the_gnat_library id4}@anchor{2d4}@anchor{gnat_rm/the_gnat_library ada-characters-wide-latin-9-a-cwila1-ads}@anchor{2d5}
23167 @section @code{Ada.Characters.Wide_Latin_9} (@code{a-cwila1.ads})
23168
23169
23170 @geindex Ada.Characters.Wide_Latin_9 (a-cwila1.ads)
23171
23172 @geindex Latin_9 constants for Wide_Character
23173
23174 This child of @code{Ada.Characters}
23175 provides a set of definitions corresponding to those in the
23176 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23177 types of the constants being @code{Wide_Character}
23178 instead of @code{Character}. The provision of such a package
23179 is specifically authorized by the Ada Reference Manual
23180 (RM A.3.3(27)).
23181
23182 @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
23183 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-1-a-chzla1-ads}@anchor{2d6}@anchor{gnat_rm/the_gnat_library id5}@anchor{2d7}
23184 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@code{a-chzla1.ads})
23185
23186
23187 @geindex Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
23188
23189 @geindex Latin_1 constants for Wide_Wide_Character
23190
23191 This child of @code{Ada.Characters}
23192 provides a set of definitions corresponding to those in the
23193 RM-defined package @code{Ada.Characters.Latin_1} but with the
23194 types of the constants being @code{Wide_Wide_Character}
23195 instead of @code{Character}. The provision of such a package
23196 is specifically authorized by the Ada Reference Manual
23197 (RM A.3.3(27)).
23198
23199 @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
23200 @anchor{gnat_rm/the_gnat_library ada-characters-wide-wide-latin-9-a-chzla9-ads}@anchor{2d8}@anchor{gnat_rm/the_gnat_library id6}@anchor{2d9}
23201 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@code{a-chzla9.ads})
23202
23203
23204 @geindex Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
23205
23206 @geindex Latin_9 constants for Wide_Wide_Character
23207
23208 This child of @code{Ada.Characters}
23209 provides a set of definitions corresponding to those in the
23210 GNAT defined package @code{Ada.Characters.Latin_9} but with the
23211 types of the constants being @code{Wide_Wide_Character}
23212 instead of @code{Character}. The provision of such a package
23213 is specifically authorized by the Ada Reference Manual
23214 (RM A.3.3(27)).
23215
23216 @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
23217 @anchor{gnat_rm/the_gnat_library id7}@anchor{2da}@anchor{gnat_rm/the_gnat_library ada-containers-formal-doubly-linked-lists-a-cfdlli-ads}@anchor{2db}
23218 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@code{a-cfdlli.ads})
23219
23220
23221 @geindex Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
23222
23223 @geindex Formal container for doubly linked lists
23224
23225 This child of @code{Ada.Containers} defines a modified version of the
23226 Ada 2005 container for doubly linked lists, meant to facilitate formal
23227 verification of code using such containers. The specification of this
23228 unit is compatible with SPARK 2014.
23229
23230 Note that although this container was designed with formal verification
23231 in mind, it may well be generally useful in that it is a simplified more
23232 efficient version than the one defined in the standard. In particular it
23233 does not have the complex overhead required to detect cursor tampering.
23234
23235 @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
23236 @anchor{gnat_rm/the_gnat_library id8}@anchor{2dc}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-maps-a-cfhama-ads}@anchor{2dd}
23237 @section @code{Ada.Containers.Formal_Hashed_Maps} (@code{a-cfhama.ads})
23238
23239
23240 @geindex Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
23241
23242 @geindex Formal container for hashed maps
23243
23244 This child of @code{Ada.Containers} defines a modified version of the
23245 Ada 2005 container for hashed maps, meant to facilitate formal
23246 verification of code using such containers. The specification of this
23247 unit is compatible with SPARK 2014.
23248
23249 Note that although this container was designed with formal verification
23250 in mind, it may well be generally useful in that it is a simplified more
23251 efficient version than the one defined in the standard. In particular it
23252 does not have the complex overhead required to detect cursor tampering.
23253
23254 @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
23255 @anchor{gnat_rm/the_gnat_library id9}@anchor{2de}@anchor{gnat_rm/the_gnat_library ada-containers-formal-hashed-sets-a-cfhase-ads}@anchor{2df}
23256 @section @code{Ada.Containers.Formal_Hashed_Sets} (@code{a-cfhase.ads})
23257
23258
23259 @geindex Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
23260
23261 @geindex Formal container for hashed sets
23262
23263 This child of @code{Ada.Containers} defines a modified version of the
23264 Ada 2005 container for hashed sets, meant to facilitate formal
23265 verification of code using such containers. The specification of this
23266 unit is compatible with SPARK 2014.
23267
23268 Note that although this container was designed with formal verification
23269 in mind, it may well be generally useful in that it is a simplified more
23270 efficient version than the one defined in the standard. In particular it
23271 does not have the complex overhead required to detect cursor tampering.
23272
23273 @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
23274 @anchor{gnat_rm/the_gnat_library id10}@anchor{2e0}@anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-maps-a-cforma-ads}@anchor{2e1}
23275 @section @code{Ada.Containers.Formal_Ordered_Maps} (@code{a-cforma.ads})
23276
23277
23278 @geindex Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
23279
23280 @geindex Formal container for ordered maps
23281
23282 This child of @code{Ada.Containers} defines a modified version of the
23283 Ada 2005 container for ordered maps, meant to facilitate formal
23284 verification of code using such containers. The specification of this
23285 unit is compatible with SPARK 2014.
23286
23287 Note that although this container was designed with formal verification
23288 in mind, it may well be generally useful in that it is a simplified more
23289 efficient version than the one defined in the standard. In particular it
23290 does not have the complex overhead required to detect cursor tampering.
23291
23292 @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
23293 @anchor{gnat_rm/the_gnat_library ada-containers-formal-ordered-sets-a-cforse-ads}@anchor{2e2}@anchor{gnat_rm/the_gnat_library id11}@anchor{2e3}
23294 @section @code{Ada.Containers.Formal_Ordered_Sets} (@code{a-cforse.ads})
23295
23296
23297 @geindex Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
23298
23299 @geindex Formal container for ordered sets
23300
23301 This child of @code{Ada.Containers} defines a modified version of the
23302 Ada 2005 container for ordered sets, meant to facilitate formal
23303 verification of code using such containers. The specification of this
23304 unit is compatible with SPARK 2014.
23305
23306 Note that although this container was designed with formal verification
23307 in mind, it may well be generally useful in that it is a simplified more
23308 efficient version than the one defined in the standard. In particular it
23309 does not have the complex overhead required to detect cursor tampering.
23310
23311 @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
23312 @anchor{gnat_rm/the_gnat_library id12}@anchor{2e4}@anchor{gnat_rm/the_gnat_library ada-containers-formal-vectors-a-cofove-ads}@anchor{2e5}
23313 @section @code{Ada.Containers.Formal_Vectors} (@code{a-cofove.ads})
23314
23315
23316 @geindex Ada.Containers.Formal_Vectors (a-cofove.ads)
23317
23318 @geindex Formal container for vectors
23319
23320 This child of @code{Ada.Containers} defines a modified version of the
23321 Ada 2005 container for vectors, meant to facilitate formal
23322 verification of code using such containers. The specification of this
23323 unit is compatible with SPARK 2014.
23324
23325 Note that although this container was designed with formal verification
23326 in mind, it may well be generally useful in that it is a simplified more
23327 efficient version than the one defined in the standard. In particular it
23328 does not have the complex overhead required to detect cursor tampering.
23329
23330 @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
23331 @anchor{gnat_rm/the_gnat_library id13}@anchor{2e6}@anchor{gnat_rm/the_gnat_library ada-containers-formal-indefinite-vectors-a-cfinve-ads}@anchor{2e7}
23332 @section @code{Ada.Containers.Formal_Indefinite_Vectors} (@code{a-cfinve.ads})
23333
23334
23335 @geindex Ada.Containers.Formal_Indefinite_Vectors (a-cfinve.ads)
23336
23337 @geindex Formal container for vectors
23338
23339 This child of @code{Ada.Containers} defines a modified version of the
23340 Ada 2005 container for vectors of indefinite elements, meant to
23341 facilitate formal verification of code using such containers. The
23342 specification of this unit is compatible with SPARK 2014.
23343
23344 Note that although this container was designed with formal verification
23345 in mind, it may well be generally useful in that it is a simplified more
23346 efficient version than the one defined in the standard. In particular it
23347 does not have the complex overhead required to detect cursor tampering.
23348
23349 @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
23350 @anchor{gnat_rm/the_gnat_library id14}@anchor{2e8}@anchor{gnat_rm/the_gnat_library ada-containers-functional-vectors-a-cofuve-ads}@anchor{2e9}
23351 @section @code{Ada.Containers.Functional_Vectors} (@code{a-cofuve.ads})
23352
23353
23354 @geindex Ada.Containers.Functional_Vectors (a-cofuve.ads)
23355
23356 @geindex Functional vectors
23357
23358 This child of @code{Ada.Containers} defines immutable vectors. These
23359 containers are unbounded and may contain indefinite elements. Furthermore, to
23360 be usable in every context, they are neither controlled nor limited. As they
23361 are functional, that is, no primitives are provided which would allow modifying
23362 an existing container, these containers can still be used safely.
23363
23364 Their API features functions creating new containers from existing ones.
23365 As a consequence, these containers are highly inefficient. They are also
23366 memory consuming, as the allocated memory is not reclaimed when the container
23367 is no longer referenced. Thus, they should in general be used in ghost code
23368 and annotations, so that they can be removed from the final executable. The
23369 specification of this unit is compatible with SPARK 2014.
23370
23371 @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
23372 @anchor{gnat_rm/the_gnat_library ada-containers-functional-sets-a-cofuse-ads}@anchor{2ea}@anchor{gnat_rm/the_gnat_library id15}@anchor{2eb}
23373 @section @code{Ada.Containers.Functional_Sets} (@code{a-cofuse.ads})
23374
23375
23376 @geindex Ada.Containers.Functional_Sets (a-cofuse.ads)
23377
23378 @geindex Functional sets
23379
23380 This child of @code{Ada.Containers} defines immutable sets. These containers are
23381 unbounded and may contain indefinite elements. Furthermore, to be usable in
23382 every context, they are neither controlled nor limited. As they are functional,
23383 that is, no primitives are provided which would allow modifying an existing
23384 container, these containers can still be used safely.
23385
23386 Their API features functions creating new containers from existing ones.
23387 As a consequence, these containers are highly inefficient. They are also
23388 memory consuming, as the allocated memory is not reclaimed when the container
23389 is no longer referenced. Thus, they should in general be used in ghost code
23390 and annotations, so that they can be removed from the final executable. The
23391 specification of this unit is compatible with SPARK 2014.
23392
23393 @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
23394 @anchor{gnat_rm/the_gnat_library id16}@anchor{2ec}@anchor{gnat_rm/the_gnat_library ada-containers-functional-maps-a-cofuma-ads}@anchor{2ed}
23395 @section @code{Ada.Containers.Functional_Maps} (@code{a-cofuma.ads})
23396
23397
23398 @geindex Ada.Containers.Functional_Maps (a-cofuma.ads)
23399
23400 @geindex Functional maps
23401
23402 This child of @code{Ada.Containers} defines immutable maps. These containers are
23403 unbounded and may contain indefinite elements. Furthermore, to be usable in
23404 every context, they are neither controlled nor limited. As they are functional,
23405 that is, no primitives are provided which would allow modifying an existing
23406 container, these containers can still be used safely.
23407
23408 Their API features functions creating new containers from existing ones.
23409 As a consequence, these containers are highly inefficient. They are also
23410 memory consuming, as the allocated memory is not reclaimed when the container
23411 is no longer referenced. Thus, they should in general be used in ghost code
23412 and annotations, so that they can be removed from the final executable. The
23413 specification of this unit is compatible with SPARK 2014.
23414
23415 @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
23416 @anchor{gnat_rm/the_gnat_library ada-containers-bounded-holders-a-coboho-ads}@anchor{2ee}@anchor{gnat_rm/the_gnat_library id17}@anchor{2ef}
23417 @section @code{Ada.Containers.Bounded_Holders} (@code{a-coboho.ads})
23418
23419
23420 @geindex Ada.Containers.Bounded_Holders (a-coboho.ads)
23421
23422 @geindex Formal container for vectors
23423
23424 This child of @code{Ada.Containers} defines a modified version of
23425 Indefinite_Holders that avoids heap allocation.
23426
23427 @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
23428 @anchor{gnat_rm/the_gnat_library ada-command-line-environment-a-colien-ads}@anchor{2f0}@anchor{gnat_rm/the_gnat_library id18}@anchor{2f1}
23429 @section @code{Ada.Command_Line.Environment} (@code{a-colien.ads})
23430
23431
23432 @geindex Ada.Command_Line.Environment (a-colien.ads)
23433
23434 @geindex Environment entries
23435
23436 This child of @code{Ada.Command_Line}
23437 provides a mechanism for obtaining environment values on systems
23438 where this concept makes sense.
23439
23440 @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
23441 @anchor{gnat_rm/the_gnat_library id19}@anchor{2f2}@anchor{gnat_rm/the_gnat_library ada-command-line-remove-a-colire-ads}@anchor{2f3}
23442 @section @code{Ada.Command_Line.Remove} (@code{a-colire.ads})
23443
23444
23445 @geindex Ada.Command_Line.Remove (a-colire.ads)
23446
23447 @geindex Removing command line arguments
23448
23449 @geindex Command line
23450 @geindex argument removal
23451
23452 This child of @code{Ada.Command_Line}
23453 provides a mechanism for logically removing
23454 arguments from the argument list. Once removed, an argument is not visible
23455 to further calls on the subprograms in @code{Ada.Command_Line} will not
23456 see the removed argument.
23457
23458 @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
23459 @anchor{gnat_rm/the_gnat_library id20}@anchor{2f4}@anchor{gnat_rm/the_gnat_library ada-command-line-response-file-a-clrefi-ads}@anchor{2f5}
23460 @section @code{Ada.Command_Line.Response_File} (@code{a-clrefi.ads})
23461
23462
23463 @geindex Ada.Command_Line.Response_File (a-clrefi.ads)
23464
23465 @geindex Response file for command line
23466
23467 @geindex Command line
23468 @geindex response file
23469
23470 @geindex Command line
23471 @geindex handling long command lines
23472
23473 This child of @code{Ada.Command_Line} provides a mechanism facilities for
23474 getting command line arguments from a text file, called a "response file".
23475 Using a response file allow passing a set of arguments to an executable longer
23476 than the maximum allowed by the system on the command line.
23477
23478 @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
23479 @anchor{gnat_rm/the_gnat_library id21}@anchor{2f6}@anchor{gnat_rm/the_gnat_library ada-direct-io-c-streams-a-diocst-ads}@anchor{2f7}
23480 @section @code{Ada.Direct_IO.C_Streams} (@code{a-diocst.ads})
23481
23482
23483 @geindex Ada.Direct_IO.C_Streams (a-diocst.ads)
23484
23485 @geindex C Streams
23486 @geindex Interfacing with Direct_IO
23487
23488 This package provides subprograms that allow interfacing between
23489 C streams and @code{Direct_IO}. The stream identifier can be
23490 extracted from a file opened on the Ada side, and an Ada file
23491 can be constructed from a stream opened on the C side.
23492
23493 @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
23494 @anchor{gnat_rm/the_gnat_library id22}@anchor{2f8}@anchor{gnat_rm/the_gnat_library ada-exceptions-is-null-occurrence-a-einuoc-ads}@anchor{2f9}
23495 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@code{a-einuoc.ads})
23496
23497
23498 @geindex Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
23499
23500 @geindex Null_Occurrence
23501 @geindex testing for
23502
23503 This child subprogram provides a way of testing for the null
23504 exception occurrence (@code{Null_Occurrence}) without raising
23505 an exception.
23506
23507 @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
23508 @anchor{gnat_rm/the_gnat_library id23}@anchor{2fa}@anchor{gnat_rm/the_gnat_library ada-exceptions-last-chance-handler-a-elchha-ads}@anchor{2fb}
23509 @section @code{Ada.Exceptions.Last_Chance_Handler} (@code{a-elchha.ads})
23510
23511
23512 @geindex Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
23513
23514 @geindex Null_Occurrence
23515 @geindex testing for
23516
23517 This child subprogram is used for handling otherwise unhandled
23518 exceptions (hence the name last chance), and perform clean ups before
23519 terminating the program. Note that this subprogram never returns.
23520
23521 @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
23522 @anchor{gnat_rm/the_gnat_library ada-exceptions-traceback-a-exctra-ads}@anchor{2fc}@anchor{gnat_rm/the_gnat_library id24}@anchor{2fd}
23523 @section @code{Ada.Exceptions.Traceback} (@code{a-exctra.ads})
23524
23525
23526 @geindex Ada.Exceptions.Traceback (a-exctra.ads)
23527
23528 @geindex Traceback for Exception Occurrence
23529
23530 This child package provides the subprogram (@code{Tracebacks}) to
23531 give a traceback array of addresses based on an exception
23532 occurrence.
23533
23534 @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
23535 @anchor{gnat_rm/the_gnat_library ada-sequential-io-c-streams-a-siocst-ads}@anchor{2fe}@anchor{gnat_rm/the_gnat_library id25}@anchor{2ff}
23536 @section @code{Ada.Sequential_IO.C_Streams} (@code{a-siocst.ads})
23537
23538
23539 @geindex Ada.Sequential_IO.C_Streams (a-siocst.ads)
23540
23541 @geindex C Streams
23542 @geindex Interfacing with Sequential_IO
23543
23544 This package provides subprograms that allow interfacing between
23545 C streams and @code{Sequential_IO}. The stream identifier can be
23546 extracted from a file opened on the Ada side, and an Ada file
23547 can be constructed from a stream opened on the C side.
23548
23549 @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
23550 @anchor{gnat_rm/the_gnat_library id26}@anchor{300}@anchor{gnat_rm/the_gnat_library ada-streams-stream-io-c-streams-a-ssicst-ads}@anchor{301}
23551 @section @code{Ada.Streams.Stream_IO.C_Streams} (@code{a-ssicst.ads})
23552
23553
23554 @geindex Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
23555
23556 @geindex C Streams
23557 @geindex Interfacing with Stream_IO
23558
23559 This package provides subprograms that allow interfacing between
23560 C streams and @code{Stream_IO}. The stream identifier can be
23561 extracted from a file opened on the Ada side, and an Ada file
23562 can be constructed from a stream opened on the C side.
23563
23564 @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
23565 @anchor{gnat_rm/the_gnat_library ada-strings-unbounded-text-io-a-suteio-ads}@anchor{302}@anchor{gnat_rm/the_gnat_library id27}@anchor{303}
23566 @section @code{Ada.Strings.Unbounded.Text_IO} (@code{a-suteio.ads})
23567
23568
23569 @geindex Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
23570
23571 @geindex Unbounded_String
23572 @geindex IO support
23573
23574 @geindex Text_IO
23575 @geindex extensions for unbounded strings
23576
23577 This package provides subprograms for Text_IO for unbounded
23578 strings, avoiding the necessity for an intermediate operation
23579 with ordinary strings.
23580
23581 @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
23582 @anchor{gnat_rm/the_gnat_library id28}@anchor{304}@anchor{gnat_rm/the_gnat_library ada-strings-wide-unbounded-wide-text-io-a-swuwti-ads}@anchor{305}
23583 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@code{a-swuwti.ads})
23584
23585
23586 @geindex Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
23587
23588 @geindex Unbounded_Wide_String
23589 @geindex IO support
23590
23591 @geindex Text_IO
23592 @geindex extensions for unbounded wide strings
23593
23594 This package provides subprograms for Text_IO for unbounded
23595 wide strings, avoiding the necessity for an intermediate operation
23596 with ordinary wide strings.
23597
23598 @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
23599 @anchor{gnat_rm/the_gnat_library id29}@anchor{306}@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{307}
23600 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
23601
23602
23603 @geindex Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
23604
23605 @geindex Unbounded_Wide_Wide_String
23606 @geindex IO support
23607
23608 @geindex Text_IO
23609 @geindex extensions for unbounded wide wide strings
23610
23611 This package provides subprograms for Text_IO for unbounded
23612 wide wide strings, avoiding the necessity for an intermediate operation
23613 with ordinary wide wide strings.
23614
23615 @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
23616 @anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{308}@anchor{gnat_rm/the_gnat_library id30}@anchor{309}
23617 @section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
23618
23619
23620 @geindex Ada.Text_IO.C_Streams (a-tiocst.ads)
23621
23622 @geindex C Streams
23623 @geindex Interfacing with `@w{`}Text_IO`@w{`}
23624
23625 This package provides subprograms that allow interfacing between
23626 C streams and @code{Text_IO}. The stream identifier can be
23627 extracted from a file opened on the Ada side, and an Ada file
23628 can be constructed from a stream opened on the C side.
23629
23630 @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
23631 @anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{30a}@anchor{gnat_rm/the_gnat_library id31}@anchor{30b}
23632 @section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
23633
23634
23635 @geindex Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
23636
23637 @geindex Text_IO resetting standard files
23638
23639 This procedure is used to reset the status of the standard files used
23640 by Ada.Text_IO. This is useful in a situation (such as a restart in an
23641 embedded application) where the status of the files may change during
23642 execution (for example a standard input file may be redefined to be
23643 interactive).
23644
23645 @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
23646 @anchor{gnat_rm/the_gnat_library id32}@anchor{30c}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{30d}
23647 @section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
23648
23649
23650 @geindex Ada.Wide_Characters.Unicode (a-wichun.ads)
23651
23652 @geindex Unicode categorization
23653 @geindex Wide_Character
23654
23655 This package provides subprograms that allow categorization of
23656 Wide_Character values according to Unicode categories.
23657
23658 @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
23659 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{30e}@anchor{gnat_rm/the_gnat_library id33}@anchor{30f}
23660 @section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
23661
23662
23663 @geindex Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
23664
23665 @geindex C Streams
23666 @geindex Interfacing with `@w{`}Wide_Text_IO`@w{`}
23667
23668 This package provides subprograms that allow interfacing between
23669 C streams and @code{Wide_Text_IO}. The stream identifier can be
23670 extracted from a file opened on the Ada side, and an Ada file
23671 can be constructed from a stream opened on the C side.
23672
23673 @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
23674 @anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{310}@anchor{gnat_rm/the_gnat_library id34}@anchor{311}
23675 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
23676
23677
23678 @geindex Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
23679
23680 @geindex Wide_Text_IO resetting standard files
23681
23682 This procedure is used to reset the status of the standard files used
23683 by Ada.Wide_Text_IO. This is useful in a situation (such as a restart in an
23684 embedded application) where the status of the files may change during
23685 execution (for example a standard input file may be redefined to be
23686 interactive).
23687
23688 @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
23689 @anchor{gnat_rm/the_gnat_library id35}@anchor{312}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{313}
23690 @section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
23691
23692
23693 @geindex Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
23694
23695 @geindex Unicode categorization
23696 @geindex Wide_Wide_Character
23697
23698 This package provides subprograms that allow categorization of
23699 Wide_Wide_Character values according to Unicode categories.
23700
23701 @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
23702 @anchor{gnat_rm/the_gnat_library id36}@anchor{314}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{315}
23703 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
23704
23705
23706 @geindex Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
23707
23708 @geindex C Streams
23709 @geindex Interfacing with `@w{`}Wide_Wide_Text_IO`@w{`}
23710
23711 This package provides subprograms that allow interfacing between
23712 C streams and @code{Wide_Wide_Text_IO}. The stream identifier can be
23713 extracted from a file opened on the Ada side, and an Ada file
23714 can be constructed from a stream opened on the C side.
23715
23716 @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
23717 @anchor{gnat_rm/the_gnat_library id37}@anchor{316}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{317}
23718 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
23719
23720
23721 @geindex Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
23722
23723 @geindex Wide_Wide_Text_IO resetting standard files
23724
23725 This procedure is used to reset the status of the standard files used
23726 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
23727 restart in an embedded application) where the status of the files may
23728 change during execution (for example a standard input file may be
23729 redefined to be interactive).
23730
23731 @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
23732 @anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{318}@anchor{gnat_rm/the_gnat_library id38}@anchor{319}
23733 @section @code{GNAT.Altivec} (@code{g-altive.ads})
23734
23735
23736 @geindex GNAT.Altivec (g-altive.ads)
23737
23738 @geindex AltiVec
23739
23740 This is the root package of the GNAT AltiVec binding. It provides
23741 definitions of constants and types common to all the versions of the
23742 binding.
23743
23744 @node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
23745 @anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{31a}@anchor{gnat_rm/the_gnat_library id39}@anchor{31b}
23746 @section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
23747
23748
23749 @geindex GNAT.Altivec.Conversions (g-altcon.ads)
23750
23751 @geindex AltiVec
23752
23753 This package provides the Vector/View conversion routines.
23754
23755 @node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
23756 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{31c}@anchor{gnat_rm/the_gnat_library id40}@anchor{31d}
23757 @section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
23758
23759
23760 @geindex GNAT.Altivec.Vector_Operations (g-alveop.ads)
23761
23762 @geindex AltiVec
23763
23764 This package exposes the Ada interface to the AltiVec operations on
23765 vector objects. A soft emulation is included by default in the GNAT
23766 library. The hard binding is provided as a separate package. This unit
23767 is common to both bindings.
23768
23769 @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
23770 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{31e}@anchor{gnat_rm/the_gnat_library id41}@anchor{31f}
23771 @section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
23772
23773
23774 @geindex GNAT.Altivec.Vector_Types (g-alvety.ads)
23775
23776 @geindex AltiVec
23777
23778 This package exposes the various vector types part of the Ada binding
23779 to AltiVec facilities.
23780
23781 @node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
23782 @anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{320}@anchor{gnat_rm/the_gnat_library id42}@anchor{321}
23783 @section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
23784
23785
23786 @geindex GNAT.Altivec.Vector_Views (g-alvevi.ads)
23787
23788 @geindex AltiVec
23789
23790 This package provides public 'View' data types from/to which private
23791 vector representations can be converted via
23792 GNAT.Altivec.Conversions. This allows convenient access to individual
23793 vector elements and provides a simple way to initialize vector
23794 objects.
23795
23796 @node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
23797 @anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{322}@anchor{gnat_rm/the_gnat_library id43}@anchor{323}
23798 @section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
23799
23800
23801 @geindex GNAT.Array_Split (g-arrspl.ads)
23802
23803 @geindex Array splitter
23804
23805 Useful array-manipulation routines: given a set of separators, split
23806 an array wherever the separators appear, and provide direct access
23807 to the resulting slices.
23808
23809 @node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
23810 @anchor{gnat_rm/the_gnat_library id44}@anchor{324}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{325}
23811 @section @code{GNAT.AWK} (@code{g-awk.ads})
23812
23813
23814 @geindex GNAT.AWK (g-awk.ads)
23815
23816 @geindex Parsing
23817
23818 @geindex AWK
23819
23820 Provides AWK-like parsing functions, with an easy interface for parsing one
23821 or more files containing formatted data. The file is viewed as a database
23822 where each record is a line and a field is a data element in this line.
23823
23824 @node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT AWK g-awk ads,The GNAT Library
23825 @anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{326}@anchor{gnat_rm/the_gnat_library id45}@anchor{327}
23826 @section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
23827
23828
23829 @geindex GNAT.Bind_Environment (g-binenv.ads)
23830
23831 @geindex Bind environment
23832
23833 Provides access to key=value associations captured at bind time.
23834 These associations can be specified using the @code{-V} binder command
23835 line switch.
23836
23837 @node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
23838 @anchor{gnat_rm/the_gnat_library id46}@anchor{328}@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{329}
23839 @section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
23840
23841
23842 @geindex GNAT.Branch_Prediction (g-brapre.ads)
23843
23844 @geindex Branch Prediction
23845
23846 Provides routines giving hints to the branch predictor of the code generator.
23847
23848 @node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
23849 @anchor{gnat_rm/the_gnat_library id47}@anchor{32a}@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{32b}
23850 @section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
23851
23852
23853 @geindex GNAT.Bounded_Buffers (g-boubuf.ads)
23854
23855 @geindex Parsing
23856
23857 @geindex Bounded Buffers
23858
23859 Provides a concurrent generic bounded buffer abstraction. Instances are
23860 useful directly or as parts of the implementations of other abstractions,
23861 such as mailboxes.
23862
23863 @node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
23864 @anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{32c}@anchor{gnat_rm/the_gnat_library id48}@anchor{32d}
23865 @section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
23866
23867
23868 @geindex GNAT.Bounded_Mailboxes (g-boumai.ads)
23869
23870 @geindex Parsing
23871
23872 @geindex Mailboxes
23873
23874 Provides a thread-safe asynchronous intertask mailbox communication facility.
23875
23876 @node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
23877 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{32e}@anchor{gnat_rm/the_gnat_library id49}@anchor{32f}
23878 @section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
23879
23880
23881 @geindex GNAT.Bubble_Sort (g-bubsor.ads)
23882
23883 @geindex Sorting
23884
23885 @geindex Bubble sort
23886
23887 Provides a general implementation of bubble sort usable for sorting arbitrary
23888 data items. Exchange and comparison procedures are provided by passing
23889 access-to-procedure values.
23890
23891 @node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
23892 @anchor{gnat_rm/the_gnat_library id50}@anchor{330}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{331}
23893 @section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
23894
23895
23896 @geindex GNAT.Bubble_Sort_A (g-busora.ads)
23897
23898 @geindex Sorting
23899
23900 @geindex Bubble sort
23901
23902 Provides a general implementation of bubble sort usable for sorting arbitrary
23903 data items. Move and comparison procedures are provided by passing
23904 access-to-procedure values. This is an older version, retained for
23905 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
23906
23907 @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
23908 @anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{332}@anchor{gnat_rm/the_gnat_library id51}@anchor{333}
23909 @section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
23910
23911
23912 @geindex GNAT.Bubble_Sort_G (g-busorg.ads)
23913
23914 @geindex Sorting
23915
23916 @geindex Bubble sort
23917
23918 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
23919 are provided as generic parameters, this improves efficiency, especially
23920 if the procedures can be inlined, at the expense of duplicating code for
23921 multiple instantiations.
23922
23923 @node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
23924 @anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{334}@anchor{gnat_rm/the_gnat_library id52}@anchor{335}
23925 @section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
23926
23927
23928 @geindex GNAT.Byte_Order_Mark (g-byorma.ads)
23929
23930 @geindex UTF-8 representation
23931
23932 @geindex Wide characte representations
23933
23934 Provides a routine which given a string, reads the start of the string to
23935 see whether it is one of the standard byte order marks (BOM's) which signal
23936 the encoding of the string. The routine includes detection of special XML
23937 sequences for various UCS input formats.
23938
23939 @node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
23940 @anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{336}@anchor{gnat_rm/the_gnat_library id53}@anchor{337}
23941 @section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
23942
23943
23944 @geindex GNAT.Byte_Swapping (g-bytswa.ads)
23945
23946 @geindex Byte swapping
23947
23948 @geindex Endianness
23949
23950 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
23951 Machine-specific implementations are available in some cases.
23952
23953 @node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
23954 @anchor{gnat_rm/the_gnat_library id54}@anchor{338}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{339}
23955 @section @code{GNAT.Calendar} (@code{g-calend.ads})
23956
23957
23958 @geindex GNAT.Calendar (g-calend.ads)
23959
23960 @geindex Calendar
23961
23962 Extends the facilities provided by @code{Ada.Calendar} to include handling
23963 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
23964 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
23965 C @code{timeval} format.
23966
23967 @node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
23968 @anchor{gnat_rm/the_gnat_library id55}@anchor{33a}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{33b}
23969 @section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
23970
23971
23972 @geindex Calendar
23973
23974 @geindex Time
23975
23976 @geindex GNAT.Calendar.Time_IO (g-catiio.ads)
23977
23978 @node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
23979 @anchor{gnat_rm/the_gnat_library id56}@anchor{33c}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{33d}
23980 @section @code{GNAT.CRC32} (@code{g-crc32.ads})
23981
23982
23983 @geindex GNAT.CRC32 (g-crc32.ads)
23984
23985 @geindex CRC32
23986
23987 @geindex Cyclic Redundancy Check
23988
23989 This package implements the CRC-32 algorithm. For a full description
23990 of this algorithm see
23991 @emph{Computation of Cyclic Redundancy Checks via Table Look-Up},
23992 @cite{Communications of the ACM}, Vol. 31 No. 8, pp. 1008-1013,
23993 Aug. 1988. Sarwate, D.V.
23994
23995 @node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
23996 @anchor{gnat_rm/the_gnat_library id57}@anchor{33e}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{33f}
23997 @section @code{GNAT.Case_Util} (@code{g-casuti.ads})
23998
23999
24000 @geindex GNAT.Case_Util (g-casuti.ads)
24001
24002 @geindex Casing utilities
24003
24004 @geindex Character handling (`@w{`}GNAT.Case_Util`@w{`})
24005
24006 A set of simple routines for handling upper and lower casing of strings
24007 without the overhead of the full casing tables
24008 in @code{Ada.Characters.Handling}.
24009
24010 @node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
24011 @anchor{gnat_rm/the_gnat_library id58}@anchor{340}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{341}
24012 @section @code{GNAT.CGI} (@code{g-cgi.ads})
24013
24014
24015 @geindex GNAT.CGI (g-cgi.ads)
24016
24017 @geindex CGI (Common Gateway Interface)
24018
24019 This is a package for interfacing a GNAT program with a Web server via the
24020 Common Gateway Interface (CGI). Basically this package parses the CGI
24021 parameters, which are a set of key/value pairs sent by the Web server. It
24022 builds a table whose index is the key and provides some services to deal
24023 with this table.
24024
24025 @node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
24026 @anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{342}@anchor{gnat_rm/the_gnat_library id59}@anchor{343}
24027 @section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
24028
24029
24030 @geindex GNAT.CGI.Cookie (g-cgicoo.ads)
24031
24032 @geindex CGI (Common Gateway Interface) cookie support
24033
24034 @geindex Cookie support in CGI
24035
24036 This is a package to interface a GNAT program with a Web server via the
24037 Common Gateway Interface (CGI). It exports services to deal with Web
24038 cookies (piece of information kept in the Web client software).
24039
24040 @node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
24041 @anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{344}@anchor{gnat_rm/the_gnat_library id60}@anchor{345}
24042 @section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
24043
24044
24045 @geindex GNAT.CGI.Debug (g-cgideb.ads)
24046
24047 @geindex CGI (Common Gateway Interface) debugging
24048
24049 This is a package to help debugging CGI (Common Gateway Interface)
24050 programs written in Ada.
24051
24052 @node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
24053 @anchor{gnat_rm/the_gnat_library id61}@anchor{346}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{347}
24054 @section @code{GNAT.Command_Line} (@code{g-comlin.ads})
24055
24056
24057 @geindex GNAT.Command_Line (g-comlin.ads)
24058
24059 @geindex Command line
24060
24061 Provides a high level interface to @code{Ada.Command_Line} facilities,
24062 including the ability to scan for named switches with optional parameters
24063 and expand file names using wildcard notations.
24064
24065 @node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
24066 @anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{348}@anchor{gnat_rm/the_gnat_library id62}@anchor{349}
24067 @section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
24068
24069
24070 @geindex GNAT.Compiler_Version (g-comver.ads)
24071
24072 @geindex Compiler Version
24073
24074 @geindex Version
24075 @geindex of compiler
24076
24077 Provides a routine for obtaining the version of the compiler used to
24078 compile the program. More accurately this is the version of the binder
24079 used to bind the program (this will normally be the same as the version
24080 of the compiler if a consistent tool set is used to compile all units
24081 of a partition).
24082
24083 @node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
24084 @anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{34a}@anchor{gnat_rm/the_gnat_library id63}@anchor{34b}
24085 @section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
24086
24087
24088 @geindex GNAT.Ctrl_C (g-ctrl_c.ads)
24089
24090 @geindex Interrupt
24091
24092 Provides a simple interface to handle Ctrl-C keyboard events.
24093
24094 @node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
24095 @anchor{gnat_rm/the_gnat_library id64}@anchor{34c}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{34d}
24096 @section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
24097
24098
24099 @geindex GNAT.Current_Exception (g-curexc.ads)
24100
24101 @geindex Current exception
24102
24103 @geindex Exception retrieval
24104
24105 Provides access to information on the current exception that has been raised
24106 without the need for using the Ada 95 / Ada 2005 exception choice parameter
24107 specification syntax.
24108 This is particularly useful in simulating typical facilities for
24109 obtaining information about exceptions provided by Ada 83 compilers.
24110
24111 @node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
24112 @anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{34e}@anchor{gnat_rm/the_gnat_library id65}@anchor{34f}
24113 @section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
24114
24115
24116 @geindex GNAT.Debug_Pools (g-debpoo.ads)
24117
24118 @geindex Debugging
24119
24120 @geindex Debug pools
24121
24122 @geindex Memory corruption debugging
24123
24124 Provide a debugging storage pools that helps tracking memory corruption
24125 problems.
24126 See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
24127
24128 @node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
24129 @anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{350}@anchor{gnat_rm/the_gnat_library id66}@anchor{351}
24130 @section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
24131
24132
24133 @geindex GNAT.Debug_Utilities (g-debuti.ads)
24134
24135 @geindex Debugging
24136
24137 Provides a few useful utilities for debugging purposes, including conversion
24138 to and from string images of address values. Supports both C and Ada formats
24139 for hexadecimal literals.
24140
24141 @node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
24142 @anchor{gnat_rm/the_gnat_library id67}@anchor{352}@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{353}
24143 @section @code{GNAT.Decode_String} (@code{g-decstr.ads})
24144
24145
24146 @geindex GNAT.Decode_String (g-decstr.ads)
24147
24148 @geindex Decoding strings
24149
24150 @geindex String decoding
24151
24152 @geindex Wide character encoding
24153
24154 @geindex UTF-8
24155
24156 @geindex Unicode
24157
24158 A generic package providing routines for decoding wide character and wide wide
24159 character strings encoded as sequences of 8-bit characters using a specified
24160 encoding method. Includes validation routines, and also routines for stepping
24161 to next or previous encoded character in an encoded string.
24162 Useful in conjunction with Unicode character coding. Note there is a
24163 preinstantiation for UTF-8. See next entry.
24164
24165 @node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
24166 @anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{354}@anchor{gnat_rm/the_gnat_library id68}@anchor{355}
24167 @section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
24168
24169
24170 @geindex GNAT.Decode_UTF8_String (g-deutst.ads)
24171
24172 @geindex Decoding strings
24173
24174 @geindex Decoding UTF-8 strings
24175
24176 @geindex UTF-8 string decoding
24177
24178 @geindex Wide character decoding
24179
24180 @geindex UTF-8
24181
24182 @geindex Unicode
24183
24184 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
24185
24186 @node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
24187 @anchor{gnat_rm/the_gnat_library id69}@anchor{356}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{357}
24188 @section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
24189
24190
24191 @geindex GNAT.Directory_Operations (g-dirope.ads)
24192
24193 @geindex Directory operations
24194
24195 Provides a set of routines for manipulating directories, including changing
24196 the current directory, making new directories, and scanning the files in a
24197 directory.
24198
24199 @node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
24200 @anchor{gnat_rm/the_gnat_library id70}@anchor{358}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{359}
24201 @section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
24202
24203
24204 @geindex GNAT.Directory_Operations.Iteration (g-diopit.ads)
24205
24206 @geindex Directory operations iteration
24207
24208 A child unit of GNAT.Directory_Operations providing additional operations
24209 for iterating through directories.
24210
24211 @node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
24212 @anchor{gnat_rm/the_gnat_library id71}@anchor{35a}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{35b}
24213 @section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
24214
24215
24216 @geindex GNAT.Dynamic_HTables (g-dynhta.ads)
24217
24218 @geindex Hash tables
24219
24220 A generic implementation of hash tables that can be used to hash arbitrary
24221 data. Provided in two forms, a simple form with built in hash functions,
24222 and a more complex form in which the hash function is supplied.
24223
24224 This package provides a facility similar to that of @code{GNAT.HTable},
24225 except that this package declares a type that can be used to define
24226 dynamic instances of the hash table, while an instantiation of
24227 @code{GNAT.HTable} creates a single instance of the hash table.
24228
24229 @node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
24230 @anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{35c}@anchor{gnat_rm/the_gnat_library id72}@anchor{35d}
24231 @section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
24232
24233
24234 @geindex GNAT.Dynamic_Tables (g-dyntab.ads)
24235
24236 @geindex Table implementation
24237
24238 @geindex Arrays
24239 @geindex extendable
24240
24241 A generic package providing a single dimension array abstraction where the
24242 length of the array can be dynamically modified.
24243
24244 This package provides a facility similar to that of @code{GNAT.Table},
24245 except that this package declares a type that can be used to define
24246 dynamic instances of the table, while an instantiation of
24247 @code{GNAT.Table} creates a single instance of the table type.
24248
24249 @node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
24250 @anchor{gnat_rm/the_gnat_library id73}@anchor{35e}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{35f}
24251 @section @code{GNAT.Encode_String} (@code{g-encstr.ads})
24252
24253
24254 @geindex GNAT.Encode_String (g-encstr.ads)
24255
24256 @geindex Encoding strings
24257
24258 @geindex String encoding
24259
24260 @geindex Wide character encoding
24261
24262 @geindex UTF-8
24263
24264 @geindex Unicode
24265
24266 A generic package providing routines for encoding wide character and wide
24267 wide character strings as sequences of 8-bit characters using a specified
24268 encoding method. Useful in conjunction with Unicode character coding.
24269 Note there is a preinstantiation for UTF-8. See next entry.
24270
24271 @node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
24272 @anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{360}@anchor{gnat_rm/the_gnat_library id74}@anchor{361}
24273 @section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
24274
24275
24276 @geindex GNAT.Encode_UTF8_String (g-enutst.ads)
24277
24278 @geindex Encoding strings
24279
24280 @geindex Encoding UTF-8 strings
24281
24282 @geindex UTF-8 string encoding
24283
24284 @geindex Wide character encoding
24285
24286 @geindex UTF-8
24287
24288 @geindex Unicode
24289
24290 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
24291
24292 @node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
24293 @anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{362}@anchor{gnat_rm/the_gnat_library id75}@anchor{363}
24294 @section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
24295
24296
24297 @geindex GNAT.Exception_Actions (g-excact.ads)
24298
24299 @geindex Exception actions
24300
24301 Provides callbacks when an exception is raised. Callbacks can be registered
24302 for specific exceptions, or when any exception is raised. This
24303 can be used for instance to force a core dump to ease debugging.
24304
24305 @node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
24306 @anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{364}@anchor{gnat_rm/the_gnat_library id76}@anchor{365}
24307 @section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
24308
24309
24310 @geindex GNAT.Exception_Traces (g-exctra.ads)
24311
24312 @geindex Exception traces
24313
24314 @geindex Debugging
24315
24316 Provides an interface allowing to control automatic output upon exception
24317 occurrences.
24318
24319 @node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
24320 @anchor{gnat_rm/the_gnat_library id77}@anchor{366}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{367}
24321 @section @code{GNAT.Exceptions} (@code{g-except.ads})
24322
24323
24324 @geindex GNAT.Exceptions (g-except.ads)
24325
24326 @geindex Exceptions
24327 @geindex Pure
24328
24329 @geindex Pure packages
24330 @geindex exceptions
24331
24332 Normally it is not possible to raise an exception with
24333 a message from a subprogram in a pure package, since the
24334 necessary types and subprograms are in @code{Ada.Exceptions}
24335 which is not a pure unit. @code{GNAT.Exceptions} provides a
24336 facility for getting around this limitation for a few
24337 predefined exceptions, and for example allow raising
24338 @code{Constraint_Error} with a message from a pure subprogram.
24339
24340 @node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
24341 @anchor{gnat_rm/the_gnat_library id78}@anchor{368}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{369}
24342 @section @code{GNAT.Expect} (@code{g-expect.ads})
24343
24344
24345 @geindex GNAT.Expect (g-expect.ads)
24346
24347 Provides a set of subprograms similar to what is available
24348 with the standard Tcl Expect tool.
24349 It allows you to easily spawn and communicate with an external process.
24350 You can send commands or inputs to the process, and compare the output
24351 with some expected regular expression. Currently @code{GNAT.Expect}
24352 is implemented on all native GNAT ports.
24353 It is not implemented for cross ports, and in particular is not
24354 implemented for VxWorks or LynxOS.
24355
24356 @node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
24357 @anchor{gnat_rm/the_gnat_library id79}@anchor{36a}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{36b}
24358 @section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
24359
24360
24361 @geindex GNAT.Expect.TTY (g-exptty.ads)
24362
24363 As GNAT.Expect but using pseudo-terminal.
24364 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
24365 ports. It is not implemented for cross ports, and
24366 in particular is not implemented for VxWorks or LynxOS.
24367
24368 @node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
24369 @anchor{gnat_rm/the_gnat_library id80}@anchor{36c}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{36d}
24370 @section @code{GNAT.Float_Control} (@code{g-flocon.ads})
24371
24372
24373 @geindex GNAT.Float_Control (g-flocon.ads)
24374
24375 @geindex Floating-Point Processor
24376
24377 Provides an interface for resetting the floating-point processor into the
24378 mode required for correct semantic operation in Ada. Some third party
24379 library calls may cause this mode to be modified, and the Reset procedure
24380 in this package can be used to reestablish the required mode.
24381
24382 @node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
24383 @anchor{gnat_rm/the_gnat_library id81}@anchor{36e}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{36f}
24384 @section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
24385
24386
24387 @geindex GNAT.Formatted_String (g-forstr.ads)
24388
24389 @geindex Formatted String
24390
24391 Provides support for C/C++ printf() formatted strings. The format is
24392 copied from the printf() routine and should therefore gives identical
24393 output. Some generic routines are provided to be able to use types
24394 derived from Integer, Float or enumerations as values for the
24395 formatted string.
24396
24397 @node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
24398 @anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{370}@anchor{gnat_rm/the_gnat_library id82}@anchor{371}
24399 @section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
24400
24401
24402 @geindex GNAT.Heap_Sort (g-heasor.ads)
24403
24404 @geindex Sorting
24405
24406 Provides a general implementation of heap sort usable for sorting arbitrary
24407 data items. Exchange and comparison procedures are provided by passing
24408 access-to-procedure values. The algorithm used is a modified heap sort
24409 that performs approximately N*log(N) comparisons in the worst case.
24410
24411 @node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
24412 @anchor{gnat_rm/the_gnat_library id83}@anchor{372}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{373}
24413 @section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
24414
24415
24416 @geindex GNAT.Heap_Sort_A (g-hesora.ads)
24417
24418 @geindex Sorting
24419
24420 Provides a general implementation of heap sort usable for sorting arbitrary
24421 data items. Move and comparison procedures are provided by passing
24422 access-to-procedure values. The algorithm used is a modified heap sort
24423 that performs approximately N*log(N) comparisons in the worst case.
24424 This differs from @code{GNAT.Heap_Sort} in having a less convenient
24425 interface, but may be slightly more efficient.
24426
24427 @node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
24428 @anchor{gnat_rm/the_gnat_library id84}@anchor{374}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{375}
24429 @section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
24430
24431
24432 @geindex GNAT.Heap_Sort_G (g-hesorg.ads)
24433
24434 @geindex Sorting
24435
24436 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
24437 are provided as generic parameters, this improves efficiency, especially
24438 if the procedures can be inlined, at the expense of duplicating code for
24439 multiple instantiations.
24440
24441 @node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
24442 @anchor{gnat_rm/the_gnat_library id85}@anchor{376}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{377}
24443 @section @code{GNAT.HTable} (@code{g-htable.ads})
24444
24445
24446 @geindex GNAT.HTable (g-htable.ads)
24447
24448 @geindex Hash tables
24449
24450 A generic implementation of hash tables that can be used to hash arbitrary
24451 data. Provides two approaches, one a simple static approach, and the other
24452 allowing arbitrary dynamic hash tables.
24453
24454 @node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
24455 @anchor{gnat_rm/the_gnat_library id86}@anchor{378}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{379}
24456 @section @code{GNAT.IO} (@code{g-io.ads})
24457
24458
24459 @geindex GNAT.IO (g-io.ads)
24460
24461 @geindex Simple I/O
24462
24463 @geindex Input/Output facilities
24464
24465 A simple preelaborable input-output package that provides a subset of
24466 simple Text_IO functions for reading characters and strings from
24467 Standard_Input, and writing characters, strings and integers to either
24468 Standard_Output or Standard_Error.
24469
24470 @node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
24471 @anchor{gnat_rm/the_gnat_library id87}@anchor{37a}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{37b}
24472 @section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
24473
24474
24475 @geindex GNAT.IO_Aux (g-io_aux.ads)
24476
24477 @geindex Text_IO
24478
24479 @geindex Input/Output facilities
24480
24481 Provides some auxiliary functions for use with Text_IO, including a test
24482 for whether a file exists, and functions for reading a line of text.
24483
24484 @node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
24485 @anchor{gnat_rm/the_gnat_library id88}@anchor{37c}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{37d}
24486 @section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
24487
24488
24489 @geindex GNAT.Lock_Files (g-locfil.ads)
24490
24491 @geindex File locking
24492
24493 @geindex Locking using files
24494
24495 Provides a general interface for using files as locks. Can be used for
24496 providing program level synchronization.
24497
24498 @node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
24499 @anchor{gnat_rm/the_gnat_library id89}@anchor{37e}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{37f}
24500 @section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
24501
24502
24503 @geindex GNAT.MBBS_Discrete_Random (g-mbdira.ads)
24504
24505 @geindex Random number generation
24506
24507 The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
24508 a modified version of the Blum-Blum-Shub generator.
24509
24510 @node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
24511 @anchor{gnat_rm/the_gnat_library id90}@anchor{380}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{381}
24512 @section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
24513
24514
24515 @geindex GNAT.MBBS_Float_Random (g-mbflra.ads)
24516
24517 @geindex Random number generation
24518
24519 The original implementation of @code{Ada.Numerics.Float_Random}. Uses
24520 a modified version of the Blum-Blum-Shub generator.
24521
24522 @node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
24523 @anchor{gnat_rm/the_gnat_library id91}@anchor{382}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{383}
24524 @section @code{GNAT.MD5} (@code{g-md5.ads})
24525
24526
24527 @geindex GNAT.MD5 (g-md5.ads)
24528
24529 @geindex Message Digest MD5
24530
24531 Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and
24532 the HMAC-MD5 message authentication function as described in RFC 2104 and
24533 FIPS PUB 198.
24534
24535 @node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
24536 @anchor{gnat_rm/the_gnat_library id92}@anchor{384}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{385}
24537 @section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
24538
24539
24540 @geindex GNAT.Memory_Dump (g-memdum.ads)
24541
24542 @geindex Dump Memory
24543
24544 Provides a convenient routine for dumping raw memory to either the
24545 standard output or standard error files. Uses GNAT.IO for actual
24546 output.
24547
24548 @node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
24549 @anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{386}@anchor{gnat_rm/the_gnat_library id93}@anchor{387}
24550 @section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
24551
24552
24553 @geindex GNAT.Most_Recent_Exception (g-moreex.ads)
24554
24555 @geindex Exception
24556 @geindex obtaining most recent
24557
24558 Provides access to the most recently raised exception. Can be used for
24559 various logging purposes, including duplicating functionality of some
24560 Ada 83 implementation dependent extensions.
24561
24562 @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
24563 @anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{388}@anchor{gnat_rm/the_gnat_library id94}@anchor{389}
24564 @section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
24565
24566
24567 @geindex GNAT.OS_Lib (g-os_lib.ads)
24568
24569 @geindex Operating System interface
24570
24571 @geindex Spawn capability
24572
24573 Provides a range of target independent operating system interface functions,
24574 including time/date management, file operations, subprocess management,
24575 including a portable spawn procedure, and access to environment variables
24576 and error return codes.
24577
24578 @node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
24579 @anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{38a}@anchor{gnat_rm/the_gnat_library id95}@anchor{38b}
24580 @section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
24581
24582
24583 @geindex GNAT.Perfect_Hash_Generators (g-pehage.ads)
24584
24585 @geindex Hash functions
24586
24587 Provides a generator of static minimal perfect hash functions. No
24588 collisions occur and each item can be retrieved from the table in one
24589 probe (perfect property). The hash table size corresponds to the exact
24590 size of the key set and no larger (minimal property). The key set has to
24591 be know in advance (static property). The hash functions are also order
24592 preserving. If w2 is inserted after w1 in the generator, their
24593 hashcode are in the same order. These hashing functions are very
24594 convenient for use with realtime applications.
24595
24596 @node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
24597 @anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{38c}@anchor{gnat_rm/the_gnat_library id96}@anchor{38d}
24598 @section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
24599
24600
24601 @geindex GNAT.Random_Numbers (g-rannum.ads)
24602
24603 @geindex Random number generation
24604
24605 Provides random number capabilities which extend those available in the
24606 standard Ada library and are more convenient to use.
24607
24608 @node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
24609 @anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{255}@anchor{gnat_rm/the_gnat_library id97}@anchor{38e}
24610 @section @code{GNAT.Regexp} (@code{g-regexp.ads})
24611
24612
24613 @geindex GNAT.Regexp (g-regexp.ads)
24614
24615 @geindex Regular expressions
24616
24617 @geindex Pattern matching
24618
24619 A simple implementation of regular expressions, using a subset of regular
24620 expression syntax copied from familiar Unix style utilities. This is the
24621 simplest of the three pattern matching packages provided, and is particularly
24622 suitable for 'file globbing' applications.
24623
24624 @node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
24625 @anchor{gnat_rm/the_gnat_library id98}@anchor{38f}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{390}
24626 @section @code{GNAT.Registry} (@code{g-regist.ads})
24627
24628
24629 @geindex GNAT.Registry (g-regist.ads)
24630
24631 @geindex Windows Registry
24632
24633 This is a high level binding to the Windows registry. It is possible to
24634 do simple things like reading a key value, creating a new key. For full
24635 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
24636 package provided with the Win32Ada binding
24637
24638 @node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
24639 @anchor{gnat_rm/the_gnat_library id99}@anchor{391}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{392}
24640 @section @code{GNAT.Regpat} (@code{g-regpat.ads})
24641
24642
24643 @geindex GNAT.Regpat (g-regpat.ads)
24644
24645 @geindex Regular expressions
24646
24647 @geindex Pattern matching
24648
24649 A complete implementation of Unix-style regular expression matching, copied
24650 from the original V7 style regular expression library written in C by
24651 Henry Spencer (and binary compatible with this C library).
24652
24653 @node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
24654 @anchor{gnat_rm/the_gnat_library id100}@anchor{393}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{394}
24655 @section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
24656
24657
24658 @geindex GNAT.Rewrite_Data (g-rewdat.ads)
24659
24660 @geindex Rewrite data
24661
24662 A unit to rewrite on-the-fly string occurrences in a stream of
24663 data. The implementation has a very minimal memory footprint as the
24664 full content to be processed is not loaded into memory all at once. This makes
24665 this interface usable for large files or socket streams.
24666
24667 @node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
24668 @anchor{gnat_rm/the_gnat_library id101}@anchor{395}@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{396}
24669 @section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
24670
24671
24672 @geindex GNAT.Secondary_Stack_Info (g-sestin.ads)
24673
24674 @geindex Secondary Stack Info
24675
24676 Provide the capability to query the high water mark of the current task's
24677 secondary stack.
24678
24679 @node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
24680 @anchor{gnat_rm/the_gnat_library id102}@anchor{397}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{398}
24681 @section @code{GNAT.Semaphores} (@code{g-semaph.ads})
24682
24683
24684 @geindex GNAT.Semaphores (g-semaph.ads)
24685
24686 @geindex Semaphores
24687
24688 Provides classic counting and binary semaphores using protected types.
24689
24690 @node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
24691 @anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{399}@anchor{gnat_rm/the_gnat_library id103}@anchor{39a}
24692 @section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
24693
24694
24695 @geindex GNAT.Serial_Communications (g-sercom.ads)
24696
24697 @geindex Serial_Communications
24698
24699 Provides a simple interface to send and receive data over a serial
24700 port. This is only supported on GNU/Linux and Windows.
24701
24702 @node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
24703 @anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{39b}@anchor{gnat_rm/the_gnat_library id104}@anchor{39c}
24704 @section @code{GNAT.SHA1} (@code{g-sha1.ads})
24705
24706
24707 @geindex GNAT.SHA1 (g-sha1.ads)
24708
24709 @geindex Secure Hash Algorithm SHA-1
24710
24711 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
24712 and RFC 3174, and the HMAC-SHA1 message authentication function as described
24713 in RFC 2104 and FIPS PUB 198.
24714
24715 @node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
24716 @anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{39d}@anchor{gnat_rm/the_gnat_library id105}@anchor{39e}
24717 @section @code{GNAT.SHA224} (@code{g-sha224.ads})
24718
24719
24720 @geindex GNAT.SHA224 (g-sha224.ads)
24721
24722 @geindex Secure Hash Algorithm SHA-224
24723
24724 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3,
24725 and the HMAC-SHA224 message authentication function as described
24726 in RFC 2104 and FIPS PUB 198.
24727
24728 @node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
24729 @anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{39f}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a0}
24730 @section @code{GNAT.SHA256} (@code{g-sha256.ads})
24731
24732
24733 @geindex GNAT.SHA256 (g-sha256.ads)
24734
24735 @geindex Secure Hash Algorithm SHA-256
24736
24737 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3,
24738 and the HMAC-SHA256 message authentication function as described
24739 in RFC 2104 and FIPS PUB 198.
24740
24741 @node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
24742 @anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a1}@anchor{gnat_rm/the_gnat_library id107}@anchor{3a2}
24743 @section @code{GNAT.SHA384} (@code{g-sha384.ads})
24744
24745
24746 @geindex GNAT.SHA384 (g-sha384.ads)
24747
24748 @geindex Secure Hash Algorithm SHA-384
24749
24750 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3,
24751 and the HMAC-SHA384 message authentication function as described
24752 in RFC 2104 and FIPS PUB 198.
24753
24754 @node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
24755 @anchor{gnat_rm/the_gnat_library id108}@anchor{3a3}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a4}
24756 @section @code{GNAT.SHA512} (@code{g-sha512.ads})
24757
24758
24759 @geindex GNAT.SHA512 (g-sha512.ads)
24760
24761 @geindex Secure Hash Algorithm SHA-512
24762
24763 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3,
24764 and the HMAC-SHA512 message authentication function as described
24765 in RFC 2104 and FIPS PUB 198.
24766
24767 @node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
24768 @anchor{gnat_rm/the_gnat_library id109}@anchor{3a5}@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3a6}
24769 @section @code{GNAT.Signals} (@code{g-signal.ads})
24770
24771
24772 @geindex GNAT.Signals (g-signal.ads)
24773
24774 @geindex Signals
24775
24776 Provides the ability to manipulate the blocked status of signals on supported
24777 targets.
24778
24779 @node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
24780 @anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3a7}@anchor{gnat_rm/the_gnat_library id110}@anchor{3a8}
24781 @section @code{GNAT.Sockets} (@code{g-socket.ads})
24782
24783
24784 @geindex GNAT.Sockets (g-socket.ads)
24785
24786 @geindex Sockets
24787
24788 A high level and portable interface to develop sockets based applications.
24789 This package is based on the sockets thin binding found in
24790 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
24791 on all native GNAT ports and on VxWorks cross prots. It is not implemented for
24792 the LynxOS cross port.
24793
24794 @node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
24795 @anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3a9}@anchor{gnat_rm/the_gnat_library id111}@anchor{3aa}
24796 @section @code{GNAT.Source_Info} (@code{g-souinf.ads})
24797
24798
24799 @geindex GNAT.Source_Info (g-souinf.ads)
24800
24801 @geindex Source Information
24802
24803 Provides subprograms that give access to source code information known at
24804 compile time, such as the current file name and line number. Also provides
24805 subprograms yielding the date and time of the current compilation (like the
24806 C macros @code{__DATE__} and @code{__TIME__})
24807
24808 @node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
24809 @anchor{gnat_rm/the_gnat_library id112}@anchor{3ab}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3ac}
24810 @section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
24811
24812
24813 @geindex GNAT.Spelling_Checker (g-speche.ads)
24814
24815 @geindex Spell checking
24816
24817 Provides a function for determining whether one string is a plausible
24818 near misspelling of another string.
24819
24820 @node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
24821 @anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3ad}@anchor{gnat_rm/the_gnat_library id113}@anchor{3ae}
24822 @section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
24823
24824
24825 @geindex GNAT.Spelling_Checker_Generic (g-spchge.ads)
24826
24827 @geindex Spell checking
24828
24829 Provides a generic function that can be instantiated with a string type for
24830 determining whether one string is a plausible near misspelling of another
24831 string.
24832
24833 @node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
24834 @anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3af}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b0}
24835 @section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
24836
24837
24838 @geindex GNAT.Spitbol.Patterns (g-spipat.ads)
24839
24840 @geindex SPITBOL pattern matching
24841
24842 @geindex Pattern matching
24843
24844 A complete implementation of SNOBOL4 style pattern matching. This is the
24845 most elaborate of the pattern matching packages provided. It fully duplicates
24846 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
24847 efficient algorithm developed by Robert Dewar for the SPITBOL system.
24848
24849 @node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
24850 @anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b1}@anchor{gnat_rm/the_gnat_library id115}@anchor{3b2}
24851 @section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
24852
24853
24854 @geindex GNAT.Spitbol (g-spitbo.ads)
24855
24856 @geindex SPITBOL interface
24857
24858 The top level package of the collection of SPITBOL-style functionality, this
24859 package provides basic SNOBOL4 string manipulation functions, such as
24860 Pad, Reverse, Trim, Substr capability, as well as a generic table function
24861 useful for constructing arbitrary mappings from strings in the style of
24862 the SNOBOL4 TABLE function.
24863
24864 @node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
24865 @anchor{gnat_rm/the_gnat_library id116}@anchor{3b3}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b4}
24866 @section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
24867
24868
24869 @geindex GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
24870
24871 @geindex Sets of strings
24872
24873 @geindex SPITBOL Tables
24874
24875 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24876 for type @code{Standard.Boolean}, giving an implementation of sets of
24877 string values.
24878
24879 @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
24880 @anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b5}@anchor{gnat_rm/the_gnat_library id117}@anchor{3b6}
24881 @section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
24882
24883
24884 @geindex GNAT.Spitbol.Table_Integer (g-sptain.ads)
24885
24886 @geindex Integer maps
24887
24888 @geindex Maps
24889
24890 @geindex SPITBOL Tables
24891
24892 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
24893 for type @code{Standard.Integer}, giving an implementation of maps
24894 from string to integer values.
24895
24896 @node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
24897 @anchor{gnat_rm/the_gnat_library id118}@anchor{3b7}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3b8}
24898 @section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
24899
24900
24901 @geindex GNAT.Spitbol.Table_VString (g-sptavs.ads)
24902
24903 @geindex String maps
24904
24905 @geindex Maps
24906
24907 @geindex SPITBOL Tables
24908
24909 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
24910 a variable length string type, giving an implementation of general
24911 maps from strings to strings.
24912
24913 @node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
24914 @anchor{gnat_rm/the_gnat_library id119}@anchor{3b9}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3ba}
24915 @section @code{GNAT.SSE} (@code{g-sse.ads})
24916
24917
24918 @geindex GNAT.SSE (g-sse.ads)
24919
24920 Root of a set of units aimed at offering Ada bindings to a subset of
24921 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
24922 targets. It exposes vector component types together with a general
24923 introduction to the binding contents and use.
24924
24925 @node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
24926 @anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3bb}@anchor{gnat_rm/the_gnat_library id120}@anchor{3bc}
24927 @section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
24928
24929
24930 @geindex GNAT.SSE.Vector_Types (g-ssvety.ads)
24931
24932 SSE vector types for use with SSE related intrinsics.
24933
24934 @node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
24935 @anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3bd}@anchor{gnat_rm/the_gnat_library id121}@anchor{3be}
24936 @section @code{GNAT.String_Hash} (@code{g-strhas.ads})
24937
24938
24939 @geindex GNAT.String_Hash (g-strhas.ads)
24940
24941 @geindex Hash functions
24942
24943 Provides a generic hash function working on arrays of scalars. Both the scalar
24944 type and the hash result type are parameters.
24945
24946 @node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
24947 @anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3bf}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c0}
24948 @section @code{GNAT.Strings} (@code{g-string.ads})
24949
24950
24951 @geindex GNAT.Strings (g-string.ads)
24952
24953 Common String access types and related subprograms. Basically it
24954 defines a string access and an array of string access types.
24955
24956 @node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
24957 @anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c1}@anchor{gnat_rm/the_gnat_library id123}@anchor{3c2}
24958 @section @code{GNAT.String_Split} (@code{g-strspl.ads})
24959
24960
24961 @geindex GNAT.String_Split (g-strspl.ads)
24962
24963 @geindex String splitter
24964
24965 Useful string manipulation routines: given a set of separators, split
24966 a string wherever the separators appear, and provide direct access
24967 to the resulting slices. This package is instantiated from
24968 @code{GNAT.Array_Split}.
24969
24970 @node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
24971 @anchor{gnat_rm/the_gnat_library id124}@anchor{3c3}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c4}
24972 @section @code{GNAT.Table} (@code{g-table.ads})
24973
24974
24975 @geindex GNAT.Table (g-table.ads)
24976
24977 @geindex Table implementation
24978
24979 @geindex Arrays
24980 @geindex extendable
24981
24982 A generic package providing a single dimension array abstraction where the
24983 length of the array can be dynamically modified.
24984
24985 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
24986 except that this package declares a single instance of the table type,
24987 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
24988 used to define dynamic instances of the table.
24989
24990 @node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
24991 @anchor{gnat_rm/the_gnat_library id125}@anchor{3c5}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c6}
24992 @section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
24993
24994
24995 @geindex GNAT.Task_Lock (g-tasloc.ads)
24996
24997 @geindex Task synchronization
24998
24999 @geindex Task locking
25000
25001 @geindex Locking
25002
25003 A very simple facility for locking and unlocking sections of code using a
25004 single global task lock. Appropriate for use in situations where contention
25005 between tasks is very rarely expected.
25006
25007 @node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
25008 @anchor{gnat_rm/the_gnat_library id126}@anchor{3c7}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3c8}
25009 @section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
25010
25011
25012 @geindex GNAT.Time_Stamp (g-timsta.ads)
25013
25014 @geindex Time stamp
25015
25016 @geindex Current time
25017
25018 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
25019 represents the current date and time in ISO 8601 format. This is a very simple
25020 routine with minimal code and there are no dependencies on any other unit.
25021
25022 @node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
25023 @anchor{gnat_rm/the_gnat_library id127}@anchor{3c9}@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3ca}
25024 @section @code{GNAT.Threads} (@code{g-thread.ads})
25025
25026
25027 @geindex GNAT.Threads (g-thread.ads)
25028
25029 @geindex Foreign threads
25030
25031 @geindex Threads
25032 @geindex foreign
25033
25034 Provides facilities for dealing with foreign threads which need to be known
25035 by the GNAT run-time system. Consult the documentation of this package for
25036 further details if your program has threads that are created by a non-Ada
25037 environment which then accesses Ada code.
25038
25039 @node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
25040 @anchor{gnat_rm/the_gnat_library id128}@anchor{3cb}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3cc}
25041 @section @code{GNAT.Traceback} (@code{g-traceb.ads})
25042
25043
25044 @geindex GNAT.Traceback (g-traceb.ads)
25045
25046 @geindex Trace back facilities
25047
25048 Provides a facility for obtaining non-symbolic traceback information, useful
25049 in various debugging situations.
25050
25051 @node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
25052 @anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3cd}@anchor{gnat_rm/the_gnat_library id129}@anchor{3ce}
25053 @section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
25054
25055
25056 @geindex GNAT.Traceback.Symbolic (g-trasym.ads)
25057
25058 @geindex Trace back facilities
25059
25060 @node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
25061 @anchor{gnat_rm/the_gnat_library id130}@anchor{3cf}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3d0}
25062 @section @code{GNAT.UTF_32} (@code{g-table.ads})
25063
25064
25065 @geindex GNAT.UTF_32 (g-table.ads)
25066
25067 @geindex Wide character codes
25068
25069 This is a package intended to be used in conjunction with the
25070 @code{Wide_Character} type in Ada 95 and the
25071 @code{Wide_Wide_Character} type in Ada 2005 (available
25072 in @code{GNAT} in Ada 2005 mode). This package contains
25073 Unicode categorization routines, as well as lexical
25074 categorization routines corresponding to the Ada 2005
25075 lexical rules for identifiers and strings, and also a
25076 lower case to upper case fold routine corresponding to
25077 the Ada 2005 rules for identifier equivalence.
25078
25079 @node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
25080 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3d1}@anchor{gnat_rm/the_gnat_library id131}@anchor{3d2}
25081 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
25082
25083
25084 @geindex GNAT.Wide_Spelling_Checker (g-u3spch.ads)
25085
25086 @geindex Spell checking
25087
25088 Provides a function for determining whether one wide wide string is a plausible
25089 near misspelling of another wide wide string, where the strings are represented
25090 using the UTF_32_String type defined in System.Wch_Cnv.
25091
25092 @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
25093 @anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d3}@anchor{gnat_rm/the_gnat_library id132}@anchor{3d4}
25094 @section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
25095
25096
25097 @geindex GNAT.Wide_Spelling_Checker (g-wispch.ads)
25098
25099 @geindex Spell checking
25100
25101 Provides a function for determining whether one wide string is a plausible
25102 near misspelling of another wide string.
25103
25104 @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
25105 @anchor{gnat_rm/the_gnat_library id133}@anchor{3d5}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d6}
25106 @section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
25107
25108
25109 @geindex GNAT.Wide_String_Split (g-wistsp.ads)
25110
25111 @geindex Wide_String splitter
25112
25113 Useful wide string manipulation routines: given a set of separators, split
25114 a wide string wherever the separators appear, and provide direct access
25115 to the resulting slices. This package is instantiated from
25116 @code{GNAT.Array_Split}.
25117
25118 @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
25119 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3d7}@anchor{gnat_rm/the_gnat_library id134}@anchor{3d8}
25120 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
25121
25122
25123 @geindex GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
25124
25125 @geindex Spell checking
25126
25127 Provides a function for determining whether one wide wide string is a plausible
25128 near misspelling of another wide wide string.
25129
25130 @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
25131 @anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3d9}@anchor{gnat_rm/the_gnat_library id135}@anchor{3da}
25132 @section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
25133
25134
25135 @geindex GNAT.Wide_Wide_String_Split (g-zistsp.ads)
25136
25137 @geindex Wide_Wide_String splitter
25138
25139 Useful wide wide string manipulation routines: given a set of separators, split
25140 a wide wide string wherever the separators appear, and provide direct access
25141 to the resulting slices. This package is instantiated from
25142 @code{GNAT.Array_Split}.
25143
25144 @node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
25145 @anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3db}@anchor{gnat_rm/the_gnat_library id136}@anchor{3dc}
25146 @section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
25147
25148
25149 @geindex Interfaces.C.Extensions (i-cexten.ads)
25150
25151 This package contains additional C-related definitions, intended
25152 for use with either manually or automatically generated bindings
25153 to C libraries.
25154
25155 @node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
25156 @anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3dd}@anchor{gnat_rm/the_gnat_library id137}@anchor{3de}
25157 @section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
25158
25159
25160 @geindex Interfaces.C.Streams (i-cstrea.ads)
25161
25162 @geindex C streams
25163 @geindex interfacing
25164
25165 This package is a binding for the most commonly used operations
25166 on C streams.
25167
25168 @node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
25169 @anchor{gnat_rm/the_gnat_library id138}@anchor{3df}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3e0}
25170 @section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
25171
25172
25173 @geindex Interfaces.Packed_Decimal (i-pacdec.ads)
25174
25175 @geindex IBM Packed Format
25176
25177 @geindex Packed Decimal
25178
25179 This package provides a set of routines for conversions to and
25180 from a packed decimal format compatible with that used on IBM
25181 mainframes.
25182
25183 @node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
25184 @anchor{gnat_rm/the_gnat_library id139}@anchor{3e1}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e2}
25185 @section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
25186
25187
25188 @geindex Interfaces.VxWorks (i-vxwork.ads)
25189
25190 @geindex Interfacing to VxWorks
25191
25192 @geindex VxWorks
25193 @geindex interfacing
25194
25195 This package provides a limited binding to the VxWorks API.
25196 In particular, it interfaces with the
25197 VxWorks hardware interrupt facilities.
25198
25199 @node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
25200 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e3}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e4}
25201 @section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
25202
25203
25204 @geindex Interfaces.VxWorks.Int_Connection (i-vxinco.ads)
25205
25206 @geindex Interfacing to VxWorks
25207
25208 @geindex VxWorks
25209 @geindex interfacing
25210
25211 This package provides a way for users to replace the use of
25212 intConnect() with a custom routine for installing interrupt
25213 handlers.
25214
25215 @node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
25216 @anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e5}@anchor{gnat_rm/the_gnat_library id141}@anchor{3e6}
25217 @section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
25218
25219
25220 @geindex Interfaces.VxWorks.IO (i-vxwoio.ads)
25221
25222 @geindex Interfacing to VxWorks' I/O
25223
25224 @geindex VxWorks
25225 @geindex I/O interfacing
25226
25227 @geindex VxWorks
25228 @geindex Get_Immediate
25229
25230 @geindex Get_Immediate
25231 @geindex VxWorks
25232
25233 This package provides a binding to the ioctl (IO/Control)
25234 function of VxWorks, defining a set of option values and
25235 function codes. A particular use of this package is
25236 to enable the use of Get_Immediate under VxWorks.
25237
25238 @node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
25239 @anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3e7}@anchor{gnat_rm/the_gnat_library id142}@anchor{3e8}
25240 @section @code{System.Address_Image} (@code{s-addima.ads})
25241
25242
25243 @geindex System.Address_Image (s-addima.ads)
25244
25245 @geindex Address image
25246
25247 @geindex Image
25248 @geindex of an address
25249
25250 This function provides a useful debugging
25251 function that gives an (implementation dependent)
25252 string which identifies an address.
25253
25254 @node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
25255 @anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3e9}@anchor{gnat_rm/the_gnat_library id143}@anchor{3ea}
25256 @section @code{System.Assertions} (@code{s-assert.ads})
25257
25258
25259 @geindex System.Assertions (s-assert.ads)
25260
25261 @geindex Assertions
25262
25263 @geindex Assert_Failure
25264 @geindex exception
25265
25266 This package provides the declaration of the exception raised
25267 by an run-time assertion failure, as well as the routine that
25268 is used internally to raise this assertion.
25269
25270 @node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
25271 @anchor{gnat_rm/the_gnat_library id144}@anchor{3eb}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3ec}
25272 @section @code{System.Atomic_Counters} (@code{s-atocou.ads})
25273
25274
25275 @geindex System.Atomic_Counters (s-atocou.ads)
25276
25277 This package provides the declaration of an atomic counter type,
25278 together with efficient routines (using hardware
25279 synchronization primitives) for incrementing, decrementing,
25280 and testing of these counters. This package is implemented
25281 on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
25282 x86, and x86_64 platforms.
25283
25284 @node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
25285 @anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3ed}@anchor{gnat_rm/the_gnat_library id145}@anchor{3ee}
25286 @section @code{System.Memory} (@code{s-memory.ads})
25287
25288
25289 @geindex System.Memory (s-memory.ads)
25290
25291 @geindex Memory allocation
25292
25293 This package provides the interface to the low level routines used
25294 by the generated code for allocation and freeing storage for the
25295 default storage pool (analogous to the C routines malloc and free.
25296 It also provides a reallocation interface analogous to the C routine
25297 realloc. The body of this unit may be modified to provide alternative
25298 allocation mechanisms for the default pool, and in addition, direct
25299 calls to this unit may be made for low level allocation uses (for
25300 example see the body of @code{GNAT.Tables}).
25301
25302 @node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
25303 @anchor{gnat_rm/the_gnat_library id146}@anchor{3ef}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3f0}
25304 @section @code{System.Multiprocessors} (@code{s-multip.ads})
25305
25306
25307 @geindex System.Multiprocessors (s-multip.ads)
25308
25309 @geindex Multiprocessor interface
25310
25311 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25312 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25313 technically an implementation-defined addition).
25314
25315 @node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
25316 @anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f1}@anchor{gnat_rm/the_gnat_library id147}@anchor{3f2}
25317 @section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
25318
25319
25320 @geindex System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
25321
25322 @geindex Multiprocessor interface
25323
25324 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
25325 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
25326 technically an implementation-defined addition).
25327
25328 @node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
25329 @anchor{gnat_rm/the_gnat_library id148}@anchor{3f3}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f4}
25330 @section @code{System.Partition_Interface} (@code{s-parint.ads})
25331
25332
25333 @geindex System.Partition_Interface (s-parint.ads)
25334
25335 @geindex Partition interfacing functions
25336
25337 This package provides facilities for partition interfacing. It
25338 is used primarily in a distribution context when using Annex E
25339 with @code{GLADE}.
25340
25341 @node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
25342 @anchor{gnat_rm/the_gnat_library id149}@anchor{3f5}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f6}
25343 @section @code{System.Pool_Global} (@code{s-pooglo.ads})
25344
25345
25346 @geindex System.Pool_Global (s-pooglo.ads)
25347
25348 @geindex Storage pool
25349 @geindex global
25350
25351 @geindex Global storage pool
25352
25353 This package provides a storage pool that is equivalent to the default
25354 storage pool used for access types for which no pool is specifically
25355 declared. It uses malloc/free to allocate/free and does not attempt to
25356 do any automatic reclamation.
25357
25358 @node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
25359 @anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3f7}@anchor{gnat_rm/the_gnat_library id150}@anchor{3f8}
25360 @section @code{System.Pool_Local} (@code{s-pooloc.ads})
25361
25362
25363 @geindex System.Pool_Local (s-pooloc.ads)
25364
25365 @geindex Storage pool
25366 @geindex local
25367
25368 @geindex Local storage pool
25369
25370 This package provides a storage pool that is intended for use with locally
25371 defined access types. It uses malloc/free for allocate/free, and maintains
25372 a list of allocated blocks, so that all storage allocated for the pool can
25373 be freed automatically when the pool is finalized.
25374
25375 @node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
25376 @anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3f9}@anchor{gnat_rm/the_gnat_library id151}@anchor{3fa}
25377 @section @code{System.Restrictions} (@code{s-restri.ads})
25378
25379
25380 @geindex System.Restrictions (s-restri.ads)
25381
25382 @geindex Run-time restrictions access
25383
25384 This package provides facilities for accessing at run time
25385 the status of restrictions specified at compile time for
25386 the partition. Information is available both with regard
25387 to actual restrictions specified, and with regard to
25388 compiler determined information on which restrictions
25389 are violated by one or more packages in the partition.
25390
25391 @node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
25392 @anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3fb}@anchor{gnat_rm/the_gnat_library id152}@anchor{3fc}
25393 @section @code{System.Rident} (@code{s-rident.ads})
25394
25395
25396 @geindex System.Rident (s-rident.ads)
25397
25398 @geindex Restrictions definitions
25399
25400 This package provides definitions of the restrictions
25401 identifiers supported by GNAT, and also the format of
25402 the restrictions provided in package System.Restrictions.
25403 It is not normally necessary to @code{with} this generic package
25404 since the necessary instantiation is included in
25405 package System.Restrictions.
25406
25407 @node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
25408 @anchor{gnat_rm/the_gnat_library id153}@anchor{3fd}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{3fe}
25409 @section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
25410
25411
25412 @geindex System.Strings.Stream_Ops (s-ststop.ads)
25413
25414 @geindex Stream operations
25415
25416 @geindex String stream operations
25417
25418 This package provides a set of stream subprograms for standard string types.
25419 It is intended primarily to support implicit use of such subprograms when
25420 stream attributes are applied to string types, but the subprograms in this
25421 package can be used directly by application programs.
25422
25423 @node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
25424 @anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{3ff}@anchor{gnat_rm/the_gnat_library id154}@anchor{400}
25425 @section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
25426
25427
25428 @geindex System.Unsigned_Types (s-unstyp.ads)
25429
25430 This package contains definitions of standard unsigned types that
25431 correspond in size to the standard signed types declared in Standard,
25432 and (unlike the types in Interfaces) have corresponding names. It
25433 also contains some related definitions for other specialized types
25434 used by the compiler in connection with packed array types.
25435
25436 @node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
25437 @anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{401}@anchor{gnat_rm/the_gnat_library id155}@anchor{402}
25438 @section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
25439
25440
25441 @geindex System.Wch_Cnv (s-wchcnv.ads)
25442
25443 @geindex Wide Character
25444 @geindex Representation
25445
25446 @geindex Wide String
25447 @geindex Conversion
25448
25449 @geindex Representation of wide characters
25450
25451 This package provides routines for converting between
25452 wide and wide wide characters and a representation as a value of type
25453 @code{Standard.String}, using a specified wide character
25454 encoding method. It uses definitions in
25455 package @code{System.Wch_Con}.
25456
25457 @node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
25458 @anchor{gnat_rm/the_gnat_library id156}@anchor{403}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{404}
25459 @section @code{System.Wch_Con} (@code{s-wchcon.ads})
25460
25461
25462 @geindex System.Wch_Con (s-wchcon.ads)
25463
25464 This package provides definitions and descriptions of
25465 the various methods used for encoding wide characters
25466 in ordinary strings. These definitions are used by
25467 the package @code{System.Wch_Cnv}.
25468
25469 @node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
25470 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{405}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{406}
25471 @chapter Interfacing to Other Languages
25472
25473
25474 The facilities in Annex B of the Ada Reference Manual are fully
25475 implemented in GNAT, and in addition, a full interface to C++ is
25476 provided.
25477
25478 @menu
25479 * Interfacing to C::
25480 * Interfacing to C++::
25481 * Interfacing to COBOL::
25482 * Interfacing to Fortran::
25483 * Interfacing to non-GNAT Ada code::
25484
25485 @end menu
25486
25487 @node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
25488 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{407}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{408}
25489 @section Interfacing to C
25490
25491
25492 Interfacing to C with GNAT can use one of two approaches:
25493
25494
25495 @itemize *
25496
25497 @item
25498 The types in the package @code{Interfaces.C} may be used.
25499
25500 @item
25501 Standard Ada types may be used directly. This may be less portable to
25502 other compilers, but will work on all GNAT compilers, which guarantee
25503 correspondence between the C and Ada types.
25504 @end itemize
25505
25506 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
25507 effect, since this is the default. The following table shows the
25508 correspondence between Ada scalar types and the corresponding C types.
25509
25510
25511 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
25512 @headitem
25513
25514 Ada Type
25515
25516 @tab
25517
25518 C Type
25519
25520 @item
25521
25522 @code{Integer}
25523
25524 @tab
25525
25526 @code{int}
25527
25528 @item
25529
25530 @code{Short_Integer}
25531
25532 @tab
25533
25534 @code{short}
25535
25536 @item
25537
25538 @code{Short_Short_Integer}
25539
25540 @tab
25541
25542 @code{signed char}
25543
25544 @item
25545
25546 @code{Long_Integer}
25547
25548 @tab
25549
25550 @code{long}
25551
25552 @item
25553
25554 @code{Long_Long_Integer}
25555
25556 @tab
25557
25558 @code{long long}
25559
25560 @item
25561
25562 @code{Short_Float}
25563
25564 @tab
25565
25566 @code{float}
25567
25568 @item
25569
25570 @code{Float}
25571
25572 @tab
25573
25574 @code{float}
25575
25576 @item
25577
25578 @code{Long_Float}
25579
25580 @tab
25581
25582 @code{double}
25583
25584 @item
25585
25586 @code{Long_Long_Float}
25587
25588 @tab
25589
25590 This is the longest floating-point type supported by the hardware.
25591
25592 @end multitable
25593
25594
25595 Additionally, there are the following general correspondences between Ada
25596 and C types:
25597
25598
25599 @itemize *
25600
25601 @item
25602 Ada enumeration types map to C enumeration types directly if pragma
25603 @code{Convention C} is specified, which causes them to have a length of
25604 32 bits, except for boolean types which map to C99 @code{bool} and for
25605 which the length is 8 bits.
25606 Without pragma @code{Convention C}, Ada enumeration types map to
25607 8, 16, or 32 bits (i.e., C types @code{signed char}, @code{short},
25608 @code{int}, respectively) depending on the number of values passed.
25609 This is the only case in which pragma @code{Convention C} affects the
25610 representation of an Ada type.
25611
25612 @item
25613 Ada access types map to C pointers, except for the case of pointers to
25614 unconstrained types in Ada, which have no direct C equivalent.
25615
25616 @item
25617 Ada arrays map directly to C arrays.
25618
25619 @item
25620 Ada records map directly to C structures.
25621
25622 @item
25623 Packed Ada records map to C structures where all members are bit fields
25624 of the length corresponding to the @code{type'Size} value in Ada.
25625 @end itemize
25626
25627 @node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
25628 @anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{409}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{49}
25629 @section Interfacing to C++
25630
25631
25632 The interface to C++ makes use of the following pragmas, which are
25633 primarily intended to be constructed automatically using a binding generator
25634 tool, although it is possible to construct them by hand.
25635
25636 Using these pragmas it is possible to achieve complete
25637 inter-operability between Ada tagged types and C++ class definitions.
25638 See @ref{7,,Implementation Defined Pragmas}, for more details.
25639
25640
25641 @table @asis
25642
25643 @item @code{pragma CPP_Class ([Entity =>] @emph{LOCAL_NAME})}
25644
25645 The argument denotes an entity in the current declarative region that is
25646 declared as a tagged or untagged record type. It indicates that the type
25647 corresponds to an externally declared C++ class type, and is to be laid
25648 out the same way that C++ would lay out the type.
25649
25650 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
25651 for backward compatibility but its functionality is available
25652 using pragma @code{Import} with @code{Convention} = @code{CPP}.
25653
25654 @item @code{pragma CPP_Constructor ([Entity =>] @emph{LOCAL_NAME})}
25655
25656 This pragma identifies an imported function (imported in the usual way
25657 with pragma @code{Import}) as corresponding to a C++ constructor.
25658 @end table
25659
25660 A few restrictions are placed on the use of the @code{Access} attribute
25661 in conjunction with subprograms subject to convention @code{CPP}: the
25662 attribute may be used neither on primitive operations of a tagged
25663 record type with convention @code{CPP}, imported or not, nor on
25664 subprograms imported with pragma @code{CPP_Constructor}.
25665
25666 In addition, C++ exceptions are propagated and can be handled in an
25667 @code{others} choice of an exception handler. The corresponding Ada
25668 occurrence has no message, and the simple name of the exception identity
25669 contains @code{Foreign_Exception}. Finalization and awaiting dependent
25670 tasks works properly when such foreign exceptions are propagated.
25671
25672 It is also possible to import a C++ exception using the following syntax:
25673
25674 @example
25675 LOCAL_NAME : exception;
25676 pragma Import (Cpp,
25677 [Entity =>] LOCAL_NAME,
25678 [External_Name =>] static_string_EXPRESSION);
25679 @end example
25680
25681 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
25682 cover a specific C++ exception in an exception handler.
25683
25684 @node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
25685 @anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{40a}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{40b}
25686 @section Interfacing to COBOL
25687
25688
25689 Interfacing to COBOL is achieved as described in section B.4 of
25690 the Ada Reference Manual.
25691
25692 @node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
25693 @anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{40c}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{40d}
25694 @section Interfacing to Fortran
25695
25696
25697 Interfacing to Fortran is achieved as described in section B.5 of the
25698 Ada Reference Manual. The pragma @code{Convention Fortran}, applied to a
25699 multi-dimensional array causes the array to be stored in column-major
25700 order as required for convenient interface to Fortran.
25701
25702 @node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
25703 @anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{40e}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{40f}
25704 @section Interfacing to non-GNAT Ada code
25705
25706
25707 It is possible to specify the convention @code{Ada} in a pragma
25708 @code{Import} or pragma @code{Export}. However this refers to
25709 the calling conventions used by GNAT, which may or may not be
25710 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
25711 compiler to allow interoperation.
25712
25713 If arguments types are kept simple, and if the foreign compiler generally
25714 follows system calling conventions, then it may be possible to integrate
25715 files compiled by other Ada compilers, provided that the elaboration
25716 issues are adequately addressed (for example by eliminating the
25717 need for any load time elaboration).
25718
25719 In particular, GNAT running on VMS is designed to
25720 be highly compatible with the DEC Ada 83 compiler, so this is one
25721 case in which it is possible to import foreign units of this type,
25722 provided that the data items passed are restricted to simple scalar
25723 values or simple record types without variants, or simple array
25724 types with fixed bounds.
25725
25726 @node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
25727 @anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{410}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{411}
25728 @chapter Specialized Needs Annexes
25729
25730
25731 Ada 95, Ada 2005, and Ada 2012 define a number of Specialized Needs Annexes, which are not
25732 required in all implementations. However, as described in this chapter,
25733 GNAT implements all of these annexes:
25734
25735
25736 @table @asis
25737
25738 @item @emph{Systems Programming (Annex C)}
25739
25740 The Systems Programming Annex is fully implemented.
25741
25742 @item @emph{Real-Time Systems (Annex D)}
25743
25744 The Real-Time Systems Annex is fully implemented.
25745
25746 @item @emph{Distributed Systems (Annex E)}
25747
25748 Stub generation is fully implemented in the GNAT compiler. In addition,
25749 a complete compatible PCS is available as part of the GLADE system,
25750 a separate product. When the two
25751 products are used in conjunction, this annex is fully implemented.
25752
25753 @item @emph{Information Systems (Annex F)}
25754
25755 The Information Systems annex is fully implemented.
25756
25757 @item @emph{Numerics (Annex G)}
25758
25759 The Numerics Annex is fully implemented.
25760
25761 @item @emph{Safety and Security / High-Integrity Systems (Annex H)}
25762
25763 The Safety and Security Annex (termed the High-Integrity Systems Annex
25764 in Ada 2005) is fully implemented.
25765 @end table
25766
25767 @node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
25768 @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{412}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{413}
25769 @chapter Implementation of Specific Ada Features
25770
25771
25772 This chapter describes the GNAT implementation of several Ada language
25773 facilities.
25774
25775 @menu
25776 * Machine Code Insertions::
25777 * GNAT Implementation of Tasking::
25778 * GNAT Implementation of Shared Passive Packages::
25779 * Code Generation for Array Aggregates::
25780 * The Size of Discriminated Records with Default Discriminants::
25781 * Strict Conformance to the Ada Reference Manual::
25782
25783 @end menu
25784
25785 @node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
25786 @anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{168}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{414}
25787 @section Machine Code Insertions
25788
25789
25790 @geindex Machine Code insertions
25791
25792 Package @code{Machine_Code} provides machine code support as described
25793 in the Ada Reference Manual in two separate forms:
25794
25795
25796 @itemize *
25797
25798 @item
25799 Machine code statements, consisting of qualified expressions that
25800 fit the requirements of RM section 13.8.
25801
25802 @item
25803 An intrinsic callable procedure, providing an alternative mechanism of
25804 including machine instructions in a subprogram.
25805 @end itemize
25806
25807 The two features are similar, and both are closely related to the mechanism
25808 provided by the asm instruction in the GNU C compiler. Full understanding
25809 and use of the facilities in this package requires understanding the asm
25810 instruction, see the section on Extended Asm in
25811 @cite{Using_the_GNU_Compiler_Collection_(GCC)}.
25812
25813 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
25814 semantic restrictions and effects as described below. Both are provided so
25815 that the procedure call can be used as a statement, and the function call
25816 can be used to form a code_statement.
25817
25818 Consider this C @code{asm} instruction:
25819
25820 @example
25821 asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
25822 @end example
25823
25824 The equivalent can be written for GNAT as:
25825
25826 @example
25827 Asm ("fsinx %1 %0",
25828 My_Float'Asm_Output ("=f", result),
25829 My_Float'Asm_Input ("f", angle));
25830 @end example
25831
25832 The first argument to @code{Asm} is the assembler template, and is
25833 identical to what is used in GNU C. This string must be a static
25834 expression. The second argument is the output operand list. It is
25835 either a single @code{Asm_Output} attribute reference, or a list of such
25836 references enclosed in parentheses (technically an array aggregate of
25837 such references).
25838
25839 The @code{Asm_Output} attribute denotes a function that takes two
25840 parameters. The first is a string, the second is the name of a variable
25841 of the type designated by the attribute prefix. The first (string)
25842 argument is required to be a static expression and designates the
25843 constraint (see the section on Constraints in
25844 @cite{Using_the_GNU_Compiler_Collection_(GCC)})
25845 for the parameter; e.g., what kind of register is required. The second
25846 argument is the variable to be written or updated with the
25847 result. The possible values for constraint are the same as those used in
25848 the RTL, and are dependent on the configuration file used to build the
25849 GCC back end. If there are no output operands, then this argument may
25850 either be omitted, or explicitly given as @code{No_Output_Operands}.
25851 No support is provided for GNU C's symbolic names for output parameters.
25852
25853 The second argument of @code{my_float'Asm_Output} functions as
25854 though it were an @code{out} parameter, which is a little curious, but
25855 all names have the form of expressions, so there is no syntactic
25856 irregularity, even though normally functions would not be permitted
25857 @code{out} parameters. The third argument is the list of input
25858 operands. It is either a single @code{Asm_Input} attribute reference, or
25859 a list of such references enclosed in parentheses (technically an array
25860 aggregate of such references).
25861
25862 The @code{Asm_Input} attribute denotes a function that takes two
25863 parameters. The first is a string, the second is an expression of the
25864 type designated by the prefix. The first (string) argument is required
25865 to be a static expression, and is the constraint for the parameter,
25866 (e.g., what kind of register is required). The second argument is the
25867 value to be used as the input argument. The possible values for the
25868 constraint are the same as those used in the RTL, and are dependent on
25869 the configuration file used to built the GCC back end.
25870 No support is provided for GNU C's symbolic names for input parameters.
25871
25872 If there are no input operands, this argument may either be omitted, or
25873 explicitly given as @code{No_Input_Operands}. The fourth argument, not
25874 present in the above example, is a list of register names, called the
25875 @emph{clobber} argument. This argument, if given, must be a static string
25876 expression, and is a space or comma separated list of names of registers
25877 that must be considered destroyed as a result of the @code{Asm} call. If
25878 this argument is the null string (the default value), then the code
25879 generator assumes that no additional registers are destroyed.
25880 In addition to registers, the special clobbers @code{memory} and
25881 @code{cc} as described in the GNU C docs are both supported.
25882
25883 The fifth argument, not present in the above example, called the
25884 @emph{volatile} argument, is by default @code{False}. It can be set to
25885 the literal value @code{True} to indicate to the code generator that all
25886 optimizations with respect to the instruction specified should be
25887 suppressed, and in particular an instruction that has outputs
25888 will still be generated, even if none of the outputs are
25889 used. See @cite{Using_the_GNU_Compiler_Collection_(GCC)}
25890 for the full description.
25891 Generally it is strongly advisable to use Volatile for any ASM statement
25892 that is missing either input or output operands or to avoid unwanted
25893 optimizations. A warning is generated if this advice is not followed.
25894
25895 No support is provided for GNU C's @code{asm goto} feature.
25896
25897 The @code{Asm} subprograms may be used in two ways. First the procedure
25898 forms can be used anywhere a procedure call would be valid, and
25899 correspond to what the RM calls 'intrinsic' routines. Such calls can
25900 be used to intersperse machine instructions with other Ada statements.
25901 Second, the function forms, which return a dummy value of the limited
25902 private type @code{Asm_Insn}, can be used in code statements, and indeed
25903 this is the only context where such calls are allowed. Code statements
25904 appear as aggregates of the form:
25905
25906 @example
25907 Asm_Insn'(Asm (...));
25908 Asm_Insn'(Asm_Volatile (...));
25909 @end example
25910
25911 In accordance with RM rules, such code statements are allowed only
25912 within subprograms whose entire body consists of such statements. It is
25913 not permissible to intermix such statements with other Ada statements.
25914
25915 Typically the form using intrinsic procedure calls is more convenient
25916 and more flexible. The code statement form is provided to meet the RM
25917 suggestion that such a facility should be made available. The following
25918 is the exact syntax of the call to @code{Asm}. As usual, if named notation
25919 is used, the arguments may be given in arbitrary order, following the
25920 normal rules for use of positional and named arguments:
25921
25922 @example
25923 ASM_CALL ::= Asm (
25924 [Template =>] static_string_EXPRESSION
25925 [,[Outputs =>] OUTPUT_OPERAND_LIST ]
25926 [,[Inputs =>] INPUT_OPERAND_LIST ]
25927 [,[Clobber =>] static_string_EXPRESSION ]
25928 [,[Volatile =>] static_boolean_EXPRESSION] )
25929
25930 OUTPUT_OPERAND_LIST ::=
25931 [PREFIX.]No_Output_Operands
25932 | OUTPUT_OPERAND_ATTRIBUTE
25933 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
25934
25935 OUTPUT_OPERAND_ATTRIBUTE ::=
25936 SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
25937
25938 INPUT_OPERAND_LIST ::=
25939 [PREFIX.]No_Input_Operands
25940 | INPUT_OPERAND_ATTRIBUTE
25941 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
25942
25943 INPUT_OPERAND_ATTRIBUTE ::=
25944 SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
25945 @end example
25946
25947 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
25948 are declared in the package @code{Machine_Code} and must be referenced
25949 according to normal visibility rules. In particular if there is no
25950 @code{use} clause for this package, then appropriate package name
25951 qualification is required.
25952
25953 @node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
25954 @anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{415}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{416}
25955 @section GNAT Implementation of Tasking
25956
25957
25958 This chapter outlines the basic GNAT approach to tasking (in particular,
25959 a multi-layered library for portability) and discusses issues related
25960 to compliance with the Real-Time Systems Annex.
25961
25962 @menu
25963 * Mapping Ada Tasks onto the Underlying Kernel Threads::
25964 * Ensuring Compliance with the Real-Time Annex::
25965 * Support for Locking Policies::
25966
25967 @end menu
25968
25969 @node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
25970 @anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{417}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{418}
25971 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
25972
25973
25974 GNAT's run-time support comprises two layers:
25975
25976
25977 @itemize *
25978
25979 @item
25980 GNARL (GNAT Run-time Layer)
25981
25982 @item
25983 GNULL (GNAT Low-level Library)
25984 @end itemize
25985
25986 In GNAT, Ada's tasking services rely on a platform and OS independent
25987 layer known as GNARL. This code is responsible for implementing the
25988 correct semantics of Ada's task creation, rendezvous, protected
25989 operations etc.
25990
25991 GNARL decomposes Ada's tasking semantics into simpler lower level
25992 operations such as create a thread, set the priority of a thread,
25993 yield, create a lock, lock/unlock, etc. The spec for these low-level
25994 operations constitutes GNULLI, the GNULL Interface. This interface is
25995 directly inspired from the POSIX real-time API.
25996
25997 If the underlying executive or OS implements the POSIX standard
25998 faithfully, the GNULL Interface maps as is to the services offered by
25999 the underlying kernel. Otherwise, some target dependent glue code maps
26000 the services offered by the underlying kernel to the semantics expected
26001 by GNARL.
26002
26003 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
26004 key point is that each Ada task is mapped on a thread in the underlying
26005 kernel. For example, in the case of VxWorks, one Ada task = one VxWorks task.
26006
26007 In addition Ada task priorities map onto the underlying thread priorities.
26008 Mapping Ada tasks onto the underlying kernel threads has several advantages:
26009
26010
26011 @itemize *
26012
26013 @item
26014 The underlying scheduler is used to schedule the Ada tasks. This
26015 makes Ada tasks as efficient as kernel threads from a scheduling
26016 standpoint.
26017
26018 @item
26019 Interaction with code written in C containing threads is eased
26020 since at the lowest level Ada tasks and C threads map onto the same
26021 underlying kernel concept.
26022
26023 @item
26024 When an Ada task is blocked during I/O the remaining Ada tasks are
26025 able to proceed.
26026
26027 @item
26028 On multiprocessor systems Ada tasks can execute in parallel.
26029 @end itemize
26030
26031 Some threads libraries offer a mechanism to fork a new process, with the
26032 child process duplicating the threads from the parent.
26033 GNAT does not
26034 support this functionality when the parent contains more than one task.
26035
26036 @geindex Forking a new process
26037
26038 @node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
26039 @anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{419}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{41a}
26040 @subsection Ensuring Compliance with the Real-Time Annex
26041
26042
26043 @geindex Real-Time Systems Annex compliance
26044
26045 Although mapping Ada tasks onto
26046 the underlying threads has significant advantages, it does create some
26047 complications when it comes to respecting the scheduling semantics
26048 specified in the real-time annex (Annex D).
26049
26050 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
26051 scheduling policy states:
26052
26053 @quotation
26054
26055 @emph{When the active priority of a ready task that is not running
26056 changes, or the setting of its base priority takes effect, the
26057 task is removed from the ready queue for its old active priority
26058 and is added at the tail of the ready queue for its new active
26059 priority, except in the case where the active priority is lowered
26060 due to the loss of inherited priority, in which case the task is
26061 added at the head of the ready queue for its new active priority.}
26062 @end quotation
26063
26064 While most kernels do put tasks at the end of the priority queue when
26065 a task changes its priority, (which respects the main
26066 FIFO_Within_Priorities requirement), almost none keep a thread at the
26067 beginning of its priority queue when its priority drops from the loss
26068 of inherited priority.
26069
26070 As a result most vendors have provided incomplete Annex D implementations.
26071
26072 The GNAT run-time, has a nice cooperative solution to this problem
26073 which ensures that accurate FIFO_Within_Priorities semantics are
26074 respected.
26075
26076 The principle is as follows. When an Ada task T is about to start
26077 running, it checks whether some other Ada task R with the same
26078 priority as T has been suspended due to the loss of priority
26079 inheritance. If this is the case, T yields and is placed at the end of
26080 its priority queue. When R arrives at the front of the queue it
26081 executes.
26082
26083 Note that this simple scheme preserves the relative order of the tasks
26084 that were ready to execute in the priority queue where R has been
26085 placed at the end.
26086
26087 @c Support_for_Locking_Policies
26088
26089 @node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
26090 @anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{41b}
26091 @subsection Support for Locking Policies
26092
26093
26094 This section specifies which policies specified by pragma Locking_Policy
26095 are supported on which platforms.
26096
26097 GNAT supports the standard @code{Ceiling_Locking} policy, and the
26098 implementation defined @code{Inheritance_Locking} and
26099 @code{Concurrent_Readers_Locking} policies.
26100
26101 @code{Ceiling_Locking} is supported on all platforms if the operating system
26102 supports it. In particular, @code{Ceiling_Locking} is not supported on
26103 VxWorks.
26104 @code{Inheritance_Locking} is supported on
26105 Linux,
26106 Darwin (Mac OS X),
26107 LynxOS 178,
26108 and VxWorks.
26109 @code{Concurrent_Readers_Locking} is supported on Linux.
26110
26111 Notes about @code{Ceiling_Locking} on Linux:
26112 If the process is running as 'root', ceiling locking is used.
26113 If the capabilities facility is installed
26114 ("sudo apt-get --assume-yes install libcap-dev" on Ubuntu,
26115 for example),
26116 and the program is linked against that library
26117 ("-largs -lcap"),
26118 and the executable file has the cap_sys_nice capability
26119 ("sudo /sbin/setcap cap_sys_nice=ep executable_file_name"),
26120 then ceiling locking is used.
26121 Otherwise, the @code{Ceiling_Locking} policy is ignored.
26122
26123 @node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
26124 @anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{41c}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{41d}
26125 @section GNAT Implementation of Shared Passive Packages
26126
26127
26128 @geindex Shared passive packages
26129
26130 GNAT fully implements the
26131 @geindex pragma Shared_Passive
26132 pragma
26133 @code{Shared_Passive} for
26134 the purpose of designating shared passive packages.
26135 This allows the use of passive partitions in the
26136 context described in the Ada Reference Manual; i.e., for communication
26137 between separate partitions of a distributed application using the
26138 features in Annex E.
26139
26140 @geindex Annex E
26141
26142 @geindex Distribution Systems Annex
26143
26144 However, the implementation approach used by GNAT provides for more
26145 extensive usage as follows:
26146
26147
26148 @table @asis
26149
26150 @item @emph{Communication between separate programs}
26151
26152 This allows separate programs to access the data in passive
26153 partitions, using protected objects for synchronization where
26154 needed. The only requirement is that the two programs have a
26155 common shared file system. It is even possible for programs
26156 running on different machines with different architectures
26157 (e.g., different endianness) to communicate via the data in
26158 a passive partition.
26159
26160 @item @emph{Persistence between program runs}
26161
26162 The data in a passive package can persist from one run of a
26163 program to another, so that a later program sees the final
26164 values stored by a previous run of the same program.
26165 @end table
26166
26167 The implementation approach used is to store the data in files. A
26168 separate stream file is created for each object in the package, and
26169 an access to an object causes the corresponding file to be read or
26170 written.
26171
26172 @geindex SHARED_MEMORY_DIRECTORY environment variable
26173
26174 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
26175 set to the directory to be used for these files.
26176 The files in this directory
26177 have names that correspond to their fully qualified names. For
26178 example, if we have the package
26179
26180 @example
26181 package X is
26182 pragma Shared_Passive (X);
26183 Y : Integer;
26184 Z : Float;
26185 end X;
26186 @end example
26187
26188 and the environment variable is set to @code{/stemp/}, then the files created
26189 will have the names:
26190
26191 @example
26192 /stemp/x.y
26193 /stemp/x.z
26194 @end example
26195
26196 These files are created when a value is initially written to the object, and
26197 the files are retained until manually deleted. This provides the persistence
26198 semantics. If no file exists, it means that no partition has assigned a value
26199 to the variable; in this case the initial value declared in the package
26200 will be used. This model ensures that there are no issues in synchronizing
26201 the elaboration process, since elaboration of passive packages elaborates the
26202 initial values, but does not create the files.
26203
26204 The files are written using normal @code{Stream_IO} access.
26205 If you want to be able
26206 to communicate between programs or partitions running on different
26207 architectures, then you should use the XDR versions of the stream attribute
26208 routines, since these are architecture independent.
26209
26210 If active synchronization is required for access to the variables in the
26211 shared passive package, then as described in the Ada Reference Manual, the
26212 package may contain protected objects used for this purpose. In this case
26213 a lock file (whose name is @code{___lock} (three underscores)
26214 is created in the shared memory directory.
26215
26216 @geindex ___lock file (for shared passive packages)
26217
26218 This is used to provide the required locking
26219 semantics for proper protected object synchronization.
26220
26221 GNAT supports shared passive packages on all platforms
26222 except for OpenVMS.
26223
26224 @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
26225 @anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{41e}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{41f}
26226 @section Code Generation for Array Aggregates
26227
26228
26229 Aggregates have a rich syntax and allow the user to specify the values of
26230 complex data structures by means of a single construct. As a result, the
26231 code generated for aggregates can be quite complex and involve loops, case
26232 statements and multiple assignments. In the simplest cases, however, the
26233 compiler will recognize aggregates whose components and constraints are
26234 fully static, and in those cases the compiler will generate little or no
26235 executable code. The following is an outline of the code that GNAT generates
26236 for various aggregate constructs. For further details, you will find it
26237 useful to examine the output produced by the -gnatG flag to see the expanded
26238 source that is input to the code generator. You may also want to examine
26239 the assembly code generated at various levels of optimization.
26240
26241 The code generated for aggregates depends on the context, the component values,
26242 and the type. In the context of an object declaration the code generated is
26243 generally simpler than in the case of an assignment. As a general rule, static
26244 component values and static subtypes also lead to simpler code.
26245
26246 @menu
26247 * Static constant aggregates with static bounds::
26248 * Constant aggregates with unconstrained nominal types::
26249 * Aggregates with static bounds::
26250 * Aggregates with nonstatic bounds::
26251 * Aggregates in assignment statements::
26252
26253 @end menu
26254
26255 @node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
26256 @anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{420}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{421}
26257 @subsection Static constant aggregates with static bounds
26258
26259
26260 For the declarations:
26261
26262 @example
26263 type One_Dim is array (1..10) of integer;
26264 ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
26265 @end example
26266
26267 GNAT generates no executable code: the constant ar0 is placed in static memory.
26268 The same is true for constant aggregates with named associations:
26269
26270 @example
26271 Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
26272 Cr3 : constant One_Dim := (others => 7777);
26273 @end example
26274
26275 The same is true for multidimensional constant arrays such as:
26276
26277 @example
26278 type two_dim is array (1..3, 1..3) of integer;
26279 Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
26280 @end example
26281
26282 The same is true for arrays of one-dimensional arrays: the following are
26283 static:
26284
26285 @example
26286 type ar1b is array (1..3) of boolean;
26287 type ar_ar is array (1..3) of ar1b;
26288 None : constant ar1b := (others => false); -- fully static
26289 None2 : constant ar_ar := (1..3 => None); -- fully static
26290 @end example
26291
26292 However, for multidimensional aggregates with named associations, GNAT will
26293 generate assignments and loops, even if all associations are static. The
26294 following two declarations generate a loop for the first dimension, and
26295 individual component assignments for the second dimension:
26296
26297 @example
26298 Zero1: constant two_dim := (1..3 => (1..3 => 0));
26299 Zero2: constant two_dim := (others => (others => 0));
26300 @end example
26301
26302 @node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
26303 @anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{422}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{423}
26304 @subsection Constant aggregates with unconstrained nominal types
26305
26306
26307 In such cases the aggregate itself establishes the subtype, so that
26308 associations with @code{others} cannot be used. GNAT determines the
26309 bounds for the actual subtype of the aggregate, and allocates the
26310 aggregate statically as well. No code is generated for the following:
26311
26312 @example
26313 type One_Unc is array (natural range <>) of integer;
26314 Cr_Unc : constant One_Unc := (12,24,36);
26315 @end example
26316
26317 @node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
26318 @anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{424}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{425}
26319 @subsection Aggregates with static bounds
26320
26321
26322 In all previous examples the aggregate was the initial (and immutable) value
26323 of a constant. If the aggregate initializes a variable, then code is generated
26324 for it as a combination of individual assignments and loops over the target
26325 object. The declarations
26326
26327 @example
26328 Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
26329 Cr_Var2 : One_Dim := (others > -1);
26330 @end example
26331
26332 generate the equivalent of
26333
26334 @example
26335 Cr_Var1 (1) := 2;
26336 Cr_Var1 (2) := 3;
26337 Cr_Var1 (3) := 5;
26338 Cr_Var1 (4) := 11;
26339
26340 for I in Cr_Var2'range loop
26341 Cr_Var2 (I) := -1;
26342 end loop;
26343 @end example
26344
26345 @node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
26346 @anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{426}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{427}
26347 @subsection Aggregates with nonstatic bounds
26348
26349
26350 If the bounds of the aggregate are not statically compatible with the bounds
26351 of the nominal subtype of the target, then constraint checks have to be
26352 generated on the bounds. For a multidimensional array, constraint checks may
26353 have to be applied to sub-arrays individually, if they do not have statically
26354 compatible subtypes.
26355
26356 @node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
26357 @anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{428}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{429}
26358 @subsection Aggregates in assignment statements
26359
26360
26361 In general, aggregate assignment requires the construction of a temporary,
26362 and a copy from the temporary to the target of the assignment. This is because
26363 it is not always possible to convert the assignment into a series of individual
26364 component assignments. For example, consider the simple case:
26365
26366 @example
26367 A := (A(2), A(1));
26368 @end example
26369
26370 This cannot be converted into:
26371
26372 @example
26373 A(1) := A(2);
26374 A(2) := A(1);
26375 @end example
26376
26377 So the aggregate has to be built first in a separate location, and then
26378 copied into the target. GNAT recognizes simple cases where this intermediate
26379 step is not required, and the assignments can be performed in place, directly
26380 into the target. The following sufficient criteria are applied:
26381
26382
26383 @itemize *
26384
26385 @item
26386 The bounds of the aggregate are static, and the associations are static.
26387
26388 @item
26389 The components of the aggregate are static constants, names of
26390 simple variables that are not renamings, or expressions not involving
26391 indexed components whose operands obey these rules.
26392 @end itemize
26393
26394 If any of these conditions are violated, the aggregate will be built in
26395 a temporary (created either by the front-end or the code generator) and then
26396 that temporary will be copied onto the target.
26397
26398 @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
26399 @anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{42a}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{42b}
26400 @section The Size of Discriminated Records with Default Discriminants
26401
26402
26403 If a discriminated type @code{T} has discriminants with default values, it is
26404 possible to declare an object of this type without providing an explicit
26405 constraint:
26406
26407 @example
26408 type Size is range 1..100;
26409
26410 type Rec (D : Size := 15) is record
26411 Name : String (1..D);
26412 end T;
26413
26414 Word : Rec;
26415 @end example
26416
26417 Such an object is said to be @emph{unconstrained}.
26418 The discriminant of the object
26419 can be modified by a full assignment to the object, as long as it preserves the
26420 relation between the value of the discriminant, and the value of the components
26421 that depend on it:
26422
26423 @example
26424 Word := (3, "yes");
26425
26426 Word := (5, "maybe");
26427
26428 Word := (5, "no"); -- raises Constraint_Error
26429 @end example
26430
26431 In order to support this behavior efficiently, an unconstrained object is
26432 given the maximum size that any value of the type requires. In the case
26433 above, @code{Word} has storage for the discriminant and for
26434 a @code{String} of length 100.
26435 It is important to note that unconstrained objects do not require dynamic
26436 allocation. It would be an improper implementation to place on the heap those
26437 components whose size depends on discriminants. (This improper implementation
26438 was used by some Ada83 compilers, where the @code{Name} component above
26439 would have
26440 been stored as a pointer to a dynamic string). Following the principle that
26441 dynamic storage management should never be introduced implicitly,
26442 an Ada compiler should reserve the full size for an unconstrained declared
26443 object, and place it on the stack.
26444
26445 This maximum size approach
26446 has been a source of surprise to some users, who expect the default
26447 values of the discriminants to determine the size reserved for an
26448 unconstrained object: "If the default is 15, why should the object occupy
26449 a larger size?"
26450 The answer, of course, is that the discriminant may be later modified,
26451 and its full range of values must be taken into account. This is why the
26452 declaration:
26453
26454 @example
26455 type Rec (D : Positive := 15) is record
26456 Name : String (1..D);
26457 end record;
26458
26459 Too_Large : Rec;
26460 @end example
26461
26462 is flagged by the compiler with a warning:
26463 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
26464 because the required size includes @code{Positive'Last}
26465 bytes. As the first example indicates, the proper approach is to declare an
26466 index type of 'reasonable' range so that unconstrained objects are not too
26467 large.
26468
26469 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
26470 created in the heap by means of an allocator, then it is @emph{not}
26471 unconstrained:
26472 it is constrained by the default values of the discriminants, and those values
26473 cannot be modified by full assignment. This is because in the presence of
26474 aliasing all views of the object (which may be manipulated by different tasks,
26475 say) must be consistent, so it is imperative that the object, once created,
26476 remain invariant.
26477
26478 @node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
26479 @anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{42c}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{42d}
26480 @section Strict Conformance to the Ada Reference Manual
26481
26482
26483 The dynamic semantics defined by the Ada Reference Manual impose a set of
26484 run-time checks to be generated. By default, the GNAT compiler will insert many
26485 run-time checks into the compiled code, including most of those required by the
26486 Ada Reference Manual. However, there are two checks that are not enabled in
26487 the default mode for efficiency reasons: checks for access before elaboration
26488 on subprogram calls, and stack overflow checking (most operating systems do not
26489 perform this check by default).
26490
26491 Strict conformance to the Ada Reference Manual can be achieved by adding two
26492 compiler options for dynamic checks for access-before-elaboration on subprogram
26493 calls and generic instantiations (@emph{-gnatE}), and stack overflow checking
26494 (@emph{-fstack-check}).
26495
26496 Note that the result of a floating point arithmetic operation in overflow and
26497 invalid situations, when the @code{Machine_Overflows} attribute of the result
26498 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
26499 case for machines compliant with the IEEE floating-point standard, but on
26500 machines that are not fully compliant with this standard, such as Alpha, the
26501 @emph{-mieee} compiler flag must be used for achieving IEEE confirming
26502 behavior (although at the cost of a significant performance penalty), so
26503 infinite and NaN values are properly generated.
26504
26505 @node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
26506 @anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{42e}@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{42f}
26507 @chapter Implementation of Ada 2012 Features
26508
26509
26510 @geindex Ada 2012 implementation status
26511
26512 @geindex -gnat12 option (gcc)
26513
26514 @geindex pragma Ada_2012
26515
26516 @geindex configuration pragma Ada_2012
26517
26518 @geindex Ada_2012 configuration pragma
26519
26520 This chapter contains a complete list of Ada 2012 features that have been
26521 implemented.
26522 Generally, these features are only
26523 available if the @emph{-gnat12} (Ada 2012 features enabled) option is set,
26524 which is the default behavior,
26525 or if the configuration pragma @code{Ada_2012} is used.
26526
26527 However, new pragmas, attributes, and restrictions are
26528 unconditionally available, since the Ada 95 standard allows the addition of
26529 new pragmas, attributes, and restrictions (there are exceptions, which are
26530 documented in the individual descriptions), and also certain packages
26531 were made available in earlier versions of Ada.
26532
26533 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
26534 This date shows the implementation date of the feature. Any wavefront
26535 subsequent to this date will contain the indicated feature, as will any
26536 subsequent releases. A date of 0000-00-00 means that GNAT has always
26537 implemented the feature, or implemented it as soon as it appeared as a
26538 binding interpretation.
26539
26540 Each feature corresponds to an Ada Issue ('AI') approved by the Ada
26541 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
26542 The features are ordered based on the relevant sections of the Ada
26543 Reference Manual ("RM"). When a given AI relates to multiple points
26544 in the RM, the earliest is used.
26545
26546 A complete description of the AIs may be found in
26547 @indicateurl{http://www.ada-auth.org/ai05-summary.html}.
26548
26549 @geindex AI-0176 (Ada 2012 feature)
26550
26551
26552 @itemize *
26553
26554 @item
26555 @emph{AI-0176 Quantified expressions (2010-09-29)}
26556
26557 Both universally and existentially quantified expressions are implemented.
26558 They use the new syntax for iterators proposed in AI05-139-2, as well as
26559 the standard Ada loop syntax.
26560
26561 RM References: 1.01.04 (12) 2.09 (2/2) 4.04 (7) 4.05.09 (0)
26562 @end itemize
26563
26564 @geindex AI-0079 (Ada 2012 feature)
26565
26566
26567 @itemize *
26568
26569 @item
26570 @emph{AI-0079 Allow other_format characters in source (2010-07-10)}
26571
26572 Wide characters in the unicode category @emph{other_format} are now allowed in
26573 source programs between tokens, but not within a token such as an identifier.
26574
26575 RM References: 2.01 (4/2) 2.02 (7)
26576 @end itemize
26577
26578 @geindex AI-0091 (Ada 2012 feature)
26579
26580
26581 @itemize *
26582
26583 @item
26584 @emph{AI-0091 Do not allow other_format in identifiers (0000-00-00)}
26585
26586 Wide characters in the unicode category @emph{other_format} are not permitted
26587 within an identifier, since this can be a security problem. The error
26588 message for this case has been improved to be more specific, but GNAT has
26589 never allowed such characters to appear in identifiers.
26590
26591 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)
26592 @end itemize
26593
26594 @geindex AI-0100 (Ada 2012 feature)
26595
26596
26597 @itemize *
26598
26599 @item
26600 @emph{AI-0100 Placement of pragmas (2010-07-01)}
26601
26602 This AI is an earlier version of AI-163. It simplifies the rules
26603 for legal placement of pragmas. In the case of lists that allow pragmas, if
26604 the list may have no elements, then the list may consist solely of pragmas.
26605
26606 RM References: 2.08 (7)
26607 @end itemize
26608
26609 @geindex AI-0163 (Ada 2012 feature)
26610
26611
26612 @itemize *
26613
26614 @item
26615 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
26616
26617 A statement sequence may be composed entirely of pragmas. It is no longer
26618 necessary to add a dummy @code{null} statement to make the sequence legal.
26619
26620 RM References: 2.08 (7) 2.08 (16)
26621 @end itemize
26622
26623 @geindex AI-0080 (Ada 2012 feature)
26624
26625
26626 @itemize *
26627
26628 @item
26629 @emph{AI-0080 'View of' not needed if clear from context (0000-00-00)}
26630
26631 This is an editorial change only, described as non-testable in the AI.
26632
26633 RM References: 3.01 (7)
26634 @end itemize
26635
26636 @geindex AI-0183 (Ada 2012 feature)
26637
26638
26639 @itemize *
26640
26641 @item
26642 @emph{AI-0183 Aspect specifications (2010-08-16)}
26643
26644 Aspect specifications have been fully implemented except for pre and post-
26645 conditions, and type invariants, which have their own separate AI's. All
26646 forms of declarations listed in the AI are supported. The following is a
26647 list of the aspects supported (with GNAT implementation aspects marked)
26648 @end itemize
26649
26650
26651 @multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxx}
26652 @headitem
26653
26654 Supported Aspect
26655
26656 @tab
26657
26658 Source
26659
26660 @item
26661
26662 @code{Ada_2005}
26663
26664 @tab
26665
26666 -- GNAT
26667
26668 @item
26669
26670 @code{Ada_2012}
26671
26672 @tab
26673
26674 -- GNAT
26675
26676 @item
26677
26678 @code{Address}
26679
26680 @tab
26681
26682 @item
26683
26684 @code{Alignment}
26685
26686 @tab
26687
26688 @item
26689
26690 @code{Atomic}
26691
26692 @tab
26693
26694 @item
26695
26696 @code{Atomic_Components}
26697
26698 @tab
26699
26700 @item
26701
26702 @code{Bit_Order}
26703
26704 @tab
26705
26706 @item
26707
26708 @code{Component_Size}
26709
26710 @tab
26711
26712 @item
26713
26714 @code{Contract_Cases}
26715
26716 @tab
26717
26718 -- GNAT
26719
26720 @item
26721
26722 @code{Discard_Names}
26723
26724 @tab
26725
26726 @item
26727
26728 @code{External_Tag}
26729
26730 @tab
26731
26732 @item
26733
26734 @code{Favor_Top_Level}
26735
26736 @tab
26737
26738 -- GNAT
26739
26740 @item
26741
26742 @code{Inline}
26743
26744 @tab
26745
26746 @item
26747
26748 @code{Inline_Always}
26749
26750 @tab
26751
26752 -- GNAT
26753
26754 @item
26755
26756 @code{Invariant}
26757
26758 @tab
26759
26760 -- GNAT
26761
26762 @item
26763
26764 @code{Machine_Radix}
26765
26766 @tab
26767
26768 @item
26769
26770 @code{No_Return}
26771
26772 @tab
26773
26774 @item
26775
26776 @code{Object_Size}
26777
26778 @tab
26779
26780 -- GNAT
26781
26782 @item
26783
26784 @code{Pack}
26785
26786 @tab
26787
26788 @item
26789
26790 @code{Persistent_BSS}
26791
26792 @tab
26793
26794 -- GNAT
26795
26796 @item
26797
26798 @code{Post}
26799
26800 @tab
26801
26802 @item
26803
26804 @code{Pre}
26805
26806 @tab
26807
26808 @item
26809
26810 @code{Predicate}
26811
26812 @tab
26813
26814 @item
26815
26816 @code{Preelaborable_Initialization}
26817
26818 @tab
26819
26820 @item
26821
26822 @code{Pure_Function}
26823
26824 @tab
26825
26826 -- GNAT
26827
26828 @item
26829
26830 @code{Remote_Access_Type}
26831
26832 @tab
26833
26834 -- GNAT
26835
26836 @item
26837
26838 @code{Shared}
26839
26840 @tab
26841
26842 -- GNAT
26843
26844 @item
26845
26846 @code{Size}
26847
26848 @tab
26849
26850 @item
26851
26852 @code{Storage_Pool}
26853
26854 @tab
26855
26856 @item
26857
26858 @code{Storage_Size}
26859
26860 @tab
26861
26862 @item
26863
26864 @code{Stream_Size}
26865
26866 @tab
26867
26868 @item
26869
26870 @code{Suppress}
26871
26872 @tab
26873
26874 @item
26875
26876 @code{Suppress_Debug_Info}
26877
26878 @tab
26879
26880 -- GNAT
26881
26882 @item
26883
26884 @code{Test_Case}
26885
26886 @tab
26887
26888 -- GNAT
26889
26890 @item
26891
26892 @code{Thread_Local_Storage}
26893
26894 @tab
26895
26896 -- GNAT
26897
26898 @item
26899
26900 @code{Type_Invariant}
26901
26902 @tab
26903
26904 @item
26905
26906 @code{Unchecked_Union}
26907
26908 @tab
26909
26910 @item
26911
26912 @code{Universal_Aliasing}
26913
26914 @tab
26915
26916 -- GNAT
26917
26918 @item
26919
26920 @code{Unmodified}
26921
26922 @tab
26923
26924 -- GNAT
26925
26926 @item
26927
26928 @code{Unreferenced}
26929
26930 @tab
26931
26932 -- GNAT
26933
26934 @item
26935
26936 @code{Unreferenced_Objects}
26937
26938 @tab
26939
26940 -- GNAT
26941
26942 @item
26943
26944 @code{Unsuppress}
26945
26946 @tab
26947
26948 @item
26949
26950 @code{Value_Size}
26951
26952 @tab
26953
26954 -- GNAT
26955
26956 @item
26957
26958 @code{Volatile}
26959
26960 @tab
26961
26962 @item
26963
26964 @code{Volatile_Components}
26965
26966 @tab
26967
26968 @item
26969
26970 @code{Warnings}
26971
26972 @tab
26973
26974 -- GNAT
26975
26976 @end multitable
26977
26978
26979 @quotation
26980
26981 Note that for aspects with an expression, e.g. @code{Size}, the expression is
26982 treated like a default expression (visibility is analyzed at the point of
26983 occurrence of the aspect, but evaluation of the expression occurs at the
26984 freeze point of the entity involved).
26985
26986 RM References: 3.02.01 (3) 3.02.02 (2) 3.03.01 (2/2) 3.08 (6)
26987 3.09.03 (1.1/2) 6.01 (2/2) 6.07 (2/2) 9.05.02 (2/2) 7.01 (3) 7.03
26988 (2) 7.03 (3) 9.01 (2/2) 9.01 (3/2) 9.04 (2/2) 9.04 (3/2)
26989 9.05.02 (2/2) 11.01 (2) 12.01 (3) 12.03 (2/2) 12.04 (2/2) 12.05 (2)
26990 12.06 (2.1/2) 12.06 (2.2/2) 12.07 (2) 13.01 (0.1/2) 13.03 (5/1)
26991 13.03.01 (0)
26992 @end quotation
26993
26994 @geindex AI-0128 (Ada 2012 feature)
26995
26996
26997 @itemize *
26998
26999 @item
27000 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
27001
27002 If an equality operator ("=") is declared for a type, then the implicitly
27003 declared inequality operator ("/=") is a primitive operation of the type.
27004 This is the only reasonable interpretation, and is the one always implemented
27005 by GNAT, but the RM was not entirely clear in making this point.
27006
27007 RM References: 3.02.03 (6) 6.06 (6)
27008 @end itemize
27009
27010 @geindex AI-0003 (Ada 2012 feature)
27011
27012
27013 @itemize *
27014
27015 @item
27016 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
27017
27018 In Ada 2012, a qualified expression is considered to be syntactically a name,
27019 meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
27020 useful in disambiguating some cases of overloading.
27021
27022 RM References: 3.03 (11) 3.03 (21) 4.01 (2) 4.04 (7) 4.07 (3)
27023 5.04 (7)
27024 @end itemize
27025
27026 @geindex AI-0120 (Ada 2012 feature)
27027
27028
27029 @itemize *
27030
27031 @item
27032 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
27033
27034 This is an RM editorial change only. The section that lists objects that are
27035 constant failed to include the current instance of a protected object
27036 within a protected function. This has always been treated as a constant
27037 in GNAT.
27038
27039 RM References: 3.03 (21)
27040 @end itemize
27041
27042 @geindex AI-0008 (Ada 2012 feature)
27043
27044
27045 @itemize *
27046
27047 @item
27048 @emph{AI-0008 General access to constrained objects (0000-00-00)}
27049
27050 The wording in the RM implied that if you have a general access to a
27051 constrained object, it could be used to modify the discriminants. This was
27052 obviously not intended. @code{Constraint_Error} should be raised, and GNAT
27053 has always done so in this situation.
27054
27055 RM References: 3.03 (23) 3.10.02 (26/2) 4.01 (9) 6.04.01 (17) 8.05.01 (5/2)
27056 @end itemize
27057
27058 @geindex AI-0093 (Ada 2012 feature)
27059
27060
27061 @itemize *
27062
27063 @item
27064 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
27065
27066 This is an editorial change only, to make more widespread use of the Ada 2012
27067 'immutably limited'.
27068
27069 RM References: 3.03 (23.4/3)
27070 @end itemize
27071
27072 @geindex AI-0096 (Ada 2012 feature)
27073
27074
27075 @itemize *
27076
27077 @item
27078 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
27079
27080 In general it is illegal for a type derived from a formal limited type to be
27081 nonlimited. This AI makes an exception to this rule: derivation is legal
27082 if it appears in the private part of the generic, and the formal type is not
27083 tagged. If the type is tagged, the legality check must be applied to the
27084 private part of the package.
27085
27086 RM References: 3.04 (5.1/2) 6.02 (7)
27087 @end itemize
27088
27089 @geindex AI-0181 (Ada 2012 feature)
27090
27091
27092 @itemize *
27093
27094 @item
27095 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
27096
27097 From Ada 2005 on, soft hyphen is considered a non-graphic character, which
27098 means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
27099 @code{Image} and @code{Value} attributes for the character types. Strictly
27100 speaking this is an inconsistency with Ada 95, but in practice the use of
27101 these attributes is so obscure that it will not cause problems.
27102
27103 RM References: 3.05.02 (2/2) A.01 (35/2) A.03.03 (21)
27104 @end itemize
27105
27106 @geindex AI-0182 (Ada 2012 feature)
27107
27108
27109 @itemize *
27110
27111 @item
27112 @emph{AI-0182 Additional forms for} @code{Character'Value} @emph{(0000-00-00)}
27113
27114 This AI allows @code{Character'Value} to accept the string @code{'?'} where
27115 @code{?} is any character including non-graphic control characters. GNAT has
27116 always accepted such strings. It also allows strings such as
27117 @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
27118 permission and raises @code{Constraint_Error}, as is certainly still
27119 permitted.
27120
27121 RM References: 3.05 (56/2)
27122 @end itemize
27123
27124 @geindex AI-0214 (Ada 2012 feature)
27125
27126
27127 @itemize *
27128
27129 @item
27130 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
27131
27132 Ada 2012 relaxes the restriction that forbids discriminants of tagged types
27133 to have default expressions by allowing them when the type is limited. It
27134 is often useful to define a default value for a discriminant even though
27135 it can't be changed by assignment.
27136
27137 RM References: 3.07 (9.1/2) 3.07.02 (3)
27138 @end itemize
27139
27140 @geindex AI-0102 (Ada 2012 feature)
27141
27142
27143 @itemize *
27144
27145 @item
27146 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
27147
27148 It is illegal to assign an anonymous access constant to an anonymous access
27149 variable. The RM did not have a clear rule to prevent this, but GNAT has
27150 always generated an error for this usage.
27151
27152 RM References: 3.07 (16) 3.07.01 (9) 6.04.01 (6) 8.06 (27/2)
27153 @end itemize
27154
27155 @geindex AI-0158 (Ada 2012 feature)
27156
27157
27158 @itemize *
27159
27160 @item
27161 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
27162
27163 This AI extends the syntax of membership tests to simplify complex conditions
27164 that can be expressed as membership in a subset of values of any type. It
27165 introduces syntax for a list of expressions that may be used in loop contexts
27166 as well.
27167
27168 RM References: 3.08.01 (5) 4.04 (3) 4.05.02 (3) 4.05.02 (5) 4.05.02 (27)
27169 @end itemize
27170
27171 @geindex AI-0173 (Ada 2012 feature)
27172
27173
27174 @itemize *
27175
27176 @item
27177 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
27178
27179 The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
27180 with the tag of an abstract type, and @code{False} otherwise.
27181
27182 RM References: 3.09 (7.4/2) 3.09 (12.4/2)
27183 @end itemize
27184
27185 @geindex AI-0076 (Ada 2012 feature)
27186
27187
27188 @itemize *
27189
27190 @item
27191 @emph{AI-0076 function with controlling result (0000-00-00)}
27192
27193 This is an editorial change only. The RM defines calls with controlling
27194 results, but uses the term 'function with controlling result' without an
27195 explicit definition.
27196
27197 RM References: 3.09.02 (2/2)
27198 @end itemize
27199
27200 @geindex AI-0126 (Ada 2012 feature)
27201
27202
27203 @itemize *
27204
27205 @item
27206 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
27207
27208 This AI clarifies dispatching rules, and simply confirms that dispatching
27209 executes the operation of the parent type when there is no explicitly or
27210 implicitly declared operation for the descendant type. This has always been
27211 the case in all versions of GNAT.
27212
27213 RM References: 3.09.02 (20/2) 3.09.02 (20.1/2) 3.09.02 (20.2/2)
27214 @end itemize
27215
27216 @geindex AI-0097 (Ada 2012 feature)
27217
27218
27219 @itemize *
27220
27221 @item
27222 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
27223
27224 The RM as written implied that in some cases it was possible to create an
27225 object of an abstract type, by having an abstract extension inherit a non-
27226 abstract constructor from its parent type. This mistake has been corrected
27227 in GNAT and in the RM, and this construct is now illegal.
27228
27229 RM References: 3.09.03 (4/2)
27230 @end itemize
27231
27232 @geindex AI-0203 (Ada 2012 feature)
27233
27234
27235 @itemize *
27236
27237 @item
27238 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
27239
27240 A return_subtype_indication cannot denote an abstract subtype. GNAT has never
27241 permitted such usage.
27242
27243 RM References: 3.09.03 (8/3)
27244 @end itemize
27245
27246 @geindex AI-0198 (Ada 2012 feature)
27247
27248
27249 @itemize *
27250
27251 @item
27252 @emph{AI-0198 Inheriting abstract operators (0000-00-00)}
27253
27254 This AI resolves a conflict between two rules involving inherited abstract
27255 operations and predefined operators. If a derived numeric type inherits
27256 an abstract operator, it overrides the predefined one. This interpretation
27257 was always the one implemented in GNAT.
27258
27259 RM References: 3.09.03 (4/3)
27260 @end itemize
27261
27262 @geindex AI-0073 (Ada 2012 feature)
27263
27264
27265 @itemize *
27266
27267 @item
27268 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
27269
27270 This AI covers a number of issues regarding returning abstract types. In
27271 particular generic functions cannot have abstract result types or access
27272 result types designated an abstract type. There are some other cases which
27273 are detailed in the AI. Note that this binding interpretation has not been
27274 retrofitted to operate before Ada 2012 mode, since it caused a significant
27275 number of regressions.
27276
27277 RM References: 3.09.03 (8) 3.09.03 (10) 6.05 (8/2)
27278 @end itemize
27279
27280 @geindex AI-0070 (Ada 2012 feature)
27281
27282
27283 @itemize *
27284
27285 @item
27286 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
27287
27288 This is an editorial change only, there are no testable consequences short of
27289 checking for the absence of generated code for an interface declaration.
27290
27291 RM References: 3.09.04 (18/2)
27292 @end itemize
27293
27294 @geindex AI-0208 (Ada 2012 feature)
27295
27296
27297 @itemize *
27298
27299 @item
27300 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
27301
27302 The wording in the Ada 2005 RM concerning characteristics of incomplete views
27303 was incorrect and implied that some programs intended to be legal were now
27304 illegal. GNAT had never considered such programs illegal, so it has always
27305 implemented the intent of this AI.
27306
27307 RM References: 3.10.01 (2.4/2) 3.10.01 (2.6/2)
27308 @end itemize
27309
27310 @geindex AI-0162 (Ada 2012 feature)
27311
27312
27313 @itemize *
27314
27315 @item
27316 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
27317
27318 Incomplete types are made more useful by allowing them to be completed by
27319 private types and private extensions.
27320
27321 RM References: 3.10.01 (2.5/2) 3.10.01 (2.6/2) 3.10.01 (3) 3.10.01 (4/2)
27322 @end itemize
27323
27324 @geindex AI-0098 (Ada 2012 feature)
27325
27326
27327 @itemize *
27328
27329 @item
27330 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
27331
27332 An unintentional omission in the RM implied some inconsistent restrictions on
27333 the use of anonymous access to subprogram values. These restrictions were not
27334 intentional, and have never been enforced by GNAT.
27335
27336 RM References: 3.10.01 (6) 3.10.01 (9.2/2)
27337 @end itemize
27338
27339 @geindex AI-0199 (Ada 2012 feature)
27340
27341
27342 @itemize *
27343
27344 @item
27345 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
27346
27347 A choice list in a record aggregate can include several components of
27348 (distinct) anonymous access types as long as they have matching designated
27349 subtypes.
27350
27351 RM References: 4.03.01 (16)
27352 @end itemize
27353
27354 @geindex AI-0220 (Ada 2012 feature)
27355
27356
27357 @itemize *
27358
27359 @item
27360 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
27361
27362 This AI addresses a wording problem in the RM that appears to permit some
27363 complex cases of aggregates with nonstatic discriminants. GNAT has always
27364 implemented the intended semantics.
27365
27366 RM References: 4.03.01 (17)
27367 @end itemize
27368
27369 @geindex AI-0147 (Ada 2012 feature)
27370
27371
27372 @itemize *
27373
27374 @item
27375 @emph{AI-0147 Conditional expressions (2009-03-29)}
27376
27377 Conditional expressions are permitted. The form of such an expression is:
27378
27379 @example
27380 (if expr then expr @{elsif expr then expr@} [else expr])
27381 @end example
27382
27383 The parentheses can be omitted in contexts where parentheses are present
27384 anyway, such as subprogram arguments and pragma arguments. If the @strong{else}
27385 clause is omitted, @strong{else} @emph{True} is assumed;
27386 thus @code{(if A then B)} is a way to conveniently represent
27387 @emph{(A implies B)} in standard logic.
27388
27389 RM References: 4.03.03 (15) 4.04 (1) 4.04 (7) 4.05.07 (0) 4.07 (2)
27390 4.07 (3) 4.09 (12) 4.09 (33) 5.03 (3) 5.03 (4) 7.05 (2.1/2)
27391 @end itemize
27392
27393 @geindex AI-0037 (Ada 2012 feature)
27394
27395
27396 @itemize *
27397
27398 @item
27399 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
27400
27401 This AI confirms that an association of the form @code{Indx => <>} in an
27402 array aggregate must raise @code{Constraint_Error} if @code{Indx}
27403 is out of range. The RM specified a range check on other associations, but
27404 not when the value of the association was defaulted. GNAT has always inserted
27405 a constraint check on the index value.
27406
27407 RM References: 4.03.03 (29)
27408 @end itemize
27409
27410 @geindex AI-0123 (Ada 2012 feature)
27411
27412
27413 @itemize *
27414
27415 @item
27416 @emph{AI-0123 Composability of equality (2010-04-13)}
27417
27418 Equality of untagged record composes, so that the predefined equality for a
27419 composite type that includes a component of some untagged record type
27420 @code{R} uses the equality operation of @code{R} (which may be user-defined
27421 or predefined). This makes the behavior of untagged records identical to that
27422 of tagged types in this respect.
27423
27424 This change is an incompatibility with previous versions of Ada, but it
27425 corrects a non-uniformity that was often a source of confusion. Analysis of
27426 a large number of industrial programs indicates that in those rare cases
27427 where a composite type had an untagged record component with a user-defined
27428 equality, either there was no use of the composite equality, or else the code
27429 expected the same composability as for tagged types, and thus had a bug that
27430 would be fixed by this change.
27431
27432 RM References: 4.05.02 (9.7/2) 4.05.02 (14) 4.05.02 (15) 4.05.02 (24)
27433 8.05.04 (8)
27434 @end itemize
27435
27436 @geindex AI-0088 (Ada 2012 feature)
27437
27438
27439 @itemize *
27440
27441 @item
27442 @emph{AI-0088 The value of exponentiation (0000-00-00)}
27443
27444 This AI clarifies the equivalence rule given for the dynamic semantics of
27445 exponentiation: the value of the operation can be obtained by repeated
27446 multiplication, but the operation can be implemented otherwise (for example
27447 using the familiar divide-by-two-and-square algorithm, even if this is less
27448 accurate), and does not imply repeated reads of a volatile base.
27449
27450 RM References: 4.05.06 (11)
27451 @end itemize
27452
27453 @geindex AI-0188 (Ada 2012 feature)
27454
27455
27456 @itemize *
27457
27458 @item
27459 @emph{AI-0188 Case expressions (2010-01-09)}
27460
27461 Case expressions are permitted. This allows use of constructs such as:
27462
27463 @example
27464 X := (case Y is when 1 => 2, when 2 => 3, when others => 31)
27465 @end example
27466
27467 RM References: 4.05.07 (0) 4.05.08 (0) 4.09 (12) 4.09 (33)
27468 @end itemize
27469
27470 @geindex AI-0104 (Ada 2012 feature)
27471
27472
27473 @itemize *
27474
27475 @item
27476 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
27477
27478 The assignment @code{Ptr := new not null Some_Ptr;} will raise
27479 @code{Constraint_Error} because the default value of the allocated object is
27480 @strong{null}. This useless construct is illegal in Ada 2012.
27481
27482 RM References: 4.08 (2)
27483 @end itemize
27484
27485 @geindex AI-0157 (Ada 2012 feature)
27486
27487
27488 @itemize *
27489
27490 @item
27491 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
27492
27493 Allocation and Deallocation from an empty storage pool (i.e. allocation or
27494 deallocation of a pointer for which a static storage size clause of zero
27495 has been given) is now illegal and is detected as such. GNAT
27496 previously gave a warning but not an error.
27497
27498 RM References: 4.08 (5.3/2) 13.11.02 (4) 13.11.02 (17)
27499 @end itemize
27500
27501 @geindex AI-0179 (Ada 2012 feature)
27502
27503
27504 @itemize *
27505
27506 @item
27507 @emph{AI-0179 Statement not required after label (2010-04-10)}
27508
27509 It is not necessary to have a statement following a label, so a label
27510 can appear at the end of a statement sequence without the need for putting a
27511 null statement afterwards, but it is not allowable to have only labels and
27512 no real statements in a statement sequence.
27513
27514 RM References: 5.01 (2)
27515 @end itemize
27516
27517 @geindex AI-0139-2 (Ada 2012 feature)
27518
27519
27520 @itemize *
27521
27522 @item
27523 @emph{AI-0139-2 Syntactic sugar for iterators (2010-09-29)}
27524
27525 The new syntax for iterating over arrays and containers is now implemented.
27526 Iteration over containers is for now limited to read-only iterators. Only
27527 default iterators are supported, with the syntax: @code{for Elem of C}.
27528
27529 RM References: 5.05
27530 @end itemize
27531
27532 @geindex AI-0134 (Ada 2012 feature)
27533
27534
27535 @itemize *
27536
27537 @item
27538 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
27539
27540 For full conformance, the profiles of anonymous-access-to-subprogram
27541 parameters must match. GNAT has always enforced this rule.
27542
27543 RM References: 6.03.01 (18)
27544 @end itemize
27545
27546 @geindex AI-0207 (Ada 2012 feature)
27547
27548
27549 @itemize *
27550
27551 @item
27552 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
27553
27554 This AI confirms that access_to_constant indication must match for mode
27555 conformance. This was implemented in GNAT when the qualifier was originally
27556 introduced in Ada 2005.
27557
27558 RM References: 6.03.01 (16/2)
27559 @end itemize
27560
27561 @geindex AI-0046 (Ada 2012 feature)
27562
27563
27564 @itemize *
27565
27566 @item
27567 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
27568
27569 For full conformance, in the case of access parameters, the null exclusion
27570 must match (either both or neither must have @code{not null}).
27571
27572 RM References: 6.03.02 (18)
27573 @end itemize
27574
27575 @geindex AI-0118 (Ada 2012 feature)
27576
27577
27578 @itemize *
27579
27580 @item
27581 @emph{AI-0118 The association of parameter associations (0000-00-00)}
27582
27583 This AI clarifies the rules for named associations in subprogram calls and
27584 generic instantiations. The rules have been in place since Ada 83.
27585
27586 RM References: 6.04.01 (2) 12.03 (9)
27587 @end itemize
27588
27589 @geindex AI-0196 (Ada 2012 feature)
27590
27591
27592 @itemize *
27593
27594 @item
27595 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
27596
27597 Null exclusion checks are not made for @code{out} parameters when
27598 evaluating the actual parameters. GNAT has never generated these checks.
27599
27600 RM References: 6.04.01 (13)
27601 @end itemize
27602
27603 @geindex AI-0015 (Ada 2012 feature)
27604
27605
27606 @itemize *
27607
27608 @item
27609 @emph{AI-0015 Constant return objects (0000-00-00)}
27610
27611 The return object declared in an @emph{extended_return_statement} may be
27612 declared constant. This was always intended, and GNAT has always allowed it.
27613
27614 RM References: 6.05 (2.1/2) 3.03 (10/2) 3.03 (21) 6.05 (5/2)
27615 6.05 (5.7/2)
27616 @end itemize
27617
27618 @geindex AI-0032 (Ada 2012 feature)
27619
27620
27621 @itemize *
27622
27623 @item
27624 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
27625
27626 If a function returns a class-wide type, the object of an extended return
27627 statement can be declared with a specific type that is covered by the class-
27628 wide type. This has been implemented in GNAT since the introduction of
27629 extended returns. Note AI-0103 complements this AI by imposing matching
27630 rules for constrained return types.
27631
27632 RM References: 6.05 (5.2/2) 6.05 (5.3/2) 6.05 (5.6/2) 6.05 (5.8/2)
27633 6.05 (8/2)
27634 @end itemize
27635
27636 @geindex AI-0103 (Ada 2012 feature)
27637
27638
27639 @itemize *
27640
27641 @item
27642 @emph{AI-0103 Static matching for extended return (2010-07-23)}
27643
27644 If the return subtype of a function is an elementary type or a constrained
27645 type, the subtype indication in an extended return statement must match
27646 statically this return subtype.
27647
27648 RM References: 6.05 (5.2/2)
27649 @end itemize
27650
27651 @geindex AI-0058 (Ada 2012 feature)
27652
27653
27654 @itemize *
27655
27656 @item
27657 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
27658
27659 The RM had some incorrect wording implying wrong treatment of abnormal
27660 completion in an extended return. GNAT has always implemented the intended
27661 correct semantics as described by this AI.
27662
27663 RM References: 6.05 (22/2)
27664 @end itemize
27665
27666 @geindex AI-0050 (Ada 2012 feature)
27667
27668
27669 @itemize *
27670
27671 @item
27672 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
27673
27674 The implementation permissions for raising @code{Constraint_Error} early on a function call
27675 when it was clear an exception would be raised were over-permissive and allowed
27676 mishandling of discriminants in some cases. GNAT did
27677 not take advantage of these incorrect permissions in any case.
27678
27679 RM References: 6.05 (24/2)
27680 @end itemize
27681
27682 @geindex AI-0125 (Ada 2012 feature)
27683
27684
27685 @itemize *
27686
27687 @item
27688 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
27689
27690 In Ada 2012, the declaration of a primitive operation of a type extension
27691 or private extension can also override an inherited primitive that is not
27692 visible at the point of this declaration.
27693
27694 RM References: 7.03.01 (6) 8.03 (23) 8.03.01 (5/2) 8.03.01 (6/2)
27695 @end itemize
27696
27697 @geindex AI-0062 (Ada 2012 feature)
27698
27699
27700 @itemize *
27701
27702 @item
27703 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
27704
27705 A full constant may have a null exclusion even if its associated deferred
27706 constant does not. GNAT has always allowed this.
27707
27708 RM References: 7.04 (6/2) 7.04 (7.1/2)
27709 @end itemize
27710
27711 @geindex AI-0178 (Ada 2012 feature)
27712
27713
27714 @itemize *
27715
27716 @item
27717 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
27718
27719 This AI clarifies the role of incomplete views and plugs an omission in the
27720 RM. GNAT always correctly restricted the use of incomplete views and types.
27721
27722 RM References: 7.05 (3/2) 7.05 (6/2)
27723 @end itemize
27724
27725 @geindex AI-0087 (Ada 2012 feature)
27726
27727
27728 @itemize *
27729
27730 @item
27731 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
27732
27733 The actual for a formal nonlimited derived type cannot be limited. In
27734 particular, a formal derived type that extends a limited interface but which
27735 is not explicitly limited cannot be instantiated with a limited type.
27736
27737 RM References: 7.05 (5/2) 12.05.01 (5.1/2)
27738 @end itemize
27739
27740 @geindex AI-0099 (Ada 2012 feature)
27741
27742
27743 @itemize *
27744
27745 @item
27746 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
27747
27748 This AI clarifies that 'needs finalization' is part of dynamic semantics,
27749 and therefore depends on the run-time characteristics of an object (i.e. its
27750 tag) and not on its nominal type. As the AI indicates: "we do not expect
27751 this to affect any implementation'@w{'}.
27752
27753 RM References: 7.06.01 (6) 7.06.01 (7) 7.06.01 (8) 7.06.01 (9/2)
27754 @end itemize
27755
27756 @geindex AI-0064 (Ada 2012 feature)
27757
27758
27759 @itemize *
27760
27761 @item
27762 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
27763
27764 This is an editorial change only. The intended behavior is already checked
27765 by an existing ACATS test, which GNAT has always executed correctly.
27766
27767 RM References: 7.06.01 (17.1/1)
27768 @end itemize
27769
27770 @geindex AI-0026 (Ada 2012 feature)
27771
27772
27773 @itemize *
27774
27775 @item
27776 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
27777
27778 Record representation clauses concerning Unchecked_Union types cannot mention
27779 the discriminant of the type. The type of a component declared in the variant
27780 part of an Unchecked_Union cannot be controlled, have controlled components,
27781 nor have protected or task parts. If an Unchecked_Union type is declared
27782 within the body of a generic unit or its descendants, then the type of a
27783 component declared in the variant part cannot be a formal private type or a
27784 formal private extension declared within the same generic unit.
27785
27786 RM References: 7.06 (9.4/2) B.03.03 (9/2) B.03.03 (10/2)
27787 @end itemize
27788
27789 @geindex AI-0205 (Ada 2012 feature)
27790
27791
27792 @itemize *
27793
27794 @item
27795 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
27796
27797 This AI corrects a simple omission in the RM. Return objects have always
27798 been visible within an extended return statement.
27799
27800 RM References: 8.03 (17)
27801 @end itemize
27802
27803 @geindex AI-0042 (Ada 2012 feature)
27804
27805
27806 @itemize *
27807
27808 @item
27809 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
27810
27811 This AI fixes a wording gap in the RM. An operation of a synchronized
27812 interface can be implemented by a protected or task entry, but the abstract
27813 operation is not being overridden in the usual sense, and it must be stated
27814 separately that this implementation is legal. This has always been the case
27815 in GNAT.
27816
27817 RM References: 9.01 (9.2/2) 9.04 (11.1/2)
27818 @end itemize
27819
27820 @geindex AI-0030 (Ada 2012 feature)
27821
27822
27823 @itemize *
27824
27825 @item
27826 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
27827
27828 Requeue is permitted to a protected, synchronized or task interface primitive
27829 providing it is known that the overriding operation is an entry. Otherwise
27830 the requeue statement has the same effect as a procedure call. Use of pragma
27831 @code{Implemented} provides a way to impose a static requirement on the
27832 overriding operation by adhering to one of the implementation kinds: entry,
27833 protected procedure or any of the above.
27834
27835 RM References: 9.05 (9) 9.05.04 (2) 9.05.04 (3) 9.05.04 (5)
27836 9.05.04 (6) 9.05.04 (7) 9.05.04 (12)
27837 @end itemize
27838
27839 @geindex AI-0201 (Ada 2012 feature)
27840
27841
27842 @itemize *
27843
27844 @item
27845 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
27846
27847 If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
27848 attribute, then individual components may not be addressable by independent
27849 tasks. However, if the representation clause has no effect (is confirming),
27850 then independence is not compromised. Furthermore, in GNAT, specification of
27851 other appropriately addressable component sizes (e.g. 16 for 8-bit
27852 characters) also preserves independence. GNAT now gives very clear warnings
27853 both for the declaration of such a type, and for any assignment to its components.
27854
27855 RM References: 9.10 (1/3) C.06 (22/2) C.06 (23/2)
27856 @end itemize
27857
27858 @geindex AI-0009 (Ada 2012 feature)
27859
27860
27861 @itemize *
27862
27863 @item
27864 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
27865
27866 This AI introduces the new pragmas @code{Independent} and
27867 @code{Independent_Components},
27868 which control guaranteeing independence of access to objects and components.
27869 The AI also requires independence not unaffected by confirming rep clauses.
27870
27871 RM References: 9.10 (1) 13.01 (15/1) 13.02 (9) 13.03 (13) C.06 (2)
27872 C.06 (4) C.06 (6) C.06 (9) C.06 (13) C.06 (14)
27873 @end itemize
27874
27875 @geindex AI-0072 (Ada 2012 feature)
27876
27877
27878 @itemize *
27879
27880 @item
27881 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
27882
27883 This AI clarifies that task signalling for reading @code{'Terminated} only
27884 occurs if the result is True. GNAT semantics has always been consistent with
27885 this notion of task signalling.
27886
27887 RM References: 9.10 (6.1/1)
27888 @end itemize
27889
27890 @geindex AI-0108 (Ada 2012 feature)
27891
27892
27893 @itemize *
27894
27895 @item
27896 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
27897
27898 This AI confirms that an incomplete type from a limited view does not have
27899 discriminants. This has always been the case in GNAT.
27900
27901 RM References: 10.01.01 (12.3/2)
27902 @end itemize
27903
27904 @geindex AI-0129 (Ada 2012 feature)
27905
27906
27907 @itemize *
27908
27909 @item
27910 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
27911
27912 This AI clarifies the description of limited views: a limited view of a
27913 package includes only one view of a type that has an incomplete declaration
27914 and a full declaration (there is no possible ambiguity in a client package).
27915 This AI also fixes an omission: a nested package in the private part has no
27916 limited view. GNAT always implemented this correctly.
27917
27918 RM References: 10.01.01 (12.2/2) 10.01.01 (12.3/2)
27919 @end itemize
27920
27921 @geindex AI-0077 (Ada 2012 feature)
27922
27923
27924 @itemize *
27925
27926 @item
27927 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
27928
27929 This AI clarifies that a declaration does not include a context clause,
27930 and confirms that it is illegal to have a context in which both a limited
27931 and a nonlimited view of a package are accessible. Such double visibility
27932 was always rejected by GNAT.
27933
27934 RM References: 10.01.02 (12/2) 10.01.02 (21/2) 10.01.02 (22/2)
27935 @end itemize
27936
27937 @geindex AI-0122 (Ada 2012 feature)
27938
27939
27940 @itemize *
27941
27942 @item
27943 @emph{AI-0122 Private with and children of generics (0000-00-00)}
27944
27945 This AI clarifies the visibility of private children of generic units within
27946 instantiations of a parent. GNAT has always handled this correctly.
27947
27948 RM References: 10.01.02 (12/2)
27949 @end itemize
27950
27951 @geindex AI-0040 (Ada 2012 feature)
27952
27953
27954 @itemize *
27955
27956 @item
27957 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
27958
27959 This AI confirms that a limited with clause in a child unit cannot name
27960 an ancestor of the unit. This has always been checked in GNAT.
27961
27962 RM References: 10.01.02 (20/2)
27963 @end itemize
27964
27965 @geindex AI-0132 (Ada 2012 feature)
27966
27967
27968 @itemize *
27969
27970 @item
27971 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
27972
27973 This AI fills a gap in the description of library unit pragmas. The pragma
27974 clearly must apply to a library unit, even if it does not carry the name
27975 of the enclosing unit. GNAT has always enforced the required check.
27976
27977 RM References: 10.01.05 (7)
27978 @end itemize
27979
27980 @geindex AI-0034 (Ada 2012 feature)
27981
27982
27983 @itemize *
27984
27985 @item
27986 @emph{AI-0034 Categorization of limited views (0000-00-00)}
27987
27988 The RM makes certain limited with clauses illegal because of categorization
27989 considerations, when the corresponding normal with would be legal. This is
27990 not intended, and GNAT has always implemented the recommended behavior.
27991
27992 RM References: 10.02.01 (11/1) 10.02.01 (17/2)
27993 @end itemize
27994
27995 @geindex AI-0035 (Ada 2012 feature)
27996
27997
27998 @itemize *
27999
28000 @item
28001 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
28002
28003 This AI remedies some inconsistencies in the legality rules for Pure units.
28004 Derived access types are legal in a pure unit (on the assumption that the
28005 rule for a zero storage pool size has been enforced on the ancestor type).
28006 The rules are enforced in generic instances and in subunits. GNAT has always
28007 implemented the recommended behavior.
28008
28009 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)
28010 @end itemize
28011
28012 @geindex AI-0219 (Ada 2012 feature)
28013
28014
28015 @itemize *
28016
28017 @item
28018 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
28019
28020 This AI refines the rules for the cases with limited parameters which do not
28021 allow the implementations to omit 'redundant'. GNAT now properly conforms
28022 to the requirements of this binding interpretation.
28023
28024 RM References: 10.02.01 (18/2)
28025 @end itemize
28026
28027 @geindex AI-0043 (Ada 2012 feature)
28028
28029
28030 @itemize *
28031
28032 @item
28033 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
28034
28035 This AI covers various omissions in the RM regarding the raising of
28036 exceptions. GNAT has always implemented the intended semantics.
28037
28038 RM References: 11.04.01 (10.1/2) 11 (2)
28039 @end itemize
28040
28041 @geindex AI-0200 (Ada 2012 feature)
28042
28043
28044 @itemize *
28045
28046 @item
28047 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
28048
28049 This AI plugs a gap in the RM which appeared to allow some obviously intended
28050 illegal instantiations. GNAT has never allowed these instantiations.
28051
28052 RM References: 12.07 (16)
28053 @end itemize
28054
28055 @geindex AI-0112 (Ada 2012 feature)
28056
28057
28058 @itemize *
28059
28060 @item
28061 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
28062
28063 This AI concerns giving names to various representation aspects, but the
28064 practical effect is simply to make the use of duplicate
28065 @code{Atomic[_Components]},
28066 @code{Volatile[_Components]}, and
28067 @code{Independent[_Components]} pragmas illegal, and GNAT
28068 now performs this required check.
28069
28070 RM References: 13.01 (8)
28071 @end itemize
28072
28073 @geindex AI-0106 (Ada 2012 feature)
28074
28075
28076 @itemize *
28077
28078 @item
28079 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
28080
28081 The RM appeared to allow representation pragmas on generic formal parameters,
28082 but this was not intended, and GNAT has never permitted this usage.
28083
28084 RM References: 13.01 (9.1/1)
28085 @end itemize
28086
28087 @geindex AI-0012 (Ada 2012 feature)
28088
28089
28090 @itemize *
28091
28092 @item
28093 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
28094
28095 It is now illegal to give an inappropriate component size or a pragma
28096 @code{Pack} that attempts to change the component size in the case of atomic
28097 or aliased components. Previously GNAT ignored such an attempt with a
28098 warning.
28099
28100 RM References: 13.02 (6.1/2) 13.02 (7) C.06 (10) C.06 (11) C.06 (21)
28101 @end itemize
28102
28103 @geindex AI-0039 (Ada 2012 feature)
28104
28105
28106 @itemize *
28107
28108 @item
28109 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
28110
28111 The RM permitted the use of dynamic expressions (such as @code{ptr.all})`
28112 for stream attributes, but these were never useful and are now illegal. GNAT
28113 has always regarded such expressions as illegal.
28114
28115 RM References: 13.03 (4) 13.03 (6) 13.13.02 (38/2)
28116 @end itemize
28117
28118 @geindex AI-0095 (Ada 2012 feature)
28119
28120
28121 @itemize *
28122
28123 @item
28124 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
28125
28126 The prefix of @code{'Address} cannot statically denote a subprogram with
28127 convention @code{Intrinsic}. The use of the @code{Address} attribute raises
28128 @code{Program_Error} if the prefix denotes a subprogram with convention
28129 @code{Intrinsic}.
28130
28131 RM References: 13.03 (11/1)
28132 @end itemize
28133
28134 @geindex AI-0116 (Ada 2012 feature)
28135
28136
28137 @itemize *
28138
28139 @item
28140 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
28141
28142 This AI requires that the alignment of a class-wide object be no greater
28143 than the alignment of any type in the class. GNAT has always followed this
28144 recommendation.
28145
28146 RM References: 13.03 (29) 13.11 (16)
28147 @end itemize
28148
28149 @geindex AI-0146 (Ada 2012 feature)
28150
28151
28152 @itemize *
28153
28154 @item
28155 @emph{AI-0146 Type invariants (2009-09-21)}
28156
28157 Type invariants may be specified for private types using the aspect notation.
28158 Aspect @code{Type_Invariant} may be specified for any private type,
28159 @code{Type_Invariant'Class} can
28160 only be specified for tagged types, and is inherited by any descendent of the
28161 tagged types. The invariant is a boolean expression that is tested for being
28162 true in the following situations: conversions to the private type, object
28163 declarations for the private type that are default initialized, and
28164 [@strong{in}] @strong{out}
28165 parameters and returned result on return from any primitive operation for
28166 the type that is visible to a client.
28167 GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
28168 @code{Invariant'Class} for @code{Type_Invariant'Class}.
28169
28170 RM References: 13.03.03 (00)
28171 @end itemize
28172
28173 @geindex AI-0078 (Ada 2012 feature)
28174
28175
28176 @itemize *
28177
28178 @item
28179 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
28180
28181 In Ada 2012, compilers are required to support unchecked conversion where the
28182 target alignment is a multiple of the source alignment. GNAT always supported
28183 this case (and indeed all cases of differing alignments, doing copies where
28184 required if the alignment was reduced).
28185
28186 RM References: 13.09 (7)
28187 @end itemize
28188
28189 @geindex AI-0195 (Ada 2012 feature)
28190
28191
28192 @itemize *
28193
28194 @item
28195 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
28196
28197 The handling of invalid values is now designated to be implementation
28198 defined. This is a documentation change only, requiring Annex M in the GNAT
28199 Reference Manual to document this handling.
28200 In GNAT, checks for invalid values are made
28201 only when necessary to avoid erroneous behavior. Operations like assignments
28202 which cannot cause erroneous behavior ignore the possibility of invalid
28203 values and do not do a check. The date given above applies only to the
28204 documentation change, this behavior has always been implemented by GNAT.
28205
28206 RM References: 13.09.01 (10)
28207 @end itemize
28208
28209 @geindex AI-0193 (Ada 2012 feature)
28210
28211
28212 @itemize *
28213
28214 @item
28215 @emph{AI-0193 Alignment of allocators (2010-09-16)}
28216
28217 This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
28218 analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
28219 of size.
28220
28221 RM References: 13.11 (16) 13.11 (21) 13.11.01 (0) 13.11.01 (1)
28222 13.11.01 (2) 13.11.01 (3)
28223 @end itemize
28224
28225 @geindex AI-0177 (Ada 2012 feature)
28226
28227
28228 @itemize *
28229
28230 @item
28231 @emph{AI-0177 Parameterized expressions (2010-07-10)}
28232
28233 The new Ada 2012 notion of parameterized expressions is implemented. The form
28234 is:
28235
28236 @example
28237 function-specification is (expression)
28238 @end example
28239
28240 This is exactly equivalent to the
28241 corresponding function body that returns the expression, but it can appear
28242 in a package spec. Note that the expression must be parenthesized.
28243
28244 RM References: 13.11.01 (3/2)
28245 @end itemize
28246
28247 @geindex AI-0033 (Ada 2012 feature)
28248
28249
28250 @itemize *
28251
28252 @item
28253 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
28254
28255 Neither of these two pragmas may appear within a generic template, because
28256 the generic might be instantiated at other than the library level.
28257
28258 RM References: 13.11.02 (16) C.03.01 (7/2) C.03.01 (8/2)
28259 @end itemize
28260
28261 @geindex AI-0161 (Ada 2012 feature)
28262
28263
28264 @itemize *
28265
28266 @item
28267 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
28268
28269 A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
28270 of the default stream attributes for elementary types. If this restriction is
28271 in force, then it is necessary to provide explicit subprograms for any
28272 stream attributes used.
28273
28274 RM References: 13.12.01 (4/2) 13.13.02 (40/2) 13.13.02 (52/2)
28275 @end itemize
28276
28277 @geindex AI-0194 (Ada 2012 feature)
28278
28279
28280 @itemize *
28281
28282 @item
28283 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
28284
28285 The @code{Stream_Size} attribute returns the default number of bits in the
28286 stream representation of the given type.
28287 This value is not affected by the presence
28288 of stream subprogram attributes for the type. GNAT has always implemented
28289 this interpretation.
28290
28291 RM References: 13.13.02 (1.2/2)
28292 @end itemize
28293
28294 @geindex AI-0109 (Ada 2012 feature)
28295
28296
28297 @itemize *
28298
28299 @item
28300 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
28301
28302 This AI is an editorial change only. It removes the need for a tag check
28303 that can never fail.
28304
28305 RM References: 13.13.02 (34/2)
28306 @end itemize
28307
28308 @geindex AI-0007 (Ada 2012 feature)
28309
28310
28311 @itemize *
28312
28313 @item
28314 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
28315
28316 The RM as written appeared to limit the possibilities of declaring read
28317 attribute procedures for private scalar types. This limitation was not
28318 intended, and has never been enforced by GNAT.
28319
28320 RM References: 13.13.02 (50/2) 13.13.02 (51/2)
28321 @end itemize
28322
28323 @geindex AI-0065 (Ada 2012 feature)
28324
28325
28326 @itemize *
28327
28328 @item
28329 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
28330
28331 This AI clarifies the fact that all remote access types support external
28332 streaming. This fixes an obvious oversight in the definition of the
28333 language, and GNAT always implemented the intended correct rules.
28334
28335 RM References: 13.13.02 (52/2)
28336 @end itemize
28337
28338 @geindex AI-0019 (Ada 2012 feature)
28339
28340
28341 @itemize *
28342
28343 @item
28344 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
28345
28346 The RM suggests that primitive subprograms of a specific tagged type are
28347 frozen when the tagged type is frozen. This would be an incompatible change
28348 and is not intended. GNAT has never attempted this kind of freezing and its
28349 behavior is consistent with the recommendation of this AI.
28350
28351 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)
28352 @end itemize
28353
28354 @geindex AI-0017 (Ada 2012 feature)
28355
28356
28357 @itemize *
28358
28359 @item
28360 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
28361
28362 So-called 'Taft-amendment types' (i.e., types that are completed in package
28363 bodies) are not frozen by the occurrence of bodies in the
28364 enclosing declarative part. GNAT always implemented this properly.
28365
28366 RM References: 13.14 (3/1)
28367 @end itemize
28368
28369 @geindex AI-0060 (Ada 2012 feature)
28370
28371
28372 @itemize *
28373
28374 @item
28375 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
28376
28377 This AI extends the definition of remote access types to include access
28378 to limited, synchronized, protected or task class-wide interface types.
28379 GNAT already implemented this extension.
28380
28381 RM References: A (4) E.02.02 (9/1) E.02.02 (9.2/1) E.02.02 (14/2) E.02.02 (18)
28382 @end itemize
28383
28384 @geindex AI-0114 (Ada 2012 feature)
28385
28386
28387 @itemize *
28388
28389 @item
28390 @emph{AI-0114 Classification of letters (0000-00-00)}
28391
28392 The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
28393 181 (@code{MICRO SIGN}), and
28394 186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
28395 lower case letters by Unicode.
28396 However, they are not allowed in identifiers, and they
28397 return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
28398 This behavior is consistent with that defined in Ada 95.
28399
28400 RM References: A.03.02 (59) A.04.06 (7)
28401 @end itemize
28402
28403 @geindex AI-0185 (Ada 2012 feature)
28404
28405
28406 @itemize *
28407
28408 @item
28409 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
28410
28411 Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
28412 classification functions for @code{Wide_Character} and
28413 @code{Wide_Wide_Character}, as well as providing
28414 case folding routines for @code{Wide_[Wide_]Character} and
28415 @code{Wide_[Wide_]String}.
28416
28417 RM References: A.03.05 (0) A.03.06 (0)
28418 @end itemize
28419
28420 @geindex AI-0031 (Ada 2012 feature)
28421
28422
28423 @itemize *
28424
28425 @item
28426 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
28427
28428 A new version of @code{Find_Token} is added to all relevant string packages,
28429 with an extra parameter @code{From}. Instead of starting at the first
28430 character of the string, the search for a matching Token starts at the
28431 character indexed by the value of @code{From}.
28432 These procedures are available in all versions of Ada
28433 but if used in versions earlier than Ada 2012 they will generate a warning
28434 that an Ada 2012 subprogram is being used.
28435
28436 RM References: A.04.03 (16) A.04.03 (67) A.04.03 (68/1) A.04.04 (51)
28437 A.04.05 (46)
28438 @end itemize
28439
28440 @geindex AI-0056 (Ada 2012 feature)
28441
28442
28443 @itemize *
28444
28445 @item
28446 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
28447
28448 The wording in the Ada 2005 RM implied an incompatible handling of the
28449 @code{Index} functions, resulting in raising an exception instead of
28450 returning zero in some situations.
28451 This was not intended and has been corrected.
28452 GNAT always returned zero, and is thus consistent with this AI.
28453
28454 RM References: A.04.03 (56.2/2) A.04.03 (58.5/2)
28455 @end itemize
28456
28457 @geindex AI-0137 (Ada 2012 feature)
28458
28459
28460 @itemize *
28461
28462 @item
28463 @emph{AI-0137 String encoding package (2010-03-25)}
28464
28465 The packages @code{Ada.Strings.UTF_Encoding}, together with its child
28466 packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
28467 and @code{Wide_Wide_Strings} have been
28468 implemented. These packages (whose documentation can be found in the spec
28469 files @code{a-stuten.ads}, @code{a-suenco.ads}, @code{a-suenst.ads},
28470 @code{a-suewst.ads}, @code{a-suezst.ads}) allow encoding and decoding of
28471 @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
28472 values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
28473 UTF-16), as well as conversions between the different UTF encodings. With
28474 the exception of @code{Wide_Wide_Strings}, these packages are available in
28475 Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
28476 The @code{Wide_Wide_Strings} package
28477 is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
28478 mode since it uses @code{Wide_Wide_Character}).
28479
28480 RM References: A.04.11
28481 @end itemize
28482
28483 @geindex AI-0038 (Ada 2012 feature)
28484
28485
28486 @itemize *
28487
28488 @item
28489 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
28490
28491 These are minor errors in the description on three points. The intent on
28492 all these points has always been clear, and GNAT has always implemented the
28493 correct intended semantics.
28494
28495 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)
28496 @end itemize
28497
28498 @geindex AI-0044 (Ada 2012 feature)
28499
28500
28501 @itemize *
28502
28503 @item
28504 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
28505
28506 This AI places restrictions on allowed instantiations of generic containers.
28507 These restrictions are not checked by the compiler, so there is nothing to
28508 change in the implementation. This affects only the RM documentation.
28509
28510 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)
28511 @end itemize
28512
28513 @geindex AI-0127 (Ada 2012 feature)
28514
28515
28516 @itemize *
28517
28518 @item
28519 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
28520
28521 This package provides an interface for identifying the current locale.
28522
28523 RM References: A.19 A.19.01 A.19.02 A.19.03 A.19.05 A.19.06
28524 A.19.07 A.19.08 A.19.09 A.19.10 A.19.11 A.19.12 A.19.13
28525 @end itemize
28526
28527 @geindex AI-0002 (Ada 2012 feature)
28528
28529
28530 @itemize *
28531
28532 @item
28533 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
28534
28535 The compiler is not required to support exporting an Ada subprogram with
28536 convention C if there are parameters or a return type of an unconstrained
28537 array type (such as @code{String}). GNAT allows such declarations but
28538 generates warnings. It is possible, but complicated, to write the
28539 corresponding C code and certainly such code would be specific to GNAT and
28540 non-portable.
28541
28542 RM References: B.01 (17) B.03 (62) B.03 (71.1/2)
28543 @end itemize
28544
28545 @geindex AI05-0216 (Ada 2012 feature)
28546
28547
28548 @itemize *
28549
28550 @item
28551 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
28552
28553 It is clearly the intention that @code{No_Task_Hierarchy} is intended to
28554 forbid tasks declared locally within subprograms, or functions returning task
28555 objects, and that is the implementation that GNAT has always provided.
28556 However the language in the RM was not sufficiently clear on this point.
28557 Thus this is a documentation change in the RM only.
28558
28559 RM References: D.07 (3/3)
28560 @end itemize
28561
28562 @geindex AI-0211 (Ada 2012 feature)
28563
28564
28565 @itemize *
28566
28567 @item
28568 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
28569
28570 The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
28571 @code{Ada.Real_Time.Timing_Events.Set_Handler}.
28572
28573 RM References: D.07 (5) D.07 (10/2) D.07 (10.4/2) D.07 (10.7/2)
28574 @end itemize
28575
28576 @geindex AI-0190 (Ada 2012 feature)
28577
28578
28579 @itemize *
28580
28581 @item
28582 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
28583
28584 This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
28585 used to control storage pools globally.
28586 In particular, you can force every access
28587 type that is used for allocation (@strong{new}) to have an explicit storage pool,
28588 or you can declare a pool globally to be used for all access types that lack
28589 an explicit one.
28590
28591 RM References: D.07 (8)
28592 @end itemize
28593
28594 @geindex AI-0189 (Ada 2012 feature)
28595
28596
28597 @itemize *
28598
28599 @item
28600 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
28601
28602 This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
28603 which says that no dynamic allocation will occur once elaboration is
28604 completed.
28605 In general this requires a run-time check, which is not required, and which
28606 GNAT does not attempt. But the static cases of allocators in a task body or
28607 in the body of the main program are detected and flagged at compile or bind
28608 time.
28609
28610 RM References: D.07 (19.1/2) H.04 (23.3/2)
28611 @end itemize
28612
28613 @geindex AI-0171 (Ada 2012 feature)
28614
28615
28616 @itemize *
28617
28618 @item
28619 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
28620
28621 A new package @code{System.Multiprocessors} is added, together with the
28622 definition of pragma @code{CPU} for controlling task affinity. A new no
28623 dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
28624 is added to the Ravenscar profile.
28625
28626 RM References: D.13.01 (4/2) D.16
28627 @end itemize
28628
28629 @geindex AI-0210 (Ada 2012 feature)
28630
28631
28632 @itemize *
28633
28634 @item
28635 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
28636
28637 This is a documentation only issue regarding wording of metric requirements,
28638 that does not affect the implementation of the compiler.
28639
28640 RM References: D.15 (24/2)
28641 @end itemize
28642
28643 @geindex AI-0206 (Ada 2012 feature)
28644
28645
28646 @itemize *
28647
28648 @item
28649 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
28650
28651 Remote types packages are now allowed to depend on preelaborated packages.
28652 This was formerly considered illegal.
28653
28654 RM References: E.02.02 (6)
28655 @end itemize
28656
28657 @geindex AI-0152 (Ada 2012 feature)
28658
28659
28660 @itemize *
28661
28662 @item
28663 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
28664
28665 Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
28666 where the type of the returned value is an anonymous access type.
28667
28668 RM References: H.04 (8/1)
28669 @end itemize
28670
28671 @node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
28672 @anchor{gnat_rm/obsolescent_features id1}@anchor{430}@anchor{gnat_rm/obsolescent_features doc}@anchor{431}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
28673 @chapter Obsolescent Features
28674
28675
28676 This chapter describes features that are provided by GNAT, but are
28677 considered obsolescent since there are preferred ways of achieving
28678 the same effect. These features are provided solely for historical
28679 compatibility purposes.
28680
28681 @menu
28682 * pragma No_Run_Time::
28683 * pragma Ravenscar::
28684 * pragma Restricted_Run_Time::
28685 * pragma Task_Info::
28686 * package System.Task_Info (s-tasinf.ads): package System Task_Info s-tasinf ads.
28687
28688 @end menu
28689
28690 @node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
28691 @anchor{gnat_rm/obsolescent_features id2}@anchor{432}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{433}
28692 @section pragma No_Run_Time
28693
28694
28695 The pragma @code{No_Run_Time} is used to achieve an affect similar
28696 to the use of the "Zero Foot Print" configurable run time, but without
28697 requiring a specially configured run time. The result of using this
28698 pragma, which must be used for all units in a partition, is to restrict
28699 the use of any language features requiring run-time support code. The
28700 preferred usage is to use an appropriately configured run-time that
28701 includes just those features that are to be made accessible.
28702
28703 @node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
28704 @anchor{gnat_rm/obsolescent_features id3}@anchor{434}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{435}
28705 @section pragma Ravenscar
28706
28707
28708 The pragma @code{Ravenscar} has exactly the same effect as pragma
28709 @code{Profile (Ravenscar)}. The latter usage is preferred since it
28710 is part of the new Ada 2005 standard.
28711
28712 @node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
28713 @anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{436}@anchor{gnat_rm/obsolescent_features id4}@anchor{437}
28714 @section pragma Restricted_Run_Time
28715
28716
28717 The pragma @code{Restricted_Run_Time} has exactly the same effect as
28718 pragma @code{Profile (Restricted)}. The latter usage is
28719 preferred since the Ada 2005 pragma @code{Profile} is intended for
28720 this kind of implementation dependent addition.
28721
28722 @node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
28723 @anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{438}@anchor{gnat_rm/obsolescent_features id5}@anchor{439}
28724 @section pragma Task_Info
28725
28726
28727 The functionality provided by pragma @code{Task_Info} is now part of the
28728 Ada language. The @code{CPU} aspect and the package
28729 @code{System.Multiprocessors} offer a less system-dependent way to specify
28730 task affinity or to query the number of processsors.
28731
28732 Syntax
28733
28734 @example
28735 pragma Task_Info (EXPRESSION);
28736 @end example
28737
28738 This pragma appears within a task definition (like pragma
28739 @code{Priority}) and applies to the task in which it appears. The
28740 argument must be of type @code{System.Task_Info.Task_Info_Type}.
28741 The @code{Task_Info} pragma provides system dependent control over
28742 aspects of tasking implementation, for example, the ability to map
28743 tasks to specific processors. For details on the facilities available
28744 for the version of GNAT that you are using, see the documentation
28745 in the spec of package System.Task_Info in the runtime
28746 library.
28747
28748 @node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
28749 @anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{43a}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{43b}
28750 @section package System.Task_Info (@code{s-tasinf.ads})
28751
28752
28753 This package provides target dependent functionality that is used
28754 to support the @code{Task_Info} pragma. The predefined Ada package
28755 @code{System.Multiprocessors} and the @code{CPU} aspect now provide a
28756 standard replacement for GNAT's @code{Task_Info} functionality.
28757
28758 @node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
28759 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{43c}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{43d}
28760 @chapter Compatibility and Porting Guide
28761
28762
28763 This chapter presents some guidelines for developing portable Ada code,
28764 describes the compatibility issues that may arise between
28765 GNAT and other Ada compilation systems (including those for Ada 83),
28766 and shows how GNAT can expedite porting
28767 applications developed in other Ada environments.
28768
28769 @menu
28770 * Writing Portable Fixed-Point Declarations::
28771 * Compatibility with Ada 83::
28772 * Compatibility between Ada 95 and Ada 2005::
28773 * Implementation-dependent characteristics::
28774 * Compatibility with Other Ada Systems::
28775 * Representation Clauses::
28776 * Compatibility with HP Ada 83::
28777
28778 @end menu
28779
28780 @node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
28781 @anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{43e}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{43f}
28782 @section Writing Portable Fixed-Point Declarations
28783
28784
28785 The Ada Reference Manual gives an implementation freedom to choose bounds
28786 that are narrower by @code{Small} from the given bounds.
28787 For example, if we write
28788
28789 @example
28790 type F1 is delta 1.0 range -128.0 .. +128.0;
28791 @end example
28792
28793 then the implementation is allowed to choose -128.0 .. +127.0 if it
28794 likes, but is not required to do so.
28795
28796 This leads to possible portability problems, so let's have a closer
28797 look at this, and figure out how to avoid these problems.
28798
28799 First, why does this freedom exist, and why would an implementation
28800 take advantage of it? To answer this, take a closer look at the type
28801 declaration for @code{F1} above. If the compiler uses the given bounds,
28802 it would need 9 bits to hold the largest positive value (and typically
28803 that means 16 bits on all machines). But if the implementation chooses
28804 the +127.0 bound then it can fit values of the type in 8 bits.
28805
28806 Why not make the user write +127.0 if that's what is wanted?
28807 The rationale is that if you are thinking of fixed point
28808 as a kind of 'poor man's floating-point', then you don't want
28809 to be thinking about the scaled integers that are used in its
28810 representation. Let's take another example:
28811
28812 @example
28813 type F2 is delta 2.0**(-15) range -1.0 .. +1.0;
28814 @end example
28815
28816 Looking at this declaration, it seems casually as though
28817 it should fit in 16 bits, but again that extra positive value
28818 +1.0 has the scaled integer equivalent of 2**15 which is one too
28819 big for signed 16 bits. The implementation can treat this as:
28820
28821 @example
28822 type F2 is delta 2.0**(-15) range -1.0 .. +1.0-(2.0**(-15));
28823 @end example
28824
28825 and the Ada language design team felt that this was too annoying
28826 to require. We don't need to debate this decision at this point,
28827 since it is well established (the rule about narrowing the ranges
28828 dates to Ada 83).
28829
28830 But the important point is that an implementation is not required
28831 to do this narrowing, so we have a potential portability problem.
28832 We could imagine three types of implementation:
28833
28834
28835 @enumerate a
28836
28837 @item
28838 those that narrow the range automatically if they can figure
28839 out that the narrower range will allow storage in a smaller machine unit,
28840
28841 @item
28842 those that will narrow only if forced to by a @code{'Size} clause, and
28843
28844 @item
28845 those that will never narrow.
28846 @end enumerate
28847
28848 Now if we are language theoreticians, we can imagine a fourth
28849 approach: to narrow all the time, e.g. to treat
28850
28851 @example
28852 type F3 is delta 1.0 range -10.0 .. +23.0;
28853 @end example
28854
28855 as though it had been written:
28856
28857 @example
28858 type F3 is delta 1.0 range -9.0 .. +22.0;
28859 @end example
28860
28861 But although technically allowed, such a behavior would be hostile and silly,
28862 and no real compiler would do this. All real compilers will fall into one of
28863 the categories (a), (b) or (c) above.
28864
28865 So, how do you get the compiler to do what you want? The answer is give the
28866 actual bounds you want, and then use a @code{'Small} clause and a
28867 @code{'Size} clause to absolutely pin down what the compiler does.
28868 E.g., for @code{F2} above, we will write:
28869
28870 @example
28871 My_Small : constant := 2.0**(-15);
28872 My_First : constant := -1.0;
28873 My_Last : constant := +1.0 - My_Small;
28874
28875 type F2 is delta My_Small range My_First .. My_Last;
28876 @end example
28877
28878 and then add
28879
28880 @example
28881 for F2'Small use my_Small;
28882 for F2'Size use 16;
28883 @end example
28884
28885 In practice all compilers will do the same thing here and will give you
28886 what you want, so the above declarations are fully portable. If you really
28887 want to play language lawyer and guard against ludicrous behavior by the
28888 compiler you could add
28889
28890 @example
28891 Test1 : constant := 1 / Boolean'Pos (F2'First = My_First);
28892 Test2 : constant := 1 / Boolean'Pos (F2'Last = My_Last);
28893 @end example
28894
28895 One or other or both are allowed to be illegal if the compiler is
28896 behaving in a silly manner, but at least the silly compiler will not
28897 get away with silently messing with your (very clear) intentions.
28898
28899 If you follow this scheme you will be guaranteed that your fixed-point
28900 types will be portable.
28901
28902 @node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
28903 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{440}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{441}
28904 @section Compatibility with Ada 83
28905
28906
28907 @geindex Compatibility (between Ada 83 and Ada 95 / Ada 2005 / Ada 2012)
28908
28909 Ada 95 and the subsequent revisions Ada 2005 and Ada 2012
28910 are highly upwards compatible with Ada 83. In
28911 particular, the design intention was that the difficulties associated
28912 with moving from Ada 83 to later versions of the standard should be no greater
28913 than those that occur when moving from one Ada 83 system to another.
28914
28915 However, there are a number of points at which there are minor
28916 incompatibilities. The @cite{Ada 95 Annotated Reference Manual} contains
28917 full details of these issues as they relate to Ada 95,
28918 and should be consulted for a complete treatment.
28919 In practice the
28920 following subsections treat the most likely issues to be encountered.
28921
28922 @menu
28923 * Legal Ada 83 programs that are illegal in Ada 95::
28924 * More deterministic semantics::
28925 * Changed semantics::
28926 * Other language compatibility issues::
28927
28928 @end menu
28929
28930 @node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
28931 @anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{442}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{443}
28932 @subsection Legal Ada 83 programs that are illegal in Ada 95
28933
28934
28935 Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
28936 Ada 95 and later versions of the standard:
28937
28938
28939 @itemize *
28940
28941 @item
28942 @emph{Character literals}
28943
28944 Some uses of character literals are ambiguous. Since Ada 95 has introduced
28945 @code{Wide_Character} as a new predefined character type, some uses of
28946 character literals that were legal in Ada 83 are illegal in Ada 95.
28947 For example:
28948
28949 @example
28950 for Char in 'A' .. 'Z' loop ... end loop;
28951 @end example
28952
28953 The problem is that 'A' and 'Z' could be from either
28954 @code{Character} or @code{Wide_Character}. The simplest correction
28955 is to make the type explicit; e.g.:
28956
28957 @example
28958 for Char in Character range 'A' .. 'Z' loop ... end loop;
28959 @end example
28960
28961 @item
28962 @emph{New reserved words}
28963
28964 The identifiers @code{abstract}, @code{aliased}, @code{protected},
28965 @code{requeue}, @code{tagged}, and @code{until} are reserved in Ada 95.
28966 Existing Ada 83 code using any of these identifiers must be edited to
28967 use some alternative name.
28968
28969 @item
28970 @emph{Freezing rules}
28971
28972 The rules in Ada 95 are slightly different with regard to the point at
28973 which entities are frozen, and representation pragmas and clauses are
28974 not permitted past the freeze point. This shows up most typically in
28975 the form of an error message complaining that a representation item
28976 appears too late, and the appropriate corrective action is to move
28977 the item nearer to the declaration of the entity to which it refers.
28978
28979 A particular case is that representation pragmas
28980 cannot be applied to a subprogram body. If necessary, a separate subprogram
28981 declaration must be introduced to which the pragma can be applied.
28982
28983 @item
28984 @emph{Optional bodies for library packages}
28985
28986 In Ada 83, a package that did not require a package body was nevertheless
28987 allowed to have one. This lead to certain surprises in compiling large
28988 systems (situations in which the body could be unexpectedly ignored by the
28989 binder). In Ada 95, if a package does not require a body then it is not
28990 permitted to have a body. To fix this problem, simply remove a redundant
28991 body if it is empty, or, if it is non-empty, introduce a dummy declaration
28992 into the spec that makes the body required. One approach is to add a private
28993 part to the package declaration (if necessary), and define a parameterless
28994 procedure called @code{Requires_Body}, which must then be given a dummy
28995 procedure body in the package body, which then becomes required.
28996 Another approach (assuming that this does not introduce elaboration
28997 circularities) is to add an @code{Elaborate_Body} pragma to the package spec,
28998 since one effect of this pragma is to require the presence of a package body.
28999
29000 @item
29001 @emph{Numeric_Error is the same exception as Constraint_Error}
29002
29003 In Ada 95, the exception @code{Numeric_Error} is a renaming of @code{Constraint_Error}.
29004 This means that it is illegal to have separate exception handlers for
29005 the two exceptions. The fix is simply to remove the handler for the
29006 @code{Numeric_Error} case (since even in Ada 83, a compiler was free to raise
29007 @code{Constraint_Error} in place of @code{Numeric_Error} in all cases).
29008
29009 @item
29010 @emph{Indefinite subtypes in generics}
29011
29012 In Ada 83, it was permissible to pass an indefinite type (e.g, @code{String})
29013 as the actual for a generic formal private type, but then the instantiation
29014 would be illegal if there were any instances of declarations of variables
29015 of this type in the generic body. In Ada 95, to avoid this clear violation
29016 of the methodological principle known as the 'contract model',
29017 the generic declaration explicitly indicates whether
29018 or not such instantiations are permitted. If a generic formal parameter
29019 has explicit unknown discriminants, indicated by using @code{(<>)} after the
29020 subtype name, then it can be instantiated with indefinite types, but no
29021 stand-alone variables can be declared of this type. Any attempt to declare
29022 such a variable will result in an illegality at the time the generic is
29023 declared. If the @code{(<>)} notation is not used, then it is illegal
29024 to instantiate the generic with an indefinite type.
29025 This is the potential incompatibility issue when porting Ada 83 code to Ada 95.
29026 It will show up as a compile time error, and
29027 the fix is usually simply to add the @code{(<>)} to the generic declaration.
29028 @end itemize
29029
29030 @node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
29031 @anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{444}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{445}
29032 @subsection More deterministic semantics
29033
29034
29035
29036 @itemize *
29037
29038 @item
29039 @emph{Conversions}
29040
29041 Conversions from real types to integer types round away from 0. In Ada 83
29042 the conversion Integer(2.5) could deliver either 2 or 3 as its value. This
29043 implementation freedom was intended to support unbiased rounding in
29044 statistical applications, but in practice it interfered with portability.
29045 In Ada 95 the conversion semantics are unambiguous, and rounding away from 0
29046 is required. Numeric code may be affected by this change in semantics.
29047 Note, though, that this issue is no worse than already existed in Ada 83
29048 when porting code from one vendor to another.
29049
29050 @item
29051 @emph{Tasking}
29052
29053 The Real-Time Annex introduces a set of policies that define the behavior of
29054 features that were implementation dependent in Ada 83, such as the order in
29055 which open select branches are executed.
29056 @end itemize
29057
29058 @node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
29059 @anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{446}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{447}
29060 @subsection Changed semantics
29061
29062
29063 The worst kind of incompatibility is one where a program that is legal in
29064 Ada 83 is also legal in Ada 95 but can have an effect in Ada 95 that was not
29065 possible in Ada 83. Fortunately this is extremely rare, but the one
29066 situation that you should be alert to is the change in the predefined type
29067 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
29068
29069 @quotation
29070
29071 @geindex Latin-1
29072 @end quotation
29073
29074
29075 @itemize *
29076
29077 @item
29078 @emph{Range of type `@w{`}Character`@w{`}}
29079
29080 The range of @code{Standard.Character} is now the full 256 characters
29081 of Latin-1, whereas in most Ada 83 implementations it was restricted
29082 to 128 characters. Although some of the effects of
29083 this change will be manifest in compile-time rejection of legal
29084 Ada 83 programs it is possible for a working Ada 83 program to have
29085 a different effect in Ada 95, one that was not permitted in Ada 83.
29086 As an example, the expression
29087 @code{Character'Pos(Character'Last)} returned @code{127} in Ada 83 and now
29088 delivers @code{255} as its value.
29089 In general, you should look at the logic of any
29090 character-processing Ada 83 program and see whether it needs to be adapted
29091 to work correctly with Latin-1. Note that the predefined Ada 95 API has a
29092 character handling package that may be relevant if code needs to be adapted
29093 to account for the additional Latin-1 elements.
29094 The desirable fix is to
29095 modify the program to accommodate the full character set, but in some cases
29096 it may be convenient to define a subtype or derived type of Character that
29097 covers only the restricted range.
29098 @end itemize
29099
29100 @node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
29101 @anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{448}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{449}
29102 @subsection Other language compatibility issues
29103
29104
29105
29106 @itemize *
29107
29108 @item
29109 @emph{-gnat83} switch
29110
29111 All implementations of GNAT provide a switch that causes GNAT to operate
29112 in Ada 83 mode. In this mode, some but not all compatibility problems
29113 of the type described above are handled automatically. For example, the
29114 new reserved words introduced in Ada 95 and Ada 2005 are treated simply
29115 as identifiers as in Ada 83. However,
29116 in practice, it is usually advisable to make the necessary modifications
29117 to the program to remove the need for using this switch.
29118 See the @code{Compiling Different Versions of Ada} section in
29119 the @cite{GNAT User's Guide}.
29120
29121 @item
29122 Support for removed Ada 83 pragmas and attributes
29123
29124 A number of pragmas and attributes from Ada 83 were removed from Ada 95,
29125 generally because they were replaced by other mechanisms. Ada 95 and Ada 2005
29126 compilers are allowed, but not required, to implement these missing
29127 elements. In contrast with some other compilers, GNAT implements all
29128 such pragmas and attributes, eliminating this compatibility concern. These
29129 include @code{pragma Interface} and the floating point type attributes
29130 (@code{Emax}, @code{Mantissa}, etc.), among other items.
29131 @end itemize
29132
29133 @node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
29134 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{44a}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{44b}
29135 @section Compatibility between Ada 95 and Ada 2005
29136
29137
29138 @geindex Compatibility between Ada 95 and Ada 2005
29139
29140 Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
29141 a number of incompatibilities. Several are enumerated below;
29142 for a complete description please see the
29143 @cite{Annotated Ada 2005 Reference Manual}, or section 9.1.1 in
29144 @cite{Rationale for Ada 2005}.
29145
29146
29147 @itemize *
29148
29149 @item
29150 @emph{New reserved words.}
29151
29152 The words @code{interface}, @code{overriding} and @code{synchronized} are
29153 reserved in Ada 2005.
29154 A pre-Ada 2005 program that uses any of these as an identifier will be
29155 illegal.
29156
29157 @item
29158 @emph{New declarations in predefined packages.}
29159
29160 A number of packages in the predefined environment contain new declarations:
29161 @code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
29162 @code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
29163 @code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
29164 @code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
29165 @code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
29166 If an Ada 95 program does a @code{with} and @code{use} of any of these
29167 packages, the new declarations may cause name clashes.
29168
29169 @item
29170 @emph{Access parameters.}
29171
29172 A nondispatching subprogram with an access parameter cannot be renamed
29173 as a dispatching operation. This was permitted in Ada 95.
29174
29175 @item
29176 @emph{Access types, discriminants, and constraints.}
29177
29178 Rule changes in this area have led to some incompatibilities; for example,
29179 constrained subtypes of some access types are not permitted in Ada 2005.
29180
29181 @item
29182 @emph{Aggregates for limited types.}
29183
29184 The allowance of aggregates for limited types in Ada 2005 raises the
29185 possibility of ambiguities in legal Ada 95 programs, since additional types
29186 now need to be considered in expression resolution.
29187
29188 @item
29189 @emph{Fixed-point multiplication and division.}
29190
29191 Certain expressions involving '*' or '/' for a fixed-point type, which
29192 were legal in Ada 95 and invoked the predefined versions of these operations,
29193 are now ambiguous.
29194 The ambiguity may be resolved either by applying a type conversion to the
29195 expression, or by explicitly invoking the operation from package
29196 @code{Standard}.
29197
29198 @item
29199 @emph{Return-by-reference types.}
29200
29201 The Ada 95 return-by-reference mechanism has been removed. Instead, the user
29202 can declare a function returning a value from an anonymous access type.
29203 @end itemize
29204
29205 @node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
29206 @anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{44c}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{44d}
29207 @section Implementation-dependent characteristics
29208
29209
29210 Although the Ada language defines the semantics of each construct as
29211 precisely as practical, in some situations (for example for reasons of
29212 efficiency, or where the effect is heavily dependent on the host or target
29213 platform) the implementation is allowed some freedom. In porting Ada 83
29214 code to GNAT, you need to be aware of whether / how the existing code
29215 exercised such implementation dependencies. Such characteristics fall into
29216 several categories, and GNAT offers specific support in assisting the
29217 transition from certain Ada 83 compilers.
29218
29219 @menu
29220 * Implementation-defined pragmas::
29221 * Implementation-defined attributes::
29222 * Libraries::
29223 * Elaboration order::
29224 * Target-specific aspects::
29225
29226 @end menu
29227
29228 @node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
29229 @anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{44e}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{44f}
29230 @subsection Implementation-defined pragmas
29231
29232
29233 Ada compilers are allowed to supplement the language-defined pragmas, and
29234 these are a potential source of non-portability. All GNAT-defined pragmas
29235 are described in @ref{7,,Implementation Defined Pragmas},
29236 and these include several that are specifically
29237 intended to correspond to other vendors' Ada 83 pragmas.
29238 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
29239 For compatibility with HP Ada 83, GNAT supplies the pragmas
29240 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
29241 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
29242 and @code{Volatile}.
29243 Other relevant pragmas include @code{External} and @code{Link_With}.
29244 Some vendor-specific
29245 Ada 83 pragmas (@code{Share_Generic}, @code{Subtitle}, and @code{Title}) are
29246 recognized, thus
29247 avoiding compiler rejection of units that contain such pragmas; they are not
29248 relevant in a GNAT context and hence are not otherwise implemented.
29249
29250 @node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
29251 @anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{450}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{451}
29252 @subsection Implementation-defined attributes
29253
29254
29255 Analogous to pragmas, the set of attributes may be extended by an
29256 implementation. All GNAT-defined attributes are described in
29257 @ref{8,,Implementation Defined Attributes},
29258 and these include several that are specifically intended
29259 to correspond to other vendors' Ada 83 attributes. For migrating from VADS,
29260 the attribute @code{VADS_Size} may be useful. For compatibility with HP
29261 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
29262 @code{Type_Class}.
29263
29264 @node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
29265 @anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{452}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{453}
29266 @subsection Libraries
29267
29268
29269 Vendors may supply libraries to supplement the standard Ada API. If Ada 83
29270 code uses vendor-specific libraries then there are several ways to manage
29271 this in Ada 95 and later versions of the standard:
29272
29273
29274 @itemize *
29275
29276 @item
29277 If the source code for the libraries (specs and bodies) are
29278 available, then the libraries can be migrated in the same way as the
29279 application.
29280
29281 @item
29282 If the source code for the specs but not the bodies are
29283 available, then you can reimplement the bodies.
29284
29285 @item
29286 Some features introduced by Ada 95 obviate the need for library support. For
29287 example most Ada 83 vendors supplied a package for unsigned integers. The
29288 Ada 95 modular type feature is the preferred way to handle this need, so
29289 instead of migrating or reimplementing the unsigned integer package it may
29290 be preferable to retrofit the application using modular types.
29291 @end itemize
29292
29293 @node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
29294 @anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{454}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{455}
29295 @subsection Elaboration order
29296
29297
29298 The implementation can choose any elaboration order consistent with the unit
29299 dependency relationship. This freedom means that some orders can result in
29300 Program_Error being raised due to an 'Access Before Elaboration': an attempt
29301 to invoke a subprogram before its body has been elaborated, or to instantiate
29302 a generic before the generic body has been elaborated. By default GNAT
29303 attempts to choose a safe order (one that will not encounter access before
29304 elaboration problems) by implicitly inserting @code{Elaborate} or
29305 @code{Elaborate_All} pragmas where
29306 needed. However, this can lead to the creation of elaboration circularities
29307 and a resulting rejection of the program by gnatbind. This issue is
29308 thoroughly described in the @emph{Elaboration Order Handling in GNAT} appendix
29309 in the @cite{GNAT User's Guide}.
29310 In brief, there are several
29311 ways to deal with this situation:
29312
29313
29314 @itemize *
29315
29316 @item
29317 Modify the program to eliminate the circularities, e.g., by moving
29318 elaboration-time code into explicitly-invoked procedures
29319
29320 @item
29321 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
29322 @code{Elaborate} pragmas, and then inhibit the generation of implicit
29323 @code{Elaborate_All}
29324 pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
29325 (by selectively suppressing elaboration checks via pragma
29326 @code{Suppress(Elaboration_Check)} when it is safe to do so).
29327 @end itemize
29328
29329 @node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
29330 @anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{456}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{457}
29331 @subsection Target-specific aspects
29332
29333
29334 Low-level applications need to deal with machine addresses, data
29335 representations, interfacing with assembler code, and similar issues. If
29336 such an Ada 83 application is being ported to different target hardware (for
29337 example where the byte endianness has changed) then you will need to
29338 carefully examine the program logic; the porting effort will heavily depend
29339 on the robustness of the original design. Moreover, Ada 95 (and thus
29340 Ada 2005 and Ada 2012) are sometimes
29341 incompatible with typical Ada 83 compiler practices regarding implicit
29342 packing, the meaning of the Size attribute, and the size of access values.
29343 GNAT's approach to these issues is described in @ref{458,,Representation Clauses}.
29344
29345 @node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
29346 @anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{45a}
29347 @section Compatibility with Other Ada Systems
29348
29349
29350 If programs avoid the use of implementation dependent and
29351 implementation defined features, as documented in the
29352 @cite{Ada Reference Manual}, there should be a high degree of portability between
29353 GNAT and other Ada systems. The following are specific items which
29354 have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
29355 compilers, but do not affect porting code to GNAT.
29356 (As of January 2007, GNAT is the only compiler available for Ada 2005;
29357 the following issues may or may not arise for Ada 2005 programs
29358 when other compilers appear.)
29359
29360
29361 @itemize *
29362
29363 @item
29364 @emph{Ada 83 Pragmas and Attributes}
29365
29366 Ada 95 compilers are allowed, but not required, to implement the missing
29367 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
29368 GNAT implements all such pragmas and attributes, eliminating this as
29369 a compatibility concern, but some other Ada 95 compilers reject these
29370 pragmas and attributes.
29371
29372 @item
29373 @emph{Specialized Needs Annexes}
29374
29375 GNAT implements the full set of special needs annexes. At the
29376 current time, it is the only Ada 95 compiler to do so. This means that
29377 programs making use of these features may not be portable to other Ada
29378 95 compilation systems.
29379
29380 @item
29381 @emph{Representation Clauses}
29382
29383 Some other Ada 95 compilers implement only the minimal set of
29384 representation clauses required by the Ada 95 reference manual. GNAT goes
29385 far beyond this minimal set, as described in the next section.
29386 @end itemize
29387
29388 @node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
29389 @anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{458}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{45b}
29390 @section Representation Clauses
29391
29392
29393 The Ada 83 reference manual was quite vague in describing both the minimal
29394 required implementation of representation clauses, and also their precise
29395 effects. Ada 95 (and thus also Ada 2005) are much more explicit, but the
29396 minimal set of capabilities required is still quite limited.
29397
29398 GNAT implements the full required set of capabilities in
29399 Ada 95 and Ada 2005, but also goes much further, and in particular
29400 an effort has been made to be compatible with existing Ada 83 usage to the
29401 greatest extent possible.
29402
29403 A few cases exist in which Ada 83 compiler behavior is incompatible with
29404 the requirements in Ada 95 (and thus also Ada 2005). These are instances of
29405 intentional or accidental dependence on specific implementation dependent
29406 characteristics of these Ada 83 compilers. The following is a list of
29407 the cases most likely to arise in existing Ada 83 code.
29408
29409
29410 @itemize *
29411
29412 @item
29413 @emph{Implicit Packing}
29414
29415 Some Ada 83 compilers allowed a Size specification to cause implicit
29416 packing of an array or record. This could cause expensive implicit
29417 conversions for change of representation in the presence of derived
29418 types, and the Ada design intends to avoid this possibility.
29419 Subsequent AI's were issued to make it clear that such implicit
29420 change of representation in response to a Size clause is inadvisable,
29421 and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
29422 Reference Manuals as implementation advice that is followed by GNAT.
29423 The problem will show up as an error
29424 message rejecting the size clause. The fix is simply to provide
29425 the explicit pragma @code{Pack}, or for more fine tuned control, provide
29426 a Component_Size clause.
29427
29428 @item
29429 @emph{Meaning of Size Attribute}
29430
29431 The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
29432 the minimal number of bits required to hold values of the type. For example,
29433 on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
29434 32 (since no sign bit is required). Some Ada 83 compilers gave 31, and
29435 some 32 in this situation. This problem will usually show up as a compile
29436 time error, but not always. It is a good idea to check all uses of the
29437 'Size attribute when porting Ada 83 code. The GNAT specific attribute
29438 Object_Size can provide a useful way of duplicating the behavior of
29439 some Ada 83 compiler systems.
29440
29441 @item
29442 @emph{Size of Access Types}
29443
29444 A common assumption in Ada 83 code is that an access type is in fact a pointer,
29445 and that therefore it will be the same size as a System.Address value. This
29446 assumption is true for GNAT in most cases with one exception. For the case of
29447 a pointer to an unconstrained array type (where the bounds may vary from one
29448 value of the access type to another), the default is to use a 'fat pointer',
29449 which is represented as two separate pointers, one to the bounds, and one to
29450 the array. This representation has a number of advantages, including improved
29451 efficiency. However, it may cause some difficulties in porting existing Ada 83
29452 code which makes the assumption that, for example, pointers fit in 32 bits on
29453 a machine with 32-bit addressing.
29454
29455 To get around this problem, GNAT also permits the use of 'thin pointers' for
29456 access types in this case (where the designated type is an unconstrained array
29457 type). These thin pointers are indeed the same size as a System.Address value.
29458 To specify a thin pointer, use a size clause for the type, for example:
29459
29460 @example
29461 type X is access all String;
29462 for X'Size use Standard'Address_Size;
29463 @end example
29464
29465 which will cause the type X to be represented using a single pointer.
29466 When using this representation, the bounds are right behind the array.
29467 This representation is slightly less efficient, and does not allow quite
29468 such flexibility in the use of foreign pointers or in using the
29469 Unrestricted_Access attribute to create pointers to non-aliased objects.
29470 But for any standard portable use of the access type it will work in
29471 a functionally correct manner and allow porting of existing code.
29472 Note that another way of forcing a thin pointer representation
29473 is to use a component size clause for the element size in an array,
29474 or a record representation clause for an access field in a record.
29475
29476 See the documentation of Unrestricted_Access in the GNAT RM for a
29477 full discussion of possible problems using this attribute in conjunction
29478 with thin pointers.
29479 @end itemize
29480
29481 @node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
29482 @anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{45c}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{45d}
29483 @section Compatibility with HP Ada 83
29484
29485
29486 All the HP Ada 83 pragmas and attributes are recognized, although only a subset
29487 of them can sensibly be implemented. The description of pragmas in
29488 @ref{7,,Implementation Defined Pragmas} indicates whether or not they are
29489 applicable to GNAT.
29490
29491
29492 @itemize *
29493
29494 @item
29495 @emph{Default floating-point representation}
29496
29497 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
29498 it is VMS format.
29499
29500 @item
29501 @emph{System}
29502
29503 the package System in GNAT exactly corresponds to the definition in the
29504 Ada 95 reference manual, which means that it excludes many of the
29505 HP Ada 83 extensions. However, a separate package Aux_DEC is provided
29506 that contains the additional definitions, and a special pragma,
29507 Extend_System allows this package to be treated transparently as an
29508 extension of package System.
29509 @end itemize
29510
29511 @node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
29512 @anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{45e}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{45f}
29513 @chapter GNU Free Documentation License
29514
29515
29516 Version 1.3, 3 November 2008
29517
29518 Copyright 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc
29519 @indicateurl{http://fsf.org/}
29520
29521 Everyone is permitted to copy and distribute verbatim copies of this
29522 license document, but changing it is not allowed.
29523
29524 @strong{Preamble}
29525
29526 The purpose of this License is to make a manual, textbook, or other
29527 functional and useful document "free" in the sense of freedom: to
29528 assure everyone the effective freedom to copy and redistribute it,
29529 with or without modifying it, either commercially or noncommercially.
29530 Secondarily, this License preserves for the author and publisher a way
29531 to get credit for their work, while not being considered responsible
29532 for modifications made by others.
29533
29534 This License is a kind of "copyleft", which means that derivative
29535 works of the document must themselves be free in the same sense. It
29536 complements the GNU General Public License, which is a copyleft
29537 license designed for free software.
29538
29539 We have designed this License in order to use it for manuals for free
29540 software, because free software needs free documentation: a free
29541 program should come with manuals providing the same freedoms that the
29542 software does. But this License is not limited to software manuals;
29543 it can be used for any textual work, regardless of subject matter or
29544 whether it is published as a printed book. We recommend this License
29545 principally for works whose purpose is instruction or reference.
29546
29547 @strong{1. APPLICABILITY AND DEFINITIONS}
29548
29549 This License applies to any manual or other work, in any medium, that
29550 contains a notice placed by the copyright holder saying it can be
29551 distributed under the terms of this License. Such a notice grants a
29552 world-wide, royalty-free license, unlimited in duration, to use that
29553 work under the conditions stated herein. The @strong{Document}, below,
29554 refers to any such manual or work. Any member of the public is a
29555 licensee, and is addressed as "@strong{you}". You accept the license if you
29556 copy, modify or distribute the work in a way requiring permission
29557 under copyright law.
29558
29559 A "@strong{Modified Version}" of the Document means any work containing the
29560 Document or a portion of it, either copied verbatim, or with
29561 modifications and/or translated into another language.
29562
29563 A "@strong{Secondary Section}" is a named appendix or a front-matter section of
29564 the Document that deals exclusively with the relationship of the
29565 publishers or authors of the Document to the Document's overall subject
29566 (or to related matters) and contains nothing that could fall directly
29567 within that overall subject. (Thus, if the Document is in part a
29568 textbook of mathematics, a Secondary Section may not explain any
29569 mathematics.) The relationship could be a matter of historical
29570 connection with the subject or with related matters, or of legal,
29571 commercial, philosophical, ethical or political position regarding
29572 them.
29573
29574 The "@strong{Invariant Sections}" are certain Secondary Sections whose titles
29575 are designated, as being those of Invariant Sections, in the notice
29576 that says that the Document is released under this License. If a
29577 section does not fit the above definition of Secondary then it is not
29578 allowed to be designated as Invariant. The Document may contain zero
29579 Invariant Sections. If the Document does not identify any Invariant
29580 Sections then there are none.
29581
29582 The "@strong{Cover Texts}" are certain short passages of text that are listed,
29583 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
29584 the Document is released under this License. A Front-Cover Text may
29585 be at most 5 words, and a Back-Cover Text may be at most 25 words.
29586
29587 A "@strong{Transparent}" copy of the Document means a machine-readable copy,
29588 represented in a format whose specification is available to the
29589 general public, that is suitable for revising the document
29590 straightforwardly with generic text editors or (for images composed of
29591 pixels) generic paint programs or (for drawings) some widely available
29592 drawing editor, and that is suitable for input to text formatters or
29593 for automatic translation to a variety of formats suitable for input
29594 to text formatters. A copy made in an otherwise Transparent file
29595 format whose markup, or absence of markup, has been arranged to thwart
29596 or discourage subsequent modification by readers is not Transparent.
29597 An image format is not Transparent if used for any substantial amount
29598 of text. A copy that is not "Transparent" is called @strong{Opaque}.
29599
29600 Examples of suitable formats for Transparent copies include plain
29601 ASCII without markup, Texinfo input format, LaTeX input format, SGML
29602 or XML using a publicly available DTD, and standard-conforming simple
29603 HTML, PostScript or PDF designed for human modification. Examples of
29604 transparent image formats include PNG, XCF and JPG. Opaque formats
29605 include proprietary formats that can be read and edited only by
29606 proprietary word processors, SGML or XML for which the DTD and/or
29607 processing tools are not generally available, and the
29608 machine-generated HTML, PostScript or PDF produced by some word
29609 processors for output purposes only.
29610
29611 The "@strong{Title Page}" means, for a printed book, the title page itself,
29612 plus such following pages as are needed to hold, legibly, the material
29613 this License requires to appear in the title page. For works in
29614 formats which do not have any title page as such, "Title Page" means
29615 the text near the most prominent appearance of the work's title,
29616 preceding the beginning of the body of the text.
29617
29618 The "@strong{publisher}" means any person or entity that distributes
29619 copies of the Document to the public.
29620
29621 A section "@strong{Entitled XYZ}" means a named subunit of the Document whose
29622 title either is precisely XYZ or contains XYZ in parentheses following
29623 text that translates XYZ in another language. (Here XYZ stands for a
29624 specific section name mentioned below, such as "@strong{Acknowledgements}",
29625 "@strong{Dedications}", "@strong{Endorsements}", or "@strong{History}".)
29626 To "@strong{Preserve the Title}"
29627 of such a section when you modify the Document means that it remains a
29628 section "Entitled XYZ" according to this definition.
29629
29630 The Document may include Warranty Disclaimers next to the notice which
29631 states that this License applies to the Document. These Warranty
29632 Disclaimers are considered to be included by reference in this
29633 License, but only as regards disclaiming warranties: any other
29634 implication that these Warranty Disclaimers may have is void and has
29635 no effect on the meaning of this License.
29636
29637 @strong{2. VERBATIM COPYING}
29638
29639 You may copy and distribute the Document in any medium, either
29640 commercially or noncommercially, provided that this License, the
29641 copyright notices, and the license notice saying this License applies
29642 to the Document are reproduced in all copies, and that you add no other
29643 conditions whatsoever to those of this License. You may not use
29644 technical measures to obstruct or control the reading or further
29645 copying of the copies you make or distribute. However, you may accept
29646 compensation in exchange for copies. If you distribute a large enough
29647 number of copies you must also follow the conditions in section 3.
29648
29649 You may also lend copies, under the same conditions stated above, and
29650 you may publicly display copies.
29651
29652 @strong{3. COPYING IN QUANTITY}
29653
29654 If you publish printed copies (or copies in media that commonly have
29655 printed covers) of the Document, numbering more than 100, and the
29656 Document's license notice requires Cover Texts, you must enclose the
29657 copies in covers that carry, clearly and legibly, all these Cover
29658 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
29659 the back cover. Both covers must also clearly and legibly identify
29660 you as the publisher of these copies. The front cover must present
29661 the full title with all words of the title equally prominent and
29662 visible. You may add other material on the covers in addition.
29663 Copying with changes limited to the covers, as long as they preserve
29664 the title of the Document and satisfy these conditions, can be treated
29665 as verbatim copying in other respects.
29666
29667 If the required texts for either cover are too voluminous to fit
29668 legibly, you should put the first ones listed (as many as fit
29669 reasonably) on the actual cover, and continue the rest onto adjacent
29670 pages.
29671
29672 If you publish or distribute Opaque copies of the Document numbering
29673 more than 100, you must either include a machine-readable Transparent
29674 copy along with each Opaque copy, or state in or with each Opaque copy
29675 a computer-network location from which the general network-using
29676 public has access to download using public-standard network protocols
29677 a complete Transparent copy of the Document, free of added material.
29678 If you use the latter option, you must take reasonably prudent steps,
29679 when you begin distribution of Opaque copies in quantity, to ensure
29680 that this Transparent copy will remain thus accessible at the stated
29681 location until at least one year after the last time you distribute an
29682 Opaque copy (directly or through your agents or retailers) of that
29683 edition to the public.
29684
29685 It is requested, but not required, that you contact the authors of the
29686 Document well before redistributing any large number of copies, to give
29687 them a chance to provide you with an updated version of the Document.
29688
29689 @strong{4. MODIFICATIONS}
29690
29691 You may copy and distribute a Modified Version of the Document under
29692 the conditions of sections 2 and 3 above, provided that you release
29693 the Modified Version under precisely this License, with the Modified
29694 Version filling the role of the Document, thus licensing distribution
29695 and modification of the Modified Version to whoever possesses a copy
29696 of it. In addition, you must do these things in the Modified Version:
29697
29698
29699 @enumerate A
29700
29701 @item
29702 Use in the Title Page (and on the covers, if any) a title distinct
29703 from that of the Document, and from those of previous versions
29704 (which should, if there were any, be listed in the History section
29705 of the Document). You may use the same title as a previous version
29706 if the original publisher of that version gives permission.
29707
29708 @item
29709 List on the Title Page, as authors, one or more persons or entities
29710 responsible for authorship of the modifications in the Modified
29711 Version, together with at least five of the principal authors of the
29712 Document (all of its principal authors, if it has fewer than five),
29713 unless they release you from this requirement.
29714
29715 @item
29716 State on the Title page the name of the publisher of the
29717 Modified Version, as the publisher.
29718
29719 @item
29720 Preserve all the copyright notices of the Document.
29721
29722 @item
29723 Add an appropriate copyright notice for your modifications
29724 adjacent to the other copyright notices.
29725
29726 @item
29727 Include, immediately after the copyright notices, a license notice
29728 giving the public permission to use the Modified Version under the
29729 terms of this License, in the form shown in the Addendum below.
29730
29731 @item
29732 Preserve in that license notice the full lists of Invariant Sections
29733 and required Cover Texts given in the Document's license notice.
29734
29735 @item
29736 Include an unaltered copy of this License.
29737
29738 @item
29739 Preserve the section Entitled "History", Preserve its Title, and add
29740 to it an item stating at least the title, year, new authors, and
29741 publisher of the Modified Version as given on the Title Page. If
29742 there is no section Entitled "History" in the Document, create one
29743 stating the title, year, authors, and publisher of the Document as
29744 given on its Title Page, then add an item describing the Modified
29745 Version as stated in the previous sentence.
29746
29747 @item
29748 Preserve the network location, if any, given in the Document for
29749 public access to a Transparent copy of the Document, and likewise
29750 the network locations given in the Document for previous versions
29751 it was based on. These may be placed in the "History" section.
29752 You may omit a network location for a work that was published at
29753 least four years before the Document itself, or if the original
29754 publisher of the version it refers to gives permission.
29755
29756 @item
29757 For any section Entitled "Acknowledgements" or "Dedications",
29758 Preserve the Title of the section, and preserve in the section all
29759 the substance and tone of each of the contributor acknowledgements
29760 and/or dedications given therein.
29761
29762 @item
29763 Preserve all the Invariant Sections of the Document,
29764 unaltered in their text and in their titles. Section numbers
29765 or the equivalent are not considered part of the section titles.
29766
29767 @item
29768 Delete any section Entitled "Endorsements". Such a section
29769 may not be included in the Modified Version.
29770
29771 @item
29772 Do not retitle any existing section to be Entitled "Endorsements"
29773 or to conflict in title with any Invariant Section.
29774
29775 @item
29776 Preserve any Warranty Disclaimers.
29777 @end enumerate
29778
29779 If the Modified Version includes new front-matter sections or
29780 appendices that qualify as Secondary Sections and contain no material
29781 copied from the Document, you may at your option designate some or all
29782 of these sections as invariant. To do this, add their titles to the
29783 list of Invariant Sections in the Modified Version's license notice.
29784 These titles must be distinct from any other section titles.
29785
29786 You may add a section Entitled "Endorsements", provided it contains
29787 nothing but endorsements of your Modified Version by various
29788 parties---for example, statements of peer review or that the text has
29789 been approved by an organization as the authoritative definition of a
29790 standard.
29791
29792 You may add a passage of up to five words as a Front-Cover Text, and a
29793 passage of up to 25 words as a Back-Cover Text, to the end of the list
29794 of Cover Texts in the Modified Version. Only one passage of
29795 Front-Cover Text and one of Back-Cover Text may be added by (or
29796 through arrangements made by) any one entity. If the Document already
29797 includes a cover text for the same cover, previously added by you or
29798 by arrangement made by the same entity you are acting on behalf of,
29799 you may not add another; but you may replace the old one, on explicit
29800 permission from the previous publisher that added the old one.
29801
29802 The author(s) and publisher(s) of the Document do not by this License
29803 give permission to use their names for publicity for or to assert or
29804 imply endorsement of any Modified Version.
29805
29806 @strong{5. COMBINING DOCUMENTS}
29807
29808 You may combine the Document with other documents released under this
29809 License, under the terms defined in section 4 above for modified
29810 versions, provided that you include in the combination all of the
29811 Invariant Sections of all of the original documents, unmodified, and
29812 list them all as Invariant Sections of your combined work in its
29813 license notice, and that you preserve all their Warranty Disclaimers.
29814
29815 The combined work need only contain one copy of this License, and
29816 multiple identical Invariant Sections may be replaced with a single
29817 copy. If there are multiple Invariant Sections with the same name but
29818 different contents, make the title of each such section unique by
29819 adding at the end of it, in parentheses, the name of the original
29820 author or publisher of that section if known, or else a unique number.
29821 Make the same adjustment to the section titles in the list of
29822 Invariant Sections in the license notice of the combined work.
29823
29824 In the combination, you must combine any sections Entitled "History"
29825 in the various original documents, forming one section Entitled
29826 "History"; likewise combine any sections Entitled "Acknowledgements",
29827 and any sections Entitled "Dedications". You must delete all sections
29828 Entitled "Endorsements".
29829
29830 @strong{6. COLLECTIONS OF DOCUMENTS}
29831
29832 You may make a collection consisting of the Document and other documents
29833 released under this License, and replace the individual copies of this
29834 License in the various documents with a single copy that is included in
29835 the collection, provided that you follow the rules of this License for
29836 verbatim copying of each of the documents in all other respects.
29837
29838 You may extract a single document from such a collection, and distribute
29839 it individually under this License, provided you insert a copy of this
29840 License into the extracted document, and follow this License in all
29841 other respects regarding verbatim copying of that document.
29842
29843 @strong{7. AGGREGATION WITH INDEPENDENT WORKS}
29844
29845 A compilation of the Document or its derivatives with other separate
29846 and independent documents or works, in or on a volume of a storage or
29847 distribution medium, is called an "aggregate" if the copyright
29848 resulting from the compilation is not used to limit the legal rights
29849 of the compilation's users beyond what the individual works permit.
29850 When the Document is included in an aggregate, this License does not
29851 apply to the other works in the aggregate which are not themselves
29852 derivative works of the Document.
29853
29854 If the Cover Text requirement of section 3 is applicable to these
29855 copies of the Document, then if the Document is less than one half of
29856 the entire aggregate, the Document's Cover Texts may be placed on
29857 covers that bracket the Document within the aggregate, or the
29858 electronic equivalent of covers if the Document is in electronic form.
29859 Otherwise they must appear on printed covers that bracket the whole
29860 aggregate.
29861
29862 @strong{8. TRANSLATION}
29863
29864 Translation is considered a kind of modification, so you may
29865 distribute translations of the Document under the terms of section 4.
29866 Replacing Invariant Sections with translations requires special
29867 permission from their copyright holders, but you may include
29868 translations of some or all Invariant Sections in addition to the
29869 original versions of these Invariant Sections. You may include a
29870 translation of this License, and all the license notices in the
29871 Document, and any Warranty Disclaimers, provided that you also include
29872 the original English version of this License and the original versions
29873 of those notices and disclaimers. In case of a disagreement between
29874 the translation and the original version of this License or a notice
29875 or disclaimer, the original version will prevail.
29876
29877 If a section in the Document is Entitled "Acknowledgements",
29878 "Dedications", or "History", the requirement (section 4) to Preserve
29879 its Title (section 1) will typically require changing the actual
29880 title.
29881
29882 @strong{9. TERMINATION}
29883
29884 You may not copy, modify, sublicense, or distribute the Document
29885 except as expressly provided under this License. Any attempt
29886 otherwise to copy, modify, sublicense, or distribute it is void, and
29887 will automatically terminate your rights under this License.
29888
29889 However, if you cease all violation of this License, then your license
29890 from a particular copyright holder is reinstated (a) provisionally,
29891 unless and until the copyright holder explicitly and finally
29892 terminates your license, and (b) permanently, if the copyright holder
29893 fails to notify you of the violation by some reasonable means prior to
29894 60 days after the cessation.
29895
29896 Moreover, your license from a particular copyright holder is
29897 reinstated permanently if the copyright holder notifies you of the
29898 violation by some reasonable means, this is the first time you have
29899 received notice of violation of this License (for any work) from that
29900 copyright holder, and you cure the violation prior to 30 days after
29901 your receipt of the notice.
29902
29903 Termination of your rights under this section does not terminate the
29904 licenses of parties who have received copies or rights from you under
29905 this License. If your rights have been terminated and not permanently
29906 reinstated, receipt of a copy of some or all of the same material does
29907 not give you any rights to use it.
29908
29909 @strong{10. FUTURE REVISIONS OF THIS LICENSE}
29910
29911 The Free Software Foundation may publish new, revised versions
29912 of the GNU Free Documentation License from time to time. Such new
29913 versions will be similar in spirit to the present version, but may
29914 differ in detail to address new problems or concerns. See
29915 @indicateurl{http://www.gnu.org/copyleft/}.
29916
29917 Each version of the License is given a distinguishing version number.
29918 If the Document specifies that a particular numbered version of this
29919 License "or any later version" applies to it, you have the option of
29920 following the terms and conditions either of that specified version or
29921 of any later version that has been published (not as a draft) by the
29922 Free Software Foundation. If the Document does not specify a version
29923 number of this License, you may choose any version ever published (not
29924 as a draft) by the Free Software Foundation. If the Document
29925 specifies that a proxy can decide which future versions of this
29926 License can be used, that proxy's public statement of acceptance of a
29927 version permanently authorizes you to choose that version for the
29928 Document.
29929
29930 @strong{11. RELICENSING}
29931
29932 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
29933 World Wide Web server that publishes copyrightable works and also
29934 provides prominent facilities for anybody to edit those works. A
29935 public wiki that anybody can edit is an example of such a server. A
29936 "Massive Multiauthor Collaboration" (or "MMC") contained in the
29937 site means any set of copyrightable works thus published on the MMC
29938 site.
29939
29940 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
29941 license published by Creative Commons Corporation, a not-for-profit
29942 corporation with a principal place of business in San Francisco,
29943 California, as well as future copyleft versions of that license
29944 published by that same organization.
29945
29946 "Incorporate" means to publish or republish a Document, in whole or
29947 in part, as part of another Document.
29948
29949 An MMC is "eligible for relicensing" if it is licensed under this
29950 License, and if all works that were first published under this License
29951 somewhere other than this MMC, and subsequently incorporated in whole
29952 or in part into the MMC, (1) had no cover texts or invariant sections,
29953 and (2) were thus incorporated prior to November 1, 2008.
29954
29955 The operator of an MMC Site may republish an MMC contained in the site
29956 under CC-BY-SA on the same site at any time before August 1, 2009,
29957 provided the MMC is eligible for relicensing.
29958
29959 @strong{ADDENDUM: How to use this License for your documents}
29960
29961 To use this License in a document you have written, include a copy of
29962 the License in the document and put the following copyright and
29963 license notices just after the title page:
29964
29965 @quotation
29966
29967 Copyright © YEAR YOUR NAME.
29968 Permission is granted to copy, distribute and/or modify this document
29969 under the terms of the GNU Free Documentation License, Version 1.3
29970 or any later version published by the Free Software Foundation;
29971 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
29972 A copy of the license is included in the section entitled "GNU
29973 Free Documentation License".
29974 @end quotation
29975
29976 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
29977 replace the "with ... Texts." line with this:
29978
29979 @quotation
29980
29981 with the Invariant Sections being LIST THEIR TITLES, with the
29982 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
29983 @end quotation
29984
29985 If you have Invariant Sections without Cover Texts, or some other
29986 combination of the three, merge those two alternatives to suit the
29987 situation.
29988
29989 If your document contains nontrivial examples of program code, we
29990 recommend releasing these examples in parallel under your choice of
29991 free software license, such as the GNU General Public License,
29992 to permit their use in free software.
29993
29994 @node Index,,GNU Free Documentation License,Top
29995 @unnumbered Index
29996
29997
29998 @printindex ge
29999
30000
30001 @c %**end of body
30002 @bye