2014-01-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / ada / gnat_rm.texi
blobabb00383157a6d6931b78766ca754f8ff3ef1a1e
1 \input texinfo   @c -*-texinfo-*-
3 @c %**start of header
5 @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
6 @c                                                                            o
7 @c                           GNAT DOCUMENTATION                               o
8 @c                                                                            o
9 @c                              G N A T _ RM                                  o
10 @c                                                                            o
11 @c  GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).    o
12 @c                                                                            o
13 @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
15 @setfilename gnat_rm.info
17 @copying
18 Copyright @copyright{} 1995-2012, Free Software Foundation, Inc.
20 Permission is granted to copy, distribute and/or modify this document
21 under the terms of the GNU Free Documentation License, Version 1.3 or
22 any later version published by the Free Software Foundation; with no
23 Invariant Sections, with the Front-Cover Texts being ``GNAT Reference
24 Manual'', and with no Back-Cover Texts.  A copy of the license is
25 included in the section entitled ``GNU Free Documentation License''.
26 @end copying
28 @set EDITION GNAT
30 @settitle GNAT Reference Manual
32 @setchapternewpage odd
33 @syncodeindex fn cp
35 @include gcc-common.texi
37 @dircategory GNU Ada tools
38 @direntry
39 * GNAT Reference Manual: (gnat_rm).  Reference Manual for GNU Ada tools.
40 @end direntry
42 @titlepage
43 @title GNAT Reference Manual
44 @subtitle GNAT, The GNU Ada Compiler
45 @versionsubtitle
46 @author AdaCore
47 @page
48 @vskip 0pt plus 1filll
50 @insertcopying
52 @end titlepage
54 @ifnottex
55 @node Top, About This Guide, (dir), (dir)
56 @top GNAT Reference Manual
58 @noindent
59 GNAT Reference Manual
61 @noindent
62 GNAT, The GNU Ada Compiler@*
63 GCC version @value{version-GCC}@*
65 @noindent
66 AdaCore
68 @menu
69 * About This Guide::
70 * Implementation Defined Pragmas::
71 * Implementation Defined Aspects::
72 * Implementation Defined Attributes::
73 * Standard and Implementation Defined Restrictions::
74 * Implementation Advice::
75 * Implementation Defined Characteristics::
76 * Intrinsic Subprograms::
77 * Representation Clauses and Pragmas::
78 * Standard Library Routines::
79 * The Implementation of Standard I/O::
80 * The GNAT Library::
81 * Interfacing to Other Languages::
82 * Specialized Needs Annexes::
83 * Implementation of Specific Ada Features::
84 * Implementation of Ada 2012 Features::
85 * Obsolescent Features::
86 * GNU Free Documentation License::
87 * Index::
89  --- The Detailed Node Listing ---
91 About This Guide
93 * What This Reference Manual Contains::
94 * Related Information::
96 Implementation Defined Pragmas
98 * Pragma Abort_Defer::
99 * Pragma Abstract_State::
100 * Pragma Ada_83::
101 * Pragma Ada_95::
102 * Pragma Ada_05::
103 * Pragma Ada_2005::
104 * Pragma Ada_12::
105 * Pragma Ada_2012::
106 * Pragma Allow_Integer_Address::
107 * Pragma Annotate::
108 * Pragma Assert::
109 * Pragma Assert_And_Cut::
110 * Pragma Assertion_Policy::
111 * Pragma Assume::
112 * Pragma Assume_No_Invalid_Values::
113 * Pragma Attribute_Definition::
114 * Pragma Ast_Entry::
115 * Pragma C_Pass_By_Copy::
116 * Pragma Check::
117 * Pragma Check_Float_Overflow::
118 * Pragma Check_Name::
119 * Pragma Check_Policy::
120 * Pragma CIL_Constructor::
121 * Pragma Comment::
122 * Pragma Common_Object::
123 * Pragma Compile_Time_Error::
124 * Pragma Compile_Time_Warning::
125 * Pragma Compiler_Unit::
126 * Pragma Complete_Representation::
127 * Pragma Complex_Representation::
128 * Pragma Component_Alignment::
129 * Pragma Contract_Cases::
130 * Pragma Convention_Identifier::
131 * Pragma CPP_Class::
132 * Pragma CPP_Constructor::
133 * Pragma CPP_Virtual::
134 * Pragma CPP_Vtable::
135 * Pragma CPU::
136 * Pragma Debug::
137 * Pragma Debug_Policy::
138 * Pragma Default_Storage_Pool::
139 * Pragma Depends::
140 * Pragma Detect_Blocking::
141 * Pragma Disable_Atomic_Synchronization::
142 * Pragma Dispatching_Domain::
143 * Pragma Elaboration_Checks::
144 * Pragma Eliminate::
145 * Pragma Enable_Atomic_Synchronization::
146 * Pragma Export_Exception::
147 * Pragma Export_Function::
148 * Pragma Export_Object::
149 * Pragma Export_Procedure::
150 * Pragma Export_Value::
151 * Pragma Export_Valued_Procedure::
152 * Pragma Extend_System::
153 * Pragma Extensions_Allowed::
154 * Pragma External::
155 * Pragma External_Name_Casing::
156 * Pragma Fast_Math::
157 * Pragma Favor_Top_Level::
158 * Pragma Finalize_Storage_Only::
159 * Pragma Float_Representation::
160 * Pragma Global::
161 * Pragma Ident::
162 * Pragma Implementation_Defined::
163 * Pragma Implemented::
164 * Pragma Implicit_Packing::
165 * Pragma Import_Exception::
166 * Pragma Import_Function::
167 * Pragma Import_Object::
168 * Pragma Import_Procedure::
169 * Pragma Import_Valued_Procedure::
170 * Pragma Independent::
171 * Pragma Independent_Components::
172 * Pragma Initial_Condition::
173 * Pragma Initialize_Scalars::
174 * Pragma Initializes::
175 * Pragma Inline_Always::
176 * Pragma Inline_Generic::
177 * Pragma Interface::
178 * Pragma Interface_Name::
179 * Pragma Interrupt_Handler::
180 * Pragma Interrupt_State::
181 * Pragma Invariant::
182 * Pragma Java_Constructor::
183 * Pragma Java_Interface::
184 * Pragma Keep_Names::
185 * Pragma License::
186 * Pragma Link_With::
187 * Pragma Linker_Alias::
188 * Pragma Linker_Constructor::
189 * Pragma Linker_Destructor::
190 * Pragma Linker_Section::
191 * Pragma Long_Float::
192 * Pragma Loop_Invariant::
193 * Pragma Loop_Optimize::
194 * Pragma Loop_Variant::
195 * Pragma Machine_Attribute::
196 * Pragma Main::
197 * Pragma Main_Storage::
198 * Pragma No_Body::
199 * Pragma No_Inline::
200 * Pragma No_Return::
201 * Pragma No_Run_Time::
202 * Pragma No_Strict_Aliasing ::
203 * Pragma Normalize_Scalars::
204 * Pragma Obsolescent::
205 * Pragma Optimize_Alignment::
206 * Pragma Ordered::
207 * Pragma Overflow_Mode::
208 * Pragma Overriding_Renamings::
209 * Pragma Partition_Elaboration_Policy::
210 * Pragma Passive::
211 * Pragma Persistent_BSS::
212 * Pragma Polling::
213 * Pragma Post::
214 * Pragma Postcondition::
215 * Pragma Post_Class::
216 * Pragma Pre::
217 * Pragma Precondition::
218 * Pragma Predicate::
219 * Pragma Preelaborable_Initialization::
220 * Pragma Preelaborate_05::
221 * Pragma Pre_Class::
222 * Pragma Priority_Specific_Dispatching::
223 * Pragma Profile::
224 * Pragma Profile_Warnings::
225 * Pragma Propagate_Exceptions::
226 * Pragma Psect_Object::
227 * Pragma Pure_05::
228 * Pragma Pure_12::
229 * Pragma Pure_Function::
230 * Pragma Ravenscar::
231 * Pragma Refined_State::
232 * Pragma Relative_Deadline::
233 * Pragma Remote_Access_Type::
234 * Pragma Restricted_Run_Time::
235 * Pragma Restriction_Warnings::
236 * Pragma Share_Generic::
237 * Pragma Shared::
238 * Pragma Short_Circuit_And_Or::
239 * Pragma Short_Descriptors::
240 * Pragma Simple_Storage_Pool_Type::
241 * Pragma Source_File_Name::
242 * Pragma Source_File_Name_Project::
243 * Pragma Source_Reference::
244 * Pragma SPARK_Mode::
245 * Pragma Static_Elaboration_Desired::
246 * Pragma Stream_Convert::
247 * Pragma Style_Checks::
248 * Pragma Subtitle::
249 * Pragma Suppress::
250 * Pragma Suppress_All::
251 * Pragma Suppress_Debug_Info::
252 * Pragma Suppress_Exception_Locations::
253 * Pragma Suppress_Initialization::
254 * Pragma Task_Info::
255 * Pragma Task_Name::
256 * Pragma Task_Storage::
257 * Pragma Test_Case::
258 * Pragma Thread_Local_Storage::
259 * Pragma Time_Slice::
260 * Pragma Title::
261 * Pragma Type_Invariant::
262 * Pragma Type_Invariant_Class::
263 * Pragma Unchecked_Union::
264 * Pragma Unimplemented_Unit::
265 * Pragma Universal_Aliasing ::
266 * Pragma Universal_Data::
267 * Pragma Unmodified::
268 * Pragma Unreferenced::
269 * Pragma Unreferenced_Objects::
270 * Pragma Unreserve_All_Interrupts::
271 * Pragma Unsuppress::
272 * Pragma Use_VADS_Size::
273 * Pragma Validity_Checks::
274 * Pragma Volatile::
275 * Pragma Warnings::
276 * Pragma Weak_External::
277 * Pragma Wide_Character_Encoding::
279 Implementation Defined Aspects
281 * Aspect Abstract_State::
282 * Aspect Ada_2005::
283 * Aspect Ada_2012::
284 * Aspect Compiler_Unit::
285 * Aspect Contract_Cases::
286 * Aspect Depends::
287 * Aspect Dimension::
288 * Aspect Dimension_System::
289 * Aspect Favor_Top_Level::
290 * Aspect Global::
291 * Aspect Initial_Condition::
292 * Aspect Initializes::
293 * Aspect Inline_Always::
294 * Aspect Invariant::
295 * Aspect Linker_Section::
296 * Aspect Object_Size::
297 * Aspect Persistent_BSS::
298 * Aspect Predicate::
299 * Aspect Preelaborate_05::
300 * Aspect Pure_05::
301 * Aspect Pure_12::
302 * Aspect Pure_Function::
303 * Aspect Refined_State::
304 * Aspect Remote_Access_Type::
305 * Aspect Scalar_Storage_Order::
306 * Aspect Shared::
307 * Aspect Simple_Storage_Pool::
308 * Aspect Simple_Storage_Pool_Type::
309 * Aspect SPARK_Mode::
310 * Aspect Suppress_Debug_Info::
311 * Aspect Test_Case::
312 * Aspect Universal_Aliasing::
313 * Aspect Universal_Data::
314 * Aspect Unmodified::
315 * Aspect Unreferenced::
316 * Aspect Unreferenced_Objects::
317 * Aspect Value_Size::
318 * Aspect Warnings::
320 Implementation Defined Attributes
322 * Attribute Abort_Signal::
323 * Attribute Address_Size::
324 * Attribute Asm_Input::
325 * Attribute Asm_Output::
326 * Attribute AST_Entry::
327 * Attribute Bit::
328 * Attribute Bit_Position::
329 * Attribute Compiler_Version::
330 * Attribute Code_Address::
331 * Attribute Default_Bit_Order::
332 * Attribute Descriptor_Size::
333 * Attribute Elaborated::
334 * Attribute Elab_Body::
335 * Attribute Elab_Spec::
336 * Attribute Elab_Subp_Body::
337 * Attribute Emax::
338 * Attribute Enabled::
339 * Attribute Enum_Rep::
340 * Attribute Enum_Val::
341 * Attribute Epsilon::
342 * Attribute Fixed_Value::
343 * Attribute Has_Access_Values::
344 * Attribute Has_Discriminants::
345 * Attribute Img::
346 * Attribute Integer_Value::
347 * Attribute Invalid_Value::
348 * Attribute Large::
349 * Attribute Library_Level::
350 * Attribute Loop_Entry::
351 * Attribute Machine_Size::
352 * Attribute Mantissa::
353 * Attribute Max_Interrupt_Priority::
354 * Attribute Max_Priority::
355 * Attribute Maximum_Alignment::
356 * Attribute Mechanism_Code::
357 * Attribute Null_Parameter::
358 * Attribute Object_Size::
359 * Attribute Passed_By_Reference::
360 * Attribute Pool_Address::
361 * Attribute Range_Length::
362 * Attribute Ref::
363 * Attribute Restriction_Set::
364 * Attribute Result::
365 * Attribute Safe_Emax::
366 * Attribute Safe_Large::
367 * Attribute Scalar_Storage_Order::
368 * Attribute Simple_Storage_Pool::
369 * Attribute Small::
370 * Attribute Storage_Unit::
371 * Attribute Stub_Type::
372 * Attribute System_Allocator_Alignment::
373 * Attribute Target_Name::
374 * Attribute Tick::
375 * Attribute To_Address::
376 * Attribute Type_Class::
377 * Attribute UET_Address::
378 * Attribute Unconstrained_Array::
379 * Attribute Universal_Literal_String::
380 * Attribute Unrestricted_Access::
381 * Attribute Update::
382 * Attribute Valid_Scalars::
383 * Attribute VADS_Size::
384 * Attribute Value_Size::
385 * Attribute Wchar_T_Size::
386 * Attribute Word_Size::
388 Standard and Implementation Defined Restrictions
390 * Partition-Wide Restrictions::
391 * Program Unit Level Restrictions::
393 Partition-Wide Restrictions
395 * Immediate_Reclamation::
396 * Max_Asynchronous_Select_Nesting::
397 * Max_Entry_Queue_Length::
398 * Max_Protected_Entries::
399 * Max_Select_Alternatives::
400 * Max_Storage_At_Blocking::
401 * Max_Task_Entries::
402 * Max_Tasks::
403 * No_Abort_Statements::
404 * No_Access_Parameter_Allocators::
405 * No_Access_Subprograms::
406 * No_Allocators::
407 * No_Anonymous_Allocators::
408 * No_Calendar::
409 * No_Coextensions::
410 * No_Default_Initialization::
411 * No_Delay::
412 * No_Dependence::
413 * No_Direct_Boolean_Operators::
414 * No_Dispatch::
415 * No_Dispatching_Calls::
416 * No_Dynamic_Attachment::
417 * No_Dynamic_Priorities::
418 * No_Entry_Calls_In_Elaboration_Code::
419 * No_Enumeration_Maps::
420 * No_Exception_Handlers::
421 * No_Exception_Propagation::
422 * No_Exception_Registration::
423 * No_Exceptions::
424 * No_Finalization::
425 * No_Fixed_Point::
426 * No_Floating_Point::
427 * No_Implicit_Conditionals::
428 * No_Implicit_Dynamic_Code::
429 * No_Implicit_Heap_Allocations::
430 * No_Implicit_Loops::
431 * No_Initialize_Scalars::
432 * No_IO::
433 * No_Local_Allocators::
434 * No_Local_Protected_Objects::
435 * No_Local_Timing_Events::
436 * No_Nested_Finalization::
437 * No_Protected_Type_Allocators::
438 * No_Protected_Types::
439 * No_Recursion::
440 * No_Reentrancy::
441 * No_Relative_Delay::
442 * No_Requeue_Statements::
443 * No_Secondary_Stack::
444 * No_Select_Statements::
445 * No_Specific_Termination_Handlers::
446 * No_Specification_of_Aspect::
447 * No_Standard_Allocators_After_Elaboration::
448 * No_Standard_Storage_Pools::
449 * No_Stream_Optimizations::
450 * No_Streams::
451 * No_Task_Allocators::
452 * No_Task_Attributes_Package::
453 * No_Task_Hierarchy::
454 * No_Task_Termination::
455 * No_Tasking::
456 * No_Terminate_Alternatives::
457 * No_Unchecked_Access::
458 * Simple_Barriers::
459 * Static_Priorities::
460 * Static_Storage_Size::
462 Program Unit Level Restrictions
464 * No_Elaboration_Code::
465 * No_Entry_Queue::
466 * No_Implementation_Aspect_Specifications::
467 * No_Implementation_Attributes::
468 * No_Implementation_Identifiers::
469 * No_Implementation_Pragmas::
470 * No_Implementation_Restrictions::
471 * No_Implementation_Units::
472 * No_Implicit_Aliasing::
473 * No_Obsolescent_Features::
474 * No_Wide_Characters::
475 * SPARK_05::
477 The Implementation of Standard I/O
479 * Standard I/O Packages::
480 * FORM Strings::
481 * Direct_IO::
482 * Sequential_IO::
483 * Text_IO::
484 * Wide_Text_IO::
485 * Wide_Wide_Text_IO::
486 * Stream_IO::
487 * Text Translation::
488 * Shared Files::
489 * Filenames encoding::
490 * Open Modes::
491 * Operations on C Streams::
492 * Interfacing to C Streams::
494 The GNAT Library
496 * Ada.Characters.Latin_9 (a-chlat9.ads)::
497 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads)::
498 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads)::
499 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)::
500 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)::
501 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)::
502 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)::
503 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)::
504 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)::
505 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)::
506 * Ada.Containers.Formal_Vectors (a-cofove.ads)::
507 * Ada.Command_Line.Environment (a-colien.ads)::
508 * Ada.Command_Line.Remove (a-colire.ads)::
509 * Ada.Command_Line.Response_File (a-clrefi.ads)::
510 * Ada.Direct_IO.C_Streams (a-diocst.ads)::
511 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)::
512 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)::
513 * Ada.Exceptions.Traceback (a-exctra.ads)::
514 * Ada.Sequential_IO.C_Streams (a-siocst.ads)::
515 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)::
516 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads)::
517 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)::
518 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)::
519 * Ada.Text_IO.C_Streams (a-tiocst.ads)::
520 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)::
521 * Ada.Wide_Characters.Unicode (a-wichun.ads)::
522 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)::
523 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)::
524 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)::
525 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)::
526 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)::
527 * GNAT.Altivec (g-altive.ads)::
528 * GNAT.Altivec.Conversions (g-altcon.ads)::
529 * GNAT.Altivec.Vector_Operations (g-alveop.ads)::
530 * GNAT.Altivec.Vector_Types (g-alvety.ads)::
531 * GNAT.Altivec.Vector_Views (g-alvevi.ads)::
532 * GNAT.Array_Split (g-arrspl.ads)::
533 * GNAT.AWK (g-awk.ads)::
534 * GNAT.Bounded_Buffers (g-boubuf.ads)::
535 * GNAT.Bounded_Mailboxes (g-boumai.ads)::
536 * GNAT.Bubble_Sort (g-bubsor.ads)::
537 * GNAT.Bubble_Sort_A (g-busora.ads)::
538 * GNAT.Bubble_Sort_G (g-busorg.ads)::
539 * GNAT.Byte_Order_Mark (g-byorma.ads)::
540 * GNAT.Byte_Swapping (g-bytswa.ads)::
541 * GNAT.Calendar (g-calend.ads)::
542 * GNAT.Calendar.Time_IO (g-catiio.ads)::
543 * GNAT.Case_Util (g-casuti.ads)::
544 * GNAT.CGI (g-cgi.ads)::
545 * GNAT.CGI.Cookie (g-cgicoo.ads)::
546 * GNAT.CGI.Debug (g-cgideb.ads)::
547 * GNAT.Command_Line (g-comlin.ads)::
548 * GNAT.Compiler_Version (g-comver.ads)::
549 * GNAT.Ctrl_C (g-ctrl_c.ads)::
550 * GNAT.CRC32 (g-crc32.ads)::
551 * GNAT.Current_Exception (g-curexc.ads)::
552 * GNAT.Debug_Pools (g-debpoo.ads)::
553 * GNAT.Debug_Utilities (g-debuti.ads)::
554 * GNAT.Decode_String (g-decstr.ads)::
555 * GNAT.Decode_UTF8_String (g-deutst.ads)::
556 * GNAT.Directory_Operations (g-dirope.ads)::
557 * GNAT.Directory_Operations.Iteration (g-diopit.ads)::
558 * GNAT.Dynamic_HTables (g-dynhta.ads)::
559 * GNAT.Dynamic_Tables (g-dyntab.ads)::
560 * GNAT.Encode_String (g-encstr.ads)::
561 * GNAT.Encode_UTF8_String (g-enutst.ads)::
562 * GNAT.Exception_Actions (g-excact.ads)::
563 * GNAT.Exception_Traces (g-exctra.ads)::
564 * GNAT.Exceptions (g-except.ads)::
565 * GNAT.Expect (g-expect.ads)::
566 * GNAT.Expect.TTY (g-exptty.ads)::
567 * GNAT.Float_Control (g-flocon.ads)::
568 * GNAT.Heap_Sort (g-heasor.ads)::
569 * GNAT.Heap_Sort_A (g-hesora.ads)::
570 * GNAT.Heap_Sort_G (g-hesorg.ads)::
571 * GNAT.HTable (g-htable.ads)::
572 * GNAT.IO (g-io.ads)::
573 * GNAT.IO_Aux (g-io_aux.ads)::
574 * GNAT.Lock_Files (g-locfil.ads)::
575 * GNAT.MBBS_Discrete_Random (g-mbdira.ads)::
576 * GNAT.MBBS_Float_Random (g-mbflra.ads)::
577 * GNAT.MD5 (g-md5.ads)::
578 * GNAT.Memory_Dump (g-memdum.ads)::
579 * GNAT.Most_Recent_Exception (g-moreex.ads)::
580 * GNAT.OS_Lib (g-os_lib.ads)::
581 * GNAT.Perfect_Hash_Generators (g-pehage.ads)::
582 * GNAT.Random_Numbers (g-rannum.ads)::
583 * GNAT.Regexp (g-regexp.ads)::
584 * GNAT.Registry (g-regist.ads)::
585 * GNAT.Regpat (g-regpat.ads)::
586 * GNAT.Secondary_Stack_Info (g-sestin.ads)::
587 * GNAT.Semaphores (g-semaph.ads)::
588 * GNAT.Serial_Communications (g-sercom.ads)::
589 * GNAT.SHA1 (g-sha1.ads)::
590 * GNAT.SHA224 (g-sha224.ads)::
591 * GNAT.SHA256 (g-sha256.ads)::
592 * GNAT.SHA384 (g-sha384.ads)::
593 * GNAT.SHA512 (g-sha512.ads)::
594 * GNAT.Signals (g-signal.ads)::
595 * GNAT.Sockets (g-socket.ads)::
596 * GNAT.Source_Info (g-souinf.ads)::
597 * GNAT.Spelling_Checker (g-speche.ads)::
598 * GNAT.Spelling_Checker_Generic (g-spchge.ads)::
599 * GNAT.Spitbol.Patterns (g-spipat.ads)::
600 * GNAT.Spitbol (g-spitbo.ads)::
601 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads)::
602 * GNAT.Spitbol.Table_Integer (g-sptain.ads)::
603 * GNAT.Spitbol.Table_VString (g-sptavs.ads)::
604 * GNAT.SSE (g-sse.ads)::
605 * GNAT.SSE.Vector_Types (g-ssvety.ads)::
606 * GNAT.Strings (g-string.ads)::
607 * GNAT.String_Split (g-strspl.ads)::
608 * GNAT.Table (g-table.ads)::
609 * GNAT.Task_Lock (g-tasloc.ads)::
610 * GNAT.Threads (g-thread.ads)::
611 * GNAT.Time_Stamp (g-timsta.ads)::
612 * GNAT.Traceback (g-traceb.ads)::
613 * GNAT.Traceback.Symbolic (g-trasym.ads)::
614 * GNAT.UTF_32 (g-utf_32.ads)::
615 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads)::
616 * GNAT.Wide_Spelling_Checker (g-wispch.ads)::
617 * GNAT.Wide_String_Split (g-wistsp.ads)::
618 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)::
619 * GNAT.Wide_Wide_String_Split (g-zistsp.ads)::
620 * Interfaces.C.Extensions (i-cexten.ads)::
621 * Interfaces.C.Streams (i-cstrea.ads)::
622 * Interfaces.CPP (i-cpp.ads)::
623 * Interfaces.Packed_Decimal (i-pacdec.ads)::
624 * Interfaces.VxWorks (i-vxwork.ads)::
625 * Interfaces.VxWorks.IO (i-vxwoio.ads)::
626 * System.Address_Image (s-addima.ads)::
627 * System.Assertions (s-assert.ads)::
628 * System.Memory (s-memory.ads)::
629 * System.Multiprocessors (s-multip.ads)::
630 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads)::
631 * System.Partition_Interface (s-parint.ads)::
632 * System.Pool_Global (s-pooglo.ads)::
633 * System.Pool_Local (s-pooloc.ads)::
634 * System.Restrictions (s-restri.ads)::
635 * System.Rident (s-rident.ads)::
636 * System.Strings.Stream_Ops (s-ststop.ads)::
637 * System.Task_Info (s-tasinf.ads)::
638 * System.Wch_Cnv (s-wchcnv.ads)::
639 * System.Wch_Con (s-wchcon.ads)::
641 Text_IO
643 * Text_IO Stream Pointer Positioning::
644 * Text_IO Reading and Writing Non-Regular Files::
645 * Get_Immediate::
646 * Treating Text_IO Files as Streams::
647 * Text_IO Extensions::
648 * Text_IO Facilities for Unbounded Strings::
650 Wide_Text_IO
652 * Wide_Text_IO Stream Pointer Positioning::
653 * Wide_Text_IO Reading and Writing Non-Regular Files::
655 Wide_Wide_Text_IO
657 * Wide_Wide_Text_IO Stream Pointer Positioning::
658 * Wide_Wide_Text_IO Reading and Writing Non-Regular Files::
660 Interfacing to Other Languages
662 * Interfacing to C::
663 * Interfacing to C++::
664 * Interfacing to COBOL::
665 * Interfacing to Fortran::
666 * Interfacing to non-GNAT Ada code::
668 Specialized Needs Annexes
670 Implementation of Specific Ada Features
671 * Machine Code Insertions::
672 * GNAT Implementation of Tasking::
673 * GNAT Implementation of Shared Passive Packages::
674 * Code Generation for Array Aggregates::
675 * The Size of Discriminated Records with Default Discriminants::
676 * Strict Conformance to the Ada Reference Manual::
678 Implementation of Ada 2012 Features
680 Obsolescent Features
682 GNU Free Documentation License
684 Index
685 @end menu
687 @end ifnottex
689 @node About This Guide
690 @unnumbered About This Guide
692 @noindent
693 This manual contains useful information in writing programs using the
694 @value{EDITION} compiler.  It includes information on implementation dependent
695 characteristics of @value{EDITION}, including all the information required by
696 Annex M of the Ada language standard.
698 @value{EDITION} implements Ada 95, Ada 2005 and Ada 2012, and it may also be
699 invoked in Ada 83 compatibility mode.
700 By default, @value{EDITION} assumes Ada 2012,
701 but you can override with a compiler switch
702 to explicitly specify the language version.
703 (Please refer to @ref{Compiling Different Versions of Ada,,, gnat_ugn,
704 @value{EDITION} User's Guide}, for details on these switches.)
705 Throughout this manual, references to ``Ada'' without a year suffix
706 apply to all the Ada versions of the language.
708 Ada is designed to be highly portable.
709 In general, a program will have the same effect even when compiled by
710 different compilers on different platforms.
711 However, since Ada is designed to be used in a
712 wide variety of applications, it also contains a number of system
713 dependent features to be used in interfacing to the external world.
714 @cindex Implementation-dependent features
715 @cindex Portability
717 Note: Any program that makes use of implementation-dependent features
718 may be non-portable.  You should follow good programming practice and
719 isolate and clearly document any sections of your program that make use
720 of these features in a non-portable manner.
722 @ifset PROEDITION
723 For ease of exposition, ``@value{EDITION}'' will be referred to simply as
724 ``GNAT'' in the remainder of this document.
725 @end ifset
727 @menu
728 * What This Reference Manual Contains::
729 * Conventions::
730 * Related Information::
731 @end menu
733 @node What This Reference Manual Contains
734 @unnumberedsec What This Reference Manual Contains
736 @noindent
737 This reference manual contains the following chapters:
739 @itemize @bullet
740 @item
741 @ref{Implementation Defined Pragmas}, lists GNAT implementation-dependent
742 pragmas, which can be used to extend and enhance the functionality of the
743 compiler.
745 @item
746 @ref{Implementation Defined Attributes}, lists GNAT
747 implementation-dependent attributes, which can be used to extend and
748 enhance the functionality of the compiler.
750 @item
751 @ref{Standard and Implementation Defined Restrictions}, lists GNAT
752 implementation-dependent restrictions, which can be used to extend and
753 enhance the functionality of the compiler.
755 @item
756 @ref{Implementation Advice}, provides information on generally
757 desirable behavior which are not requirements that all compilers must
758 follow since it cannot be provided on all systems, or which may be
759 undesirable on some systems.
761 @item
762 @ref{Implementation Defined Characteristics}, provides a guide to
763 minimizing implementation dependent features.
765 @item
766 @ref{Intrinsic Subprograms}, describes the intrinsic subprograms
767 implemented by GNAT, and how they can be imported into user
768 application programs.
770 @item
771 @ref{Representation Clauses and Pragmas}, describes in detail the
772 way that GNAT represents data, and in particular the exact set
773 of representation clauses and pragmas that is accepted.
775 @item
776 @ref{Standard Library Routines}, provides a listing of packages and a
777 brief description of the functionality that is provided by Ada's
778 extensive set of standard library routines as implemented by GNAT@.
780 @item
781 @ref{The Implementation of Standard I/O}, details how the GNAT
782 implementation of the input-output facilities.
784 @item
785 @ref{The GNAT Library}, is a catalog of packages that complement
786 the Ada predefined library.
788 @item
789 @ref{Interfacing to Other Languages}, describes how programs
790 written in Ada using GNAT can be interfaced to other programming
791 languages.
793 @ref{Specialized Needs Annexes}, describes the GNAT implementation of all
794 of the specialized needs annexes.
796 @item
797 @ref{Implementation of Specific Ada Features}, discusses issues related
798 to GNAT's implementation of machine code insertions, tasking, and several
799 other features.
801 @item
802 @ref{Implementation of Ada 2012 Features}, describes the status of the
803 GNAT implementation of the Ada 2012 language standard.
805 @item
806 @ref{Obsolescent Features} documents implementation dependent features,
807 including pragmas and attributes, which are considered obsolescent, since
808 there are other preferred ways of achieving the same results. These
809 obsolescent forms are retained for backwards compatibility.
811 @end itemize
813 @cindex Ada 95 Language Reference Manual
814 @cindex Ada 2005 Language Reference Manual
815 @noindent
816 This reference manual assumes a basic familiarity with the Ada 95 language, as
817 described in the International Standard ANSI/ISO/IEC-8652:1995,
818 January 1995.
819 It does not require knowledge of the new features introduced by Ada 2005,
820 (officially known as ISO/IEC 8652:1995 with Technical Corrigendum 1
821 and Amendment 1).
822 Both reference manuals are included in the GNAT documentation
823 package.
825 @node Conventions
826 @unnumberedsec Conventions
827 @cindex Conventions, typographical
828 @cindex Typographical conventions
830 @noindent
831 Following are examples of the typographical and graphic conventions used
832 in this guide:
834 @itemize @bullet
835 @item
836 @code{Functions}, @code{utility program names}, @code{standard names},
837 and @code{classes}.
839 @item
840 @code{Option flags}
842 @item
843 @file{File names}, @samp{button names}, and @samp{field names}.
845 @item
846 @code{Variables}, @env{environment variables}, and @var{metasyntactic
847 variables}.
849 @item
850 @emph{Emphasis}.
852 @item
853 [optional information or parameters]
855 @item
856 Examples are described by text
857 @smallexample
858 and then shown this way.
859 @end smallexample
860 @end itemize
862 @noindent
863 Commands that are entered by the user are preceded in this manual by the
864 characters @samp{$ } (dollar sign followed by space).  If your system uses this
865 sequence as a prompt, then the commands will appear exactly as you see them
866 in the manual.  If your system uses some other prompt, then the command will
867 appear with the @samp{$} replaced by whatever prompt character you are using.
869 @node Related Information
870 @unnumberedsec Related Information
871 @noindent
872 See the following documents for further information on GNAT:
874 @itemize @bullet
875 @item
876 @xref{Top, @value{EDITION} User's Guide, About This Guide, gnat_ugn,
877 @value{EDITION} User's Guide}, which provides information on how to use the
878 GNAT compiler system.
880 @item
881 @cite{Ada 95 Reference Manual}, which contains all reference
882 material for the Ada 95 programming language.
884 @item
885 @cite{Ada 95 Annotated Reference Manual}, which is an annotated version
886 of the Ada 95 standard.  The annotations describe
887 detailed aspects of the design decision, and in particular contain useful
888 sections on Ada 83 compatibility.
890 @item
891 @cite{Ada 2005 Reference Manual}, which contains all reference
892 material for the Ada 2005 programming language.
894 @item
895 @cite{Ada 2005 Annotated Reference Manual}, which is an annotated version
896 of the Ada 2005 standard.  The annotations describe
897 detailed aspects of the design decision, and in particular contain useful
898 sections on Ada 83 and Ada 95 compatibility.
900 @item
901 @cite{DEC Ada, Technical Overview and Comparison on DIGITAL Platforms},
902 which contains specific information on compatibility between GNAT and
903 DEC Ada 83 systems.
905 @item
906 @cite{DEC Ada, Language Reference Manual, part number AA-PYZAB-TK} which
907 describes in detail the pragmas and attributes provided by the DEC Ada 83
908 compiler system.
910 @end itemize
912 @node Implementation Defined Pragmas
913 @chapter Implementation Defined Pragmas
915 @noindent
916 Ada defines a set of pragmas that can be used to supply additional
917 information to the compiler.  These language defined pragmas are
918 implemented in GNAT and work as described in the Ada Reference Manual.
920 In addition, Ada allows implementations to define additional pragmas
921 whose meaning is defined by the implementation.  GNAT provides a number
922 of these implementation-defined pragmas, which can be used to extend
923 and enhance the functionality of the compiler.  This section of the GNAT
924 Reference Manual describes these additional pragmas.
926 Note that any program using these pragmas might not be portable to other
927 compilers (although GNAT implements this set of pragmas on all
928 platforms).  Therefore if portability to other compilers is an important
929 consideration, the use of these pragmas should be minimized.
931 @menu
932 * Pragma Abort_Defer::
933 * Pragma Abstract_State::
934 * Pragma Ada_83::
935 * Pragma Ada_95::
936 * Pragma Ada_05::
937 * Pragma Ada_2005::
938 * Pragma Ada_12::
939 * Pragma Ada_2012::
940 * Pragma Allow_Integer_Address::
941 * Pragma Annotate::
942 * Pragma Assert::
943 * Pragma Assert_And_Cut::
944 * Pragma Assertion_Policy::
945 * Pragma Assume::
946 * Pragma Assume_No_Invalid_Values::
947 * Pragma Attribute_Definition::
948 * Pragma Ast_Entry::
949 * Pragma C_Pass_By_Copy::
950 * Pragma Check::
951 * Pragma Check_Float_Overflow::
952 * Pragma Check_Name::
953 * Pragma Check_Policy::
954 * Pragma CIL_Constructor::
955 * Pragma Comment::
956 * Pragma Common_Object::
957 * Pragma Compile_Time_Error::
958 * Pragma Compile_Time_Warning::
959 * Pragma Compiler_Unit::
960 * Pragma Complete_Representation::
961 * Pragma Complex_Representation::
962 * Pragma Component_Alignment::
963 * Pragma Contract_Cases::
964 * Pragma Convention_Identifier::
965 * Pragma CPP_Class::
966 * Pragma CPP_Constructor::
967 * Pragma CPP_Virtual::
968 * Pragma CPP_Vtable::
969 * Pragma CPU::
970 * Pragma Debug::
971 * Pragma Debug_Policy::
972 * Pragma Default_Storage_Pool::
973 * Pragma Depends::
974 * Pragma Detect_Blocking::
975 * Pragma Disable_Atomic_Synchronization::
976 * Pragma Dispatching_Domain::
977 * Pragma Elaboration_Checks::
978 * Pragma Eliminate::
979 * Pragma Enable_Atomic_Synchronization::
980 * Pragma Export_Exception::
981 * Pragma Export_Function::
982 * Pragma Export_Object::
983 * Pragma Export_Procedure::
984 * Pragma Export_Value::
985 * Pragma Export_Valued_Procedure::
986 * Pragma Extend_System::
987 * Pragma Extensions_Allowed::
988 * Pragma External::
989 * Pragma External_Name_Casing::
990 * Pragma Fast_Math::
991 * Pragma Favor_Top_Level::
992 * Pragma Finalize_Storage_Only::
993 * Pragma Float_Representation::
994 * Pragma Global::
995 * Pragma Ident::
996 * Pragma Implementation_Defined::
997 * Pragma Implemented::
998 * Pragma Implicit_Packing::
999 * Pragma Import_Exception::
1000 * Pragma Import_Function::
1001 * Pragma Import_Object::
1002 * Pragma Import_Procedure::
1003 * Pragma Import_Valued_Procedure::
1004 * Pragma Independent::
1005 * Pragma Independent_Components::
1006 * Pragma Initial_Condition::
1007 * Pragma Initialize_Scalars::
1008 * Pragma Initializes::
1009 * Pragma Inline_Always::
1010 * Pragma Inline_Generic::
1011 * Pragma Interface::
1012 * Pragma Interface_Name::
1013 * Pragma Interrupt_Handler::
1014 * Pragma Interrupt_State::
1015 * Pragma Invariant::
1016 * Pragma Java_Constructor::
1017 * Pragma Java_Interface::
1018 * Pragma Keep_Names::
1019 * Pragma License::
1020 * Pragma Link_With::
1021 * Pragma Linker_Alias::
1022 * Pragma Linker_Constructor::
1023 * Pragma Linker_Destructor::
1024 * Pragma Linker_Section::
1025 * Pragma Long_Float::
1026 * Pragma Loop_Invariant::
1027 * Pragma Loop_Optimize::
1028 * Pragma Loop_Variant::
1029 * Pragma Machine_Attribute::
1030 * Pragma Main::
1031 * Pragma Main_Storage::
1032 * Pragma No_Body::
1033 * Pragma No_Inline::
1034 * Pragma No_Return::
1035 * Pragma No_Run_Time::
1036 * Pragma No_Strict_Aliasing::
1037 * Pragma Normalize_Scalars::
1038 * Pragma Obsolescent::
1039 * Pragma Optimize_Alignment::
1040 * Pragma Ordered::
1041 * Pragma Overflow_Mode::
1042 * Pragma Overriding_Renamings::
1043 * Pragma Partition_Elaboration_Policy::
1044 * Pragma Passive::
1045 * Pragma Persistent_BSS::
1046 * Pragma Polling::
1047 * Pragma Post::
1048 * Pragma Postcondition::
1049 * Pragma Post_Class::
1050 * Pragma Pre::
1051 * Pragma Precondition::
1052 * Pragma Predicate::
1053 * Pragma Preelaborable_Initialization::
1054 * Pragma Preelaborate_05::
1055 * Pragma Pre_Class::
1056 * Pragma Priority_Specific_Dispatching::
1057 * Pragma Profile::
1058 * Pragma Profile_Warnings::
1059 * Pragma Propagate_Exceptions::
1060 * Pragma Psect_Object::
1061 * Pragma Pure_05::
1062 * Pragma Pure_12::
1063 * Pragma Pure_Function::
1064 * Pragma Ravenscar::
1065 * Pragma Refined_State::
1066 * Pragma Relative_Deadline::
1067 * Pragma Remote_Access_Type::
1068 * Pragma Restricted_Run_Time::
1069 * Pragma Restriction_Warnings::
1070 * Pragma Share_Generic::
1071 * Pragma Shared::
1072 * Pragma Short_Circuit_And_Or::
1073 * Pragma Short_Descriptors::
1074 * Pragma Simple_Storage_Pool_Type::
1075 * Pragma Source_File_Name::
1076 * Pragma Source_File_Name_Project::
1077 * Pragma Source_Reference::
1078 * Pragma SPARK_Mode::
1079 * Pragma Static_Elaboration_Desired::
1080 * Pragma Stream_Convert::
1081 * Pragma Style_Checks::
1082 * Pragma Subtitle::
1083 * Pragma Suppress::
1084 * Pragma Suppress_All::
1085 * Pragma Suppress_Debug_Info::
1086 * Pragma Suppress_Exception_Locations::
1087 * Pragma Suppress_Initialization::
1088 * Pragma Task_Info::
1089 * Pragma Task_Name::
1090 * Pragma Task_Storage::
1091 * Pragma Test_Case::
1092 * Pragma Thread_Local_Storage::
1093 * Pragma Time_Slice::
1094 * Pragma Title::
1095 * Pragma Type_Invariant::
1096 * Pragma Type_Invariant_Class::
1097 * Pragma Unchecked_Union::
1098 * Pragma Unimplemented_Unit::
1099 * Pragma Universal_Aliasing ::
1100 * Pragma Universal_Data::
1101 * Pragma Unmodified::
1102 * Pragma Unreferenced::
1103 * Pragma Unreferenced_Objects::
1104 * Pragma Unreserve_All_Interrupts::
1105 * Pragma Unsuppress::
1106 * Pragma Use_VADS_Size::
1107 * Pragma Validity_Checks::
1108 * Pragma Volatile::
1109 * Pragma Warnings::
1110 * Pragma Weak_External::
1111 * Pragma Wide_Character_Encoding::
1112 @end menu
1114 @node Pragma Abort_Defer
1115 @unnumberedsec Pragma Abort_Defer
1116 @findex Abort_Defer
1117 @cindex Deferring aborts
1118 @noindent
1119 Syntax:
1120 @smallexample
1121 pragma Abort_Defer;
1122 @end smallexample
1124 @noindent
1125 This pragma must appear at the start of the statement sequence of a
1126 handled sequence of statements (right after the @code{begin}).  It has
1127 the effect of deferring aborts for the sequence of statements (but not
1128 for the declarations or handlers, if any, associated with this statement
1129 sequence).
1131 @node Pragma Abstract_State
1132 @unnumberedsec Pragma Abstract_State
1133 @findex Abstract_State
1134 @noindent
1135 For the description of this pragma, see SPARK 2014 Reference Manual,
1136 section 7.1.4.
1138 @node Pragma Ada_83
1139 @unnumberedsec Pragma Ada_83
1140 @findex Ada_83
1141 @noindent
1142 Syntax:
1143 @smallexample @c ada
1144 pragma Ada_83;
1145 @end smallexample
1147 @noindent
1148 A configuration pragma that establishes Ada 83 mode for the unit to
1149 which it applies, regardless of the mode set by the command line
1150 switches.  In Ada 83 mode, GNAT attempts to be as compatible with
1151 the syntax and semantics of Ada 83, as defined in the original Ada
1152 83 Reference Manual as possible.  In particular, the keywords added by Ada 95
1153 and Ada 2005 are not recognized, optional package bodies are allowed,
1154 and generics may name types with unknown discriminants without using
1155 the @code{(<>)} notation.  In addition, some but not all of the additional
1156 restrictions of Ada 83 are enforced.
1158 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
1159 Ada 83 code to be compiled and adapted to GNAT with less effort.
1160 Secondly, it aids in keeping code backwards compatible with Ada 83.
1161 However, there is no guarantee that code that is processed correctly
1162 by GNAT in Ada 83 mode will in fact compile and execute with an Ada
1163 83 compiler, since GNAT does not enforce all the additional checks
1164 required by Ada 83.
1166 @node Pragma Ada_95
1167 @unnumberedsec Pragma Ada_95
1168 @findex Ada_95
1169 @noindent
1170 Syntax:
1171 @smallexample @c ada
1172 pragma Ada_95;
1173 @end smallexample
1175 @noindent
1176 A configuration pragma that establishes Ada 95 mode for the unit to which
1177 it applies, regardless of the mode set by the command line switches.
1178 This mode is set automatically for the @code{Ada} and @code{System}
1179 packages and their children, so you need not specify it in these
1180 contexts.  This pragma is useful when writing a reusable component that
1181 itself uses Ada 95 features, but which is intended to be usable from
1182 either Ada 83 or Ada 95 programs.
1184 @node Pragma Ada_05
1185 @unnumberedsec Pragma Ada_05
1186 @findex Ada_05
1187 @noindent
1188 Syntax:
1189 @smallexample @c ada
1190 pragma Ada_05;
1191 @end smallexample
1193 @noindent
1194 A configuration pragma that establishes Ada 2005 mode for the unit to which
1195 it applies, regardless of the mode set by the command line switches.
1196 This pragma is useful when writing a reusable component that
1197 itself uses Ada 2005 features, but which is intended to be usable from
1198 either Ada 83 or Ada 95 programs.
1200 @node Pragma Ada_2005
1201 @unnumberedsec Pragma Ada_2005
1202 @findex Ada_2005
1203 @noindent
1204 Syntax:
1205 @smallexample @c ada
1206 pragma Ada_2005;
1207 @end smallexample
1209 @noindent
1210 This configuration pragma is a synonym for pragma Ada_05 and has the
1211 same syntax and effect.
1213 @node Pragma Ada_12
1214 @unnumberedsec Pragma Ada_12
1215 @findex Ada_12
1216 @noindent
1217 Syntax:
1218 @smallexample @c ada
1219 pragma Ada_12;
1220 @end smallexample
1222 @noindent
1223 A configuration pragma that establishes Ada 2012 mode for the unit to which
1224 it applies, regardless of the mode set by the command line switches.
1225 This mode is set automatically for the @code{Ada} and @code{System}
1226 packages and their children, so you need not specify it in these
1227 contexts.  This pragma is useful when writing a reusable component that
1228 itself uses Ada 2012 features, but which is intended to be usable from
1229 Ada 83, Ada 95, or Ada 2005 programs.
1231 @node Pragma Ada_2012
1232 @unnumberedsec Pragma Ada_2012
1233 @findex Ada_2005
1234 @noindent
1235 Syntax:
1236 @smallexample @c ada
1237 pragma Ada_2012;
1238 @end smallexample
1240 @noindent
1241 This configuration pragma is a synonym for pragma Ada_12 and has the
1242 same syntax and effect.
1244 @node Pragma Allow_Integer_Address
1245 @unnumberedsec Pragma Allow_Integer_Address
1246 @findex Allow_Integer_Address
1247 @noindent
1248 Syntax:
1249 @smallexample @c ada
1250 pragma Allow_Integer_Address;
1251 @end smallexample
1253 @noindent
1254 In almost all versions of GNAT, @code{System.Address} is a private
1255 type in accordance with the implementation advice in the RM. This
1256 means that integer values,
1257 in particular integer literals, are not allowed as address values.
1258 If the configuration pragma
1259 @code{Allow_Integer_Address} is given, then integer expressions may
1260 be used anywhere a value of type @code{System.Address} is required.
1261 The effect is to introduce an implicit unchecked conversion from the
1262 integer value to type @code{System.Address}. The reverse case of using
1263 an address where an integer type is required is handled analogously.
1264 The following example compiles without errors:
1266 @smallexample @c ada
1267 pragma Allow_Integer_Address;
1268 with System; use System;
1269 package AddrAsInt is
1270    X : Integer;
1271    Y : Integer;
1272    for X'Address use 16#1240#;
1273    for Y use at 16#3230#;
1274    m : Address := 16#4000#;
1275    n : constant Address := 4000;
1276    p : constant Address := Address (X + Y);
1277    v : Integer := y'Address;
1278    w : constant Integer := Integer (Y'Address);
1279    type R is new integer;
1280    RR : R := 1000;
1281    Z : Integer;
1282    for Z'Address use RR;
1283 end AddrAsInt;
1284 @end smallexample
1286 @noindent
1287 Note that pragma @code{Allow_Integer_Address} is ignored if
1288 @code{System.Address}
1289 is not a private type. In implementations of @code{GNAT} where
1290 System.Address is a visible integer type (notably the implementations
1291 for @code{OpenVMS}), this pragma serves no purpose but is ignored
1292 rather than rejected to allow common sets of sources to be used
1293 in the two situations.
1295 @node Pragma Annotate
1296 @unnumberedsec Pragma Annotate
1297 @findex Annotate
1298 @noindent
1299 Syntax:
1300 @smallexample @c ada
1301 pragma Annotate (IDENTIFIER [,IDENTIFIER @{, ARG@}]);
1303 ARG ::= NAME | EXPRESSION
1304 @end smallexample
1306 @noindent
1307 This pragma is used to annotate programs.  @var{identifier} identifies
1308 the type of annotation.  GNAT verifies that it is an identifier, but does
1309 not otherwise analyze it. The second optional identifier is also left
1310 unanalyzed, and by convention is used to control the action of the tool to
1311 which the annotation is addressed.  The remaining @var{arg} arguments
1312 can be either string literals or more generally expressions.
1313 String literals are assumed to be either of type
1314 @code{Standard.String} or else @code{Wide_String} or @code{Wide_Wide_String}
1315 depending on the character literals they contain.
1316 All other kinds of arguments are analyzed as expressions, and must be
1317 unambiguous.
1319 The analyzed pragma is retained in the tree, but not otherwise processed
1320 by any part of the GNAT compiler, except to generate corresponding note
1321 lines in the generated ALI file. For the format of these note lines, see
1322 the compiler source file lib-writ.ads. This pragma is intended for use by
1323 external tools, including ASIS@. The use of pragma Annotate does not
1324 affect the compilation process in any way. This pragma may be used as
1325 a configuration pragma.
1327 @node Pragma Assert
1328 @unnumberedsec Pragma Assert
1329 @findex Assert
1330 @noindent
1331 Syntax:
1332 @smallexample @c ada
1333 pragma Assert (
1334   boolean_EXPRESSION
1335   [, string_EXPRESSION]);
1336 @end smallexample
1338 @noindent
1339 The effect of this pragma depends on whether the corresponding command
1340 line switch is set to activate assertions.  The pragma expands into code
1341 equivalent to the following:
1343 @smallexample @c ada
1344 if assertions-enabled then
1345    if not boolean_EXPRESSION then
1346       System.Assertions.Raise_Assert_Failure
1347         (string_EXPRESSION);
1348    end if;
1349 end if;
1350 @end smallexample
1352 @noindent
1353 The string argument, if given, is the message that will be associated
1354 with the exception occurrence if the exception is raised.  If no second
1355 argument is given, the default message is @samp{@var{file}:@var{nnn}},
1356 where @var{file} is the name of the source file containing the assert,
1357 and @var{nnn} is the line number of the assert.  A pragma is not a
1358 statement, so if a statement sequence contains nothing but a pragma
1359 assert, then a null statement is required in addition, as in:
1361 @smallexample @c ada
1362 @dots{}
1363 if J > 3 then
1364    pragma Assert (K > 3, "Bad value for K");
1365    null;
1366 end if;
1367 @end smallexample
1369 @noindent
1370 Note that, as with the @code{if} statement to which it is equivalent, the
1371 type of the expression is either @code{Standard.Boolean}, or any type derived
1372 from this standard type.
1374 Assert checks can be either checked or ignored. By default they are ignored.
1375 They will be checked if either the command line switch @option{-gnata} is
1376 used, or if an @code{Assertion_Policy} or @code{Check_Policy} pragma is used
1377 to enable @code{Assert_Checks}.
1379 If assertions are ignored, then there
1380 is no run-time effect (and in particular, any side effects from the
1381 expression will not occur at run time).  (The expression is still
1382 analyzed at compile time, and may cause types to be frozen if they are
1383 mentioned here for the first time).
1385 If assertions are checked, then the given expression is tested, and if
1386 it is @code{False} then @code{System.Assertions.Raise_Assert_Failure} is called
1387 which results in the raising of @code{Assert_Failure} with the given message.
1389 You should generally avoid side effects in the expression arguments of
1390 this pragma, because these side effects will turn on and off with the
1391 setting of the assertions mode, resulting in assertions that have an
1392 effect on the program.  However, the expressions are analyzed for
1393 semantic correctness whether or not assertions are enabled, so turning
1394 assertions on and off cannot affect the legality of a program.
1396 Note that the implementation defined policy @code{DISABLE}, given in a
1397 pragma @code{Assertion_Policy}, can be used to suppress this semantic analysis.
1399 Note: this is a standard language-defined pragma in versions
1400 of Ada from 2005 on. In GNAT, it is implemented in all versions
1401 of Ada, and the DISABLE policy is an implementation-defined
1402 addition.
1404 @node Pragma Assert_And_Cut
1405 @unnumberedsec Pragma Assert_And_Cut
1406 @findex Assert_And_Cut
1407 @noindent
1408 Syntax:
1409 @smallexample @c ada
1410 pragma Assert_And_Cut (
1411   boolean_EXPRESSION
1412   [, string_EXPRESSION]);
1413 @end smallexample
1415 @noindent
1416 The effect of this pragma is identical to that of pragma @code{Assert},
1417 except that in an @code{Assertion_Policy} pragma, the identifier
1418 @code{Assert_And_Cut} is used to control whether it is ignored or checked
1419 (or disabled).
1421 The intention is that this be used within a subprogram when the
1422 given test expresion sums up all the work done so far in the
1423 subprogram, so that the rest of the subprogram can be verified
1424 (informally or formally) using only the entry preconditions,
1425 and the expression in this pragma. This allows dividing up
1426 a subprogram into sections for the purposes of testing or
1427 formal verification. The pragma also serves as useful
1428 documentation.
1430 @node Pragma Assertion_Policy
1431 @unnumberedsec Pragma Assertion_Policy
1432 @findex Assertion_Policy
1433 @noindent
1434 Syntax:
1435 @smallexample @c ada
1436 pragma Assertion_Policy (CHECK | DISABLE | IGNORE);
1438 pragma Assertion_Policy (
1439     ASSERTION_KIND => POLICY_IDENTIFIER
1440  @{, ASSERTION_KIND => POLICY_IDENTIFIER@});
1442 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1444 RM_ASSERTION_KIND ::= Assert               |
1445                       Static_Predicate     |
1446                       Dynamic_Predicate    |
1447                       Pre                  |
1448                       Pre'Class            |
1449                       Post                 |
1450                       Post'Class           |
1451                       Type_Invariant       |
1452                       Type_Invariant'Class
1454 ID_ASSERTION_KIND ::= Assertions           |
1455                       Assert_And_Cut       |
1456                       Assume               |
1457                       Contract_Cases       |
1458                       Debug                |
1459                       Invariant            |
1460                       Invariant'Class      |
1461                       Loop_Invariant       |
1462                       Loop_Variant         |
1463                       Postcondition        |
1464                       Precondition         |
1465                       Predicate            |
1466                       Refined_Post         |
1467                       Statement_Assertions
1469 POLICY_IDENTIFIER ::= Check | Disable | Ignore
1470 @end smallexample
1472 @noindent
1473 This is a standard Ada 2012 pragma that is available as an
1474 implementation-defined pragma in earlier versions of Ada.
1475 The assertion kinds @code{RM_ASSERTION_KIND} are those defined in
1476 the Ada standard. The assertion kinds @code{ID_ASSERTION_KIND}
1477 are implementation defined additions recognized by the GNAT compiler.
1479 The pragma applies in both cases to pragmas and aspects with matching
1480 names, e.g. @code{Pre} applies to the Pre aspect, and @code{Precondition}
1481 applies to both the @code{Precondition} pragma
1482 and the aspect @code{Precondition}. Note that the identifiers for
1483 pragmas Pre_Class and Post_Class are Pre'Class and Post'Class (not
1484 Pre_Class and Post_Class), since these pragmas are intended to be
1485 identical to the corresponding aspects).
1487 If the policy is @code{CHECK}, then assertions are enabled, i.e.
1488 the corresponding pragma or aspect is activated.
1489 If the policy is @code{IGNORE}, then assertions are ignored, i.e.
1490 the corresponding pragma or aspect is deactivated.
1491 This pragma overrides the effect of the @option{-gnata} switch on the
1492 command line.
1494 The implementation defined policy @code{DISABLE} is like
1495 @code{IGNORE} except that it completely disables semantic
1496 checking of the corresponding pragma or aspect. This is
1497 useful when the pragma or aspect argument references subprograms
1498 in a with'ed package which is replaced by a dummy package
1499 for the final build.
1501 The implementation defined policy @code{Assertions} applies to all
1502 assertion kinds. The form with no assertion kind given implies this
1503 choice, so it applies to all assertion kinds (RM defined, and
1504 implementation defined).
1506 The implementation defined policy @code{Statement_Assertions}
1507 applies to @code{Assert}, @code{Assert_And_Cut},
1508 @code{Assume}, @code{Loop_Invariant}, and @code{Loop_Variant}.
1510 @node Pragma Assume
1511 @unnumberedsec Pragma Assume
1512 @findex Assume
1513 @noindent
1514 Syntax:
1515 @smallexample @c ada
1516 pragma Assume (
1517   boolean_EXPRESSION
1518   [, string_EXPRESSION]);
1519 @end smallexample
1521 @noindent
1522 The effect of this pragma is identical to that of pragma @code{Assert},
1523 except that in an @code{Assertion_Policy} pragma, the identifier
1524 @code{Assume} is used to control whether it is ignored or checked
1525 (or disabled).
1527 The intention is that this be used for assumptions about the
1528 external environment. So you cannot expect to verify formally
1529 or informally that the condition is met, this must be
1530 established by examining things outside the program itself.
1531 For example, we may have code that depends on the size of
1532 @code{Long_Long_Integer} being at least 64. So we could write:
1534 @smallexample @c ada
1535 pragma Assume (Long_Long_Integer'Size >= 64);
1536 @end smallexample
1538 @noindent
1539 This assumption cannot be proved from the program itself,
1540 but it acts as a useful run-time check that the assumption
1541 is met, and documents the need to ensure that it is met by
1542 reference to information outside the program.
1544 @node Pragma Assume_No_Invalid_Values
1545 @unnumberedsec Pragma Assume_No_Invalid_Values
1546 @findex Assume_No_Invalid_Values
1547 @cindex Invalid representations
1548 @cindex Invalid values
1549 @noindent
1550 Syntax:
1551 @smallexample @c ada
1552 pragma Assume_No_Invalid_Values (On | Off);
1553 @end smallexample
1555 @noindent
1556 This is a configuration pragma that controls the assumptions made by the
1557 compiler about the occurrence of invalid representations (invalid values)
1558 in the code.
1560 The default behavior (corresponding to an Off argument for this pragma), is
1561 to assume that values may in general be invalid unless the compiler can
1562 prove they are valid. Consider the following example:
1564 @smallexample @c ada
1565 V1 : Integer range 1 .. 10;
1566 V2 : Integer range 11 .. 20;
1568 for J in V2 .. V1 loop
1569    ...
1570 end loop;
1571 @end smallexample
1573 @noindent
1574 if V1 and V2 have valid values, then the loop is known at compile
1575 time not to execute since the lower bound must be greater than the
1576 upper bound. However in default mode, no such assumption is made,
1577 and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
1578 is given, the compiler will assume that any occurrence of a variable
1579 other than in an explicit @code{'Valid} test always has a valid
1580 value, and the loop above will be optimized away.
1582 The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
1583 you know your code is free of uninitialized variables and other
1584 possible sources of invalid representations, and may result in
1585 more efficient code. A program that accesses an invalid representation
1586 with this pragma in effect is erroneous, so no guarantees can be made
1587 about its behavior.
1589 It is peculiar though permissible to use this pragma in conjunction
1590 with validity checking (-gnatVa). In such cases, accessing invalid
1591 values will generally give an exception, though formally the program
1592 is erroneous so there are no guarantees that this will always be the
1593 case, and it is recommended that these two options not be used together.
1595 @node Pragma Ast_Entry
1596 @unnumberedsec Pragma Ast_Entry
1597 @cindex OpenVMS
1598 @findex Ast_Entry
1599 @noindent
1600 Syntax:
1601 @smallexample @c ada
1602 pragma AST_Entry (entry_IDENTIFIER);
1603 @end smallexample
1605 @noindent
1606 This pragma is implemented only in the OpenVMS implementation of GNAT@.  The
1607 argument is the simple name of a single entry; at most one @code{AST_Entry}
1608 pragma is allowed for any given entry.  This pragma must be used in
1609 conjunction with the @code{AST_Entry} attribute, and is only allowed after
1610 the entry declaration and in the same task type specification or single task
1611 as the entry to which it applies.  This pragma specifies that the given entry
1612 may be used to handle an OpenVMS asynchronous system trap (@code{AST})
1613 resulting from an OpenVMS system service call.  The pragma does not affect
1614 normal use of the entry.  For further details on this pragma, see the
1615 DEC Ada Language Reference Manual, section 9.12a.
1617 @node Pragma Attribute_Definition
1618 @unnumberedsec Pragma Attribute_Definition
1619 @findex Attribute_Definition
1620 @noindent
1621 Syntax:
1622 @smallexample @c ada
1623 pragma Attribute_Definition
1624   ([Attribute  =>] ATTRIBUTE_DESIGNATOR,
1625    [Entity     =>] LOCAL_NAME,
1626    [Expression =>] EXPRESSION | NAME);
1627 @end smallexample
1629 @noindent
1630 If @code{Attribute} is a known attribute name, this pragma is equivalent to
1631 the attribute definition clause:
1633 @smallexample @c ada
1634   for Entity'Attribute use Expression;
1635 @end smallexample
1637 If @code{Attribute} is not a recognized attribute name, the pragma is
1638 ignored, and a warning is emitted. This allows source
1639 code to be written that takes advantage of some new attribute, while remaining
1640 compilable with earlier compilers.
1642 @node Pragma C_Pass_By_Copy
1643 @unnumberedsec Pragma C_Pass_By_Copy
1644 @cindex Passing by copy
1645 @findex C_Pass_By_Copy
1646 @noindent
1647 Syntax:
1648 @smallexample @c ada
1649 pragma C_Pass_By_Copy
1650   ([Max_Size =>] static_integer_EXPRESSION);
1651 @end smallexample
1653 @noindent
1654 Normally the default mechanism for passing C convention records to C
1655 convention subprograms is to pass them by reference, as suggested by RM
1656 B.3(69).  Use the configuration pragma @code{C_Pass_By_Copy} to change
1657 this default, by requiring that record formal parameters be passed by
1658 copy if all of the following conditions are met:
1660 @itemize @bullet
1661 @item
1662 The size of the record type does not exceed the value specified for
1663 @code{Max_Size}.
1664 @item
1665 The record type has @code{Convention C}.
1666 @item
1667 The formal parameter has this record type, and the subprogram has a
1668 foreign (non-Ada) convention.
1669 @end itemize
1671 @noindent
1672 If these conditions are met the argument is passed by copy, i.e.@: in a
1673 manner consistent with what C expects if the corresponding formal in the
1674 C prototype is a struct (rather than a pointer to a struct).
1676 You can also pass records by copy by specifying the convention
1677 @code{C_Pass_By_Copy} for the record type, or by using the extended
1678 @code{Import} and @code{Export} pragmas, which allow specification of
1679 passing mechanisms on a parameter by parameter basis.
1681 @node Pragma Check
1682 @unnumberedsec Pragma Check
1683 @cindex Assertions
1684 @cindex Named assertions
1685 @findex Check
1686 @noindent
1687 Syntax:
1688 @smallexample @c ada
1689 pragma Check (
1690      [Name    =>] CHECK_KIND,
1691      [Check   =>] Boolean_EXPRESSION
1692   [, [Message =>] string_EXPRESSION] );
1694 CHECK_KIND ::= IDENTIFIER           |
1695                Pre'Class            |
1696                Post'Class           |
1697                Type_Invariant'Class |
1698                Invariant'Class
1699 @end smallexample
1701 @noindent
1702 This pragma is similar to the predefined pragma @code{Assert} except that an
1703 extra identifier argument is present. In conjunction with pragma
1704 @code{Check_Policy}, this can be used to define groups of assertions that can
1705 be independently controlled. The identifier @code{Assertion} is special, it
1706 refers to the normal set of pragma @code{Assert} statements.
1708 Checks introduced by this pragma are normally deactivated by default. They can
1709 be activated either by the command line option @option{-gnata}, which turns on
1710 all checks, or individually controlled using pragma @code{Check_Policy}.
1712 The identifiers @code{Assertions} and @code{Statement_Assertions} are not
1713 permitted as check kinds, since this would cause confusion with the use
1714 of these identifiers in @code{Assertion_Policy} and @code{Check_Policy}
1715 pragmas, where they are used to refer to sets of assertions.
1717 @node Pragma Check_Float_Overflow
1718 @unnumberedsec Pragma Check_Float_Overflow
1719 @cindex Floating-point overflow
1720 @findex Check_Float_Overflow
1721 @noindent
1722 Syntax:
1723 @smallexample @c ada
1724 pragma Check_Float_Overflow;
1725 @end smallexample
1727 @noindent
1728 In Ada, the predefined floating-point types (@code{Short_Float},
1729 @code{Float}, @code{Long_Float}, @code{Long_Long_Float}) are
1730 defined to be @emph{unconstrained}. This means that even though each
1731 has a well-defined base range, an operation that delivers a result
1732 outside this base range is not required to raise an exception.
1733 This implementation permission accommodates the notion
1734 of infinities in IEEE floating-point, and corresponds to the
1735 efficient execution mode on most machines. GNAT will not raise
1736 overflow exceptions on these machines; instead it will generate
1737 infinities and NaN's as defined in the IEEE standard.
1739 Generating infinities, although efficient, is not always desirable.
1740 Often the preferable approach is to check for overflow, even at the
1741 (perhaps considerable) expense of run-time performance.
1742 This can be accomplished by defining your own constrained floating-point subtypes -- i.e., by supplying explicit
1743 range constraints -- and indeed such a subtype
1744 can have the same base range as its base type. For example:
1746 @smallexample @c ada
1747 subtype My_Float is Float range Float'Range;
1748 @end smallexample
1750 @noindent
1751 Here @code{My_Float} has the same range as
1752 @code{Float} but is constrained, so operations on
1753 @code{My_Float} values will be checked for overflow
1754 against this range.
1756 This style will achieve the desired goal, but
1757 it is often more convenient to be able to simply use
1758 the standard predefined floating-point types as long
1759 as overflow checking could be guaranteed.
1760 The @code{Check_Float_Overflow}
1761 configuration pragma achieves this effect. If a unit is compiled
1762 subject to this configuration pragma, then all operations
1763 on predefined floating-point types will be treated as
1764 though those types were constrained, and overflow checks
1765 will be generated. The @code{Constraint_Error}
1766 exception is raised if the result is out of range.
1768 This mode can also be set by use of the compiler
1769 switch @option{-gnateF}.
1771 @node Pragma Check_Name
1772 @unnumberedsec Pragma Check_Name
1773 @cindex Defining check names
1774 @cindex Check names, defining
1775 @findex Check_Name
1776 @noindent
1777 Syntax:
1778 @smallexample @c ada
1779 pragma Check_Name (check_name_IDENTIFIER);
1780 @end smallexample
1782 @noindent
1783 This is a configuration pragma that defines a new implementation
1784 defined check name (unless IDENTIFIER matches one of the predefined
1785 check names, in which case the pragma has no effect). Check names
1786 are global to a partition, so if two or more configuration pragmas
1787 are present in a partition mentioning the same name, only one new
1788 check name is introduced.
1790 An implementation defined check name introduced with this pragma may
1791 be used in only three contexts: @code{pragma Suppress},
1792 @code{pragma Unsuppress},
1793 and as the prefix of a @code{Check_Name'Enabled} attribute reference. For
1794 any of these three cases, the check name must be visible. A check
1795 name is visible if it is in the configuration pragmas applying to
1796 the current unit, or if it appears at the start of any unit that
1797 is part of the dependency set of the current unit (e.g., units that
1798 are mentioned in @code{with} clauses).
1800 Check names introduced by this pragma are subject to control by compiler
1801 switches (in particular -gnatp) in the usual manner.
1803 @node Pragma Check_Policy
1804 @unnumberedsec Pragma Check_Policy
1805 @cindex Controlling assertions
1806 @cindex Assertions, control
1807 @cindex Check pragma control
1808 @cindex Named assertions
1809 @findex Check
1810 @noindent
1811 Syntax:
1812 @smallexample @c ada
1813 pragma Check_Policy
1814  ([Name   =>] CHECK_KIND,
1815   [Policy =>] POLICY_IDENTIFIER);
1817 pragma Check_Policy (
1818     CHECK_KIND => POLICY_IDENTIFIER
1819  @{, CHECK_KIND => POLICY_IDENTIFIER@});
1821 ASSERTION_KIND ::= RM_ASSERTION_KIND | ID_ASSERTION_KIND
1823 CHECK_KIND ::= IDENTIFIER           |
1824                Pre'Class            |
1825                Post'Class           |
1826                Type_Invariant'Class |
1827                Invariant'Class
1829 The identifiers Name and Policy are not allowed as CHECK_KIND values. This
1830 avoids confusion between the two possible syntax forms for this pragma.
1832 POLICY_IDENTIFIER ::= ON | OFF | CHECK | DISABLE | IGNORE
1833 @end smallexample
1835 @noindent
1836 This pragma is used to set the checking policy for assertions (specified
1837 by aspects or pragmas), the @code{Debug} pragma, or additional checks
1838 to be checked using the @code{Check} pragma. It may appear either as
1839 a configuration pragma, or within a declarative part of package. In the
1840 latter case, it applies from the point where it appears to the end of
1841 the declarative region (like pragma @code{Suppress}).
1843 The @code{Check_Policy} pragma is similar to the
1844 predefined @code{Assertion_Policy} pragma,
1845 and if the check kind corresponds to one of the assertion kinds that
1846 are allowed by @code{Assertion_Policy}, then the effect is identical.
1848 If the first argument is Debug, then the policy applies to Debug pragmas,
1849 disabling their effect if the policy is @code{OFF}, @code{DISABLE}, or
1850 @code{IGNORE}, and allowing them to execute with normal semantics if
1851 the policy is @code{ON} or @code{CHECK}. In addition if the policy is
1852 @code{DISABLE}, then the procedure call in @code{Debug} pragmas will
1853 be totally ignored and not analyzed semantically.
1855 Finally the first argument may be some other identifier than the above
1856 possibilities, in which case it controls a set of named assertions
1857 that can be checked using pragma @code{Check}. For example, if the pragma:
1859 @smallexample @c ada
1860 pragma Check_Policy (Critical_Error, OFF);
1861 @end smallexample
1863 @noindent
1864 is given, then subsequent @code{Check} pragmas whose first argument is also
1865 @code{Critical_Error} will be disabled.
1867 The check policy is @code{OFF} to turn off corresponding checks, and @code{ON}
1868 to turn on corresponding checks. The default for a set of checks for which no
1869 @code{Check_Policy} is given is @code{OFF} unless the compiler switch
1870 @option{-gnata} is given, which turns on all checks by default.
1872 The check policy settings @code{CHECK} and @code{IGNORE} are recognized
1873 as synonyms for @code{ON} and @code{OFF}. These synonyms are provided for
1874 compatibility with the standard @code{Assertion_Policy} pragma. The check
1875 policy setting @code{DISABLE} causes the second argument of a corresponding
1876 @code{Check} pragma to be completely ignored and not analyzed.
1878 @node Pragma CIL_Constructor
1879 @unnumberedsec Pragma CIL_Constructor
1880 @findex CIL_Constructor
1881 @noindent
1882 Syntax:
1884 @smallexample @c ada
1885 pragma CIL_Constructor ([Entity =>] function_LOCAL_NAME);
1886 @end smallexample
1888 @noindent
1889 This pragma is used to assert that the specified Ada function should be
1890 mapped to the .NET constructor for some Ada tagged record type.
1892 See section 4.1 of the
1893 @code{GNAT User's Guide: Supplement for the .NET Platform.}
1894 for related information.
1896 @node Pragma Comment
1897 @unnumberedsec Pragma Comment
1898 @findex Comment
1899 @noindent
1900 Syntax:
1902 @smallexample @c ada
1903 pragma Comment (static_string_EXPRESSION);
1904 @end smallexample
1906 @noindent
1907 This is almost identical in effect to pragma @code{Ident}.  It allows the
1908 placement of a comment into the object file and hence into the
1909 executable file if the operating system permits such usage.  The
1910 difference is that @code{Comment}, unlike @code{Ident}, has
1911 no limitations on placement of the pragma (it can be placed
1912 anywhere in the main source unit), and if more than one pragma
1913 is used, all comments are retained.
1915 @node Pragma Common_Object
1916 @unnumberedsec Pragma Common_Object
1917 @findex Common_Object
1918 @noindent
1919 Syntax:
1921 @smallexample @c ada
1922 pragma Common_Object (
1923      [Internal =>] LOCAL_NAME
1924   [, [External =>] EXTERNAL_SYMBOL]
1925   [, [Size     =>] EXTERNAL_SYMBOL] );
1927 EXTERNAL_SYMBOL ::=
1928   IDENTIFIER
1929 | static_string_EXPRESSION
1930 @end smallexample
1932 @noindent
1933 This pragma enables the shared use of variables stored in overlaid
1934 linker areas corresponding to the use of @code{COMMON}
1935 in Fortran.  The single
1936 object @var{LOCAL_NAME} is assigned to the area designated by
1937 the @var{External} argument.
1938 You may define a record to correspond to a series
1939 of fields.  The @var{Size} argument
1940 is syntax checked in GNAT, but otherwise ignored.
1942 @code{Common_Object} is not supported on all platforms.  If no
1943 support is available, then the code generator will issue a message
1944 indicating that the necessary attribute for implementation of this
1945 pragma is not available.
1947 @node Pragma Compile_Time_Error
1948 @unnumberedsec Pragma Compile_Time_Error
1949 @findex Compile_Time_Error
1950 @noindent
1951 Syntax:
1953 @smallexample @c ada
1954 pragma Compile_Time_Error
1955          (boolean_EXPRESSION, static_string_EXPRESSION);
1956 @end smallexample
1958 @noindent
1959 This pragma can be used to generate additional compile time
1960 error messages. It
1961 is particularly useful in generics, where errors can be issued for
1962 specific problematic instantiations. The first parameter is a boolean
1963 expression. The pragma is effective only if the value of this expression
1964 is known at compile time, and has the value True. The set of expressions
1965 whose values are known at compile time includes all static boolean
1966 expressions, and also other values which the compiler can determine
1967 at compile time (e.g., the size of a record type set by an explicit
1968 size representation clause, or the value of a variable which was
1969 initialized to a constant and is known not to have been modified).
1970 If these conditions are met, an error message is generated using
1971 the value given as the second argument. This string value may contain
1972 embedded ASCII.LF characters to break the message into multiple lines.
1974 @node Pragma Compile_Time_Warning
1975 @unnumberedsec Pragma Compile_Time_Warning
1976 @findex Compile_Time_Warning
1977 @noindent
1978 Syntax:
1980 @smallexample @c ada
1981 pragma Compile_Time_Warning
1982          (boolean_EXPRESSION, static_string_EXPRESSION);
1983 @end smallexample
1985 @noindent
1986 Same as pragma Compile_Time_Error, except a warning is issued instead
1987 of an error message. Note that if this pragma is used in a package that
1988 is with'ed by a client, the client will get the warning even though it
1989 is issued by a with'ed package (normally warnings in with'ed units are
1990 suppressed, but this is a special exception to that rule).
1992 One typical use is within a generic where compile time known characteristics
1993 of formal parameters are tested, and warnings given appropriately. Another use
1994 with a first parameter of True is to warn a client about use of a package,
1995 for example that it is not fully implemented.
1997 @node Pragma Compiler_Unit
1998 @unnumberedsec Pragma Compiler_Unit
1999 @findex Compiler_Unit
2000 @noindent
2001 Syntax:
2003 @smallexample @c ada
2004 pragma Compiler_Unit;
2005 @end smallexample
2007 @noindent
2008 This pragma is intended only for internal use in the GNAT run-time library.
2009 It indicates that the unit is used as part of the compiler build. The effect
2010 is to disallow constructs (raise with message, conditional expressions etc)
2011 that would cause trouble when bootstrapping using an older version of GNAT.
2012 For the exact list of restrictions, see the compiler sources and references
2013 to Is_Compiler_Unit.
2015 @node Pragma Complete_Representation
2016 @unnumberedsec Pragma Complete_Representation
2017 @findex Complete_Representation
2018 @noindent
2019 Syntax:
2021 @smallexample @c ada
2022 pragma Complete_Representation;
2023 @end smallexample
2025 @noindent
2026 This pragma must appear immediately within a record representation
2027 clause. Typical placements are before the first component clause
2028 or after the last component clause. The effect is to give an error
2029 message if any component is missing a component clause. This pragma
2030 may be used to ensure that a record representation clause is
2031 complete, and that this invariant is maintained if fields are
2032 added to the record in the future.
2034 @node Pragma Complex_Representation
2035 @unnumberedsec Pragma Complex_Representation
2036 @findex Complex_Representation
2037 @noindent
2038 Syntax:
2040 @smallexample @c ada
2041 pragma Complex_Representation
2042         ([Entity =>] LOCAL_NAME);
2043 @end smallexample
2045 @noindent
2046 The @var{Entity} argument must be the name of a record type which has
2047 two fields of the same floating-point type.  The effect of this pragma is
2048 to force gcc to use the special internal complex representation form for
2049 this record, which may be more efficient.  Note that this may result in
2050 the code for this type not conforming to standard ABI (application
2051 binary interface) requirements for the handling of record types.  For
2052 example, in some environments, there is a requirement for passing
2053 records by pointer, and the use of this pragma may result in passing
2054 this type in floating-point registers.
2056 @node Pragma Component_Alignment
2057 @unnumberedsec Pragma Component_Alignment
2058 @cindex Alignments of components
2059 @findex Component_Alignment
2060 @noindent
2061 Syntax:
2063 @smallexample @c ada
2064 pragma Component_Alignment (
2065      [Form =>] ALIGNMENT_CHOICE
2066   [, [Name =>] type_LOCAL_NAME]);
2068 ALIGNMENT_CHOICE ::=
2069   Component_Size
2070 | Component_Size_4
2071 | Storage_Unit
2072 | Default
2073 @end smallexample
2075 @noindent
2076 Specifies the alignment of components in array or record types.
2077 The meaning of the @var{Form} argument is as follows:
2079 @table @code
2080 @findex Component_Size
2081 @item Component_Size
2082 Aligns scalar components and subcomponents of the array or record type
2083 on boundaries appropriate to their inherent size (naturally
2084 aligned).  For example, 1-byte components are aligned on byte boundaries,
2085 2-byte integer components are aligned on 2-byte boundaries, 4-byte
2086 integer components are aligned on 4-byte boundaries and so on.  These
2087 alignment rules correspond to the normal rules for C compilers on all
2088 machines except the VAX@.
2090 @findex Component_Size_4
2091 @item Component_Size_4
2092 Naturally aligns components with a size of four or fewer
2093 bytes.  Components that are larger than 4 bytes are placed on the next
2094 4-byte boundary.
2096 @findex Storage_Unit
2097 @item Storage_Unit
2098 Specifies that array or record components are byte aligned, i.e.@:
2099 aligned on boundaries determined by the value of the constant
2100 @code{System.Storage_Unit}.
2102 @cindex OpenVMS
2103 @item Default
2104 Specifies that array or record components are aligned on default
2105 boundaries, appropriate to the underlying hardware or operating system or
2106 both.  For OpenVMS VAX systems, the @code{Default} choice is the same as
2107 the @code{Storage_Unit} choice (byte alignment).  For all other systems,
2108 the @code{Default} choice is the same as @code{Component_Size} (natural
2109 alignment).
2110 @end table
2112 @noindent
2113 If the @code{Name} parameter is present, @var{type_LOCAL_NAME} must
2114 refer to a local record or array type, and the specified alignment
2115 choice applies to the specified type.  The use of
2116 @code{Component_Alignment} together with a pragma @code{Pack} causes the
2117 @code{Component_Alignment} pragma to be ignored.  The use of
2118 @code{Component_Alignment} together with a record representation clause
2119 is only effective for fields not specified by the representation clause.
2121 If the @code{Name} parameter is absent, the pragma can be used as either
2122 a configuration pragma, in which case it applies to one or more units in
2123 accordance with the normal rules for configuration pragmas, or it can be
2124 used within a declarative part, in which case it applies to types that
2125 are declared within this declarative part, or within any nested scope
2126 within this declarative part.  In either case it specifies the alignment
2127 to be applied to any record or array type which has otherwise standard
2128 representation.
2130 If the alignment for a record or array type is not specified (using
2131 pragma @code{Pack}, pragma @code{Component_Alignment}, or a record rep
2132 clause), the GNAT uses the default alignment as described previously.
2134 @node Pragma Contract_Cases
2135 @unnumberedsec Pragma Contract_Cases
2136 @cindex Contract cases
2137 @findex Contract_Cases
2138 @noindent
2139 Syntax:
2141 @smallexample @c ada
2142 pragma Contract_Cases (
2143    Condition => Consequence
2144  @{,Condition => Consequence@});
2145 @end smallexample
2147 @noindent
2148 The @code{Contract_Cases} pragma allows defining fine-grain specifications
2149 that can complement or replace the contract given by a precondition and a
2150 postcondition. Additionally, the @code{Contract_Cases} pragma can be used
2151 by testing and formal verification tools. The compiler checks its validity and,
2152 depending on the assertion policy at the point of declaration of the pragma,
2153 it may insert a check in the executable. For code generation, the contract
2154 cases
2156 @smallexample @c ada
2157 pragma Contract_Cases (
2158   Cond1 => Pred1,
2159   Cond2 => Pred2);
2160 @end smallexample
2162 @noindent
2163 are equivalent to
2165 @smallexample @c ada
2166 C1 : constant Boolean := Cond1;  --  evaluated at subprogram entry
2167 C2 : constant Boolean := Cond2;  --  evaluated at subprogram entry
2168 pragma Precondition ((C1 and not C2) or (C2 and not C1));
2169 pragma Postcondition (if C1 then Pred1);
2170 pragma Postcondition (if C2 then Pred2);
2171 @end smallexample
2173 @noindent
2174 The precondition ensures that one and only one of the conditions is
2175 satisfied on entry to the subprogram.
2176 The postcondition ensures that for the condition that was True on entry,
2177 the corrresponding consequence is True on exit. Other consequence expressions
2178 are not evaluated.
2180 A precondition @code{P} and postcondition @code{Q} can also be
2181 expressed as contract cases:
2183 @smallexample @c ada
2184 pragma Contract_Cases (P => Q);
2185 @end smallexample
2187 The placement and visibility rules for @code{Contract_Cases} pragmas are
2188 identical to those described for preconditions and postconditions.
2190 The compiler checks that boolean expressions given in conditions and
2191 consequences are valid, where the rules for conditions are the same as
2192 the rule for an expression in @code{Precondition} and the rules for
2193 consequences are the same as the rule for an expression in
2194 @code{Postcondition}. In particular, attributes @code{'Old} and
2195 @code{'Result} can only be used within consequence expressions.
2196 The condition for the last contract case may be @code{others}, to denote
2197 any case not captured by the previous cases. The
2198 following is an example of use within a package spec:
2200 @smallexample @c ada
2201 package Math_Functions is
2202    ...
2203    function Sqrt (Arg : Float) return Float;
2204    pragma Contract_Cases ((Arg in 0 .. 99) => Sqrt'Result < 10,
2205                           Arg >= 100       => Sqrt'Result >= 10,
2206                           others           => Sqrt'Result = 0);
2207    ...
2208 end Math_Functions;
2209 @end smallexample
2211 @noindent
2212 The meaning of contract cases is that only one case should apply at each
2213 call, as determined by the corresponding condition evaluating to True,
2214 and that the consequence for this case should hold when the subprogram
2215 returns.
2217 @node Pragma Convention_Identifier
2218 @unnumberedsec Pragma Convention_Identifier
2219 @findex Convention_Identifier
2220 @cindex Conventions, synonyms
2221 @noindent
2222 Syntax:
2224 @smallexample @c ada
2225 pragma Convention_Identifier (
2226          [Name =>]       IDENTIFIER,
2227          [Convention =>] convention_IDENTIFIER);
2228 @end smallexample
2230 @noindent
2231 This pragma provides a mechanism for supplying synonyms for existing
2232 convention identifiers. The @code{Name} identifier can subsequently
2233 be used as a synonym for the given convention in other pragmas (including
2234 for example pragma @code{Import} or another @code{Convention_Identifier}
2235 pragma). As an example of the use of this, suppose you had legacy code
2236 which used Fortran77 as the identifier for Fortran. Then the pragma:
2238 @smallexample @c ada
2239 pragma Convention_Identifier (Fortran77, Fortran);
2240 @end smallexample
2242 @noindent
2243 would allow the use of the convention identifier @code{Fortran77} in
2244 subsequent code, avoiding the need to modify the sources. As another
2245 example, you could use this to parameterize convention requirements
2246 according to systems. Suppose you needed to use @code{Stdcall} on
2247 windows systems, and @code{C} on some other system, then you could
2248 define a convention identifier @code{Library} and use a single
2249 @code{Convention_Identifier} pragma to specify which convention
2250 would be used system-wide.
2252 @node Pragma CPP_Class
2253 @unnumberedsec Pragma CPP_Class
2254 @findex CPP_Class
2255 @cindex Interfacing with C++
2256 @noindent
2257 Syntax:
2259 @smallexample @c ada
2260 pragma CPP_Class ([Entity =>] LOCAL_NAME);
2261 @end smallexample
2263 @noindent
2264 The argument denotes an entity in the current declarative region that is
2265 declared as a record type. It indicates that the type corresponds to an
2266 externally declared C++ class type, and is to be laid out the same way
2267 that C++ would lay out the type. If the C++ class has virtual primitives
2268 then the record must be declared as a tagged record type.
2270 Types for which @code{CPP_Class} is specified do not have assignment or
2271 equality operators defined (such operations can be imported or declared
2272 as subprograms as required). Initialization is allowed only by constructor
2273 functions (see pragma @code{CPP_Constructor}). Such types are implicitly
2274 limited if not explicitly declared as limited or derived from a limited
2275 type, and an error is issued in that case.
2277 See @ref{Interfacing to C++} for related information.
2279 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
2280 for backward compatibility but its functionality is available
2281 using pragma @code{Import} with @code{Convention} = @code{CPP}.
2283 @node Pragma CPP_Constructor
2284 @unnumberedsec Pragma CPP_Constructor
2285 @cindex Interfacing with C++
2286 @findex CPP_Constructor
2287 @noindent
2288 Syntax:
2290 @smallexample @c ada
2291 pragma CPP_Constructor ([Entity =>] LOCAL_NAME
2292   [, [External_Name =>] static_string_EXPRESSION ]
2293   [, [Link_Name     =>] static_string_EXPRESSION ]);
2294 @end smallexample
2296 @noindent
2297 This pragma identifies an imported function (imported in the usual way
2298 with pragma @code{Import}) as corresponding to a C++ constructor. If
2299 @code{External_Name} and @code{Link_Name} are not specified then the
2300 @code{Entity} argument is a name that must have been previously mentioned
2301 in a pragma @code{Import} with @code{Convention} = @code{CPP}. Such name
2302 must be of one of the following forms:
2304 @itemize @bullet
2305 @item
2306 @code{function @var{Fname} return @var{T}}
2308 @itemize @bullet
2309 @item
2310 @code{function @var{Fname} return @var{T}'Class}
2312 @item
2313 @code{function @var{Fname} (@dots{}) return @var{T}}
2314 @end itemize
2316 @item
2317 @code{function @var{Fname} (@dots{}) return @var{T}'Class}
2318 @end itemize
2320 @noindent
2321 where @var{T} is a limited record type imported from C++ with pragma
2322 @code{Import} and @code{Convention} = @code{CPP}.
2324 The first two forms import the default constructor, used when an object
2325 of type @var{T} is created on the Ada side with no explicit constructor.
2326 The latter two forms cover all the non-default constructors of the type.
2327 See the @value{EDITION} User's Guide for details.
2329 If no constructors are imported, it is impossible to create any objects
2330 on the Ada side and the type is implicitly declared abstract.
2332 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
2333 using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
2334 GCC switch).
2335 See @ref{Interfacing to C++} for more related information.
2337 Note: The use of functions returning class-wide types for constructors is
2338 currently obsolete. They are supported for backward compatibility. The
2339 use of functions returning the type T leave the Ada sources more clear
2340 because the imported C++ constructors always return an object of type T;
2341 that is, they never return an object whose type is a descendant of type T.
2343 @node Pragma CPP_Virtual
2344 @unnumberedsec Pragma CPP_Virtual
2345 @cindex Interfacing to C++
2346 @findex CPP_Virtual
2347 @noindent
2348 This pragma is now obsolete and, other than generating a warning if warnings
2349 on obsolescent features are enabled, is completely ignored.
2350 It is retained for compatibility
2351 purposes. It used to be required to ensure compoatibility with C++, but
2352 is no longer required for that purpose because GNAT generates
2353 the same object layout as the G++ compiler by default.
2355 See @ref{Interfacing to C++} for related information.
2357 @node Pragma CPP_Vtable
2358 @unnumberedsec Pragma CPP_Vtable
2359 @cindex Interfacing with C++
2360 @findex CPP_Vtable
2361 @noindent
2362 This pragma is now obsolete and, other than generating a warning if warnings
2363 on obsolescent features are enabled, is completely ignored.
2364 It used to be required to ensure compatibility with C++, but
2365 is no longer required for that purpose because GNAT generates
2366 the same object layout than the G++ compiler by default.
2368 See @ref{Interfacing to C++} for related information.
2370 @node Pragma CPU
2371 @unnumberedsec Pragma CPU
2372 @findex CPU
2373 @noindent
2374 Syntax:
2376 @smallexample @c ada
2377 pragma CPU (EXPRESSION);
2378 @end smallexample
2380 @noindent
2381 This pragma is standard in Ada 2012, but is available in all earlier
2382 versions of Ada as an implementation-defined pragma.
2383 See Ada 2012 Reference Manual for details.
2385 @node Pragma Debug
2386 @unnumberedsec Pragma Debug
2387 @findex Debug
2388 @noindent
2389 Syntax:
2391 @smallexample @c ada
2392 pragma Debug ([CONDITION, ]PROCEDURE_CALL_WITHOUT_SEMICOLON);
2394 PROCEDURE_CALL_WITHOUT_SEMICOLON ::=
2395   PROCEDURE_NAME
2396 | PROCEDURE_PREFIX ACTUAL_PARAMETER_PART
2397 @end smallexample
2399 @noindent
2400 The procedure call argument has the syntactic form of an expression, meeting
2401 the syntactic requirements for pragmas.
2403 If debug pragmas are not enabled or if the condition is present and evaluates
2404 to False, this pragma has no effect. If debug pragmas are enabled, the
2405 semantics of the pragma is exactly equivalent to the procedure call statement
2406 corresponding to the argument with a terminating semicolon. Pragmas are
2407 permitted in sequences of declarations, so you can use pragma @code{Debug} to
2408 intersperse calls to debug procedures in the middle of declarations. Debug
2409 pragmas can be enabled either by use of the command line switch @option{-gnata}
2410 or by use of the pragma @code{Check_Policy} with a first argument of
2411 @code{Debug}.
2413 @node Pragma Debug_Policy
2414 @unnumberedsec Pragma Debug_Policy
2415 @findex Debug_Policy
2416 @noindent
2417 Syntax:
2419 @smallexample @c ada
2420 pragma Debug_Policy (CHECK | DISABLE | IGNORE | ON | OFF);
2421 @end smallexample
2423 @noindent
2424 This pragma is equivalent to a corresponding @code{Check_Policy} pragma
2425 with a first argument of @code{Debug}. It is retained for historical
2426 compatibility reasons.
2428 @node Pragma Default_Storage_Pool
2429 @unnumberedsec Pragma Default_Storage_Pool
2430 @findex Default_Storage_Pool
2431 @noindent
2432 Syntax:
2434 @smallexample @c ada
2435 pragma Default_Storage_Pool (storage_pool_NAME | null);
2436 @end smallexample
2438 @noindent
2439 This pragma is standard in Ada 2012, but is available in all earlier
2440 versions of Ada as an implementation-defined pragma.
2441 See Ada 2012 Reference Manual for details.
2443 @node Pragma Depends
2444 @unnumberedsec Pragma Depends
2445 @findex Depends
2446 @noindent
2447 For the description of this pragma, see SPARK 2014 Reference Manual,
2448 section 6.1.5.
2450 @node Pragma Detect_Blocking
2451 @unnumberedsec Pragma Detect_Blocking
2452 @findex Detect_Blocking
2453 @noindent
2454 Syntax:
2456 @smallexample @c ada
2457 pragma Detect_Blocking;
2458 @end smallexample
2460 @noindent
2461 This is a standard pragma in Ada 2005, that is available in all earlier
2462 versions of Ada as an implementation-defined pragma.
2464 This is a configuration pragma that forces the detection of potentially
2465 blocking operations within a protected operation, and to raise Program_Error
2466 if that happens.
2468 @node Pragma Disable_Atomic_Synchronization
2469 @unnumberedsec Pragma Disable_Atomic_Synchronization
2470 @cindex Atomic Synchronization
2471 @findex Disable_Atomic_Synchronization
2472 @noindent
2473 Syntax:
2475 @smallexample @c ada
2476 pragma Disable_Atomic_Synchronization [(Entity)];
2477 @end smallexample
2479 @noindent
2480 Ada requires that accesses (reads or writes) of an atomic variable be
2481 regarded as synchronization points in the case of multiple tasks.
2482 Particularly in the case of multi-processors this may require special
2483 handling, e.g. the generation of memory barriers. This capability may
2484 be turned off using this pragma in cases where it is known not to be
2485 required.
2487 The placement and scope rules for this pragma are the same as those
2488 for @code{pragma Suppress}. In particular it can be used as a
2489 configuration  pragma, or in a declaration sequence where it applies
2490 till the end of the scope. If an @code{Entity} argument is present,
2491 the action applies only to that entity.
2493 @node Pragma Dispatching_Domain
2494 @unnumberedsec Pragma Dispatching_Domain
2495 @findex Dispatching_Domain
2496 @noindent
2497 Syntax:
2499 @smallexample @c ada
2500 pragma Dispatching_Domain (EXPRESSION);
2501 @end smallexample
2503 @noindent
2504 This pragma is standard in Ada 2012, but is available in all earlier
2505 versions of Ada as an implementation-defined pragma.
2506 See Ada 2012 Reference Manual for details.
2508 @node Pragma Elaboration_Checks
2509 @unnumberedsec Pragma Elaboration_Checks
2510 @cindex Elaboration control
2511 @findex Elaboration_Checks
2512 @noindent
2513 Syntax:
2515 @smallexample @c ada
2516 pragma Elaboration_Checks (Dynamic | Static);
2517 @end smallexample
2519 @noindent
2520 This is a configuration pragma that provides control over the
2521 elaboration model used by the compilation affected by the
2522 pragma.  If the parameter is @code{Dynamic},
2523 then the dynamic elaboration
2524 model described in the Ada Reference Manual is used, as though
2525 the @option{-gnatE} switch had been specified on the command
2526 line.  If the parameter is @code{Static}, then the default GNAT static
2527 model is used.  This configuration pragma overrides the setting
2528 of the command line.  For full details on the elaboration models
2529 used by the GNAT compiler, see @ref{Elaboration Order Handling in GNAT,,,
2530 gnat_ugn, @value{EDITION} User's Guide}.
2532 @node Pragma Eliminate
2533 @unnumberedsec Pragma Eliminate
2534 @cindex Elimination of unused subprograms
2535 @findex Eliminate
2536 @noindent
2537 Syntax:
2539 @smallexample @c ada
2540 pragma Eliminate ([Entity          =>] DEFINING_DESIGNATOR,
2541                   [Source_Location =>] STRING_LITERAL);
2542 @end smallexample
2544 @noindent
2545 The string literal given for the source location is a string which
2546 specifies the line number of the occurrence of the entity, using
2547 the syntax for SOURCE_TRACE given below:
2549 @smallexample @c ada
2550  SOURCE_TRACE     ::= SOURCE_REFERENCE [LBRACKET SOURCE_TRACE RBRACKET]
2552  LBRACKET         ::= [
2553  RBRACKET         ::= ]
2555  SOURCE_REFERENCE ::= FILE_NAME : LINE_NUMBER
2557  LINE_NUMBER      ::= DIGIT @{DIGIT@}
2558 @end smallexample
2560 @noindent
2561 Spaces around the colon in a @code{Source_Reference} are optional.
2563 The @code{DEFINING_DESIGNATOR} matches the defining designator used in an
2564 explicit subprogram declaration, where the @code{entity} name in this
2565 designator appears on the source line specified by the source location.
2567 The source trace that is given as the @code{Source_Location} shall obey the
2568 following rules. The @code{FILE_NAME} is the short name (with no directory
2569 information) of an Ada source file, given using exactly the required syntax
2570 for the underlying file system (e.g. case is important if the underlying
2571 operating system is case sensitive). @code{LINE_NUMBER} gives the line
2572 number of the occurrence of the @code{entity}
2573 as a decimal literal without an exponent or point. If an @code{entity} is not
2574 declared in a generic instantiation (this includes generic subprogram
2575 instances), the source trace includes only one source reference. If an entity
2576 is declared inside a generic instantiation, its source trace (when parsing
2577 from left to right) starts with the source location of the declaration of the
2578 entity in the generic unit and ends with the source location of the
2579 instantiation (it is given in square brackets). This approach is recursively
2580 used in case of nested instantiations: the rightmost (nested most deeply in
2581 square brackets) element of the source trace is the location of the outermost
2582 instantiation, the next to left element is the location of the next (first
2583 nested) instantiation in the code of the corresponding generic unit, and so
2584 on, and the leftmost element (that is out of any square brackets) is the
2585 location of the declaration of the entity to eliminate in a generic unit.
2587 Note that the @code{Source_Location} argument specifies which of a set of
2588 similarly named entities is being eliminated, dealing both with overloading,
2589 and also appearance of the same entity name in different scopes.
2591 This pragma indicates that the given entity is not used in the program to be
2592 compiled and built. The effect of the pragma is to allow the compiler to
2593 eliminate the code or data associated with the named entity. Any reference to
2594 an eliminated entity causes a compile-time or link-time error.
2596 The intention of pragma @code{Eliminate} is to allow a program to be compiled
2597 in a system-independent manner, with unused entities eliminated, without
2598 needing to modify the source text. Normally the required set of
2599 @code{Eliminate} pragmas is constructed automatically using the gnatelim tool.
2601 Any source file change that removes, splits, or
2602 adds lines may make the set of Eliminate pragmas invalid because their
2603 @code{Source_Location} argument values may get out of date.
2605 Pragma @code{Eliminate} may be used where the referenced entity is a dispatching
2606 operation. In this case all the subprograms to which the given operation can
2607 dispatch are considered to be unused (are never called as a result of a direct
2608 or a dispatching call).
2610 @node Pragma Enable_Atomic_Synchronization
2611 @unnumberedsec Pragma Enable_Atomic_Synchronization
2612 @cindex Atomic Synchronization
2613 @findex Enable_Atomic_Synchronization
2614 @noindent
2615 Syntax:
2617 @smallexample @c ada
2618 pragma Enable_Atomic_Synchronization [(Entity)];
2619 @end smallexample
2621 @noindent
2622 Ada requires that accesses (reads or writes) of an atomic variable be
2623 regarded as synchronization points in the case of multiple tasks.
2624 Particularly in the case of multi-processors this may require special
2625 handling, e.g. the generation of memory barriers. This synchronization
2626 is performed by default, but can be turned off using
2627 @code{pragma Disable_Atomic_Synchronization}. The
2628 @code{Enable_Atomic_Synchronization} pragma can be used to turn
2629 it back on.
2631 The placement and scope rules for this pragma are the same as those
2632 for @code{pragma Unsuppress}. In particular it can be used as a
2633 configuration  pragma, or in a declaration sequence where it applies
2634 till the end of the scope. If an @code{Entity} argument is present,
2635 the action applies only to that entity.
2637 @node Pragma Export_Exception
2638 @unnumberedsec Pragma Export_Exception
2639 @cindex OpenVMS
2640 @findex Export_Exception
2641 @noindent
2642 Syntax:
2644 @smallexample @c ada
2645 pragma Export_Exception (
2646      [Internal =>] LOCAL_NAME
2647   [, [External =>] EXTERNAL_SYMBOL]
2648   [, [Form     =>] Ada | VMS]
2649   [, [Code     =>] static_integer_EXPRESSION]);
2651 EXTERNAL_SYMBOL ::=
2652   IDENTIFIER
2653 | static_string_EXPRESSION
2654 @end smallexample
2656 @noindent
2657 This pragma is implemented only in the OpenVMS implementation of GNAT@.  It
2658 causes the specified exception to be propagated outside of the Ada program,
2659 so that it can be handled by programs written in other OpenVMS languages.
2660 This pragma establishes an external name for an Ada exception and makes the
2661 name available to the OpenVMS Linker as a global symbol.  For further details
2662 on this pragma, see the
2663 DEC Ada Language Reference Manual, section 13.9a3.2.
2665 @node Pragma Export_Function
2666 @unnumberedsec Pragma Export_Function
2667 @cindex Argument passing mechanisms
2668 @findex Export_Function
2670 @noindent
2671 Syntax:
2673 @smallexample @c ada
2674 pragma Export_Function (
2675      [Internal         =>] LOCAL_NAME
2676   [, [External         =>] EXTERNAL_SYMBOL]
2677   [, [Parameter_Types  =>] PARAMETER_TYPES]
2678   [, [Result_Type      =>] result_SUBTYPE_MARK]
2679   [, [Mechanism        =>] MECHANISM]
2680   [, [Result_Mechanism =>] MECHANISM_NAME]);
2682 EXTERNAL_SYMBOL ::=
2683   IDENTIFIER
2684 | static_string_EXPRESSION
2685 | ""
2687 PARAMETER_TYPES ::=
2688   null
2689 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
2691 TYPE_DESIGNATOR ::=
2692   subtype_NAME
2693 | subtype_Name ' Access
2695 MECHANISM ::=
2696   MECHANISM_NAME
2697 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
2699 MECHANISM_ASSOCIATION ::=
2700   [formal_parameter_NAME =>] MECHANISM_NAME
2702 MECHANISM_NAME ::=
2703   Value
2704 | Reference
2705 | Descriptor [([Class =>] CLASS_NAME)]
2706 | Short_Descriptor [([Class =>] CLASS_NAME)]
2708 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
2709 @end smallexample
2711 @noindent
2712 Use this pragma to make a function externally callable and optionally
2713 provide information on mechanisms to be used for passing parameter and
2714 result values.  We recommend, for the purposes of improving portability,
2715 this pragma always be used in conjunction with a separate pragma
2716 @code{Export}, which must precede the pragma @code{Export_Function}.
2717 GNAT does not require a separate pragma @code{Export}, but if none is
2718 present, @code{Convention Ada} is assumed, which is usually
2719 not what is wanted, so it is usually appropriate to use this
2720 pragma in conjunction with a @code{Export} or @code{Convention}
2721 pragma that specifies the desired foreign convention.
2722 Pragma @code{Export_Function}
2723 (and @code{Export}, if present) must appear in the same declarative
2724 region as the function to which they apply.
2726 @var{internal_name} must uniquely designate the function to which the
2727 pragma applies.  If more than one function name exists of this name in
2728 the declarative part you must use the @code{Parameter_Types} and
2729 @code{Result_Type} parameters is mandatory to achieve the required
2730 unique designation.  @var{subtype_mark}s in these parameters must
2731 exactly match the subtypes in the corresponding function specification,
2732 using positional notation to match parameters with subtype marks.
2733 The form with an @code{'Access} attribute can be used to match an
2734 anonymous access parameter.
2736 @cindex OpenVMS
2737 @cindex Passing by descriptor
2738 Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
2739 The default behavior for Export_Function is to accept either 64bit or
2740 32bit descriptors unless short_descriptor is specified, then only 32bit
2741 descriptors are accepted.
2743 @cindex Suppressing external name
2744 Special treatment is given if the EXTERNAL is an explicit null
2745 string or a static string expressions that evaluates to the null
2746 string. In this case, no external name is generated. This form
2747 still allows the specification of parameter mechanisms.
2749 @node Pragma Export_Object
2750 @unnumberedsec Pragma Export_Object
2751 @findex Export_Object
2752 @noindent
2753 Syntax:
2755 @smallexample @c ada
2756 pragma Export_Object
2757       [Internal =>] LOCAL_NAME
2758    [, [External =>] EXTERNAL_SYMBOL]
2759    [, [Size     =>] EXTERNAL_SYMBOL]
2761 EXTERNAL_SYMBOL ::=
2762   IDENTIFIER
2763 | static_string_EXPRESSION
2764 @end smallexample
2766 @noindent
2767 This pragma designates an object as exported, and apart from the
2768 extended rules for external symbols, is identical in effect to the use of
2769 the normal @code{Export} pragma applied to an object.  You may use a
2770 separate Export pragma (and you probably should from the point of view
2771 of portability), but it is not required.  @var{Size} is syntax checked,
2772 but otherwise ignored by GNAT@.
2774 @node Pragma Export_Procedure
2775 @unnumberedsec Pragma Export_Procedure
2776 @findex Export_Procedure
2777 @noindent
2778 Syntax:
2780 @smallexample @c ada
2781 pragma Export_Procedure (
2782      [Internal        =>] LOCAL_NAME
2783   [, [External        =>] EXTERNAL_SYMBOL]
2784   [, [Parameter_Types =>] PARAMETER_TYPES]
2785   [, [Mechanism       =>] MECHANISM]);
2787 EXTERNAL_SYMBOL ::=
2788   IDENTIFIER
2789 | static_string_EXPRESSION
2790 | ""
2792 PARAMETER_TYPES ::=
2793   null
2794 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
2796 TYPE_DESIGNATOR ::=
2797   subtype_NAME
2798 | subtype_Name ' Access
2800 MECHANISM ::=
2801   MECHANISM_NAME
2802 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
2804 MECHANISM_ASSOCIATION ::=
2805   [formal_parameter_NAME =>] MECHANISM_NAME
2807 MECHANISM_NAME ::=
2808   Value
2809 | Reference
2810 | Descriptor [([Class =>] CLASS_NAME)]
2811 | Short_Descriptor [([Class =>] CLASS_NAME)]
2813 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
2814 @end smallexample
2816 @noindent
2817 This pragma is identical to @code{Export_Function} except that it
2818 applies to a procedure rather than a function and the parameters
2819 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
2820 GNAT does not require a separate pragma @code{Export}, but if none is
2821 present, @code{Convention Ada} is assumed, which is usually
2822 not what is wanted, so it is usually appropriate to use this
2823 pragma in conjunction with a @code{Export} or @code{Convention}
2824 pragma that specifies the desired foreign convention.
2826 @cindex OpenVMS
2827 @cindex Passing by descriptor
2828 Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
2829 The default behavior for Export_Procedure is to accept either 64bit or
2830 32bit descriptors unless short_descriptor is specified, then only 32bit
2831 descriptors are accepted.
2833 @cindex Suppressing external name
2834 Special treatment is given if the EXTERNAL is an explicit null
2835 string or a static string expressions that evaluates to the null
2836 string. In this case, no external name is generated. This form
2837 still allows the specification of parameter mechanisms.
2839 @node Pragma Export_Value
2840 @unnumberedsec Pragma Export_Value
2841 @findex Export_Value
2842 @noindent
2843 Syntax:
2845 @smallexample @c ada
2846 pragma Export_Value (
2847   [Value     =>] static_integer_EXPRESSION,
2848   [Link_Name =>] static_string_EXPRESSION);
2849 @end smallexample
2851 @noindent
2852 This pragma serves to export a static integer value for external use.
2853 The first argument specifies the value to be exported. The Link_Name
2854 argument specifies the symbolic name to be associated with the integer
2855 value. This pragma is useful for defining a named static value in Ada
2856 that can be referenced in assembly language units to be linked with
2857 the application. This pragma is currently supported only for the
2858 AAMP target and is ignored for other targets.
2860 @node Pragma Export_Valued_Procedure
2861 @unnumberedsec Pragma Export_Valued_Procedure
2862 @findex Export_Valued_Procedure
2863 @noindent
2864 Syntax:
2866 @smallexample @c ada
2867 pragma Export_Valued_Procedure (
2868      [Internal        =>] LOCAL_NAME
2869   [, [External        =>] EXTERNAL_SYMBOL]
2870   [, [Parameter_Types =>] PARAMETER_TYPES]
2871   [, [Mechanism       =>] MECHANISM]);
2873 EXTERNAL_SYMBOL ::=
2874   IDENTIFIER
2875 | static_string_EXPRESSION
2876 | ""
2878 PARAMETER_TYPES ::=
2879   null
2880 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
2882 TYPE_DESIGNATOR ::=
2883   subtype_NAME
2884 | subtype_Name ' Access
2886 MECHANISM ::=
2887   MECHANISM_NAME
2888 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
2890 MECHANISM_ASSOCIATION ::=
2891   [formal_parameter_NAME =>] MECHANISM_NAME
2893 MECHANISM_NAME ::=
2894   Value
2895 | Reference
2896 | Descriptor [([Class =>] CLASS_NAME)]
2897 | Short_Descriptor [([Class =>] CLASS_NAME)]
2899 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a
2900 @end smallexample
2902 @noindent
2903 This pragma is identical to @code{Export_Procedure} except that the
2904 first parameter of @var{LOCAL_NAME}, which must be present, must be of
2905 mode @code{OUT}, and externally the subprogram is treated as a function
2906 with this parameter as the result of the function.  GNAT provides for
2907 this capability to allow the use of @code{OUT} and @code{IN OUT}
2908 parameters in interfacing to external functions (which are not permitted
2909 in Ada functions).
2910 GNAT does not require a separate pragma @code{Export}, but if none is
2911 present, @code{Convention Ada} is assumed, which is almost certainly
2912 not what is wanted since the whole point of this pragma is to interface
2913 with foreign language functions, so it is usually appropriate to use this
2914 pragma in conjunction with a @code{Export} or @code{Convention}
2915 pragma that specifies the desired foreign convention.
2917 @cindex OpenVMS
2918 @cindex Passing by descriptor
2919 Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
2920 The default behavior for Export_Valued_Procedure is to accept either 64bit or
2921 32bit descriptors unless short_descriptor is specified, then only 32bit
2922 descriptors are accepted.
2924 @cindex Suppressing external name
2925 Special treatment is given if the EXTERNAL is an explicit null
2926 string or a static string expressions that evaluates to the null
2927 string. In this case, no external name is generated. This form
2928 still allows the specification of parameter mechanisms.
2930 @node Pragma Extend_System
2931 @unnumberedsec Pragma Extend_System
2932 @cindex @code{system}, extending
2933 @cindex Dec Ada 83
2934 @findex Extend_System
2935 @noindent
2936 Syntax:
2938 @smallexample @c ada
2939 pragma Extend_System ([Name =>] IDENTIFIER);
2940 @end smallexample
2942 @noindent
2943 This pragma is used to provide backwards compatibility with other
2944 implementations that extend the facilities of package @code{System}.  In
2945 GNAT, @code{System} contains only the definitions that are present in
2946 the Ada RM@.  However, other implementations, notably the DEC Ada 83
2947 implementation, provide many extensions to package @code{System}.
2949 For each such implementation accommodated by this pragma, GNAT provides a
2950 package @code{Aux_@var{xxx}}, e.g.@: @code{Aux_DEC} for the DEC Ada 83
2951 implementation, which provides the required additional definitions.  You
2952 can use this package in two ways.  You can @code{with} it in the normal
2953 way and access entities either by selection or using a @code{use}
2954 clause.  In this case no special processing is required.
2956 However, if existing code contains references such as
2957 @code{System.@var{xxx}} where @var{xxx} is an entity in the extended
2958 definitions provided in package @code{System}, you may use this pragma
2959 to extend visibility in @code{System} in a non-standard way that
2960 provides greater compatibility with the existing code.  Pragma
2961 @code{Extend_System} is a configuration pragma whose single argument is
2962 the name of the package containing the extended definition
2963 (e.g.@: @code{Aux_DEC} for the DEC Ada case).  A unit compiled under
2964 control of this pragma will be processed using special visibility
2965 processing that looks in package @code{System.Aux_@var{xxx}} where
2966 @code{Aux_@var{xxx}} is the pragma argument for any entity referenced in
2967 package @code{System}, but not found in package @code{System}.
2969 You can use this pragma either to access a predefined @code{System}
2970 extension supplied with the compiler, for example @code{Aux_DEC} or
2971 you can construct your own extension unit following the above
2972 definition.  Note that such a package is a child of @code{System}
2973 and thus is considered part of the implementation.
2974 To compile it you will have to use the @option{-gnatg} switch,
2975 or the @option{/GNAT_INTERNAL} qualifier on OpenVMS,
2976 for compiling System units, as explained in the
2977 @value{EDITION} User's Guide.
2979 @node Pragma Extensions_Allowed
2980 @unnumberedsec Pragma Extensions_Allowed
2981 @cindex Ada Extensions
2982 @cindex GNAT Extensions
2983 @findex Extensions_Allowed
2984 @noindent
2985 Syntax:
2987 @smallexample @c ada
2988 pragma Extensions_Allowed (On | Off);
2989 @end smallexample
2991 @noindent
2992 This configuration pragma enables or disables the implementation
2993 extension mode (the use of Off as a parameter cancels the effect
2994 of the @option{-gnatX} command switch).
2996 In extension mode, the latest version of the Ada language is
2997 implemented (currently Ada 2012), and in addition a small number
2998 of GNAT specific extensions are recognized as follows:
3000 @table @asis
3001 @item Constrained attribute for generic objects
3002 The @code{Constrained} attribute is permitted for objects of
3003 generic types. The result indicates if the corresponding actual
3004 is constrained.
3006 @end table
3008 @node Pragma External
3009 @unnumberedsec Pragma External
3010 @findex External
3011 @noindent
3012 Syntax:
3014 @smallexample @c ada
3015 pragma External (
3016   [   Convention    =>] convention_IDENTIFIER,
3017   [   Entity        =>] LOCAL_NAME
3018   [, [External_Name =>] static_string_EXPRESSION ]
3019   [, [Link_Name     =>] static_string_EXPRESSION ]);
3020 @end smallexample
3022 @noindent
3023 This pragma is identical in syntax and semantics to pragma
3024 @code{Export} as defined in the Ada Reference Manual.  It is
3025 provided for compatibility with some Ada 83 compilers that
3026 used this pragma for exactly the same purposes as pragma
3027 @code{Export} before the latter was standardized.
3029 @node Pragma External_Name_Casing
3030 @unnumberedsec Pragma External_Name_Casing
3031 @cindex Dec Ada 83 casing compatibility
3032 @cindex External Names, casing
3033 @cindex Casing of External names
3034 @findex External_Name_Casing
3035 @noindent
3036 Syntax:
3038 @smallexample @c ada
3039 pragma External_Name_Casing (
3040   Uppercase | Lowercase
3041   [, Uppercase | Lowercase | As_Is]);
3042 @end smallexample
3044 @noindent
3045 This pragma provides control over the casing of external names associated
3046 with Import and Export pragmas.  There are two cases to consider:
3048 @table @asis
3049 @item Implicit external names
3050 Implicit external names are derived from identifiers.  The most common case
3051 arises when a standard Ada Import or Export pragma is used with only two
3052 arguments, as in:
3054 @smallexample @c ada
3055    pragma Import (C, C_Routine);
3056 @end smallexample
3058 @noindent
3059 Since Ada is a case-insensitive language, the spelling of the identifier in
3060 the Ada source program does not provide any information on the desired
3061 casing of the external name, and so a convention is needed.  In GNAT the
3062 default treatment is that such names are converted to all lower case
3063 letters.  This corresponds to the normal C style in many environments.
3064 The first argument of pragma @code{External_Name_Casing} can be used to
3065 control this treatment.  If @code{Uppercase} is specified, then the name
3066 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3067 then the normal default of all lower case letters will be used.
3069 This same implicit treatment is also used in the case of extended DEC Ada 83
3070 compatible Import and Export pragmas where an external name is explicitly
3071 specified using an identifier rather than a string.
3073 @item Explicit external names
3074 Explicit external names are given as string literals.  The most common case
3075 arises when a standard Ada Import or Export pragma is used with three
3076 arguments, as in:
3078 @smallexample @c ada
3079 pragma Import (C, C_Routine, "C_routine");
3080 @end smallexample
3082 @noindent
3083 In this case, the string literal normally provides the exact casing required
3084 for the external name.  The second argument of pragma
3085 @code{External_Name_Casing} may be used to modify this behavior.
3086 If @code{Uppercase} is specified, then the name
3087 will be forced to all uppercase letters.  If @code{Lowercase} is specified,
3088 then the name will be forced to all lowercase letters.  A specification of
3089 @code{As_Is} provides the normal default behavior in which the casing is
3090 taken from the string provided.
3091 @end table
3093 @noindent
3094 This pragma may appear anywhere that a pragma is valid.  In particular, it
3095 can be used as a configuration pragma in the @file{gnat.adc} file, in which
3096 case it applies to all subsequent compilations, or it can be used as a program
3097 unit pragma, in which case it only applies to the current unit, or it can
3098 be used more locally to control individual Import/Export pragmas.
3100 It is primarily intended for use with OpenVMS systems, where many
3101 compilers convert all symbols to upper case by default.  For interfacing to
3102 such compilers (e.g.@: the DEC C compiler), it may be convenient to use
3103 the pragma:
3105 @smallexample @c ada
3106 pragma External_Name_Casing (Uppercase, Uppercase);
3107 @end smallexample
3109 @noindent
3110 to enforce the upper casing of all external symbols.
3112 @node Pragma Fast_Math
3113 @unnumberedsec Pragma Fast_Math
3114 @findex Fast_Math
3115 @noindent
3116 Syntax:
3118 @smallexample @c ada
3119 pragma Fast_Math;
3120 @end smallexample
3122 @noindent
3123 This is a configuration pragma which activates a mode in which speed is
3124 considered more important for floating-point operations than absolutely
3125 accurate adherence to the requirements of the standard. Currently the
3126 following operations are affected:
3128 @table @asis
3129 @item Complex Multiplication
3130 The normal simple formula for complex multiplication can result in intermediate
3131 overflows for numbers near the end of the range. The Ada standard requires that
3132 this situation be detected and corrected by scaling, but in Fast_Math mode such
3133 cases will simply result in overflow. Note that to take advantage of this you
3134 must instantiate your own version of @code{Ada.Numerics.Generic_Complex_Types}
3135 under control of the pragma, rather than use the preinstantiated versions.
3136 @end table
3138 @node Pragma Favor_Top_Level
3139 @unnumberedsec Pragma Favor_Top_Level
3140 @findex Favor_Top_Level
3141 @noindent
3142 Syntax:
3144 @smallexample @c ada
3145 pragma Favor_Top_Level (type_NAME);
3146 @end smallexample
3148 @noindent
3149 The named type must be an access-to-subprogram type. This pragma is an
3150 efficiency hint to the compiler, regarding the use of 'Access or
3151 'Unrestricted_Access on nested (non-library-level) subprograms. The
3152 pragma means that nested subprograms are not used with this type, or
3153 are rare, so that the generated code should be efficient in the
3154 top-level case. When this pragma is used, dynamically generated
3155 trampolines may be used on some targets for nested subprograms.
3156 See also the No_Implicit_Dynamic_Code restriction.
3158 @node Pragma Finalize_Storage_Only
3159 @unnumberedsec Pragma Finalize_Storage_Only
3160 @findex Finalize_Storage_Only
3161 @noindent
3162 Syntax:
3164 @smallexample @c ada
3165 pragma Finalize_Storage_Only (first_subtype_LOCAL_NAME);
3166 @end smallexample
3168 @noindent
3169 This pragma allows the compiler not to emit a Finalize call for objects
3170 defined at the library level.  This is mostly useful for types where
3171 finalization is only used to deal with storage reclamation since in most
3172 environments it is not necessary to reclaim memory just before terminating
3173 execution, hence the name.
3175 @node Pragma Float_Representation
3176 @unnumberedsec Pragma Float_Representation
3177 @cindex OpenVMS
3178 @findex Float_Representation
3179 @noindent
3180 Syntax:
3182 @smallexample @c ada
3183 pragma Float_Representation (FLOAT_REP[, float_type_LOCAL_NAME]);
3185 FLOAT_REP ::= VAX_Float | IEEE_Float
3186 @end smallexample
3188 @noindent
3189 In the one argument form, this pragma is a configuration pragma which
3190 allows control over the internal representation chosen for the predefined
3191 floating point types declared in the packages @code{Standard} and
3192 @code{System}. On all systems other than OpenVMS, the argument must
3193 be @code{IEEE_Float} and the pragma has no effect. On OpenVMS, the
3194 argument may be @code{VAX_Float} to specify the use of the VAX float
3195 format for the floating-point types in Standard. This requires that
3196 the standard runtime libraries be recompiled.
3198 The two argument form specifies the representation to be used for
3199 the specified floating-point type. On all systems other than OpenVMS,
3200 the argument must
3201 be @code{IEEE_Float} to specify the use of IEEE format, as follows:
3203 @itemize @bullet
3204 @item
3205 For a digits value of 6, 32-bit IEEE short format will be used.
3206 @item
3207 For a digits value of 15, 64-bit IEEE long format will be used.
3208 @item
3209 No other value of digits is permitted.
3210 @end itemize
3212 On OpenVMS, the
3213 argument may be @code{VAX_Float} to specify the use of the VAX float
3214 format, as follows:
3216 @itemize @bullet
3217 @item
3218 For digits values up to 6, F float format will be used.
3219 @item
3220 For digits values from 7 to 9, D float format will be used.
3221 @item
3222 For digits values from 10 to 15, G float format will be used.
3223 @item
3224 Digits values above 15 are not allowed.
3225 @end itemize
3227 @node Pragma Global
3228 @unnumberedsec Pragma Global
3229 @findex Global
3230 @noindent
3231 For the description of this pragma, see SPARK 2014 Reference Manual,
3232 section 6.1.4.
3234 @node Pragma Ident
3235 @unnumberedsec Pragma Ident
3236 @findex Ident
3237 @noindent
3238 Syntax:
3240 @smallexample @c ada
3241 pragma Ident (static_string_EXPRESSION);
3242 @end smallexample
3244 @noindent
3245 This pragma provides a string identification in the generated object file,
3246 if the system supports the concept of this kind of identification string.
3247 This pragma is allowed only in the outermost declarative part or
3248 declarative items of a compilation unit. If more than one @code{Ident}
3249 pragma is given, only the last one processed is effective.
3250 @cindex OpenVMS
3251 On OpenVMS systems, the effect of the pragma is identical to the effect of
3252 the DEC Ada 83 pragma of the same name. Note that in DEC Ada 83, the
3253 maximum allowed length is 31 characters, so if it is important to
3254 maintain compatibility with this compiler, you should obey this length
3255 limit.
3257 @node Pragma Implementation_Defined
3258 @unnumberedsec Pragma Implementation_Defined
3259 @findex Implementation_Defined
3260 @noindent
3261 Syntax:
3263 @smallexample @c ada
3264 pragma Implementation_Defined (local_NAME);
3265 @end smallexample
3267 @noindent
3268 This pragma marks a previously declared entioty as implementation-defined.
3269 For an overloaded entity, applies to the most recent homonym.
3271 @smallexample @c ada
3272 pragma Implementation_Defined;
3273 @end smallexample
3275 @noindent
3276 The form with no arguments appears anywhere within a scope, most
3277 typically a package spec, and indicates that all entities that are
3278 defined within the package spec are Implementation_Defined.
3280 This pragma is used within the GNAT runtime library to identify
3281 implementation-defined entities introduced in language-defined units,
3282 for the purpose of implementing the No_Implementation_Identifiers
3283 restriction.
3285 @node Pragma Implemented
3286 @unnumberedsec Pragma Implemented
3287 @findex Implemented
3288 @noindent
3289 Syntax:
3291 @smallexample @c ada
3292 pragma Implemented (procedure_LOCAL_NAME, implementation_kind);
3294 implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
3295 @end smallexample
3297 @noindent
3298 This is an Ada 2012 representation pragma which applies to protected, task
3299 and synchronized interface primitives. The use of pragma Implemented provides
3300 a way to impose a static requirement on the overriding operation by adhering
3301 to one of the three implementation kinds: entry, protected procedure or any of
3302 the above. This pragma is available in all earlier versions of Ada as an
3303 implementation-defined pragma.
3305 @smallexample @c ada
3306 type Synch_Iface is synchronized interface;
3307 procedure Prim_Op (Obj : in out Iface) is abstract;
3308 pragma Implemented (Prim_Op, By_Protected_Procedure);
3310 protected type Prot_1 is new Synch_Iface with
3311    procedure Prim_Op;  --  Legal
3312 end Prot_1;
3314 protected type Prot_2 is new Synch_Iface with
3315    entry Prim_Op;      --  Illegal
3316 end Prot_2;
3318 task type Task_Typ is new Synch_Iface with
3319    entry Prim_Op;      --  Illegal
3320 end Task_Typ;
3321 @end smallexample
3323 @noindent
3324 When applied to the procedure_or_entry_NAME of a requeue statement, pragma
3325 Implemented determines the runtime behavior of the requeue. Implementation kind
3326 By_Entry guarantees that the action of requeueing will proceed from an entry to
3327 another entry. Implementation kind By_Protected_Procedure transforms the
3328 requeue into a dispatching call, thus eliminating the chance of blocking. Kind
3329 By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on
3330 the target's overriding subprogram kind.
3332 @node Pragma Implicit_Packing
3333 @unnumberedsec Pragma Implicit_Packing
3334 @findex Implicit_Packing
3335 @cindex Rational Profile
3336 @noindent
3337 Syntax:
3339 @smallexample @c ada
3340 pragma Implicit_Packing;
3341 @end smallexample
3343 @noindent
3344 This is a configuration pragma that requests implicit packing for packed
3345 arrays for which a size clause is given but no explicit pragma Pack or
3346 specification of Component_Size is present. It also applies to records
3347 where no record representation clause is present. Consider this example:
3349 @smallexample @c ada
3350 type R is array (0 .. 7) of Boolean;
3351 for R'Size use 8;
3352 @end smallexample
3354 @noindent
3355 In accordance with the recommendation in the RM (RM 13.3(53)), a Size clause
3356 does not change the layout of a composite object. So the Size clause in the
3357 above example is normally rejected, since the default layout of the array uses
3358 8-bit components, and thus the array requires a minimum of 64 bits.
3360 If this declaration is compiled in a region of code covered by an occurrence
3361 of the configuration pragma Implicit_Packing, then the Size clause in this
3362 and similar examples will cause implicit packing and thus be accepted. For
3363 this implicit packing to occur, the type in question must be an array of small
3364 components whose size is known at compile time, and the Size clause must
3365 specify the exact size that corresponds to the number of elements in the array
3366 multiplied by the size in bits of the component type (both single and
3367 multi-dimensioned arrays can be controlled with this pragma).
3369 @cindex Array packing
3371 Similarly, the following example shows the use in the record case
3373 @smallexample @c ada
3374 type r is record
3375    a, b, c, d, e, f, g, h : boolean;
3376    chr                    : character;
3377 end record;
3378 for r'size use 16;
3379 @end smallexample
3381 @noindent
3382 Without a pragma Pack, each Boolean field requires 8 bits, so the
3383 minimum size is 72 bits, but with a pragma Pack, 16 bits would be
3384 sufficient. The use of pragma Implicit_Packing allows this record
3385 declaration to compile without an explicit pragma Pack.
3386 @node Pragma Import_Exception
3387 @unnumberedsec Pragma Import_Exception
3388 @cindex OpenVMS
3389 @findex Import_Exception
3390 @noindent
3391 Syntax:
3393 @smallexample @c ada
3394 pragma Import_Exception (
3395      [Internal =>] LOCAL_NAME
3396   [, [External =>] EXTERNAL_SYMBOL]
3397   [, [Form     =>] Ada | VMS]
3398   [, [Code     =>] static_integer_EXPRESSION]);
3400 EXTERNAL_SYMBOL ::=
3401   IDENTIFIER
3402 | static_string_EXPRESSION
3403 @end smallexample
3405 @noindent
3406 This pragma is implemented only in the OpenVMS implementation of GNAT@.
3407 It allows OpenVMS conditions (for example, from OpenVMS system services or
3408 other OpenVMS languages) to be propagated to Ada programs as Ada exceptions.
3409 The pragma specifies that the exception associated with an exception
3410 declaration in an Ada program be defined externally (in non-Ada code).
3411 For further details on this pragma, see the
3412 DEC Ada Language Reference Manual, section 13.9a.3.1.
3414 @node Pragma Import_Function
3415 @unnumberedsec Pragma Import_Function
3416 @findex Import_Function
3417 @noindent
3418 Syntax:
3420 @smallexample @c ada
3421 pragma Import_Function (
3422      [Internal                 =>] LOCAL_NAME,
3423   [, [External                 =>] EXTERNAL_SYMBOL]
3424   [, [Parameter_Types          =>] PARAMETER_TYPES]
3425   [, [Result_Type              =>] SUBTYPE_MARK]
3426   [, [Mechanism                =>] MECHANISM]
3427   [, [Result_Mechanism         =>] MECHANISM_NAME]
3428   [, [First_Optional_Parameter =>] IDENTIFIER]);
3430 EXTERNAL_SYMBOL ::=
3431   IDENTIFIER
3432 | static_string_EXPRESSION
3434 PARAMETER_TYPES ::=
3435   null
3436 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3438 TYPE_DESIGNATOR ::=
3439   subtype_NAME
3440 | subtype_Name ' Access
3442 MECHANISM ::=
3443   MECHANISM_NAME
3444 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3446 MECHANISM_ASSOCIATION ::=
3447   [formal_parameter_NAME =>] MECHANISM_NAME
3449 MECHANISM_NAME ::=
3450   Value
3451 | Reference
3452 | Descriptor [([Class =>] CLASS_NAME)]
3453 | Short_Descriptor [([Class =>] CLASS_NAME)]
3455 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
3456 @end smallexample
3458 @noindent
3459 This pragma is used in conjunction with a pragma @code{Import} to
3460 specify additional information for an imported function.  The pragma
3461 @code{Import} (or equivalent pragma @code{Interface}) must precede the
3462 @code{Import_Function} pragma and both must appear in the same
3463 declarative part as the function specification.
3465 The @var{Internal} argument must uniquely designate
3466 the function to which the
3467 pragma applies.  If more than one function name exists of this name in
3468 the declarative part you must use the @code{Parameter_Types} and
3469 @var{Result_Type} parameters to achieve the required unique
3470 designation.  Subtype marks in these parameters must exactly match the
3471 subtypes in the corresponding function specification, using positional
3472 notation to match parameters with subtype marks.
3473 The form with an @code{'Access} attribute can be used to match an
3474 anonymous access parameter.
3476 You may optionally use the @var{Mechanism} and @var{Result_Mechanism}
3477 parameters to specify passing mechanisms for the
3478 parameters and result.  If you specify a single mechanism name, it
3479 applies to all parameters.  Otherwise you may specify a mechanism on a
3480 parameter by parameter basis using either positional or named
3481 notation.  If the mechanism is not specified, the default mechanism
3482 is used.
3484 @cindex OpenVMS
3485 @cindex Passing by descriptor
3486 Passing by descriptor is supported only on the OpenVMS ports of GNAT@.
3487 The default behavior for Import_Function is to pass a 64bit descriptor
3488 unless short_descriptor is specified, then a 32bit descriptor is passed.
3490 @code{First_Optional_Parameter} applies only to OpenVMS ports of GNAT@.
3491 It specifies that the designated parameter and all following parameters
3492 are optional, meaning that they are not passed at the generated code
3493 level (this is distinct from the notion of optional parameters in Ada
3494 where the parameters are passed anyway with the designated optional
3495 parameters).  All optional parameters must be of mode @code{IN} and have
3496 default parameter values that are either known at compile time
3497 expressions, or uses of the @code{'Null_Parameter} attribute.
3499 @node Pragma Import_Object
3500 @unnumberedsec Pragma Import_Object
3501 @findex Import_Object
3502 @noindent
3503 Syntax:
3505 @smallexample @c ada
3506 pragma Import_Object
3507      [Internal =>] LOCAL_NAME
3508   [, [External =>] EXTERNAL_SYMBOL]
3509   [, [Size     =>] EXTERNAL_SYMBOL]);
3511 EXTERNAL_SYMBOL ::=
3512   IDENTIFIER
3513 | static_string_EXPRESSION
3514 @end smallexample
3516 @noindent
3517 This pragma designates an object as imported, and apart from the
3518 extended rules for external symbols, is identical in effect to the use of
3519 the normal @code{Import} pragma applied to an object.  Unlike the
3520 subprogram case, you need not use a separate @code{Import} pragma,
3521 although you may do so (and probably should do so from a portability
3522 point of view).  @var{size} is syntax checked, but otherwise ignored by
3523 GNAT@.
3525 @node Pragma Import_Procedure
3526 @unnumberedsec Pragma Import_Procedure
3527 @findex Import_Procedure
3528 @noindent
3529 Syntax:
3531 @smallexample @c ada
3532 pragma Import_Procedure (
3533      [Internal                 =>] LOCAL_NAME
3534   [, [External                 =>] EXTERNAL_SYMBOL]
3535   [, [Parameter_Types          =>] PARAMETER_TYPES]
3536   [, [Mechanism                =>] MECHANISM]
3537   [, [First_Optional_Parameter =>] IDENTIFIER]);
3539 EXTERNAL_SYMBOL ::=
3540   IDENTIFIER
3541 | static_string_EXPRESSION
3543 PARAMETER_TYPES ::=
3544   null
3545 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3547 TYPE_DESIGNATOR ::=
3548   subtype_NAME
3549 | subtype_Name ' Access
3551 MECHANISM ::=
3552   MECHANISM_NAME
3553 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3555 MECHANISM_ASSOCIATION ::=
3556   [formal_parameter_NAME =>] MECHANISM_NAME
3558 MECHANISM_NAME ::=
3559   Value
3560 | Reference
3561 | Descriptor [([Class =>] CLASS_NAME)]
3562 | Short_Descriptor [([Class =>] CLASS_NAME)]
3564 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
3565 @end smallexample
3567 @noindent
3568 This pragma is identical to @code{Import_Function} except that it
3569 applies to a procedure rather than a function and the parameters
3570 @code{Result_Type} and @code{Result_Mechanism} are not permitted.
3572 @node Pragma Import_Valued_Procedure
3573 @unnumberedsec Pragma Import_Valued_Procedure
3574 @findex Import_Valued_Procedure
3575 @noindent
3576 Syntax:
3578 @smallexample @c ada
3579 pragma Import_Valued_Procedure (
3580      [Internal                 =>] LOCAL_NAME
3581   [, [External                 =>] EXTERNAL_SYMBOL]
3582   [, [Parameter_Types          =>] PARAMETER_TYPES]
3583   [, [Mechanism                =>] MECHANISM]
3584   [, [First_Optional_Parameter =>] IDENTIFIER]);
3586 EXTERNAL_SYMBOL ::=
3587   IDENTIFIER
3588 | static_string_EXPRESSION
3590 PARAMETER_TYPES ::=
3591   null
3592 | TYPE_DESIGNATOR @{, TYPE_DESIGNATOR@}
3594 TYPE_DESIGNATOR ::=
3595   subtype_NAME
3596 | subtype_Name ' Access
3598 MECHANISM ::=
3599   MECHANISM_NAME
3600 | (MECHANISM_ASSOCIATION @{, MECHANISM_ASSOCIATION@})
3602 MECHANISM_ASSOCIATION ::=
3603   [formal_parameter_NAME =>] MECHANISM_NAME
3605 MECHANISM_NAME ::=
3606   Value
3607 | Reference
3608 | Descriptor [([Class =>] CLASS_NAME)]
3609 | Short_Descriptor [([Class =>] CLASS_NAME)]
3611 CLASS_NAME ::= ubs | ubsb | uba | s | sb | a | nca
3612 @end smallexample
3614 @noindent
3615 This pragma is identical to @code{Import_Procedure} except that the
3616 first parameter of @var{LOCAL_NAME}, which must be present, must be of
3617 mode @code{OUT}, and externally the subprogram is treated as a function
3618 with this parameter as the result of the function.  The purpose of this
3619 capability is to allow the use of @code{OUT} and @code{IN OUT}
3620 parameters in interfacing to external functions (which are not permitted
3621 in Ada functions).  You may optionally use the @code{Mechanism}
3622 parameters to specify passing mechanisms for the parameters.
3623 If you specify a single mechanism name, it applies to all parameters.
3624 Otherwise you may specify a mechanism on a parameter by parameter
3625 basis using either positional or named notation.  If the mechanism is not
3626 specified, the default mechanism is used.
3628 Note that it is important to use this pragma in conjunction with a separate
3629 pragma Import that specifies the desired convention, since otherwise the
3630 default convention is Ada, which is almost certainly not what is required.
3632 @node Pragma Independent
3633 @unnumberedsec Pragma Independent
3634 @findex Independent
3635 @noindent
3636 Syntax:
3638 @smallexample @c ada
3639 pragma Independent (Local_NAME);
3640 @end smallexample
3642 @noindent
3643 This pragma is standard in Ada 2012 mode (which also provides an aspect
3644 of the same name). It is also available as an implementation-defined
3645 pragma in all earlier versions. It specifies that the
3646 designated object or all objects of the designated type must be
3647 independently addressable. This means that separate tasks can safely
3648 manipulate such objects. For example, if two components of a record are
3649 independent, then two separate tasks may access these two components.
3650 This may place
3651 constraints on the representation of the object (for instance prohibiting
3652 tight packing).
3654 @node Pragma Independent_Components
3655 @unnumberedsec Pragma Independent_Components
3656 @findex Independent_Components
3657 @noindent
3658 Syntax:
3660 @smallexample @c ada
3661 pragma Independent_Components (Local_NAME);
3662 @end smallexample
3664 @noindent
3665 This pragma is standard in Ada 2012 mode (which also provides an aspect
3666 of the same name). It is also available as an implementation-defined
3667 pragma in all earlier versions. It specifies that the components of the
3668 designated object, or the components of each object of the designated
3669 type, must be
3670 independently addressable. This means that separate tasks can safely
3671 manipulate separate components in the composite object. This may place
3672 constraints on the representation of the object (for instance prohibiting
3673 tight packing).
3675 @node Pragma Initial_Condition
3676 @unnumberedsec Pragma Initial_Condition
3677 @findex Initial_Condition
3678 @noindent
3679 For the description of this pragma, see SPARK 2014 Reference Manual,
3680 section 7.1.6.
3682 @node Pragma Initialize_Scalars
3683 @unnumberedsec Pragma Initialize_Scalars
3684 @findex Initialize_Scalars
3685 @cindex debugging with Initialize_Scalars
3686 @noindent
3687 Syntax:
3689 @smallexample @c ada
3690 pragma Initialize_Scalars;
3691 @end smallexample
3693 @noindent
3694 This pragma is similar to @code{Normalize_Scalars} conceptually but has
3695 two important differences.  First, there is no requirement for the pragma
3696 to be used uniformly in all units of a partition, in particular, it is fine
3697 to use this just for some or all of the application units of a partition,
3698 without needing to recompile the run-time library.
3700 In the case where some units are compiled with the pragma, and some without,
3701 then a declaration of a variable where the type is defined in package
3702 Standard or is locally declared will always be subject to initialization,
3703 as will any declaration of a scalar variable.  For composite variables,
3704 whether the variable is initialized may also depend on whether the package
3705 in which the type of the variable is declared is compiled with the pragma.
3707 The other important difference is that you can control the value used
3708 for initializing scalar objects.  At bind time, you can select several
3709 options for initialization. You can
3710 initialize with invalid values (similar to Normalize_Scalars, though for
3711 Initialize_Scalars it is not always possible to determine the invalid
3712 values in complex cases like signed component fields with non-standard
3713 sizes). You can also initialize with high or
3714 low values, or with a specified bit pattern.  See the @value{EDITION}
3715 User's Guide for binder options for specifying these cases.
3717 This means that you can compile a program, and then without having to
3718 recompile the program, you can run it with different values being used
3719 for initializing otherwise uninitialized values, to test if your program
3720 behavior depends on the choice.  Of course the behavior should not change,
3721 and if it does, then most likely you have an erroneous reference to an
3722 uninitialized value.
3724 It is even possible to change the value at execution time eliminating even
3725 the need to rebind with a different switch using an environment variable.
3726 See the @value{EDITION} User's Guide for details.
3728 Note that pragma @code{Initialize_Scalars} is particularly useful in
3729 conjunction with the enhanced validity checking that is now provided
3730 in GNAT, which checks for invalid values under more conditions.
3731 Using this feature (see description of the @option{-gnatV} flag in the
3732 @value{EDITION} User's Guide) in conjunction with
3733 pragma @code{Initialize_Scalars}
3734 provides a powerful new tool to assist in the detection of problems
3735 caused by uninitialized variables.
3737 Note: the use of @code{Initialize_Scalars} has a fairly extensive
3738 effect on the generated code. This may cause your code to be
3739 substantially larger. It may also cause an increase in the amount
3740 of stack required, so it is probably a good idea to turn on stack
3741 checking (see description of stack checking in the @value{EDITION}
3742 User's Guide) when using this pragma.
3744 @node Pragma Initializes
3745 @unnumberedsec Pragma Initializes
3746 @findex Initializes
3747 @noindent
3748 For the description of this pragma, see SPARK 2014 Reference Manual,
3749 section 7.1.5.
3751 @node Pragma Inline_Always
3752 @unnumberedsec Pragma Inline_Always
3753 @findex Inline_Always
3754 @noindent
3755 Syntax:
3757 @smallexample @c ada
3758 pragma Inline_Always (NAME [, NAME]);
3759 @end smallexample
3761 @noindent
3762 Similar to pragma @code{Inline} except that inlining is not subject to
3763 the use of option @option{-gnatn} or @option{-gnatN} and the inlining
3764 happens regardless of whether these options are used.
3766 @node Pragma Inline_Generic
3767 @unnumberedsec Pragma Inline_Generic
3768 @findex Inline_Generic
3769 @noindent
3770 Syntax:
3772 @smallexample @c ada
3773 pragma Inline_Generic (GNAME @{, GNAME@});
3775 GNAME ::= generic_unit_NAME | generic_instance_NAME
3776 @end smallexample
3778 @noindent
3779 This pragma is provided for compatibility with Dec Ada 83. It has
3780 no effect in @code{GNAT} (which always inlines generics), other
3781 than to check that the given names are all names of generic units or
3782 generic instances.
3784 @node Pragma Interface
3785 @unnumberedsec Pragma Interface
3786 @findex Interface
3787 @noindent
3788 Syntax:
3790 @smallexample @c ada
3791 pragma Interface (
3792      [Convention    =>] convention_identifier,
3793      [Entity        =>] local_NAME
3794   [, [External_Name =>] static_string_expression]
3795   [, [Link_Name     =>] static_string_expression]);
3796 @end smallexample
3798 @noindent
3799 This pragma is identical in syntax and semantics to
3800 the standard Ada pragma @code{Import}.  It is provided for compatibility
3801 with Ada 83.  The definition is upwards compatible both with pragma
3802 @code{Interface} as defined in the Ada 83 Reference Manual, and also
3803 with some extended implementations of this pragma in certain Ada 83
3804 implementations.  The only difference between pragma @code{Interface}
3805 and pragma @code{Import} is that there is special circuitry to allow
3806 both pragmas to appear for the same subprogram entity (normally it
3807 is illegal to have multiple @code{Import} pragmas. This is useful in
3808 maintaining Ada 83/Ada 95 compatibility and is compatible with other
3809 Ada 83 compilers.
3811 @node Pragma Interface_Name
3812 @unnumberedsec Pragma Interface_Name
3813 @findex Interface_Name
3814 @noindent
3815 Syntax:
3817 @smallexample @c ada
3818 pragma Interface_Name (
3819      [Entity        =>] LOCAL_NAME
3820   [, [External_Name =>] static_string_EXPRESSION]
3821   [, [Link_Name     =>] static_string_EXPRESSION]);
3822 @end smallexample
3824 @noindent
3825 This pragma provides an alternative way of specifying the interface name
3826 for an interfaced subprogram, and is provided for compatibility with Ada
3827 83 compilers that use the pragma for this purpose.  You must provide at
3828 least one of @var{External_Name} or @var{Link_Name}.
3830 @node Pragma Interrupt_Handler
3831 @unnumberedsec Pragma Interrupt_Handler
3832 @findex Interrupt_Handler
3833 @noindent
3834 Syntax:
3836 @smallexample @c ada
3837 pragma Interrupt_Handler (procedure_LOCAL_NAME);
3838 @end smallexample
3840 @noindent
3841 This program unit pragma is supported for parameterless protected procedures
3842 as described in Annex C of the Ada Reference Manual. On the AAMP target
3843 the pragma can also be specified for nonprotected parameterless procedures
3844 that are declared at the library level (which includes procedures
3845 declared at the top level of a library package). In the case of AAMP,
3846 when this pragma is applied to a nonprotected procedure, the instruction
3847 @code{IERET} is generated for returns from the procedure, enabling
3848 maskable interrupts, in place of the normal return instruction.
3850 @node Pragma Interrupt_State
3851 @unnumberedsec Pragma Interrupt_State
3852 @findex Interrupt_State
3853 @noindent
3854 Syntax:
3856 @smallexample @c ada
3857 pragma Interrupt_State
3858  ([Name  =>] value,
3859   [State =>] SYSTEM | RUNTIME | USER);
3860 @end smallexample
3862 @noindent
3863 Normally certain interrupts are reserved to the implementation.  Any attempt
3864 to attach an interrupt causes Program_Error to be raised, as described in
3865 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
3866 many systems for an @kbd{Ctrl-C} interrupt.  Normally this interrupt is
3867 reserved to the implementation, so that @kbd{Ctrl-C} can be used to
3868 interrupt execution.  Additionally, signals such as @code{SIGSEGV},
3869 @code{SIGABRT}, @code{SIGFPE} and @code{SIGILL} are often mapped to specific
3870 Ada exceptions, or used to implement run-time functions such as the
3871 @code{abort} statement and stack overflow checking.
3873 Pragma @code{Interrupt_State} provides a general mechanism for overriding
3874 such uses of interrupts.  It subsumes the functionality of pragma
3875 @code{Unreserve_All_Interrupts}.  Pragma @code{Interrupt_State} is not
3876 available on Windows or VMS.  On all other platforms than VxWorks,
3877 it applies to signals; on VxWorks, it applies to vectored hardware interrupts
3878 and may be used to mark interrupts required by the board support package
3879 as reserved.
3881 Interrupts can be in one of three states:
3882 @itemize @bullet
3883 @item System
3885 The interrupt is reserved (no Ada handler can be installed), and the
3886 Ada run-time may not install a handler. As a result you are guaranteed
3887 standard system default action if this interrupt is raised.
3889 @item Runtime
3891 The interrupt is reserved (no Ada handler can be installed). The run time
3892 is allowed to install a handler for internal control purposes, but is
3893 not required to do so.
3895 @item User
3897 The interrupt is unreserved.  The user may install a handler to provide
3898 some other action.
3899 @end itemize
3901 @noindent
3902 These states are the allowed values of the @code{State} parameter of the
3903 pragma.  The @code{Name} parameter is a value of the type
3904 @code{Ada.Interrupts.Interrupt_ID}.  Typically, it is a name declared in
3905 @code{Ada.Interrupts.Names}.
3907 This is a configuration pragma, and the binder will check that there
3908 are no inconsistencies between different units in a partition in how a
3909 given interrupt is specified. It may appear anywhere a pragma is legal.
3911 The effect is to move the interrupt to the specified state.
3913 By declaring interrupts to be SYSTEM, you guarantee the standard system
3914 action, such as a core dump.
3916 By declaring interrupts to be USER, you guarantee that you can install
3917 a handler.
3919 Note that certain signals on many operating systems cannot be caught and
3920 handled by applications.  In such cases, the pragma is ignored.  See the
3921 operating system documentation, or the value of the array @code{Reserved}
3922 declared in the spec of package @code{System.OS_Interface}.
3924 Overriding the default state of signals used by the Ada runtime may interfere
3925 with an application's runtime behavior in the cases of the synchronous signals,
3926 and in the case of the signal used to implement the @code{abort} statement.
3928 @node Pragma Invariant
3929 @unnumberedsec Pragma Invariant
3930 @findex Invariant
3931 @noindent
3932 Syntax:
3934 @smallexample @c ada
3935 pragma Invariant
3936   ([Entity =>]    private_type_LOCAL_NAME,
3937    [Check  =>]    EXPRESSION
3938    [,[Message =>] String_Expression]);
3939 @end smallexample
3941 @noindent
3942 This pragma provides exactly the same capabilities as the Type_Invariant aspect
3943 defined in AI05-0146-1, and in the Ada 2012 Reference Manual. The
3944 Type_Invariant aspect is fully implemented in Ada 2012 mode, but since it
3945 requires the use of the aspect syntax, which is not available except in 2012
3946 mode, it is not possible to use the Type_Invariant aspect in earlier versions
3947 of Ada. However the Invariant pragma may be used in any version of Ada. Also
3948 note that the aspect Invariant is a synonym in GNAT for the aspect
3949 Type_Invariant, but there is no pragma Type_Invariant.
3951 The pragma must appear within the visible part of the package specification,
3952 after the type to which its Entity argument appears. As with the Invariant
3953 aspect, the Check expression is not analyzed until the end of the visible
3954 part of the package, so it may contain forward references. The Message
3955 argument, if present, provides the exception message used if the invariant
3956 is violated. If no Message parameter is provided, a default message that
3957 identifies the line on which the pragma appears is used.
3959 It is permissible to have multiple Invariants for the same type entity, in
3960 which case they are and'ed together. It is permissible to use this pragma
3961 in Ada 2012 mode, but you cannot have both an invariant aspect and an
3962 invariant pragma for the same entity.
3964 For further details on the use of this pragma, see the Ada 2012 documentation
3965 of the Type_Invariant aspect.
3967 @node Pragma Java_Constructor
3968 @unnumberedsec Pragma Java_Constructor
3969 @findex Java_Constructor
3970 @noindent
3971 Syntax:
3973 @smallexample @c ada
3974 pragma Java_Constructor ([Entity =>] function_LOCAL_NAME);
3975 @end smallexample
3977 @noindent
3978 This pragma is used to assert that the specified Ada function should be
3979 mapped to the Java constructor for some Ada tagged record type.
3981 See section 7.3.2 of the
3982 @code{GNAT User's Guide: Supplement for the JVM Platform.}
3983 for related information.
3985 @node Pragma Java_Interface
3986 @unnumberedsec Pragma Java_Interface
3987 @findex Java_Interface
3988 @noindent
3989 Syntax:
3991 @smallexample @c ada
3992 pragma Java_Interface ([Entity =>] abstract_tagged_type_LOCAL_NAME);
3993 @end smallexample
3995 @noindent
3996 This pragma is used to assert that the specified Ada abstract tagged type
3997 is to be mapped to a Java interface name.
3999 See sections 7.1 and 7.2 of the
4000 @code{GNAT User's Guide: Supplement for the JVM Platform.}
4001 for related information.
4003 @node Pragma Keep_Names
4004 @unnumberedsec Pragma Keep_Names
4005 @findex Keep_Names
4006 @noindent
4007 Syntax:
4009 @smallexample @c ada
4010 pragma Keep_Names ([On =>] enumeration_first_subtype_LOCAL_NAME);
4011 @end smallexample
4013 @noindent
4014 The @var{LOCAL_NAME} argument
4015 must refer to an enumeration first subtype
4016 in the current declarative part. The effect is to retain the enumeration
4017 literal names for use by @code{Image} and @code{Value} even if a global
4018 @code{Discard_Names} pragma applies. This is useful when you want to
4019 generally suppress enumeration literal names and for example you therefore
4020 use a @code{Discard_Names} pragma in the @file{gnat.adc} file, but you
4021 want to retain the names for specific enumeration types.
4023 @node Pragma License
4024 @unnumberedsec Pragma License
4025 @findex License
4026 @cindex License checking
4027 @noindent
4028 Syntax:
4030 @smallexample @c ada
4031 pragma License (Unrestricted | GPL | Modified_GPL | Restricted);
4032 @end smallexample
4034 @noindent
4035 This pragma is provided to allow automated checking for appropriate license
4036 conditions with respect to the standard and modified GPL@.  A pragma
4037 @code{License}, which is a configuration pragma that typically appears at
4038 the start of a source file or in a separate @file{gnat.adc} file, specifies
4039 the licensing conditions of a unit as follows:
4041 @itemize @bullet
4042 @item Unrestricted
4043 This is used for a unit that can be freely used with no license restrictions.
4044 Examples of such units are public domain units, and units from the Ada
4045 Reference Manual.
4047 @item GPL
4048 This is used for a unit that is licensed under the unmodified GPL, and which
4049 therefore cannot be @code{with}'ed by a restricted unit.
4051 @item Modified_GPL
4052 This is used for a unit licensed under the GNAT modified GPL that includes
4053 a special exception paragraph that specifically permits the inclusion of
4054 the unit in programs without requiring the entire program to be released
4055 under the GPL@.
4057 @item Restricted
4058 This is used for a unit that is restricted in that it is not permitted to
4059 depend on units that are licensed under the GPL@.  Typical examples are
4060 proprietary code that is to be released under more restrictive license
4061 conditions.  Note that restricted units are permitted to @code{with} units
4062 which are licensed under the modified GPL (this is the whole point of the
4063 modified GPL).
4065 @end itemize
4067 @noindent
4068 Normally a unit with no @code{License} pragma is considered to have an
4069 unknown license, and no checking is done.  However, standard GNAT headers
4070 are recognized, and license information is derived from them as follows.
4072 @itemize @bullet
4074 A GNAT license header starts with a line containing 78 hyphens.  The following
4075 comment text is searched for the appearance of any of the following strings.
4077 If the string ``GNU General Public License'' is found, then the unit is assumed
4078 to have GPL license, unless the string ``As a special exception'' follows, in
4079 which case the license is assumed to be modified GPL@.
4081 If one of the strings
4082 ``This specification is adapted from the Ada Semantic Interface'' or
4083 ``This specification is derived from the Ada Reference Manual'' is found
4084 then the unit is assumed to be unrestricted.
4085 @end itemize
4087 @noindent
4088 These default actions means that a program with a restricted license pragma
4089 will automatically get warnings if a GPL unit is inappropriately
4090 @code{with}'ed.  For example, the program:
4092 @smallexample @c ada
4093 with Sem_Ch3;
4094 with GNAT.Sockets;
4095 procedure Secret_Stuff is
4096   @dots{}
4097 end Secret_Stuff
4098 @end smallexample
4100 @noindent
4101 if compiled with pragma @code{License} (@code{Restricted}) in a
4102 @file{gnat.adc} file will generate the warning:
4104 @smallexample
4105 1.  with Sem_Ch3;
4106         |
4107    >>> license of withed unit "Sem_Ch3" is incompatible
4109 2.  with GNAT.Sockets;
4110 3.  procedure Secret_Stuff is
4111 @end smallexample
4113 @noindent
4114 Here we get a warning on @code{Sem_Ch3} since it is part of the GNAT
4115 compiler and is licensed under the
4116 GPL, but no warning for @code{GNAT.Sockets} which is part of the GNAT
4117 run time, and is therefore licensed under the modified GPL@.
4119 @node Pragma Link_With
4120 @unnumberedsec Pragma Link_With
4121 @findex Link_With
4122 @noindent
4123 Syntax:
4125 @smallexample @c ada
4126 pragma Link_With (static_string_EXPRESSION @{,static_string_EXPRESSION@});
4127 @end smallexample
4129 @noindent
4130 This pragma is provided for compatibility with certain Ada 83 compilers.
4131 It has exactly the same effect as pragma @code{Linker_Options} except
4132 that spaces occurring within one of the string expressions are treated
4133 as separators. For example, in the following case:
4135 @smallexample @c ada
4136 pragma Link_With ("-labc -ldef");
4137 @end smallexample
4139 @noindent
4140 results in passing the strings @code{-labc} and @code{-ldef} as two
4141 separate arguments to the linker. In addition pragma Link_With allows
4142 multiple arguments, with the same effect as successive pragmas.
4144 @node Pragma Linker_Alias
4145 @unnumberedsec Pragma Linker_Alias
4146 @findex Linker_Alias
4147 @noindent
4148 Syntax:
4150 @smallexample @c ada
4151 pragma Linker_Alias (
4152   [Entity =>] LOCAL_NAME,
4153   [Target =>] static_string_EXPRESSION);
4154 @end smallexample
4156 @noindent
4157 @var{LOCAL_NAME} must refer to an object that is declared at the library
4158 level. This pragma establishes the given entity as a linker alias for the
4159 given target. It is equivalent to @code{__attribute__((alias))} in GNU C
4160 and causes @var{LOCAL_NAME} to be emitted as an alias for the symbol
4161 @var{static_string_EXPRESSION} in the object file, that is to say no space
4162 is reserved for @var{LOCAL_NAME} by the assembler and it will be resolved
4163 to the same address as @var{static_string_EXPRESSION} by the linker.
4165 The actual linker name for the target must be used (e.g.@: the fully
4166 encoded name with qualification in Ada, or the mangled name in C++),
4167 or it must be declared using the C convention with @code{pragma Import}
4168 or @code{pragma Export}.
4170 Not all target machines support this pragma. On some of them it is accepted
4171 only if @code{pragma Weak_External} has been applied to @var{LOCAL_NAME}.
4173 @smallexample @c ada
4174 --  Example of the use of pragma Linker_Alias
4176 package p is
4177   i : Integer := 1;
4178   pragma Export (C, i);
4180   new_name_for_i : Integer;
4181   pragma Linker_Alias (new_name_for_i, "i");
4182 end p;
4183 @end smallexample
4185 @node Pragma Linker_Constructor
4186 @unnumberedsec Pragma Linker_Constructor
4187 @findex Linker_Constructor
4188 @noindent
4189 Syntax:
4191 @smallexample @c ada
4192 pragma Linker_Constructor (procedure_LOCAL_NAME);
4193 @end smallexample
4195 @noindent
4196 @var{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4197 is declared at the library level. A procedure to which this pragma is
4198 applied will be treated as an initialization routine by the linker.
4199 It is equivalent to @code{__attribute__((constructor))} in GNU C and
4200 causes @var{procedure_LOCAL_NAME} to be invoked before the entry point
4201 of the executable is called (or immediately after the shared library is
4202 loaded if the procedure is linked in a shared library), in particular
4203 before the Ada run-time environment is set up.
4205 Because of these specific contexts, the set of operations such a procedure
4206 can perform is very limited and the type of objects it can manipulate is
4207 essentially restricted to the elementary types. In particular, it must only
4208 contain code to which pragma Restrictions (No_Elaboration_Code) applies.
4210 This pragma is used by GNAT to implement auto-initialization of shared Stand
4211 Alone Libraries, which provides a related capability without the restrictions
4212 listed above. Where possible, the use of Stand Alone Libraries is preferable
4213 to the use of this pragma.
4215 @node Pragma Linker_Destructor
4216 @unnumberedsec Pragma Linker_Destructor
4217 @findex Linker_Destructor
4218 @noindent
4219 Syntax:
4221 @smallexample @c ada
4222 pragma Linker_Destructor (procedure_LOCAL_NAME);
4223 @end smallexample
4225 @noindent
4226 @var{procedure_LOCAL_NAME} must refer to a parameterless procedure that
4227 is declared at the library level. A procedure to which this pragma is
4228 applied will be treated as a finalization routine by the linker.
4229 It is equivalent to @code{__attribute__((destructor))} in GNU C and
4230 causes @var{procedure_LOCAL_NAME} to be invoked after the entry point
4231 of the executable has exited (or immediately before the shared library
4232 is unloaded if the procedure is linked in a shared library), in particular
4233 after the Ada run-time environment is shut down.
4235 See @code{pragma Linker_Constructor} for the set of restrictions that apply
4236 because of these specific contexts.
4238 @node Pragma Linker_Section
4239 @unnumberedsec Pragma Linker_Section
4240 @findex Linker_Section
4241 @noindent
4242 Syntax:
4244 @smallexample @c ada
4245 pragma Linker_Section (
4246   [Entity  =>] LOCAL_NAME,
4247   [Section =>] static_string_EXPRESSION);
4248 @end smallexample
4250 @noindent
4251 @var{LOCAL_NAME} must refer to an object, type, or subprogram that is
4252 declared at the library level. This pragma specifies the name of the
4253 linker section for the given entity. It is equivalent to
4254 @code{__attribute__((section))} in GNU C and causes @var{LOCAL_NAME} to
4255 be placed in the @var{static_string_EXPRESSION} section of the
4256 executable (assuming the linker doesn't rename the section).
4257 GNAT also provides an implementation defined aspect of the same name.
4259 In the case of specifying this aspect for a type, the effect is to
4260 specify the corresponding for all library level objects of the type which
4261 do not have an explicit linker section set. Note that this only applies to
4262 whole objects, not to components of composite objects.
4264 In the case of a subprogram, the linker section applies to all previously
4265 declared matching overloaded subprograms in the current declarative part
4266 which do not already have a linker section assigned. The linker section
4267 aspect is useful in this case for specifying different linker sections
4268 for different elements of such an overloaded set.
4270 Note that an empty string specifies that no linker section is specified.
4271 This is not quite the same as omitting the pragma or aspect, since it
4272 can be used to specify that one element of an overloaded set of subprograms
4273 has the default linker section, or that one object of a type for which a
4274 linker section is specified should has the default linker section.
4276 The compiler normally places library-level entities in standard sections
4277 depending on the class: procedures and functions generally go in the
4278 @code{.text} section, initialized variables in the @code{.data} section
4279 and uninitialized variables in the @code{.bss} section.
4281 Other, special sections may exist on given target machines to map special
4282 hardware, for example I/O ports or flash memory. This pragma is a means to
4283 defer the final layout of the executable to the linker, thus fully working
4284 at the symbolic level with the compiler.
4286 Some file formats do not support arbitrary sections so not all target
4287 machines support this pragma. The use of this pragma may cause a program
4288 execution to be erroneous if it is used to place an entity into an
4289 inappropriate section (e.g.@: a modified variable into the @code{.text}
4290 section). See also @code{pragma Persistent_BSS}.
4292 @smallexample @c ada
4293 --  Example of the use of pragma Linker_Section
4295 package IO_Card is
4296   Port_A : Integer;
4297   pragma Volatile (Port_A);
4298   pragma Linker_Section (Port_A, ".bss.port_a");
4300   Port_B : Integer;
4301   pragma Volatile (Port_B);
4302   pragma Linker_Section (Port_B, ".bss.port_b");
4304   type Port_Type is new Integer with Linker_Section => ".bss";
4305   PA : Port_Type with Linker_Section => ".bss.PA";
4306   PB : Port_Type; --  ends up in linker section ".bss"
4308   procedure Q with Linker_Section => "Qsection";
4309 end IO_Card;
4310 @end smallexample
4312 @node Pragma Long_Float
4313 @unnumberedsec Pragma Long_Float
4314 @cindex OpenVMS
4315 @findex Long_Float
4316 @noindent
4317 Syntax:
4319 @smallexample @c ada
4320 pragma Long_Float (FLOAT_FORMAT);
4322 FLOAT_FORMAT ::= D_Float | G_Float
4323 @end smallexample
4325 @noindent
4326 This pragma is implemented only in the OpenVMS implementation of GNAT@.
4327 It allows control over the internal representation chosen for the predefined
4328 type @code{Long_Float} and for floating point type representations with
4329 @code{digits} specified in the range 7 through 15.
4330 For further details on this pragma, see the
4331 @cite{DEC Ada Language Reference Manual}, section 3.5.7b.  Note that to use
4332 this pragma, the standard runtime libraries must be recompiled.
4334 @node Pragma Loop_Invariant
4335 @unnumberedsec Pragma Loop_Invariant
4336 @findex Loop_Invariant
4337 @noindent
4338 Syntax:
4340 @smallexample @c ada
4341 pragma Loop_Invariant ( boolean_EXPRESSION );
4342 @end smallexample
4344 @noindent
4345 The effect of this pragma is similar to that of pragma @code{Assert},
4346 except that in an @code{Assertion_Policy} pragma, the identifier
4347 @code{Loop_Invariant} is used to control whether it is ignored or checked
4348 (or disabled).
4350 @code{Loop_Invariant} can only appear as one of the items in the sequence
4351 of statements of a loop body. The intention is that it be used to
4352 represent a "loop invariant" assertion, i.e. something that is true each
4353 time through the loop, and which can be used to show that the loop is
4354 achieving its purpose.
4356 To aid in writing such invariants, the special attribute @code{Loop_Entry}
4357 may be used to refer to the value of an expression on entry to the loop. This
4358 attribute can only be used within the expression of a @code{Loop_Invariant}
4359 pragma. For full details, see documentation of attribute @code{Loop_Entry}.
4361 @node Pragma Loop_Optimize
4362 @unnumberedsec Pragma Loop_Optimize
4363 @findex Loop_Optimize
4364 @noindent
4365 Syntax:
4367 @smallexample @c ada
4368 pragma Loop_Optimize (OPTIMIZATION_HINT @{, OPTIMIZATION_HINT@});
4370 OPTIMIZATION_HINT ::= No_Unroll | Unroll | No_Vector | Vector
4371 @end smallexample
4373 @noindent
4374 This pragma must appear immediately within a loop statement.  It allows the
4375 programmer to specify optimization hints for the enclosing loop.  The hints
4376 are not mutually exclusive and can be freely mixed, but not all combinations
4377 will yield a sensible outcome.
4379 There are four supported optimization hints for a loop:
4380 @itemize @bullet
4381 @item No_Unroll
4383 The loop must not be unrolled.  This is a strong hint: the compiler will not
4384 unroll a loop marked with this hint.
4386 @item Unroll
4388 The loop should be unrolled.  This is a weak hint: the compiler will try to
4389 apply unrolling to this loop preferably to other optimizations, notably
4390 vectorization, but there is no guarantee that the loop will be unrolled.
4392 @item No_Vector
4394 The loop must not be vectorized.  This is a strong hint: the compiler will not
4395 vectorize a loop marked with this hint.
4397 @item Vector
4399 The loop should be vectorized.  This is a weak hint: the compiler will try to
4400 apply vectorization to this loop preferably to other optimizations, notably
4401 unrolling, but there is no guarantee that the loop will be vectorized.
4403 @end itemize
4405 These hints do not void the need to pass the appropriate switches to the
4406 compiler in order to enable the relevant optimizations, that is to say
4407 @option{-funroll-loops} for unrolling and @option{-ftree-vectorize} for
4408 vectorization.
4410 @node Pragma Loop_Variant
4411 @unnumberedsec Pragma Loop_Variant
4412 @findex Loop_Variant
4413 @noindent
4414 Syntax:
4416 @smallexample @c ada
4417 pragma Loop_Variant ( LOOP_VARIANT_ITEM @{, LOOP_VARIANT_ITEM @} );
4418 LOOP_VARIANT_ITEM ::= CHANGE_DIRECTION => discrete_EXPRESSION
4419 CHANGE_DIRECTION ::= Increases | Decreases
4420 @end smallexample
4422 @noindent
4423 This pragma must appear immediately within the sequence of statements of a
4424 loop statement. It allows the specification of quantities which must always
4425 decrease or increase in successive iterations of the loop. In its simplest
4426 form, just one expression is specified, whose value must increase or decrease
4427 on each iteration of the loop.
4429 In a more complex form, multiple arguments can be given which are intepreted
4430 in a nesting lexicographic manner. For example:
4432 @smallexample @c ada
4433 pragma Loop_Variant (Increases => X, Decreases => Y);
4434 @end smallexample
4436 @noindent
4437 specifies that each time through the loop either X increases, or X stays
4438 the same and Y decreases. A @code{Loop_Variant} pragma ensures that the
4439 loop is making progress. It can be useful in helping to show informally
4440 or prove formally that the loop always terminates.
4442 @code{Loop_Variant} is an assertion whose effect can be controlled using
4443 an @code{Assertion_Policy} with a check name of @code{Loop_Variant}. The
4444 policy can be @code{Check} to enable the loop variant check, @code{Ignore}
4445 to ignore the check (in which case the pragma has no effect on the program),
4446 or @code{Disable} in which case the pragma is not even checked for correct
4447 syntax.
4449 The @code{Loop_Entry} attribute may be used within the expressions of the
4450 @code{Loop_Variant} pragma to refer to values on entry to the loop.
4452 @node Pragma Machine_Attribute
4453 @unnumberedsec Pragma Machine_Attribute
4454 @findex Machine_Attribute
4455 @noindent
4456 Syntax:
4458 @smallexample @c ada
4459 pragma Machine_Attribute (
4460      [Entity         =>] LOCAL_NAME,
4461      [Attribute_Name =>] static_string_EXPRESSION
4462   [, [Info           =>] static_EXPRESSION] );
4463 @end smallexample
4465 @noindent
4466 Machine-dependent attributes can be specified for types and/or
4467 declarations.  This pragma is semantically equivalent to
4468 @code{__attribute__((@var{attribute_name}))} (if @var{info} is not
4469 specified) or @code{__attribute__((@var{attribute_name}(@var{info})))}
4470 in GNU C, where @code{@var{attribute_name}} is recognized by the
4471 compiler middle-end or the @code{TARGET_ATTRIBUTE_TABLE} machine
4472 specific macro.  A string literal for the optional parameter @var{info}
4473 is transformed into an identifier, which may make this pragma unusable
4474 for some attributes.  @xref{Target Attributes,, Defining target-specific
4475 uses of @code{__attribute__}, gccint, GNU Compiler Collection (GCC)
4476 Internals}, further information.
4478 @node Pragma Main
4479 @unnumberedsec Pragma Main
4480 @cindex OpenVMS
4481 @findex Main
4482 @noindent
4483 Syntax:
4485 @smallexample @c ada
4486 pragma Main
4487  (MAIN_OPTION [, MAIN_OPTION]);
4489 MAIN_OPTION ::=
4490   [Stack_Size              =>] static_integer_EXPRESSION
4491 | [Task_Stack_Size_Default =>] static_integer_EXPRESSION
4492 | [Time_Slicing_Enabled    =>] static_boolean_EXPRESSION
4493 @end smallexample
4495 @noindent
4496 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4497 no effect in GNAT, other than being syntax checked.
4499 @node Pragma Main_Storage
4500 @unnumberedsec Pragma Main_Storage
4501 @cindex OpenVMS
4502 @findex Main_Storage
4503 @noindent
4504 Syntax:
4506 @smallexample @c ada
4507 pragma Main_Storage
4508   (MAIN_STORAGE_OPTION [, MAIN_STORAGE_OPTION]);
4510 MAIN_STORAGE_OPTION ::=
4511   [WORKING_STORAGE =>] static_SIMPLE_EXPRESSION
4512 | [TOP_GUARD       =>] static_SIMPLE_EXPRESSION
4513 @end smallexample
4515 @noindent
4516 This pragma is provided for compatibility with OpenVMS VAX Systems.  It has
4517 no effect in GNAT, other than being syntax checked.  Note that the pragma
4518 also has no effect in DEC Ada 83 for OpenVMS Alpha Systems.
4520 @node Pragma No_Body
4521 @unnumberedsec Pragma No_Body
4522 @findex No_Body
4523 @noindent
4524 Syntax:
4526 @smallexample @c ada
4527 pragma No_Body;
4528 @end smallexample
4530 @noindent
4531 There are a number of cases in which a package spec does not require a body,
4532 and in fact a body is not permitted. GNAT will not permit the spec to be
4533 compiled if there is a body around. The pragma No_Body allows you to provide
4534 a body file, even in a case where no body is allowed. The body file must
4535 contain only comments and a single No_Body pragma. This is recognized by
4536 the compiler as indicating that no body is logically present.
4538 This is particularly useful during maintenance when a package is modified in
4539 such a way that a body needed before is no longer needed. The provision of a
4540 dummy body with a No_Body pragma ensures that there is no interference from
4541 earlier versions of the package body.
4543 @node Pragma No_Inline
4544 @unnumberedsec Pragma No_Inline
4545 @findex No_Inline
4546 @noindent
4547 Syntax:
4549 @smallexample @c ada
4550 pragma No_Inline (NAME @{, NAME@});
4551 @end smallexample
4553 @noindent
4554 This pragma suppresses inlining for the callable entity or the instances of
4555 the generic subprogram designated by @var{NAME}, including inlining that
4556 results from the use of pragma @code{Inline}.  This pragma is always active,
4557 in particular it is not subject to the use of option @option{-gnatn} or
4558 @option{-gnatN}.  It is illegal to specify both pragma @code{No_Inline} and
4559 pragma @code{Inline_Always} for the same @var{NAME}.
4561 @node Pragma No_Return
4562 @unnumberedsec Pragma No_Return
4563 @findex No_Return
4564 @noindent
4565 Syntax:
4567 @smallexample @c ada
4568 pragma No_Return (procedure_LOCAL_NAME @{, procedure_LOCAL_NAME@});
4569 @end smallexample
4571 @noindent
4572 Each @var{procedure_LOCAL_NAME} argument must refer to one or more procedure
4573 declarations in the current declarative part.  A procedure to which this
4574 pragma is applied may not contain any explicit @code{return} statements.
4575 In addition, if the procedure contains any implicit returns from falling
4576 off the end of a statement sequence, then execution of that implicit
4577 return will cause Program_Error to be raised.
4579 One use of this pragma is to identify procedures whose only purpose is to raise
4580 an exception. Another use of this pragma is to suppress incorrect warnings
4581 about missing returns in functions, where the last statement of a function
4582 statement sequence is a call to such a procedure.
4584 Note that in Ada 2005 mode, this pragma is part of the language. It is
4585 available in all earlier versions of Ada as an implementation-defined
4586 pragma.
4588 @node Pragma No_Run_Time
4589 @unnumberedsec Pragma No_Run_Time
4590 @findex No_Run_Time
4591 @noindent
4592 Syntax:
4594 @smallexample @c ada
4595 pragma No_Run_Time;
4596 @end smallexample
4598 @noindent
4599 This is an obsolete configuration pragma that historically was used to
4600 setup what is now called the "zero footprint" library. It causes any
4601 library units outside this basic library to be ignored. The use of
4602 this pragma has been superseded by the general configurable run-time
4603 capability of @code{GNAT} where the compiler takes into account whatever
4604 units happen to be accessible in the library.
4606 @node Pragma No_Strict_Aliasing
4607 @unnumberedsec Pragma No_Strict_Aliasing
4608 @findex No_Strict_Aliasing
4609 @noindent
4610 Syntax:
4612 @smallexample @c ada
4613 pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
4614 @end smallexample
4616 @noindent
4617 @var{type_LOCAL_NAME} must refer to an access type
4618 declaration in the current declarative part.  The effect is to inhibit
4619 strict aliasing optimization for the given type.  The form with no
4620 arguments is a configuration pragma which applies to all access types
4621 declared in units to which the pragma applies. For a detailed
4622 description of the strict aliasing optimization, and the situations
4623 in which it must be suppressed, see @ref{Optimization and Strict
4624 Aliasing,,, gnat_ugn, @value{EDITION} User's Guide}.
4626 This pragma currently has no effects on access to unconstrained array types.
4628 @node Pragma Normalize_Scalars
4629 @unnumberedsec Pragma Normalize_Scalars
4630 @findex Normalize_Scalars
4631 @noindent
4632 Syntax:
4634 @smallexample @c ada
4635 pragma Normalize_Scalars;
4636 @end smallexample
4638 @noindent
4639 This is a language defined pragma which is fully implemented in GNAT@.  The
4640 effect is to cause all scalar objects that are not otherwise initialized
4641 to be initialized.  The initial values are implementation dependent and
4642 are as follows:
4644 @table @code
4645 @item Standard.Character
4646 @noindent
4647 Objects whose root type is Standard.Character are initialized to
4648 Character'Last unless the subtype range excludes NUL (in which case
4649 NUL is used). This choice will always generate an invalid value if
4650 one exists.
4652 @item Standard.Wide_Character
4653 @noindent
4654 Objects whose root type is Standard.Wide_Character are initialized to
4655 Wide_Character'Last unless the subtype range excludes NUL (in which case
4656 NUL is used). This choice will always generate an invalid value if
4657 one exists.
4659 @item Standard.Wide_Wide_Character
4660 @noindent
4661 Objects whose root type is Standard.Wide_Wide_Character are initialized to
4662 the invalid value 16#FFFF_FFFF# unless the subtype range excludes NUL (in
4663 which case NUL is used). This choice will always generate an invalid value if
4664 one exists.
4666 @item Integer types
4667 @noindent
4668 Objects of an integer type are treated differently depending on whether
4669 negative values are present in the subtype. If no negative values are
4670 present, then all one bits is used as the initial value except in the
4671 special case where zero is excluded from the subtype, in which case
4672 all zero bits are used. This choice will always generate an invalid
4673 value if one exists.
4675 For subtypes with negative values present, the largest negative number
4676 is used, except in the unusual case where this largest negative number
4677 is in the subtype, and the largest positive number is not, in which case
4678 the largest positive value is used. This choice will always generate
4679 an invalid value if one exists.
4681 @item Floating-Point Types
4682 Objects of all floating-point types are initialized to all 1-bits. For
4683 standard IEEE format, this corresponds to a NaN (not a number) which is
4684 indeed an invalid value.
4686 @item Fixed-Point Types
4687 Objects of all fixed-point types are treated as described above for integers,
4688 with the rules applying to the underlying integer value used to represent
4689 the fixed-point value.
4691 @item Modular types
4692 Objects of a modular type are initialized to all one bits, except in
4693 the special case where zero is excluded from the subtype, in which
4694 case all zero bits are used. This choice will always generate an
4695 invalid value if one exists.
4697 @item Enumeration types
4698 Objects of an enumeration type are initialized to all one-bits, i.e.@: to
4699 the value @code{2 ** typ'Size - 1} unless the subtype excludes the literal
4700 whose Pos value is zero, in which case a code of zero is used. This choice
4701 will always generate an invalid value if one exists.
4703 @end table
4705 @node Pragma Obsolescent
4706 @unnumberedsec Pragma Obsolescent
4707 @findex Obsolescent
4708 @noindent
4709 Syntax:
4711 @smallexample @c ada
4712 pragma Obsolescent;
4714 pragma Obsolescent (
4715   [Message =>] static_string_EXPRESSION
4716 [,[Version =>] Ada_05]]);
4718 pragma Obsolescent (
4719   [Entity  =>] NAME
4720 [,[Message =>] static_string_EXPRESSION
4721 [,[Version =>] Ada_05]] );
4722 @end smallexample
4724 @noindent
4725 This pragma can occur immediately following a declaration of an entity,
4726 including the case of a record component. If no Entity argument is present,
4727 then this declaration is the one to which the pragma applies. If an Entity
4728 parameter is present, it must either match the name of the entity in this
4729 declaration, or alternatively, the pragma can immediately follow an enumeration
4730 type declaration, where the Entity argument names one of the enumeration
4731 literals.
4733 This pragma is used to indicate that the named entity
4734 is considered obsolescent and should not be used. Typically this is
4735 used when an API must be modified by eventually removing or modifying
4736 existing subprograms or other entities. The pragma can be used at an
4737 intermediate stage when the entity is still present, but will be
4738 removed later.
4740 The effect of this pragma is to output a warning message on a reference to
4741 an entity thus marked that the subprogram is obsolescent if the appropriate
4742 warning option in the compiler is activated. If the Message parameter is
4743 present, then a second warning message is given containing this text. In
4744 addition, a reference to the entity is considered to be a violation of pragma
4745 Restrictions (No_Obsolescent_Features).
4747 This pragma can also be used as a program unit pragma for a package,
4748 in which case the entity name is the name of the package, and the
4749 pragma indicates that the entire package is considered
4750 obsolescent. In this case a client @code{with}'ing such a package
4751 violates the restriction, and the @code{with} statement is
4752 flagged with warnings if the warning option is set.
4754 If the Version parameter is present (which must be exactly
4755 the identifier Ada_05, no other argument is allowed), then the
4756 indication of obsolescence applies only when compiling in Ada 2005
4757 mode. This is primarily intended for dealing with the situations
4758 in the predefined library where subprograms or packages
4759 have become defined as obsolescent in Ada 2005
4760 (e.g.@: in Ada.Characters.Handling), but may be used anywhere.
4762 The following examples show typical uses of this pragma:
4764 @smallexample @c ada
4765 package p is
4766    pragma Obsolescent (p, Message => "use pp instead of p");
4767 end p;
4769 package q is
4770    procedure q2;
4771    pragma Obsolescent ("use q2new instead");
4773    type R is new integer;
4774    pragma Obsolescent
4775      (Entity  => R,
4776       Message => "use RR in Ada 2005",
4777       Version => Ada_05);
4779    type M is record
4780       F1 : Integer;
4781       F2 : Integer;
4782       pragma Obsolescent;
4783       F3 : Integer;
4784    end record;
4786    type E is (a, bc, 'd', quack);
4787    pragma Obsolescent (Entity => bc)
4788    pragma Obsolescent (Entity => 'd')
4790    function "+"
4791      (a, b : character) return character;
4792    pragma Obsolescent (Entity => "+");
4793 end;
4794 @end smallexample
4796 @noindent
4797 Note that, as for all pragmas, if you use a pragma argument identifier,
4798 then all subsequent parameters must also use a pragma argument identifier.
4799 So if you specify "Entity =>" for the Entity argument, and a Message
4800 argument is present, it must be preceded by "Message =>".
4802 @node Pragma Optimize_Alignment
4803 @unnumberedsec Pragma Optimize_Alignment
4804 @findex Optimize_Alignment
4805 @cindex Alignment, default settings
4806 @noindent
4807 Syntax:
4809 @smallexample @c ada
4810 pragma Optimize_Alignment (TIME | SPACE | OFF);
4811 @end smallexample
4813 @noindent
4814 This is a configuration pragma which affects the choice of default alignments
4815 for types where no alignment is explicitly specified. There is a time/space
4816 trade-off in the selection of these values. Large alignments result in more
4817 efficient code, at the expense of larger data space, since sizes have to be
4818 increased to match these alignments. Smaller alignments save space, but the
4819 access code is slower. The normal choice of default alignments (which is what
4820 you get if you do not use this pragma, or if you use an argument of OFF),
4821 tries to balance these two requirements.
4823 Specifying SPACE causes smaller default alignments to be chosen in two cases.
4824 First any packed record is given an alignment of 1. Second, if a size is given
4825 for the type, then the alignment is chosen to avoid increasing this size. For
4826 example, consider:
4828 @smallexample @c ada
4829    type R is record
4830       X : Integer;
4831       Y : Character;
4832    end record;
4834    for R'Size use 5*8;
4835 @end smallexample
4837 @noindent
4838 In the default mode, this type gets an alignment of 4, so that access to the
4839 Integer field X are efficient. But this means that objects of the type end up
4840 with a size of 8 bytes. This is a valid choice, since sizes of objects are
4841 allowed to be bigger than the size of the type, but it can waste space if for
4842 example fields of type R appear in an enclosing record. If the above type is
4843 compiled in @code{Optimize_Alignment (Space)} mode, the alignment is set to 1.
4845 However, there is one case in which SPACE is ignored. If a variable length
4846 record (that is a discriminated record with a component which is an array
4847 whose length depends on a discriminant), has a pragma Pack, then it is not
4848 in general possible to set the alignment of such a record to one, so the
4849 pragma is ignored in this case (with a warning).
4851 Specifying TIME causes larger default alignments to be chosen in the case of
4852 small types with sizes that are not a power of 2. For example, consider:
4854 @smallexample @c ada
4855    type R is record
4856       A : Character;
4857       B : Character;
4858       C : Boolean;
4859    end record;
4861    pragma Pack (R);
4862    for R'Size use 17;
4863 @end smallexample
4865 @noindent
4866 The default alignment for this record is normally 1, but if this type is
4867 compiled in @code{Optimize_Alignment (Time)} mode, then the alignment is set
4868 to 4, which wastes space for objects of the type, since they are now 4 bytes
4869 long, but results in more efficient access when the whole record is referenced.
4871 As noted above, this is a configuration pragma, and there is a requirement
4872 that all units in a partition be compiled with a consistent setting of the
4873 optimization setting. This would normally be achieved by use of a configuration
4874 pragma file containing the appropriate setting. The exception to this rule is
4875 that units with an explicit configuration pragma in the same file as the source
4876 unit are excluded from the consistency check, as are all predefined units. The
4877 latter are compiled by default in pragma Optimize_Alignment (Off) mode if no
4878 pragma appears at the start of the file.
4880 @node Pragma Ordered
4881 @unnumberedsec Pragma Ordered
4882 @findex Ordered
4883 @findex pragma @code{Ordered}
4884 @noindent
4885 Syntax:
4887 @smallexample @c ada
4888 pragma Ordered (enumeration_first_subtype_LOCAL_NAME);
4889 @end smallexample
4891 @noindent
4892 Most enumeration types are from a conceptual point of view unordered.
4893 For example, consider:
4895 @smallexample @c ada
4896 type Color is (Red, Blue, Green, Yellow);
4897 @end smallexample
4899 @noindent
4900 By Ada semantics @code{Blue > Red} and @code{Green > Blue},
4901 but really these relations make no sense; the enumeration type merely
4902 specifies a set of possible colors, and the order is unimportant.
4904 For unordered enumeration types, it is generally a good idea if
4905 clients avoid comparisons (other than equality or inequality) and
4906 explicit ranges. (A @emph{client} is a unit where the type is referenced,
4907 other than the unit where the type is declared, its body, and its subunits.)
4908 For example, if code buried in some client says:
4910 @smallexample @c ada
4911 if Current_Color < Yellow then ...
4912 if Current_Color in Blue .. Green then ...
4913 @end smallexample
4915 @noindent
4916 then the client code is relying on the order, which is undesirable.
4917 It makes the code hard to read and creates maintenance difficulties if
4918 entries have to be added to the enumeration type. Instead,
4919 the code in the client should list the possibilities, or an
4920 appropriate subtype should be declared in the unit that declares
4921 the original enumeration type. E.g., the following subtype could
4922 be declared along with the type @code{Color}:
4924 @smallexample @c ada
4925 subtype RBG is Color range Red .. Green;
4926 @end smallexample
4928 @noindent
4929 and then the client could write:
4931 @smallexample @c ada
4932 if Current_Color in RBG then ...
4933 if Current_Color = Blue or Current_Color = Green then ...
4934 @end smallexample
4936 @noindent
4937 However, some enumeration types are legitimately ordered from a conceptual
4938 point of view. For example, if you declare:
4940 @smallexample @c ada
4941 type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
4942 @end smallexample
4944 @noindent
4945 then the ordering imposed by the language is reasonable, and
4946 clients can depend on it, writing for example:
4948 @smallexample @c ada
4949 if D in Mon .. Fri then ...
4950 if D < Wed then ...
4951 @end smallexample
4953 @noindent
4954 The pragma @option{Ordered} is provided to mark enumeration types that
4955 are conceptually ordered, alerting the reader that clients may depend
4956 on the ordering. GNAT provides a pragma to mark enumerations as ordered
4957 rather than one to mark them as unordered, since in our experience,
4958 the great majority of enumeration types are conceptually unordered.
4960 The types @code{Boolean}, @code{Character}, @code{Wide_Character},
4961 and @code{Wide_Wide_Character}
4962 are considered to be ordered types, so each is declared with a
4963 pragma @code{Ordered} in package @code{Standard}.
4965 Normally pragma @code{Ordered} serves only as documentation and a guide for
4966 coding standards, but GNAT provides a warning switch @option{-gnatw.u} that
4967 requests warnings for inappropriate uses (comparisons and explicit
4968 subranges) for unordered types. If this switch is used, then any
4969 enumeration type not marked with pragma @code{Ordered} will be considered
4970 as unordered, and will generate warnings for inappropriate uses.
4972 For additional information please refer to the description of the
4973 @option{-gnatw.u} switch in the @value{EDITION} User's Guide.
4975 @node Pragma Overflow_Mode
4976 @unnumberedsec Pragma Overflow_Mode
4977 @findex Overflow checks
4978 @findex Overflow mode
4979 @findex pragma @code{Overflow_Mode}
4980 @noindent
4981 Syntax:
4983 @smallexample @c ada
4984 pragma Overflow_Mode
4985  (  [General    =>] MODE
4986   [,[Assertions =>] MODE]);
4988 MODE ::= STRICT | MINIMIZED | ELIMINATED
4989 @end smallexample
4991 @noindent
4992 This pragma sets the current overflow mode to the given setting. For details
4993 of the meaning of these modes, please refer to the
4994 ``Overflow Check Handling in GNAT'' appendix in the
4995 @value{EDITION} User's Guide. If only the @code{General} parameter is present,
4996 the given mode applies to all expressions. If both parameters are present,
4997 the @code{General} mode applies to expressions outside assertions, and
4998 the @code{Eliminated} mode applies to expressions within assertions.
5000 The case of the @code{MODE} parameter is ignored,
5001 so @code{MINIMIZED}, @code{Minimized} and
5002 @code{minimized} all have the same effect.
5004 The @code{Overflow_Mode} pragma has the same scoping and placement
5005 rules as pragma @code{Suppress}, so it can occur either as a
5006 configuration pragma, specifying a default for the whole
5007 program, or in a declarative scope, where it applies to the
5008 remaining declarations and statements in that scope.
5010 The pragma @code{Suppress (Overflow_Check)} suppresses
5011 overflow checking, but does not affect the overflow mode.
5013 The pragma @code{Unsuppress (Overflow_Check)} unsuppresses (enables)
5014 overflow checking, but does not affect the overflow mode.
5016 @node Pragma Overriding_Renamings
5017 @unnumberedsec Pragma Overriding_Renamings
5018 @findex Overriding_Renamings
5019 @cindex Rational profile
5020 @cindex Rational compatibility
5021 @noindent
5022 Syntax:
5024 @smallexample @c ada
5025 pragma Overriding_Renamings;
5026 @end smallexample
5028 @noindent
5029 This is a GNAT configuration pragma to simplify porting
5030 legacy code accepted by the Rational
5031 Ada compiler. In the presence of this pragma, a renaming declaration that
5032 renames an inherited operation declared in the same scope is legal if selected
5033 notation is used as in:
5035 @smallexample @c ada
5036 pragma Overriding_Renamings;
5038 package R is
5039   function F (..);
5040   ...
5041   function F (..) renames R.F;
5042 end R;
5043 @end smallexample
5045 even though
5046 RM 8.3 (15) stipulates that an overridden operation is not visible within the
5047 declaration of the overriding operation.
5049 @node Pragma Partition_Elaboration_Policy
5050 @unnumberedsec Pragma Partition_Elaboration_Policy
5051 @findex Partition_Elaboration_Policy
5052 @noindent
5053 Syntax:
5055 @smallexample @c ada
5056 pragma Partition_Elaboration_Policy (POLICY_IDENTIFIER);
5058 POLICY_IDENTIFIER ::= Concurrent | Sequential
5059 @end smallexample
5061 @noindent
5062 This pragma is standard in Ada 2005, but is available in all earlier
5063 versions of Ada as an implementation-defined pragma.
5064 See Ada 2012 Reference Manual for details.
5066 @node Pragma Passive
5067 @unnumberedsec Pragma Passive
5068 @findex Passive
5069 @noindent
5070 Syntax:
5072 @smallexample @c ada
5073 pragma Passive [(Semaphore | No)];
5074 @end smallexample
5076 @noindent
5077 Syntax checked, but otherwise ignored by GNAT@.  This is recognized for
5078 compatibility with DEC Ada 83 implementations, where it is used within a
5079 task definition to request that a task be made passive.  If the argument
5080 @code{Semaphore} is present, or the argument is omitted, then DEC Ada 83
5081 treats the pragma as an assertion that the containing task is passive
5082 and that optimization of context switch with this task is permitted and
5083 desired.  If the argument @code{No} is present, the task must not be
5084 optimized.  GNAT does not attempt to optimize any tasks in this manner
5085 (since protected objects are available in place of passive tasks).
5087 For more information on the subject of passive tasks, see the section
5088 ``Passive Task Optimization'' in the GNAT Users Guide.
5090 @node Pragma Persistent_BSS
5091 @unnumberedsec Pragma Persistent_BSS
5092 @findex Persistent_BSS
5093 @noindent
5094 Syntax:
5096 @smallexample @c ada
5097 pragma Persistent_BSS [(LOCAL_NAME)]
5098 @end smallexample
5100 @noindent
5101 This pragma allows selected objects to be placed in the @code{.persistent_bss}
5102 section. On some targets the linker and loader provide for special
5103 treatment of this section, allowing a program to be reloaded without
5104 affecting the contents of this data (hence the name persistent).
5106 There are two forms of usage. If an argument is given, it must be the
5107 local name of a library level object, with no explicit initialization
5108 and whose type is potentially persistent. If no argument is given, then
5109 the pragma is a configuration pragma, and applies to all library level
5110 objects with no explicit initialization of potentially persistent types.
5112 A potentially persistent type is a scalar type, or a non-tagged,
5113 non-discriminated record, all of whose components have no explicit
5114 initialization and are themselves of a potentially persistent type,
5115 or an array, all of whose constraints are static, and whose component
5116 type is potentially persistent.
5118 If this pragma is used on a target where this feature is not supported,
5119 then the pragma will be ignored. See also @code{pragma Linker_Section}.
5121 @node Pragma Polling
5122 @unnumberedsec Pragma Polling
5123 @findex Polling
5124 @noindent
5125 Syntax:
5127 @smallexample @c ada
5128 pragma Polling (ON | OFF);
5129 @end smallexample
5131 @noindent
5132 This pragma controls the generation of polling code.  This is normally off.
5133 If @code{pragma Polling (ON)} is used then periodic calls are generated to
5134 the routine @code{Ada.Exceptions.Poll}.  This routine is a separate unit in the
5135 runtime library, and can be found in file @file{a-excpol.adb}.
5137 Pragma @code{Polling} can appear as a configuration pragma (for example it
5138 can be placed in the @file{gnat.adc} file) to enable polling globally, or it
5139 can be used in the statement or declaration sequence to control polling
5140 more locally.
5142 A call to the polling routine is generated at the start of every loop and
5143 at the start of every subprogram call.  This guarantees that the @code{Poll}
5144 routine is called frequently, and places an upper bound (determined by
5145 the complexity of the code) on the period between two @code{Poll} calls.
5147 The primary purpose of the polling interface is to enable asynchronous
5148 aborts on targets that cannot otherwise support it (for example Windows
5149 NT), but it may be used for any other purpose requiring periodic polling.
5150 The standard version is null, and can be replaced by a user program.  This
5151 will require re-compilation of the @code{Ada.Exceptions} package that can
5152 be found in files @file{a-except.ads} and @file{a-except.adb}.
5154 A standard alternative unit (in file @file{4wexcpol.adb} in the standard GNAT
5155 distribution) is used to enable the asynchronous abort capability on
5156 targets that do not normally support the capability.  The version of
5157 @code{Poll} in this file makes a call to the appropriate runtime routine
5158 to test for an abort condition.
5160 Note that polling can also be enabled by use of the @option{-gnatP} switch.
5161 @xref{Switches for gcc,,, gnat_ugn, @value{EDITION} User's Guide}, for
5162 details.
5164 @node Pragma Post
5165 @unnumberedsec Pragma Post
5166 @cindex Post
5167 @cindex Checks, postconditions
5168 @findex Postconditions
5169 @noindent
5170 Syntax:
5172 @smallexample @c ada
5173 pragma Post (Boolean_Expression);
5174 @end smallexample
5176 @noindent
5177 The @code{Post} pragma is intended to be an exact replacement for
5178 the language-defined
5179 @code{Post} aspect, and shares its restrictions and semantics.
5180 It must appear either immediately following the corresponding
5181 subprogram declaration (only other pragmas may intervene), or
5182 if there is no separate subprogram declaration, then it can
5183 appear at the start of the declarations in a subprogram body
5184 (preceded only by other pragmas).
5186 @node Pragma Postcondition
5187 @unnumberedsec Pragma Postcondition
5188 @cindex Postcondition
5189 @cindex Checks, postconditions
5190 @findex Postconditions
5191 @noindent
5192 Syntax:
5194 @smallexample @c ada
5195 pragma Postcondition (
5196    [Check   =>] Boolean_Expression
5197  [,[Message =>] String_Expression]);
5198 @end smallexample
5200 @noindent
5201 The @code{Postcondition} pragma allows specification of automatic
5202 postcondition checks for subprograms. These checks are similar to
5203 assertions, but are automatically inserted just prior to the return
5204 statements of the subprogram with which they are associated (including
5205 implicit returns at the end of procedure bodies and associated
5206 exception handlers).
5208 In addition, the boolean expression which is the condition which
5209 must be true may contain references to function'Result in the case
5210 of a function to refer to the returned value.
5212 @code{Postcondition} pragmas may appear either immediately following the
5213 (separate) declaration of a subprogram, or at the start of the
5214 declarations of a subprogram body. Only other pragmas may intervene
5215 (that is appear between the subprogram declaration and its
5216 postconditions, or appear before the postcondition in the
5217 declaration sequence in a subprogram body). In the case of a
5218 postcondition appearing after a subprogram declaration, the
5219 formal arguments of the subprogram are visible, and can be
5220 referenced in the postcondition expressions.
5222 The postconditions are collected and automatically tested just
5223 before any return (implicit or explicit) in the subprogram body.
5224 A postcondition is only recognized if postconditions are active
5225 at the time the pragma is encountered. The compiler switch @option{gnata}
5226 turns on all postconditions by default, and pragma @code{Check_Policy}
5227 with an identifier of @code{Postcondition} can also be used to
5228 control whether postconditions are active.
5230 The general approach is that postconditions are placed in the spec
5231 if they represent functional aspects which make sense to the client.
5232 For example we might have:
5234 @smallexample @c ada
5235    function Direction return Integer;
5236    pragma Postcondition
5237     (Direction'Result = +1
5238        or else
5239      Direction'Result = -1);
5240 @end smallexample
5242 @noindent
5243 which serves to document that the result must be +1 or -1, and
5244 will test that this is the case at run time if postcondition
5245 checking is active.
5247 Postconditions within the subprogram body can be used to
5248 check that some internal aspect of the implementation,
5249 not visible to the client, is operating as expected.
5250 For instance if a square root routine keeps an internal
5251 counter of the number of times it is called, then we
5252 might have the following postcondition:
5254 @smallexample @c ada
5255    Sqrt_Calls : Natural := 0;
5257    function Sqrt (Arg : Float) return Float is
5258      pragma Postcondition
5259        (Sqrt_Calls = Sqrt_Calls'Old + 1);
5260      ...
5261    end Sqrt
5262 @end smallexample
5264 @noindent
5265 As this example, shows, the use of the @code{Old} attribute
5266 is often useful in postconditions to refer to the state on
5267 entry to the subprogram.
5269 Note that postconditions are only checked on normal returns
5270 from the subprogram. If an abnormal return results from
5271 raising an exception, then the postconditions are not checked.
5273 If a postcondition fails, then the exception
5274 @code{System.Assertions.Assert_Failure} is raised. If
5275 a message argument was supplied, then the given string
5276 will be used as the exception message. If no message
5277 argument was supplied, then the default message has
5278 the form "Postcondition failed at file:line". The
5279 exception is raised in the context of the subprogram
5280 body, so it is possible to catch postcondition failures
5281 within the subprogram body itself.
5283 Within a package spec, normal visibility rules
5284 in Ada would prevent forward references within a
5285 postcondition pragma to functions defined later in
5286 the same package. This would introduce undesirable
5287 ordering constraints. To avoid this problem, all
5288 postcondition pragmas are analyzed at the end of
5289 the package spec, allowing forward references.
5291 The following example shows that this even allows
5292 mutually recursive postconditions as in:
5294 @smallexample @c ada
5295 package Parity_Functions is
5296    function Odd  (X : Natural) return Boolean;
5297    pragma Postcondition
5298      (Odd'Result =
5299         (x = 1
5300           or else
5301         (x /= 0 and then Even (X - 1))));
5303    function Even (X : Natural) return Boolean;
5304    pragma Postcondition
5305      (Even'Result =
5306         (x = 0
5307           or else
5308         (x /= 1 and then Odd (X - 1))));
5310 end Parity_Functions;
5311 @end smallexample
5313 @noindent
5314 There are no restrictions on the complexity or form of
5315 conditions used within @code{Postcondition} pragmas.
5316 The following example shows that it is even possible
5317 to verify performance behavior.
5319 @smallexample @c ada
5320 package Sort is
5322    Performance : constant Float;
5323    --  Performance constant set by implementation
5324    --  to match target architecture behavior.
5326    procedure Treesort (Arg : String);
5327    --  Sorts characters of argument using N*logN sort
5328    pragma Postcondition
5329      (Float (Clock - Clock'Old) <=
5330         Float (Arg'Length) *
5331         log (Float (Arg'Length)) *
5332         Performance);
5333 end Sort;
5334 @end smallexample
5336 @noindent
5337 Note: postcondition pragmas associated with subprograms that are
5338 marked as Inline_Always, or those marked as Inline with front-end
5339 inlining (-gnatN option set) are accepted and legality-checked
5340 by the compiler, but are ignored at run-time even if postcondition
5341 checking is enabled.
5343 Note that pragma @code{Postcondition} differs from the language-defined
5344 @code{Post} aspect (and corresponding @code{Post} pragma) in allowing
5345 multiple occurrences, allowing occurences in the body even if there
5346 is a separate spec, and allowing a second string parameter, and the
5347 use of the pragma identifier @code{Check}. Historically, pragma
5348 @code{Postcondition} was implemented prior to the development of
5349 Ada 2012, and has been retained in its original form for
5350 compatibility purposes.
5352 @node Pragma Post_Class
5353 @unnumberedsec Pragma Post_Class
5354 @cindex Post
5355 @cindex Checks, postconditions
5356 @findex Postconditions
5357 @noindent
5358 Syntax:
5360 @smallexample @c ada
5361 pragma Post_Class (Boolean_Expression);
5362 @end smallexample
5364 @noindent
5365 The @code{Post_Class} pragma is intended to be an exact replacement for
5366 the language-defined
5367 @code{Post'Class} aspect, and shares its restrictions and semantics.
5368 It must appear either immediately following the corresponding
5369 subprogram declaration (only other pragmas may intervene), or
5370 if there is no separate subprogram declaration, then it can
5371 appear at the start of the declarations in a subprogram body
5372 (preceded only by other pragmas).
5374 Note: This pragma is called @code{Post_Class} rather than
5375 @code{Post'Class} because the latter would not be strictly
5376 conforming to the allowed syntax for pragmas. The motivation
5377 for provinding pragmas equivalent to the aspects is to allow a program
5378 to be written using the pragmas, and then compiled if necessary
5379 using an Ada compiler that does not recognize the pragmas or
5380 aspects, but is prepared to ignore the pragmas. The assertion
5381 policy that controls this pragma is @code{Post'Class}, not
5382 @code{Post_Class}.
5384 @node Pragma Pre
5385 @unnumberedsec Pragma Pre
5386 @cindex Pre
5387 @cindex Checks, preconditions
5388 @findex Preconditions
5389 @noindent
5390 Syntax:
5392 @smallexample @c ada
5393 pragma Pre (Boolean_Expression);
5394 @end smallexample
5396 @noindent
5397 The @code{Pre} pragma is intended to be an exact replacement for
5398 the language-defined
5399 @code{Pre} aspect, and shares its restrictions and semantics.
5400 It must appear either immediately following the corresponding
5401 subprogram declaration (only other pragmas may intervene), or
5402 if there is no separate subprogram declaration, then it can
5403 appear at the start of the declarations in a subprogram body
5404 (preceded only by other pragmas).
5406 @node Pragma Precondition
5407 @unnumberedsec Pragma Precondition
5408 @cindex Preconditions
5409 @cindex Checks, preconditions
5410 @findex Preconditions
5411 @noindent
5412 Syntax:
5414 @smallexample @c ada
5415 pragma Precondition (
5416    [Check   =>] Boolean_Expression
5417  [,[Message =>] String_Expression]);
5418 @end smallexample
5420 @noindent
5421 The @code{Precondition} pragma is similar to @code{Postcondition}
5422 except that the corresponding checks take place immediately upon
5423 entry to the subprogram, and if a precondition fails, the exception
5424 is raised in the context of the caller, and the attribute 'Result
5425 cannot be used within the precondition expression.
5427 Otherwise, the placement and visibility rules are identical to those
5428 described for postconditions. The following is an example of use
5429 within a package spec:
5431 @smallexample @c ada
5432 package Math_Functions is
5433    ...
5434    function Sqrt (Arg : Float) return Float;
5435    pragma Precondition (Arg >= 0.0)
5436    ...
5437 end Math_Functions;
5438 @end smallexample
5440 @noindent
5441 @code{Precondition} pragmas may appear either immediately following the
5442 (separate) declaration of a subprogram, or at the start of the
5443 declarations of a subprogram body. Only other pragmas may intervene
5444 (that is appear between the subprogram declaration and its
5445 postconditions, or appear before the postcondition in the
5446 declaration sequence in a subprogram body).
5448 Note: precondition pragmas associated with subprograms that are
5449 marked as Inline_Always, or those marked as Inline with front-end
5450 inlining (-gnatN option set) are accepted and legality-checked
5451 by the compiler, but are ignored at run-time even if precondition
5452 checking is enabled.
5454 Note that pragma @code{Precondition} differs from the language-defined
5455 @code{Pre} aspect (and corresponding @code{Pre} pragma) in allowing
5456 multiple occurrences, allowing occurences in the body even if there
5457 is a separate spec, and allowing a second string parameter, and the
5458 use of the pragma identifier @code{Check}. Historically, pragma
5459 @code{Precondition} was implemented prior to the development of
5460 Ada 2012, and has been retained in its original form for
5461 compatibility purposes.
5463 @node Pragma Predicate
5464 @unnumberedsec Pragma Predicate
5465 @findex Predicate
5466 @findex Predicate pragma
5467 @noindent
5468 Syntax:
5470 @smallexample @c ada
5471 pragma Predicate
5472   ([Entity =>] type_LOCAL_NAME,
5473    [Check  =>] EXPRESSION);
5474 @end smallexample
5476 @noindent
5477 This pragma (available in all versions of Ada in GNAT) encompasses both
5478 the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
5479 Ada 2012. A predicate is regarded as static if it has an allowed form
5480 for @code{Static_Predicate} and is otherwise treated as a
5481 @code{Dynamic_Predicate}. Otherwise, predicates specified by this
5482 pragma behave exactly as described in the Ada 2012 reference manual.
5483 For example, if we have
5485 @smallexample @c ada
5486 type R is range 1 .. 10;
5487 subtype S is R;
5488 pragma Predicate (Entity => S, Check => S not in 4 .. 6);
5489 subtype Q is R
5490 pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
5491 @end smallexample
5493 @noindent
5494 the effect is identical to the following Ada 2012 code:
5496 @smallexample @c ada
5497 type R is range 1 .. 10;
5498 subtype S is R with
5499   Static_Predicate => S not in 4 .. 6;
5500 subtype Q is R with
5501   Dynamic_Predicate => F(Q) or G(Q);
5502 @end smallexample
5504 Note that there is are no pragmas @code{Dynamic_Predicate}
5505 or @code{Static_Predicate}. That is
5506 because these pragmas would affect legality and semantics of
5507 the program and thus do not have a neutral effect if ignored.
5508 The motivation behind providing pragmas equivalent to
5509 corresponding aspects is to allow a program to be written
5510 using the pragmas, and then compiled with a compiler that
5511 will ignore the pragmas. That doesn't work in the case of
5512 static and dynamic predicates, since if the corresponding
5513 pragmas are ignored, then the behavior of the program is
5514 fundamentally changed (for example a membership test
5515 @code{A in B} would not take into account a predicate
5516 defined for subtype B). When following this approach, the
5517 use of predicates should be avoided.
5519 @node Pragma Preelaborable_Initialization
5520 @unnumberedsec Pragma Preelaborable_Initialization
5521 @findex Preelaborable_Initialization
5522 @noindent
5523 Syntax:
5525 @smallexample @c ada
5526 pragma Preelaborable_Initialization (DIRECT_NAME);
5527 @end smallexample
5529 @noindent
5530 This pragma is standard in Ada 2005, but is available in all earlier
5531 versions of Ada as an implementation-defined pragma.
5532 See Ada 2012 Reference Manual for details.
5534 @node Pragma Preelaborate_05
5535 @unnumberedsec Pragma Preelaborate_05
5536 @findex Preelaborate_05
5537 @noindent
5538 Syntax:
5540 @smallexample @c ada
5541 pragma Preelaborate_05 [(library_unit_NAME)];
5542 @end smallexample
5544 @noindent
5545 This pragma is only available in GNAT mode (@option{-gnatg} switch set)
5546 and is intended for use in the standard run-time library only. It has
5547 no effect in Ada 83 or Ada 95 mode, but is
5548 equivalent to @code{pragma Prelaborate} when operating in later
5549 Ada versions. This is used to handle some cases where packages
5550 not previously preelaborable became so in Ada 2005.
5552 @node Pragma Pre_Class
5553 @unnumberedsec Pragma Pre_Class
5554 @cindex Pre_Class
5555 @cindex Checks, preconditions
5556 @findex Preconditions
5557 @noindent
5558 Syntax:
5560 @smallexample @c ada
5561 pragma Pre_Class (Boolean_Expression);
5562 @end smallexample
5564 @noindent
5565 The @code{Pre_Class} pragma is intended to be an exact replacement for
5566 the language-defined
5567 @code{Pre'Class} aspect, and shares its restrictions and semantics.
5568 It must appear either immediately following the corresponding
5569 subprogram declaration (only other pragmas may intervene), or
5570 if there is no separate subprogram declaration, then it can
5571 appear at the start of the declarations in a subprogram body
5572 (preceded only by other pragmas).
5574 Note: This pragma is called @code{Pre_Class} rather than
5575 @code{Pre'Class} because the latter would not be strictly
5576 conforming to the allowed syntax for pragmas. The motivation
5577 for providing pragmas equivalent to the aspects is to allow a program
5578 to be written using the pragmas, and then compiled if necessary
5579 using an Ada compiler that does not recognize the pragmas or
5580 aspects, but is prepared to ignore the pragmas. The assertion
5581 policy that controls this pragma is @code{Pre'Class}, not
5582 @code{Pre_Class}.
5584 @node Pragma Priority_Specific_Dispatching
5585 @unnumberedsec Pragma Priority_Specific_Dispatching
5586 @findex Priority_Specific_Dispatching
5587 @noindent
5588 Syntax:
5590 @smallexample @c ada
5591 pragma Priority_Specific_Dispatching (
5592    POLICY_IDENTIFIER,
5593    first_priority_EXPRESSION,
5594    last_priority_EXPRESSION)
5596 POLICY_IDENTIFIER ::=
5597    EDF_Across_Priorities            |
5598    FIFO_Within_Priorities           |
5599    Non_Preemptive_Within_Priorities |
5600    Round_Robin_Within_Priorities
5601 @end smallexample
5603 @noindent
5604 This pragma is standard in Ada 2005, but is available in all earlier
5605 versions of Ada as an implementation-defined pragma.
5606 See Ada 2012 Reference Manual for details.
5608 @node Pragma Profile
5609 @unnumberedsec Pragma Profile
5610 @findex Profile
5611 @noindent
5612 Syntax:
5614 @smallexample @c ada
5615 pragma Profile (Ravenscar | Restricted | Rational);
5616 @end smallexample
5618 @noindent
5619 This pragma is standard in Ada 2005, but is available in all earlier
5620 versions of Ada as an implementation-defined pragma. This is a
5621 configuration pragma that establishes a set of configiuration pragmas
5622 that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
5623 The other two possibilities (@code{Restricted} or @code{Rational})
5624 are implementation-defined. The set of configuration pragmas
5625 is defined in the following sections.
5627 @itemize
5629 @item Pragma Profile (Ravenscar)
5630 @findex Ravenscar
5631 @noindent
5633 The @code{Ravenscar} profile is standard in Ada 2005,
5634 but is available in all earlier
5635 versions of Ada as an implementation-defined pragma. This profile
5636 establishes the following set of configuration pragmas:
5638 @table @code
5639 @item Task_Dispatching_Policy (FIFO_Within_Priorities)
5640 [RM D.2.2] Tasks are dispatched following a preemptive
5641 priority-ordered scheduling policy.
5643 @item Locking_Policy (Ceiling_Locking)
5644 [RM D.3] While tasks and interrupts execute a protected action, they inherit
5645 the ceiling priority of the corresponding protected object.
5647 @item Detect_Blocking
5648 This pragma forces the detection of potentially blocking operations within a
5649 protected operation, and to raise Program_Error if that happens.
5650 @end table
5651 @noindent
5653 plus the following set of restrictions:
5655 @table @code
5656 @item Max_Entry_Queue_Length => 1
5657 No task can be queued on a protected entry.
5658 @item Max_Protected_Entries => 1
5659 @item Max_Task_Entries => 0
5660 No rendezvous statements are allowed.
5661 @item No_Abort_Statements
5662 @item No_Dynamic_Attachment
5663 @item No_Dynamic_Priorities
5664 @item No_Implicit_Heap_Allocations
5665 @item No_Local_Protected_Objects
5666 @item No_Local_Timing_Events
5667 @item No_Protected_Type_Allocators
5668 @item No_Relative_Delay
5669 @item No_Requeue_Statements
5670 @item No_Select_Statements
5671 @item No_Specific_Termination_Handlers
5672 @item No_Task_Allocators
5673 @item No_Task_Hierarchy
5674 @item No_Task_Termination
5675 @item Simple_Barriers
5676 @end table
5677 @noindent
5679 The Ravenscar profile also includes the following restrictions that specify
5680 that there are no semantic dependences on the corresponding predefined
5681 packages:
5683 @table @code
5684 @item No_Dependence => Ada.Asynchronous_Task_Control
5685 @item No_Dependence => Ada.Calendar
5686 @item No_Dependence => Ada.Execution_Time.Group_Budget
5687 @item No_Dependence => Ada.Execution_Time.Timers
5688 @item No_Dependence => Ada.Task_Attributes
5689 @item No_Dependence => System.Multiprocessors.Dispatching_Domains
5690 @end table
5692 @noindent
5694 This set of configuration pragmas and restrictions correspond to the
5695 definition of the ``Ravenscar Profile'' for limited tasking, devised and
5696 published by the @cite{International Real-Time Ada Workshop}, 1997,
5697 and whose most recent description is available at
5698 @url{http://www-users.cs.york.ac.uk/~burns/ravenscar.ps}.
5700 The original definition of the profile was revised at subsequent IRTAW
5701 meetings. It has been included in the ISO
5702 @cite{Guide for the Use of the Ada Programming Language in High
5703 Integrity Systems}, and has been approved by ISO/IEC/SC22/WG9 for inclusion in
5704 the next revision of the standard. The formal definition given by
5705 the Ada Rapporteur Group (ARG) can be found in two Ada Issues (AI-249 and
5706 AI-305) available at
5707 @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00249.txt} and
5708 @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ais/ai-00305.txt}.
5710 The above set is a superset of the restrictions provided by pragma
5711 @code{Profile (Restricted)}, it includes six additional restrictions
5712 (@code{Simple_Barriers}, @code{No_Select_Statements},
5713 @code{No_Calendar}, @code{No_Implicit_Heap_Allocations},
5714 @code{No_Relative_Delay} and @code{No_Task_Termination}).  This means
5715 that pragma @code{Profile (Ravenscar)}, like the pragma
5716 @code{Profile (Restricted)},
5717 automatically causes the use of a simplified,
5718 more efficient version of the tasking run-time system.
5720 @item Pragma Profile (Restricted)
5721 @findex Restricted Run Time
5722 @noindent
5723 This profile corresponds to the GNAT restricted run time. It
5724 establishes the following set of restrictions:
5726 @itemize @bullet
5727 @item No_Abort_Statements
5728 @item No_Entry_Queue
5729 @item No_Task_Hierarchy
5730 @item No_Task_Allocators
5731 @item No_Dynamic_Priorities
5732 @item No_Terminate_Alternatives
5733 @item No_Dynamic_Attachment
5734 @item No_Protected_Type_Allocators
5735 @item No_Local_Protected_Objects
5736 @item No_Requeue_Statements
5737 @item No_Task_Attributes_Package
5738 @item Max_Asynchronous_Select_Nesting =  0
5739 @item Max_Task_Entries =  0
5740 @item Max_Protected_Entries = 1
5741 @item Max_Select_Alternatives = 0
5742 @end itemize
5744 @noindent
5745 This set of restrictions causes the automatic selection of a simplified
5746 version of the run time that provides improved performance for the
5747 limited set of tasking functionality permitted by this set of restrictions.
5749 @item Pragma Profile (Rational)
5750 @findex Rational compatibility mode
5751 @noindent
5752 The Rational profile is intended to facilitate porting legacy code that
5753 compiles with the Rational APEX compiler, even when the code includes non-
5754 conforming Ada constructs.  The profile enables the following three pragmas:
5756 @itemize @bullet
5757 @item pragma Implicit_Packing
5758 @item pragma Overriding_Renamings
5759 @item pragma Use_VADS_Size
5760 @end itemize
5762 @end itemize
5764 @node Pragma Profile_Warnings
5765 @unnumberedsec Pragma Profile_Warnings
5766 @findex Profile_Warnings
5767 @noindent
5768 Syntax:
5770 @smallexample @c ada
5771 pragma Profile_Warnings (Ravenscar | Restricted | Rational);
5772 @end smallexample
5774 @noindent
5775 This is an implementation-defined pragma that is similar in
5776 effect to @code{pragma Profile} except that instead of
5777 generating @code{Restrictions} pragmas, it generates
5778 @code{Restriction_Warnings} pragmas. The result is that
5779 violations of the profile generate warning messages instead
5780 of error messages.
5782 @node Pragma Propagate_Exceptions
5783 @unnumberedsec Pragma Propagate_Exceptions
5784 @cindex Interfacing to C++
5785 @findex Propagate_Exceptions
5786 @noindent
5787 Syntax:
5789 @smallexample @c ada
5790 pragma Propagate_Exceptions;
5791 @end smallexample
5793 @noindent
5794 This pragma is now obsolete and, other than generating a warning if warnings
5795 on obsolescent features are enabled, is ignored.
5796 It is retained for compatibility
5797 purposes. It used to be used in connection with optimization of
5798 a now-obsolete mechanism for implementation of exceptions.
5800 @node Pragma Psect_Object
5801 @unnumberedsec Pragma Psect_Object
5802 @findex Psect_Object
5803 @noindent
5804 Syntax:
5806 @smallexample @c ada
5807 pragma Psect_Object (
5808      [Internal =>] LOCAL_NAME,
5809   [, [External =>] EXTERNAL_SYMBOL]
5810   [, [Size     =>] EXTERNAL_SYMBOL]);
5812 EXTERNAL_SYMBOL ::=
5813   IDENTIFIER
5814 | static_string_EXPRESSION
5815 @end smallexample
5817 @noindent
5818 This pragma is identical in effect to pragma @code{Common_Object}.
5820 @node Pragma Pure_05
5821 @unnumberedsec Pragma Pure_05
5822 @findex Pure_05
5823 @noindent
5824 Syntax:
5826 @smallexample @c ada
5827 pragma Pure_05 [(library_unit_NAME)];
5828 @end smallexample
5830 @noindent
5831 This pragma is only available in GNAT mode (@option{-gnatg} switch set)
5832 and is intended for use in the standard run-time library only. It has
5833 no effect in Ada 83 or Ada 95 mode, but is
5834 equivalent to @code{pragma Pure} when operating in later
5835 Ada versions. This is used to handle some cases where packages
5836 not previously pure became so in Ada 2005.
5838 @node Pragma Pure_12
5839 @unnumberedsec Pragma Pure_12
5840 @findex Pure_12
5841 @noindent
5842 Syntax:
5844 @smallexample @c ada
5845 pragma Pure_12 [(library_unit_NAME)];
5846 @end smallexample
5848 @noindent
5849 This pragma is only available in GNAT mode (@option{-gnatg} switch set)
5850 and is intended for use in the standard run-time library only. It has
5851 no effect in Ada 83, Ada 95, or Ada 2005 modes, but is
5852 equivalent to @code{pragma Pure} when operating in later
5853 Ada versions. This is used to handle some cases where packages
5854 not previously pure became so in Ada 2012.
5856 @node Pragma Pure_Function
5857 @unnumberedsec Pragma Pure_Function
5858 @findex Pure_Function
5859 @noindent
5860 Syntax:
5862 @smallexample @c ada
5863 pragma Pure_Function ([Entity =>] function_LOCAL_NAME);
5864 @end smallexample
5866 @noindent
5867 This pragma appears in the same declarative part as a function
5868 declaration (or a set of function declarations if more than one
5869 overloaded declaration exists, in which case the pragma applies
5870 to all entities).  It specifies that the function @code{Entity} is
5871 to be considered pure for the purposes of code generation.  This means
5872 that the compiler can assume that there are no side effects, and
5873 in particular that two calls with identical arguments produce the
5874 same result.  It also means that the function can be used in an
5875 address clause.
5877 Note that, quite deliberately, there are no static checks to try
5878 to ensure that this promise is met, so @code{Pure_Function} can be used
5879 with functions that are conceptually pure, even if they do modify
5880 global variables.  For example, a square root function that is
5881 instrumented to count the number of times it is called is still
5882 conceptually pure, and can still be optimized, even though it
5883 modifies a global variable (the count).  Memo functions are another
5884 example (where a table of previous calls is kept and consulted to
5885 avoid re-computation).
5887 Note also that the normal rules excluding optimization of subprograms
5888 in pure units (when parameter types are descended from System.Address,
5889 or when the full view of a parameter type is limited), do not apply
5890 for the Pure_Function case. If you explicitly specify Pure_Function,
5891 the compiler may optimize away calls with identical arguments, and
5892 if that results in unexpected behavior, the proper action is not to
5893 use the pragma for subprograms that are not (conceptually) pure.
5895 @findex Pure
5896 Note: Most functions in a @code{Pure} package are automatically pure, and
5897 there is no need to use pragma @code{Pure_Function} for such functions.  One
5898 exception is any function that has at least one formal of type
5899 @code{System.Address} or a type derived from it.  Such functions are not
5900 considered pure by default, since the compiler assumes that the
5901 @code{Address} parameter may be functioning as a pointer and that the
5902 referenced data may change even if the address value does not.
5903 Similarly, imported functions are not considered to be pure by default,
5904 since there is no way of checking that they are in fact pure.  The use
5905 of pragma @code{Pure_Function} for such a function will override these default
5906 assumption, and cause the compiler to treat a designated subprogram as pure
5907 in these cases.
5909 Note: If pragma @code{Pure_Function} is applied to a renamed function, it
5910 applies to the underlying renamed function.  This can be used to
5911 disambiguate cases of overloading where some but not all functions
5912 in a set of overloaded functions are to be designated as pure.
5914 If pragma @code{Pure_Function} is applied to a library level function, the
5915 function is also considered pure from an optimization point of view, but the
5916 unit is not a Pure unit in the categorization sense. So for example, a function
5917 thus marked is free to @code{with} non-pure units.
5919 @node Pragma Ravenscar
5920 @unnumberedsec Pragma Ravenscar
5921 @findex Pragma Ravenscar
5922 @noindent
5923 Syntax:
5925 @smallexample @c ada
5926 pragma Ravenscar;
5927 @end smallexample
5929 @noindent
5930 This pragma is considered obsolescent, but is retained for
5931 compatibility purposes. It is equivalent to:
5933 @smallexample @c ada
5934 pragma Profile (Ravenscar);
5935 @end smallexample
5937 @noindent
5938 which is the preferred method of setting the @code{Ravenscar} profile.
5940 @node Pragma Refined_State
5941 @unnumberedsec Pragma Refined_State
5942 @findex Refined_State
5943 @noindent
5944 For the description of this pragma, see SPARK 2014 Reference Manual,
5945 section 7.2.2.
5947 @node Pragma Relative_Deadline
5948 @unnumberedsec Pragma Relative_Deadline
5949 @findex Relative_Deadline
5950 @noindent
5951 Syntax:
5953 @smallexample @c ada
5954 pragma Relative_Deadline (time_span_EXPRESSION);
5955 @end smallexample
5957 @noindent
5958 This pragma is standard in Ada 2005, but is available in all earlier
5959 versions of Ada as an implementation-defined pragma.
5960 See Ada 2012 Reference Manual for details.
5962 @node Pragma Remote_Access_Type
5963 @unnumberedsec Pragma Remote_Access_Type
5964 @findex Remote_Access_Type
5965 @noindent
5966 Syntax:
5968 @smallexample @c ada
5969 pragma Remote_Access_Type ([Entity =>] formal_access_type_LOCAL_NAME);
5970 @end smallexample
5972 @noindent
5973 This pragma appears in the formal part of a generic declaration.
5974 It specifies an exception to the RM rule from E.2.2(17/2), which forbids
5975 the use of a remote access to class-wide type as actual for a formal
5976 access type.
5978 When this pragma applies to a formal access type @code{Entity}, that
5979 type is treated as a remote access to class-wide type in the generic.
5980 It must be a formal general access type, and its designated type must
5981 be the class-wide type of a formal tagged limited private type from the
5982 same generic declaration.
5984 In the generic unit, the formal type is subject to all restrictions
5985 pertaining to remote access to class-wide types. At instantiation, the
5986 actual type must be a remote access to class-wide type.
5988 @node Pragma Restricted_Run_Time
5989 @unnumberedsec Pragma Restricted_Run_Time
5990 @findex Pragma Restricted_Run_Time
5991 @noindent
5992 Syntax:
5994 @smallexample @c ada
5995 pragma Restricted_Run_Time;
5996 @end smallexample
5998 @noindent
5999 This pragma is considered obsolescent, but is retained for
6000 compatibility purposes. It is equivalent to:
6002 @smallexample @c ada
6003 pragma Profile (Restricted);
6004 @end smallexample
6006 @noindent
6007 which is the preferred method of setting the restricted run time
6008 profile.
6010 @node Pragma Restriction_Warnings
6011 @unnumberedsec Pragma Restriction_Warnings
6012 @findex Restriction_Warnings
6013 @noindent
6014 Syntax:
6016 @smallexample @c ada
6017 pragma Restriction_Warnings
6018   (restriction_IDENTIFIER @{, restriction_IDENTIFIER@});
6019 @end smallexample
6021 @noindent
6022 This pragma allows a series of restriction identifiers to be
6023 specified (the list of allowed identifiers is the same as for
6024 pragma @code{Restrictions}). For each of these identifiers
6025 the compiler checks for violations of the restriction, but
6026 generates a warning message rather than an error message
6027 if the restriction is violated.
6029 @node Pragma Share_Generic
6030 @unnumberedsec Pragma Share_Generic
6031 @findex Share_Generic
6032 @noindent
6033 Syntax:
6035 @smallexample @c ada
6036 pragma Share_Generic (GNAME @{, GNAME@});
6038 GNAME ::= generic_unit_NAME | generic_instance_NAME
6039 @end smallexample
6041 @noindent
6042 This pragma is provided for compatibility with Dec Ada 83. It has
6043 no effect in @code{GNAT} (which does not implement shared generics), other
6044 than to check that the given names are all names of generic units or
6045 generic instances.
6047 @node Pragma Shared
6048 @unnumberedsec Pragma Shared
6049 @findex Shared
6051 @noindent
6052 This pragma is provided for compatibility with Ada 83. The syntax and
6053 semantics are identical to pragma Atomic.
6055 @node Pragma Short_Circuit_And_Or
6056 @unnumberedsec Pragma Short_Circuit_And_Or
6057 @findex Short_Circuit_And_Or
6058 @noindent
6059 Syntax:
6061 @smallexample @c ada
6062 pragma Short_Circuit_And_Or;
6063 @end smallexample
6065 @noindent
6066 This configuration pragma causes any occurrence of the AND operator applied to
6067 operands of type Standard.Boolean to be short-circuited (i.e. the AND operator
6068 is treated as if it were AND THEN). Or is similarly treated as OR ELSE. This
6069 may be useful in the context of certification protocols requiring the use of
6070 short-circuited logical operators. If this configuration pragma occurs locally
6071 within the file being compiled, it applies only to the file being compiled.
6072 There is no requirement that all units in a partition use this option.
6074 @node Pragma Short_Descriptors
6075 @unnumberedsec Pragma Short_Descriptors
6076 @findex Short_Descriptors
6077 @noindent
6078 Syntax:
6080 @smallexample @c ada
6081 pragma Short_Descriptors
6082 @end smallexample
6084 @noindent
6085 In VMS versions of the compiler, this configuration pragma causes all
6086 occurrences of the mechanism types Descriptor[_xxx] to be treated as
6087 Short_Descriptor[_xxx]. This is helpful in porting legacy applications from a
6088 32-bit environment to a 64-bit environment. This pragma is ignored for non-VMS
6089 versions.
6091 @node Pragma Simple_Storage_Pool_Type
6092 @unnumberedsec Pragma Simple_Storage_Pool_Type
6093 @findex Simple_Storage_Pool_Type
6094 @cindex Storage pool, simple
6095 @cindex Simple storage pool
6096 @noindent
6097 Syntax:
6099 @smallexample @c ada
6100 pragma Simple_Storage_Pool_Type (type_LOCAL_NAME);
6101 @end smallexample
6103 @noindent
6104 A type can be established as a ``simple storage pool type'' by applying
6105 the representation pragma @code{Simple_Storage_Pool_Type} to the type.
6106 A type named in the pragma must be a library-level immutably limited record
6107 type or limited tagged type declared immediately within a package declaration.
6108 The type can also be a limited private type whose full type is allowed as
6109 a simple storage pool type.
6111 For a simple storage pool type @var{SSP}, nonabstract primitive subprograms
6112 @code{Allocate}, @code{Deallocate}, and @code{Storage_Size} can be declared that
6113 are subtype conformant with the following subprogram declarations:
6115 @smallexample @c ada
6116 procedure Allocate
6117   (Pool                     : in out SSP;
6118    Storage_Address          : out System.Address;
6119    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6120    Alignment                : System.Storage_Elements.Storage_Count);
6122 procedure Deallocate
6123   (Pool : in out SSP;
6124    Storage_Address          : System.Address;
6125    Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
6126    Alignment                : System.Storage_Elements.Storage_Count);
6128 function Storage_Size (Pool : SSP)
6129   return System.Storage_Elements.Storage_Count;
6130 @end smallexample
6132 @noindent
6133 Procedure @code{Allocate} must be declared, whereas @code{Deallocate} and
6134 @code{Storage_Size} are optional. If @code{Deallocate} is not declared, then
6135 applying an unchecked deallocation has no effect other than to set its actual
6136 parameter to null. If @code{Storage_Size} is not declared, then the
6137 @code{Storage_Size} attribute applied to an access type associated with
6138 a pool object of type SSP returns zero. Additional operations can be declared
6139 for a simple storage pool type (such as for supporting a mark/release
6140 storage-management discipline).
6142 An object of a simple storage pool type can be associated with an access
6143 type by specifying the attribute @code{Simple_Storage_Pool}. For example:
6145 @smallexample @c ada
6147 My_Pool : My_Simple_Storage_Pool_Type;
6149 type Acc is access My_Data_Type;
6151 for Acc'Simple_Storage_Pool use My_Pool;
6153 @end smallexample
6155 @noindent
6156 See attribute @code{Simple_Storage_Pool} for further details.
6158 @node Pragma Source_File_Name
6159 @unnumberedsec Pragma Source_File_Name
6160 @findex Source_File_Name
6161 @noindent
6162 Syntax:
6164 @smallexample @c ada
6165 pragma Source_File_Name (
6166   [Unit_Name   =>] unit_NAME,
6167   Spec_File_Name =>  STRING_LITERAL,
6168   [Index => INTEGER_LITERAL]);
6170 pragma Source_File_Name (
6171   [Unit_Name   =>] unit_NAME,
6172   Body_File_Name =>  STRING_LITERAL,
6173   [Index => INTEGER_LITERAL]);
6174 @end smallexample
6176 @noindent
6177 Use this to override the normal naming convention.  It is a configuration
6178 pragma, and so has the usual applicability of configuration pragmas
6179 (i.e.@: it applies to either an entire partition, or to all units in a
6180 compilation, or to a single unit, depending on how it is used.
6181 @var{unit_name} is mapped to @var{file_name_literal}.  The identifier for
6182 the second argument is required, and indicates whether this is the file
6183 name for the spec or for the body.
6185 The optional Index argument should be used when a file contains multiple
6186 units, and when you do not want to use @code{gnatchop} to separate then
6187 into multiple files (which is the recommended procedure to limit the
6188 number of recompilations that are needed when some sources change).
6189 For instance, if the source file @file{source.ada} contains
6191 @smallexample @c ada
6192 package B is
6194 end B;
6196 with B;
6197 procedure A is
6198 begin
6199    ..
6200 end A;
6201 @end smallexample
6203 you could use the following configuration pragmas:
6205 @smallexample @c ada
6206 pragma Source_File_Name
6207   (B, Spec_File_Name => "source.ada", Index => 1);
6208 pragma Source_File_Name
6209   (A, Body_File_Name => "source.ada", Index => 2);
6210 @end smallexample
6212 Note that the @code{gnatname} utility can also be used to generate those
6213 configuration pragmas.
6215 Another form of the @code{Source_File_Name} pragma allows
6216 the specification of patterns defining alternative file naming schemes
6217 to apply to all files.
6219 @smallexample @c ada
6220 pragma Source_File_Name
6221   (  [Spec_File_Name  =>] STRING_LITERAL
6222    [,[Casing          =>] CASING_SPEC]
6223    [,[Dot_Replacement =>] STRING_LITERAL]);
6225 pragma Source_File_Name
6226   (  [Body_File_Name  =>] STRING_LITERAL
6227    [,[Casing          =>] CASING_SPEC]
6228    [,[Dot_Replacement =>] STRING_LITERAL]);
6230 pragma Source_File_Name
6231   (  [Subunit_File_Name =>] STRING_LITERAL
6232    [,[Casing            =>] CASING_SPEC]
6233    [,[Dot_Replacement   =>] STRING_LITERAL]);
6235 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
6236 @end smallexample
6238 @noindent
6239 The first argument is a pattern that contains a single asterisk indicating
6240 the point at which the unit name is to be inserted in the pattern string
6241 to form the file name.  The second argument is optional.  If present it
6242 specifies the casing of the unit name in the resulting file name string.
6243 The default is lower case.  Finally the third argument allows for systematic
6244 replacement of any dots in the unit name by the specified string literal.
6246 Note that Source_File_Name pragmas should not be used if you are using
6247 project files. The reason for this rule is that the project manager is not
6248 aware of these pragmas, and so other tools that use the projet file would not
6249 be aware of the intended naming conventions. If you are using project files,
6250 file naming is controlled by Source_File_Name_Project pragmas, which are
6251 usually supplied automatically by the project manager. A pragma
6252 Source_File_Name cannot appear after a @ref{Pragma Source_File_Name_Project}.
6254 For more details on the use of the @code{Source_File_Name} pragma,
6255 @xref{Using Other File Names,,, gnat_ugn, @value{EDITION} User's Guide},
6256 and @ref{Alternative File Naming Schemes,,, gnat_ugn, @value{EDITION}
6257 User's Guide}.
6259 @node Pragma Source_File_Name_Project
6260 @unnumberedsec Pragma Source_File_Name_Project
6261 @findex Source_File_Name_Project
6262 @noindent
6264 This pragma has the same syntax and semantics as pragma Source_File_Name.
6265 It is only allowed as a stand alone configuration pragma.
6266 It cannot appear after a @ref{Pragma Source_File_Name}, and
6267 most importantly, once pragma Source_File_Name_Project appears,
6268 no further Source_File_Name pragmas are allowed.
6270 The intention is that Source_File_Name_Project pragmas are always
6271 generated by the Project Manager in a manner consistent with the naming
6272 specified in a project file, and when naming is controlled in this manner,
6273 it is not permissible to attempt to modify this naming scheme using
6274 Source_File_Name or Source_File_Name_Project pragmas (which would not be
6275 known to the project manager).
6277 @node Pragma Source_Reference
6278 @unnumberedsec Pragma Source_Reference
6279 @findex Source_Reference
6280 @noindent
6281 Syntax:
6283 @smallexample @c ada
6284 pragma Source_Reference (INTEGER_LITERAL, STRING_LITERAL);
6285 @end smallexample
6287 @noindent
6288 This pragma must appear as the first line of a source file.
6289 @var{integer_literal} is the logical line number of the line following
6290 the pragma line (for use in error messages and debugging
6291 information).  @var{string_literal} is a static string constant that
6292 specifies the file name to be used in error messages and debugging
6293 information.  This is most notably used for the output of @code{gnatchop}
6294 with the @option{-r} switch, to make sure that the original unchopped
6295 source file is the one referred to.
6297 The second argument must be a string literal, it cannot be a static
6298 string expression other than a string literal.  This is because its value
6299 is needed for error messages issued by all phases of the compiler.
6301 @node Pragma SPARK_Mode
6302 @unnumberedsec Pragma SPARK_Mode
6303 @findex SPARK_Mode
6304 @noindent
6305 Syntax:
6307 @smallexample @c ada
6308 pragma SPARK_Mode [(On | Off)] ;
6309 @end smallexample
6311 @noindent
6312 In general a program can have some parts that are in SPARK 2014 (and
6313 follow all the rules in the SPARK Reference Manual), and some parts
6314 that are full Ada 2012.
6316 The SPARK_Mode pragma is used to identify which parts are in SPARK
6317 2014 (by default programs are in full Ada). The SPARK_Mode pragma can
6318 be used in the following places:
6320 @itemize @bullet
6322 @item
6323 As a configuration pragma, in which case it sets the default mode for
6324 all units compiled with this pragma.
6326 @item
6327 Immediately following a library-level subprogram spec
6329 @item
6330 Immediately within a library-level package body
6332 @item
6333 Immediately following the @code{private} keyword of a library-level
6334 package spec
6336 @item
6337 Immediately following the @code{begin} keyword of a library-level
6338 package body
6340 @item
6341 Immediately within a library-level subprogram body
6343 @end itemize
6345 @noindent
6346 Normally a subprogram or package spec/body inherits the current mode
6347 that is active at the point it is declared. But this can be overridden
6348 by pragma within the spec or body as above.
6350 The basic consistency rule is that you can't turn SPARK_Mode back
6351 @code{On}, once you have explicitly (with a pragma) turned if
6352 @code{Off}. So the following rules apply:
6354 @noindent
6355 If a subprogram spec has SPARK_Mode @code{Off}, then the body must
6356 also have SPARK_Mode @code{Off}.
6358 @noindent
6359 For a package, we have four parts:
6361 @itemize
6362 @item
6363 the package public declarations
6364 @item
6365 the package private part
6366 @item
6367 the body of the package
6368 @item
6369 the elaboration code after @code{begin}
6370 @end itemize
6372 @noindent
6373 For a package, the rule is that if you explicitly turn SPARK_Mode
6374 @code{Off} for any part, then all the following parts must have
6375 SPARK_Mode @code{Off}. Note that this may require repeating a pragma
6376 SPARK_Mode (@code{Off}) in the body. For example, if we have a
6377 configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
6378 default everywhere, and one particular package spec has pragma
6379 SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
6380 the package body.
6382 @node Pragma Static_Elaboration_Desired
6383 @unnumberedsec Pragma Static_Elaboration_Desired
6384 @findex Static_Elaboration_Desired
6385 @noindent
6386 Syntax:
6388 @smallexample @c ada
6389 pragma Static_Elaboration_Desired;
6390 @end smallexample
6392 @noindent
6393 This pragma is used to indicate that the compiler should attempt to initialize
6394 statically the objects declared in the library unit to which the pragma applies,
6395 when these objects are initialized (explicitly or implicitly) by an aggregate.
6396 In the absence of this pragma, aggregates in object declarations are expanded
6397 into assignments and loops, even when the aggregate components are static
6398 constants. When the aggregate is present the compiler builds a static expression
6399 that requires no run-time code, so that the initialized object can be placed in
6400 read-only data space. If the components are not static, or the aggregate has
6401 more that 100 components, the compiler emits a warning that the pragma cannot
6402 be obeyed. (See also the restriction No_Implicit_Loops, which supports static
6403 construction of larger aggregates with static components that include an others
6404 choice.)
6406 @node Pragma Stream_Convert
6407 @unnumberedsec Pragma Stream_Convert
6408 @findex Stream_Convert
6409 @noindent
6410 Syntax:
6412 @smallexample @c ada
6413 pragma Stream_Convert (
6414   [Entity =>] type_LOCAL_NAME,
6415   [Read   =>] function_NAME,
6416   [Write  =>] function_NAME);
6417 @end smallexample
6419 @noindent
6420 This pragma provides an efficient way of providing stream functions for
6421 types defined in packages.  Not only is it simpler to use than declaring
6422 the necessary functions with attribute representation clauses, but more
6423 significantly, it allows the declaration to made in such a way that the
6424 stream packages are not loaded unless they are needed.  The use of
6425 the Stream_Convert pragma adds no overhead at all, unless the stream
6426 attributes are actually used on the designated type.
6428 The first argument specifies the type for which stream functions are
6429 provided.  The second parameter provides a function used to read values
6430 of this type.  It must name a function whose argument type may be any
6431 subtype, and whose returned type must be the type given as the first
6432 argument to the pragma.
6434 The meaning of the @var{Read} parameter is that if a stream attribute directly
6435 or indirectly specifies reading of the type given as the first parameter,
6436 then a value of the type given as the argument to the Read function is
6437 read from the stream, and then the Read function is used to convert this
6438 to the required target type.
6440 Similarly the @var{Write} parameter specifies how to treat write attributes
6441 that directly or indirectly apply to the type given as the first parameter.
6442 It must have an input parameter of the type specified by the first parameter,
6443 and the return type must be the same as the input type of the Read function.
6444 The effect is to first call the Write function to convert to the given stream
6445 type, and then write the result type to the stream.
6447 The Read and Write functions must not be overloaded subprograms.  If necessary
6448 renamings can be supplied to meet this requirement.
6449 The usage of this attribute is best illustrated by a simple example, taken
6450 from the GNAT implementation of package Ada.Strings.Unbounded:
6452 @smallexample @c ada
6453 function To_Unbounded (S : String)
6454            return Unbounded_String
6455   renames To_Unbounded_String;
6457 pragma Stream_Convert
6458   (Unbounded_String, To_Unbounded, To_String);
6459 @end smallexample
6461 @noindent
6462 The specifications of the referenced functions, as given in the Ada
6463 Reference Manual are:
6465 @smallexample @c ada
6466 function To_Unbounded_String (Source : String)
6467   return Unbounded_String;
6469 function To_String (Source : Unbounded_String)
6470   return String;
6471 @end smallexample
6473 @noindent
6474 The effect is that if the value of an unbounded string is written to a stream,
6475 then the representation of the item in the stream is in the same format that
6476 would be used for @code{Standard.String'Output}, and this same representation
6477 is expected when a value of this type is read from the stream. Note that the
6478 value written always includes the bounds, even for Unbounded_String'Write,
6479 since Unbounded_String is not an array type.
6481 @node Pragma Style_Checks
6482 @unnumberedsec Pragma Style_Checks
6483 @findex Style_Checks
6484 @noindent
6485 Syntax:
6487 @smallexample @c ada
6488 pragma Style_Checks (string_LITERAL | ALL_CHECKS |
6489                      On | Off [, LOCAL_NAME]);
6490 @end smallexample
6492 @noindent
6493 This pragma is used in conjunction with compiler switches to control the
6494 built in style checking provided by GNAT@.  The compiler switches, if set,
6495 provide an initial setting for the switches, and this pragma may be used
6496 to modify these settings, or the settings may be provided entirely by
6497 the use of the pragma.  This pragma can be used anywhere that a pragma
6498 is legal, including use as a configuration pragma (including use in
6499 the @file{gnat.adc} file).
6501 The form with a string literal specifies which style options are to be
6502 activated.  These are additive, so they apply in addition to any previously
6503 set style check options.  The codes for the options are the same as those
6504 used in the @option{-gnaty} switch to @command{gcc} or @command{gnatmake}.
6505 For example the following two methods can be used to enable
6506 layout checking:
6508 @itemize @bullet
6509 @item
6510 @smallexample @c ada
6511 pragma Style_Checks ("l");
6512 @end smallexample
6514 @item
6515 @smallexample
6516 gcc -c -gnatyl @dots{}
6517 @end smallexample
6518 @end itemize
6520 @noindent
6521 The form ALL_CHECKS activates all standard checks (its use is equivalent
6522 to the use of the @code{gnaty} switch with no options.  @xref{Top,
6523 @value{EDITION} User's Guide, About This Guide, gnat_ugn,
6524 @value{EDITION} User's Guide}, for details.)
6526 Note: the behavior is slightly different in GNAT mode (@option{-gnatg} used).
6527 In this case, ALL_CHECKS implies the standard set of GNAT mode style check
6528 options (i.e. equivalent to -gnatyg).
6530 The forms with @code{Off} and @code{On}
6531 can be used to temporarily disable style checks
6532 as shown in the following example:
6534 @smallexample @c ada
6535 @iftex
6536 @leftskip=0cm
6537 @end iftex
6538 pragma Style_Checks ("k"); -- requires keywords in lower case
6539 pragma Style_Checks (Off); -- turn off style checks
6540 NULL;                      -- this will not generate an error message
6541 pragma Style_Checks (On);  -- turn style checks back on
6542 NULL;                      -- this will generate an error message
6543 @end smallexample
6545 @noindent
6546 Finally the two argument form is allowed only if the first argument is
6547 @code{On} or @code{Off}.  The effect is to turn of semantic style checks
6548 for the specified entity, as shown in the following example:
6550 @smallexample @c ada
6551 @iftex
6552 @leftskip=0cm
6553 @end iftex
6554 pragma Style_Checks ("r"); -- require consistency of identifier casing
6555 Arg : Integer;
6556 Rf1 : Integer := ARG;      -- incorrect, wrong case
6557 pragma Style_Checks (Off, Arg);
6558 Rf2 : Integer := ARG;      -- OK, no error
6559 @end smallexample
6561 @node Pragma Subtitle
6562 @unnumberedsec Pragma Subtitle
6563 @findex Subtitle
6564 @noindent
6565 Syntax:
6567 @smallexample @c ada
6568 pragma Subtitle ([Subtitle =>] STRING_LITERAL);
6569 @end smallexample
6571 @noindent
6572 This pragma is recognized for compatibility with other Ada compilers
6573 but is ignored by GNAT@.
6575 @node Pragma Suppress
6576 @unnumberedsec Pragma Suppress
6577 @findex Suppress
6578 @noindent
6579 Syntax:
6581 @smallexample @c ada
6582 pragma Suppress (Identifier [, [On =>] Name]);
6583 @end smallexample
6585 @noindent
6586 This is a standard pragma, and supports all the check names required in
6587 the RM. It is included here because GNAT recognizes some additional check
6588 names that are implementation defined (as permitted by the RM):
6590 @itemize @bullet
6592 @item
6593 @code{Alignment_Check} can be used to suppress alignment checks
6594 on addresses used in address clauses. Such checks can also be suppressed
6595 by suppressing range checks, but the specific use of @code{Alignment_Check}
6596 allows suppression of alignment checks without suppressing other range checks.
6598 @item
6599 @code{Predicate_Check} can be used to control whether predicate checks are
6600 active. It is applicable only to predicates for which the policy is
6601 @code{Check}. Unlike @code{Assertion_Policy}, which determines if a given
6602 predicate is ignored or checked for the whole program, the use of
6603 @code{Suppress} and @code{Unsuppress} with this check name allows a given
6604 predicate to be turned on and off at specific points in the program.
6606 @item
6607 @code{Validity_Check} can be used specifically to control validity checks.
6608 If @code{Suppress} is used to suppress validity checks, then no validity
6609 checks are performed, including those specified by the appropriate compiler
6610 switch or the @code{Validity_Checks} pragma.
6612 @item
6613 Additional check names previously introduced by use of the @code{Check_Name}
6614 pragma are also allowed.
6616 @end itemize
6618 @noindent
6619 Note that pragma Suppress gives the compiler permission to omit
6620 checks, but does not require the compiler to omit checks. The compiler
6621 will generate checks if they are essentially free, even when they are
6622 suppressed. In particular, if the compiler can prove that a certain
6623 check will necessarily fail, it will generate code to do an
6624 unconditional ``raise'', even if checks are suppressed. The compiler
6625 warns in this case.
6627 Of course, run-time checks are omitted whenever the compiler can prove
6628 that they will not fail, whether or not checks are suppressed.
6630 @node Pragma Suppress_All
6631 @unnumberedsec Pragma Suppress_All
6632 @findex Suppress_All
6633 @noindent
6634 Syntax:
6636 @smallexample @c ada
6637 pragma Suppress_All;
6638 @end smallexample
6640 @noindent
6641 This pragma can appear anywhere within a unit.
6642 The effect is to apply @code{Suppress (All_Checks)} to the unit
6643 in which it appears.  This pragma is implemented for compatibility with DEC
6644 Ada 83 usage where it appears at the end of a unit, and for compatibility
6645 with Rational Ada, where it appears as a program unit pragma.
6646 The use of the standard Ada pragma @code{Suppress (All_Checks)}
6647 as a normal configuration pragma is the preferred usage in GNAT@.
6649 @node Pragma Suppress_Debug_Info
6650 @unnumberedsec Pragma Suppress_Debug_Info
6651 @findex Suppress_Debug_Info
6652 @noindent
6653 Syntax:
6655 @smallexample @c ada
6656 Suppress_Debug_Info ([Entity =>] LOCAL_NAME);
6657 @end smallexample
6659 @noindent
6660 This pragma can be used to suppress generation of debug information
6661 for the specified entity. It is intended primarily for use in debugging
6662 the debugger, and navigating around debugger problems.
6664 @node Pragma Suppress_Exception_Locations
6665 @unnumberedsec Pragma Suppress_Exception_Locations
6666 @findex Suppress_Exception_Locations
6667 @noindent
6668 Syntax:
6670 @smallexample @c ada
6671 pragma Suppress_Exception_Locations;
6672 @end smallexample
6674 @noindent
6675 In normal mode, a raise statement for an exception by default generates
6676 an exception message giving the file name and line number for the location
6677 of the raise. This is useful for debugging and logging purposes, but this
6678 entails extra space for the strings for the messages. The configuration
6679 pragma @code{Suppress_Exception_Locations} can be used to suppress the
6680 generation of these strings, with the result that space is saved, but the
6681 exception message for such raises is null. This configuration pragma may
6682 appear in a global configuration pragma file, or in a specific unit as
6683 usual. It is not required that this pragma be used consistently within
6684 a partition, so it is fine to have some units within a partition compiled
6685 with this pragma and others compiled in normal mode without it.
6687 @node Pragma Suppress_Initialization
6688 @unnumberedsec Pragma Suppress_Initialization
6689 @findex Suppress_Initialization
6690 @cindex Suppressing initialization
6691 @cindex Initialization, suppression of
6692 @noindent
6693 Syntax:
6695 @smallexample @c ada
6696 pragma Suppress_Initialization ([Entity =>] subtype_Name);
6697 @end smallexample
6699 @noindent
6700 Here subtype_Name is the name introduced by a type declaration
6701 or subtype declaration.
6702 This pragma suppresses any implicit or explicit initialization
6703 for all variables of the given type or subtype,
6704 including initialization resulting from the use of pragmas
6705 Normalize_Scalars or Initialize_Scalars.
6707 This is considered a representation item, so it cannot be given after
6708 the type is frozen. It applies to all subsequent object declarations,
6709 and also any allocator that creates objects of the type.
6711 If the pragma is given for the first subtype, then it is considered
6712 to apply to the base type and all its subtypes. If the pragma is given
6713 for other than a first subtype, then it applies only to the given subtype.
6714 The pragma may not be given after the type is frozen.
6716 @node Pragma Task_Info
6717 @unnumberedsec Pragma Task_Info
6718 @findex Task_Info
6719 @noindent
6720 Syntax
6722 @smallexample @c ada
6723 pragma Task_Info (EXPRESSION);
6724 @end smallexample
6726 @noindent
6727 This pragma appears within a task definition (like pragma
6728 @code{Priority}) and applies to the task in which it appears.  The
6729 argument must be of type @code{System.Task_Info.Task_Info_Type}.
6730 The @code{Task_Info} pragma provides system dependent control over
6731 aspects of tasking implementation, for example, the ability to map
6732 tasks to specific processors.  For details on the facilities available
6733 for the version of GNAT that you are using, see the documentation
6734 in the spec of package System.Task_Info in the runtime
6735 library.
6737 @node Pragma Task_Name
6738 @unnumberedsec Pragma Task_Name
6739 @findex Task_Name
6740 @noindent
6741 Syntax
6743 @smallexample @c ada
6744 pragma Task_Name (string_EXPRESSION);
6745 @end smallexample
6747 @noindent
6748 This pragma appears within a task definition (like pragma
6749 @code{Priority}) and applies to the task in which it appears.  The
6750 argument must be of type String, and provides a name to be used for
6751 the task instance when the task is created.  Note that this expression
6752 is not required to be static, and in particular, it can contain
6753 references to task discriminants.  This facility can be used to
6754 provide different names for different tasks as they are created,
6755 as illustrated in the example below.
6757 The task name is recorded internally in the run-time structures
6758 and is accessible to tools like the debugger.  In addition the
6759 routine @code{Ada.Task_Identification.Image} will return this
6760 string, with a unique task address appended.
6762 @smallexample @c ada
6763 --  Example of the use of pragma Task_Name
6765 with Ada.Task_Identification;
6766 use Ada.Task_Identification;
6767 with Text_IO; use Text_IO;
6768 procedure t3 is
6770    type Astring is access String;
6772    task type Task_Typ (Name : access String) is
6773       pragma Task_Name (Name.all);
6774    end Task_Typ;
6776    task body Task_Typ is
6777       Nam : constant String := Image (Current_Task);
6778    begin
6779       Put_Line ("-->" & Nam (1 .. 14) & "<--");
6780    end Task_Typ;
6782    type Ptr_Task is access Task_Typ;
6783    Task_Var : Ptr_Task;
6785 begin
6786    Task_Var :=
6787      new Task_Typ (new String'("This is task 1"));
6788    Task_Var :=
6789      new Task_Typ (new String'("This is task 2"));
6790 end;
6791 @end smallexample
6793 @node Pragma Task_Storage
6794 @unnumberedsec Pragma Task_Storage
6795 @findex Task_Storage
6796 Syntax:
6798 @smallexample @c ada
6799 pragma Task_Storage (
6800   [Task_Type =>] LOCAL_NAME,
6801   [Top_Guard =>] static_integer_EXPRESSION);
6802 @end smallexample
6804 @noindent
6805 This pragma specifies the length of the guard area for tasks.  The guard
6806 area is an additional storage area allocated to a task.  A value of zero
6807 means that either no guard area is created or a minimal guard area is
6808 created, depending on the target.  This pragma can appear anywhere a
6809 @code{Storage_Size} attribute definition clause is allowed for a task
6810 type.
6812 @node Pragma Test_Case
6813 @unnumberedsec Pragma Test_Case
6814 @cindex Test cases
6815 @findex Test_Case
6816 @noindent
6817 Syntax:
6819 @smallexample @c ada
6820 pragma Test_Case (
6821    [Name     =>] static_string_Expression
6822   ,[Mode     =>] (Nominal | Robustness)
6823  [, Requires =>  Boolean_Expression]
6824  [, Ensures  =>  Boolean_Expression]);
6825 @end smallexample
6827 @noindent
6828 The @code{Test_Case} pragma allows defining fine-grain specifications
6829 for use by testing tools.
6830 The compiler checks the validity of the @code{Test_Case} pragma, but its
6831 presence does not lead to any modification of the code generated by the
6832 compiler.
6834 @code{Test_Case} pragmas may only appear immediately following the
6835 (separate) declaration of a subprogram in a package declaration, inside
6836 a package spec unit. Only other pragmas may intervene (that is appear
6837 between the subprogram declaration and a test case).
6839 The compiler checks that boolean expressions given in @code{Requires} and
6840 @code{Ensures} are valid, where the rules for @code{Requires} are the
6841 same as the rule for an expression in @code{Precondition} and the rules
6842 for @code{Ensures} are the same as the rule for an expression in
6843 @code{Postcondition}. In particular, attributes @code{'Old} and
6844 @code{'Result} can only be used within the @code{Ensures}
6845 expression. The following is an example of use within a package spec:
6847 @smallexample @c ada
6848 package Math_Functions is
6849    ...
6850    function Sqrt (Arg : Float) return Float;
6851    pragma Test_Case (Name     => "Test 1",
6852                      Mode     => Nominal,
6853                      Requires => Arg < 10000,
6854                      Ensures  => Sqrt'Result < 10);
6855    ...
6856 end Math_Functions;
6857 @end smallexample
6859 @noindent
6860 The meaning of a test case is that there is at least one context where
6861 @code{Requires} holds such that, if the associated subprogram is executed in
6862 that context, then @code{Ensures} holds when the subprogram returns.
6863 Mode @code{Nominal} indicates that the input context should also satisfy the
6864 precondition of the subprogram, and the output context should also satisfy its
6865 postcondition. More @code{Robustness} indicates that the precondition and
6866 postcondition of the subprogram should be ignored for this test case.
6868 @node Pragma Thread_Local_Storage
6869 @unnumberedsec Pragma Thread_Local_Storage
6870 @findex Thread_Local_Storage
6871 @cindex Task specific storage
6872 @cindex TLS (Thread Local Storage)
6873 @cindex Task_Attributes
6874 Syntax:
6876 @smallexample @c ada
6877 pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
6878 @end smallexample
6880 @noindent
6881 This pragma specifies that the specified entity, which must be
6882 a variable declared in a library level package, is to be marked as
6883 "Thread Local Storage" (@code{TLS}). On systems supporting this (which
6884 include Solaris, GNU/Linux and VxWorks 6), this causes each thread
6885 (and hence each Ada task) to see a distinct copy of the variable.
6887 The variable may not have default initialization, and if there is
6888 an explicit initialization, it must be either @code{null} for an
6889 access variable, or a static expression for a scalar variable.
6890 This provides a low level mechanism similar to that provided by
6891 the @code{Ada.Task_Attributes} package, but much more efficient
6892 and is also useful in writing interface code that will interact
6893 with foreign threads.
6895 If this pragma is used on a system where @code{TLS} is not supported,
6896 then an error message will be generated and the program will be rejected.
6898 @node Pragma Time_Slice
6899 @unnumberedsec Pragma Time_Slice
6900 @findex Time_Slice
6901 @noindent
6902 Syntax:
6904 @smallexample @c ada
6905 pragma Time_Slice (static_duration_EXPRESSION);
6906 @end smallexample
6908 @noindent
6909 For implementations of GNAT on operating systems where it is possible
6910 to supply a time slice value, this pragma may be used for this purpose.
6911 It is ignored if it is used in a system that does not allow this control,
6912 or if it appears in other than the main program unit.
6913 @cindex OpenVMS
6914 Note that the effect of this pragma is identical to the effect of the
6915 DEC Ada 83 pragma of the same name when operating under OpenVMS systems.
6917 @node Pragma Title
6918 @unnumberedsec Pragma Title
6919 @findex Title
6920 @noindent
6921 Syntax:
6923 @smallexample @c ada
6924 pragma Title (TITLING_OPTION [, TITLING OPTION]);
6926 TITLING_OPTION ::=
6927   [Title    =>] STRING_LITERAL,
6928 | [Subtitle =>] STRING_LITERAL
6929 @end smallexample
6931 @noindent
6932 Syntax checked but otherwise ignored by GNAT@.  This is a listing control
6933 pragma used in DEC Ada 83 implementations to provide a title and/or
6934 subtitle for the program listing.  The program listing generated by GNAT
6935 does not have titles or subtitles.
6937 Unlike other pragmas, the full flexibility of named notation is allowed
6938 for this pragma, i.e.@: the parameters may be given in any order if named
6939 notation is used, and named and positional notation can be mixed
6940 following the normal rules for procedure calls in Ada.
6942 @node Pragma Type_Invariant
6943 @unnumberedsec Pragma Type_Invariant
6944 @findex Invariant
6945 @findex Type_Invariant pragma
6946 @noindent
6947 Syntax:
6949 @smallexample @c ada
6950 pragma Type_Invariant
6951   ([Entity =>] type_LOCAL_NAME,
6952    [Check  =>] EXPRESSION);
6953 @end smallexample
6955 @noindent
6956 The @code{Type_Invariant} pragma is intended to be an exact
6957 replacement for the language-defined @code{Type_Invariant}
6958 aspect, and shares its restrictions and semantics. It differs
6959 from the language defined @code{Invariant} pragma in that it
6960 does not permit a string parameter, and it is
6961 controlled by the assertion identifier @code{Type_Invariant}
6962 rather than @code{Invariant}.
6964 @node Pragma Type_Invariant_Class
6965 @unnumberedsec Pragma Type_Invariant_Class
6966 @findex Invariant
6967 @findex Type_Invariant_Class pragma
6968 @noindent
6969 Syntax:
6971 @smallexample @c ada
6972 pragma Type_Invariant_Class
6973   ([Entity =>] type_LOCAL_NAME,
6974    [Check  =>] EXPRESSION);
6975 @end smallexample
6977 @noindent
6978 The @code{Type_Invariant_Class} pragma is intended to be an exact
6979 replacement for the language-defined @code{Type_Invariant'Class}
6980 aspect, and shares its restrictions and semantics.
6982 Note: This pragma is called @code{Type_Invariant_Class} rather than
6983 @code{Type_Invariant'Class} because the latter would not be strictly
6984 conforming to the allowed syntax for pragmas. The motivation
6985 for providing pragmas equivalent to the aspects is to allow a program
6986 to be written using the pragmas, and then compiled if necessary
6987 using an Ada compiler that does not recognize the pragmas or
6988 aspects, but is prepared to ignore the pragmas. The assertion
6989 policy that controls this pragma is @code{Type_Invariant'Class},
6990 not @code{Type_Invariant_Class}.
6992 @node Pragma Unchecked_Union
6993 @unnumberedsec Pragma Unchecked_Union
6994 @cindex Unions in C
6995 @findex Unchecked_Union
6996 @noindent
6997 Syntax:
6999 @smallexample @c ada
7000 pragma Unchecked_Union (first_subtype_LOCAL_NAME);
7001 @end smallexample
7003 @noindent
7004 This pragma is used to specify a representation of a record type that is
7005 equivalent to a C union. It was introduced as a GNAT implementation defined
7006 pragma in the GNAT Ada 95 mode. Ada 2005 includes an extended version of this
7007 pragma, making it language defined, and GNAT fully implements this extended
7008 version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
7009 details, consult the Ada 2012 Reference Manual, section B.3.3.
7011 @node Pragma Unimplemented_Unit
7012 @unnumberedsec Pragma Unimplemented_Unit
7013 @findex Unimplemented_Unit
7014 @noindent
7015 Syntax:
7017 @smallexample @c ada
7018 pragma Unimplemented_Unit;
7019 @end smallexample
7021 @noindent
7022 If this pragma occurs in a unit that is processed by the compiler, GNAT
7023 aborts with the message @samp{@var{xxx} not implemented}, where
7024 @var{xxx} is the name of the current compilation unit.  This pragma is
7025 intended to allow the compiler to handle unimplemented library units in
7026 a clean manner.
7028 The abort only happens if code is being generated.  Thus you can use
7029 specs of unimplemented packages in syntax or semantic checking mode.
7031 @node Pragma Universal_Aliasing
7032 @unnumberedsec Pragma Universal_Aliasing
7033 @findex Universal_Aliasing
7034 @noindent
7035 Syntax:
7037 @smallexample @c ada
7038 pragma Universal_Aliasing [([Entity =>] type_LOCAL_NAME)];
7039 @end smallexample
7041 @noindent
7042 @var{type_LOCAL_NAME} must refer to a type declaration in the current
7043 declarative part.  The effect is to inhibit strict type-based aliasing
7044 optimization for the given type.  In other words, the effect is as though
7045 access types designating this type were subject to pragma No_Strict_Aliasing.
7046 For a detailed description of the strict aliasing optimization, and the
7047 situations in which it must be suppressed, @xref{Optimization and Strict
7048 Aliasing,,, gnat_ugn, @value{EDITION} User's Guide}.
7050 @node Pragma Universal_Data
7051 @unnumberedsec Pragma Universal_Data
7052 @findex Universal_Data
7053 @noindent
7054 Syntax:
7056 @smallexample @c ada
7057 pragma Universal_Data [(library_unit_Name)];
7058 @end smallexample
7060 @noindent
7061 This pragma is supported only for the AAMP target and is ignored for
7062 other targets. The pragma specifies that all library-level objects
7063 (Counter 0 data) associated with the library unit are to be accessed
7064 and updated using universal addressing (24-bit addresses for AAMP5)
7065 rather than the default of 16-bit Data Environment (DENV) addressing.
7066 Use of this pragma will generally result in less efficient code for
7067 references to global data associated with the library unit, but
7068 allows such data to be located anywhere in memory. This pragma is
7069 a library unit pragma, but can also be used as a configuration pragma
7070 (including use in the @file{gnat.adc} file). The functionality
7071 of this pragma is also available by applying the -univ switch on the
7072 compilations of units where universal addressing of the data is desired.
7074 @node Pragma Unmodified
7075 @unnumberedsec Pragma Unmodified
7076 @findex Unmodified
7077 @cindex Warnings, unmodified
7078 @noindent
7079 Syntax:
7081 @smallexample @c ada
7082 pragma Unmodified (LOCAL_NAME @{, LOCAL_NAME@});
7083 @end smallexample
7085 @noindent
7086 This pragma signals that the assignable entities (variables,
7087 @code{out} parameters, @code{in out} parameters) whose names are listed are
7088 deliberately not assigned in the current source unit. This
7089 suppresses warnings about the
7090 entities being referenced but not assigned, and in addition a warning will be
7091 generated if one of these entities is in fact assigned in the
7092 same unit as the pragma (or in the corresponding body, or one
7093 of its subunits).
7095 This is particularly useful for clearly signaling that a particular
7096 parameter is not modified, even though the spec suggests that it might
7099 @node Pragma Unreferenced
7100 @unnumberedsec Pragma Unreferenced
7101 @findex Unreferenced
7102 @cindex Warnings, unreferenced
7103 @noindent
7104 Syntax:
7106 @smallexample @c ada
7107 pragma Unreferenced (LOCAL_NAME @{, LOCAL_NAME@});
7108 pragma Unreferenced (library_unit_NAME @{, library_unit_NAME@});
7109 @end smallexample
7111 @noindent
7112 This pragma signals that the entities whose names are listed are
7113 deliberately not referenced in the current source unit. This
7114 suppresses warnings about the
7115 entities being unreferenced, and in addition a warning will be
7116 generated if one of these entities is in fact subsequently referenced in the
7117 same unit as the pragma (or in the corresponding body, or one
7118 of its subunits).
7120 This is particularly useful for clearly signaling that a particular
7121 parameter is not referenced in some particular subprogram implementation
7122 and that this is deliberate. It can also be useful in the case of
7123 objects declared only for their initialization or finalization side
7124 effects.
7126 If @code{LOCAL_NAME} identifies more than one matching homonym in the
7127 current scope, then the entity most recently declared is the one to which
7128 the pragma applies. Note that in the case of accept formals, the pragma
7129 Unreferenced may appear immediately after the keyword @code{do} which
7130 allows the indication of whether or not accept formals are referenced
7131 or not to be given individually for each accept statement.
7133 The left hand side of an assignment does not count as a reference for the
7134 purpose of this pragma. Thus it is fine to assign to an entity for which
7135 pragma Unreferenced is given.
7137 Note that if a warning is desired for all calls to a given subprogram,
7138 regardless of whether they occur in the same unit as the subprogram
7139 declaration, then this pragma should not be used (calls from another
7140 unit would not be flagged); pragma Obsolescent can be used instead
7141 for this purpose, see @xref{Pragma Obsolescent}.
7143 The second form of pragma @code{Unreferenced} is used within a context
7144 clause. In this case the arguments must be unit names of units previously
7145 mentioned in @code{with} clauses (similar to the usage of pragma
7146 @code{Elaborate_All}. The effect is to suppress warnings about unreferenced
7147 units and unreferenced entities within these units.
7149 @node Pragma Unreferenced_Objects
7150 @unnumberedsec Pragma Unreferenced_Objects
7151 @findex Unreferenced_Objects
7152 @cindex Warnings, unreferenced
7153 @noindent
7154 Syntax:
7156 @smallexample @c ada
7157 pragma Unreferenced_Objects (local_subtype_NAME @{, local_subtype_NAME@});
7158 @end smallexample
7160 @noindent
7161 This pragma signals that for the types or subtypes whose names are
7162 listed, objects which are declared with one of these types or subtypes may
7163 not be referenced, and if no references appear, no warnings are given.
7165 This is particularly useful for objects which are declared solely for their
7166 initialization and finalization effect. Such variables are sometimes referred
7167 to as RAII variables (Resource Acquisition Is Initialization). Using this
7168 pragma on the relevant type (most typically a limited controlled type), the
7169 compiler will automatically suppress unwanted warnings about these variables
7170 not being referenced.
7172 @node Pragma Unreserve_All_Interrupts
7173 @unnumberedsec Pragma Unreserve_All_Interrupts
7174 @findex Unreserve_All_Interrupts
7175 @noindent
7176 Syntax:
7178 @smallexample @c ada
7179 pragma Unreserve_All_Interrupts;
7180 @end smallexample
7182 @noindent
7183 Normally certain interrupts are reserved to the implementation.  Any attempt
7184 to attach an interrupt causes Program_Error to be raised, as described in
7185 RM C.3.2(22).  A typical example is the @code{SIGINT} interrupt used in
7186 many systems for a @kbd{Ctrl-C} interrupt.  Normally this interrupt is
7187 reserved to the implementation, so that @kbd{Ctrl-C} can be used to
7188 interrupt execution.
7190 If the pragma @code{Unreserve_All_Interrupts} appears anywhere in any unit in
7191 a program, then all such interrupts are unreserved.  This allows the
7192 program to handle these interrupts, but disables their standard
7193 functions.  For example, if this pragma is used, then pressing
7194 @kbd{Ctrl-C} will not automatically interrupt execution.  However,
7195 a program can then handle the @code{SIGINT} interrupt as it chooses.
7197 For a full list of the interrupts handled in a specific implementation,
7198 see the source code for the spec of @code{Ada.Interrupts.Names} in
7199 file @file{a-intnam.ads}.  This is a target dependent file that contains the
7200 list of interrupts recognized for a given target.  The documentation in
7201 this file also specifies what interrupts are affected by the use of
7202 the @code{Unreserve_All_Interrupts} pragma.
7204 For a more general facility for controlling what interrupts can be
7205 handled, see pragma @code{Interrupt_State}, which subsumes the functionality
7206 of the @code{Unreserve_All_Interrupts} pragma.
7208 @node Pragma Unsuppress
7209 @unnumberedsec Pragma Unsuppress
7210 @findex Unsuppress
7211 @noindent
7212 Syntax:
7214 @smallexample @c ada
7215 pragma Unsuppress (IDENTIFIER [, [On =>] NAME]);
7216 @end smallexample
7218 @noindent
7219 This pragma undoes the effect of a previous pragma @code{Suppress}.  If
7220 there is no corresponding pragma @code{Suppress} in effect, it has no
7221 effect.  The range of the effect is the same as for pragma
7222 @code{Suppress}.  The meaning of the arguments is identical to that used
7223 in pragma @code{Suppress}.
7225 One important application is to ensure that checks are on in cases where
7226 code depends on the checks for its correct functioning, so that the code
7227 will compile correctly even if the compiler switches are set to suppress
7228 checks.
7230 This pragma is standard in Ada 2005. It is available in all earlier versions
7231 of Ada as an implementation-defined pragma.
7233 Note that in addition to the checks defined in the Ada RM, GNAT recogizes
7234 a number of implementation-defined check names. See description of pragma
7235 @code{Suppress} for full details.
7237 @node Pragma Use_VADS_Size
7238 @unnumberedsec Pragma Use_VADS_Size
7239 @cindex @code{Size}, VADS compatibility
7240 @cindex Rational profile
7241 @findex Use_VADS_Size
7242 @noindent
7243 Syntax:
7245 @smallexample @c ada
7246 pragma Use_VADS_Size;
7247 @end smallexample
7249 @noindent
7250 This is a configuration pragma.  In a unit to which it applies, any use
7251 of the 'Size attribute is automatically interpreted as a use of the
7252 'VADS_Size attribute.  Note that this may result in incorrect semantic
7253 processing of valid Ada 95 or Ada 2005 programs.  This is intended to aid in
7254 the handling of existing code which depends on the interpretation of Size
7255 as implemented in the VADS compiler.  See description of the VADS_Size
7256 attribute for further details.
7258 @node Pragma Validity_Checks
7259 @unnumberedsec Pragma Validity_Checks
7260 @findex Validity_Checks
7261 @noindent
7262 Syntax:
7264 @smallexample @c ada
7265 pragma Validity_Checks (string_LITERAL | ALL_CHECKS | On | Off);
7266 @end smallexample
7268 @noindent
7269 This pragma is used in conjunction with compiler switches to control the
7270 built-in validity checking provided by GNAT@.  The compiler switches, if set
7271 provide an initial setting for the switches, and this pragma may be used
7272 to modify these settings, or the settings may be provided entirely by
7273 the use of the pragma.  This pragma can be used anywhere that a pragma
7274 is legal, including use as a configuration pragma (including use in
7275 the @file{gnat.adc} file).
7277 The form with a string literal specifies which validity options are to be
7278 activated.  The validity checks are first set to include only the default
7279 reference manual settings, and then a string of letters in the string
7280 specifies the exact set of options required.  The form of this string
7281 is exactly as described for the @option{-gnatVx} compiler switch (see the
7282 @value{EDITION} User's Guide for details).  For example the following two
7283 methods can be used to enable validity checking for mode @code{in} and
7284 @code{in out} subprogram parameters:
7286 @itemize @bullet
7287 @item
7288 @smallexample @c ada
7289 pragma Validity_Checks ("im");
7290 @end smallexample
7292 @item
7293 @smallexample
7294 gcc -c -gnatVim @dots{}
7295 @end smallexample
7296 @end itemize
7298 @noindent
7299 The form ALL_CHECKS activates all standard checks (its use is equivalent
7300 to the use of the @code{gnatva} switch.
7302 The forms with @code{Off} and @code{On}
7303 can be used to temporarily disable validity checks
7304 as shown in the following example:
7306 @smallexample @c ada
7307 @iftex
7308 @leftskip=0cm
7309 @end iftex
7310 pragma Validity_Checks ("c"); -- validity checks for copies
7311 pragma Validity_Checks (Off); -- turn off validity checks
7312 A := B;                       -- B will not be validity checked
7313 pragma Validity_Checks (On);  -- turn validity checks back on
7314 A := C;                       -- C will be validity checked
7315 @end smallexample
7317 @node Pragma Volatile
7318 @unnumberedsec Pragma Volatile
7319 @findex Volatile
7320 @noindent
7321 Syntax:
7323 @smallexample @c ada
7324 pragma Volatile (LOCAL_NAME);
7325 @end smallexample
7327 @noindent
7328 This pragma is defined by the Ada Reference Manual, and the GNAT
7329 implementation is fully conformant with this definition.  The reason it
7330 is mentioned in this section is that a pragma of the same name was supplied
7331 in some Ada 83 compilers, including DEC Ada 83.  The Ada 95 / Ada 2005
7332 implementation of pragma Volatile is upwards compatible with the
7333 implementation in DEC Ada 83.
7335 @node Pragma Warnings
7336 @unnumberedsec Pragma Warnings
7337 @findex Warnings
7338 @noindent
7339 Syntax:
7341 @smallexample @c ada
7342 pragma Warnings (On | Off [,REASON]);
7343 pragma Warnings (On | Off, LOCAL_NAME [,REASON]);
7344 pragma Warnings (static_string_EXPRESSION [,REASON]);
7345 pragma Warnings (On | Off, static_string_EXPRESSION [,REASON]);
7347 REASON ::= Reason => static_string_EXPRESSION
7348 @end smallexample
7350 @noindent
7351 Normally warnings are enabled, with the output being controlled by
7352 the command line switch.  Warnings (@code{Off}) turns off generation of
7353 warnings until a Warnings (@code{On}) is encountered or the end of the
7354 current unit.  If generation of warnings is turned off using this
7355 pragma, then some or all of the warning messages are suppressed,
7356 regardless of the setting of the command line switches.
7358 The @code{Reason} parameter may optionally appear as the last argument
7359 in any of the forms of this pragma. It is intended purely for the
7360 purposes of documenting the reason for the @code{Warnings} pragma.
7361 The compiler will check that the argument is a static string but
7362 otherwise ignore this argument. Other tools may provide specialized
7363 processing for this string.
7365 The form with a single argument (or two arguments if Reason present),
7366 where the first argument is @code{ON} or @code{OFF}
7367 may be used as a configuration pragma.
7369 If the @var{LOCAL_NAME} parameter is present, warnings are suppressed for
7370 the specified entity.  This suppression is effective from the point where
7371 it occurs till the end of the extended scope of the variable (similar to
7372 the scope of @code{Suppress}). This form cannot be used as a configuration
7373 pragma.
7375 The form with a single static_string_EXPRESSION argument (and possible
7376 reason) provides more precise
7377 control over which warnings are active. The string is a list of letters
7378 specifying which warnings are to be activated and which deactivated. The
7379 code for these letters is the same as the string used in the command
7380 line switch controlling warnings. For a brief summary, use the gnatmake
7381 command with no arguments, which will generate usage information containing
7382 the list of warnings switches supported. For
7383 full details see @ref{Warning Message Control,,, gnat_ugn, @value{EDITION}
7384 User's Guide}. This form can also be used as a configuration pragma.
7386 @noindent
7387 The warnings controlled by the `-gnatw' switch are generated by the front end
7388 of the compiler. The `GCC' back end can provide additional warnings and they
7389 are controlled by the `-W' switch.
7390 The form with a single static_string_EXPRESSION argument also works for the
7391 latters, but the string must be a single full `-W' switch in this case.
7392 The above reference lists a few examples of these additional warnings.
7394 @noindent
7395 The specified warnings will be in effect until the end of the program
7396 or another pragma Warnings is encountered. The effect of the pragma is
7397 cumulative. Initially the set of warnings is the standard default set
7398 as possibly modified by compiler switches. Then each pragma Warning
7399 modifies this set of warnings as specified. This form of the pragma may
7400 also be used as a configuration pragma.
7402 The fourth form, with an @code{On|Off} parameter and a string, is used to
7403 control individual messages, based on their text. The string argument
7404 is a pattern that is used to match against the text of individual
7405 warning messages (not including the initial "warning: " tag).
7407 The pattern may contain asterisks, which match zero or more characters in
7408 the message. For example, you can use
7409 @code{pragma Warnings (Off, "*bits of*unused")} to suppress the warning
7410 message @code{warning: 960 bits of "a" unused}. No other regular
7411 expression notations are permitted. All characters other than asterisk in
7412 these three specific cases are treated as literal characters in the match.
7414 The above use of patterns to match the message applies only to warning
7415 messages generated by the front end. This form of the pragma with a
7416 string argument can also be used to control back end warnings controlled
7417 by a "-Wxxx" switch. Such warnings can be identified by the appearance
7418 of a string of the form "[-Wxxx]" in the message which identifies the
7419 "-W" switch that controls the message. By using the text of the
7420 "-W" switch in the pragma, such back end warnings can be turned on and off.
7422 There are two ways to use the pragma in this form. The OFF form can be used as a
7423 configuration pragma. The effect is to suppress all warnings (if any)
7424 that match the pattern string throughout the compilation (or match the
7425 -W switch in the back end case).
7427 The second usage is to suppress a warning locally, and in this case, two
7428 pragmas must appear in sequence:
7430 @smallexample @c ada
7431 pragma Warnings (Off, Pattern);
7432 @dots{} code where given warning is to be suppressed
7433 pragma Warnings (On, Pattern);
7434 @end smallexample
7436 @noindent
7437 In this usage, the pattern string must match in the Off and On pragmas,
7438 and at least one matching warning must be suppressed.
7440 Note: to write a string that will match any warning, use the string
7441 @code{"***"}. It will not work to use a single asterisk or two asterisks
7442 since this looks like an operator name. This form with three asterisks
7443 is similar in effect to specifying @code{pragma Warnings (Off)} except that a
7444 matching @code{pragma Warnings (On, "***")} will be required. This can be
7445 helpful in avoiding forgetting to turn warnings back on.
7447 Note: the debug flag -gnatd.i (@code{/NOWARNINGS_PRAGMAS} in VMS) can be
7448 used to cause the compiler to entirely ignore all WARNINGS pragmas. This can
7449 be useful in checking whether obsolete pragmas in existing programs are hiding
7450 real problems.
7452 Note: pragma Warnings does not affect the processing of style messages. See
7453 separate entry for pragma Style_Checks for control of style messages.
7455 @node Pragma Weak_External
7456 @unnumberedsec Pragma Weak_External
7457 @findex Weak_External
7458 @noindent
7459 Syntax:
7461 @smallexample @c ada
7462 pragma Weak_External ([Entity =>] LOCAL_NAME);
7463 @end smallexample
7465 @noindent
7466 @var{LOCAL_NAME} must refer to an object that is declared at the library
7467 level. This pragma specifies that the given entity should be marked as a
7468 weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
7469 in GNU C and causes @var{LOCAL_NAME} to be emitted as a weak symbol instead
7470 of a regular symbol, that is to say a symbol that does not have to be
7471 resolved by the linker if used in conjunction with a pragma Import.
7473 When a weak symbol is not resolved by the linker, its address is set to
7474 zero. This is useful in writing interfaces to external modules that may
7475 or may not be linked in the final executable, for example depending on
7476 configuration settings.
7478 If a program references at run time an entity to which this pragma has been
7479 applied, and the corresponding symbol was not resolved at link time, then
7480 the execution of the program is erroneous. It is not erroneous to take the
7481 Address of such an entity, for example to guard potential references,
7482 as shown in the example below.
7484 Some file formats do not support weak symbols so not all target machines
7485 support this pragma.
7487 @smallexample @c ada
7488 --  Example of the use of pragma Weak_External
7490 package External_Module is
7491   key : Integer;
7492   pragma Import (C, key);
7493   pragma Weak_External (key);
7494   function Present return boolean;
7495 end External_Module;
7497 with System; use System;
7498 package body External_Module is
7499   function Present return boolean is
7500   begin
7501     return key'Address /= System.Null_Address;
7502   end Present;
7503 end External_Module;
7504 @end smallexample
7506 @node Pragma Wide_Character_Encoding
7507 @unnumberedsec Pragma Wide_Character_Encoding
7508 @findex Wide_Character_Encoding
7509 @noindent
7510 Syntax:
7512 @smallexample @c ada
7513 pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
7514 @end smallexample
7516 @noindent
7517 This pragma specifies the wide character encoding to be used in program
7518 source text appearing subsequently. It is a configuration pragma, but may
7519 also be used at any point that a pragma is allowed, and it is permissible
7520 to have more than one such pragma in a file, allowing multiple encodings
7521 to appear within the same file.
7523 The argument can be an identifier or a character literal. In the identifier
7524 case, it is one of @code{HEX}, @code{UPPER}, @code{SHIFT_JIS},
7525 @code{EUC}, @code{UTF8}, or @code{BRACKETS}. In the character literal
7526 case it is correspondingly one of the characters @samp{h}, @samp{u},
7527 @samp{s}, @samp{e}, @samp{8}, or @samp{b}.
7529 Note that when the pragma is used within a file, it affects only the
7530 encoding within that file, and does not affect withed units, specs,
7531 or subunits.
7533 @node Implementation Defined Aspects
7534 @chapter Implementation Defined Aspects
7535 Ada defines (throughout the Ada 2012 reference manual, summarized
7536 in annex K) a set of aspects that can be specified for certain entities.
7537 These language defined aspects are implemented in GNAT in Ada 2012 mode
7538 and work as described in the Ada 2012 Reference Manual.
7540 In addition, Ada 2012 allows implementations to define additional aspects
7541 whose meaning is defined by the implementation.  GNAT provides
7542 a number of these implementation-dependent aspects which can be used
7543 to extend and enhance the functionality of the compiler.  This section of
7544 the GNAT reference manual describes these additional attributes.
7546 Note that any program using these aspects may not be portable to
7547 other compilers (although GNAT implements this set of aspects on all
7548 platforms).  Therefore if portability to other compilers is an important
7549 consideration, you should minimize the use of these aspects.
7551 Note that for many of these aspects, the effect is essentially similar
7552 to the use of a pragma or attribute specification with the same name
7553 applied to the entity. For example, if we write:
7555 @smallexample @c ada
7556 type R is range 1 .. 100
7557   with Value_Size => 10;
7558 @end smallexample
7560 @noindent
7561 then the effect is the same as:
7563 @smallexample @c ada
7564 type R is range 1 .. 100;
7565 for R'Value_Size use 10;
7566 @end smallexample
7568 @noindent
7569 and if we write:
7571 @smallexample @c ada
7572 type R is new Integer
7573   with Shared => True;
7574 @end smallexample
7576 @noindent
7577 then the effect is the same as:
7579 @smallexample @c ada
7580 type R is new Integer;
7581 pragma Shared (R);
7582 @end smallexample
7584 @noindent
7585 In the documentation sections that follow, such cases are simply marked
7586 as being equivalent to the corresponding pragma or attribute definition
7587 clause.
7589 @menu
7590 * Aspect Abstract_State::
7591 * Aspect Ada_2005::
7592 * Aspect Ada_2012::
7593 * Aspect Compiler_Unit::
7594 * Aspect Contract_Cases::
7595 * Aspect Depends::
7596 * Aspect Dimension::
7597 * Aspect Dimension_System::
7598 * Aspect Favor_Top_Level::
7599 * Aspect Global::
7600 * Aspect Initial_Condition::
7601 * Aspect Initializes::
7602 * Aspect Inline_Always::
7603 * Aspect Invariant::
7604 * Aspect Linker_Section::
7605 * Aspect Lock_Free::
7606 * Aspect Object_Size::
7607 * Aspect Persistent_BSS::
7608 * Aspect Predicate::
7609 * Aspect Preelaborate_05::
7610 * Aspect Pure_05::
7611 * Aspect Pure_12::
7612 * Aspect Pure_Function::
7613 * Aspect Refined_State::
7614 * Aspect Remote_Access_Type::
7615 * Aspect Scalar_Storage_Order::
7616 * Aspect Shared::
7617 * Aspect Simple_Storage_Pool::
7618 * Aspect Simple_Storage_Pool_Type::
7619 * Aspect SPARK_Mode::
7620 * Aspect Suppress_Debug_Info::
7621 * Aspect Test_Case::
7622 * Aspect Universal_Aliasing::
7623 * Aspect Universal_Data::
7624 * Aspect Unmodified::
7625 * Aspect Unreferenced::
7626 * Aspect Unreferenced_Objects::
7627 * Aspect Value_Size::
7628 * Aspect Warnings::
7629 @end menu
7631 @node Aspect Abstract_State
7632 @unnumberedsec Aspect Abstract_State
7633 @findex Abstract_State
7634 @noindent
7635 This aspect is equivalent to pragma @code{Abstract_State}.
7637 @node Aspect Ada_2005
7638 @unnumberedsec Aspect Ada_2005
7639 @findex Ada_2005
7640 @noindent
7641 This aspect is equivalent to the one argument form of pragma @code{Ada_2005}.
7643 @node Aspect Ada_2012
7644 @unnumberedsec Aspect Ada_2012
7645 @findex Ada_2012
7646 @noindent
7647 This aspect is equivalent to the one argument form of pragma @code{Ada_2012}.
7649 @node Aspect Compiler_Unit
7650 @unnumberedsec Aspect Compiler_Unit
7651 @findex Compiler_Unit
7652 @noindent
7653 This aspect is equivalent to pragma @code{Compiler_Unit}.
7655 @node Aspect Contract_Cases
7656 @unnumberedsec Aspect Contract_Cases
7657 @findex Contract_Cases
7658 @noindent
7659 This aspect is equivalent to pragma @code{Contract_Cases}, the sequence
7660 of clauses being enclosed in parentheses so that syntactically it is an
7661 aggregate.
7663 @node Aspect Depends
7664 @unnumberedsec Aspect Depends
7665 @findex Depends
7666 @noindent
7667 This aspect is equivalent to pragma @code{Depends}.
7669 * Dimension::
7671 @node Aspect Dimension
7672 @unnumberedsec Aspect Dimension
7673 @findex Dimension
7674 @noindent
7675 The @code{Dimension} aspect is used to specify the dimensions of a given
7676 subtype of a dimensioned numeric type. The aspect also specifies a symbol
7677 used when doing formatted output of dimensioned quantities. The syntax is:
7679 @smallexample @c ada
7680 with Dimension =>
7681   ([Symbol =>] SYMBOL, DIMENSION_VALUE @{, DIMENSION_Value@})
7683 SYMBOL ::= STRING_LITERAL | CHARACTER_LITERAL
7685 DIMENSION_VALUE ::=
7686   RATIONAL
7687 | others               => RATIONAL
7688 | DISCRETE_CHOICE_LIST => RATIONAL
7690 RATIONAL ::= [-] NUMERIC_LITERAL [/ NUMERIC_LITERAL]
7691 @end smallexample
7693 @noindent
7694 This aspect can only be applied to a subtype whose parent type has
7695 a @code{Dimension_Systen} aspect. The aspect must specify values for
7696 all dimensions of the system. The rational values are the powers of the
7697 corresponding dimensions that are used by the compiler to verify that
7698 physical (numeric) computations are dimensionally consistent. For example,
7699 the computation of a force must result in dimensions (L => 1, M => 1, T => -2).
7700 For further examples of the usage
7701 of this aspect, see package @code{System.Dim.Mks}.
7702 Note that when the dimensioned type is an integer type, then any
7703 dimension value must be an integer literal.
7705 @node Aspect Dimension_System
7706 @unnumberedsec Aspect Dimension_System
7707 @findex Dimension_System
7708 @noindent
7709 The @code{Dimension_System} aspect is used to define a system of
7710 dimensions that will be used in subsequent subtype declarations with
7711 @code{Dimension} aspects that reference this system. The syntax is:
7713 @smallexample @c ada
7714 with Dimension_System => (DIMENSION @{, DIMENSION@});
7716 DIMENSION ::= ([Unit_Name   =>] IDENTIFIER,
7717                [Unit_Symbol =>] SYMBOL,
7718                [Dim_Symbol  =>] SYMBOL)
7720 SYMBOL ::= CHARACTER_LITERAL | STRING_LITERAL
7721 @end smallexample
7723 @noindent
7724 This aspect is applied to a type, which must be a numeric derived type
7725 (typically a floating-point type), that
7726 will represent values within the dimension system. Each @code{DIMENSION}
7727 corresponds to one particular dimension. A maximum of 7 dimensions may
7728 be specified. @code{Unit_Name} is the name of the dimension (for example
7729 @code{Meter}). @code{Unit_Symbol} is the shorthand used for quantities
7730 of this dimension (for example 'm' for Meter). @code{Dim_Symbol} gives
7731 the identification within the dimension system (typically this is a
7732 single letter, e.g. 'L' standing for length for unit name Meter). The
7733 Unit_Smbol is used in formatted output of dimensioned quantities. The
7734 Dim_Symbol is used in error messages when numeric operations have
7735 inconsistent dimensions.
7737 GNAT provides the standard definition of the International MKS system in
7738 the run-time package @code{System.Dim.Mks}. You can easily define
7739 similar packages for cgs units or British units, and define conversion factors
7740 between values in different systems. The MKS system is characterized by the
7741 following aspect:
7743 @smallexample @c ada
7744    type Mks_Type is new Long_Long_Float
7745      with
7746       Dimension_System => (
7747         (Unit_Name => Meter,    Unit_Symbol => 'm',   Dim_Symbol => 'L'),
7748         (Unit_Name => Kilogram, Unit_Symbol => "kg",  Dim_Symbol => 'M'),
7749         (Unit_Name => Second,   Unit_Symbol => 's',   Dim_Symbol => 'T'),
7750         (Unit_Name => Ampere,   Unit_Symbol => 'A',   Dim_Symbol => 'I'),
7751         (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => "Theta"),
7752         (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
7753         (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
7754 @end smallexample
7756 @noindent
7757 See section "Performing Dimensionality Analysis in GNAT" in the GNAT Users
7758 Guide for detailed examples of use of the dimension system.
7760 @node Aspect Favor_Top_Level
7761 @unnumberedsec Aspect Favor_Top_Level
7762 @findex Favor_Top_Level
7763 @noindent
7764 This aspect is equivalent to pragma @code{Favor_Top_Level}.
7766 @node Aspect Global
7767 @unnumberedsec Aspect Global
7768 @findex Global
7769 @noindent
7770 This aspect is equivalent to pragma @code{Global}.
7772 @node Aspect Initial_Condition
7773 @unnumberedsec Aspect Initial_Condition
7774 @findex Initial_Condition
7775 @noindent
7776 This aspect is equivalent to pragma @code{Initial_Condition}.
7778 @node Aspect Initializes
7779 @unnumberedsec Aspect Initializes
7780 @findex Initializes
7781 @noindent
7782 This aspect is equivalent to pragma @code{Initializes}.
7784 @node Aspect Inline_Always
7785 @unnumberedsec Aspect Inline_Always
7786 @findex Inline_Always
7787 @noindent
7788 This aspect is equivalent to pragma @code{Inline_Always}.
7790 @node Aspect Invariant
7791 @unnumberedsec Aspect Invariant
7792 @findex Invariant
7793 @noindent
7794 This aspect is equivalent to pragma @code{Invariant}. It is a
7795 synonym for the language defined aspect @code{Type_Invariant} except
7796 that it is separately controllable using pragma @code{Assertion_Policy}.
7798 @node Aspect Linker_Section
7799 @unnumberedsec Aspect Linker_Section
7800 @findex Linker_Section
7801 @noindent
7802 This aspect is equivalent to an @code{Linker_Section} pragma.
7804 @node Aspect Lock_Free
7805 @unnumberedsec Aspect Lock_Free
7806 @findex Lock_Free
7807 @noindent
7808 This aspect is equivalent to pragma @code{Lock_Free}.
7810 @node Aspect Object_Size
7811 @unnumberedsec Aspect Object_Size
7812 @findex Object_Size
7813 @noindent
7814 This aspect is equivalent to an @code{Object_Size} attribute definition
7815 clause.
7817 @node Aspect Persistent_BSS
7818 @unnumberedsec Aspect Persistent_BSS
7819 @findex Persistent_BSS
7820 @noindent
7821 This aspect is equivalent to pragma @code{Persistent_BSS}.
7823 @node Aspect Predicate
7824 @unnumberedsec Aspect Predicate
7825 @findex Predicate
7826 @noindent
7827 This aspect is equivalent to pragma @code{Predicate}. It is thus
7828 similar to the language defined aspects @code{Dynamic_Predicate}
7829 and @code{Static_Predicate} except that whether the resulting
7830 predicate is static or dynamic is controlled by the form of the
7831 expression. It is also separately controllable using pragma
7832 @code{Assertion_Policy}.
7834 @node Aspect Preelaborate_05
7835 @unnumberedsec Aspect Preelaborate_05
7836 @findex Preelaborate_05
7837 @noindent
7838 This aspect is equivalent to pragma @code{Preelaborate_05}.
7840 @node Aspect Pure_05
7841 @unnumberedsec Aspect Pure_05
7842 @findex Pure_05
7843 @noindent
7844 This aspect is equivalent to pragma @code{Pure_05}.
7846 @node Aspect Pure_12
7847 @unnumberedsec Aspect Pure_12
7848 @findex Pure_12
7849 @noindent
7850 This aspect is equivalent to pragma @code{Pure_12}.
7852 @node Aspect Pure_Function
7853 @unnumberedsec Aspect Pure_Function
7854 @findex Pure_Function
7855 @noindent
7856 This aspect is equivalent to pragma @code{Pure_Function}.
7858 @node Aspect Refined_State
7859 @unnumberedsec Aspect Refined_State
7860 @findex Refined_State
7861 @noindent
7862 This aspect is equivalent to pragma @code{Refined_State}.
7864 @node Aspect Remote_Access_Type
7865 @unnumberedsec Aspect Remote_Access_Type
7866 @findex Remote_Access_Type
7867 @noindent
7868 This aspect is equivalent to pragma @code{Remote_Access_Type}.
7870 @node Aspect Scalar_Storage_Order
7871 @unnumberedsec Aspect Scalar_Storage_Order
7872 @findex Scalar_Storage_Order
7873 @noindent
7874 This aspect is equivalent to a @code{Scalar_Storage_Order}
7875 attribute definition clause.
7877 @node Aspect Shared
7878 @unnumberedsec Aspect Shared
7879 @findex Shared
7880 @noindent
7881 This aspect is equivalent to pragma @code{Shared}, and is thus a synonym
7882 for aspect @code{Atomic}.
7884 @node Aspect Simple_Storage_Pool
7885 @unnumberedsec Aspect Simple_Storage_Pool
7886 @findex Simple_Storage_Pool
7887 @noindent
7888 This aspect is equivalent to a @code{Simple_Storage_Pool}
7889 attribute definition clause.
7891 @node Aspect Simple_Storage_Pool_Type
7892 @unnumberedsec Aspect Simple_Storage_Pool_Type
7893 @findex Simple_Storage_Pool_Type
7894 @noindent
7895 This aspect is equivalent to pragma @code{Simple_Storage_Pool_Type}.
7897 @node Aspect SPARK_Mode
7898 @unnumberedsec Aspect SPARK_Mode
7899 @findex SPARK_Mode
7900 @noindent
7901 This aspect is equivalent to pragma @code{SPARK_Mode} and
7902 may be specified for either or both of the specification and body
7903 of a subprogram or package.
7905 @node Aspect Suppress_Debug_Info
7906 @unnumberedsec Aspect Suppress_Debug_Info
7907 @findex Suppress_Debug_Info
7908 @noindent
7909 This aspect is equivalent to pragma @code{Suppress_Debug_Info}.
7911 @node Aspect Test_Case
7912 @unnumberedsec Aspect Test_Case
7913 @findex Test_Case
7914 @noindent
7915 This aspect is equivalent to pragma @code{Test_Case}.
7917 @node Aspect Universal_Aliasing
7918 @unnumberedsec Aspect Universal_Aliasing
7919 @findex Universal_Aliasing
7920 @noindent
7921 This aspect is equivalent to pragma @code{Universal_Aliasing}.
7923 @node Aspect Universal_Data
7924 @unnumberedsec Aspect Universal_Data
7925 @findex Universal_Data
7926 @noindent
7927 This aspect is equivalent to pragma @code{Universal_Data}.
7929 @node Aspect Unmodified
7930 @unnumberedsec Aspect Unmodified
7931 @findex Unmodified
7932 @noindent
7933 This aspect is equivalent to pragma @code{Unmodified}.
7935 @node Aspect Unreferenced
7936 @unnumberedsec Aspect Unreferenced
7937 @findex Unreferenced
7938 @noindent
7939 This aspect is equivalent to pragma @code{Unreferenced}.
7941 @node Aspect Unreferenced_Objects
7942 @unnumberedsec Aspect Unreferenced_Objects
7943 @findex Unreferenced_Objects
7944 @noindent
7945 This aspect is equivalent to pragma @code{Unreferenced_Objects}.
7947 @node Aspect Value_Size
7948 @unnumberedsec Aspect Value_Size
7949 @findex Value_Size
7950 @noindent
7951 This aspect is equivalent to a @code{Value_Size}
7952 attribute definition clause.
7954 @node Aspect Warnings
7955 @unnumberedsec Aspect Warnings
7956 @findex Warnings
7957 @noindent
7958 This aspect is equivalent to the two argument form of pragma @code{Warnings},
7959 where the first argument is @code{ON} or @code{OFF} and the second argument
7960 is the entity.
7962 @node Implementation Defined Attributes
7963 @chapter Implementation Defined Attributes
7964 Ada defines (throughout the Ada reference manual,
7965 summarized in Annex K),
7966 a set of attributes that provide useful additional functionality in all
7967 areas of the language.  These language defined attributes are implemented
7968 in GNAT and work as described in the Ada Reference Manual.
7970 In addition, Ada allows implementations to define additional
7971 attributes whose meaning is defined by the implementation.  GNAT provides
7972 a number of these implementation-dependent attributes which can be used
7973 to extend and enhance the functionality of the compiler.  This section of
7974 the GNAT reference manual describes these additional attributes.
7976 Note that any program using these attributes may not be portable to
7977 other compilers (although GNAT implements this set of attributes on all
7978 platforms).  Therefore if portability to other compilers is an important
7979 consideration, you should minimize the use of these attributes.
7981 @menu
7982 * Attribute Abort_Signal::
7983 * Attribute Address_Size::
7984 * Attribute Asm_Input::
7985 * Attribute Asm_Output::
7986 * Attribute AST_Entry::
7987 * Attribute Bit::
7988 * Attribute Bit_Position::
7989 * Attribute Compiler_Version::
7990 * Attribute Code_Address::
7991 * Attribute Default_Bit_Order::
7992 * Attribute Descriptor_Size::
7993 * Attribute Elaborated::
7994 * Attribute Elab_Body::
7995 * Attribute Elab_Spec::
7996 * Attribute Elab_Subp_Body::
7997 * Attribute Emax::
7998 * Attribute Enabled::
7999 * Attribute Enum_Rep::
8000 * Attribute Enum_Val::
8001 * Attribute Epsilon::
8002 * Attribute Fixed_Value::
8003 * Attribute Has_Access_Values::
8004 * Attribute Has_Discriminants::
8005 * Attribute Img::
8006 * Attribute Integer_Value::
8007 * Attribute Invalid_Value::
8008 * Attribute Large::
8009 * Attribute Library_Level::
8010 * Attribute Loop_Entry::
8011 * Attribute Machine_Size::
8012 * Attribute Mantissa::
8013 * Attribute Max_Interrupt_Priority::
8014 * Attribute Max_Priority::
8015 * Attribute Maximum_Alignment::
8016 * Attribute Mechanism_Code::
8017 * Attribute Null_Parameter::
8018 * Attribute Object_Size::
8019 * Attribute Passed_By_Reference::
8020 * Attribute Pool_Address::
8021 * Attribute Range_Length::
8022 * Attribute Ref::
8023 * Attribute Restriction_Set::
8024 * Attribute Result::
8025 * Attribute Safe_Emax::
8026 * Attribute Safe_Large::
8027 * Attribute Scalar_Storage_Order::
8028 * Attribute Simple_Storage_Pool::
8029 * Attribute Small::
8030 * Attribute Storage_Unit::
8031 * Attribute Stub_Type::
8032 * Attribute System_Allocator_Alignment::
8033 * Attribute Target_Name::
8034 * Attribute Tick::
8035 * Attribute To_Address::
8036 * Attribute Type_Class::
8037 * Attribute UET_Address::
8038 * Attribute Unconstrained_Array::
8039 * Attribute Universal_Literal_String::
8040 * Attribute Unrestricted_Access::
8041 * Attribute Update::
8042 * Attribute Valid_Scalars::
8043 * Attribute VADS_Size::
8044 * Attribute Value_Size::
8045 * Attribute Wchar_T_Size::
8046 * Attribute Word_Size::
8047 @end menu
8049 @node Attribute Abort_Signal
8050 @unnumberedsec Attribute Abort_Signal
8051 @findex Abort_Signal
8052 @noindent
8053 @code{Standard'Abort_Signal} (@code{Standard} is the only allowed
8054 prefix) provides the entity for the special exception used to signal
8055 task abort or asynchronous transfer of control.  Normally this attribute
8056 should only be used in the tasking runtime (it is highly peculiar, and
8057 completely outside the normal semantics of Ada, for a user program to
8058 intercept the abort exception).
8060 @node Attribute Address_Size
8061 @unnumberedsec Attribute Address_Size
8062 @cindex Size of @code{Address}
8063 @findex Address_Size
8064 @noindent
8065 @code{Standard'Address_Size} (@code{Standard} is the only allowed
8066 prefix) is a static constant giving the number of bits in an
8067 @code{Address}. It is the same value as System.Address'Size,
8068 but has the advantage of being static, while a direct
8069 reference to System.Address'Size is non-static because Address
8070 is a private type.
8072 @node Attribute Asm_Input
8073 @unnumberedsec Attribute Asm_Input
8074 @findex Asm_Input
8075 @noindent
8076 The @code{Asm_Input} attribute denotes a function that takes two
8077 parameters.  The first is a string, the second is an expression of the
8078 type designated by the prefix.  The first (string) argument is required
8079 to be a static expression, and is the constraint for the parameter,
8080 (e.g.@: what kind of register is required).  The second argument is the
8081 value to be used as the input argument.  The possible values for the
8082 constant are the same as those used in the RTL, and are dependent on
8083 the configuration file used to built the GCC back end.
8084 @ref{Machine Code Insertions}
8086 @node Attribute Asm_Output
8087 @unnumberedsec Attribute Asm_Output
8088 @findex Asm_Output
8089 @noindent
8090 The @code{Asm_Output} attribute denotes a function that takes two
8091 parameters.  The first is a string, the second is the name of a variable
8092 of the type designated by the attribute prefix.  The first (string)
8093 argument is required to be a static expression and designates the
8094 constraint for the parameter (e.g.@: what kind of register is
8095 required).  The second argument is the variable to be updated with the
8096 result.  The possible values for constraint are the same as those used in
8097 the RTL, and are dependent on the configuration file used to build the
8098 GCC back end.  If there are no output operands, then this argument may
8099 either be omitted, or explicitly given as @code{No_Output_Operands}.
8100 @ref{Machine Code Insertions}
8102 @node Attribute AST_Entry
8103 @unnumberedsec Attribute AST_Entry
8104 @cindex OpenVMS
8105 @findex AST_Entry
8106 @noindent
8107 This attribute is implemented only in OpenVMS versions of GNAT@.  Applied to
8108 the name of an entry, it yields a value of the predefined type AST_Handler
8109 (declared in the predefined package System, as extended by the use of
8110 pragma @code{Extend_System (Aux_DEC)}).  This value enables the given entry to
8111 be called when an AST occurs.  For further details, refer to the @cite{DEC Ada
8112 Language Reference Manual}, section 9.12a.
8114 @node Attribute Bit
8115 @unnumberedsec Attribute Bit
8116 @findex Bit
8117 @code{@var{obj}'Bit}, where @var{obj} is any object, yields the bit
8118 offset within the storage unit (byte) that contains the first bit of
8119 storage allocated for the object.  The value of this attribute is of the
8120 type @code{Universal_Integer}, and is always a non-negative number not
8121 exceeding the value of @code{System.Storage_Unit}.
8123 For an object that is a variable or a constant allocated in a register,
8124 the value is zero.  (The use of this attribute does not force the
8125 allocation of a variable to memory).
8127 For an object that is a formal parameter, this attribute applies
8128 to either the matching actual parameter or to a copy of the
8129 matching actual parameter.
8131 For an access object the value is zero.  Note that
8132 @code{@var{obj}.all'Bit} is subject to an @code{Access_Check} for the
8133 designated object.  Similarly for a record component
8134 @code{@var{X}.@var{C}'Bit} is subject to a discriminant check and
8135 @code{@var{X}(@var{I}).Bit} and @code{@var{X}(@var{I1}..@var{I2})'Bit}
8136 are subject to index checks.
8138 This attribute is designed to be compatible with the DEC Ada 83 definition
8139 and implementation of the @code{Bit} attribute.
8141 @node Attribute Bit_Position
8142 @unnumberedsec Attribute Bit_Position
8143 @findex Bit_Position
8144 @noindent
8145 @code{@var{R.C}'Bit_Position}, where @var{R} is a record object and C is one
8146 of the fields of the record type, yields the bit
8147 offset within the record contains the first bit of
8148 storage allocated for the object.  The value of this attribute is of the
8149 type @code{Universal_Integer}.  The value depends only on the field
8150 @var{C} and is independent of the alignment of
8151 the containing record @var{R}.
8153 @node Attribute Compiler_Version
8154 @unnumberedsec Attribute Compiler_Version
8155 @findex Compiler_Version
8156 @noindent
8157 @code{Standard'Compiler_Version} (@code{Standard} is the only allowed
8158 prefix) yields a static string identifying the version of the compiler
8159 being used to compile the unit containing the attribute reference. A
8160 typical result would be something like "@value{EDITION} @i{version} (20090221)".
8162 @node Attribute Code_Address
8163 @unnumberedsec Attribute Code_Address
8164 @findex Code_Address
8165 @cindex Subprogram address
8166 @cindex Address of subprogram code
8167 @noindent
8168 The @code{'Address}
8169 attribute may be applied to subprograms in Ada 95 and Ada 2005, but the
8170 intended effect seems to be to provide
8171 an address value which can be used to call the subprogram by means of
8172 an address clause as in the following example:
8174 @smallexample @c ada
8175 procedure K is @dots{}
8177 procedure L;
8178 for L'Address use K'Address;
8179 pragma Import (Ada, L);
8180 @end smallexample
8182 @noindent
8183 A call to @code{L} is then expected to result in a call to @code{K}@.
8184 In Ada 83, where there were no access-to-subprogram values, this was
8185 a common work-around for getting the effect of an indirect call.
8186 GNAT implements the above use of @code{Address} and the technique
8187 illustrated by the example code works correctly.
8189 However, for some purposes, it is useful to have the address of the start
8190 of the generated code for the subprogram.  On some architectures, this is
8191 not necessarily the same as the @code{Address} value described above.
8192 For example, the @code{Address} value may reference a subprogram
8193 descriptor rather than the subprogram itself.
8195 The @code{'Code_Address} attribute, which can only be applied to
8196 subprogram entities, always returns the address of the start of the
8197 generated code of the specified subprogram, which may or may not be
8198 the same value as is returned by the corresponding @code{'Address}
8199 attribute.
8201 @node Attribute Default_Bit_Order
8202 @unnumberedsec Attribute Default_Bit_Order
8203 @cindex Big endian
8204 @cindex Little endian
8205 @findex Default_Bit_Order
8206 @noindent
8207 @code{Standard'Default_Bit_Order} (@code{Standard} is the only
8208 permissible prefix), provides the value @code{System.Default_Bit_Order}
8209 as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
8210 @code{Low_Order_First}).  This is used to construct the definition of
8211 @code{Default_Bit_Order} in package @code{System}.
8213 @node Attribute Descriptor_Size
8214 @unnumberedsec Attribute Descriptor_Size
8215 @cindex Descriptor
8216 @cindex Dope vector
8217 @findex Descriptor_Size
8218 @noindent
8219 Non-static attribute @code{Descriptor_Size} returns the size in bits of the
8220 descriptor allocated for a type.  The result is non-zero only for unconstrained
8221 array types and the returned value is of type universal integer.  In GNAT, an
8222 array descriptor contains bounds information and is located immediately before
8223 the first element of the array.
8225 @smallexample @c ada
8226 type Unconstr_Array is array (Positive range <>) of Boolean;
8227 Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
8228 @end smallexample
8230 @noindent
8231 The attribute takes into account any additional padding due to type alignment.
8232 In the example above, the descriptor contains two values of type
8233 @code{Positive} representing the low and high bound.  Since @code{Positive} has
8234 a size of 31 bits and an alignment of 4, the descriptor size is @code{2 *
8235 Positive'Size + 2} or 64 bits.
8237 @node Attribute Elaborated
8238 @unnumberedsec Attribute Elaborated
8239 @findex Elaborated
8240 @noindent
8241 The prefix of the @code{'Elaborated} attribute must be a unit name.  The
8242 value is a Boolean which indicates whether or not the given unit has been
8243 elaborated.  This attribute is primarily intended for internal use by the
8244 generated code for dynamic elaboration checking, but it can also be used
8245 in user programs.  The value will always be True once elaboration of all
8246 units has been completed.  An exception is for units which need no
8247 elaboration, the value is always False for such units.
8249 @node Attribute Elab_Body
8250 @unnumberedsec Attribute Elab_Body
8251 @findex Elab_Body
8252 @noindent
8253 This attribute can only be applied to a program unit name.  It returns
8254 the entity for the corresponding elaboration procedure for elaborating
8255 the body of the referenced unit.  This is used in the main generated
8256 elaboration procedure by the binder and is not normally used in any
8257 other context.  However, there may be specialized situations in which it
8258 is useful to be able to call this elaboration procedure from Ada code,
8259 e.g.@: if it is necessary to do selective re-elaboration to fix some
8260 error.
8262 @node Attribute Elab_Spec
8263 @unnumberedsec Attribute Elab_Spec
8264 @findex Elab_Spec
8265 @noindent
8266 This attribute can only be applied to a program unit name.  It returns
8267 the entity for the corresponding elaboration procedure for elaborating
8268 the spec of the referenced unit.  This is used in the main
8269 generated elaboration procedure by the binder and is not normally used
8270 in any other context.  However, there may be specialized situations in
8271 which it is useful to be able to call this elaboration procedure from
8272 Ada code, e.g.@: if it is necessary to do selective re-elaboration to fix
8273 some error.
8275 @node Attribute Elab_Subp_Body
8276 @unnumberedsec Attribute Elab_Subp_Body
8277 @findex Elab_Subp_Body
8278 @noindent
8279 This attribute can only be applied to a library level subprogram
8280 name and is only allowed in CodePeer mode. It returns the entity
8281 for the corresponding elaboration procedure for elaborating the body
8282 of the referenced subprogram unit. This is used in the main generated
8283 elaboration procedure by the binder in CodePeer mode only and is unrecognized
8284 otherwise.
8286 @node Attribute Emax
8287 @unnumberedsec Attribute Emax
8288 @cindex Ada 83 attributes
8289 @findex Emax
8290 @noindent
8291 The @code{Emax} attribute is provided for compatibility with Ada 83.  See
8292 the Ada 83 reference manual for an exact description of the semantics of
8293 this attribute.
8295 @node Attribute Enabled
8296 @unnumberedsec Attribute Enabled
8297 @findex Enabled
8298 @noindent
8299 The @code{Enabled} attribute allows an application program to check at compile
8300 time to see if the designated check is currently enabled. The prefix is a
8301 simple identifier, referencing any predefined check name (other than
8302 @code{All_Checks}) or a check name introduced by pragma Check_Name. If
8303 no argument is given for the attribute, the check is for the general state
8304 of the check, if an argument is given, then it is an entity name, and the
8305 check indicates whether an @code{Suppress} or @code{Unsuppress} has been
8306 given naming the entity (if not, then the argument is ignored).
8308 Note that instantiations inherit the check status at the point of the
8309 instantiation, so a useful idiom is to have a library package that
8310 introduces a check name with @code{pragma Check_Name}, and then contains
8311 generic packages or subprograms which use the @code{Enabled} attribute
8312 to see if the check is enabled. A user of this package can then issue
8313 a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
8314 the package or subprogram, controlling whether the check will be present.
8316 @node Attribute Enum_Rep
8317 @unnumberedsec Attribute Enum_Rep
8318 @cindex Representation of enums
8319 @findex Enum_Rep
8320 @noindent
8321 For every enumeration subtype @var{S}, @code{@var{S}'Enum_Rep} denotes a
8322 function with the following spec:
8324 @smallexample @c ada
8325 function @var{S}'Enum_Rep (Arg : @var{S}'Base)
8326   return @i{Universal_Integer};
8327 @end smallexample
8329 @noindent
8330 It is also allowable to apply @code{Enum_Rep} directly to an object of an
8331 enumeration type or to a non-overloaded enumeration
8332 literal.  In this case @code{@var{S}'Enum_Rep} is equivalent to
8333 @code{@var{typ}'Enum_Rep(@var{S})} where @var{typ} is the type of the
8334 enumeration literal or object.
8336 The function returns the representation value for the given enumeration
8337 value.  This will be equal to value of the @code{Pos} attribute in the
8338 absence of an enumeration representation clause.  This is a static
8339 attribute (i.e.@: the result is static if the argument is static).
8341 @code{@var{S}'Enum_Rep} can also be used with integer types and objects,
8342 in which case it simply returns the integer value.  The reason for this
8343 is to allow it to be used for @code{(<>)} discrete formal arguments in
8344 a generic unit that can be instantiated with either enumeration types
8345 or integer types.  Note that if @code{Enum_Rep} is used on a modular
8346 type whose upper bound exceeds the upper bound of the largest signed
8347 integer type, and the argument is a variable, so that the universal
8348 integer calculation is done at run time, then the call to @code{Enum_Rep}
8349 may raise @code{Constraint_Error}.
8351 @node Attribute Enum_Val
8352 @unnumberedsec Attribute Enum_Val
8353 @cindex Representation of enums
8354 @findex Enum_Val
8355 @noindent
8356 For every enumeration subtype @var{S}, @code{@var{S}'Enum_Val} denotes a
8357 function with the following spec:
8359 @smallexample @c ada
8360 function @var{S}'Enum_Val (Arg : @i{Universal_Integer)
8361   return @var{S}'Base};
8362 @end smallexample
8364 @noindent
8365 The function returns the enumeration value whose representation matches the
8366 argument, or raises Constraint_Error if no enumeration literal of the type
8367 has the matching value.
8368 This will be equal to value of the @code{Val} attribute in the
8369 absence of an enumeration representation clause.  This is a static
8370 attribute (i.e.@: the result is static if the argument is static).
8372 @node Attribute Epsilon
8373 @unnumberedsec Attribute Epsilon
8374 @cindex Ada 83 attributes
8375 @findex Epsilon
8376 @noindent
8377 The @code{Epsilon} attribute is provided for compatibility with Ada 83.  See
8378 the Ada 83 reference manual for an exact description of the semantics of
8379 this attribute.
8381 @node Attribute Fixed_Value
8382 @unnumberedsec Attribute Fixed_Value
8383 @findex Fixed_Value
8384 @noindent
8385 For every fixed-point type @var{S}, @code{@var{S}'Fixed_Value} denotes a
8386 function with the following specification:
8388 @smallexample @c ada
8389 function @var{S}'Fixed_Value (Arg : @i{Universal_Integer})
8390   return @var{S};
8391 @end smallexample
8393 @noindent
8394 The value returned is the fixed-point value @var{V} such that
8396 @smallexample @c ada
8397 @var{V} = Arg * @var{S}'Small
8398 @end smallexample
8400 @noindent
8401 The effect is thus similar to first converting the argument to the
8402 integer type used to represent @var{S}, and then doing an unchecked
8403 conversion to the fixed-point type.  The difference is
8404 that there are full range checks, to ensure that the result is in range.
8405 This attribute is primarily intended for use in implementation of the
8406 input-output functions for fixed-point values.
8408 @node Attribute Has_Access_Values
8409 @unnumberedsec Attribute Has_Access_Values
8410 @cindex Access values, testing for
8411 @findex Has_Access_Values
8412 @noindent
8413 The prefix of the @code{Has_Access_Values} attribute is a type.  The result
8414 is a Boolean value which is True if the is an access type, or is a composite
8415 type with a component (at any nesting depth) that is an access type, and is
8416 False otherwise.
8417 The intended use of this attribute is in conjunction with generic
8418 definitions.  If the attribute is applied to a generic private type, it
8419 indicates whether or not the corresponding actual type has access values.
8421 @node Attribute Has_Discriminants
8422 @unnumberedsec Attribute Has_Discriminants
8423 @cindex Discriminants, testing for
8424 @findex Has_Discriminants
8425 @noindent
8426 The prefix of the @code{Has_Discriminants} attribute is a type.  The result
8427 is a Boolean value which is True if the type has discriminants, and False
8428 otherwise.  The intended use of this attribute is in conjunction with generic
8429 definitions.  If the attribute is applied to a generic private type, it
8430 indicates whether or not the corresponding actual type has discriminants.
8432 @node Attribute Img
8433 @unnumberedsec Attribute Img
8434 @findex Img
8435 @noindent
8436 The @code{Img} attribute differs from @code{Image} in that it is applied
8437 directly to an object, and yields the same result as
8438 @code{Image} for the subtype of the object.  This is convenient for
8439 debugging:
8441 @smallexample @c ada
8442 Put_Line ("X = " & X'Img);
8443 @end smallexample
8445 @noindent
8446 has the same meaning as the more verbose:
8448 @smallexample @c ada
8449 Put_Line ("X = " & @var{T}'Image (X));
8450 @end smallexample
8452 @noindent
8453 where @var{T} is the (sub)type of the object @code{X}.
8455 Note that technically, in analogy to @code{Image},
8456 @code{X'Img} returns a parameterless function
8457 that returns the appropriate string when called. This means that
8458 @code{X'Img} can be renamed as a function-returning-string, or used
8459 in an instantiation as a function parameter.
8461 @node Attribute Integer_Value
8462 @unnumberedsec Attribute Integer_Value
8463 @findex Integer_Value
8464 @noindent
8465 For every integer type @var{S}, @code{@var{S}'Integer_Value} denotes a
8466 function with the following spec:
8468 @smallexample @c ada
8469 function @var{S}'Integer_Value (Arg : @i{Universal_Fixed})
8470   return @var{S};
8471 @end smallexample
8473 @noindent
8474 The value returned is the integer value @var{V}, such that
8476 @smallexample @c ada
8477 Arg = @var{V} * @var{T}'Small
8478 @end smallexample
8480 @noindent
8481 where @var{T} is the type of @code{Arg}.
8482 The effect is thus similar to first doing an unchecked conversion from
8483 the fixed-point type to its corresponding implementation type, and then
8484 converting the result to the target integer type.  The difference is
8485 that there are full range checks, to ensure that the result is in range.
8486 This attribute is primarily intended for use in implementation of the
8487 standard input-output functions for fixed-point values.
8489 @node Attribute Invalid_Value
8490 @unnumberedsec Attribute Invalid_Value
8491 @findex Invalid_Value
8492 @noindent
8493 For every scalar type S, S'Invalid_Value returns an undefined value of the
8494 type. If possible this value is an invalid representation for the type. The
8495 value returned is identical to the value used to initialize an otherwise
8496 uninitialized value of the type if pragma Initialize_Scalars is used,
8497 including the ability to modify the value with the binder -Sxx flag and
8498 relevant environment variables at run time.
8500 @node Attribute Large
8501 @unnumberedsec Attribute Large
8502 @cindex Ada 83 attributes
8503 @findex Large
8504 @noindent
8505 The @code{Large} attribute is provided for compatibility with Ada 83.  See
8506 the Ada 83 reference manual for an exact description of the semantics of
8507 this attribute.
8509 @node Attribute Library_Level
8510 @unnumberedsec Attribute Library_Level
8511 @findex Library_Level
8512 @noindent
8513 @noindent
8514 @code{P'Library_Level}, where P is an entity name,
8515 returns a Boolean value which is True if the entity is declared
8516 at the library level, and False otherwise. Note that within a
8517 generic instantition, the name of the generic unit denotes the
8518 instance, which means that this attribute can be used to test
8519 if a generic is instantiated at the library level, as shown
8520 in this example:
8522 @smallexample @c ada
8523 generic
8524   ...
8525 package Gen is
8526   pragma Compile_Time_Error
8527     (not Gen'Library_Level,
8528      "Gen can only be instantiated at library level");
8529   ...
8530 end Gen;
8531 @end smallexample
8533 @node Attribute Loop_Entry
8534 @unnumberedsec Attribute Loop_Entry
8535 @findex Loop_Entry
8536 @noindent
8537 Syntax:
8539 @smallexample @c ada
8540 X'Loop_Entry [(loop_name)]
8541 @end smallexample
8543 @noindent
8544 The @code{Loop_Entry} attribute is used to refer to the value that an
8545 expression had upon entry to a given loop in much the same way that the
8546 @code{Old} attribute in a subprogram postcondition can be used to refer
8547 to the value an expression had upon entry to the subprogram. The
8548 relevant loop is either identified by the given loop name, or it is the
8549 innermost enclosing loop when no loop name is given.
8551 @noindent
8552 A @code{Loop_Entry} attribute can only occur within a
8553 @code{Loop_Variant} or @code{Loop_Invariant} pragma. A common use of
8554 @code{Loop_Entry} is to compare the current value of objects with their
8555 initial value at loop entry, in a @code{Loop_Invariant} pragma.
8557 @noindent
8558 The effect of using @code{X'Loop_Entry} is the same as declaring
8559 a constant initialized with the initial value of @code{X} at loop
8560 entry. This copy is not performed if the loop is not entered, or if the
8561 corresponding pragmas are ignored or disabled.
8563 @node Attribute Machine_Size
8564 @unnumberedsec Attribute Machine_Size
8565 @findex Machine_Size
8566 @noindent
8567 This attribute is identical to the @code{Object_Size} attribute.  It is
8568 provided for compatibility with the DEC Ada 83 attribute of this name.
8570 @node Attribute Mantissa
8571 @unnumberedsec Attribute Mantissa
8572 @cindex Ada 83 attributes
8573 @findex Mantissa
8574 @noindent
8575 The @code{Mantissa} attribute is provided for compatibility with Ada 83.  See
8576 the Ada 83 reference manual for an exact description of the semantics of
8577 this attribute.
8579 @node Attribute Max_Interrupt_Priority
8580 @unnumberedsec Attribute Max_Interrupt_Priority
8581 @cindex Interrupt priority, maximum
8582 @findex Max_Interrupt_Priority
8583 @noindent
8584 @code{Standard'Max_Interrupt_Priority} (@code{Standard} is the only
8585 permissible prefix), provides the same value as
8586 @code{System.Max_Interrupt_Priority}.
8588 @node Attribute Max_Priority
8589 @unnumberedsec Attribute Max_Priority
8590 @cindex Priority, maximum
8591 @findex Max_Priority
8592 @noindent
8593 @code{Standard'Max_Priority} (@code{Standard} is the only permissible
8594 prefix) provides the same value as @code{System.Max_Priority}.
8596 @node Attribute Maximum_Alignment
8597 @unnumberedsec Attribute Maximum_Alignment
8598 @cindex Alignment, maximum
8599 @findex Maximum_Alignment
8600 @noindent
8601 @code{Standard'Maximum_Alignment} (@code{Standard} is the only
8602 permissible prefix) provides the maximum useful alignment value for the
8603 target.  This is a static value that can be used to specify the alignment
8604 for an object, guaranteeing that it is properly aligned in all
8605 cases.
8607 @node Attribute Mechanism_Code
8608 @unnumberedsec Attribute Mechanism_Code
8609 @cindex Return values, passing mechanism
8610 @cindex Parameters, passing mechanism
8611 @findex Mechanism_Code
8612 @noindent
8613 @code{@var{function}'Mechanism_Code} yields an integer code for the
8614 mechanism used for the result of function, and
8615 @code{@var{subprogram}'Mechanism_Code (@var{n})} yields the mechanism
8616 used for formal parameter number @var{n} (a static integer value with 1
8617 meaning the first parameter) of @var{subprogram}.  The code returned is:
8619 @table @asis
8620 @item 1
8621 by copy (value)
8622 @item 2
8623 by reference
8624 @item 3
8625 by descriptor (default descriptor class)
8626 @item 4
8627 by descriptor (UBS: unaligned bit string)
8628 @item 5
8629 by descriptor (UBSB: aligned bit string with arbitrary bounds)
8630 @item 6
8631 by descriptor (UBA: unaligned bit array)
8632 @item 7
8633 by descriptor (S: string, also scalar access type parameter)
8634 @item 8
8635 by descriptor (SB: string with arbitrary bounds)
8636 @item 9
8637 by descriptor (A: contiguous array)
8638 @item 10
8639 by descriptor (NCA: non-contiguous array)
8640 @end table
8642 @noindent
8643 Values from 3 through 10 are only relevant to Digital OpenVMS implementations.
8644 @cindex OpenVMS
8646 @node Attribute Null_Parameter
8647 @unnumberedsec Attribute Null_Parameter
8648 @cindex Zero address, passing
8649 @findex Null_Parameter
8650 @noindent
8651 A reference @code{@var{T}'Null_Parameter} denotes an imaginary object of
8652 type or subtype @var{T} allocated at machine address zero.  The attribute
8653 is allowed only as the default expression of a formal parameter, or as
8654 an actual expression of a subprogram call.  In either case, the
8655 subprogram must be imported.
8657 The identity of the object is represented by the address zero in the
8658 argument list, independent of the passing mechanism (explicit or
8659 default).
8661 This capability is needed to specify that a zero address should be
8662 passed for a record or other composite object passed by reference.
8663 There is no way of indicating this without the @code{Null_Parameter}
8664 attribute.
8666 @node Attribute Object_Size
8667 @unnumberedsec Attribute Object_Size
8668 @cindex Size, used for objects
8669 @findex Object_Size
8670 @noindent
8671 The size of an object is not necessarily the same as the size of the type
8672 of an object.  This is because by default object sizes are increased to be
8673 a multiple of the alignment of the object.  For example,
8674 @code{Natural'Size} is
8675 31, but by default objects of type @code{Natural} will have a size of 32 bits.
8676 Similarly, a record containing an integer and a character:
8678 @smallexample @c ada
8679 type Rec is record
8680    I : Integer;
8681    C : Character;
8682 end record;
8683 @end smallexample
8685 @noindent
8686 will have a size of 40 (that is @code{Rec'Size} will be 40).  The
8687 alignment will be 4, because of the
8688 integer field, and so the default size of record objects for this type
8689 will be 64 (8 bytes).
8691 @node Attribute Passed_By_Reference
8692 @unnumberedsec Attribute Passed_By_Reference
8693 @cindex Parameters, when passed by reference
8694 @findex Passed_By_Reference
8695 @noindent
8696 @code{@var{type}'Passed_By_Reference} for any subtype @var{type} returns
8697 a value of type @code{Boolean} value that is @code{True} if the type is
8698 normally passed by reference and @code{False} if the type is normally
8699 passed by copy in calls.  For scalar types, the result is always @code{False}
8700 and is static.  For non-scalar types, the result is non-static.
8702 @node Attribute Pool_Address
8703 @unnumberedsec Attribute Pool_Address
8704 @cindex Parameters, when passed by reference
8705 @findex Pool_Address
8706 @noindent
8707 @code{@var{X}'Pool_Address} for any object @var{X} returns the address
8708 of X within its storage pool. This is the same as
8709 @code{@var{X}'Address}, except that for an unconstrained array whose
8710 bounds are allocated just before the first component,
8711 @code{@var{X}'Pool_Address} returns the address of those bounds,
8712 whereas @code{@var{X}'Address} returns the address of the first
8713 component.
8715 Here, we are interpreting ``storage pool'' broadly to mean ``wherever
8716 the object is allocated'', which could be a user-defined storage pool,
8717 the global heap, on the stack, or in a static memory area. For an
8718 object created by @code{new}, @code{@var{Ptr.all}'Pool_Address} is
8719 what is passed to @code{Allocate} and returned from @code{Deallocate}.
8721 @node Attribute Range_Length
8722 @unnumberedsec Attribute Range_Length
8723 @findex Range_Length
8724 @noindent
8725 @code{@var{type}'Range_Length} for any discrete type @var{type} yields
8726 the number of values represented by the subtype (zero for a null
8727 range).  The result is static for static subtypes.  @code{Range_Length}
8728 applied to the index subtype of a one dimensional array always gives the
8729 same result as @code{Length} applied to the array itself.
8731 @node Attribute Ref
8732 @unnumberedsec Attribute Ref
8733 @findex Ref
8734 @noindent
8737 @node Attribute Restriction_Set
8738 @unnumberedsec Attribute Restriction_Set
8739 @findex Restriction_Set
8740 @cindex Restrictions
8741 @noindent
8742 This attribute allows compile time testing of restrictions that
8743 are currently in effect. It is primarily intended for specializing
8744 code in the run-time based on restrictions that are active (e.g.
8745 don't need to save fpt registers if restriction No_Floating_Point
8746 is known to be in effect), but can be used anywhere.
8748 There are two forms:
8750 @smallexample @c ada
8751 System'Restriction_Set (partition_boolean_restriction_NAME)
8752 System'Restriction_Set (No_Dependence => library_unit_NAME);
8753 @end smallexample
8755 @noindent
8756 In the case of the first form, the only restriction names
8757 allowed are parameterless restrictions that are checked
8758 for consistency at bind time. For a complete list see the
8759 subtype @code{System.Rident.Partition_Boolean_Restrictions}.
8761 The result returned is True if the restriction is known to
8762 be in effect, and False if the restriction is known not to
8763 be in effect. An important guarantee is that the value of
8764 a Restriction_Set attribute is known to be consistent throughout
8765 all the code of a partition.
8767 This is trivially achieved if the entire partition is compiled
8768 with a consistent set of restriction pragmas. However, the
8769 compilation model does not require this. It is possible to
8770 compile one set of units with one set of pragmas, and another
8771 set of units with another set of pragmas. It is even possible
8772 to compile a spec with one set of pragmas, and then WITH the
8773 same spec with a different set of pragmas. Inconsistencies
8774 in the actual use of the restriction are checked at bind time.
8776 In order to achieve the guarantee of consistency for the
8777 Restriction_Set pragma, we consider that a use of the pragma
8778 that yields False is equivalent to a violation of the
8779 restriction.
8781 So for example if you write
8783 @smallexample @c ada
8784 if System'Restriction_Set (No_Floating_Point) then
8785    ...
8786 else
8787    ...
8788 end if;
8789 @end smallexample
8791 @noindent
8792 And the result is False, so that the else branch is executed,
8793 you can assume that this restriction is not set for any unit
8794 in the partition. This is checked by considering this use of
8795 the restriction pragma to be a violation of the restriction
8796 No_Floating_Point. This means that no other unit can attempt
8797 to set this restriction (if some unit does attempt to set it,
8798 the binder will refuse to bind the partition).
8800 Technical note: The restriction name and the unit name are
8801 intepreted entirely syntactically, as in the corresponding
8802 Restrictions pragma, they are not analyzed semantically,
8803 so they do not have a type.
8805 @node Attribute Result
8806 @unnumberedsec Attribute Result
8807 @findex Result
8808 @noindent
8809 @code{@var{function}'Result} can only be used with in a Postcondition pragma
8810 for a function. The prefix must be the name of the corresponding function. This
8811 is used to refer to the result of the function in the postcondition expression.
8812 For a further discussion of the use of this attribute and examples of its use,
8813 see the description of pragma Postcondition.
8815 @node Attribute Safe_Emax
8816 @unnumberedsec Attribute Safe_Emax
8817 @cindex Ada 83 attributes
8818 @findex Safe_Emax
8819 @noindent
8820 The @code{Safe_Emax} attribute is provided for compatibility with Ada 83.  See
8821 the Ada 83 reference manual for an exact description of the semantics of
8822 this attribute.
8824 @node Attribute Safe_Large
8825 @unnumberedsec Attribute Safe_Large
8826 @cindex Ada 83 attributes
8827 @findex Safe_Large
8828 @noindent
8829 The @code{Safe_Large} attribute is provided for compatibility with Ada 83.  See
8830 the Ada 83 reference manual for an exact description of the semantics of
8831 this attribute.
8833 @node Attribute Scalar_Storage_Order
8834 @unnumberedsec Attribute Scalar_Storage_Order
8835 @cindex Endianness
8836 @cindex Scalar storage order
8837 @findex Scalar_Storage_Order
8838 @noindent
8839 For every array or record type @var{S}, the representation attribute
8840 @code{Scalar_Storage_Order} denotes the order in which storage elements
8841 that make up scalar components are ordered within S:
8843 @smallexample @c ada
8844    --  Component type definitions
8846    subtype Yr_Type is Natural range 0 .. 127;
8847    subtype Mo_Type is Natural range 1 .. 12;
8848    subtype Da_Type is Natural range 1 .. 31;
8850    --  Record declaration
8852    type Date is record
8853       Years_Since_1980 : Yr_Type;
8854       Month            : Mo_Type;
8855       Day_Of_Month     : Da_Type;
8856    end record;
8858    --  Record representation clause
8860    for Date use record
8861       Years_Since_1980 at 0 range 0  ..  6;
8862       Month            at 0 range 7  .. 10;
8863       Day_Of_Month     at 0 range 11 .. 15;
8864    end record;
8866    --  Attribute definition clauses
8868    for Date'Bit_Order use System.High_Order_First;
8869    for Date'Scalar_Storage_Order use System.High_Order_First;
8870    --  If Scalar_Storage_Order is specified, it must be consistent with
8871    --  Bit_Order, so it's best to always define the latter explicitly if
8872    --  the former is used.
8873 @end smallexample
8875 Other properties are
8876 as for standard representation attribute @code{Bit_Order}, as defined by
8877 Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
8879 For a record type @var{S}, if @code{@var{S}'Scalar_Storage_Order} is
8880 specified explicitly, it shall be equal to @code{@var{S}'Bit_Order}. Note:
8881 this means that if a @code{Scalar_Storage_Order} attribute definition
8882 clause is not confirming, then the type's @code{Bit_Order} shall be
8883 specified explicitly and set to the same value.
8885 For a record extension, the derived type shall have the same scalar storage
8886 order as the parent type.
8888 If a component of @var{S} has itself a record or array type, then it shall also
8889 have a @code{Scalar_Storage_Order} attribute definition clause. In addition,
8890 if the component is a packed array, or does not start on a byte boundary, then
8891 the scalar storage order specified for S and for the nested component type shall
8892 be identical.
8894 If @var{S} appears as the type of a record or array component, the enclosing
8895 record or array shall also have a @code{Scalar_Storage_Order} attribute
8896 definition clause.
8898 No component of a type that has a @code{Scalar_Storage_Order} attribute
8899 definition may be aliased.
8901 A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
8902 with a value equal to @code{System.Default_Bit_Order}) has no effect.
8904 If the opposite storage order is specified, then whenever the value of
8905 a scalar component of an object of type @var{S} is read, the storage
8906 elements of the enclosing machine scalar are first reversed (before
8907 retrieving the component value, possibly applying some shift and mask
8908 operatings on the enclosing machine scalar), and the opposite operation
8909 is done for writes.
8911 In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
8912 are relaxed. Instead, the following rules apply:
8914 @itemize @bullet
8915 @item the underlying storage elements are those at positions
8916   @code{(position + first_bit / storage_element_size) ..
8917         (position + (last_bit + storage_element_size - 1) /
8918                     storage_element_size)}
8919 @item the sequence of underlying storage elements shall have
8920         a size no greater than the largest machine scalar
8921 @item the enclosing machine scalar is defined as the smallest machine
8922         scalar starting at a position no greater than
8923         @code{position + first_bit / storage_element_size} and covering
8924         storage elements at least up to @code{position + (last_bit +
8925         storage_element_size - 1) / storage_element_size}
8926 @item the position of the component is interpreted relative to that machine
8927  scalar.
8929 @end itemize
8931 @node Attribute Simple_Storage_Pool
8932 @unnumberedsec Attribute Simple_Storage_Pool
8933 @cindex Storage pool, simple
8934 @cindex Simple storage pool
8935 @findex Simple_Storage_Pool
8936 @noindent
8937 For every nonformal, nonderived access-to-object type @var{Acc}, the
8938 representation attribute @code{Simple_Storage_Pool} may be specified
8939 via an attribute_definition_clause (or by specifying the equivalent aspect):
8941 @smallexample @c ada
8943 My_Pool : My_Simple_Storage_Pool_Type;
8945 type Acc is access My_Data_Type;
8947 for Acc'Simple_Storage_Pool use My_Pool;
8949 @end smallexample
8951 @noindent
8952 The name given in an attribute_definition_clause for the
8953 @code{Simple_Storage_Pool} attribute shall denote a variable of
8954 a ``simple storage pool type'' (see pragma @code{Simple_Storage_Pool_Type}).
8956 The use of this attribute is only allowed for a prefix denoting a type
8957 for which it has been specified. The type of the attribute is the type
8958 of the variable specified as the simple storage pool of the access type,
8959 and the attribute denotes that variable.
8961 It is illegal to specify both @code{Storage_Pool} and @code{Simple_Storage_Pool}
8962 for the same access type.
8964 If the @code{Simple_Storage_Pool} attribute has been specified for an access
8965 type, then applying the @code{Storage_Pool} attribute to the type is flagged
8966 with a warning and its evaluation raises the exception @code{Program_Error}.
8968 If the Simple_Storage_Pool attribute has been specified for an access
8969 type @var{S}, then the evaluation of the attribute @code{@var{S}'Storage_Size}
8970 returns the result of calling @code{Storage_Size (@var{S}'Simple_Storage_Pool)},
8971 which is intended to indicate the number of storage elements reserved for
8972 the simple storage pool. If the Storage_Size function has not been defined
8973 for the simple storage pool type, then this attribute returns zero.
8975 If an access type @var{S} has a specified simple storage pool of type
8976 @var{SSP}, then the evaluation of an allocator for that access type calls
8977 the primitive @code{Allocate} procedure for type @var{SSP}, passing
8978 @code{@var{S}'Simple_Storage_Pool} as the pool parameter. The detailed
8979 semantics of such allocators is the same as those defined for allocators
8980 in section 13.11 of the Ada Reference Manual, with the term
8981 ``simple storage pool'' substituted for ``storage pool''.
8983 If an access type @var{S} has a specified simple storage pool of type
8984 @var{SSP}, then a call to an instance of the @code{Ada.Unchecked_Deallocation}
8985 for that access type invokes the primitive @code{Deallocate} procedure
8986 for type @var{SSP}, passing @code{@var{S}'Simple_Storage_Pool} as the pool
8987 parameter. The detailed semantics of such unchecked deallocations is the same
8988 as defined in section 13.11.2 of the Ada Reference Manual, except that the
8989 term ``simple storage pool'' is substituted for ``storage pool''.
8991 @node Attribute Small
8992 @unnumberedsec Attribute Small
8993 @cindex Ada 83 attributes
8994 @findex Small
8995 @noindent
8996 The @code{Small} attribute is defined in Ada 95 (and Ada 2005) only for
8997 fixed-point types.
8998 GNAT also allows this attribute to be applied to floating-point types
8999 for compatibility with Ada 83.  See
9000 the Ada 83 reference manual for an exact description of the semantics of
9001 this attribute when applied to floating-point types.
9003 @node Attribute Storage_Unit
9004 @unnumberedsec Attribute Storage_Unit
9005 @findex Storage_Unit
9006 @noindent
9007 @code{Standard'Storage_Unit} (@code{Standard} is the only permissible
9008 prefix) provides the same value as @code{System.Storage_Unit}.
9010 @node Attribute Stub_Type
9011 @unnumberedsec Attribute Stub_Type
9012 @findex Stub_Type
9013 @noindent
9014 The GNAT implementation of remote access-to-classwide types is
9015 organized as described in AARM section E.4 (20.t): a value of an RACW type
9016 (designating a remote object) is represented as a normal access
9017 value, pointing to a "stub" object which in turn contains the
9018 necessary information to contact the designated remote object. A
9019 call on any dispatching operation of such a stub object does the
9020 remote call, if necessary, using the information in the stub object
9021 to locate the target partition, etc.
9023 For a prefix @code{T} that denotes a remote access-to-classwide type,
9024 @code{T'Stub_Type} denotes the type of the corresponding stub objects.
9026 By construction, the layout of @code{T'Stub_Type} is identical to that of
9027 type @code{RACW_Stub_Type} declared in the internal implementation-defined
9028 unit @code{System.Partition_Interface}. Use of this attribute will create
9029 an implicit dependency on this unit.
9031 @node Attribute System_Allocator_Alignment
9032 @unnumberedsec Attribute System_Allocator_Alignment
9033 @cindex Alignment, allocator
9034 @findex System_Allocator_Alignment
9035 @noindent
9036 @code{Standard'System_Allocator_Alignment} (@code{Standard} is the only
9037 permissible prefix) provides the observable guaranted to be honored by
9038 the system allocator (malloc). This is a static value that can be used
9039 in user storage pools based on malloc either to reject allocation
9040 with alignment too large or to enable a realignment circuitry if the
9041 alignment request is larger than this value.
9043 @node Attribute Target_Name
9044 @unnumberedsec Attribute Target_Name
9045 @findex Target_Name
9046 @noindent
9047 @code{Standard'Target_Name} (@code{Standard} is the only permissible
9048 prefix) provides a static string value that identifies the target
9049 for the current compilation. For GCC implementations, this is the
9050 standard gcc target name without the terminating slash (for
9051 example, GNAT 5.0 on windows yields "i586-pc-mingw32msv").
9053 @node Attribute Tick
9054 @unnumberedsec Attribute Tick
9055 @findex Tick
9056 @noindent
9057 @code{Standard'Tick} (@code{Standard} is the only permissible prefix)
9058 provides the same value as @code{System.Tick},
9060 @node Attribute To_Address
9061 @unnumberedsec Attribute To_Address
9062 @findex To_Address
9063 @noindent
9064 The @code{System'To_Address}
9065 (@code{System} is the only permissible prefix)
9066 denotes a function identical to
9067 @code{System.Storage_Elements.To_Address} except that
9068 it is a static attribute.  This means that if its argument is
9069 a static expression, then the result of the attribute is a
9070 static expression.  This means that such an expression can be
9071 used in contexts (e.g.@: preelaborable packages) which require a
9072 static expression and where the function call could not be used
9073 (since the function call is always non-static, even if its
9074 argument is static). The argument must be in the range
9075 -(2**(m-1) .. 2**m-1, where m is the memory size
9076 (typically 32 or 64). Negative values are intepreted in a
9077 modular manner (e.g. -1 means the same as 16#FFFF_FFFF# on
9078 a 32 bits machine).
9080 @node Attribute Type_Class
9081 @unnumberedsec Attribute Type_Class
9082 @findex Type_Class
9083 @noindent
9084 @code{@var{type}'Type_Class} for any type or subtype @var{type} yields
9085 the value of the type class for the full type of @var{type}.  If
9086 @var{type} is a generic formal type, the value is the value for the
9087 corresponding actual subtype.  The value of this attribute is of type
9088 @code{System.Aux_DEC.Type_Class}, which has the following definition:
9090 @smallexample @c ada
9091   type Type_Class is
9092     (Type_Class_Enumeration,
9093      Type_Class_Integer,
9094      Type_Class_Fixed_Point,
9095      Type_Class_Floating_Point,
9096      Type_Class_Array,
9097      Type_Class_Record,
9098      Type_Class_Access,
9099      Type_Class_Task,
9100      Type_Class_Address);
9101 @end smallexample
9103 @noindent
9104 Protected types yield the value @code{Type_Class_Task}, which thus
9105 applies to all concurrent types.  This attribute is designed to
9106 be compatible with the DEC Ada 83 attribute of the same name.
9108 @node Attribute UET_Address
9109 @unnumberedsec Attribute UET_Address
9110 @findex UET_Address
9111 @noindent
9112 The @code{UET_Address} attribute can only be used for a prefix which
9113 denotes a library package.  It yields the address of the unit exception
9114 table when zero cost exception handling is used.  This attribute is
9115 intended only for use within the GNAT implementation.  See the unit
9116 @code{Ada.Exceptions} in files @file{a-except.ads} and @file{a-except.adb}
9117 for details on how this attribute is used in the implementation.
9119 @node Attribute Unconstrained_Array
9120 @unnumberedsec Attribute Unconstrained_Array
9121 @findex Unconstrained_Array
9122 @noindent
9123 The @code{Unconstrained_Array} attribute can be used with a prefix that
9124 denotes any type or subtype. It is a static attribute that yields
9125 @code{True} if the prefix designates an unconstrained array,
9126 and @code{False} otherwise. In a generic instance, the result is
9127 still static, and yields the result of applying this test to the
9128 generic actual.
9130 @node Attribute Universal_Literal_String
9131 @unnumberedsec Attribute Universal_Literal_String
9132 @cindex Named numbers, representation of
9133 @findex Universal_Literal_String
9134 @noindent
9135 The prefix of @code{Universal_Literal_String} must be a named
9136 number.  The static result is the string consisting of the characters of
9137 the number as defined in the original source.  This allows the user
9138 program to access the actual text of named numbers without intermediate
9139 conversions and without the need to enclose the strings in quotes (which
9140 would preclude their use as numbers).
9142 For example, the following program prints the first 50 digits of pi:
9144 @smallexample @c ada
9145 with Text_IO; use Text_IO;
9146 with Ada.Numerics;
9147 procedure Pi is
9148 begin
9149    Put (Ada.Numerics.Pi'Universal_Literal_String);
9150 end;
9151 @end smallexample
9153 @node Attribute Unrestricted_Access
9154 @unnumberedsec Attribute Unrestricted_Access
9155 @cindex @code{Access}, unrestricted
9156 @findex Unrestricted_Access
9157 @noindent
9158 The @code{Unrestricted_Access} attribute is similar to @code{Access}
9159 except that all accessibility and aliased view checks are omitted.  This
9160 is a user-beware attribute.  It is similar to
9161 @code{Address}, for which it is a desirable replacement where the value
9162 desired is an access type.  In other words, its effect is identical to
9163 first applying the @code{Address} attribute and then doing an unchecked
9164 conversion to a desired access type.  In GNAT, but not necessarily in
9165 other implementations, the use of static chains for inner level
9166 subprograms means that @code{Unrestricted_Access} applied to a
9167 subprogram yields a value that can be called as long as the subprogram
9168 is in scope (normal Ada accessibility rules restrict this usage).
9170 It is possible to use @code{Unrestricted_Access} for any type, but care
9171 must be exercised if it is used to create pointers to unconstrained
9172 objects. In this case, the resulting pointer has the same scope as the
9173 context of the attribute, and may not be returned to some enclosing
9174 scope. For instance, a function cannot use @code{Unrestricted_Access}
9175 to create a unconstrained pointer and then return that value to the
9176 caller.
9178 @node Attribute Update
9179 @unnumberedsec Attribute Update
9180 @findex Update
9181 @noindent
9182 The @code{Update} attribute creates a copy of an array or record value
9183 with one or more modified components. The syntax is:
9185 @smallexample @c ada
9186 PREFIX'Update (AGGREGATE)
9187 @end smallexample
9189 @noindent
9190 where @code{PREFIX} is the name of an array or record object, and
9191 @code{AGGREGATE} is a named aggregate that does not contain an @code{others}
9192 choice. The effect is to yield a copy of the array or record value which
9193 is unchanged apart from the components mentioned in the aggregate, which
9194 are changed to the indicated value. The original value of the array or
9195 record value is not affected. For example:
9197 @smallexample @c ada
9198 type Arr is Array (1 .. 5) of Integer;
9200 Avar1 : Arr := (1,2,3,4,5);
9201 Avar2 : Arr := Avar1'Update ((2 => 10, 3 .. 4 => 20));
9202 @end smallexample
9204 @noindent
9205 yields a value for @code{Avar2} of 1,10,20,20,5 with @code{Avar1}
9206 begin unmodified. Similarly:
9208 @smallexample @c ada
9209 type Rec is A, B, C : Integer;
9211 Rvar1 : Rec := (A => 1, B => 2, C => 3);
9212 Rvar2 : Rec := Rvar1'Update ((B => 20));
9213 @end smallexample
9215 @noindent
9216 yields a value for @code{Rvar2} of (A => 1, B => 20, C => 3),
9217 with @code{Rvar1} being unmodifed.
9218 Note that the value of the attribute reference is computed
9219 completely before it is used. This means that if you write:
9221 @smallexample @c ada
9222 Avar1 := Avar1'Update ((1 => 10, 2 => Function_Call));
9223 @end smallexample
9225 @noindent
9226 then the value of @code{Avar1} is not modified if @code{Function_Call}
9227 raises an exception, unlike the effect of a series of direct assignments
9228 to elements of @code{Avar1}. In general this requires that
9229 two extra complete copies of the object are required, which should be
9230 kept in mind when considering efficiency.
9232 The @code{Update} attribute cannot be applied to prefixes of a limited
9233 type, and cannot reference discriminants in the case of a record type.
9234 The accessibility level of an Update attribute result object is defined
9235 as for an aggregate.
9237 In the record case, no component can be mentioned more than once. In
9238 the array case, two overlapping ranges can appear in the aggregate,
9239 in which case the modifications are processed left to right.
9241 Multi-dimensional arrays can be modified, as shown by this example:
9243 @smallexample @c ada
9244 A : array (1 .. 10, 1 .. 10) of Integer;
9246 A := A'Update (1 => (2 => 20), 3 => (4 => 30));
9247 @end smallexample
9249 @noindent
9250 which changes element (1,2) to 20 and (3,4) to 30.
9252 @node Attribute Valid_Scalars
9253 @unnumberedsec Attribute Valid_Scalars
9254 @findex Valid_Scalars
9255 @noindent
9256 The @code{'Valid_Scalars} attribute is intended to make it easier to
9257 check the validity of scalar subcomponents of composite objects. It
9258 is defined for any prefix @code{X} that denotes an object.
9259 The value of this attribute is of the predefined type Boolean.
9260 @code{X'Valid_Scalars} yields True if and only if evaluation of
9261 @code{P'Valid} yields True for every scalar part P of X or if X has
9262 no scalar parts. It is not specified in what order the scalar parts
9263 are checked, nor whether any more are checked after any one of them
9264 is determined to be invalid. If the prefix @code{X} is of a class-wide
9265 type @code{T'Class} (where @code{T} is the associated specific type),
9266 or if the prefix @code{X} is of a specific tagged type @code{T}, then
9267 only the scalar parts of components of @code{T} are traversed; in other
9268 words, components of extensions of @code{T} are not traversed even if
9269 @code{T'Class (X)'Tag /= T'Tag} . The compiler will issue a warning if it can
9270 be determined at compile time that the prefix of the attribute has no
9271 scalar parts (e.g., if the prefix is of an access type, an interface type,
9272 an undiscriminated task type, or an undiscriminated protected type).
9274 @node Attribute VADS_Size
9275 @unnumberedsec Attribute VADS_Size
9276 @cindex @code{Size}, VADS compatibility
9277 @findex VADS_Size
9278 @noindent
9279 The @code{'VADS_Size} attribute is intended to make it easier to port
9280 legacy code which relies on the semantics of @code{'Size} as implemented
9281 by the VADS Ada 83 compiler.  GNAT makes a best effort at duplicating the
9282 same semantic interpretation.  In particular, @code{'VADS_Size} applied
9283 to a predefined or other primitive type with no Size clause yields the
9284 Object_Size (for example, @code{Natural'Size} is 32 rather than 31 on
9285 typical machines).  In addition @code{'VADS_Size} applied to an object
9286 gives the result that would be obtained by applying the attribute to
9287 the corresponding type.
9289 @node Attribute Value_Size
9290 @unnumberedsec Attribute Value_Size
9291 @cindex @code{Size}, setting for not-first subtype
9292 @findex Value_Size
9293 @code{@var{type}'Value_Size} is the number of bits required to represent
9294 a value of the given subtype.  It is the same as @code{@var{type}'Size},
9295 but, unlike @code{Size}, may be set for non-first subtypes.
9297 @node Attribute Wchar_T_Size
9298 @unnumberedsec Attribute Wchar_T_Size
9299 @findex Wchar_T_Size
9300 @code{Standard'Wchar_T_Size} (@code{Standard} is the only permissible
9301 prefix) provides the size in bits of the C @code{wchar_t} type
9302 primarily for constructing the definition of this type in
9303 package @code{Interfaces.C}.
9305 @node Attribute Word_Size
9306 @unnumberedsec Attribute Word_Size
9307 @findex Word_Size
9308 @code{Standard'Word_Size} (@code{Standard} is the only permissible
9309 prefix) provides the value @code{System.Word_Size}.
9311 @node Standard and Implementation Defined Restrictions
9312 @chapter Standard and Implementation Defined Restrictions
9314 @noindent
9315 All RM defined Restriction identifiers are implemented:
9317 @itemize @bullet
9318 @item language-defined restrictions (see 13.12.1)
9319 @item tasking restrictions (see D.7)
9320 @item high integrity restrictions (see H.4)
9321 @end itemize
9323 @noindent
9324 GNAT implements additional restriction identifiers. All restrictions, whether
9325 language defined or GNAT-specific, are listed in the following.
9327 @menu
9328 * Partition-Wide Restrictions::
9329 * Program Unit Level Restrictions::
9330 @end menu
9332 @node Partition-Wide Restrictions
9333 @section Partition-Wide Restrictions
9335 There are two separate lists of restriction identifiers. The first
9336 set requires consistency throughout a partition (in other words, if the
9337 restriction identifier is used for any compilation unit in the partition,
9338 then all compilation units in the partition must obey the restriction).
9340 @menu
9341 * Immediate_Reclamation::
9342 * Max_Asynchronous_Select_Nesting::
9343 * Max_Entry_Queue_Length::
9344 * Max_Protected_Entries::
9345 * Max_Select_Alternatives::
9346 * Max_Storage_At_Blocking::
9347 * Max_Task_Entries::
9348 * Max_Tasks::
9349 * No_Abort_Statements::
9350 * No_Access_Parameter_Allocators::
9351 * No_Access_Subprograms::
9352 * No_Allocators::
9353 * No_Anonymous_Allocators::
9354 * No_Calendar::
9355 * No_Coextensions::
9356 * No_Default_Initialization::
9357 * No_Delay::
9358 * No_Dependence::
9359 * No_Direct_Boolean_Operators::
9360 * No_Dispatch::
9361 * No_Dispatching_Calls::
9362 * No_Dynamic_Attachment::
9363 * No_Dynamic_Priorities::
9364 * No_Entry_Calls_In_Elaboration_Code::
9365 * No_Enumeration_Maps::
9366 * No_Exception_Handlers::
9367 * No_Exception_Propagation::
9368 * No_Exception_Registration::
9369 * No_Exceptions::
9370 * No_Finalization::
9371 * No_Fixed_Point::
9372 * No_Floating_Point::
9373 * No_Implicit_Conditionals::
9374 * No_Implicit_Dynamic_Code::
9375 * No_Implicit_Heap_Allocations::
9376 * No_Implicit_Loops::
9377 * No_Initialize_Scalars::
9378 * No_IO::
9379 * No_Local_Allocators::
9380 * No_Local_Protected_Objects::
9381 * No_Local_Timing_Events::
9382 * No_Nested_Finalization::
9383 * No_Protected_Type_Allocators::
9384 * No_Protected_Types::
9385 * No_Recursion::
9386 * No_Reentrancy::
9387 * No_Relative_Delay::
9388 * No_Requeue_Statements::
9389 * No_Secondary_Stack::
9390 * No_Select_Statements::
9391 * No_Specific_Termination_Handlers::
9392 * No_Specification_of_Aspect::
9393 * No_Standard_Allocators_After_Elaboration::
9394 * No_Standard_Storage_Pools::
9395 * No_Stream_Optimizations::
9396 * No_Streams::
9397 * No_Task_Allocators::
9398 * No_Task_Attributes_Package::
9399 * No_Task_Hierarchy::
9400 * No_Task_Termination::
9401 * No_Tasking::
9402 * No_Terminate_Alternatives::
9403 * No_Unchecked_Access::
9404 * Simple_Barriers::
9405 * Static_Priorities::
9406 * Static_Storage_Size::
9407 @end menu
9409 @node Immediate_Reclamation
9410 @unnumberedsubsec Immediate_Reclamation
9411 @findex Immediate_Reclamation
9412 [RM H.4] This restriction ensures that, except for storage occupied by
9413 objects created by allocators and not deallocated via unchecked
9414 deallocation, any storage reserved at run time for an object is
9415 immediately reclaimed when the object no longer exists.
9417 @node Max_Asynchronous_Select_Nesting
9418 @unnumberedsubsec Max_Asynchronous_Select_Nesting
9419 @findex Max_Asynchronous_Select_Nesting
9420 [RM D.7] Specifies the maximum dynamic nesting level of asynchronous
9421 selects. Violations of this restriction with a value of zero are
9422 detected at compile time. Violations of this restriction with values
9423 other than zero cause Storage_Error to be raised.
9425 @node Max_Entry_Queue_Length
9426 @unnumberedsubsec Max_Entry_Queue_Length
9427 @findex Max_Entry_Queue_Length
9428 [RM D.7] This restriction is a declaration that any protected entry compiled in
9429 the scope of the restriction has at most the specified number of
9430 tasks waiting on the entry at any one time, and so no queue is required.
9431 Note that this restriction is checked at run time. Violation of this
9432 restriction results in the raising of Program_Error exception at the point of
9433 the call.
9435 @findex Max_Entry_Queue_Depth
9436 The restriction @code{Max_Entry_Queue_Depth} is recognized as a
9437 synonym for @code{Max_Entry_Queue_Length}. This is retained for historical
9438 compatibility purposes (and a warning will be generated for its use if
9439 warnings on obsolescent features are activated).
9441 @node Max_Protected_Entries
9442 @unnumberedsubsec Max_Protected_Entries
9443 @findex Max_Protected_Entries
9444 [RM D.7] Specifies the maximum number of entries per protected type. The
9445 bounds of every entry family of a protected unit shall be static, or shall be
9446 defined by a discriminant of a subtype whose corresponding bound is static.
9448 @node Max_Select_Alternatives
9449 @unnumberedsubsec Max_Select_Alternatives
9450 @findex Max_Select_Alternatives
9451 [RM D.7] Specifies the maximum number of alternatives in a selective accept.
9453 @node Max_Storage_At_Blocking
9454 @unnumberedsubsec Max_Storage_At_Blocking
9455 @findex Max_Storage_At_Blocking
9456 [RM D.7] Specifies the maximum portion (in storage elements) of a task's
9457 Storage_Size that can be retained by a blocked task. A violation of this
9458 restriction causes Storage_Error to be raised.
9460 @node Max_Task_Entries
9461 @unnumberedsubsec Max_Task_Entries
9462 @findex Max_Task_Entries
9463 [RM D.7] Specifies the maximum number of entries
9464 per task.  The bounds of every entry family
9465 of a task unit shall be static, or shall be
9466 defined by a discriminant of a subtype whose
9467 corresponding bound is static.
9469 @node Max_Tasks
9470 @unnumberedsubsec Max_Tasks
9471 @findex Max_Tasks
9472 [RM D.7] Specifies the maximum number of task that may be created, not
9473 counting the creation of the environment task.  Violations of this
9474 restriction with a value of zero are detected at compile
9475 time. Violations of this restriction with values other than zero cause
9476 Storage_Error to be raised.
9478 @node No_Abort_Statements
9479 @unnumberedsubsec No_Abort_Statements
9480 @findex No_Abort_Statements
9481 [RM D.7] There are no abort_statements, and there are
9482 no calls to Task_Identification.Abort_Task.
9484 @node No_Access_Parameter_Allocators
9485 @unnumberedsubsec No_Access_Parameter_Allocators
9486 @findex No_Access_Parameter_Allocators
9487 [RM H.4] This restriction ensures at compile time that there are no
9488 occurrences of an allocator as the actual parameter to an access
9489 parameter.
9491 @node No_Access_Subprograms
9492 @unnumberedsubsec No_Access_Subprograms
9493 @findex No_Access_Subprograms
9494 [RM H.4] This restriction ensures at compile time that there are no
9495 declarations of access-to-subprogram types.
9497 @node No_Allocators
9498 @unnumberedsubsec No_Allocators
9499 @findex No_Allocators
9500 [RM H.4] This restriction ensures at compile time that there are no
9501 occurrences of an allocator.
9503 @node No_Anonymous_Allocators
9504 @unnumberedsubsec No_Anonymous_Allocators
9505 @findex No_Anonymous_Allocators
9506 [RM H.4] This restriction ensures at compile time that there are no
9507 occurrences of an allocator of anonymous access type.
9509 @node No_Calendar
9510 @unnumberedsubsec No_Calendar
9511 @findex No_Calendar
9512 [GNAT] This restriction ensures at compile time that there is no implicit or
9513 explicit dependence on the package @code{Ada.Calendar}.
9515 @node No_Coextensions
9516 @unnumberedsubsec No_Coextensions
9517 @findex No_Coextensions
9518 [RM H.4] This restriction ensures at compile time that there are no
9519 coextensions. See 3.10.2.
9521 @node No_Default_Initialization
9522 @unnumberedsubsec No_Default_Initialization
9523 @findex No_Default_Initialization
9525 [GNAT] This restriction prohibits any instance of default initialization
9526 of variables.  The binder implements a consistency rule which prevents
9527 any unit compiled without the restriction from with'ing a unit with the
9528 restriction (this allows the generation of initialization procedures to
9529 be skipped, since you can be sure that no call is ever generated to an
9530 initialization procedure in a unit with the restriction active). If used
9531 in conjunction with Initialize_Scalars or Normalize_Scalars, the effect
9532 is to prohibit all cases of variables declared without a specific
9533 initializer (including the case of OUT scalar parameters).
9535 @node No_Delay
9536 @unnumberedsubsec No_Delay
9537 @findex No_Delay
9538 [RM H.4] This restriction ensures at compile time that there are no
9539 delay statements and no dependences on package Calendar.
9541 @node No_Dependence
9542 @unnumberedsubsec No_Dependence
9543 @findex No_Dependence
9544 [RM 13.12.1] This restriction checks at compile time that there are no
9545 dependence on a library unit.
9547 @node No_Direct_Boolean_Operators
9548 @unnumberedsubsec No_Direct_Boolean_Operators
9549 @findex No_Direct_Boolean_Operators
9550 [GNAT] This restriction ensures that no logical operators (and/or/xor)
9551 are used on operands of type Boolean (or any type derived from Boolean).
9552 This is intended for use in safety critical programs where the certification
9553 protocol requires the use of short-circuit (and then, or else) forms for all
9554 composite boolean operations.
9556 @node No_Dispatch
9557 @unnumberedsubsec No_Dispatch
9558 @findex No_Dispatch
9559 [RM H.4] This restriction ensures at compile time that there are no
9560 occurrences of @code{T'Class}, for any (tagged) subtype @code{T}.
9562 @node No_Dispatching_Calls
9563 @unnumberedsubsec No_Dispatching_Calls
9564 @findex No_Dispatching_Calls
9565 [GNAT] This restriction ensures at compile time that the code generated by the
9566 compiler involves no dispatching calls. The use of this restriction allows the
9567 safe use of record extensions, classwide membership tests and other classwide
9568 features not involving implicit dispatching. This restriction ensures that
9569 the code contains no indirect calls through a dispatching mechanism. Note that
9570 this includes internally-generated calls created by the compiler, for example
9571 in the implementation of class-wide objects assignments. The
9572 membership test is allowed in the presence of this restriction, because its
9573 implementation requires no dispatching.
9574 This restriction is comparable to the official Ada restriction
9575 @code{No_Dispatch} except that it is a bit less restrictive in that it allows
9576 all classwide constructs that do not imply dispatching.
9577 The following example indicates constructs that violate this restriction.
9579 @smallexample
9580 package Pkg is
9581   type T is tagged record
9582     Data : Natural;
9583   end record;
9584   procedure P (X : T);
9586   type DT is new T with record
9587     More_Data : Natural;
9588   end record;
9589   procedure Q (X : DT);
9590 end Pkg;
9592 with Pkg; use Pkg;
9593 procedure Example is
9594   procedure Test (O : T'Class) is
9595     N : Natural  := O'Size;--  Error: Dispatching call
9596     C : T'Class := O;      --  Error: implicit Dispatching Call
9597   begin
9598     if O in DT'Class then  --  OK   : Membership test
9599        Q (DT (O));         --  OK   : Type conversion plus direct call
9600     else
9601        P (O);              --  Error: Dispatching call
9602     end if;
9603   end Test;
9605   Obj : DT;
9606 begin
9607   P (Obj);                 --  OK   : Direct call
9608   P (T (Obj));             --  OK   : Type conversion plus direct call
9609   P (T'Class (Obj));       --  Error: Dispatching call
9611   Test (Obj);              --  OK   : Type conversion
9613   if Obj in T'Class then   --  OK   : Membership test
9614      null;
9615   end if;
9616 end Example;
9617 @end smallexample
9619 @node No_Dynamic_Attachment
9620 @unnumberedsubsec No_Dynamic_Attachment
9621 @findex No_Dynamic_Attachment
9622 [RM D.7] This restriction ensures that there is no call to any of the
9623 operations defined in package Ada.Interrupts
9624 (Is_Reserved, Is_Attached, Current_Handler, Attach_Handler, Exchange_Handler,
9625 Detach_Handler, and Reference).
9627 @findex No_Dynamic_Interrupts
9628 The restriction @code{No_Dynamic_Interrupts} is recognized as a
9629 synonym for @code{No_Dynamic_Attachment}. This is retained for historical
9630 compatibility purposes (and a warning will be generated for its use if
9631 warnings on obsolescent features are activated).
9633 @node No_Dynamic_Priorities
9634 @unnumberedsubsec No_Dynamic_Priorities
9635 @findex No_Dynamic_Priorities
9636 [RM D.7] There are no semantic dependencies on the package Dynamic_Priorities.
9638 @node No_Entry_Calls_In_Elaboration_Code
9639 @unnumberedsubsec No_Entry_Calls_In_Elaboration_Code
9640 @findex No_Entry_Calls_In_Elaboration_Code
9641 [GNAT] This restriction ensures at compile time that no task or protected entry
9642 calls are made during elaboration code.  As a result of the use of this
9643 restriction, the compiler can assume that no code past an accept statement
9644 in a task can be executed at elaboration time.
9646 @node No_Enumeration_Maps
9647 @unnumberedsubsec No_Enumeration_Maps
9648 @findex No_Enumeration_Maps
9649 [GNAT] This restriction ensures at compile time that no operations requiring
9650 enumeration maps are used (that is Image and Value attributes applied
9651 to enumeration types).
9653 @node No_Exception_Handlers
9654 @unnumberedsubsec No_Exception_Handlers
9655 @findex No_Exception_Handlers
9656 [GNAT] This restriction ensures at compile time that there are no explicit
9657 exception handlers. It also indicates that no exception propagation will
9658 be provided. In this mode, exceptions may be raised but will result in
9659 an immediate call to the last chance handler, a routine that the user
9660 must define with the following profile:
9662 @smallexample @c ada
9663 procedure Last_Chance_Handler
9664   (Source_Location : System.Address; Line : Integer);
9665 pragma Export (C, Last_Chance_Handler,
9666                "__gnat_last_chance_handler");
9667 @end smallexample
9669 The parameter is a C null-terminated string representing a message to be
9670 associated with the exception (typically the source location of the raise
9671 statement generated by the compiler). The Line parameter when nonzero
9672 represents the line number in the source program where the raise occurs.
9674 @node No_Exception_Propagation
9675 @unnumberedsubsec No_Exception_Propagation
9676 @findex No_Exception_Propagation
9677 [GNAT] This restriction guarantees that exceptions are never propagated
9678 to an outer subprogram scope. The only case in which an exception may
9679 be raised is when the handler is statically in the same subprogram, so
9680 that the effect of a raise is essentially like a goto statement. Any
9681 other raise statement (implicit or explicit) will be considered
9682 unhandled. Exception handlers are allowed, but may not contain an
9683 exception occurrence identifier (exception choice). In addition, use of
9684 the package GNAT.Current_Exception is not permitted, and reraise
9685 statements (raise with no operand) are not permitted.
9687 @node No_Exception_Registration
9688 @unnumberedsubsec No_Exception_Registration
9689 @findex No_Exception_Registration
9690 [GNAT] This restriction ensures at compile time that no stream operations for
9691 types Exception_Id or Exception_Occurrence are used. This also makes it
9692 impossible to pass exceptions to or from a partition with this restriction
9693 in a distributed environment. If this exception is active, then the generated
9694 code is simplified by omitting the otherwise-required global registration
9695 of exceptions when they are declared.
9697 @node No_Exceptions
9698 @unnumberedsubsec No_Exceptions
9699 @findex No_Exceptions
9700 [RM H.4] This restriction ensures at compile time that there are no
9701 raise statements and no exception handlers.
9703 @node No_Finalization
9704 @unnumberedsubsec No_Finalization
9705 @findex No_Finalization
9706 [GNAT] This restriction disables the language features described in
9707 chapter 7.6 of the Ada 2005 RM as well as all form of code generation
9708 performed by the compiler to support these features. The following types
9709 are no longer considered controlled when this restriction is in effect:
9710 @itemize @bullet
9711 @item
9712 @code{Ada.Finalization.Controlled}
9713 @item
9714 @code{Ada.Finalization.Limited_Controlled}
9715 @item
9716 Derivations from @code{Controlled} or @code{Limited_Controlled}
9717 @item
9718 Class-wide types
9719 @item
9720 Protected types
9721 @item
9722 Task types
9723 @item
9724 Array and record types with controlled components
9725 @end itemize
9726 The compiler no longer generates code to initialize, finalize or adjust an
9727 object or a nested component, either declared on the stack or on the heap. The
9728 deallocation of a controlled object no longer finalizes its contents.
9730 @node No_Fixed_Point
9731 @unnumberedsubsec No_Fixed_Point
9732 @findex No_Fixed_Point
9733 [RM H.4] This restriction ensures at compile time that there are no
9734 occurrences of fixed point types and operations.
9736 @node No_Floating_Point
9737 @unnumberedsubsec No_Floating_Point
9738 @findex No_Floating_Point
9739 [RM H.4] This restriction ensures at compile time that there are no
9740 occurrences of floating point types and operations.
9742 @node No_Implicit_Conditionals
9743 @unnumberedsubsec No_Implicit_Conditionals
9744 @findex No_Implicit_Conditionals
9745 [GNAT] This restriction ensures that the generated code does not contain any
9746 implicit conditionals, either by modifying the generated code where possible,
9747 or by rejecting any construct that would otherwise generate an implicit
9748 conditional. Note that this check does not include run time constraint
9749 checks, which on some targets may generate implicit conditionals as
9750 well. To control the latter, constraint checks can be suppressed in the
9751 normal manner. Constructs generating implicit conditionals include comparisons
9752 of composite objects and the Max/Min attributes.
9754 @node No_Implicit_Dynamic_Code
9755 @unnumberedsubsec No_Implicit_Dynamic_Code
9756 @findex No_Implicit_Dynamic_Code
9757 @cindex trampoline
9758 [GNAT] This restriction prevents the compiler from building ``trampolines''.
9759 This is a structure that is built on the stack and contains dynamic
9760 code to be executed at run time. On some targets, a trampoline is
9761 built for the following features: @code{Access},
9762 @code{Unrestricted_Access}, or @code{Address} of a nested subprogram;
9763 nested task bodies; primitive operations of nested tagged types.
9764 Trampolines do not work on machines that prevent execution of stack
9765 data. For example, on windows systems, enabling DEP (data execution
9766 protection) will cause trampolines to raise an exception.
9767 Trampolines are also quite slow at run time.
9769 On many targets, trampolines have been largely eliminated. Look at the
9770 version of system.ads for your target --- if it has
9771 Always_Compatible_Rep equal to False, then trampolines are largely
9772 eliminated. In particular, a trampoline is built for the following
9773 features: @code{Address} of a nested subprogram;
9774 @code{Access} or @code{Unrestricted_Access} of a nested subprogram,
9775 but only if pragma Favor_Top_Level applies, or the access type has a
9776 foreign-language convention; primitive operations of nested tagged
9777 types.
9779 @node No_Implicit_Heap_Allocations
9780 @unnumberedsubsec No_Implicit_Heap_Allocations
9781 @findex No_Implicit_Heap_Allocations
9782 [RM D.7] No constructs are allowed to cause implicit heap allocation.
9784 @node No_Implicit_Loops
9785 @unnumberedsubsec No_Implicit_Loops
9786 @findex No_Implicit_Loops
9787 [GNAT] This restriction ensures that the generated code does not contain any
9788 implicit @code{for} loops, either by modifying
9789 the generated code where possible,
9790 or by rejecting any construct that would otherwise generate an implicit
9791 @code{for} loop. If this restriction is active, it is possible to build
9792 large array aggregates with all static components without generating an
9793 intermediate temporary, and without generating a loop to initialize individual
9794 components. Otherwise, a loop is created for arrays larger than about 5000
9795 scalar components.
9797 @node No_Initialize_Scalars
9798 @unnumberedsubsec No_Initialize_Scalars
9799 @findex No_Initialize_Scalars
9800 [GNAT] This restriction ensures that no unit in the partition is compiled with
9801 pragma Initialize_Scalars. This allows the generation of more efficient
9802 code, and in particular eliminates dummy null initialization routines that
9803 are otherwise generated for some record and array types.
9805 @node No_IO
9806 @unnumberedsubsec No_IO
9807 @findex No_IO
9808 [RM H.4] This restriction ensures at compile time that there are no
9809 dependences on any of the library units Sequential_IO, Direct_IO,
9810 Text_IO, Wide_Text_IO, Wide_Wide_Text_IO, or Stream_IO.
9812 @node No_Local_Allocators
9813 @unnumberedsubsec No_Local_Allocators
9814 @findex No_Local_Allocators
9815 [RM H.4] This restriction ensures at compile time that there are no
9816 occurrences of an allocator in subprograms, generic subprograms, tasks,
9817 and entry bodies.
9819 @node No_Local_Protected_Objects
9820 @unnumberedsubsec No_Local_Protected_Objects
9821 @findex No_Local_Protected_Objects
9822 [RM D.7] This restriction ensures at compile time that protected objects are
9823 only declared at the library level.
9825 @node No_Local_Timing_Events
9826 @unnumberedsubsec No_Local_Timing_Events
9827 @findex No_Local_Timing_Events
9828 [RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
9829 declared at the library level.
9831 @node No_Nested_Finalization
9832 @unnumberedsubsec No_Nested_Finalization
9833 @findex No_Nested_Finalization
9834 [RM D.7] All objects requiring finalization are declared at the library level.
9836 @node No_Protected_Type_Allocators
9837 @unnumberedsubsec No_Protected_Type_Allocators
9838 @findex No_Protected_Type_Allocators
9839 [RM D.7] This restriction ensures at compile time that there are no allocator
9840 expressions that attempt to allocate protected objects.
9842 @node No_Protected_Types
9843 @unnumberedsubsec No_Protected_Types
9844 @findex No_Protected_Types
9845 [RM H.4] This restriction ensures at compile time that there are no
9846 declarations of protected types or protected objects.
9848 @node No_Recursion
9849 @unnumberedsubsec No_Recursion
9850 @findex No_Recursion
9851 [RM H.4] A program execution is erroneous if a subprogram is invoked as
9852 part of its execution.
9854 @node No_Reentrancy
9855 @unnumberedsubsec No_Reentrancy
9856 @findex No_Reentrancy
9857 [RM H.4] A program execution is erroneous if a subprogram is executed by
9858 two tasks at the same time.
9860 @node No_Relative_Delay
9861 @unnumberedsubsec No_Relative_Delay
9862 @findex No_Relative_Delay
9863 [RM D.7] This restriction ensures at compile time that there are no delay
9864 relative statements and prevents expressions such as @code{delay 1.23;} from
9865 appearing in source code.
9867 @node No_Requeue_Statements
9868 @unnumberedsubsec No_Requeue_Statements
9869 @findex No_Requeue_Statements
9870 [RM D.7] This restriction ensures at compile time that no requeue statements
9871 are permitted and prevents keyword @code{requeue} from being used in source
9872 code.
9874 @findex No_Requeue
9875 The restriction @code{No_Requeue} is recognized as a
9876 synonym for @code{No_Requeue_Statements}. This is retained for historical
9877 compatibility purposes (and a warning will be generated for its use if
9878 warnings on oNobsolescent features are activated).
9880 @node No_Secondary_Stack
9881 @unnumberedsubsec No_Secondary_Stack
9882 @findex No_Secondary_Stack
9883 [GNAT] This restriction ensures at compile time that the generated code
9884 does not contain any reference to the secondary stack.  The secondary
9885 stack is used to implement functions returning unconstrained objects
9886 (arrays or records) on some targets.
9888 @node No_Select_Statements
9889 @unnumberedsubsec No_Select_Statements
9890 @findex No_Select_Statements
9891 [RM D.7] This restriction ensures at compile time no select statements of any
9892 kind are permitted, that is the keyword @code{select} may not appear.
9894 @node No_Specific_Termination_Handlers
9895 @unnumberedsubsec No_Specific_Termination_Handlers
9896 @findex No_Specific_Termination_Handlers
9897 [RM D.7] There are no calls to Ada.Task_Termination.Set_Specific_Handler
9898 or to Ada.Task_Termination.Specific_Handler.
9900 @node No_Specification_of_Aspect
9901 @unnumberedsubsec No_Specification_of_Aspect
9902 @findex No_Specification_of_Aspect
9903 [RM 13.12.1] This restriction checks at compile time that no aspect
9904 specification, attribute definition clause, or pragma is given for a
9905 given aspect.
9907 @node No_Standard_Allocators_After_Elaboration
9908 @unnumberedsubsec No_Standard_Allocators_After_Elaboration
9909 @findex No_Standard_Allocators_After_Elaboration
9910 [RM D.7] Specifies that an allocator using a standard storage pool
9911 should never be evaluated at run time after the elaboration of the
9912 library items of the partition has completed. Otherwise, Storage_Error
9913 is raised.
9915 @node No_Standard_Storage_Pools
9916 @unnumberedsubsec No_Standard_Storage_Pools
9917 @findex No_Standard_Storage_Pools
9918 [GNAT] This restriction ensures at compile time that no access types
9919 use the standard default storage pool.  Any access type declared must
9920 have an explicit Storage_Pool attribute defined specifying a
9921 user-defined storage pool.
9923 @node No_Stream_Optimizations
9924 @unnumberedsubsec No_Stream_Optimizations
9925 @findex No_Stream_Optimizations
9926 [GNAT] This restriction affects the performance of stream operations on types
9927 @code{String}, @code{Wide_String} and @code{Wide_Wide_String}. By default, the
9928 compiler uses block reads and writes when manipulating @code{String} objects
9929 due to their supperior performance. When this restriction is in effect, the
9930 compiler performs all IO operations on a per-character basis.
9932 @node No_Streams
9933 @unnumberedsubsec No_Streams
9934 @findex No_Streams
9935 [GNAT] This restriction ensures at compile/bind time that there are no
9936 stream objects created and no use of stream attributes.
9937 This restriction does not forbid dependences on the package
9938 @code{Ada.Streams}. So it is permissible to with
9939 @code{Ada.Streams} (or another package that does so itself)
9940 as long as no actual stream objects are created and no
9941 stream attributes are used.
9943 Note that the use of restriction allows optimization of tagged types,
9944 since they do not need to worry about dispatching stream operations.
9945 To take maximum advantage of this space-saving optimization, any
9946 unit declaring a tagged type should be compiled with the restriction,
9947 though this is not required.
9949 @node No_Task_Allocators
9950 @unnumberedsubsec No_Task_Allocators
9951 @findex No_Task_Allocators
9952 [RM D.7] There are no allocators for task types
9953 or types containing task subcomponents.
9955 @node No_Task_Attributes_Package
9956 @unnumberedsubsec No_Task_Attributes_Package
9957 @findex No_Task_Attributes_Package
9958 [GNAT] This restriction ensures at compile time that there are no implicit or
9959 explicit dependencies on the package @code{Ada.Task_Attributes}.
9961 @findex No_Task_Attributes
9962 The restriction @code{No_Task_Attributes} is recognized as a synonym
9963 for @code{No_Task_Attributes_Package}. This is retained for historical
9964 compatibility purposes (and a warning will be generated for its use if
9965 warnings on obsolescent features are activated).
9967 @node No_Task_Hierarchy
9968 @unnumberedsubsec No_Task_Hierarchy
9969 @findex No_Task_Hierarchy
9970 [RM D.7] All (non-environment) tasks depend
9971 directly on the environment task of the partition.
9973 @node No_Task_Termination
9974 @unnumberedsubsec No_Task_Termination
9975 @findex No_Task_Termination
9976 [RM D.7] Tasks which terminate are erroneous.
9978 @node No_Tasking
9979 @unnumberedsubsec No_Tasking
9980 @findex No_Tasking
9981 [GNAT] This restriction prevents the declaration of tasks or task types
9982 throughout the partition.  It is similar in effect to the use of
9983 @code{Max_Tasks => 0} except that violations are caught at compile time
9984 and cause an error message to be output either by the compiler or
9985 binder.
9987 @node No_Terminate_Alternatives
9988 @unnumberedsubsec No_Terminate_Alternatives
9989 @findex No_Terminate_Alternatives
9990 [RM D.7] There are no selective accepts with terminate alternatives.
9992 @node No_Unchecked_Access
9993 @unnumberedsubsec No_Unchecked_Access
9994 @findex No_Unchecked_Access
9995 [RM H.4] This restriction ensures at compile time that there are no
9996 occurrences of the Unchecked_Access attribute.
9998 @node Simple_Barriers
9999 @unnumberedsubsec Simple_Barriers
10000 @findex Simple_Barriers
10001 [RM D.7] This restriction ensures at compile time that barriers in entry
10002 declarations for protected types are restricted to either static boolean
10003 expressions or references to simple boolean variables defined in the private
10004 part of the protected type.  No other form of entry barriers is permitted.
10006 @findex Boolean_Entry_Barriers
10007 The restriction @code{Boolean_Entry_Barriers} is recognized as a
10008 synonym for @code{Simple_Barriers}. This is retained for historical
10009 compatibility purposes (and a warning will be generated for its use if
10010 warnings on obsolescent features are activated).
10012 @node Static_Priorities
10013 @unnumberedsubsec Static_Priorities
10014 @findex Static_Priorities
10015 [GNAT] This restriction ensures at compile time that all priority expressions
10016 are static, and that there are no dependences on the package
10017 @code{Ada.Dynamic_Priorities}.
10019 @node Static_Storage_Size
10020 @unnumberedsubsec Static_Storage_Size
10021 @findex Static_Storage_Size
10022 [GNAT] This restriction ensures at compile time that any expression appearing
10023 in a Storage_Size pragma or attribute definition clause is static.
10025 @node Program Unit Level Restrictions
10026 @section Program Unit Level Restrictions
10028 @noindent
10029 The second set of restriction identifiers
10030 does not require partition-wide consistency.
10031 The restriction may be enforced for a single
10032 compilation unit without any effect on any of the
10033 other compilation units in the partition.
10035 @menu
10036 * No_Elaboration_Code::
10037 * No_Entry_Queue::
10038 * No_Implementation_Aspect_Specifications::
10039 * No_Implementation_Attributes::
10040 * No_Implementation_Identifiers::
10041 * No_Implementation_Pragmas::
10042 * No_Implementation_Restrictions::
10043 * No_Implementation_Units::
10044 * No_Implicit_Aliasing::
10045 * No_Obsolescent_Features::
10046 * No_Wide_Characters::
10047 * SPARK_05::
10048 @end menu
10050 @node No_Elaboration_Code
10051 @unnumberedsubsec No_Elaboration_Code
10052 @findex No_Elaboration_Code
10053 [GNAT] This restriction ensures at compile time that no elaboration code is
10054 generated.  Note that this is not the same condition as is enforced
10055 by pragma @code{Preelaborate}.  There are cases in which pragma
10056 @code{Preelaborate} still permits code to be generated (e.g.@: code
10057 to initialize a large array to all zeroes), and there are cases of units
10058 which do not meet the requirements for pragma @code{Preelaborate},
10059 but for which no elaboration code is generated.  Generally, it is
10060 the case that preelaborable units will meet the restrictions, with
10061 the exception of large aggregates initialized with an others_clause,
10062 and exception declarations (which generate calls to a run-time
10063 registry procedure).  This restriction is enforced on
10064 a unit by unit basis, it need not be obeyed consistently
10065 throughout a partition.
10067 In the case of aggregates with others, if the aggregate has a dynamic
10068 size, there is no way to eliminate the elaboration code (such dynamic
10069 bounds would be incompatible with @code{Preelaborate} in any case). If
10070 the bounds are static, then use of this restriction actually modifies
10071 the code choice of the compiler to avoid generating a loop, and instead
10072 generate the aggregate statically if possible, no matter how many times
10073 the data for the others clause must be repeatedly generated.
10075 It is not possible to precisely document
10076 the constructs which are compatible with this restriction, since,
10077 unlike most other restrictions, this is not a restriction on the
10078 source code, but a restriction on the generated object code. For
10079 example, if the source contains a declaration:
10081 @smallexample
10082    Val : constant Integer := X;
10083 @end smallexample
10085 @noindent
10086 where X is not a static constant, it may be possible, depending
10087 on complex optimization circuitry, for the compiler to figure
10088 out the value of X at compile time, in which case this initialization
10089 can be done by the loader, and requires no initialization code. It
10090 is not possible to document the precise conditions under which the
10091 optimizer can figure this out.
10093 Note that this the implementation of this restriction requires full
10094 code generation. If it is used in conjunction with "semantics only"
10095 checking, then some cases of violations may be missed.
10097 @node No_Entry_Queue
10098 @unnumberedsubsec No_Entry_Queue
10099 @findex No_Entry_Queue
10100 [GNAT] This restriction is a declaration that any protected entry compiled in
10101 the scope of the restriction has at most one task waiting on the entry
10102 at any one time, and so no queue is required.  This restriction is not
10103 checked at compile time.  A program execution is erroneous if an attempt
10104 is made to queue a second task on such an entry.
10106 @node No_Implementation_Aspect_Specifications
10107 @unnumberedsubsec No_Implementation_Aspect_Specifications
10108 @findex No_Implementation_Aspect_Specifications
10109 [RM 13.12.1] This restriction checks at compile time that no
10110 GNAT-defined aspects are present.  With this restriction, the only
10111 aspects that can be used are those defined in the Ada Reference Manual.
10113 @node No_Implementation_Attributes
10114 @unnumberedsubsec No_Implementation_Attributes
10115 @findex No_Implementation_Attributes
10116 [RM 13.12.1] This restriction checks at compile time that no
10117 GNAT-defined attributes are present.  With this restriction, the only
10118 attributes that can be used are those defined in the Ada Reference
10119 Manual.
10121 @node No_Implementation_Identifiers
10122 @unnumberedsubsec No_Implementation_Identifiers
10123 @findex No_Implementation_Identifiers
10124 [RM 13.12.1] This restriction checks at compile time that no
10125 implementation-defined identifiers (marked with pragma Implementation_Defined)
10126 occur within language-defined packages.
10128 @node No_Implementation_Pragmas
10129 @unnumberedsubsec No_Implementation_Pragmas
10130 @findex No_Implementation_Pragmas
10131 [RM 13.12.1] This restriction checks at compile time that no
10132 GNAT-defined pragmas are present.  With this restriction, the only
10133 pragmas that can be used are those defined in the Ada Reference Manual.
10135 @node No_Implementation_Restrictions
10136 @unnumberedsubsec No_Implementation_Restrictions
10137 @findex No_Implementation_Restrictions
10138 [GNAT] This restriction checks at compile time that no GNAT-defined restriction
10139 identifiers (other than @code{No_Implementation_Restrictions} itself)
10140 are present.  With this restriction, the only other restriction identifiers
10141 that can be used are those defined in the Ada Reference Manual.
10143 @node No_Implementation_Units
10144 @unnumberedsubsec No_Implementation_Units
10145 @findex No_Implementation_Units
10146 [RM 13.12.1] This restriction checks at compile time that there is no
10147 mention in the context clause of any implementation-defined descendants
10148 of packages Ada, Interfaces, or System.
10150 @node No_Implicit_Aliasing
10151 @unnumberedsubsec No_Implicit_Aliasing
10152 @findex No_Implicit_Aliasing
10153 [GNAT] This restriction, which is not required to be partition-wide consistent,
10154 requires an explicit aliased keyword for an object to which 'Access,
10155 'Unchecked_Access, or 'Address is applied, and forbids entirely the use of
10156 the 'Unrestricted_Access attribute for objects. Note: the reason that
10157 Unrestricted_Access is forbidden is that it would require the prefix
10158 to be aliased, and in such cases, it can always be replaced by
10159 the standard attribute Unchecked_Access which is preferable.
10161 @node No_Obsolescent_Features
10162 @unnumberedsubsec No_Obsolescent_Features
10163 @findex No_Obsolescent_Features
10164 [RM 13.12.1] This restriction checks at compile time that no obsolescent
10165 features are used, as defined in Annex J of the Ada Reference Manual.
10167 @node No_Wide_Characters
10168 @unnumberedsubsec No_Wide_Characters
10169 @findex No_Wide_Characters
10170 [GNAT] This restriction ensures at compile time that no uses of the types
10171 @code{Wide_Character} or @code{Wide_String} or corresponding wide
10172 wide types
10173 appear, and that no wide or wide wide string or character literals
10174 appear in the program (that is literals representing characters not in
10175 type @code{Character}).
10177 @node SPARK_05
10178 @unnumberedsubsec SPARK_05
10179 @findex SPARK_05
10180 [GNAT] This restriction checks at compile time that some constructs
10181 forbidden in SPARK 2005 are not present. Error messages related to
10182 SPARK restriction have the form:
10184 @findex SPARK
10185 The restriction @code{SPARK} is recognized as a
10186 synonym for @code{SPARK_05}. This is retained for historical
10187 compatibility purposes (and an unconditional warning will be generated
10188 for its use, advising replacement by @code{SPARK}.
10190 @smallexample
10191 violation of restriction "SPARK" at <file>
10192  <error message>
10193 @end smallexample
10195 This is not a replacement for the semantic checks performed by the
10196 SPARK Examiner tool, as the compiler only deals currently with code,
10197 not at all with SPARK 2005 annotations and does not guarantee catching all
10198 cases of constructs forbidden by SPARK 2005.
10200 Thus it may well be the case that code which passes the compiler with
10201 the SPARK restriction is rejected by the SPARK Examiner, e.g. due to
10202 the different visibility rules of the Examiner based on SPARK 2005
10203 @code{inherit} annotations.
10205 This restriction can be useful in providing an initial filter for code
10206 developed using SPARK 2005, or in examining legacy code to see how far
10207 it is from meeting SPARK restrictions.
10209 Note that if a unit is compiled in Ada 95 mode with SPARK restriction,
10210 violations will be reported for constructs forbidden in SPARK 95,
10211 instead of SPARK 2005.
10213 @c ------------------------
10214 @node Implementation Advice
10215 @chapter Implementation Advice
10216 @noindent
10217 The main text of the Ada Reference Manual describes the required
10218 behavior of all Ada compilers, and the GNAT compiler conforms to
10219 these requirements.
10221 In addition, there are sections throughout the Ada Reference Manual headed
10222 by the phrase ``Implementation advice''.  These sections are not normative,
10223 i.e., they do not specify requirements that all compilers must
10224 follow.  Rather they provide advice on generally desirable behavior.  You
10225 may wonder why they are not requirements.  The most typical answer is
10226 that they describe behavior that seems generally desirable, but cannot
10227 be provided on all systems, or which may be undesirable on some systems.
10229 As far as practical, GNAT follows the implementation advice sections in
10230 the Ada Reference Manual.  This chapter contains a table giving the
10231 reference manual section number, paragraph number and several keywords
10232 for each advice.  Each entry consists of the text of the advice followed
10233 by the GNAT interpretation of this advice.  Most often, this simply says
10234 ``followed'', which means that GNAT follows the advice.  However, in a
10235 number of cases, GNAT deliberately deviates from this advice, in which
10236 case the text describes what GNAT does and why.
10238 @cindex Error detection
10239 @unnumberedsec 1.1.3(20): Error Detection
10240 @sp 1
10241 @cartouche
10242 If an implementation detects the use of an unsupported Specialized Needs
10243 Annex feature at run time, it should raise @code{Program_Error} if
10244 feasible.
10245 @end cartouche
10246 Not relevant.  All specialized needs annex features are either supported,
10247 or diagnosed at compile time.
10249 @cindex Child Units
10250 @unnumberedsec 1.1.3(31): Child Units
10251 @sp 1
10252 @cartouche
10253 If an implementation wishes to provide implementation-defined
10254 extensions to the functionality of a language-defined library unit, it
10255 should normally do so by adding children to the library unit.
10256 @end cartouche
10257 Followed.
10259 @cindex Bounded errors
10260 @unnumberedsec 1.1.5(12): Bounded Errors
10261 @sp 1
10262 @cartouche
10263 If an implementation detects a bounded error or erroneous
10264 execution, it should raise @code{Program_Error}.
10265 @end cartouche
10266 Followed in all cases in which the implementation detects a bounded
10267 error or erroneous execution.  Not all such situations are detected at
10268 runtime.
10270 @cindex Pragmas
10271 @unnumberedsec 2.8(16): Pragmas
10272 @sp 1
10273 @cartouche
10274 Normally, implementation-defined pragmas should have no semantic effect
10275 for error-free programs; that is, if the implementation-defined pragmas
10276 are removed from a working program, the program should still be legal,
10277 and should still have the same semantics.
10278 @end cartouche
10279 The following implementation defined pragmas are exceptions to this
10280 rule:
10282 @table @code
10283 @item Abort_Defer
10284 Affects semantics
10285 @item Ada_83
10286 Affects legality
10287 @item Assert
10288 Affects semantics
10289 @item CPP_Class
10290 Affects semantics
10291 @item CPP_Constructor
10292 Affects semantics
10293 @item Debug
10294 Affects semantics
10295 @item Interface_Name
10296 Affects semantics
10297 @item Machine_Attribute
10298 Affects semantics
10299 @item Unimplemented_Unit
10300 Affects legality
10301 @item Unchecked_Union
10302 Affects semantics
10303 @end table
10305 @noindent
10306 In each of the above cases, it is essential to the purpose of the pragma
10307 that this advice not be followed.  For details see the separate section
10308 on implementation defined pragmas.
10310 @unnumberedsec 2.8(17-19): Pragmas
10311 @sp 1
10312 @cartouche
10313 Normally, an implementation should not define pragmas that can
10314 make an illegal program legal, except as follows:
10315 @end cartouche
10316 @sp 1
10317 @cartouche
10318 A pragma used to complete a declaration, such as a pragma @code{Import};
10319 @end cartouche
10320 @sp 1
10321 @cartouche
10322 A pragma used to configure the environment by adding, removing, or
10323 replacing @code{library_items}.
10324 @end cartouche
10325 See response to paragraph 16 of this same section.
10327 @cindex Character Sets
10328 @cindex Alternative Character Sets
10329 @unnumberedsec 3.5.2(5): Alternative Character Sets
10330 @sp 1
10331 @cartouche
10332 If an implementation supports a mode with alternative interpretations
10333 for @code{Character} and @code{Wide_Character}, the set of graphic
10334 characters of @code{Character} should nevertheless remain a proper
10335 subset of the set of graphic characters of @code{Wide_Character}.  Any
10336 character set ``localizations'' should be reflected in the results of
10337 the subprograms defined in the language-defined package
10338 @code{Characters.Handling} (see A.3) available in such a mode.  In a mode with
10339 an alternative interpretation of @code{Character}, the implementation should
10340 also support a corresponding change in what is a legal
10341 @code{identifier_letter}.
10342 @end cartouche
10343 Not all wide character modes follow this advice, in particular the JIS
10344 and IEC modes reflect standard usage in Japan, and in these encoding,
10345 the upper half of the Latin-1 set is not part of the wide-character
10346 subset, since the most significant bit is used for wide character
10347 encoding.  However, this only applies to the external forms.  Internally
10348 there is no such restriction.
10350 @cindex Integer types
10351 @unnumberedsec 3.5.4(28): Integer Types
10353 @sp 1
10354 @cartouche
10355 An implementation should support @code{Long_Integer} in addition to
10356 @code{Integer} if the target machine supports 32-bit (or longer)
10357 arithmetic.  No other named integer subtypes are recommended for package
10358 @code{Standard}.  Instead, appropriate named integer subtypes should be
10359 provided in the library package @code{Interfaces} (see B.2).
10360 @end cartouche
10361 @code{Long_Integer} is supported.  Other standard integer types are supported
10362 so this advice is not fully followed.  These types
10363 are supported for convenient interface to C, and so that all hardware
10364 types of the machine are easily available.
10365 @unnumberedsec 3.5.4(29): Integer Types
10367 @sp 1
10368 @cartouche
10369 An implementation for a two's complement machine should support
10370 modular types with a binary modulus up to @code{System.Max_Int*2+2}.  An
10371 implementation should support a non-binary modules up to @code{Integer'Last}.
10372 @end cartouche
10373 Followed.
10375 @cindex Enumeration values
10376 @unnumberedsec 3.5.5(8): Enumeration Values
10377 @sp 1
10378 @cartouche
10379 For the evaluation of a call on @code{@var{S}'Pos} for an enumeration
10380 subtype, if the value of the operand does not correspond to the internal
10381 code for any enumeration literal of its type (perhaps due to an
10382 un-initialized variable), then the implementation should raise
10383 @code{Program_Error}.  This is particularly important for enumeration
10384 types with noncontiguous internal codes specified by an
10385 enumeration_representation_clause.
10386 @end cartouche
10387 Followed.
10389 @cindex Float types
10390 @unnumberedsec 3.5.7(17): Float Types
10391 @sp 1
10392 @cartouche
10393 An implementation should support @code{Long_Float} in addition to
10394 @code{Float} if the target machine supports 11 or more digits of
10395 precision.  No other named floating point subtypes are recommended for
10396 package @code{Standard}.  Instead, appropriate named floating point subtypes
10397 should be provided in the library package @code{Interfaces} (see B.2).
10398 @end cartouche
10399 @code{Short_Float} and @code{Long_Long_Float} are also provided.  The
10400 former provides improved compatibility with other implementations
10401 supporting this type.  The latter corresponds to the highest precision
10402 floating-point type supported by the hardware.  On most machines, this
10403 will be the same as @code{Long_Float}, but on some machines, it will
10404 correspond to the IEEE extended form.  The notable case is all ia32
10405 (x86) implementations, where @code{Long_Long_Float} corresponds to
10406 the 80-bit extended precision format supported in hardware on this
10407 processor.  Note that the 128-bit format on SPARC is not supported,
10408 since this is a software rather than a hardware format.
10410 @cindex Multidimensional arrays
10411 @cindex Arrays, multidimensional
10412 @unnumberedsec 3.6.2(11): Multidimensional Arrays
10413 @sp 1
10414 @cartouche
10415 An implementation should normally represent multidimensional arrays in
10416 row-major order, consistent with the notation used for multidimensional
10417 array aggregates (see 4.3.3).  However, if a pragma @code{Convention}
10418 (@code{Fortran}, @dots{}) applies to a multidimensional array type, then
10419 column-major order should be used instead (see B.5, ``Interfacing with
10420 Fortran'').
10421 @end cartouche
10422 Followed.
10424 @findex Duration'Small
10425 @unnumberedsec 9.6(30-31): Duration'Small
10426 @sp 1
10427 @cartouche
10428 Whenever possible in an implementation, the value of @code{Duration'Small}
10429 should be no greater than 100 microseconds.
10430 @end cartouche
10431 Followed.  (@code{Duration'Small} = 10**(@minus{}9)).
10433 @sp 1
10434 @cartouche
10435 The time base for @code{delay_relative_statements} should be monotonic;
10436 it need not be the same time base as used for @code{Calendar.Clock}.
10437 @end cartouche
10438 Followed.
10440 @unnumberedsec 10.2.1(12): Consistent Representation
10441 @sp 1
10442 @cartouche
10443 In an implementation, a type declared in a pre-elaborated package should
10444 have the same representation in every elaboration of a given version of
10445 the package, whether the elaborations occur in distinct executions of
10446 the same program, or in executions of distinct programs or partitions
10447 that include the given version.
10448 @end cartouche
10449 Followed, except in the case of tagged types.  Tagged types involve
10450 implicit pointers to a local copy of a dispatch table, and these pointers
10451 have representations which thus depend on a particular elaboration of the
10452 package.  It is not easy to see how it would be possible to follow this
10453 advice without severely impacting efficiency of execution.
10455 @cindex Exception information
10456 @unnumberedsec 11.4.1(19): Exception Information
10457 @sp 1
10458 @cartouche
10459 @code{Exception_Message} by default and @code{Exception_Information}
10460 should produce information useful for
10461 debugging.  @code{Exception_Message} should be short, about one
10462 line.  @code{Exception_Information} can be long.  @code{Exception_Message}
10463 should not include the
10464 @code{Exception_Name}.  @code{Exception_Information} should include both
10465 the @code{Exception_Name} and the @code{Exception_Message}.
10466 @end cartouche
10467 Followed.  For each exception that doesn't have a specified
10468 @code{Exception_Message}, the compiler generates one containing the location
10469 of the raise statement.  This location has the form ``file:line'', where
10470 file is the short file name (without path information) and line is the line
10471 number in the file.  Note that in the case of the Zero Cost Exception
10472 mechanism, these messages become redundant with the Exception_Information that
10473 contains a full backtrace of the calling sequence, so they are disabled.
10474 To disable explicitly the generation of the source location message, use the
10475 Pragma @code{Discard_Names}.
10477 @cindex Suppression of checks
10478 @cindex Checks, suppression of
10479 @unnumberedsec 11.5(28): Suppression of Checks
10480 @sp 1
10481 @cartouche
10482 The implementation should minimize the code executed for checks that
10483 have been suppressed.
10484 @end cartouche
10485 Followed.
10487 @cindex Representation clauses
10488 @unnumberedsec 13.1 (21-24): Representation Clauses
10489 @sp 1
10490 @cartouche
10491 The recommended level of support for all representation items is
10492 qualified as follows:
10493 @end cartouche
10494 @sp 1
10495 @cartouche
10496 An implementation need not support representation items containing
10497 non-static expressions, except that an implementation should support a
10498 representation item for a given entity if each non-static expression in
10499 the representation item is a name that statically denotes a constant
10500 declared before the entity.
10501 @end cartouche
10502 Followed.  In fact, GNAT goes beyond the recommended level of support
10503 by allowing nonstatic expressions in some representation clauses even
10504 without the need to declare constants initialized with the values of
10505 such expressions.
10506 For example:
10508 @smallexample @c ada
10509   X : Integer;
10510   Y : Float;
10511   for Y'Address use X'Address;>>
10512 @end smallexample
10514 @sp 1
10515 @cartouche
10516 An implementation need not support a specification for the @code{Size}
10517 for a given composite subtype, nor the size or storage place for an
10518 object (including a component) of a given composite subtype, unless the
10519 constraints on the subtype and its composite subcomponents (if any) are
10520 all static constraints.
10521 @end cartouche
10522 Followed.  Size Clauses are not permitted on non-static components, as
10523 described above.
10525 @sp 1
10526 @cartouche
10527 An aliased component, or a component whose type is by-reference, should
10528 always be allocated at an addressable location.
10529 @end cartouche
10530 Followed.
10532 @cindex Packed types
10533 @unnumberedsec 13.2(6-8): Packed Types
10534 @sp 1
10535 @cartouche
10536 If a type is packed, then the implementation should try to minimize
10537 storage allocated to objects of the type, possibly at the expense of
10538 speed of accessing components, subject to reasonable complexity in
10539 addressing calculations.
10540 @end cartouche
10541 @sp 1
10542 @cartouche
10543 The recommended level of support pragma @code{Pack} is:
10545 For a packed record type, the components should be packed as tightly as
10546 possible subject to the Sizes of the component subtypes, and subject to
10547 any @code{record_representation_clause} that applies to the type; the
10548 implementation may, but need not, reorder components or cross aligned
10549 word boundaries to improve the packing.  A component whose @code{Size} is
10550 greater than the word size may be allocated an integral number of words.
10551 @end cartouche
10552 Followed.  Tight packing of arrays is supported for all component sizes
10553 up to 64-bits. If the array component size is 1 (that is to say, if
10554 the component is a boolean type or an enumeration type with two values)
10555 then values of the type are implicitly initialized to zero. This
10556 happens both for objects of the packed type, and for objects that have a
10557 subcomponent of the packed type.
10559 @sp 1
10560 @cartouche
10561 An implementation should support Address clauses for imported
10562 subprograms.
10563 @end cartouche
10564 Followed.
10565 @cindex @code{Address} clauses
10566 @unnumberedsec 13.3(14-19): Address Clauses
10568 @sp 1
10569 @cartouche
10570 For an array @var{X}, @code{@var{X}'Address} should point at the first
10571 component of the array, and not at the array bounds.
10572 @end cartouche
10573 Followed.
10575 @sp 1
10576 @cartouche
10577 The recommended level of support for the @code{Address} attribute is:
10579 @code{@var{X}'Address} should produce a useful result if @var{X} is an
10580 object that is aliased or of a by-reference type, or is an entity whose
10581 @code{Address} has been specified.
10582 @end cartouche
10583 Followed.  A valid address will be produced even if none of those
10584 conditions have been met.  If necessary, the object is forced into
10585 memory to ensure the address is valid.
10587 @sp 1
10588 @cartouche
10589 An implementation should support @code{Address} clauses for imported
10590 subprograms.
10591 @end cartouche
10592 Followed.
10594 @sp 1
10595 @cartouche
10596 Objects (including subcomponents) that are aliased or of a by-reference
10597 type should be allocated on storage element boundaries.
10598 @end cartouche
10599 Followed.
10601 @sp 1
10602 @cartouche
10603 If the @code{Address} of an object is specified, or it is imported or exported,
10604 then the implementation should not perform optimizations based on
10605 assumptions of no aliases.
10606 @end cartouche
10607 Followed.
10609 @cindex @code{Alignment} clauses
10610 @unnumberedsec 13.3(29-35): Alignment Clauses
10611 @sp 1
10612 @cartouche
10613 The recommended level of support for the @code{Alignment} attribute for
10614 subtypes is:
10616 An implementation should support specified Alignments that are factors
10617 and multiples of the number of storage elements per word, subject to the
10618 following:
10619 @end cartouche
10620 Followed.
10622 @sp 1
10623 @cartouche
10624 An implementation need not support specified @code{Alignment}s for
10625 combinations of @code{Size}s and @code{Alignment}s that cannot be easily
10626 loaded and stored by available machine instructions.
10627 @end cartouche
10628 Followed.
10630 @sp 1
10631 @cartouche
10632 An implementation need not support specified @code{Alignment}s that are
10633 greater than the maximum @code{Alignment} the implementation ever returns by
10634 default.
10635 @end cartouche
10636 Followed.
10638 @sp 1
10639 @cartouche
10640 The recommended level of support for the @code{Alignment} attribute for
10641 objects is:
10643 Same as above, for subtypes, but in addition:
10644 @end cartouche
10645 Followed.
10647 @sp 1
10648 @cartouche
10649 For stand-alone library-level objects of statically constrained
10650 subtypes, the implementation should support all @code{Alignment}s
10651 supported by the target linker.  For example, page alignment is likely to
10652 be supported for such objects, but not for subtypes.
10653 @end cartouche
10654 Followed.
10656 @cindex @code{Size} clauses
10657 @unnumberedsec 13.3(42-43): Size Clauses
10658 @sp 1
10659 @cartouche
10660 The recommended level of support for the @code{Size} attribute of
10661 objects is:
10663 A @code{Size} clause should be supported for an object if the specified
10664 @code{Size} is at least as large as its subtype's @code{Size}, and
10665 corresponds to a size in storage elements that is a multiple of the
10666 object's @code{Alignment} (if the @code{Alignment} is nonzero).
10667 @end cartouche
10668 Followed.
10670 @unnumberedsec 13.3(50-56): Size Clauses
10671 @sp 1
10672 @cartouche
10673 If the @code{Size} of a subtype is specified, and allows for efficient
10674 independent addressability (see 9.10) on the target architecture, then
10675 the @code{Size} of the following objects of the subtype should equal the
10676 @code{Size} of the subtype:
10678 Aliased objects (including components).
10679 @end cartouche
10680 Followed.
10682 @sp 1
10683 @cartouche
10684 @code{Size} clause on a composite subtype should not affect the
10685 internal layout of components.
10686 @end cartouche
10687 Followed. But note that this can be overridden by use of the implementation
10688 pragma Implicit_Packing in the case of packed arrays.
10690 @sp 1
10691 @cartouche
10692 The recommended level of support for the @code{Size} attribute of subtypes is:
10693 @end cartouche
10694 @sp 1
10695 @cartouche
10696 The @code{Size} (if not specified) of a static discrete or fixed point
10697 subtype should be the number of bits needed to represent each value
10698 belonging to the subtype using an unbiased representation, leaving space
10699 for a sign bit only if the subtype contains negative values.  If such a
10700 subtype is a first subtype, then an implementation should support a
10701 specified @code{Size} for it that reflects this representation.
10702 @end cartouche
10703 Followed.
10705 @sp 1
10706 @cartouche
10707 For a subtype implemented with levels of indirection, the @code{Size}
10708 should include the size of the pointers, but not the size of what they
10709 point at.
10710 @end cartouche
10711 Followed.
10713 @cindex @code{Component_Size} clauses
10714 @unnumberedsec 13.3(71-73): Component Size Clauses
10715 @sp 1
10716 @cartouche
10717 The recommended level of support for the @code{Component_Size}
10718 attribute is:
10719 @end cartouche
10720 @sp 1
10721 @cartouche
10722 An implementation need not support specified @code{Component_Sizes} that are
10723 less than the @code{Size} of the component subtype.
10724 @end cartouche
10725 Followed.
10727 @sp 1
10728 @cartouche
10729 An implementation should support specified @code{Component_Size}s that
10730 are factors and multiples of the word size.  For such
10731 @code{Component_Size}s, the array should contain no gaps between
10732 components.  For other @code{Component_Size}s (if supported), the array
10733 should contain no gaps between components when packing is also
10734 specified; the implementation should forbid this combination in cases
10735 where it cannot support a no-gaps representation.
10736 @end cartouche
10737 Followed.
10739 @cindex Enumeration representation clauses
10740 @cindex Representation clauses, enumeration
10741 @unnumberedsec 13.4(9-10): Enumeration Representation Clauses
10742 @sp 1
10743 @cartouche
10744 The recommended level of support for enumeration representation clauses
10747 An implementation need not support enumeration representation clauses
10748 for boolean types, but should at minimum support the internal codes in
10749 the range @code{System.Min_Int.System.Max_Int}.
10750 @end cartouche
10751 Followed.
10753 @cindex Record representation clauses
10754 @cindex Representation clauses, records
10755 @unnumberedsec 13.5.1(17-22): Record Representation Clauses
10756 @sp 1
10757 @cartouche
10758 The recommended level of support for
10759 @*@code{record_representation_clauses} is:
10761 An implementation should support storage places that can be extracted
10762 with a load, mask, shift sequence of machine code, and set with a load,
10763 shift, mask, store sequence, given the available machine instructions
10764 and run-time model.
10765 @end cartouche
10766 Followed.
10768 @sp 1
10769 @cartouche
10770 A storage place should be supported if its size is equal to the
10771 @code{Size} of the component subtype, and it starts and ends on a
10772 boundary that obeys the @code{Alignment} of the component subtype.
10773 @end cartouche
10774 Followed.
10776 @sp 1
10777 @cartouche
10778 If the default bit ordering applies to the declaration of a given type,
10779 then for a component whose subtype's @code{Size} is less than the word
10780 size, any storage place that does not cross an aligned word boundary
10781 should be supported.
10782 @end cartouche
10783 Followed.
10785 @sp 1
10786 @cartouche
10787 An implementation may reserve a storage place for the tag field of a
10788 tagged type, and disallow other components from overlapping that place.
10789 @end cartouche
10790 Followed.  The storage place for the tag field is the beginning of the tagged
10791 record, and its size is Address'Size.  GNAT will reject an explicit component
10792 clause for the tag field.
10794 @sp 1
10795 @cartouche
10796 An implementation need not support a @code{component_clause} for a
10797 component of an extension part if the storage place is not after the
10798 storage places of all components of the parent type, whether or not
10799 those storage places had been specified.
10800 @end cartouche
10801 Followed.  The above advice on record representation clauses is followed,
10802 and all mentioned features are implemented.
10804 @cindex Storage place attributes
10805 @unnumberedsec 13.5.2(5): Storage Place Attributes
10806 @sp 1
10807 @cartouche
10808 If a component is represented using some form of pointer (such as an
10809 offset) to the actual data of the component, and this data is contiguous
10810 with the rest of the object, then the storage place attributes should
10811 reflect the place of the actual data, not the pointer.  If a component is
10812 allocated discontinuously from the rest of the object, then a warning
10813 should be generated upon reference to one of its storage place
10814 attributes.
10815 @end cartouche
10816 Followed.  There are no such components in GNAT@.
10818 @cindex Bit ordering
10819 @unnumberedsec 13.5.3(7-8): Bit Ordering
10820 @sp 1
10821 @cartouche
10822 The recommended level of support for the non-default bit ordering is:
10823 @end cartouche
10824 @sp 1
10825 @cartouche
10826 If @code{Word_Size} = @code{Storage_Unit}, then the implementation
10827 should support the non-default bit ordering in addition to the default
10828 bit ordering.
10829 @end cartouche
10830 Followed.  Word size does not equal storage size in this implementation.
10831 Thus non-default bit ordering is not supported.
10833 @cindex @code{Address}, as private type
10834 @unnumberedsec 13.7(37): Address as Private
10835 @sp 1
10836 @cartouche
10837 @code{Address} should be of a private type.
10838 @end cartouche
10839 Followed.
10841 @cindex Operations, on @code{Address}
10842 @cindex @code{Address}, operations of
10843 @unnumberedsec 13.7.1(16): Address Operations
10844 @sp 1
10845 @cartouche
10846 Operations in @code{System} and its children should reflect the target
10847 environment semantics as closely as is reasonable.  For example, on most
10848 machines, it makes sense for address arithmetic to ``wrap around''.
10849 Operations that do not make sense should raise @code{Program_Error}.
10850 @end cartouche
10851 Followed.  Address arithmetic is modular arithmetic that wraps around.  No
10852 operation raises @code{Program_Error}, since all operations make sense.
10854 @cindex Unchecked conversion
10855 @unnumberedsec 13.9(14-17): Unchecked Conversion
10856 @sp 1
10857 @cartouche
10858 The @code{Size} of an array object should not include its bounds; hence,
10859 the bounds should not be part of the converted data.
10860 @end cartouche
10861 Followed.
10863 @sp 1
10864 @cartouche
10865 The implementation should not generate unnecessary run-time checks to
10866 ensure that the representation of @var{S} is a representation of the
10867 target type.  It should take advantage of the permission to return by
10868 reference when possible.  Restrictions on unchecked conversions should be
10869 avoided unless required by the target environment.
10870 @end cartouche
10871 Followed.  There are no restrictions on unchecked conversion.  A warning is
10872 generated if the source and target types do not have the same size since
10873 the semantics in this case may be target dependent.
10875 @sp 1
10876 @cartouche
10877 The recommended level of support for unchecked conversions is:
10878 @end cartouche
10879 @sp 1
10880 @cartouche
10881 Unchecked conversions should be supported and should be reversible in
10882 the cases where this clause defines the result.  To enable meaningful use
10883 of unchecked conversion, a contiguous representation should be used for
10884 elementary subtypes, for statically constrained array subtypes whose
10885 component subtype is one of the subtypes described in this paragraph,
10886 and for record subtypes without discriminants whose component subtypes
10887 are described in this paragraph.
10888 @end cartouche
10889 Followed.
10891 @cindex Heap usage, implicit
10892 @unnumberedsec 13.11(23-25): Implicit Heap Usage
10893 @sp 1
10894 @cartouche
10895 An implementation should document any cases in which it dynamically
10896 allocates heap storage for a purpose other than the evaluation of an
10897 allocator.
10898 @end cartouche
10899 Followed, the only other points at which heap storage is dynamically
10900 allocated are as follows:
10902 @itemize @bullet
10903 @item
10904 At initial elaboration time, to allocate dynamically sized global
10905 objects.
10907 @item
10908 To allocate space for a task when a task is created.
10910 @item
10911 To extend the secondary stack dynamically when needed.  The secondary
10912 stack is used for returning variable length results.
10913 @end itemize
10915 @sp 1
10916 @cartouche
10917 A default (implementation-provided) storage pool for an
10918 access-to-constant type should not have overhead to support deallocation of
10919 individual objects.
10920 @end cartouche
10921 Followed.
10923 @sp 1
10924 @cartouche
10925 A storage pool for an anonymous access type should be created at the
10926 point of an allocator for the type, and be reclaimed when the designated
10927 object becomes inaccessible.
10928 @end cartouche
10929 Followed.
10931 @cindex Unchecked deallocation
10932 @unnumberedsec 13.11.2(17): Unchecked De-allocation
10933 @sp 1
10934 @cartouche
10935 For a standard storage pool, @code{Free} should actually reclaim the
10936 storage.
10937 @end cartouche
10938 Followed.
10940 @cindex Stream oriented attributes
10941 @unnumberedsec 13.13.2(17): Stream Oriented Attributes
10942 @sp 1
10943 @cartouche
10944 If a stream element is the same size as a storage element, then the
10945 normal in-memory representation should be used by @code{Read} and
10946 @code{Write} for scalar objects.  Otherwise, @code{Read} and @code{Write}
10947 should use the smallest number of stream elements needed to represent
10948 all values in the base range of the scalar type.
10949 @end cartouche
10951 Followed.  By default, GNAT uses the interpretation suggested by AI-195,
10952 which specifies using the size of the first subtype.
10953 However, such an implementation is based on direct binary
10954 representations and is therefore target- and endianness-dependent.
10955 To address this issue, GNAT also supplies an alternate implementation
10956 of the stream attributes @code{Read} and @code{Write},
10957 which uses the target-independent XDR standard representation
10958 for scalar types.
10959 @cindex XDR representation
10960 @cindex @code{Read} attribute
10961 @cindex @code{Write} attribute
10962 @cindex Stream oriented attributes
10963 The XDR implementation is provided as an alternative body of the
10964 @code{System.Stream_Attributes} package, in the file
10965 @file{s-stratt-xdr.adb} in the GNAT library.
10966 There is no @file{s-stratt-xdr.ads} file.
10967 In order to install the XDR implementation, do the following:
10968 @enumerate
10969 @item Replace the default implementation of the
10970 @code{System.Stream_Attributes} package with the XDR implementation.
10971 For example on a Unix platform issue the commands:
10972 @smallexample
10973 $ mv s-stratt.adb s-stratt-default.adb
10974 $ mv s-stratt-xdr.adb s-stratt.adb
10975 @end smallexample
10977 @item
10978 Rebuild the GNAT run-time library as documented in
10979 @ref{GNAT and Libraries,,, gnat_ugn, @value{EDITION} User's Guide}.
10980 @end enumerate
10982 @unnumberedsec A.1(52): Names of Predefined Numeric Types
10983 @sp 1
10984 @cartouche
10985 If an implementation provides additional named predefined integer types,
10986 then the names should end with @samp{Integer} as in
10987 @samp{Long_Integer}.  If an implementation provides additional named
10988 predefined floating point types, then the names should end with
10989 @samp{Float} as in @samp{Long_Float}.
10990 @end cartouche
10991 Followed.
10993 @findex Ada.Characters.Handling
10994 @unnumberedsec A.3.2(49): @code{Ada.Characters.Handling}
10995 @sp 1
10996 @cartouche
10997 If an implementation provides a localized definition of @code{Character}
10998 or @code{Wide_Character}, then the effects of the subprograms in
10999 @code{Characters.Handling} should reflect the localizations.  See also
11000 3.5.2.
11001 @end cartouche
11002 Followed.  GNAT provides no such localized definitions.
11004 @cindex Bounded-length strings
11005 @unnumberedsec A.4.4(106): Bounded-Length String Handling
11006 @sp 1
11007 @cartouche
11008 Bounded string objects should not be implemented by implicit pointers
11009 and dynamic allocation.
11010 @end cartouche
11011 Followed.  No implicit pointers or dynamic allocation are used.
11013 @cindex Random number generation
11014 @unnumberedsec A.5.2(46-47): Random Number Generation
11015 @sp 1
11016 @cartouche
11017 Any storage associated with an object of type @code{Generator} should be
11018 reclaimed on exit from the scope of the object.
11019 @end cartouche
11020 Followed.
11022 @sp 1
11023 @cartouche
11024 If the generator period is sufficiently long in relation to the number
11025 of distinct initiator values, then each possible value of
11026 @code{Initiator} passed to @code{Reset} should initiate a sequence of
11027 random numbers that does not, in a practical sense, overlap the sequence
11028 initiated by any other value.  If this is not possible, then the mapping
11029 between initiator values and generator states should be a rapidly
11030 varying function of the initiator value.
11031 @end cartouche
11032 Followed.  The generator period is sufficiently long for the first
11033 condition here to hold true.
11035 @findex Get_Immediate
11036 @unnumberedsec A.10.7(23): @code{Get_Immediate}
11037 @sp 1
11038 @cartouche
11039 The @code{Get_Immediate} procedures should be implemented with
11040 unbuffered input.  For a device such as a keyboard, input should be
11041 @dfn{available} if a key has already been typed, whereas for a disk
11042 file, input should always be available except at end of file.  For a file
11043 associated with a keyboard-like device, any line-editing features of the
11044 underlying operating system should be disabled during the execution of
11045 @code{Get_Immediate}.
11046 @end cartouche
11047 Followed on all targets except VxWorks. For VxWorks, there is no way to
11048 provide this functionality that does not result in the input buffer being
11049 flushed before the @code{Get_Immediate} call. A special unit
11050 @code{Interfaces.Vxworks.IO} is provided that contains routines to enable
11051 this functionality.
11053 @findex Export
11054 @unnumberedsec B.1(39-41): Pragma @code{Export}
11055 @sp 1
11056 @cartouche
11057 If an implementation supports pragma @code{Export} to a given language,
11058 then it should also allow the main subprogram to be written in that
11059 language.  It should support some mechanism for invoking the elaboration
11060 of the Ada library units included in the system, and for invoking the
11061 finalization of the environment task.  On typical systems, the
11062 recommended mechanism is to provide two subprograms whose link names are
11063 @code{adainit} and @code{adafinal}.  @code{adainit} should contain the
11064 elaboration code for library units.  @code{adafinal} should contain the
11065 finalization code.  These subprograms should have no effect the second
11066 and subsequent time they are called.
11067 @end cartouche
11068 Followed.
11070 @sp 1
11071 @cartouche
11072 Automatic elaboration of pre-elaborated packages should be
11073 provided when pragma @code{Export} is supported.
11074 @end cartouche
11075 Followed when the main program is in Ada.  If the main program is in a
11076 foreign language, then
11077 @code{adainit} must be called to elaborate pre-elaborated
11078 packages.
11080 @sp 1
11081 @cartouche
11082 For each supported convention @var{L} other than @code{Intrinsic}, an
11083 implementation should support @code{Import} and @code{Export} pragmas
11084 for objects of @var{L}-compatible types and for subprograms, and pragma
11085 @code{Convention} for @var{L}-eligible types and for subprograms,
11086 presuming the other language has corresponding features.  Pragma
11087 @code{Convention} need not be supported for scalar types.
11088 @end cartouche
11089 Followed.
11091 @cindex Package @code{Interfaces}
11092 @findex Interfaces
11093 @unnumberedsec B.2(12-13): Package @code{Interfaces}
11094 @sp 1
11095 @cartouche
11096 For each implementation-defined convention identifier, there should be a
11097 child package of package Interfaces with the corresponding name.  This
11098 package should contain any declarations that would be useful for
11099 interfacing to the language (implementation) represented by the
11100 convention.  Any declarations useful for interfacing to any language on
11101 the given hardware architecture should be provided directly in
11102 @code{Interfaces}.
11103 @end cartouche
11104 Followed. An additional package not defined
11105 in the Ada Reference Manual is @code{Interfaces.CPP}, used
11106 for interfacing to C++.
11108 @sp 1
11109 @cartouche
11110 An implementation supporting an interface to C, COBOL, or Fortran should
11111 provide the corresponding package or packages described in the following
11112 clauses.
11113 @end cartouche
11114 Followed.  GNAT provides all the packages described in this section.
11116 @cindex C, interfacing with
11117 @unnumberedsec B.3(63-71): Interfacing with C
11118 @sp 1
11119 @cartouche
11120 An implementation should support the following interface correspondences
11121 between Ada and C@.
11122 @end cartouche
11123 Followed.
11125 @sp 1
11126 @cartouche
11127 An Ada procedure corresponds to a void-returning C function.
11128 @end cartouche
11129 Followed.
11131 @sp 1
11132 @cartouche
11133 An Ada function corresponds to a non-void C function.
11134 @end cartouche
11135 Followed.
11137 @sp 1
11138 @cartouche
11139 An Ada @code{in} scalar parameter is passed as a scalar argument to a C
11140 function.
11141 @end cartouche
11142 Followed.
11144 @sp 1
11145 @cartouche
11146 An Ada @code{in} parameter of an access-to-object type with designated
11147 type @var{T} is passed as a @code{@var{t}*} argument to a C function,
11148 where @var{t} is the C type corresponding to the Ada type @var{T}.
11149 @end cartouche
11150 Followed.
11152 @sp 1
11153 @cartouche
11154 An Ada access @var{T} parameter, or an Ada @code{out} or @code{in out}
11155 parameter of an elementary type @var{T}, is passed as a @code{@var{t}*}
11156 argument to a C function, where @var{t} is the C type corresponding to
11157 the Ada type @var{T}.  In the case of an elementary @code{out} or
11158 @code{in out} parameter, a pointer to a temporary copy is used to
11159 preserve by-copy semantics.
11160 @end cartouche
11161 Followed.
11163 @sp 1
11164 @cartouche
11165 An Ada parameter of a record type @var{T}, of any mode, is passed as a
11166 @code{@var{t}*} argument to a C function, where @var{t} is the C
11167 structure corresponding to the Ada type @var{T}.
11168 @end cartouche
11169 Followed.  This convention may be overridden by the use of the C_Pass_By_Copy
11170 pragma, or Convention, or by explicitly specifying the mechanism for a given
11171 call using an extended import or export pragma.
11173 @sp 1
11174 @cartouche
11175 An Ada parameter of an array type with component type @var{T}, of any
11176 mode, is passed as a @code{@var{t}*} argument to a C function, where
11177 @var{t} is the C type corresponding to the Ada type @var{T}.
11178 @end cartouche
11179 Followed.
11181 @sp 1
11182 @cartouche
11183 An Ada parameter of an access-to-subprogram type is passed as a pointer
11184 to a C function whose prototype corresponds to the designated
11185 subprogram's specification.
11186 @end cartouche
11187 Followed.
11189 @cindex COBOL, interfacing with
11190 @unnumberedsec B.4(95-98): Interfacing with COBOL
11191 @sp 1
11192 @cartouche
11193 An Ada implementation should support the following interface
11194 correspondences between Ada and COBOL@.
11195 @end cartouche
11196 Followed.
11198 @sp 1
11199 @cartouche
11200 An Ada access @var{T} parameter is passed as a @samp{BY REFERENCE} data item of
11201 the COBOL type corresponding to @var{T}.
11202 @end cartouche
11203 Followed.
11205 @sp 1
11206 @cartouche
11207 An Ada in scalar parameter is passed as a @samp{BY CONTENT} data item of
11208 the corresponding COBOL type.
11209 @end cartouche
11210 Followed.
11212 @sp 1
11213 @cartouche
11214 Any other Ada parameter is passed as a @samp{BY REFERENCE} data item of the
11215 COBOL type corresponding to the Ada parameter type; for scalars, a local
11216 copy is used if necessary to ensure by-copy semantics.
11217 @end cartouche
11218 Followed.
11220 @cindex Fortran, interfacing with
11221 @unnumberedsec B.5(22-26): Interfacing with Fortran
11222 @sp 1
11223 @cartouche
11224 An Ada implementation should support the following interface
11225 correspondences between Ada and Fortran:
11226 @end cartouche
11227 Followed.
11229 @sp 1
11230 @cartouche
11231 An Ada procedure corresponds to a Fortran subroutine.
11232 @end cartouche
11233 Followed.
11235 @sp 1
11236 @cartouche
11237 An Ada function corresponds to a Fortran function.
11238 @end cartouche
11239 Followed.
11241 @sp 1
11242 @cartouche
11243 An Ada parameter of an elementary, array, or record type @var{T} is
11244 passed as a @var{T} argument to a Fortran procedure, where @var{T} is
11245 the Fortran type corresponding to the Ada type @var{T}, and where the
11246 INTENT attribute of the corresponding dummy argument matches the Ada
11247 formal parameter mode; the Fortran implementation's parameter passing
11248 conventions are used.  For elementary types, a local copy is used if
11249 necessary to ensure by-copy semantics.
11250 @end cartouche
11251 Followed.
11253 @sp 1
11254 @cartouche
11255 An Ada parameter of an access-to-subprogram type is passed as a
11256 reference to a Fortran procedure whose interface corresponds to the
11257 designated subprogram's specification.
11258 @end cartouche
11259 Followed.
11261 @cindex Machine operations
11262 @unnumberedsec C.1(3-5): Access to Machine Operations
11263 @sp 1
11264 @cartouche
11265 The machine code or intrinsic support should allow access to all
11266 operations normally available to assembly language programmers for the
11267 target environment, including privileged instructions, if any.
11268 @end cartouche
11269 Followed.
11271 @sp 1
11272 @cartouche
11273 The interfacing pragmas (see Annex B) should support interface to
11274 assembler; the default assembler should be associated with the
11275 convention identifier @code{Assembler}.
11276 @end cartouche
11277 Followed.
11279 @sp 1
11280 @cartouche
11281 If an entity is exported to assembly language, then the implementation
11282 should allocate it at an addressable location, and should ensure that it
11283 is retained by the linking process, even if not otherwise referenced
11284 from the Ada code.  The implementation should assume that any call to a
11285 machine code or assembler subprogram is allowed to read or update every
11286 object that is specified as exported.
11287 @end cartouche
11288 Followed.
11290 @unnumberedsec C.1(10-16): Access to Machine Operations
11291 @sp 1
11292 @cartouche
11293 The implementation should ensure that little or no overhead is
11294 associated with calling intrinsic and machine-code subprograms.
11295 @end cartouche
11296 Followed for both intrinsics and machine-code subprograms.
11298 @sp 1
11299 @cartouche
11300 It is recommended that intrinsic subprograms be provided for convenient
11301 access to any machine operations that provide special capabilities or
11302 efficiency and that are not otherwise available through the language
11303 constructs.
11304 @end cartouche
11305 Followed.  A full set of machine operation intrinsic subprograms is provided.
11307 @sp 1
11308 @cartouche
11309 Atomic read-modify-write operations---e.g.@:, test and set, compare and
11310 swap, decrement and test, enqueue/dequeue.
11311 @end cartouche
11312 Followed on any target supporting such operations.
11314 @sp 1
11315 @cartouche
11316 Standard numeric functions---e.g.@:, sin, log.
11317 @end cartouche
11318 Followed on any target supporting such operations.
11320 @sp 1
11321 @cartouche
11322 String manipulation operations---e.g.@:, translate and test.
11323 @end cartouche
11324 Followed on any target supporting such operations.
11326 @sp 1
11327 @cartouche
11328 Vector operations---e.g.@:, compare vector against thresholds.
11329 @end cartouche
11330 Followed on any target supporting such operations.
11332 @sp 1
11333 @cartouche
11334 Direct operations on I/O ports.
11335 @end cartouche
11336 Followed on any target supporting such operations.
11338 @cindex Interrupt support
11339 @unnumberedsec C.3(28): Interrupt Support
11340 @sp 1
11341 @cartouche
11342 If the @code{Ceiling_Locking} policy is not in effect, the
11343 implementation should provide means for the application to specify which
11344 interrupts are to be blocked during protected actions, if the underlying
11345 system allows for a finer-grain control of interrupt blocking.
11346 @end cartouche
11347 Followed.  The underlying system does not allow for finer-grain control
11348 of interrupt blocking.
11350 @cindex Protected procedure handlers
11351 @unnumberedsec C.3.1(20-21): Protected Procedure Handlers
11352 @sp 1
11353 @cartouche
11354 Whenever possible, the implementation should allow interrupt handlers to
11355 be called directly by the hardware.
11356 @end cartouche
11357 Followed on any target where the underlying operating system permits
11358 such direct calls.
11360 @sp 1
11361 @cartouche
11362 Whenever practical, violations of any
11363 implementation-defined restrictions should be detected before run time.
11364 @end cartouche
11365 Followed.  Compile time warnings are given when possible.
11367 @cindex Package @code{Interrupts}
11368 @findex Interrupts
11369 @unnumberedsec C.3.2(25): Package @code{Interrupts}
11371 @sp 1
11372 @cartouche
11373 If implementation-defined forms of interrupt handler procedures are
11374 supported, such as protected procedures with parameters, then for each
11375 such form of a handler, a type analogous to @code{Parameterless_Handler}
11376 should be specified in a child package of @code{Interrupts}, with the
11377 same operations as in the predefined package Interrupts.
11378 @end cartouche
11379 Followed.
11381 @cindex Pre-elaboration requirements
11382 @unnumberedsec C.4(14): Pre-elaboration Requirements
11383 @sp 1
11384 @cartouche
11385 It is recommended that pre-elaborated packages be implemented in such a
11386 way that there should be little or no code executed at run time for the
11387 elaboration of entities not already covered by the Implementation
11388 Requirements.
11389 @end cartouche
11390 Followed.  Executable code is generated in some cases, e.g.@: loops
11391 to initialize large arrays.
11393 @unnumberedsec C.5(8): Pragma @code{Discard_Names}
11394 @sp 1
11395 @cartouche
11396 If the pragma applies to an entity, then the implementation should
11397 reduce the amount of storage used for storing names associated with that
11398 entity.
11399 @end cartouche
11400 Followed.
11402 @cindex Package @code{Task_Attributes}
11403 @findex Task_Attributes
11404 @unnumberedsec C.7.2(30): The Package Task_Attributes
11405 @sp 1
11406 @cartouche
11407 Some implementations are targeted to domains in which memory use at run
11408 time must be completely deterministic.  For such implementations, it is
11409 recommended that the storage for task attributes will be pre-allocated
11410 statically and not from the heap.  This can be accomplished by either
11411 placing restrictions on the number and the size of the task's
11412 attributes, or by using the pre-allocated storage for the first @var{N}
11413 attribute objects, and the heap for the others.  In the latter case,
11414 @var{N} should be documented.
11415 @end cartouche
11416 Not followed.  This implementation is not targeted to such a domain.
11418 @cindex Locking Policies
11419 @unnumberedsec D.3(17): Locking Policies
11421 @sp 1
11422 @cartouche
11423 The implementation should use names that end with @samp{_Locking} for
11424 locking policies defined by the implementation.
11425 @end cartouche
11426 Followed.  Two implementation-defined locking policies are defined,
11427 whose names (@code{Inheritance_Locking} and
11428 @code{Concurrent_Readers_Locking}) follow this suggestion.
11430 @cindex Entry queuing policies
11431 @unnumberedsec D.4(16): Entry Queuing Policies
11432 @sp 1
11433 @cartouche
11434 Names that end with @samp{_Queuing} should be used
11435 for all implementation-defined queuing policies.
11436 @end cartouche
11437 Followed.  No such implementation-defined queuing policies exist.
11439 @cindex Preemptive abort
11440 @unnumberedsec D.6(9-10): Preemptive Abort
11441 @sp 1
11442 @cartouche
11443 Even though the @code{abort_statement} is included in the list of
11444 potentially blocking operations (see 9.5.1), it is recommended that this
11445 statement be implemented in a way that never requires the task executing
11446 the @code{abort_statement} to block.
11447 @end cartouche
11448 Followed.
11450 @sp 1
11451 @cartouche
11452 On a multi-processor, the delay associated with aborting a task on
11453 another processor should be bounded; the implementation should use
11454 periodic polling, if necessary, to achieve this.
11455 @end cartouche
11456 Followed.
11458 @cindex Tasking restrictions
11459 @unnumberedsec D.7(21): Tasking Restrictions
11460 @sp 1
11461 @cartouche
11462 When feasible, the implementation should take advantage of the specified
11463 restrictions to produce a more efficient implementation.
11464 @end cartouche
11465 GNAT currently takes advantage of these restrictions by providing an optimized
11466 run time when the Ravenscar profile and the GNAT restricted run time set
11467 of restrictions are specified.  See pragma @code{Profile (Ravenscar)} and
11468 pragma @code{Profile (Restricted)} for more details.
11470 @cindex Time, monotonic
11471 @unnumberedsec D.8(47-49): Monotonic Time
11472 @sp 1
11473 @cartouche
11474 When appropriate, implementations should provide configuration
11475 mechanisms to change the value of @code{Tick}.
11476 @end cartouche
11477 Such configuration mechanisms are not appropriate to this implementation
11478 and are thus not supported.
11480 @sp 1
11481 @cartouche
11482 It is recommended that @code{Calendar.Clock} and @code{Real_Time.Clock}
11483 be implemented as transformations of the same time base.
11484 @end cartouche
11485 Followed.
11487 @sp 1
11488 @cartouche
11489 It is recommended that the @dfn{best} time base which exists in
11490 the underlying system be available to the application through
11491 @code{Clock}.  @dfn{Best} may mean highest accuracy or largest range.
11492 @end cartouche
11493 Followed.
11495 @cindex Partition communication subsystem
11496 @cindex PCS
11497 @unnumberedsec E.5(28-29): Partition Communication Subsystem
11498 @sp 1
11499 @cartouche
11500 Whenever possible, the PCS on the called partition should allow for
11501 multiple tasks to call the RPC-receiver with different messages and
11502 should allow them to block until the corresponding subprogram body
11503 returns.
11504 @end cartouche
11505 Followed by GLADE, a separately supplied PCS that can be used with
11506 GNAT.
11508 @sp 1
11509 @cartouche
11510 The @code{Write} operation on a stream of type @code{Params_Stream_Type}
11511 should raise @code{Storage_Error} if it runs out of space trying to
11512 write the @code{Item} into the stream.
11513 @end cartouche
11514 Followed by GLADE, a separately supplied PCS that can be used with
11515 GNAT@.
11517 @cindex COBOL support
11518 @unnumberedsec F(7): COBOL Support
11519 @sp 1
11520 @cartouche
11521 If COBOL (respectively, C) is widely supported in the target
11522 environment, implementations supporting the Information Systems Annex
11523 should provide the child package @code{Interfaces.COBOL} (respectively,
11524 @code{Interfaces.C}) specified in Annex B and should support a
11525 @code{convention_identifier} of COBOL (respectively, C) in the interfacing
11526 pragmas (see Annex B), thus allowing Ada programs to interface with
11527 programs written in that language.
11528 @end cartouche
11529 Followed.
11531 @cindex Decimal radix support
11532 @unnumberedsec F.1(2): Decimal Radix Support
11533 @sp 1
11534 @cartouche
11535 Packed decimal should be used as the internal representation for objects
11536 of subtype @var{S} when @var{S}'Machine_Radix = 10.
11537 @end cartouche
11538 Not followed.  GNAT ignores @var{S}'Machine_Radix and always uses binary
11539 representations.
11541 @cindex Numerics
11542 @unnumberedsec G: Numerics
11543 @sp 2
11544 @cartouche
11545 If Fortran (respectively, C) is widely supported in the target
11546 environment, implementations supporting the Numerics Annex
11547 should provide the child package @code{Interfaces.Fortran} (respectively,
11548 @code{Interfaces.C}) specified in Annex B and should support a
11549 @code{convention_identifier} of Fortran (respectively, C) in the interfacing
11550 pragmas (see Annex B), thus allowing Ada programs to interface with
11551 programs written in that language.
11552 @end cartouche
11553 Followed.
11555 @cindex Complex types
11556 @unnumberedsec G.1.1(56-58): Complex Types
11557 @sp 2
11558 @cartouche
11559 Because the usual mathematical meaning of multiplication of a complex
11560 operand and a real operand is that of the scaling of both components of
11561 the former by the latter, an implementation should not perform this
11562 operation by first promoting the real operand to complex type and then
11563 performing a full complex multiplication.  In systems that, in the
11564 future, support an Ada binding to IEC 559:1989, the latter technique
11565 will not generate the required result when one of the components of the
11566 complex operand is infinite.  (Explicit multiplication of the infinite
11567 component by the zero component obtained during promotion yields a NaN
11568 that propagates into the final result.) Analogous advice applies in the
11569 case of multiplication of a complex operand and a pure-imaginary
11570 operand, and in the case of division of a complex operand by a real or
11571 pure-imaginary operand.
11572 @end cartouche
11573 Not followed.
11575 @sp 1
11576 @cartouche
11577 Similarly, because the usual mathematical meaning of addition of a
11578 complex operand and a real operand is that the imaginary operand remains
11579 unchanged, an implementation should not perform this operation by first
11580 promoting the real operand to complex type and then performing a full
11581 complex addition.  In implementations in which the @code{Signed_Zeros}
11582 attribute of the component type is @code{True} (and which therefore
11583 conform to IEC 559:1989 in regard to the handling of the sign of zero in
11584 predefined arithmetic operations), the latter technique will not
11585 generate the required result when the imaginary component of the complex
11586 operand is a negatively signed zero.  (Explicit addition of the negative
11587 zero to the zero obtained during promotion yields a positive zero.)
11588 Analogous advice applies in the case of addition of a complex operand
11589 and a pure-imaginary operand, and in the case of subtraction of a
11590 complex operand and a real or pure-imaginary operand.
11591 @end cartouche
11592 Not followed.
11594 @sp 1
11595 @cartouche
11596 Implementations in which @code{Real'Signed_Zeros} is @code{True} should
11597 attempt to provide a rational treatment of the signs of zero results and
11598 result components.  As one example, the result of the @code{Argument}
11599 function should have the sign of the imaginary component of the
11600 parameter @code{X} when the point represented by that parameter lies on
11601 the positive real axis; as another, the sign of the imaginary component
11602 of the @code{Compose_From_Polar} function should be the same as
11603 (respectively, the opposite of) that of the @code{Argument} parameter when that
11604 parameter has a value of zero and the @code{Modulus} parameter has a
11605 nonnegative (respectively, negative) value.
11606 @end cartouche
11607 Followed.
11609 @cindex Complex elementary functions
11610 @unnumberedsec G.1.2(49): Complex Elementary Functions
11611 @sp 1
11612 @cartouche
11613 Implementations in which @code{Complex_Types.Real'Signed_Zeros} is
11614 @code{True} should attempt to provide a rational treatment of the signs
11615 of zero results and result components.  For example, many of the complex
11616 elementary functions have components that are odd functions of one of
11617 the parameter components; in these cases, the result component should
11618 have the sign of the parameter component at the origin.  Other complex
11619 elementary functions have zero components whose sign is opposite that of
11620 a parameter component at the origin, or is always positive or always
11621 negative.
11622 @end cartouche
11623 Followed.
11625 @cindex Accuracy requirements
11626 @unnumberedsec G.2.4(19): Accuracy Requirements
11627 @sp 1
11628 @cartouche
11629 The versions of the forward trigonometric functions without a
11630 @code{Cycle} parameter should not be implemented by calling the
11631 corresponding version with a @code{Cycle} parameter of
11632 @code{2.0*Numerics.Pi}, since this will not provide the required
11633 accuracy in some portions of the domain.  For the same reason, the
11634 version of @code{Log} without a @code{Base} parameter should not be
11635 implemented by calling the corresponding version with a @code{Base}
11636 parameter of @code{Numerics.e}.
11637 @end cartouche
11638 Followed.
11640 @cindex Complex arithmetic accuracy
11641 @cindex Accuracy, complex arithmetic
11642 @unnumberedsec G.2.6(15): Complex Arithmetic Accuracy
11644 @sp 1
11645 @cartouche
11646 The version of the @code{Compose_From_Polar} function without a
11647 @code{Cycle} parameter should not be implemented by calling the
11648 corresponding version with a @code{Cycle} parameter of
11649 @code{2.0*Numerics.Pi}, since this will not provide the required
11650 accuracy in some portions of the domain.
11651 @end cartouche
11652 Followed.
11654 @cindex Sequential elaboration policy
11655 @unnumberedsec H.6(15/2): Pragma Partition_Elaboration_Policy
11657 @sp 1
11658 @cartouche
11659 If the partition elaboration policy is @code{Sequential} and the
11660 Environment task becomes permanently blocked during elaboration then the
11661 partition is deadlocked and it is recommended that the partition be
11662 immediately terminated.
11663 @end cartouche
11664 Not followed.
11666 @c -----------------------------------------
11667 @node Implementation Defined Characteristics
11668 @chapter Implementation Defined Characteristics
11670 @noindent
11671 In addition to the implementation dependent pragmas and attributes, and the
11672 implementation advice, there are a number of other Ada features that are
11673 potentially implementation dependent and are designated as
11674 implementation-defined. These are mentioned throughout the Ada Reference
11675 Manual, and are summarized in Annex M@.
11677 A requirement for conforming Ada compilers is that they provide
11678 documentation describing how the implementation deals with each of these
11679 issues.  In this chapter, you will find each point in Annex M listed
11680 followed by a description in italic font of how GNAT
11681 handles the implementation dependence.
11683 You can use this chapter as a guide to minimizing implementation
11684 dependent features in your programs if portability to other compilers
11685 and other operating systems is an important consideration.  The numbers
11686 in each section below correspond to the paragraph number in the Ada
11687 Reference Manual.
11689 @sp 1
11690 @cartouche
11691 @noindent
11692 @strong{2}.  Whether or not each recommendation given in Implementation
11693 Advice is followed.  See 1.1.2(37).
11694 @end cartouche
11695 @noindent
11696 @xref{Implementation Advice}.
11698 @sp 1
11699 @cartouche
11700 @noindent
11701 @strong{3}.  Capacity limitations of the implementation.  See 1.1.3(3).
11702 @end cartouche
11703 @noindent
11704 The complexity of programs that can be processed is limited only by the
11705 total amount of available virtual memory, and disk space for the
11706 generated object files.
11708 @sp 1
11709 @cartouche
11710 @noindent
11711 @strong{4}.  Variations from the standard that are impractical to avoid
11712 given the implementation's execution environment.  See 1.1.3(6).
11713 @end cartouche
11714 @noindent
11715 There are no variations from the standard.
11717 @sp 1
11718 @cartouche
11719 @noindent
11720 @strong{5}.  Which @code{code_statement}s cause external
11721 interactions.  See 1.1.3(10).
11722 @end cartouche
11723 @noindent
11724 Any @code{code_statement} can potentially cause external interactions.
11726 @sp 1
11727 @cartouche
11728 @noindent
11729 @strong{6}.  The coded representation for the text of an Ada
11730 program.  See 2.1(4).
11731 @end cartouche
11732 @noindent
11733 See separate section on source representation.
11735 @sp 1
11736 @cartouche
11737 @noindent
11738 @strong{7}.  The control functions allowed in comments.  See 2.1(14).
11739 @end cartouche
11740 @noindent
11741 See separate section on source representation.
11743 @sp 1
11744 @cartouche
11745 @noindent
11746 @strong{8}.  The representation for an end of line.  See 2.2(2).
11747 @end cartouche
11748 @noindent
11749 See separate section on source representation.
11751 @sp 1
11752 @cartouche
11753 @noindent
11754 @strong{9}.  Maximum supported line length and lexical element
11755 length.  See 2.2(15).
11756 @end cartouche
11757 @noindent
11758 The maximum line length is 255 characters and the maximum length of
11759 a lexical element is also 255 characters. This is the default setting
11760 if not overridden by the use of compiler switch @option{-gnaty} (which
11761 sets the maximum to 79) or @option{-gnatyMnn} which allows the maximum
11762 line length to be specified to be any value up to 32767. The maximum
11763 length of a lexical element is the same as the maximum line length.
11765 @sp 1
11766 @cartouche
11767 @noindent
11768 @strong{10}.  Implementation defined pragmas.  See 2.8(14).
11769 @end cartouche
11770 @noindent
11772 @xref{Implementation Defined Pragmas}.
11774 @sp 1
11775 @cartouche
11776 @noindent
11777 @strong{11}.  Effect of pragma @code{Optimize}.  See 2.8(27).
11778 @end cartouche
11779 @noindent
11780 Pragma @code{Optimize}, if given with a @code{Time} or @code{Space}
11781 parameter, checks that the optimization flag is set, and aborts if it is
11782 not.
11784 @sp 1
11785 @cartouche
11786 @noindent
11787 @strong{12}.  The sequence of characters of the value returned by
11788 @code{@var{S}'Image} when some of the graphic characters of
11789 @code{@var{S}'Wide_Image} are not defined in @code{Character}.  See
11790 3.5(37).
11791 @end cartouche
11792 @noindent
11793 The sequence of characters is as defined by the wide character encoding
11794 method used for the source.  See section on source representation for
11795 further details.
11797 @sp 1
11798 @cartouche
11799 @noindent
11800 @strong{13}.  The predefined integer types declared in
11801 @code{Standard}.  See 3.5.4(25).
11802 @end cartouche
11803 @noindent
11804 @table @code
11805 @item Short_Short_Integer
11806 8 bit signed
11807 @item Short_Integer
11808 (Short) 16 bit signed
11809 @item Integer
11810 32 bit signed
11811 @item Long_Integer
11812 64 bit signed (on most 64 bit targets, depending on the C definition of long).
11813 32 bit signed (all other targets)
11814 @item Long_Long_Integer
11815 64 bit signed
11816 @end table
11818 @sp 1
11819 @cartouche
11820 @noindent
11821 @strong{14}.  Any nonstandard integer types and the operators defined
11822 for them.  See 3.5.4(26).
11823 @end cartouche
11824 @noindent
11825 There are no nonstandard integer types.
11827 @sp 1
11828 @cartouche
11829 @noindent
11830 @strong{15}.  Any nonstandard real types and the operators defined for
11831 them.  See 3.5.6(8).
11832 @end cartouche
11833 @noindent
11834 There are no nonstandard real types.
11836 @sp 1
11837 @cartouche
11838 @noindent
11839 @strong{16}.  What combinations of requested decimal precision and range
11840 are supported for floating point types.  See 3.5.7(7).
11841 @end cartouche
11842 @noindent
11843 The precision and range is as defined by the IEEE standard.
11845 @sp 1
11846 @cartouche
11847 @noindent
11848 @strong{17}.  The predefined floating point types declared in
11849 @code{Standard}.  See 3.5.7(16).
11850 @end cartouche
11851 @noindent
11852 @table @code
11853 @item Short_Float
11854 32 bit IEEE short
11855 @item Float
11856 (Short) 32 bit IEEE short
11857 @item Long_Float
11858 64 bit IEEE long
11859 @item Long_Long_Float
11860 64 bit IEEE long (80 bit IEEE long on x86 processors)
11861 @end table
11863 @sp 1
11864 @cartouche
11865 @noindent
11866 @strong{18}.  The small of an ordinary fixed point type.  See 3.5.9(8).
11867 @end cartouche
11868 @noindent
11869 @code{Fine_Delta} is 2**(@minus{}63)
11871 @sp 1
11872 @cartouche
11873 @noindent
11874 @strong{19}.  What combinations of small, range, and digits are
11875 supported for fixed point types.  See 3.5.9(10).
11876 @end cartouche
11877 @noindent
11878 Any combinations are permitted that do not result in a small less than
11879 @code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
11880 If the mantissa is larger than 53 bits on machines where Long_Long_Float
11881 is 64 bits (true of all architectures except ia32), then the output from
11882 Text_IO is accurate to only 53 bits, rather than the full mantissa.  This
11883 is because floating-point conversions are used to convert fixed point.
11885 @sp 1
11886 @cartouche
11887 @noindent
11888 @strong{20}.  The result of @code{Tags.Expanded_Name} for types declared
11889 within an unnamed @code{block_statement}.  See 3.9(10).
11890 @end cartouche
11891 @noindent
11892 Block numbers of the form @code{B@var{nnn}}, where @var{nnn} is a
11893 decimal integer are allocated.
11895 @sp 1
11896 @cartouche
11897 @noindent
11898 @strong{21}.  Implementation-defined attributes.  See 4.1.4(12).
11899 @end cartouche
11900 @noindent
11901 @xref{Implementation Defined Attributes}.
11903 @sp 1
11904 @cartouche
11905 @noindent
11906 @strong{22}.  Any implementation-defined time types.  See 9.6(6).
11907 @end cartouche
11908 @noindent
11909 There are no implementation-defined time types.
11911 @sp 1
11912 @cartouche
11913 @noindent
11914 @strong{23}.  The time base associated with relative delays.
11915 @end cartouche
11916 @noindent
11917 See 9.6(20).  The time base used is that provided by the C library
11918 function @code{gettimeofday}.
11920 @sp 1
11921 @cartouche
11922 @noindent
11923 @strong{24}.  The time base of the type @code{Calendar.Time}.  See
11924 9.6(23).
11925 @end cartouche
11926 @noindent
11927 The time base used is that provided by the C library function
11928 @code{gettimeofday}.
11930 @sp 1
11931 @cartouche
11932 @noindent
11933 @strong{25}.  The time zone used for package @code{Calendar}
11934 operations.  See 9.6(24).
11935 @end cartouche
11936 @noindent
11937 The time zone used by package @code{Calendar} is the current system time zone
11938 setting for local time, as accessed by the C library function
11939 @code{localtime}.
11941 @sp 1
11942 @cartouche
11943 @noindent
11944 @strong{26}.  Any limit on @code{delay_until_statements} of
11945 @code{select_statements}.  See 9.6(29).
11946 @end cartouche
11947 @noindent
11948 There are no such limits.
11950 @sp 1
11951 @cartouche
11952 @noindent
11953 @strong{27}.  Whether or not two non-overlapping parts of a composite
11954 object are independently addressable, in the case where packing, record
11955 layout, or @code{Component_Size} is specified for the object.  See
11956 9.10(1).
11957 @end cartouche
11958 @noindent
11959 Separate components are independently addressable if they do not share
11960 overlapping storage units.
11962 @sp 1
11963 @cartouche
11964 @noindent
11965 @strong{28}.  The representation for a compilation.  See 10.1(2).
11966 @end cartouche
11967 @noindent
11968 A compilation is represented by a sequence of files presented to the
11969 compiler in a single invocation of the @command{gcc} command.
11971 @sp 1
11972 @cartouche
11973 @noindent
11974 @strong{29}.  Any restrictions on compilations that contain multiple
11975 compilation_units.  See 10.1(4).
11976 @end cartouche
11977 @noindent
11978 No single file can contain more than one compilation unit, but any
11979 sequence of files can be presented to the compiler as a single
11980 compilation.
11982 @sp 1
11983 @cartouche
11984 @noindent
11985 @strong{30}.  The mechanisms for creating an environment and for adding
11986 and replacing compilation units.  See 10.1.4(3).
11987 @end cartouche
11988 @noindent
11989 See separate section on compilation model.
11991 @sp 1
11992 @cartouche
11993 @noindent
11994 @strong{31}.  The manner of explicitly assigning library units to a
11995 partition.  See 10.2(2).
11996 @end cartouche
11997 @noindent
11998 If a unit contains an Ada main program, then the Ada units for the partition
11999 are determined by recursive application of the rules in the Ada Reference
12000 Manual section 10.2(2-6).  In other words, the Ada units will be those that
12001 are needed by the main program, and then this definition of need is applied
12002 recursively to those units, and the partition contains the transitive
12003 closure determined by this relationship.  In short, all the necessary units
12004 are included, with no need to explicitly specify the list.  If additional
12005 units are required, e.g.@: by foreign language units, then all units must be
12006 mentioned in the context clause of one of the needed Ada units.
12008 If the partition contains no main program, or if the main program is in
12009 a language other than Ada, then GNAT
12010 provides the binder options @option{-z} and @option{-n} respectively, and in
12011 this case a list of units can be explicitly supplied to the binder for
12012 inclusion in the partition (all units needed by these units will also
12013 be included automatically).  For full details on the use of these
12014 options, refer to @ref{The GNAT Make Program gnatmake,,, gnat_ugn,
12015 @value{EDITION} User's Guide}.
12017 @sp 1
12018 @cartouche
12019 @noindent
12020 @strong{32}.  The implementation-defined means, if any, of specifying
12021 which compilation units are needed by a given compilation unit.  See
12022 10.2(2).
12023 @end cartouche
12024 @noindent
12025 The units needed by a given compilation unit are as defined in
12026 the Ada Reference Manual section 10.2(2-6).  There are no
12027 implementation-defined pragmas or other implementation-defined
12028 means for specifying needed units.
12030 @sp 1
12031 @cartouche
12032 @noindent
12033 @strong{33}.  The manner of designating the main subprogram of a
12034 partition.  See 10.2(7).
12035 @end cartouche
12036 @noindent
12037 The main program is designated by providing the name of the
12038 corresponding @file{ALI} file as the input parameter to the binder.
12040 @sp 1
12041 @cartouche
12042 @noindent
12043 @strong{34}.  The order of elaboration of @code{library_items}.  See
12044 10.2(18).
12045 @end cartouche
12046 @noindent
12047 The first constraint on ordering is that it meets the requirements of
12048 Chapter 10 of the Ada Reference Manual.  This still leaves some
12049 implementation dependent choices, which are resolved by first
12050 elaborating bodies as early as possible (i.e., in preference to specs
12051 where there is a choice), and second by evaluating the immediate with
12052 clauses of a unit to determine the probably best choice, and
12053 third by elaborating in alphabetical order of unit names
12054 where a choice still remains.
12056 @sp 1
12057 @cartouche
12058 @noindent
12059 @strong{35}.  Parameter passing and function return for the main
12060 subprogram.  See 10.2(21).
12061 @end cartouche
12062 @noindent
12063 The main program has no parameters.  It may be a procedure, or a function
12064 returning an integer type.  In the latter case, the returned integer
12065 value is the return code of the program (overriding any value that
12066 may have been set by a call to @code{Ada.Command_Line.Set_Exit_Status}).
12068 @sp 1
12069 @cartouche
12070 @noindent
12071 @strong{36}.  The mechanisms for building and running partitions.  See
12072 10.2(24).
12073 @end cartouche
12074 @noindent
12075 GNAT itself supports programs with only a single partition.  The GNATDIST
12076 tool provided with the GLADE package (which also includes an implementation
12077 of the PCS) provides a completely flexible method for building and running
12078 programs consisting of multiple partitions.  See the separate GLADE manual
12079 for details.
12081 @sp 1
12082 @cartouche
12083 @noindent
12084 @strong{37}.  The details of program execution, including program
12085 termination.  See 10.2(25).
12086 @end cartouche
12087 @noindent
12088 See separate section on compilation model.
12090 @sp 1
12091 @cartouche
12092 @noindent
12093 @strong{38}.  The semantics of any non-active partitions supported by the
12094 implementation.  See 10.2(28).
12095 @end cartouche
12096 @noindent
12097 Passive partitions are supported on targets where shared memory is
12098 provided by the operating system.  See the GLADE reference manual for
12099 further details.
12101 @sp 1
12102 @cartouche
12103 @noindent
12104 @strong{39}.  The information returned by @code{Exception_Message}.  See
12105 11.4.1(10).
12106 @end cartouche
12107 @noindent
12108 Exception message returns the null string unless a specific message has
12109 been passed by the program.
12111 @sp 1
12112 @cartouche
12113 @noindent
12114 @strong{40}.  The result of @code{Exceptions.Exception_Name} for types
12115 declared within an unnamed @code{block_statement}.  See 11.4.1(12).
12116 @end cartouche
12117 @noindent
12118 Blocks have implementation defined names of the form @code{B@var{nnn}}
12119 where @var{nnn} is an integer.
12121 @sp 1
12122 @cartouche
12123 @noindent
12124 @strong{41}.  The information returned by
12125 @code{Exception_Information}.  See 11.4.1(13).
12126 @end cartouche
12127 @noindent
12128 @code{Exception_Information} returns a string in the following format:
12130 @smallexample
12131 @emph{Exception_Name:} nnnnn
12132 @emph{Message:} mmmmm
12133 @emph{PID:} ppp
12134 @emph{Load address:} 0xhhhh
12135 @emph{Call stack traceback locations:}
12136 0xhhhh 0xhhhh 0xhhhh ... 0xhhh
12137 @end smallexample
12139 @noindent
12140 where
12142 @itemize @bullet
12143 @item
12144 @code{nnnn} is the fully qualified name of the exception in all upper
12145 case letters. This line is always present.
12147 @item
12148 @code{mmmm} is the message (this line present only if message is non-null)
12150 @item
12151 @code{ppp} is the Process Id value as a decimal integer (this line is
12152 present only if the Process Id is nonzero). Currently we are
12153 not making use of this field.
12155 @item
12156 The Load address line, the Call stack traceback locations line and the
12157 following values are present only if at least one traceback location was
12158 recorded. The Load address indicates the address at which the main executable
12159 was loaded; this line may not be present if operating system hasn't relocated
12160 the main executable. The values are given in C style format, with lower case
12161 letters for a-f, and only as many digits present as are necessary.
12162 @end itemize
12164 @noindent
12165 The line terminator sequence at the end of each line, including
12166 the last line is a single @code{LF} character (@code{16#0A#}).
12168 @sp 1
12169 @cartouche
12170 @noindent
12171 @strong{42}.  Implementation-defined check names.  See 11.5(27).
12172 @end cartouche
12173 @noindent
12174 The implementation defined check name Alignment_Check controls checking of
12175 address clause values for proper alignment (that is, the address supplied
12176 must be consistent with the alignment of the type).
12178 The implementation defined check name Predicate_Check controls whether
12179 predicate checks are generated.
12181 The implementation defined check name Validity_Check controls whether
12182 validity checks are generated.
12184 In addition, a user program can add implementation-defined check names
12185 by means of the pragma Check_Name.
12187 @sp 1
12188 @cartouche
12189 @noindent
12190 @strong{43}.  The interpretation of each aspect of representation.  See
12191 13.1(20).
12192 @end cartouche
12193 @noindent
12194 See separate section on data representations.
12196 @sp 1
12197 @cartouche
12198 @noindent
12199 @strong{44}.  Any restrictions placed upon representation items.  See
12200 13.1(20).
12201 @end cartouche
12202 @noindent
12203 See separate section on data representations.
12205 @sp 1
12206 @cartouche
12207 @noindent
12208 @strong{45}.  The meaning of @code{Size} for indefinite subtypes.  See
12209 13.3(48).
12210 @end cartouche
12211 @noindent
12212 Size for an indefinite subtype is the maximum possible size, except that
12213 for the case of a subprogram parameter, the size of the parameter object
12214 is the actual size.
12216 @sp 1
12217 @cartouche
12218 @noindent
12219 @strong{46}.  The default external representation for a type tag.  See
12220 13.3(75).
12221 @end cartouche
12222 @noindent
12223 The default external representation for a type tag is the fully expanded
12224 name of the type in upper case letters.
12226 @sp 1
12227 @cartouche
12228 @noindent
12229 @strong{47}.  What determines whether a compilation unit is the same in
12230 two different partitions.  See 13.3(76).
12231 @end cartouche
12232 @noindent
12233 A compilation unit is the same in two different partitions if and only
12234 if it derives from the same source file.
12236 @sp 1
12237 @cartouche
12238 @noindent
12239 @strong{48}.  Implementation-defined components.  See 13.5.1(15).
12240 @end cartouche
12241 @noindent
12242 The only implementation defined component is the tag for a tagged type,
12243 which contains a pointer to the dispatching table.
12245 @sp 1
12246 @cartouche
12247 @noindent
12248 @strong{49}.  If @code{Word_Size} = @code{Storage_Unit}, the default bit
12249 ordering.  See 13.5.3(5).
12250 @end cartouche
12251 @noindent
12252 @code{Word_Size} (32) is not the same as @code{Storage_Unit} (8) for this
12253 implementation, so no non-default bit ordering is supported.  The default
12254 bit ordering corresponds to the natural endianness of the target architecture.
12256 @sp 1
12257 @cartouche
12258 @noindent
12259 @strong{50}.  The contents of the visible part of package @code{System}
12260 and its language-defined children.  See 13.7(2).
12261 @end cartouche
12262 @noindent
12263 See the definition of these packages in files @file{system.ads} and
12264 @file{s-stoele.ads}.
12266 @sp 1
12267 @cartouche
12268 @noindent
12269 @strong{51}.  The contents of the visible part of package
12270 @code{System.Machine_Code}, and the meaning of
12271 @code{code_statements}.  See 13.8(7).
12272 @end cartouche
12273 @noindent
12274 See the definition and documentation in file @file{s-maccod.ads}.
12276 @sp 1
12277 @cartouche
12278 @noindent
12279 @strong{52}.  The effect of unchecked conversion.  See 13.9(11).
12280 @end cartouche
12281 @noindent
12282 Unchecked conversion between types of the same size
12283 results in an uninterpreted transmission of the bits from one type
12284 to the other.  If the types are of unequal sizes, then in the case of
12285 discrete types, a shorter source is first zero or sign extended as
12286 necessary, and a shorter target is simply truncated on the left.
12287 For all non-discrete types, the source is first copied if necessary
12288 to ensure that the alignment requirements of the target are met, then
12289 a pointer is constructed to the source value, and the result is obtained
12290 by dereferencing this pointer after converting it to be a pointer to the
12291 target type. Unchecked conversions where the target subtype is an
12292 unconstrained array are not permitted. If the target alignment is
12293 greater than the source alignment, then a copy of the result is
12294 made with appropriate alignment
12296 @sp 1
12297 @cartouche
12298 @noindent
12299 @strong{53}. The semantics of operations on invalid representations.
12300 See 13.9.2(10-11).
12301 @end cartouche
12302 @noindent
12303 For assignments and other operations where the use of invalid values cannot
12304 result in erroneous behavior, the compiler ignores the possibility of invalid
12305 values. An exception is raised at the point where an invalid value would
12306 result in erroneous behavior. For example executing:
12308 @smallexample @c ada
12309 procedure invalidvals is
12310    X : Integer := -1;
12311    Y : Natural range 1 .. 10;
12312    for Y'Address use X'Address;
12313    Z : Natural range 1 .. 10;
12314    A : array (Natural range 1 .. 10) of Integer;
12315 begin
12316    Z := Y;     -- no exception
12317    A (Z) := 3; -- exception raised;
12318 end;
12319 @end smallexample
12321 @noindent
12322 As indicated, an exception is raised on the array assignment, but not
12323 on the simple assignment of the invalid negative value from Y to Z.
12325 @sp 1
12326 @cartouche
12327 @noindent
12328 @strong{53}.  The manner of choosing a storage pool for an access type
12329 when @code{Storage_Pool} is not specified for the type.  See 13.11(17).
12330 @end cartouche
12331 @noindent
12332 There are 3 different standard pools used by the compiler when
12333 @code{Storage_Pool} is not specified depending whether the type is local
12334 to a subprogram or defined at the library level and whether
12335 @code{Storage_Size}is specified or not.  See documentation in the runtime
12336 library units @code{System.Pool_Global}, @code{System.Pool_Size} and
12337 @code{System.Pool_Local} in files @file{s-poosiz.ads},
12338 @file{s-pooglo.ads} and @file{s-pooloc.ads} for full details on the
12339 default pools used.
12341 @sp 1
12342 @cartouche
12343 @noindent
12344 @strong{54}.  Whether or not the implementation provides user-accessible
12345 names for the standard pool type(s).  See 13.11(17).
12346 @end cartouche
12347 @noindent
12349 See documentation in the sources of the run time mentioned in paragraph
12350 @strong{53} .  All these pools are accessible by means of @code{with}'ing
12351 these units.
12353 @sp 1
12354 @cartouche
12355 @noindent
12356 @strong{55}.  The meaning of @code{Storage_Size}.  See 13.11(18).
12357 @end cartouche
12358 @noindent
12359 @code{Storage_Size} is measured in storage units, and refers to the
12360 total space available for an access type collection, or to the primary
12361 stack space for a task.
12363 @sp 1
12364 @cartouche
12365 @noindent
12366 @strong{56}.  Implementation-defined aspects of storage pools.  See
12367 13.11(22).
12368 @end cartouche
12369 @noindent
12370 See documentation in the sources of the run time mentioned in paragraph
12371 @strong{53} for details on GNAT-defined aspects of storage pools.
12373 @sp 1
12374 @cartouche
12375 @noindent
12376 @strong{57}.  The set of restrictions allowed in a pragma
12377 @code{Restrictions}.  See 13.12(7).
12378 @end cartouche
12379 @noindent
12380 @xref{Standard and Implementation Defined Restrictions}.
12382 @sp 1
12383 @cartouche
12384 @noindent
12385 @strong{58}.  The consequences of violating limitations on
12386 @code{Restrictions} pragmas.  See 13.12(9).
12387 @end cartouche
12388 @noindent
12389 Restrictions that can be checked at compile time result in illegalities
12390 if violated.  Currently there are no other consequences of violating
12391 restrictions.
12393 @sp 1
12394 @cartouche
12395 @noindent
12396 @strong{59}.  The representation used by the @code{Read} and
12397 @code{Write} attributes of elementary types in terms of stream
12398 elements.  See 13.13.2(9).
12399 @end cartouche
12400 @noindent
12401 The representation is the in-memory representation of the base type of
12402 the type, using the number of bits corresponding to the
12403 @code{@var{type}'Size} value, and the natural ordering of the machine.
12405 @sp 1
12406 @cartouche
12407 @noindent
12408 @strong{60}.  The names and characteristics of the numeric subtypes
12409 declared in the visible part of package @code{Standard}.  See A.1(3).
12410 @end cartouche
12411 @noindent
12412 See items describing the integer and floating-point types supported.
12414 @sp 1
12415 @cartouche
12416 @noindent
12417 @strong{61}. The string returned by @code{Character_Set_Version}.
12418 See A.3.5(3).
12419 @end cartouche
12420 @noindent
12421 @code{Ada.Wide_Characters.Handling.Character_Set_Version} returns
12422 the string "Unicode 4.0", referring to version 4.0 of the
12423 Unicode specification.
12425 @sp 1
12426 @cartouche
12427 @noindent
12428 @strong{62}.  The accuracy actually achieved by the elementary
12429 functions.  See A.5.1(1).
12430 @end cartouche
12431 @noindent
12432 The elementary functions correspond to the functions available in the C
12433 library.  Only fast math mode is implemented.
12435 @sp 1
12436 @cartouche
12437 @noindent
12438 @strong{63}.  The sign of a zero result from some of the operators or
12439 functions in @code{Numerics.Generic_Elementary_Functions}, when
12440 @code{Float_Type'Signed_Zeros} is @code{True}.  See A.5.1(46).
12441 @end cartouche
12442 @noindent
12443 The sign of zeroes follows the requirements of the IEEE 754 standard on
12444 floating-point.
12446 @sp 1
12447 @cartouche
12448 @noindent
12449 @strong{64}.  The value of
12450 @code{Numerics.Float_Random.Max_Image_Width}.  See A.5.2(27).
12451 @end cartouche
12452 @noindent
12453 Maximum image width is 6864, see library file @file{s-rannum.ads}.
12455 @sp 1
12456 @cartouche
12457 @noindent
12458 @strong{65}.  The value of
12459 @code{Numerics.Discrete_Random.Max_Image_Width}.  See A.5.2(27).
12460 @end cartouche
12461 @noindent
12462 Maximum image width is 6864, see library file @file{s-rannum.ads}.
12464 @sp 1
12465 @cartouche
12466 @noindent
12467 @strong{66}.  The algorithms for random number generation.  See
12468 A.5.2(32).
12469 @end cartouche
12470 @noindent
12471 The algorithm is the Mersenne Twister, as documented in the source file
12472 @file{s-rannum.adb}. This version of the algorithm has a period of
12473 2**19937-1.
12475 @sp 1
12476 @cartouche
12477 @noindent
12478 @strong{67}.  The string representation of a random number generator's
12479 state.  See A.5.2(38).
12480 @end cartouche
12481 @noindent
12482 The value returned by the Image function is the concatenation of
12483 the fixed-width decimal representations of the 624 32-bit integers
12484 of the state vector.
12486 @sp 1
12487 @cartouche
12488 @noindent
12489 @strong{68}.  The minimum time interval between calls to the
12490 time-dependent Reset procedure that are guaranteed to initiate different
12491 random number sequences.  See A.5.2(45).
12492 @end cartouche
12493 @noindent
12494 The minimum period between reset calls to guarantee distinct series of
12495 random numbers is one microsecond.
12497 @sp 1
12498 @cartouche
12499 @noindent
12500 @strong{69}.  The values of the @code{Model_Mantissa},
12501 @code{Model_Emin}, @code{Model_Epsilon}, @code{Model},
12502 @code{Safe_First}, and @code{Safe_Last} attributes, if the Numerics
12503 Annex is not supported.  See A.5.3(72).
12504 @end cartouche
12505 @noindent
12506 Run the compiler with @option{-gnatS} to produce a listing of package
12507 @code{Standard}, has the values of all numeric attributes.
12509 @sp 1
12510 @cartouche
12511 @noindent
12512 @strong{70}.  Any implementation-defined characteristics of the
12513 input-output packages.  See A.7(14).
12514 @end cartouche
12515 @noindent
12516 There are no special implementation defined characteristics for these
12517 packages.
12519 @sp 1
12520 @cartouche
12521 @noindent
12522 @strong{71}.  The value of @code{Buffer_Size} in @code{Storage_IO}.  See
12523 A.9(10).
12524 @end cartouche
12525 @noindent
12526 All type representations are contiguous, and the @code{Buffer_Size} is
12527 the value of @code{@var{type}'Size} rounded up to the next storage unit
12528 boundary.
12530 @sp 1
12531 @cartouche
12532 @noindent
12533 @strong{72}.  External files for standard input, standard output, and
12534 standard error See A.10(5).
12535 @end cartouche
12536 @noindent
12537 These files are mapped onto the files provided by the C streams
12538 libraries.  See source file @file{i-cstrea.ads} for further details.
12540 @sp 1
12541 @cartouche
12542 @noindent
12543 @strong{73}.  The accuracy of the value produced by @code{Put}.  See
12544 A.10.9(36).
12545 @end cartouche
12546 @noindent
12547 If more digits are requested in the output than are represented by the
12548 precision of the value, zeroes are output in the corresponding least
12549 significant digit positions.
12551 @sp 1
12552 @cartouche
12553 @noindent
12554 @strong{74}.  The meaning of @code{Argument_Count}, @code{Argument}, and
12555 @code{Command_Name}.  See A.15(1).
12556 @end cartouche
12557 @noindent
12558 These are mapped onto the @code{argv} and @code{argc} parameters of the
12559 main program in the natural manner.
12561 @sp 1
12562 @cartouche
12563 @noindent
12564 @strong{75}.  The interpretation of the @code{Form} parameter in procedure
12565 @code{Create_Directory}.  See A.16(56).
12566 @end cartouche
12567 @noindent
12568 The @code{Form} parameter is not used.
12570 @sp 1
12571 @cartouche
12572 @noindent
12573 @strong{76}.  The interpretation of the @code{Form} parameter in procedure
12574 @code{Create_Path}.  See A.16(60).
12575 @end cartouche
12576 @noindent
12577 The @code{Form} parameter is not used.
12579 @sp 1
12580 @cartouche
12581 @noindent
12582 @strong{77}.  The interpretation of the @code{Form} parameter in procedure
12583 @code{Copy_File}.  See A.16(68).
12584 @end cartouche
12585 @noindent
12586 The @code{Form} parameter is case-insensitive.
12588 Two fields are recognized in the @code{Form} parameter:
12590 @table @code
12592 @item preserve=<value>
12594 @item mode=<value>
12596 @end table
12598 @noindent
12599 <value> starts immediately after the character '=' and ends with the
12600 character immediately preceding the next comma (',') or with the last
12601 character of the parameter.
12603 The only possible values for preserve= are:
12605 @table @code
12607 @item no_attributes
12608 Do not try to preserve any file attributes. This is the default if no
12609 preserve= is found in Form.
12611 @item all_attributes
12612 Try to preserve all file attributes (timestamps, access rights).
12614 @item timestamps
12615 Preserve the timestamp of the copied file, but not the other file attributes.
12617 @end table
12619 @noindent
12620 The only possible values for mode= are:
12622 @table @code
12624 @item copy
12625 Only do the copy if the destination file does not already exist. If it already
12626 exists, Copy_File fails.
12628 @item overwrite
12629 Copy the file in all cases. Overwrite an already existing destination file.
12631 @item append
12632 Append the original file to the destination file. If the destination file does
12633 not exist, the destination file is a copy of the source file. When mode=append,
12634 the field preserve=, if it exists, is not taken into account.
12636 @end table
12638 @noindent
12639 If the Form parameter includes one or both of the fields and the value or
12640 values are incorrect, Copy_file fails with Use_Error.
12642 Examples of correct Forms:
12644 @smallexample
12645 Form => "preserve=no_attributes,mode=overwrite" (the default)
12646 Form => "mode=append"
12647 Form => "mode=copy, preserve=all_attributes"
12648 @end smallexample
12650 @noindent
12651 Examples of incorrect Forms
12653 @smallexample
12654 Form => "preserve=junk"
12655 Form => "mode=internal, preserve=timestamps"
12656 @end smallexample
12658 @sp 1
12659 @cartouche
12660 @noindent
12661 @strong{78}.  Implementation-defined convention names.  See B.1(11).
12662 @end cartouche
12663 @noindent
12664 The following convention names are supported
12666 @table @code
12667 @item  Ada
12669 @item Ada_Pass_By_Copy
12670 Allowed for any types except by-reference types such as limited
12671 records. Compatible with convention Ada, but causes any parameters
12672 with this convention to be passed by copy.
12673 @item Ada_Pass_By_Reference
12674 Allowed for any types except by-copy types such as scalars.
12675 Compatible with convention Ada, but causes any parameters
12676 with this convention to be passed by reference.
12677 @item Assembler
12678 Assembly language
12679 @item Asm
12680 Synonym for Assembler
12681 @item Assembly
12682 Synonym for Assembler
12683 @item C
12685 @item C_Pass_By_Copy
12686 Allowed only for record types, like C, but also notes that record
12687 is to be passed by copy rather than reference.
12688 @item COBOL
12689 COBOL
12690 @item C_Plus_Plus (or CPP)
12692 @item Default
12693 Treated the same as C
12694 @item External
12695 Treated the same as C
12696 @item Fortran
12697 Fortran
12698 @item Intrinsic
12699 For support of pragma @code{Import} with convention Intrinsic, see
12700 separate section on Intrinsic Subprograms.
12701 @item Stdcall
12702 Stdcall (used for Windows implementations only).  This convention correspond
12703 to the WINAPI (previously called Pascal convention) C/C++ convention under
12704 Windows.  A routine with this convention cleans the stack before
12705 exit. This pragma cannot be applied to a dispatching call.
12706 @item DLL
12707 Synonym for Stdcall
12708 @item Win32
12709 Synonym for Stdcall
12710 @item Stubbed
12711 Stubbed is a special convention used to indicate that the body of the
12712 subprogram will be entirely ignored.  Any call to the subprogram
12713 is converted into a raise of the @code{Program_Error} exception.  If a
12714 pragma @code{Import} specifies convention @code{stubbed} then no body need
12715 be present at all.  This convention is useful during development for the
12716 inclusion of subprograms whose body has not yet been written.
12718 @end table
12719 @noindent
12720 In addition, all otherwise unrecognized convention names are also
12721 treated as being synonymous with convention C@.  In all implementations
12722 except for VMS, use of such other names results in a warning.  In VMS
12723 implementations, these names are accepted silently.
12725 @sp 1
12726 @cartouche
12727 @noindent
12728 @strong{79}.  The meaning of link names.  See B.1(36).
12729 @end cartouche
12730 @noindent
12731 Link names are the actual names used by the linker.
12733 @sp 1
12734 @cartouche
12735 @noindent
12736 @strong{80}.  The manner of choosing link names when neither the link
12737 name nor the address of an imported or exported entity is specified.  See
12738 B.1(36).
12739 @end cartouche
12740 @noindent
12741 The default linker name is that which would be assigned by the relevant
12742 external language, interpreting the Ada name as being in all lower case
12743 letters.
12745 @sp 1
12746 @cartouche
12747 @noindent
12748 @strong{81}.  The effect of pragma @code{Linker_Options}.  See B.1(37).
12749 @end cartouche
12750 @noindent
12751 The string passed to @code{Linker_Options} is presented uninterpreted as
12752 an argument to the link command, unless it contains ASCII.NUL characters.
12753 NUL characters if they appear act as argument separators, so for example
12755 @smallexample @c ada
12756 pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");
12757 @end smallexample
12759 @noindent
12760 causes two separate arguments @code{-labc} and @code{-ldef} to be passed to the
12761 linker. The order of linker options is preserved for a given unit. The final
12762 list of options passed to the linker is in reverse order of the elaboration
12763 order. For example, linker options for a body always appear before the options
12764 from the corresponding package spec.
12766 @sp 1
12767 @cartouche
12768 @noindent
12769 @strong{82}.  The contents of the visible part of package
12770 @code{Interfaces} and its language-defined descendants.  See B.2(1).
12771 @end cartouche
12772 @noindent
12773 See files with prefix @file{i-} in the distributed library.
12775 @sp 1
12776 @cartouche
12777 @noindent
12778 @strong{83}.  Implementation-defined children of package
12779 @code{Interfaces}.  The contents of the visible part of package
12780 @code{Interfaces}.  See B.2(11).
12781 @end cartouche
12782 @noindent
12783 See files with prefix @file{i-} in the distributed library.
12785 @sp 1
12786 @cartouche
12787 @noindent
12788 @strong{84}.  The types @code{Floating}, @code{Long_Floating},
12789 @code{Binary}, @code{Long_Binary}, @code{Decimal_ Element}, and
12790 @code{COBOL_Character}; and the initialization of the variables
12791 @code{Ada_To_COBOL} and @code{COBOL_To_Ada}, in
12792 @code{Interfaces.COBOL}.  See B.4(50).
12793 @end cartouche
12794 @noindent
12795 @table @code
12796 @item Floating
12797 Float
12798 @item Long_Floating
12799 (Floating) Long_Float
12800 @item Binary
12801 Integer
12802 @item Long_Binary
12803 Long_Long_Integer
12804 @item Decimal_Element
12805 Character
12806 @item COBOL_Character
12807 Character
12808 @end table
12810 @noindent
12811 For initialization, see the file @file{i-cobol.ads} in the distributed library.
12813 @sp 1
12814 @cartouche
12815 @noindent
12816 @strong{85}.  Support for access to machine instructions.  See C.1(1).
12817 @end cartouche
12818 @noindent
12819 See documentation in file @file{s-maccod.ads} in the distributed library.
12821 @sp 1
12822 @cartouche
12823 @noindent
12824 @strong{86}.  Implementation-defined aspects of access to machine
12825 operations.  See C.1(9).
12826 @end cartouche
12827 @noindent
12828 See documentation in file @file{s-maccod.ads} in the distributed library.
12830 @sp 1
12831 @cartouche
12832 @noindent
12833 @strong{87}.  Implementation-defined aspects of interrupts.  See C.3(2).
12834 @end cartouche
12835 @noindent
12836 Interrupts are mapped to signals or conditions as appropriate.  See
12837 definition of unit
12838 @code{Ada.Interrupt_Names} in source file @file{a-intnam.ads} for details
12839 on the interrupts supported on a particular target.
12841 @sp 1
12842 @cartouche
12843 @noindent
12844 @strong{88}.  Implementation-defined aspects of pre-elaboration.  See
12845 C.4(13).
12846 @end cartouche
12847 @noindent
12848 GNAT does not permit a partition to be restarted without reloading,
12849 except under control of the debugger.
12851 @sp 1
12852 @cartouche
12853 @noindent
12854 @strong{89}.  The semantics of pragma @code{Discard_Names}.  See C.5(7).
12855 @end cartouche
12856 @noindent
12857 Pragma @code{Discard_Names} causes names of enumeration literals to
12858 be suppressed.  In the presence of this pragma, the Image attribute
12859 provides the image of the Pos of the literal, and Value accepts
12860 Pos values.
12862 @sp 1
12863 @cartouche
12864 @noindent
12865 @strong{90}.  The result of the @code{Task_Identification.Image}
12866 attribute.  See C.7.1(7).
12867 @end cartouche
12868 @noindent
12869 The result of this attribute is a string that identifies
12870 the object or component that denotes a given task. If a variable @code{Var}
12871 has a task type, the image for this task will have the form @code{Var_@var{XXXXXXXX}},
12872 where the suffix
12873 is the hexadecimal representation of the virtual address of the corresponding
12874 task control block. If the variable is an array of tasks, the image of each
12875 task will have the form of an indexed component indicating the position of a
12876 given task in the array, e.g.@: @code{Group(5)_@var{XXXXXXX}}. If the task is a
12877 component of a record, the image of the task will have the form of a selected
12878 component. These rules are fully recursive, so that the image of a task that
12879 is a subcomponent of a composite object corresponds to the expression that
12880 designates this task.
12881 @noindent
12882 If a task is created by an allocator, its image depends on the context. If the
12883 allocator is part of an object declaration, the rules described above are used
12884 to construct its image, and this image is not affected by subsequent
12885 assignments. If the allocator appears within an expression, the image
12886 includes only the name of the task type.
12887 @noindent
12888 If the configuration pragma Discard_Names is present, or if the restriction
12889 No_Implicit_Heap_Allocation is in effect,  the image reduces to
12890 the numeric suffix, that is to say the hexadecimal representation of the
12891 virtual address of the control block of the task.
12892 @sp 1
12893 @cartouche
12894 @noindent
12895 @strong{91}.  The value of @code{Current_Task} when in a protected entry
12896 or interrupt handler.  See C.7.1(17).
12897 @end cartouche
12898 @noindent
12899 Protected entries or interrupt handlers can be executed by any
12900 convenient thread, so the value of @code{Current_Task} is undefined.
12902 @sp 1
12903 @cartouche
12904 @noindent
12905 @strong{92}.  The effect of calling @code{Current_Task} from an entry
12906 body or interrupt handler.  See C.7.1(19).
12907 @end cartouche
12908 @noindent
12909 The effect of calling @code{Current_Task} from an entry body or
12910 interrupt handler is to return the identification of the task currently
12911 executing the code.
12913 @sp 1
12914 @cartouche
12915 @noindent
12916 @strong{93}.  Implementation-defined aspects of
12917 @code{Task_Attributes}.  See C.7.2(19).
12918 @end cartouche
12919 @noindent
12920 There are no implementation-defined aspects of @code{Task_Attributes}.
12922 @sp 1
12923 @cartouche
12924 @noindent
12925 @strong{94}.  Values of all @code{Metrics}.  See D(2).
12926 @end cartouche
12927 @noindent
12928 The metrics information for GNAT depends on the performance of the
12929 underlying operating system.  The sources of the run-time for tasking
12930 implementation, together with the output from @option{-gnatG} can be
12931 used to determine the exact sequence of operating systems calls made
12932 to implement various tasking constructs.  Together with appropriate
12933 information on the performance of the underlying operating system,
12934 on the exact target in use, this information can be used to determine
12935 the required metrics.
12937 @sp 1
12938 @cartouche
12939 @noindent
12940 @strong{95}.  The declarations of @code{Any_Priority} and
12941 @code{Priority}.  See D.1(11).
12942 @end cartouche
12943 @noindent
12944 See declarations in file @file{system.ads}.
12946 @sp 1
12947 @cartouche
12948 @noindent
12949 @strong{96}.  Implementation-defined execution resources.  See D.1(15).
12950 @end cartouche
12951 @noindent
12952 There are no implementation-defined execution resources.
12954 @sp 1
12955 @cartouche
12956 @noindent
12957 @strong{97}.  Whether, on a multiprocessor, a task that is waiting for
12958 access to a protected object keeps its processor busy.  See D.2.1(3).
12959 @end cartouche
12960 @noindent
12961 On a multi-processor, a task that is waiting for access to a protected
12962 object does not keep its processor busy.
12964 @sp 1
12965 @cartouche
12966 @noindent
12967 @strong{98}.  The affect of implementation defined execution resources
12968 on task dispatching.  See D.2.1(9).
12969 @end cartouche
12970 @noindent
12971 Tasks map to threads in the threads package used by GNAT@.  Where possible
12972 and appropriate, these threads correspond to native threads of the
12973 underlying operating system.
12975 @sp 1
12976 @cartouche
12977 @noindent
12978 @strong{99}.  Implementation-defined @code{policy_identifiers} allowed
12979 in a pragma @code{Task_Dispatching_Policy}.  See D.2.2(3).
12980 @end cartouche
12981 @noindent
12982 There are no implementation-defined policy-identifiers allowed in this
12983 pragma.
12985 @sp 1
12986 @cartouche
12987 @noindent
12988 @strong{100}.  Implementation-defined aspects of priority inversion.  See
12989 D.2.2(16).
12990 @end cartouche
12991 @noindent
12992 Execution of a task cannot be preempted by the implementation processing
12993 of delay expirations for lower priority tasks.
12995 @sp 1
12996 @cartouche
12997 @noindent
12998 @strong{101}.  Implementation-defined task dispatching.  See D.2.2(18).
12999 @end cartouche
13000 @noindent
13001 The policy is the same as that of the underlying threads implementation.
13003 @sp 1
13004 @cartouche
13005 @noindent
13006 @strong{102}.  Implementation-defined @code{policy_identifiers} allowed
13007 in a pragma @code{Locking_Policy}.  See D.3(4).
13008 @end cartouche
13009 @noindent
13010 The two implementation defined policies permitted in GNAT are
13011 @code{Inheritance_Locking} and  @code{Conccurent_Readers_Locking}.  On
13012 targets that support the @code{Inheritance_Locking} policy, locking is
13013 implemented by inheritance, i.e.@: the task owning the lock operates
13014 at a priority equal to the highest priority of any task currently
13015 requesting the lock.  On targets that support the
13016 @code{Conccurent_Readers_Locking} policy, locking is implemented with a
13017 read/write lock allowing multiple propected object functions to enter
13018 concurrently.
13020 @sp 1
13021 @cartouche
13022 @noindent
13023 @strong{103}.  Default ceiling priorities.  See D.3(10).
13024 @end cartouche
13025 @noindent
13026 The ceiling priority of protected objects of the type
13027 @code{System.Interrupt_Priority'Last} as described in the Ada
13028 Reference Manual D.3(10),
13030 @sp 1
13031 @cartouche
13032 @noindent
13033 @strong{104}.  The ceiling of any protected object used internally by
13034 the implementation.  See D.3(16).
13035 @end cartouche
13036 @noindent
13037 The ceiling priority of internal protected objects is
13038 @code{System.Priority'Last}.
13040 @sp 1
13041 @cartouche
13042 @noindent
13043 @strong{105}.  Implementation-defined queuing policies.  See D.4(1).
13044 @end cartouche
13045 @noindent
13046 There are no implementation-defined queuing policies.
13048 @sp 1
13049 @cartouche
13050 @noindent
13051 @strong{106}.  On a multiprocessor, any conditions that cause the
13052 completion of an aborted construct to be delayed later than what is
13053 specified for a single processor.  See D.6(3).
13054 @end cartouche
13055 @noindent
13056 The semantics for abort on a multi-processor is the same as on a single
13057 processor, there are no further delays.
13059 @sp 1
13060 @cartouche
13061 @noindent
13062 @strong{107}.  Any operations that implicitly require heap storage
13063 allocation.  See D.7(8).
13064 @end cartouche
13065 @noindent
13066 The only operation that implicitly requires heap storage allocation is
13067 task creation.
13069 @sp 1
13070 @cartouche
13071 @noindent
13072 @strong{108}.  Implementation-defined aspects of pragma
13073 @code{Restrictions}.  See D.7(20).
13074 @end cartouche
13075 @noindent
13076 There are no such implementation-defined aspects.
13078 @sp 1
13079 @cartouche
13080 @noindent
13081 @strong{109}.  Implementation-defined aspects of package
13082 @code{Real_Time}.  See D.8(17).
13083 @end cartouche
13084 @noindent
13085 There are no implementation defined aspects of package @code{Real_Time}.
13087 @sp 1
13088 @cartouche
13089 @noindent
13090 @strong{110}.  Implementation-defined aspects of
13091 @code{delay_statements}.  See D.9(8).
13092 @end cartouche
13093 @noindent
13094 Any difference greater than one microsecond will cause the task to be
13095 delayed (see D.9(7)).
13097 @sp 1
13098 @cartouche
13099 @noindent
13100 @strong{111}.  The upper bound on the duration of interrupt blocking
13101 caused by the implementation.  See D.12(5).
13102 @end cartouche
13103 @noindent
13104 The upper bound is determined by the underlying operating system.  In
13105 no cases is it more than 10 milliseconds.
13107 @sp 1
13108 @cartouche
13109 @noindent
13110 @strong{112}.  The means for creating and executing distributed
13111 programs.  See E(5).
13112 @end cartouche
13113 @noindent
13114 The GLADE package provides a utility GNATDIST for creating and executing
13115 distributed programs.  See the GLADE reference manual for further details.
13117 @sp 1
13118 @cartouche
13119 @noindent
13120 @strong{113}.  Any events that can result in a partition becoming
13121 inaccessible.  See E.1(7).
13122 @end cartouche
13123 @noindent
13124 See the GLADE reference manual for full details on such events.
13126 @sp 1
13127 @cartouche
13128 @noindent
13129 @strong{114}.  The scheduling policies, treatment of priorities, and
13130 management of shared resources between partitions in certain cases.  See
13131 E.1(11).
13132 @end cartouche
13133 @noindent
13134 See the GLADE reference manual for full details on these aspects of
13135 multi-partition execution.
13137 @sp 1
13138 @cartouche
13139 @noindent
13140 @strong{115}.  Events that cause the version of a compilation unit to
13141 change.  See E.3(5).
13142 @end cartouche
13143 @noindent
13144 Editing the source file of a compilation unit, or the source files of
13145 any units on which it is dependent in a significant way cause the version
13146 to change.  No other actions cause the version number to change.  All changes
13147 are significant except those which affect only layout, capitalization or
13148 comments.
13150 @sp 1
13151 @cartouche
13152 @noindent
13153 @strong{116}.  Whether the execution of the remote subprogram is
13154 immediately aborted as a result of cancellation.  See E.4(13).
13155 @end cartouche
13156 @noindent
13157 See the GLADE reference manual for details on the effect of abort in
13158 a distributed application.
13160 @sp 1
13161 @cartouche
13162 @noindent
13163 @strong{117}.  Implementation-defined aspects of the PCS@.  See E.5(25).
13164 @end cartouche
13165 @noindent
13166 See the GLADE reference manual for a full description of all implementation
13167 defined aspects of the PCS@.
13169 @sp 1
13170 @cartouche
13171 @noindent
13172 @strong{118}.  Implementation-defined interfaces in the PCS@.  See
13173 E.5(26).
13174 @end cartouche
13175 @noindent
13176 See the GLADE reference manual for a full description of all
13177 implementation defined interfaces.
13179 @sp 1
13180 @cartouche
13181 @noindent
13182 @strong{119}.  The values of named numbers in the package
13183 @code{Decimal}.  See F.2(7).
13184 @end cartouche
13185 @noindent
13186 @table @code
13187 @item Max_Scale
13189 @item Min_Scale
13191 @item Min_Delta
13192 1.0E-18
13193 @item Max_Delta
13194 1.0E+18
13195 @item Max_Decimal_Digits
13197 @end table
13199 @sp 1
13200 @cartouche
13201 @noindent
13202 @strong{120}.  The value of @code{Max_Picture_Length} in the package
13203 @code{Text_IO.Editing}.  See F.3.3(16).
13204 @end cartouche
13205 @noindent
13208 @sp 1
13209 @cartouche
13210 @noindent
13211 @strong{121}.  The value of @code{Max_Picture_Length} in the package
13212 @code{Wide_Text_IO.Editing}.  See F.3.4(5).
13213 @end cartouche
13214 @noindent
13217 @sp 1
13218 @cartouche
13219 @noindent
13220 @strong{122}.  The accuracy actually achieved by the complex elementary
13221 functions and by other complex arithmetic operations.  See G.1(1).
13222 @end cartouche
13223 @noindent
13224 Standard library functions are used for the complex arithmetic
13225 operations.  Only fast math mode is currently supported.
13227 @sp 1
13228 @cartouche
13229 @noindent
13230 @strong{123}.  The sign of a zero result (or a component thereof) from
13231 any operator or function in @code{Numerics.Generic_Complex_Types}, when
13232 @code{Real'Signed_Zeros} is True.  See G.1.1(53).
13233 @end cartouche
13234 @noindent
13235 The signs of zero values are as recommended by the relevant
13236 implementation advice.
13238 @sp 1
13239 @cartouche
13240 @noindent
13241 @strong{124}.  The sign of a zero result (or a component thereof) from
13242 any operator or function in
13243 @code{Numerics.Generic_Complex_Elementary_Functions}, when
13244 @code{Real'Signed_Zeros} is @code{True}.  See G.1.2(45).
13245 @end cartouche
13246 @noindent
13247 The signs of zero values are as recommended by the relevant
13248 implementation advice.
13250 @sp 1
13251 @cartouche
13252 @noindent
13253 @strong{125}.  Whether the strict mode or the relaxed mode is the
13254 default.  See G.2(2).
13255 @end cartouche
13256 @noindent
13257 The strict mode is the default.  There is no separate relaxed mode.  GNAT
13258 provides a highly efficient implementation of strict mode.
13260 @sp 1
13261 @cartouche
13262 @noindent
13263 @strong{126}.  The result interval in certain cases of fixed-to-float
13264 conversion.  See G.2.1(10).
13265 @end cartouche
13266 @noindent
13267 For cases where the result interval is implementation dependent, the
13268 accuracy is that provided by performing all operations in 64-bit IEEE
13269 floating-point format.
13271 @sp 1
13272 @cartouche
13273 @noindent
13274 @strong{127}.  The result of a floating point arithmetic operation in
13275 overflow situations, when the @code{Machine_Overflows} attribute of the
13276 result type is @code{False}.  See G.2.1(13).
13277 @end cartouche
13278 @noindent
13279 Infinite and NaN values are produced as dictated by the IEEE
13280 floating-point standard.
13282 Note that on machines that are not fully compliant with the IEEE
13283 floating-point standard, such as Alpha, the @option{-mieee} compiler flag
13284 must be used for achieving IEEE conforming behavior (although at the cost
13285 of a significant performance penalty), so infinite and NaN values are
13286 properly generated.
13288 @sp 1
13289 @cartouche
13290 @noindent
13291 @strong{128}.  The result interval for division (or exponentiation by a
13292 negative exponent), when the floating point hardware implements division
13293 as multiplication by a reciprocal.  See G.2.1(16).
13294 @end cartouche
13295 @noindent
13296 Not relevant, division is IEEE exact.
13298 @sp 1
13299 @cartouche
13300 @noindent
13301 @strong{129}.  The definition of close result set, which determines the
13302 accuracy of certain fixed point multiplications and divisions.  See
13303 G.2.3(5).
13304 @end cartouche
13305 @noindent
13306 Operations in the close result set are performed using IEEE long format
13307 floating-point arithmetic.  The input operands are converted to
13308 floating-point, the operation is done in floating-point, and the result
13309 is converted to the target type.
13311 @sp 1
13312 @cartouche
13313 @noindent
13314 @strong{130}.  Conditions on a @code{universal_real} operand of a fixed
13315 point multiplication or division for which the result shall be in the
13316 perfect result set.  See G.2.3(22).
13317 @end cartouche
13318 @noindent
13319 The result is only defined to be in the perfect result set if the result
13320 can be computed by a single scaling operation involving a scale factor
13321 representable in 64-bits.
13323 @sp 1
13324 @cartouche
13325 @noindent
13326 @strong{131}.  The result of a fixed point arithmetic operation in
13327 overflow situations, when the @code{Machine_Overflows} attribute of the
13328 result type is @code{False}.  See G.2.3(27).
13329 @end cartouche
13330 @noindent
13331 Not relevant, @code{Machine_Overflows} is @code{True} for fixed-point
13332 types.
13334 @sp 1
13335 @cartouche
13336 @noindent
13337 @strong{132}.  The result of an elementary function reference in
13338 overflow situations, when the @code{Machine_Overflows} attribute of the
13339 result type is @code{False}.  See G.2.4(4).
13340 @end cartouche
13341 @noindent
13342 IEEE infinite and Nan values are produced as appropriate.
13344 @sp 1
13345 @cartouche
13346 @noindent
13347 @strong{133}.  The value of the angle threshold, within which certain
13348 elementary functions, complex arithmetic operations, and complex
13349 elementary functions yield results conforming to a maximum relative
13350 error bound.  See G.2.4(10).
13351 @end cartouche
13352 @noindent
13353 Information on this subject is not yet available.
13355 @sp 1
13356 @cartouche
13357 @noindent
13358 @strong{134}.  The accuracy of certain elementary functions for
13359 parameters beyond the angle threshold.  See G.2.4(10).
13360 @end cartouche
13361 @noindent
13362 Information on this subject is not yet available.
13364 @sp 1
13365 @cartouche
13366 @noindent
13367 @strong{135}.  The result of a complex arithmetic operation or complex
13368 elementary function reference in overflow situations, when the
13369 @code{Machine_Overflows} attribute of the corresponding real type is
13370 @code{False}.  See G.2.6(5).
13371 @end cartouche
13372 @noindent
13373 IEEE infinite and Nan values are produced as appropriate.
13375 @sp 1
13376 @cartouche
13377 @noindent
13378 @strong{136}.  The accuracy of certain complex arithmetic operations and
13379 certain complex elementary functions for parameters (or components
13380 thereof) beyond the angle threshold.  See G.2.6(8).
13381 @end cartouche
13382 @noindent
13383 Information on those subjects is not yet available.
13385 @sp 1
13386 @cartouche
13387 @noindent
13388 @strong{137}.  Information regarding bounded errors and erroneous
13389 execution.  See H.2(1).
13390 @end cartouche
13391 @noindent
13392 Information on this subject is not yet available.
13394 @sp 1
13395 @cartouche
13396 @noindent
13397 @strong{138}.  Implementation-defined aspects of pragma
13398 @code{Inspection_Point}.  See H.3.2(8).
13399 @end cartouche
13400 @noindent
13401 Pragma @code{Inspection_Point} ensures that the variable is live and can
13402 be examined by the debugger at the inspection point.
13404 @sp 1
13405 @cartouche
13406 @noindent
13407 @strong{139}.  Implementation-defined aspects of pragma
13408 @code{Restrictions}.  See H.4(25).
13409 @end cartouche
13410 @noindent
13411 There are no implementation-defined aspects of pragma @code{Restrictions}.  The
13412 use of pragma @code{Restrictions [No_Exceptions]} has no effect on the
13413 generated code.  Checks must suppressed by use of pragma @code{Suppress}.
13415 @sp 1
13416 @cartouche
13417 @noindent
13418 @strong{140}.  Any restrictions on pragma @code{Restrictions}.  See
13419 H.4(27).
13420 @end cartouche
13421 @noindent
13422 There are no restrictions on pragma @code{Restrictions}.
13424 @node Intrinsic Subprograms
13425 @chapter Intrinsic Subprograms
13426 @cindex Intrinsic Subprograms
13428 @menu
13429 * Intrinsic Operators::
13430 * Enclosing_Entity::
13431 * Exception_Information::
13432 * Exception_Message::
13433 * Exception_Name::
13434 * File::
13435 * Line::
13436 * Shifts and Rotates::
13437 * Source_Location::
13438 @end menu
13440 @noindent
13441 GNAT allows a user application program to write the declaration:
13443 @smallexample @c ada
13444    pragma Import (Intrinsic, name);
13445 @end smallexample
13447 @noindent
13448 providing that the name corresponds to one of the implemented intrinsic
13449 subprograms in GNAT, and that the parameter profile of the referenced
13450 subprogram meets the requirements.  This chapter describes the set of
13451 implemented intrinsic subprograms, and the requirements on parameter profiles.
13452 Note that no body is supplied; as with other uses of pragma Import, the
13453 body is supplied elsewhere (in this case by the compiler itself).  Note
13454 that any use of this feature is potentially non-portable, since the
13455 Ada standard does not require Ada compilers to implement this feature.
13457 @node Intrinsic Operators
13458 @section Intrinsic Operators
13459 @cindex Intrinsic operator
13461 @noindent
13462 All the predefined numeric operators in package Standard
13463 in @code{pragma Import (Intrinsic,..)}
13464 declarations.  In the binary operator case, the operands must have the same
13465 size.  The operand or operands must also be appropriate for
13466 the operator.  For example, for addition, the operands must
13467 both be floating-point or both be fixed-point, and the
13468 right operand for @code{"**"} must have a root type of
13469 @code{Standard.Integer'Base}.
13470 You can use an intrinsic operator declaration as in the following example:
13472 @smallexample @c ada
13473    type Int1 is new Integer;
13474    type Int2 is new Integer;
13476    function "+" (X1 : Int1; X2 : Int2) return Int1;
13477    function "+" (X1 : Int1; X2 : Int2) return Int2;
13478    pragma Import (Intrinsic, "+");
13479 @end smallexample
13481 @noindent
13482 This declaration would permit ``mixed mode'' arithmetic on items
13483 of the differing types @code{Int1} and @code{Int2}.
13484 It is also possible to specify such operators for private types, if the
13485 full views are appropriate arithmetic types.
13487 @node Enclosing_Entity
13488 @section Enclosing_Entity
13489 @cindex Enclosing_Entity
13490 @noindent
13491 This intrinsic subprogram is used in the implementation of the
13492 library routine @code{GNAT.Source_Info}.  The only useful use of the
13493 intrinsic import in this case is the one in this unit, so an
13494 application program should simply call the function
13495 @code{GNAT.Source_Info.Enclosing_Entity} to obtain the name of
13496 the current subprogram, package, task, entry, or protected subprogram.
13498 @node Exception_Information
13499 @section Exception_Information
13500 @cindex Exception_Information'
13501 @noindent
13502 This intrinsic subprogram is used in the implementation of the
13503 library routine @code{GNAT.Current_Exception}.  The only useful
13504 use of the intrinsic import in this case is the one in this unit,
13505 so an application program should simply call the function
13506 @code{GNAT.Current_Exception.Exception_Information} to obtain
13507 the exception information associated with the current exception.
13509 @node Exception_Message
13510 @section Exception_Message
13511 @cindex Exception_Message
13512 @noindent
13513 This intrinsic subprogram is used in the implementation of the
13514 library routine @code{GNAT.Current_Exception}.  The only useful
13515 use of the intrinsic import in this case is the one in this unit,
13516 so an application program should simply call the function
13517 @code{GNAT.Current_Exception.Exception_Message} to obtain
13518 the message associated with the current exception.
13520 @node Exception_Name
13521 @section Exception_Name
13522 @cindex Exception_Name
13523 @noindent
13524 This intrinsic subprogram is used in the implementation of the
13525 library routine @code{GNAT.Current_Exception}.  The only useful
13526 use of the intrinsic import in this case is the one in this unit,
13527 so an application program should simply call the function
13528 @code{GNAT.Current_Exception.Exception_Name} to obtain
13529 the name of the current exception.
13531 @node File
13532 @section File
13533 @cindex File
13534 @noindent
13535 This intrinsic subprogram is used in the implementation of the
13536 library routine @code{GNAT.Source_Info}.  The only useful use of the
13537 intrinsic import in this case is the one in this unit, so an
13538 application program should simply call the function
13539 @code{GNAT.Source_Info.File} to obtain the name of the current
13540 file.
13542 @node Line
13543 @section Line
13544 @cindex Line
13545 @noindent
13546 This intrinsic subprogram is used in the implementation of the
13547 library routine @code{GNAT.Source_Info}.  The only useful use of the
13548 intrinsic import in this case is the one in this unit, so an
13549 application program should simply call the function
13550 @code{GNAT.Source_Info.Line} to obtain the number of the current
13551 source line.
13553 @node Shifts and Rotates
13554 @section Shifts and Rotates
13555 @cindex Shift_Left
13556 @cindex Shift_Right
13557 @cindex Shift_Right_Arithmetic
13558 @cindex Rotate_Left
13559 @cindex Rotate_Right
13560 @noindent
13561 In standard Ada, the shift and rotate functions are available only
13562 for the predefined modular types in package @code{Interfaces}.  However, in
13563 GNAT it is possible to define these functions for any integer
13564 type (signed or modular), as in this example:
13566 @smallexample @c ada
13567    function Shift_Left
13568      (Value  : T;
13569       Amount : Natural)
13570       return   T;
13571 @end smallexample
13573 @noindent
13574 The function name must be one of
13575 Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, or
13576 Rotate_Right. T must be an integer type. T'Size must be
13577 8, 16, 32 or 64 bits; if T is modular, the modulus
13578 must be 2**8, 2**16, 2**32 or 2**64.
13579 The result type must be the same as the type of @code{Value}.
13580 The shift amount must be Natural.
13581 The formal parameter names can be anything.
13583 @node Source_Location
13584 @section Source_Location
13585 @cindex Source_Location
13586 @noindent
13587 This intrinsic subprogram is used in the implementation of the
13588 library routine @code{GNAT.Source_Info}.  The only useful use of the
13589 intrinsic import in this case is the one in this unit, so an
13590 application program should simply call the function
13591 @code{GNAT.Source_Info.Source_Location} to obtain the current
13592 source file location.
13594 @node Representation Clauses and Pragmas
13595 @chapter Representation Clauses and Pragmas
13596 @cindex Representation Clauses
13598 @menu
13599 * Alignment Clauses::
13600 * Size Clauses::
13601 * Storage_Size Clauses::
13602 * Size of Variant Record Objects::
13603 * Biased Representation ::
13604 * Value_Size and Object_Size Clauses::
13605 * Component_Size Clauses::
13606 * Bit_Order Clauses::
13607 * Effect of Bit_Order on Byte Ordering::
13608 * Pragma Pack for Arrays::
13609 * Pragma Pack for Records::
13610 * Record Representation Clauses::
13611 * Enumeration Clauses::
13612 * Address Clauses::
13613 * Effect of Convention on Representation::
13614 * Determining the Representations chosen by GNAT::
13615 @end menu
13617 @noindent
13618 @cindex Representation Clause
13619 @cindex Representation Pragma
13620 @cindex Pragma, representation
13621 This section describes the representation clauses accepted by GNAT, and
13622 their effect on the representation of corresponding data objects.
13624 GNAT fully implements Annex C (Systems Programming).  This means that all
13625 the implementation advice sections in chapter 13 are fully implemented.
13626 However, these sections only require a minimal level of support for
13627 representation clauses.  GNAT provides much more extensive capabilities,
13628 and this section describes the additional capabilities provided.
13630 @node Alignment Clauses
13631 @section Alignment Clauses
13632 @cindex Alignment Clause
13634 @noindent
13635 GNAT requires that all alignment clauses specify a power of 2, and all
13636 default alignments are always a power of 2.  The default alignment
13637 values are as follows:
13639 @itemize @bullet
13640 @item @emph{Primitive Types}.
13641 For primitive types, the alignment is the minimum of the actual size of
13642 objects of the type divided by @code{Storage_Unit},
13643 and the maximum alignment supported by the target.
13644 (This maximum alignment is given by the GNAT-specific attribute
13645 @code{Standard'Maximum_Alignment}; see @ref{Attribute Maximum_Alignment}.)
13646 @cindex @code{Maximum_Alignment} attribute
13647 For example, for type @code{Long_Float}, the object size is 8 bytes, and the
13648 default alignment will be 8 on any target that supports alignments
13649 this large, but on some targets, the maximum alignment may be smaller
13650 than 8, in which case objects of type @code{Long_Float} will be maximally
13651 aligned.
13653 @item @emph{Arrays}.
13654 For arrays, the alignment is equal to the alignment of the component type
13655 for the normal case where no packing or component size is given.  If the
13656 array is packed, and the packing is effective (see separate section on
13657 packed arrays), then the alignment will be one for long packed arrays,
13658 or arrays whose length is not known at compile time.  For short packed
13659 arrays, which are handled internally as modular types, the alignment
13660 will be as described for primitive types, e.g.@: a packed array of length
13661 31 bits will have an object size of four bytes, and an alignment of 4.
13663 @item @emph{Records}.
13664 For the normal non-packed case, the alignment of a record is equal to
13665 the maximum alignment of any of its components.  For tagged records, this
13666 includes the implicit access type used for the tag.  If a pragma @code{Pack}
13667 is used and all components are packable (see separate section on pragma
13668 @code{Pack}), then the resulting alignment is 1, unless the layout of the
13669 record makes it profitable to increase it.
13671 A special case is when:
13672 @itemize @bullet
13673 @item
13674 the size of the record is given explicitly, or a
13675 full record representation clause is given, and
13676 @item
13677 the size of the record is 2, 4, or 8 bytes.
13678 @end itemize
13679 @noindent
13680 In this case, an alignment is chosen to match the
13681 size of the record. For example, if we have:
13683 @smallexample @c ada
13684    type Small is record
13685       A, B : Character;
13686    end record;
13687    for Small'Size use 16;
13688 @end smallexample
13690 @noindent
13691 then the default alignment of the record type @code{Small} is 2, not 1. This
13692 leads to more efficient code when the record is treated as a unit, and also
13693 allows the type to specified as @code{Atomic} on architectures requiring
13694 strict alignment.
13696 @end itemize
13698 @noindent
13699 An alignment clause may specify a larger alignment than the default value
13700 up to some maximum value dependent on the target (obtainable by using the
13701 attribute reference @code{Standard'Maximum_Alignment}). It may also specify
13702 a smaller alignment than the default value for enumeration, integer and
13703 fixed point types, as well as for record types, for example
13705 @smallexample @c ada
13706   type V is record
13707      A : Integer;
13708   end record;
13710   for V'alignment use 1;
13711 @end smallexample
13713 @noindent
13714 @cindex Alignment, default
13715 The default alignment for the type @code{V} is 4, as a result of the
13716 Integer field in the record, but it is permissible, as shown, to
13717 override the default alignment of the record with a smaller value.
13719 @cindex Alignment, subtypes
13720 Note that according to the Ada standard, an alignment clause applies only
13721 to the first named subtype. If additional subtypes are declared, then the
13722 compiler is allowed to choose any alignment it likes, and there is no way
13723 to control this choice. Consider:
13725 @smallexample @c ada
13726    type R is range 1 .. 10_000;
13727    for R'Alignment use 1;
13728    subtype RS is R range 1 .. 1000;
13729 @end smallexample
13731 @noindent
13732 The alignment clause specifies an alignment of 1 for the first named subtype
13733 @code{R} but this does not necessarily apply to @code{RS}. When writing
13734 portable Ada code, you should avoid writing code that explicitly or
13735 implicitly relies on the alignment of such subtypes.
13737 For the GNAT compiler, if an explicit alignment clause is given, this
13738 value is also used for any subsequent subtypes. So for GNAT, in the
13739 above example, you can count on the alignment of @code{RS} being 1. But this
13740 assumption is non-portable, and other compilers may choose different
13741 alignments for the subtype @code{RS}.
13743 @node Size Clauses
13744 @section Size Clauses
13745 @cindex Size Clause
13747 @noindent
13748 The default size for a type @code{T} is obtainable through the
13749 language-defined attribute @code{T'Size} and also through the
13750 equivalent GNAT-defined attribute @code{T'Value_Size}.
13751 For objects of type @code{T}, GNAT will generally increase the type size
13752 so that the object size (obtainable through the GNAT-defined attribute
13753 @code{T'Object_Size})
13754 is a multiple of @code{T'Alignment * Storage_Unit}.
13755 For example
13757 @smallexample @c ada
13758    type Smallint is range 1 .. 6;
13760    type Rec is record
13761       Y1 : integer;
13762       Y2 : boolean;
13763    end record;
13764 @end smallexample
13766 @noindent
13767 In this example, @code{Smallint'Size} = @code{Smallint'Value_Size} = 3,
13768 as specified by the RM rules,
13769 but objects of this type will have a size of 8
13770 (@code{Smallint'Object_Size} = 8),
13771 since objects by default occupy an integral number
13772 of storage units.  On some targets, notably older
13773 versions of the Digital Alpha, the size of stand
13774 alone objects of this type may be 32, reflecting
13775 the inability of the hardware to do byte load/stores.
13777 Similarly, the size of type @code{Rec} is 40 bits
13778 (@code{Rec'Size} = @code{Rec'Value_Size} = 40), but
13779 the alignment is 4, so objects of this type will have
13780 their size increased to 64 bits so that it is a multiple
13781 of the alignment (in bits).  This decision is
13782 in accordance with the specific Implementation Advice in RM 13.3(43):
13784 @quotation
13785 A @code{Size} clause should be supported for an object if the specified
13786 @code{Size} is at least as large as its subtype's @code{Size}, and corresponds
13787 to a size in storage elements that is a multiple of the object's
13788 @code{Alignment} (if the @code{Alignment} is nonzero).
13789 @end quotation
13791 @noindent
13792 An explicit size clause may be used to override the default size by
13793 increasing it.  For example, if we have:
13795 @smallexample @c ada
13796    type My_Boolean is new Boolean;
13797    for My_Boolean'Size use 32;
13798 @end smallexample
13800 @noindent
13801 then values of this type will always be 32 bits long.  In the case of
13802 discrete types, the size can be increased up to 64 bits, with the effect
13803 that the entire specified field is used to hold the value, sign- or
13804 zero-extended as appropriate.  If more than 64 bits is specified, then
13805 padding space is allocated after the value, and a warning is issued that
13806 there are unused bits.
13808 Similarly the size of records and arrays may be increased, and the effect
13809 is to add padding bits after the value.  This also causes a warning message
13810 to be generated.
13812 The largest Size value permitted in GNAT is 2**31@minus{}1.  Since this is a
13813 Size in bits, this corresponds to an object of size 256 megabytes (minus
13814 one).  This limitation is true on all targets.  The reason for this
13815 limitation is that it improves the quality of the code in many cases
13816 if it is known that a Size value can be accommodated in an object of
13817 type Integer.
13819 @node Storage_Size Clauses
13820 @section Storage_Size Clauses
13821 @cindex Storage_Size Clause
13823 @noindent
13824 For tasks, the @code{Storage_Size} clause specifies the amount of space
13825 to be allocated for the task stack.  This cannot be extended, and if the
13826 stack is exhausted, then @code{Storage_Error} will be raised (if stack
13827 checking is enabled).  Use a @code{Storage_Size} attribute definition clause,
13828 or a @code{Storage_Size} pragma in the task definition to set the
13829 appropriate required size.  A useful technique is to include in every
13830 task definition a pragma of the form:
13832 @smallexample @c ada
13833    pragma Storage_Size (Default_Stack_Size);
13834 @end smallexample
13836 @noindent
13837 Then @code{Default_Stack_Size} can be defined in a global package, and
13838 modified as required. Any tasks requiring stack sizes different from the
13839 default can have an appropriate alternative reference in the pragma.
13841 You can also use the @option{-d} binder switch to modify the default stack
13842 size.
13844 For access types, the @code{Storage_Size} clause specifies the maximum
13845 space available for allocation of objects of the type.  If this space is
13846 exceeded then @code{Storage_Error} will be raised by an allocation attempt.
13847 In the case where the access type is declared local to a subprogram, the
13848 use of a @code{Storage_Size} clause triggers automatic use of a special
13849 predefined storage pool (@code{System.Pool_Size}) that ensures that all
13850 space for the pool is automatically reclaimed on exit from the scope in
13851 which the type is declared.
13853 A special case recognized by the compiler is the specification of a
13854 @code{Storage_Size} of zero for an access type.  This means that no
13855 items can be allocated from the pool, and this is recognized at compile
13856 time, and all the overhead normally associated with maintaining a fixed
13857 size storage pool is eliminated.  Consider the following example:
13859 @smallexample @c ada
13860    procedure p is
13861       type R is array (Natural) of Character;
13862       type P is access all R;
13863       for P'Storage_Size use 0;
13864       --  Above access type intended only for interfacing purposes
13866       y : P;
13868       procedure g (m : P);
13869       pragma Import (C, g);
13871       --  @dots{}
13873    begin
13874       --  @dots{}
13875       y := new R;
13876    end;
13877 @end smallexample
13879 @noindent
13880 As indicated in this example, these dummy storage pools are often useful in
13881 connection with interfacing where no object will ever be allocated.  If you
13882 compile the above example, you get the warning:
13884 @smallexample
13885    p.adb:16:09: warning: allocation from empty storage pool
13886    p.adb:16:09: warning: Storage_Error will be raised at run time
13887 @end smallexample
13889 @noindent
13890 Of course in practice, there will not be any explicit allocators in the
13891 case of such an access declaration.
13893 @node Size of Variant Record Objects
13894 @section Size of Variant Record Objects
13895 @cindex Size, variant record objects
13896 @cindex Variant record objects, size
13898 @noindent
13899 In the case of variant record objects, there is a question whether Size gives
13900 information about a particular variant, or the maximum size required
13901 for any variant.  Consider the following program
13903 @smallexample @c ada
13904 with Text_IO; use Text_IO;
13905 procedure q is
13906    type R1 (A : Boolean := False) is record
13907      case A is
13908        when True  => X : Character;
13909        when False => null;
13910      end case;
13911    end record;
13913    V1 : R1 (False);
13914    V2 : R1;
13916 begin
13917    Put_Line (Integer'Image (V1'Size));
13918    Put_Line (Integer'Image (V2'Size));
13919 end q;
13920 @end smallexample
13922 @noindent
13923 Here we are dealing with a variant record, where the True variant
13924 requires 16 bits, and the False variant requires 8 bits.
13925 In the above example, both V1 and V2 contain the False variant,
13926 which is only 8 bits long.  However, the result of running the
13927 program is:
13929 @smallexample
13932 @end smallexample
13934 @noindent
13935 The reason for the difference here is that the discriminant value of
13936 V1 is fixed, and will always be False.  It is not possible to assign
13937 a True variant value to V1, therefore 8 bits is sufficient.  On the
13938 other hand, in the case of V2, the initial discriminant value is
13939 False (from the default), but it is possible to assign a True
13940 variant value to V2, therefore 16 bits must be allocated for V2
13941 in the general case, even fewer bits may be needed at any particular
13942 point during the program execution.
13944 As can be seen from the output of this program, the @code{'Size}
13945 attribute applied to such an object in GNAT gives the actual allocated
13946 size of the variable, which is the largest size of any of the variants.
13947 The Ada Reference Manual is not completely clear on what choice should
13948 be made here, but the GNAT behavior seems most consistent with the
13949 language in the RM@.
13951 In some cases, it may be desirable to obtain the size of the current
13952 variant, rather than the size of the largest variant.  This can be
13953 achieved in GNAT by making use of the fact that in the case of a
13954 subprogram parameter, GNAT does indeed return the size of the current
13955 variant (because a subprogram has no way of knowing how much space
13956 is actually allocated for the actual).
13958 Consider the following modified version of the above program:
13960 @smallexample @c ada
13961 with Text_IO; use Text_IO;
13962 procedure q is
13963    type R1 (A : Boolean := False) is record
13964      case A is
13965        when True  => X : Character;
13966        when False => null;
13967      end case;
13968    end record;
13970    V2 : R1;
13972    function Size (V : R1) return Integer is
13973    begin
13974       return V'Size;
13975    end Size;
13977 begin
13978    Put_Line (Integer'Image (V2'Size));
13979    Put_Line (Integer'IMage (Size (V2)));
13980    V2 := (True, 'x');
13981    Put_Line (Integer'Image (V2'Size));
13982    Put_Line (Integer'IMage (Size (V2)));
13983 end q;
13984 @end smallexample
13986 @noindent
13987 The output from this program is
13989 @smallexample
13994 @end smallexample
13996 @noindent
13997 Here we see that while the @code{'Size} attribute always returns
13998 the maximum size, regardless of the current variant value, the
13999 @code{Size} function does indeed return the size of the current
14000 variant value.
14002 @node Biased Representation
14003 @section Biased Representation
14004 @cindex Size for biased representation
14005 @cindex Biased representation
14007 @noindent
14008 In the case of scalars with a range starting at other than zero, it is
14009 possible in some cases to specify a size smaller than the default minimum
14010 value, and in such cases, GNAT uses an unsigned biased representation,
14011 in which zero is used to represent the lower bound, and successive values
14012 represent successive values of the type.
14014 For example, suppose we have the declaration:
14016 @smallexample @c ada
14017    type Small is range -7 .. -4;
14018    for Small'Size use 2;
14019 @end smallexample
14021 @noindent
14022 Although the default size of type @code{Small} is 4, the @code{Size}
14023 clause is accepted by GNAT and results in the following representation
14024 scheme:
14026 @smallexample
14027   -7 is represented as 2#00#
14028   -6 is represented as 2#01#
14029   -5 is represented as 2#10#
14030   -4 is represented as 2#11#
14031 @end smallexample
14033 @noindent
14034 Biased representation is only used if the specified @code{Size} clause
14035 cannot be accepted in any other manner.  These reduced sizes that force
14036 biased representation can be used for all discrete types except for
14037 enumeration types for which a representation clause is given.
14039 @node Value_Size and Object_Size Clauses
14040 @section Value_Size and Object_Size Clauses
14041 @findex Value_Size
14042 @findex Object_Size
14043 @cindex Size, of objects
14045 @noindent
14046 In Ada 95 and Ada 2005, @code{T'Size} for a type @code{T} is the minimum
14047 number of bits required to hold values of type @code{T}.
14048 Although this interpretation was allowed in Ada 83, it was not required,
14049 and this requirement in practice can cause some significant difficulties.
14050 For example, in most Ada 83 compilers, @code{Natural'Size} was 32.
14051 However, in Ada 95 and Ada 2005,
14052 @code{Natural'Size} is
14053 typically 31.  This means that code may change in behavior when moving
14054 from Ada 83 to Ada 95 or Ada 2005.  For example, consider:
14056 @smallexample @c ada
14057    type Rec is record;
14058       A : Natural;
14059       B : Natural;
14060    end record;
14062    for Rec use record
14063       at 0  range 0 .. Natural'Size - 1;
14064       at 0  range Natural'Size .. 2 * Natural'Size - 1;
14065    end record;
14066 @end smallexample
14068 @noindent
14069 In the above code, since the typical size of @code{Natural} objects
14070 is 32 bits and @code{Natural'Size} is 31, the above code can cause
14071 unexpected inefficient packing in Ada 95 and Ada 2005, and in general
14072 there are cases where the fact that the object size can exceed the
14073 size of the type causes surprises.
14075 To help get around this problem GNAT provides two implementation
14076 defined attributes, @code{Value_Size} and @code{Object_Size}.  When
14077 applied to a type, these attributes yield the size of the type
14078 (corresponding to the RM defined size attribute), and the size of
14079 objects of the type respectively.
14081 The @code{Object_Size} is used for determining the default size of
14082 objects and components.  This size value can be referred to using the
14083 @code{Object_Size} attribute.  The phrase ``is used'' here means that it is
14084 the basis of the determination of the size.  The backend is free to
14085 pad this up if necessary for efficiency, e.g.@: an 8-bit stand-alone
14086 character might be stored in 32 bits on a machine with no efficient
14087 byte access instructions such as the Alpha.
14089 The default rules for the value of @code{Object_Size} for
14090 discrete types are as follows:
14092 @itemize @bullet
14093 @item
14094 The @code{Object_Size} for base subtypes reflect the natural hardware
14095 size in bits (run the compiler with @option{-gnatS} to find those values
14096 for numeric types). Enumeration types and fixed-point base subtypes have
14097 8, 16, 32 or 64 bits for this size, depending on the range of values
14098 to be stored.
14100 @item
14101 The @code{Object_Size} of a subtype is the same as the
14102 @code{Object_Size} of
14103 the type from which it is obtained.
14105 @item
14106 The @code{Object_Size} of a derived base type is copied from the parent
14107 base type, and the @code{Object_Size} of a derived first subtype is copied
14108 from the parent first subtype.
14109 @end itemize
14111 @noindent
14112 The @code{Value_Size} attribute
14113 is the (minimum) number of bits required to store a value
14114 of the type.
14115 This value is used to determine how tightly to pack
14116 records or arrays with components of this type, and also affects
14117 the semantics of unchecked conversion (unchecked conversions where
14118 the @code{Value_Size} values differ generate a warning, and are potentially
14119 target dependent).
14121 The default rules for the value of @code{Value_Size} are as follows:
14123 @itemize @bullet
14124 @item
14125 The @code{Value_Size} for a base subtype is the minimum number of bits
14126 required to store all values of the type (including the sign bit
14127 only if negative values are possible).
14129 @item
14130 If a subtype statically matches the first subtype of a given type, then it has
14131 by default the same @code{Value_Size} as the first subtype.  This is a
14132 consequence of RM 13.1(14) (``if two subtypes statically match,
14133 then their subtype-specific aspects are the same''.)
14135 @item
14136 All other subtypes have a @code{Value_Size} corresponding to the minimum
14137 number of bits required to store all values of the subtype.  For
14138 dynamic bounds, it is assumed that the value can range down or up
14139 to the corresponding bound of the ancestor
14140 @end itemize
14142 @noindent
14143 The RM defined attribute @code{Size} corresponds to the
14144 @code{Value_Size} attribute.
14146 The @code{Size} attribute may be defined for a first-named subtype.  This sets
14147 the @code{Value_Size} of
14148 the first-named subtype to the given value, and the
14149 @code{Object_Size} of this first-named subtype to the given value padded up
14150 to an appropriate boundary.  It is a consequence of the default rules
14151 above that this @code{Object_Size} will apply to all further subtypes.  On the
14152 other hand, @code{Value_Size} is affected only for the first subtype, any
14153 dynamic subtypes obtained from it directly, and any statically matching
14154 subtypes.  The @code{Value_Size} of any other static subtypes is not affected.
14156 @code{Value_Size} and
14157 @code{Object_Size} may be explicitly set for any subtype using
14158 an attribute definition clause.  Note that the use of these attributes
14159 can cause the RM 13.1(14) rule to be violated.  If two access types
14160 reference aliased objects whose subtypes have differing @code{Object_Size}
14161 values as a result of explicit attribute definition clauses, then it
14162 is erroneous to convert from one access subtype to the other.
14164 At the implementation level, Esize stores the Object_Size and the
14165 RM_Size field stores the @code{Value_Size} (and hence the value of the
14166 @code{Size} attribute,
14167 which, as noted above, is equivalent to @code{Value_Size}).
14169 To get a feel for the difference, consider the following examples (note
14170 that in each case the base is @code{Short_Short_Integer} with a size of 8):
14172 @smallexample
14173                                        Object_Size     Value_Size
14175 type x1 is range 0 .. 5;                    8               3
14177 type x2 is range 0 .. 5;
14178 for x2'size use 12;                        16              12
14180 subtype x3 is x2 range 0 .. 3;             16               2
14182 subtype x4 is x2'base range 0 .. 10;        8               4
14184 subtype x5 is x2 range 0 .. dynamic;       16               3*
14186 subtype x6 is x2'base range 0 .. dynamic;   8               3*
14188 @end smallexample
14190 @noindent
14191 Note: the entries marked ``3*'' are not actually specified by the Ada
14192 Reference Manual, but it seems in the spirit of the RM rules to allocate
14193 the minimum number of bits (here 3, given the range for @code{x2})
14194 known to be large enough to hold the given range of values.
14196 So far, so good, but GNAT has to obey the RM rules, so the question is
14197 under what conditions must the RM @code{Size} be used.
14198 The following is a list
14199 of the occasions on which the RM @code{Size} must be used:
14201 @itemize @bullet
14202 @item
14203 Component size for packed arrays or records
14205 @item
14206 Value of the attribute @code{Size} for a type
14208 @item
14209 Warning about sizes not matching for unchecked conversion
14210 @end itemize
14212 @noindent
14213 For record types, the @code{Object_Size} is always a multiple of the
14214 alignment of the type (this is true for all types). In some cases the
14215 @code{Value_Size} can be smaller. Consider:
14217 @smallexample
14218    type R is record
14219      X : Integer;
14220      Y : Character;
14221    end record;
14222 @end smallexample
14224 @noindent
14225 On a typical 32-bit architecture, the X component will be four bytes, and
14226 require four-byte alignment, and the Y component will be one byte. In this
14227 case @code{R'Value_Size} will be 40 (bits) since this is the minimum size
14228 required to store a value of this type, and for example, it is permissible
14229 to have a component of type R in an outer array whose component size is
14230 specified to be 48 bits. However, @code{R'Object_Size} will be 64 (bits),
14231 since it must be rounded up so that this value is a multiple of the
14232 alignment (4 bytes = 32 bits).
14234 @noindent
14235 For all other types, the @code{Object_Size}
14236 and Value_Size are the same (and equivalent to the RM attribute @code{Size}).
14237 Only @code{Size} may be specified for such types.
14239 @node Component_Size Clauses
14240 @section Component_Size Clauses
14241 @cindex Component_Size Clause
14243 @noindent
14244 Normally, the value specified in a component size clause must be consistent
14245 with the subtype of the array component with regard to size and alignment.
14246 In other words, the value specified must be at least equal to the size
14247 of this subtype, and must be a multiple of the alignment value.
14249 In addition, component size clauses are allowed which cause the array
14250 to be packed, by specifying a smaller value.  A first case is for
14251 component size values in the range 1 through 63.  The value specified
14252 must not be smaller than the Size of the subtype.  GNAT will accurately
14253 honor all packing requests in this range.  For example, if we have:
14255 @smallexample @c ada
14256 type r is array (1 .. 8) of Natural;
14257 for r'Component_Size use 31;
14258 @end smallexample
14260 @noindent
14261 then the resulting array has a length of 31 bytes (248 bits = 8 * 31).
14262 Of course access to the components of such an array is considerably
14263 less efficient than if the natural component size of 32 is used.
14264 A second case is when the subtype of the component is a record type
14265 padded because of its default alignment.  For example, if we have:
14267 @smallexample @c ada
14268 type r is record
14269   i : Integer;
14270   j : Integer;
14271   b : Boolean;
14272 end record;
14274 type a is array (1 .. 8) of r;
14275 for a'Component_Size use 72;
14276 @end smallexample
14278 @noindent
14279 then the resulting array has a length of 72 bytes, instead of 96 bytes
14280 if the alignment of the record (4) was obeyed.
14282 Note that there is no point in giving both a component size clause
14283 and a pragma Pack for the same array type. if such duplicate
14284 clauses are given, the pragma Pack will be ignored.
14286 @node Bit_Order Clauses
14287 @section Bit_Order Clauses
14288 @cindex Bit_Order Clause
14289 @cindex bit ordering
14290 @cindex ordering, of bits
14292 @noindent
14293 For record subtypes, GNAT permits the specification of the @code{Bit_Order}
14294 attribute.  The specification may either correspond to the default bit
14295 order for the target, in which case the specification has no effect and
14296 places no additional restrictions, or it may be for the non-standard
14297 setting (that is the opposite of the default).
14299 In the case where the non-standard value is specified, the effect is
14300 to renumber bits within each byte, but the ordering of bytes is not
14301 affected.  There are certain
14302 restrictions placed on component clauses as follows:
14304 @itemize @bullet
14306 @item Components fitting within a single storage unit.
14307 @noindent
14308 These are unrestricted, and the effect is merely to renumber bits.  For
14309 example if we are on a little-endian machine with @code{Low_Order_First}
14310 being the default, then the following two declarations have exactly
14311 the same effect:
14313 @smallexample @c ada
14314    type R1 is record
14315       A : Boolean;
14316       B : Integer range 1 .. 120;
14317    end record;
14319    for R1 use record
14320       A at 0 range 0 .. 0;
14321       B at 0 range 1 .. 7;
14322    end record;
14324    type R2 is record
14325       A : Boolean;
14326       B : Integer range 1 .. 120;
14327    end record;
14329    for R2'Bit_Order use High_Order_First;
14331    for R2 use record
14332       A at 0 range 7 .. 7;
14333       B at 0 range 0 .. 6;
14334    end record;
14335 @end smallexample
14337 @noindent
14338 The useful application here is to write the second declaration with the
14339 @code{Bit_Order} attribute definition clause, and know that it will be treated
14340 the same, regardless of whether the target is little-endian or big-endian.
14342 @item Components occupying an integral number of bytes.
14343 @noindent
14344 These are components that exactly fit in two or more bytes.  Such component
14345 declarations are allowed, but have no effect, since it is important to realize
14346 that the @code{Bit_Order} specification does not affect the ordering of bytes.
14347 In particular, the following attempt at getting an endian-independent integer
14348 does not work:
14350 @smallexample @c ada
14351    type R2 is record
14352       A : Integer;
14353    end record;
14355    for R2'Bit_Order use High_Order_First;
14357    for R2 use record
14358       A at 0 range 0 .. 31;
14359    end record;
14360 @end smallexample
14362 @noindent
14363 This declaration will result in a little-endian integer on a
14364 little-endian machine, and a big-endian integer on a big-endian machine.
14365 If byte flipping is required for interoperability between big- and
14366 little-endian machines, this must be explicitly programmed.  This capability
14367 is not provided by @code{Bit_Order}.
14369 @item Components that are positioned across byte boundaries
14370 @noindent
14371 but do not occupy an integral number of bytes.  Given that bytes are not
14372 reordered, such fields would occupy a non-contiguous sequence of bits
14373 in memory, requiring non-trivial code to reassemble.  They are for this
14374 reason not permitted, and any component clause specifying such a layout
14375 will be flagged as illegal by GNAT@.
14377 @end itemize
14379 @noindent
14380 Since the misconception that Bit_Order automatically deals with all
14381 endian-related incompatibilities is a common one, the specification of
14382 a component field that is an integral number of bytes will always
14383 generate a warning.  This warning may be suppressed using @code{pragma
14384 Warnings (Off)} if desired.  The following section contains additional
14385 details regarding the issue of byte ordering.
14387 @node Effect of Bit_Order on Byte Ordering
14388 @section Effect of Bit_Order on Byte Ordering
14389 @cindex byte ordering
14390 @cindex ordering, of bytes
14392 @noindent
14393 In this section we will review the effect of the @code{Bit_Order} attribute
14394 definition clause on byte ordering.  Briefly, it has no effect at all, but
14395 a detailed example will be helpful.  Before giving this
14396 example, let us review the precise
14397 definition of the effect of defining @code{Bit_Order}.  The effect of a
14398 non-standard bit order is described in section 15.5.3 of the Ada
14399 Reference Manual:
14401 @quotation
14402 2   A bit ordering is a method of interpreting the meaning of
14403 the storage place attributes.
14404 @end quotation
14406 @noindent
14407 To understand the precise definition of storage place attributes in
14408 this context, we visit section 13.5.1 of the manual:
14410 @quotation
14411 13   A record_representation_clause (without the mod_clause)
14412 specifies the layout.  The storage place attributes (see 13.5.2)
14413 are taken from the values of the position, first_bit, and last_bit
14414 expressions after normalizing those values so that first_bit is
14415 less than Storage_Unit.
14416 @end quotation
14418 @noindent
14419 The critical point here is that storage places are taken from
14420 the values after normalization, not before.  So the @code{Bit_Order}
14421 interpretation applies to normalized values.  The interpretation
14422 is described in the later part of the 15.5.3 paragraph:
14424 @quotation
14425 2   A bit ordering is a method of interpreting the meaning of
14426 the storage place attributes.  High_Order_First (known in the
14427 vernacular as ``big endian'') means that the first bit of a
14428 storage element (bit 0) is the most significant bit (interpreting
14429 the sequence of bits that represent a component as an unsigned
14430 integer value).  Low_Order_First (known in the vernacular as
14431 ``little endian'') means the opposite: the first bit is the
14432 least significant.
14433 @end quotation
14435 @noindent
14436 Note that the numbering is with respect to the bits of a storage
14437 unit.  In other words, the specification affects only the numbering
14438 of bits within a single storage unit.
14440 We can make the effect clearer by giving an example.
14442 Suppose that we have an external device which presents two bytes, the first
14443 byte presented, which is the first (low addressed byte) of the two byte
14444 record is called Master, and the second byte is called Slave.
14446 The left most (most significant bit is called Control for each byte, and
14447 the remaining 7 bits are called V1, V2, @dots{} V7, where V7 is the rightmost
14448 (least significant) bit.
14450 On a big-endian machine, we can write the following representation clause
14452 @smallexample @c ada
14453    type Data is record
14454       Master_Control : Bit;
14455       Master_V1      : Bit;
14456       Master_V2      : Bit;
14457       Master_V3      : Bit;
14458       Master_V4      : Bit;
14459       Master_V5      : Bit;
14460       Master_V6      : Bit;
14461       Master_V7      : Bit;
14462       Slave_Control  : Bit;
14463       Slave_V1       : Bit;
14464       Slave_V2       : Bit;
14465       Slave_V3       : Bit;
14466       Slave_V4       : Bit;
14467       Slave_V5       : Bit;
14468       Slave_V6       : Bit;
14469       Slave_V7       : Bit;
14470    end record;
14472    for Data use record
14473       Master_Control at 0 range 0 .. 0;
14474       Master_V1      at 0 range 1 .. 1;
14475       Master_V2      at 0 range 2 .. 2;
14476       Master_V3      at 0 range 3 .. 3;
14477       Master_V4      at 0 range 4 .. 4;
14478       Master_V5      at 0 range 5 .. 5;
14479       Master_V6      at 0 range 6 .. 6;
14480       Master_V7      at 0 range 7 .. 7;
14481       Slave_Control  at 1 range 0 .. 0;
14482       Slave_V1       at 1 range 1 .. 1;
14483       Slave_V2       at 1 range 2 .. 2;
14484       Slave_V3       at 1 range 3 .. 3;
14485       Slave_V4       at 1 range 4 .. 4;
14486       Slave_V5       at 1 range 5 .. 5;
14487       Slave_V6       at 1 range 6 .. 6;
14488       Slave_V7       at 1 range 7 .. 7;
14489    end record;
14490 @end smallexample
14492 @noindent
14493 Now if we move this to a little endian machine, then the bit ordering within
14494 the byte is backwards, so we have to rewrite the record rep clause as:
14496 @smallexample @c ada
14497    for Data use record
14498       Master_Control at 0 range 7 .. 7;
14499       Master_V1      at 0 range 6 .. 6;
14500       Master_V2      at 0 range 5 .. 5;
14501       Master_V3      at 0 range 4 .. 4;
14502       Master_V4      at 0 range 3 .. 3;
14503       Master_V5      at 0 range 2 .. 2;
14504       Master_V6      at 0 range 1 .. 1;
14505       Master_V7      at 0 range 0 .. 0;
14506       Slave_Control  at 1 range 7 .. 7;
14507       Slave_V1       at 1 range 6 .. 6;
14508       Slave_V2       at 1 range 5 .. 5;
14509       Slave_V3       at 1 range 4 .. 4;
14510       Slave_V4       at 1 range 3 .. 3;
14511       Slave_V5       at 1 range 2 .. 2;
14512       Slave_V6       at 1 range 1 .. 1;
14513       Slave_V7       at 1 range 0 .. 0;
14514    end record;
14515 @end smallexample
14517 @noindent
14518 It is a nuisance to have to rewrite the clause, especially if
14519 the code has to be maintained on both machines.  However,
14520 this is a case that we can handle with the
14521 @code{Bit_Order} attribute if it is implemented.
14522 Note that the implementation is not required on byte addressed
14523 machines, but it is indeed implemented in GNAT.
14524 This means that we can simply use the
14525 first record clause, together with the declaration
14527 @smallexample @c ada
14528    for Data'Bit_Order use High_Order_First;
14529 @end smallexample
14531 @noindent
14532 and the effect is what is desired, namely the layout is exactly the same,
14533 independent of whether the code is compiled on a big-endian or little-endian
14534 machine.
14536 The important point to understand is that byte ordering is not affected.
14537 A @code{Bit_Order} attribute definition never affects which byte a field
14538 ends up in, only where it ends up in that byte.
14539 To make this clear, let us rewrite the record rep clause of the previous
14540 example as:
14542 @smallexample @c ada
14543    for Data'Bit_Order use High_Order_First;
14544    for Data use record
14545       Master_Control at 0 range  0 .. 0;
14546       Master_V1      at 0 range  1 .. 1;
14547       Master_V2      at 0 range  2 .. 2;
14548       Master_V3      at 0 range  3 .. 3;
14549       Master_V4      at 0 range  4 .. 4;
14550       Master_V5      at 0 range  5 .. 5;
14551       Master_V6      at 0 range  6 .. 6;
14552       Master_V7      at 0 range  7 .. 7;
14553       Slave_Control  at 0 range  8 .. 8;
14554       Slave_V1       at 0 range  9 .. 9;
14555       Slave_V2       at 0 range 10 .. 10;
14556       Slave_V3       at 0 range 11 .. 11;
14557       Slave_V4       at 0 range 12 .. 12;
14558       Slave_V5       at 0 range 13 .. 13;
14559       Slave_V6       at 0 range 14 .. 14;
14560       Slave_V7       at 0 range 15 .. 15;
14561    end record;
14562 @end smallexample
14564 @noindent
14565 This is exactly equivalent to saying (a repeat of the first example):
14567 @smallexample @c ada
14568    for Data'Bit_Order use High_Order_First;
14569    for Data use record
14570       Master_Control at 0 range 0 .. 0;
14571       Master_V1      at 0 range 1 .. 1;
14572       Master_V2      at 0 range 2 .. 2;
14573       Master_V3      at 0 range 3 .. 3;
14574       Master_V4      at 0 range 4 .. 4;
14575       Master_V5      at 0 range 5 .. 5;
14576       Master_V6      at 0 range 6 .. 6;
14577       Master_V7      at 0 range 7 .. 7;
14578       Slave_Control  at 1 range 0 .. 0;
14579       Slave_V1       at 1 range 1 .. 1;
14580       Slave_V2       at 1 range 2 .. 2;
14581       Slave_V3       at 1 range 3 .. 3;
14582       Slave_V4       at 1 range 4 .. 4;
14583       Slave_V5       at 1 range 5 .. 5;
14584       Slave_V6       at 1 range 6 .. 6;
14585       Slave_V7       at 1 range 7 .. 7;
14586    end record;
14587 @end smallexample
14589 @noindent
14590 Why are they equivalent? Well take a specific field, the @code{Slave_V2}
14591 field.  The storage place attributes are obtained by normalizing the
14592 values given so that the @code{First_Bit} value is less than 8.  After
14593 normalizing the values (0,10,10) we get (1,2,2) which is exactly what
14594 we specified in the other case.
14596 Now one might expect that the @code{Bit_Order} attribute might affect
14597 bit numbering within the entire record component (two bytes in this
14598 case, thus affecting which byte fields end up in), but that is not
14599 the way this feature is defined, it only affects numbering of bits,
14600 not which byte they end up in.
14602 Consequently it never makes sense to specify a starting bit number
14603 greater than 7 (for a byte addressable field) if an attribute
14604 definition for @code{Bit_Order} has been given, and indeed it
14605 may be actively confusing to specify such a value, so the compiler
14606 generates a warning for such usage.
14608 If you do need to control byte ordering then appropriate conditional
14609 values must be used.  If in our example, the slave byte came first on
14610 some machines we might write:
14612 @smallexample @c ada
14613    Master_Byte_First constant Boolean := @dots{};
14615    Master_Byte : constant Natural :=
14616                    1 - Boolean'Pos (Master_Byte_First);
14617    Slave_Byte  : constant Natural :=
14618                    Boolean'Pos (Master_Byte_First);
14620    for Data'Bit_Order use High_Order_First;
14621    for Data use record
14622       Master_Control at Master_Byte range 0 .. 0;
14623       Master_V1      at Master_Byte range 1 .. 1;
14624       Master_V2      at Master_Byte range 2 .. 2;
14625       Master_V3      at Master_Byte range 3 .. 3;
14626       Master_V4      at Master_Byte range 4 .. 4;
14627       Master_V5      at Master_Byte range 5 .. 5;
14628       Master_V6      at Master_Byte range 6 .. 6;
14629       Master_V7      at Master_Byte range 7 .. 7;
14630       Slave_Control  at Slave_Byte  range 0 .. 0;
14631       Slave_V1       at Slave_Byte  range 1 .. 1;
14632       Slave_V2       at Slave_Byte  range 2 .. 2;
14633       Slave_V3       at Slave_Byte  range 3 .. 3;
14634       Slave_V4       at Slave_Byte  range 4 .. 4;
14635       Slave_V5       at Slave_Byte  range 5 .. 5;
14636       Slave_V6       at Slave_Byte  range 6 .. 6;
14637       Slave_V7       at Slave_Byte  range 7 .. 7;
14638    end record;
14639 @end smallexample
14641 @noindent
14642 Now to switch between machines, all that is necessary is
14643 to set the boolean constant @code{Master_Byte_First} in
14644 an appropriate manner.
14646 @node Pragma Pack for Arrays
14647 @section Pragma Pack for Arrays
14648 @cindex Pragma Pack (for arrays)
14650 @noindent
14651 Pragma @code{Pack} applied to an array has no effect unless the component type
14652 is packable.  For a component type to be packable, it must be one of the
14653 following cases:
14655 @itemize @bullet
14656 @item
14657 Any scalar type
14658 @item
14659 Any type whose size is specified with a size clause
14660 @item
14661 Any packed array type with a static size
14662 @item
14663 Any record type padded because of its default alignment
14664 @end itemize
14666 @noindent
14667 For all these cases, if the component subtype size is in the range
14668 1 through 63, then the effect of the pragma @code{Pack} is exactly as though a
14669 component size were specified giving the component subtype size.
14670 For example if we have:
14672 @smallexample @c ada
14673    type r is range 0 .. 17;
14675    type ar is array (1 .. 8) of r;
14676    pragma Pack (ar);
14677 @end smallexample
14679 @noindent
14680 Then the component size of @code{ar} will be set to 5 (i.e.@: to @code{r'size},
14681 and the size of the array @code{ar} will be exactly 40 bits.
14683 Note that in some cases this rather fierce approach to packing can produce
14684 unexpected effects.  For example, in Ada 95 and Ada 2005,
14685 subtype @code{Natural} typically has a size of 31, meaning that if you
14686 pack an array of @code{Natural}, you get 31-bit
14687 close packing, which saves a few bits, but results in far less efficient
14688 access.  Since many other Ada compilers will ignore such a packing request,
14689 GNAT will generate a warning on some uses of pragma @code{Pack} that it guesses
14690 might not be what is intended.  You can easily remove this warning by
14691 using an explicit @code{Component_Size} setting instead, which never generates
14692 a warning, since the intention of the programmer is clear in this case.
14694 GNAT treats packed arrays in one of two ways.  If the size of the array is
14695 known at compile time and is less than 64 bits, then internally the array
14696 is represented as a single modular type, of exactly the appropriate number
14697 of bits.  If the length is greater than 63 bits, or is not known at compile
14698 time, then the packed array is represented as an array of bytes, and the
14699 length is always a multiple of 8 bits.
14701 Note that to represent a packed array as a modular type, the alignment must
14702 be suitable for the modular type involved. For example, on typical machines
14703 a 32-bit packed array will be represented by a 32-bit modular integer with
14704 an alignment of four bytes. If you explicitly override the default alignment
14705 with an alignment clause that is too small, the modular representation
14706 cannot be used. For example, consider the following set of declarations:
14708 @smallexample @c ada
14709    type R is range 1 .. 3;
14710    type S is array (1 .. 31) of R;
14711    for S'Component_Size use 2;
14712    for S'Size use 62;
14713    for S'Alignment use 1;
14714 @end smallexample
14716 @noindent
14717 If the alignment clause were not present, then a 62-bit modular
14718 representation would be chosen (typically with an alignment of 4 or 8
14719 bytes depending on the target). But the default alignment is overridden
14720 with the explicit alignment clause. This means that the modular
14721 representation cannot be used, and instead the array of bytes
14722 representation must be used, meaning that the length must be a multiple
14723 of 8. Thus the above set of declarations will result in a diagnostic
14724 rejecting the size clause and noting that the minimum size allowed is 64.
14726 @cindex Pragma Pack (for type Natural)
14727 @cindex Pragma Pack warning
14729 One special case that is worth noting occurs when the base type of the
14730 component size is 8/16/32 and the subtype is one bit less. Notably this
14731 occurs with subtype @code{Natural}. Consider:
14733 @smallexample @c ada
14734    type Arr is array (1 .. 32) of Natural;
14735    pragma Pack (Arr);
14736 @end smallexample
14738 @noindent
14739 In all commonly used Ada 83 compilers, this pragma Pack would be ignored,
14740 since typically @code{Natural'Size} is 32 in Ada 83, and in any case most
14741 Ada 83 compilers did not attempt 31 bit packing.
14743 In Ada 95 and Ada 2005, @code{Natural'Size} is required to be 31. Furthermore,
14744 GNAT really does pack 31-bit subtype to 31 bits. This may result in a
14745 substantial unintended performance penalty when porting legacy Ada 83 code.
14746 To help prevent this, GNAT generates a warning in such cases. If you really
14747 want 31 bit packing in a case like this, you can set the component size
14748 explicitly:
14750 @smallexample @c ada
14751    type Arr is array (1 .. 32) of Natural;
14752    for Arr'Component_Size use 31;
14753 @end smallexample
14755 @noindent
14756 Here 31-bit packing is achieved as required, and no warning is generated,
14757 since in this case the programmer intention is clear.
14759 @node Pragma Pack for Records
14760 @section Pragma Pack for Records
14761 @cindex Pragma Pack (for records)
14763 @noindent
14764 Pragma @code{Pack} applied to a record will pack the components to reduce
14765 wasted space from alignment gaps and by reducing the amount of space
14766 taken by components.  We distinguish between @emph{packable} components and
14767 @emph{non-packable} components.
14768 Components of the following types are considered packable:
14769 @itemize @bullet
14770 @item
14771 All primitive types are packable.
14773 @item
14774 Small packed arrays, whose size does not exceed 64 bits, and where the
14775 size is statically known at compile time, are represented internally
14776 as modular integers, and so they are also packable.
14778 @end itemize
14780 @noindent
14781 All packable components occupy the exact number of bits corresponding to
14782 their @code{Size} value, and are packed with no padding bits, i.e.@: they
14783 can start on an arbitrary bit boundary.
14785 All other types are non-packable, they occupy an integral number of
14786 storage units, and
14787 are placed at a boundary corresponding to their alignment requirements.
14789 For example, consider the record
14791 @smallexample @c ada
14792    type Rb1 is array (1 .. 13) of Boolean;
14793    pragma Pack (rb1);
14795    type Rb2 is array (1 .. 65) of Boolean;
14796    pragma Pack (rb2);
14798    type x2 is record
14799       l1 : Boolean;
14800       l2 : Duration;
14801       l3 : Float;
14802       l4 : Boolean;
14803       l5 : Rb1;
14804       l6 : Rb2;
14805    end record;
14806    pragma Pack (x2);
14807 @end smallexample
14809 @noindent
14810 The representation for the record x2 is as follows:
14812 @smallexample @c ada
14813 for x2'Size use 224;
14814 for x2 use record
14815    l1 at  0 range  0 .. 0;
14816    l2 at  0 range  1 .. 64;
14817    l3 at 12 range  0 .. 31;
14818    l4 at 16 range  0 .. 0;
14819    l5 at 16 range  1 .. 13;
14820    l6 at 18 range  0 .. 71;
14821 end record;
14822 @end smallexample
14824 @noindent
14825 Studying this example, we see that the packable fields @code{l1}
14826 and @code{l2} are
14827 of length equal to their sizes, and placed at specific bit boundaries (and
14828 not byte boundaries) to
14829 eliminate padding.  But @code{l3} is of a non-packable float type, so
14830 it is on the next appropriate alignment boundary.
14832 The next two fields are fully packable, so @code{l4} and @code{l5} are
14833 minimally packed with no gaps.  However, type @code{Rb2} is a packed
14834 array that is longer than 64 bits, so it is itself non-packable.  Thus
14835 the @code{l6} field is aligned to the next byte boundary, and takes an
14836 integral number of bytes, i.e.@: 72 bits.
14838 @node Record Representation Clauses
14839 @section Record Representation Clauses
14840 @cindex Record Representation Clause
14842 @noindent
14843 Record representation clauses may be given for all record types, including
14844 types obtained by record extension.  Component clauses are allowed for any
14845 static component.  The restrictions on component clauses depend on the type
14846 of the component.
14848 @cindex Component Clause
14849 For all components of an elementary type, the only restriction on component
14850 clauses is that the size must be at least the 'Size value of the type
14851 (actually the Value_Size).  There are no restrictions due to alignment,
14852 and such components may freely cross storage boundaries.
14854 Packed arrays with a size up to and including 64 bits are represented
14855 internally using a modular type with the appropriate number of bits, and
14856 thus the same lack of restriction applies.  For example, if you declare:
14858 @smallexample @c ada
14859    type R is array (1 .. 49) of Boolean;
14860    pragma Pack (R);
14861    for R'Size use 49;
14862 @end smallexample
14864 @noindent
14865 then a component clause for a component of type R may start on any
14866 specified bit boundary, and may specify a value of 49 bits or greater.
14868 For packed bit arrays that are longer than 64 bits, there are two
14869 cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
14870 including the important case of single bits or boolean values, then
14871 there are no limitations on placement of such components, and they
14872 may start and end at arbitrary bit boundaries.
14874 If the component size is not a power of 2 (e.g.@: 3 or 5), then
14875 an array of this type longer than 64 bits must always be placed on
14876 on a storage unit (byte) boundary and occupy an integral number
14877 of storage units (bytes). Any component clause that does not
14878 meet this requirement will be rejected.
14880 Any aliased component, or component of an aliased type, must
14881 have its normal alignment and size. A component clause that
14882 does not meet this requirement will be rejected.
14884 The tag field of a tagged type always occupies an address sized field at
14885 the start of the record.  No component clause may attempt to overlay this
14886 tag. When a tagged type appears as a component, the tag field must have
14887 proper alignment
14889 In the case of a record extension T1, of a type T, no component clause applied
14890 to the type T1 can specify a storage location that would overlap the first
14891 T'Size bytes of the record.
14893 For all other component types, including non-bit-packed arrays,
14894 the component can be placed at an arbitrary bit boundary,
14895 so for example, the following is permitted:
14897 @smallexample @c ada
14898    type R is array (1 .. 10) of Boolean;
14899    for R'Size use 80;
14901    type Q is record
14902       G, H : Boolean;
14903       L, M : R;
14904    end record;
14906    for Q use record
14907       G at 0 range  0 ..   0;
14908       H at 0 range  1 ..   1;
14909       L at 0 range  2 ..  81;
14910       R at 0 range 82 .. 161;
14911    end record;
14912 @end smallexample
14914 @noindent
14915 Note: the above rules apply to recent releases of GNAT 5.
14916 In GNAT 3, there are more severe restrictions on larger components.
14917 For non-primitive types, including packed arrays with a size greater than
14918 64 bits, component clauses must respect the alignment requirement of the
14919 type, in particular, always starting on a byte boundary, and the length
14920 must be a multiple of the storage unit.
14922 @node Enumeration Clauses
14923 @section Enumeration Clauses
14925 The only restriction on enumeration clauses is that the range of values
14926 must be representable.  For the signed case, if one or more of the
14927 representation values are negative, all values must be in the range:
14929 @smallexample @c ada
14930    System.Min_Int .. System.Max_Int
14931 @end smallexample
14933 @noindent
14934 For the unsigned case, where all values are nonnegative, the values must
14935 be in the range:
14937 @smallexample @c ada
14938    0 .. System.Max_Binary_Modulus;
14939 @end smallexample
14941 @noindent
14942 A @emph{confirming} representation clause is one in which the values range
14943 from 0 in sequence, i.e.@: a clause that confirms the default representation
14944 for an enumeration type.
14945 Such a confirming representation
14946 is permitted by these rules, and is specially recognized by the compiler so
14947 that no extra overhead results from the use of such a clause.
14949 If an array has an index type which is an enumeration type to which an
14950 enumeration clause has been applied, then the array is stored in a compact
14951 manner.  Consider the declarations:
14953 @smallexample @c ada
14954    type r is (A, B, C);
14955    for r use (A => 1, B => 5, C => 10);
14956    type t is array (r) of Character;
14957 @end smallexample
14959 @noindent
14960 The array type t corresponds to a vector with exactly three elements and
14961 has a default size equal to @code{3*Character'Size}.  This ensures efficient
14962 use of space, but means that accesses to elements of the array will incur
14963 the overhead of converting representation values to the corresponding
14964 positional values, (i.e.@: the value delivered by the @code{Pos} attribute).
14966 @node Address Clauses
14967 @section Address Clauses
14968 @cindex Address Clause
14970 The reference manual allows a general restriction on representation clauses,
14971 as found in RM 13.1(22):
14973 @quotation
14974 An implementation need not support representation
14975 items containing nonstatic expressions, except that
14976 an implementation should support a representation item
14977 for a given entity if each nonstatic expression in the
14978 representation item is a name that statically denotes
14979 a constant declared before the entity.
14980 @end quotation
14982 @noindent
14983 In practice this is applicable only to address clauses, since this is the
14984 only case in which a non-static expression is permitted by the syntax.  As
14985 the AARM notes in sections 13.1 (22.a-22.h):
14987 @display
14988   22.a   Reason: This is to avoid the following sort of thing:
14990   22.b        X : Integer := F(@dots{});
14991               Y : Address := G(@dots{});
14992               for X'Address use Y;
14994   22.c   In the above, we have to evaluate the
14995          initialization expression for X before we
14996          know where to put the result.  This seems
14997          like an unreasonable implementation burden.
14999   22.d   The above code should instead be written
15000          like this:
15002   22.e        Y : constant Address := G(@dots{});
15003               X : Integer := F(@dots{});
15004               for X'Address use Y;
15006   22.f   This allows the expression ``Y'' to be safely
15007          evaluated before X is created.
15009   22.g   The constant could be a formal parameter of mode in.
15011   22.h   An implementation can support other nonstatic
15012          expressions if it wants to.  Expressions of type
15013          Address are hardly ever static, but their value
15014          might be known at compile time anyway in many
15015          cases.
15016 @end display
15018 @noindent
15019 GNAT does indeed permit many additional cases of non-static expressions.  In
15020 particular, if the type involved is elementary there are no restrictions
15021 (since in this case, holding a temporary copy of the initialization value,
15022 if one is present, is inexpensive).  In addition, if there is no implicit or
15023 explicit initialization, then there are no restrictions.  GNAT will reject
15024 only the case where all three of these conditions hold:
15026 @itemize @bullet
15028 @item
15029 The type of the item is non-elementary (e.g.@: a record or array).
15031 @item
15032 There is explicit or implicit initialization required for the object.
15033 Note that access values are always implicitly initialized.
15035 @item
15036 The address value is non-static.  Here GNAT is more permissive than the
15037 RM, and allows the address value to be the address of a previously declared
15038 stand-alone variable, as long as it does not itself have an address clause.
15040 @smallexample @c ada
15041            Anchor  : Some_Initialized_Type;
15042            Overlay : Some_Initialized_Type;
15043            for Overlay'Address use Anchor'Address;
15044 @end smallexample
15046 @noindent
15047 However, the prefix of the address clause cannot be an array component, or
15048 a component of a discriminated record.
15050 @end itemize
15052 @noindent
15053 As noted above in section 22.h, address values are typically non-static.  In
15054 particular the To_Address function, even if applied to a literal value, is
15055 a non-static function call.  To avoid this minor annoyance, GNAT provides
15056 the implementation defined attribute 'To_Address.  The following two
15057 expressions have identical values:
15059 @findex Attribute
15060 @findex To_Address
15061 @smallexample @c ada
15062    To_Address (16#1234_0000#)
15063    System'To_Address (16#1234_0000#);
15064 @end smallexample
15066 @noindent
15067 except that the second form is considered to be a static expression, and
15068 thus when used as an address clause value is always permitted.
15070 @noindent
15071 Additionally, GNAT treats as static an address clause that is an
15072 unchecked_conversion of a static integer value.  This simplifies the porting
15073 of legacy code, and provides a portable equivalent to the GNAT attribute
15074 @code{To_Address}.
15076 Another issue with address clauses is the interaction with alignment
15077 requirements.  When an address clause is given for an object, the address
15078 value must be consistent with the alignment of the object (which is usually
15079 the same as the alignment of the type of the object).  If an address clause
15080 is given that specifies an inappropriately aligned address value, then the
15081 program execution is erroneous.
15083 Since this source of erroneous behavior can have unfortunate effects, GNAT
15084 checks (at compile time if possible, generating a warning, or at execution
15085 time with a run-time check) that the alignment is appropriate.  If the
15086 run-time check fails, then @code{Program_Error} is raised.  This run-time
15087 check is suppressed if range checks are suppressed, or if the special GNAT
15088 check Alignment_Check is suppressed, or if
15089 @code{pragma Restrictions (No_Elaboration_Code)} is in effect.
15091 Finally, GNAT does not permit overlaying of objects of controlled types or
15092 composite types containing a controlled component. In most cases, the compiler
15093 can detect an attempt at such overlays and will generate a warning at compile
15094 time and a Program_Error exception at run time.
15096 @findex Export
15097 An address clause cannot be given for an exported object.  More
15098 understandably the real restriction is that objects with an address
15099 clause cannot be exported.  This is because such variables are not
15100 defined by the Ada program, so there is no external object to export.
15102 @findex Import
15103 It is permissible to give an address clause and a pragma Import for the
15104 same object.  In this case, the variable is not really defined by the
15105 Ada program, so there is no external symbol to be linked.  The link name
15106 and the external name are ignored in this case.  The reason that we allow this
15107 combination is that it provides a useful idiom to avoid unwanted
15108 initializations on objects with address clauses.
15110 When an address clause is given for an object that has implicit or
15111 explicit initialization, then by default initialization takes place.  This
15112 means that the effect of the object declaration is to overwrite the
15113 memory at the specified address.  This is almost always not what the
15114 programmer wants, so GNAT will output a warning:
15116 @smallexample
15117   with System;
15118   package G is
15119      type R is record
15120         M : Integer := 0;
15121      end record;
15123      Ext : R;
15124      for Ext'Address use System'To_Address (16#1234_1234#);
15125          |
15126   >>> warning: implicit initialization of "Ext" may
15127       modify overlaid storage
15128   >>> warning: use pragma Import for "Ext" to suppress
15129       initialization (RM B(24))
15131   end G;
15132 @end smallexample
15134 @noindent
15135 As indicated by the warning message, the solution is to use a (dummy) pragma
15136 Import to suppress this initialization.  The pragma tell the compiler that the
15137 object is declared and initialized elsewhere.  The following package compiles
15138 without warnings (and the initialization is suppressed):
15140 @smallexample @c ada
15141    with System;
15142    package G is
15143       type R is record
15144          M : Integer := 0;
15145       end record;
15147       Ext : R;
15148       for Ext'Address use System'To_Address (16#1234_1234#);
15149       pragma Import (Ada, Ext);
15150    end G;
15151 @end smallexample
15153 @noindent
15154 A final issue with address clauses involves their use for overlaying
15155 variables, as in the following example:
15156 @cindex Overlaying of objects
15158 @smallexample @c ada
15159   A : Integer;
15160   B : Integer;
15161   for B'Address use A'Address;
15162 @end smallexample
15164 @noindent
15165 or alternatively, using the form recommended by the RM:
15167 @smallexample @c ada
15168   A    : Integer;
15169   Addr : constant Address := A'Address;
15170   B    : Integer;
15171   for B'Address use Addr;
15172 @end smallexample
15174 @noindent
15175 In both of these cases, @code{A}
15176 and @code{B} become aliased to one another via the
15177 address clause. This use of address clauses to overlay
15178 variables, achieving an effect similar to unchecked
15179 conversion was erroneous in Ada 83, but in Ada 95 and Ada 2005
15180 the effect is implementation defined. Furthermore, the
15181 Ada RM specifically recommends that in a situation
15182 like this, @code{B} should be subject to the following
15183 implementation advice (RM 13.3(19)):
15185 @quotation
15186 19  If the Address of an object is specified, or it is imported
15187     or exported, then the implementation should not perform
15188     optimizations based on assumptions of no aliases.
15189 @end quotation
15191 @noindent
15192 GNAT follows this recommendation, and goes further by also applying
15193 this recommendation to the overlaid variable (@code{A}
15194 in the above example) in this case. This means that the overlay
15195 works "as expected", in that a modification to one of the variables
15196 will affect the value of the other.
15198 @node Effect of Convention on Representation
15199 @section Effect of Convention on Representation
15200 @cindex Convention, effect on representation
15202 @noindent
15203 Normally the specification of a foreign language convention for a type or
15204 an object has no effect on the chosen representation.  In particular, the
15205 representation chosen for data in GNAT generally meets the standard system
15206 conventions, and for example records are laid out in a manner that is
15207 consistent with C@.  This means that specifying convention C (for example)
15208 has no effect.
15210 There are four exceptions to this general rule:
15212 @itemize @bullet
15214 @item Convention Fortran and array subtypes
15215 If pragma Convention Fortran is specified for an array subtype, then in
15216 accordance with the implementation advice in section 3.6.2(11) of the
15217 Ada Reference Manual, the array will be stored in a Fortran-compatible
15218 column-major manner, instead of the normal default row-major order.
15220 @item Convention C and enumeration types
15221 GNAT normally stores enumeration types in 8, 16, or 32 bits as required
15222 to accommodate all values of the type.  For example, for the enumeration
15223 type declared by:
15225 @smallexample @c ada
15226    type Color is (Red, Green, Blue);
15227 @end smallexample
15229 @noindent
15230 8 bits is sufficient to store all values of the type, so by default, objects
15231 of type @code{Color} will be represented using 8 bits.  However, normal C
15232 convention is to use 32 bits for all enum values in C, since enum values
15233 are essentially of type int.  If pragma @code{Convention C} is specified for an
15234 Ada enumeration type, then the size is modified as necessary (usually to
15235 32 bits) to be consistent with the C convention for enum values.
15237 Note that this treatment applies only to types. If Convention C is given for
15238 an enumeration object, where the enumeration type is not Convention C, then
15239 Object_Size bits are allocated. For example, for a normal enumeration type,
15240 with less than 256 elements, only 8 bits will be allocated for the object.
15241 Since this may be a surprise in terms of what C expects, GNAT will issue a
15242 warning in this situation. The warning can be suppressed by giving an explicit
15243 size clause specifying the desired size.
15245 @item Convention C/Fortran and Boolean types
15246 In C, the usual convention for boolean values, that is values used for
15247 conditions, is that zero represents false, and nonzero values represent
15248 true.  In Ada, the normal convention is that two specific values, typically
15249 0/1, are used to represent false/true respectively.
15251 Fortran has a similar convention for @code{LOGICAL} values (any nonzero
15252 value represents true).
15254 To accommodate the Fortran and C conventions, if a pragma Convention specifies
15255 C or Fortran convention for a derived Boolean, as in the following example:
15257 @smallexample @c ada
15258    type C_Switch is new Boolean;
15259    pragma Convention (C, C_Switch);
15260 @end smallexample
15262 @noindent
15263 then the GNAT generated code will treat any nonzero value as true.  For truth
15264 values generated by GNAT, the conventional value 1 will be used for True, but
15265 when one of these values is read, any nonzero value is treated as True.
15267 @item Access types on OpenVMS
15268 For 64-bit OpenVMS systems, access types (other than those for unconstrained
15269 arrays) are 64-bits long. An exception to this rule is for the case of
15270 C-convention access types where there is no explicit size clause present (or
15271 inherited for derived types). In this case, GNAT chooses to make these
15272 pointers 32-bits, which provides an easier path for migration of 32-bit legacy
15273 code. size clause specifying 64-bits must be used to obtain a 64-bit pointer.
15275 @end itemize
15277 @node Determining the Representations chosen by GNAT
15278 @section Determining the Representations chosen by GNAT
15279 @cindex Representation, determination of
15280 @cindex @option{-gnatR} switch
15282 @noindent
15283 Although the descriptions in this section are intended to be complete, it is
15284 often easier to simply experiment to see what GNAT accepts and what the
15285 effect is on the layout of types and objects.
15287 As required by the Ada RM, if a representation clause is not accepted, then
15288 it must be rejected as illegal by the compiler.  However, when a
15289 representation clause or pragma is accepted, there can still be questions
15290 of what the compiler actually does.  For example, if a partial record
15291 representation clause specifies the location of some components and not
15292 others, then where are the non-specified components placed? Or if pragma
15293 @code{Pack} is used on a record, then exactly where are the resulting
15294 fields placed? The section on pragma @code{Pack} in this chapter can be
15295 used to answer the second question, but it is often easier to just see
15296 what the compiler does.
15298 For this purpose, GNAT provides the option @option{-gnatR}.  If you compile
15299 with this option, then the compiler will output information on the actual
15300 representations chosen, in a format similar to source representation
15301 clauses.  For example, if we compile the package:
15303 @smallexample @c ada
15304 package q is
15305    type r (x : boolean) is tagged record
15306       case x is
15307          when True => S : String (1 .. 100);
15308          when False => null;
15309       end case;
15310    end record;
15312    type r2 is new r (false) with record
15313       y2 : integer;
15314    end record;
15316    for r2 use record
15317       y2 at 16 range 0 .. 31;
15318    end record;
15320    type x is record
15321       y : character;
15322    end record;
15324    type x1 is array (1 .. 10) of x;
15325    for x1'component_size use 11;
15327    type ia is access integer;
15329    type Rb1 is array (1 .. 13) of Boolean;
15330    pragma Pack (rb1);
15332    type Rb2 is array (1 .. 65) of Boolean;
15333    pragma Pack (rb2);
15335    type x2 is record
15336       l1 : Boolean;
15337       l2 : Duration;
15338       l3 : Float;
15339       l4 : Boolean;
15340       l5 : Rb1;
15341       l6 : Rb2;
15342    end record;
15343    pragma Pack (x2);
15344 end q;
15345 @end smallexample
15347 @noindent
15348 using the switch @option{-gnatR} we obtain the following output:
15350 @smallexample
15351 Representation information for unit q
15352 -------------------------------------
15354 for r'Size use ??;
15355 for r'Alignment use 4;
15356 for r use record
15357    x    at 4 range  0 .. 7;
15358    _tag at 0 range  0 .. 31;
15359    s    at 5 range  0 .. 799;
15360 end record;
15362 for r2'Size use 160;
15363 for r2'Alignment use 4;
15364 for r2 use record
15365    x       at  4 range  0 .. 7;
15366    _tag    at  0 range  0 .. 31;
15367    _parent at  0 range  0 .. 63;
15368    y2      at 16 range  0 .. 31;
15369 end record;
15371 for x'Size use 8;
15372 for x'Alignment use 1;
15373 for x use record
15374    y at 0 range  0 .. 7;
15375 end record;
15377 for x1'Size use 112;
15378 for x1'Alignment use 1;
15379 for x1'Component_Size use 11;
15381 for rb1'Size use 13;
15382 for rb1'Alignment use 2;
15383 for rb1'Component_Size use 1;
15385 for rb2'Size use 72;
15386 for rb2'Alignment use 1;
15387 for rb2'Component_Size use 1;
15389 for x2'Size use 224;
15390 for x2'Alignment use 4;
15391 for x2 use record
15392    l1 at  0 range  0 .. 0;
15393    l2 at  0 range  1 .. 64;
15394    l3 at 12 range  0 .. 31;
15395    l4 at 16 range  0 .. 0;
15396    l5 at 16 range  1 .. 13;
15397    l6 at 18 range  0 .. 71;
15398 end record;
15399 @end smallexample
15401 @noindent
15402 The Size values are actually the Object_Size, i.e.@: the default size that
15403 will be allocated for objects of the type.
15404 The ?? size for type r indicates that we have a variant record, and the
15405 actual size of objects will depend on the discriminant value.
15407 The Alignment values show the actual alignment chosen by the compiler
15408 for each record or array type.
15410 The record representation clause for type r shows where all fields
15411 are placed, including the compiler generated tag field (whose location
15412 cannot be controlled by the programmer).
15414 The record representation clause for the type extension r2 shows all the
15415 fields present, including the parent field, which is a copy of the fields
15416 of the parent type of r2, i.e.@: r1.
15418 The component size and size clauses for types rb1 and rb2 show
15419 the exact effect of pragma @code{Pack} on these arrays, and the record
15420 representation clause for type x2 shows how pragma @code{Pack} affects
15421 this record type.
15423 In some cases, it may be useful to cut and paste the representation clauses
15424 generated by the compiler into the original source to fix and guarantee
15425 the actual representation to be used.
15427 @node Standard Library Routines
15428 @chapter Standard Library Routines
15430 @noindent
15431 The Ada Reference Manual contains in Annex A a full description of an
15432 extensive set of standard library routines that can be used in any Ada
15433 program, and which must be provided by all Ada compilers.  They are
15434 analogous to the standard C library used by C programs.
15436 GNAT implements all of the facilities described in annex A, and for most
15437 purposes the description in the Ada Reference Manual, or appropriate Ada
15438 text book, will be sufficient for making use of these facilities.
15440 In the case of the input-output facilities,
15441 @xref{The Implementation of Standard I/O},
15442 gives details on exactly how GNAT interfaces to the
15443 file system.  For the remaining packages, the Ada Reference Manual
15444 should be sufficient.  The following is a list of the packages included,
15445 together with a brief description of the functionality that is provided.
15447 For completeness, references are included to other predefined library
15448 routines defined in other sections of the Ada Reference Manual (these are
15449 cross-indexed from Annex A).
15451 @table @code
15452 @item Ada (A.2)
15453 This is a parent package for all the standard library packages.  It is
15454 usually included implicitly in your program, and itself contains no
15455 useful data or routines.
15457 @item Ada.Calendar (9.6)
15458 @code{Calendar} provides time of day access, and routines for
15459 manipulating times and durations.
15461 @item Ada.Characters (A.3.1)
15462 This is a dummy parent package that contains no useful entities
15464 @item Ada.Characters.Handling (A.3.2)
15465 This package provides some basic character handling capabilities,
15466 including classification functions for classes of characters (e.g.@: test
15467 for letters, or digits).
15469 @item Ada.Characters.Latin_1 (A.3.3)
15470 This package includes a complete set of definitions of the characters
15471 that appear in type CHARACTER@.  It is useful for writing programs that
15472 will run in international environments.  For example, if you want an
15473 upper case E with an acute accent in a string, it is often better to use
15474 the definition of @code{UC_E_Acute} in this package.  Then your program
15475 will print in an understandable manner even if your environment does not
15476 support these extended characters.
15478 @item Ada.Command_Line (A.15)
15479 This package provides access to the command line parameters and the name
15480 of the current program (analogous to the use of @code{argc} and @code{argv}
15481 in C), and also allows the exit status for the program to be set in a
15482 system-independent manner.
15484 @item Ada.Decimal (F.2)
15485 This package provides constants describing the range of decimal numbers
15486 implemented, and also a decimal divide routine (analogous to the COBOL
15487 verb DIVIDE @dots{} GIVING @dots{} REMAINDER @dots{})
15489 @item Ada.Direct_IO (A.8.4)
15490 This package provides input-output using a model of a set of records of
15491 fixed-length, containing an arbitrary definite Ada type, indexed by an
15492 integer record number.
15494 @item Ada.Dynamic_Priorities (D.5)
15495 This package allows the priorities of a task to be adjusted dynamically
15496 as the task is running.
15498 @item Ada.Exceptions (11.4.1)
15499 This package provides additional information on exceptions, and also
15500 contains facilities for treating exceptions as data objects, and raising
15501 exceptions with associated messages.
15503 @item Ada.Finalization (7.6)
15504 This package contains the declarations and subprograms to support the
15505 use of controlled types, providing for automatic initialization and
15506 finalization (analogous to the constructors and destructors of C++)
15508 @item Ada.Interrupts (C.3.2)
15509 This package provides facilities for interfacing to interrupts, which
15510 includes the set of signals or conditions that can be raised and
15511 recognized as interrupts.
15513 @item Ada.Interrupts.Names (C.3.2)
15514 This package provides the set of interrupt names (actually signal
15515 or condition names) that can be handled by GNAT@.
15517 @item Ada.IO_Exceptions (A.13)
15518 This package defines the set of exceptions that can be raised by use of
15519 the standard IO packages.
15521 @item Ada.Numerics
15522 This package contains some standard constants and exceptions used
15523 throughout the numerics packages.  Note that the constants pi and e are
15524 defined here, and it is better to use these definitions than rolling
15525 your own.
15527 @item Ada.Numerics.Complex_Elementary_Functions
15528 Provides the implementation of standard elementary functions (such as
15529 log and trigonometric functions) operating on complex numbers using the
15530 standard @code{Float} and the @code{Complex} and @code{Imaginary} types
15531 created by the package @code{Numerics.Complex_Types}.
15533 @item Ada.Numerics.Complex_Types
15534 This is a predefined instantiation of
15535 @code{Numerics.Generic_Complex_Types} using @code{Standard.Float} to
15536 build the type @code{Complex} and @code{Imaginary}.
15538 @item Ada.Numerics.Discrete_Random
15539 This generic package provides a random number generator suitable for generating
15540 uniformly distributed values of a specified discrete subtype.
15542 @item Ada.Numerics.Float_Random
15543 This package provides a random number generator suitable for generating
15544 uniformly distributed floating point values in the unit interval.
15546 @item Ada.Numerics.Generic_Complex_Elementary_Functions
15547 This is a generic version of the package that provides the
15548 implementation of standard elementary functions (such as log and
15549 trigonometric functions) for an arbitrary complex type.
15551 The following predefined instantiations of this package are provided:
15553 @table @code
15554 @item Short_Float
15555 @code{Ada.Numerics.Short_Complex_Elementary_Functions}
15556 @item Float
15557 @code{Ada.Numerics.Complex_Elementary_Functions}
15558 @item Long_Float
15559 @code{Ada.Numerics.Long_Complex_Elementary_Functions}
15560 @end table
15562 @item Ada.Numerics.Generic_Complex_Types
15563 This is a generic package that allows the creation of complex types,
15564 with associated complex arithmetic operations.
15566 The following predefined instantiations of this package exist
15567 @table @code
15568 @item Short_Float
15569 @code{Ada.Numerics.Short_Complex_Complex_Types}
15570 @item Float
15571 @code{Ada.Numerics.Complex_Complex_Types}
15572 @item Long_Float
15573 @code{Ada.Numerics.Long_Complex_Complex_Types}
15574 @end table
15576 @item Ada.Numerics.Generic_Elementary_Functions
15577 This is a generic package that provides the implementation of standard
15578 elementary functions (such as log an trigonometric functions) for an
15579 arbitrary float type.
15581 The following predefined instantiations of this package exist
15583 @table @code
15584 @item Short_Float
15585 @code{Ada.Numerics.Short_Elementary_Functions}
15586 @item Float
15587 @code{Ada.Numerics.Elementary_Functions}
15588 @item Long_Float
15589 @code{Ada.Numerics.Long_Elementary_Functions}
15590 @end table
15592 @item Ada.Real_Time (D.8)
15593 This package provides facilities similar to those of @code{Calendar}, but
15594 operating with a finer clock suitable for real time control. Note that
15595 annex D requires that there be no backward clock jumps, and GNAT generally
15596 guarantees this behavior, but of course if the external clock on which
15597 the GNAT runtime depends is deliberately reset by some external event,
15598 then such a backward jump may occur.
15600 @item Ada.Sequential_IO (A.8.1)
15601 This package provides input-output facilities for sequential files,
15602 which can contain a sequence of values of a single type, which can be
15603 any Ada type, including indefinite (unconstrained) types.
15605 @item Ada.Storage_IO (A.9)
15606 This package provides a facility for mapping arbitrary Ada types to and
15607 from a storage buffer.  It is primarily intended for the creation of new
15608 IO packages.
15610 @item Ada.Streams (13.13.1)
15611 This is a generic package that provides the basic support for the
15612 concept of streams as used by the stream attributes (@code{Input},
15613 @code{Output}, @code{Read} and @code{Write}).
15615 @item Ada.Streams.Stream_IO (A.12.1)
15616 This package is a specialization of the type @code{Streams} defined in
15617 package @code{Streams} together with a set of operations providing
15618 Stream_IO capability.  The Stream_IO model permits both random and
15619 sequential access to a file which can contain an arbitrary set of values
15620 of one or more Ada types.
15622 @item Ada.Strings (A.4.1)
15623 This package provides some basic constants used by the string handling
15624 packages.
15626 @item Ada.Strings.Bounded (A.4.4)
15627 This package provides facilities for handling variable length
15628 strings.  The bounded model requires a maximum length.  It is thus
15629 somewhat more limited than the unbounded model, but avoids the use of
15630 dynamic allocation or finalization.
15632 @item Ada.Strings.Fixed (A.4.3)
15633 This package provides facilities for handling fixed length strings.
15635 @item Ada.Strings.Maps (A.4.2)
15636 This package provides facilities for handling character mappings and
15637 arbitrarily defined subsets of characters.  For instance it is useful in
15638 defining specialized translation tables.
15640 @item Ada.Strings.Maps.Constants (A.4.6)
15641 This package provides a standard set of predefined mappings and
15642 predefined character sets.  For example, the standard upper to lower case
15643 conversion table is found in this package.  Note that upper to lower case
15644 conversion is non-trivial if you want to take the entire set of
15645 characters, including extended characters like E with an acute accent,
15646 into account.  You should use the mappings in this package (rather than
15647 adding 32 yourself) to do case mappings.
15649 @item Ada.Strings.Unbounded (A.4.5)
15650 This package provides facilities for handling variable length
15651 strings.  The unbounded model allows arbitrary length strings, but
15652 requires the use of dynamic allocation and finalization.
15654 @item Ada.Strings.Wide_Bounded (A.4.7)
15655 @itemx Ada.Strings.Wide_Fixed (A.4.7)
15656 @itemx Ada.Strings.Wide_Maps (A.4.7)
15657 @itemx Ada.Strings.Wide_Maps.Constants (A.4.7)
15658 @itemx Ada.Strings.Wide_Unbounded (A.4.7)
15659 These packages provide analogous capabilities to the corresponding
15660 packages without @samp{Wide_} in the name, but operate with the types
15661 @code{Wide_String} and @code{Wide_Character} instead of @code{String}
15662 and @code{Character}.
15664 @item Ada.Strings.Wide_Wide_Bounded (A.4.7)
15665 @itemx Ada.Strings.Wide_Wide_Fixed (A.4.7)
15666 @itemx Ada.Strings.Wide_Wide_Maps (A.4.7)
15667 @itemx Ada.Strings.Wide_Wide_Maps.Constants (A.4.7)
15668 @itemx Ada.Strings.Wide_Wide_Unbounded (A.4.7)
15669 These packages provide analogous capabilities to the corresponding
15670 packages without @samp{Wide_} in the name, but operate with the types
15671 @code{Wide_Wide_String} and @code{Wide_Wide_Character} instead
15672 of @code{String} and @code{Character}.
15674 @item Ada.Synchronous_Task_Control (D.10)
15675 This package provides some standard facilities for controlling task
15676 communication in a synchronous manner.
15678 @item Ada.Tags
15679 This package contains definitions for manipulation of the tags of tagged
15680 values.
15682 @item Ada.Task_Attributes
15683 This package provides the capability of associating arbitrary
15684 task-specific data with separate tasks.
15686 @item Ada.Text_IO
15687 This package provides basic text input-output capabilities for
15688 character, string and numeric data.  The subpackages of this
15689 package are listed next.
15691 @item Ada.Text_IO.Decimal_IO
15692 Provides input-output facilities for decimal fixed-point types
15694 @item Ada.Text_IO.Enumeration_IO
15695 Provides input-output facilities for enumeration types.
15697 @item Ada.Text_IO.Fixed_IO
15698 Provides input-output facilities for ordinary fixed-point types.
15700 @item Ada.Text_IO.Float_IO
15701 Provides input-output facilities for float types.  The following
15702 predefined instantiations of this generic package are available:
15704 @table @code
15705 @item Short_Float
15706 @code{Short_Float_Text_IO}
15707 @item Float
15708 @code{Float_Text_IO}
15709 @item Long_Float
15710 @code{Long_Float_Text_IO}
15711 @end table
15713 @item Ada.Text_IO.Integer_IO
15714 Provides input-output facilities for integer types.  The following
15715 predefined instantiations of this generic package are available:
15717 @table @code
15718 @item Short_Short_Integer
15719 @code{Ada.Short_Short_Integer_Text_IO}
15720 @item Short_Integer
15721 @code{Ada.Short_Integer_Text_IO}
15722 @item Integer
15723 @code{Ada.Integer_Text_IO}
15724 @item Long_Integer
15725 @code{Ada.Long_Integer_Text_IO}
15726 @item Long_Long_Integer
15727 @code{Ada.Long_Long_Integer_Text_IO}
15728 @end table
15730 @item Ada.Text_IO.Modular_IO
15731 Provides input-output facilities for modular (unsigned) types
15733 @item Ada.Text_IO.Complex_IO (G.1.3)
15734 This package provides basic text input-output capabilities for complex
15735 data.
15737 @item Ada.Text_IO.Editing (F.3.3)
15738 This package contains routines for edited output, analogous to the use
15739 of pictures in COBOL@.  The picture formats used by this package are a
15740 close copy of the facility in COBOL@.
15742 @item Ada.Text_IO.Text_Streams (A.12.2)
15743 This package provides a facility that allows Text_IO files to be treated
15744 as streams, so that the stream attributes can be used for writing
15745 arbitrary data, including binary data, to Text_IO files.
15747 @item Ada.Unchecked_Conversion (13.9)
15748 This generic package allows arbitrary conversion from one type to
15749 another of the same size, providing for breaking the type safety in
15750 special circumstances.
15752 If the types have the same Size (more accurately the same Value_Size),
15753 then the effect is simply to transfer the bits from the source to the
15754 target type without any modification.  This usage is well defined, and
15755 for simple types whose representation is typically the same across
15756 all implementations, gives a portable method of performing such
15757 conversions.
15759 If the types do not have the same size, then the result is implementation
15760 defined, and thus may be non-portable.  The following describes how GNAT
15761 handles such unchecked conversion cases.
15763 If the types are of different sizes, and are both discrete types, then
15764 the effect is of a normal type conversion without any constraint checking.
15765 In particular if the result type has a larger size, the result will be
15766 zero or sign extended.  If the result type has a smaller size, the result
15767 will be truncated by ignoring high order bits.
15769 If the types are of different sizes, and are not both discrete types,
15770 then the conversion works as though pointers were created to the source
15771 and target, and the pointer value is converted.  The effect is that bits
15772 are copied from successive low order storage units and bits of the source
15773 up to the length of the target type.
15775 A warning is issued if the lengths differ, since the effect in this
15776 case is implementation dependent, and the above behavior may not match
15777 that of some other compiler.
15779 A pointer to one type may be converted to a pointer to another type using
15780 unchecked conversion.  The only case in which the effect is undefined is
15781 when one or both pointers are pointers to unconstrained array types.  In
15782 this case, the bounds information may get incorrectly transferred, and in
15783 particular, GNAT uses double size pointers for such types, and it is
15784 meaningless to convert between such pointer types.  GNAT will issue a
15785 warning if the alignment of the target designated type is more strict
15786 than the alignment of the source designated type (since the result may
15787 be unaligned in this case).
15789 A pointer other than a pointer to an unconstrained array type may be
15790 converted to and from System.Address.  Such usage is common in Ada 83
15791 programs, but note that Ada.Address_To_Access_Conversions is the
15792 preferred method of performing such conversions in Ada 95 and Ada 2005.
15793 Neither
15794 unchecked conversion nor Ada.Address_To_Access_Conversions should be
15795 used in conjunction with pointers to unconstrained objects, since
15796 the bounds information cannot be handled correctly in this case.
15798 @item Ada.Unchecked_Deallocation (13.11.2)
15799 This generic package allows explicit freeing of storage previously
15800 allocated by use of an allocator.
15802 @item Ada.Wide_Text_IO (A.11)
15803 This package is similar to @code{Ada.Text_IO}, except that the external
15804 file supports wide character representations, and the internal types are
15805 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
15806 and @code{String}.  It contains generic subpackages listed next.
15808 @item Ada.Wide_Text_IO.Decimal_IO
15809 Provides input-output facilities for decimal fixed-point types
15811 @item Ada.Wide_Text_IO.Enumeration_IO
15812 Provides input-output facilities for enumeration types.
15814 @item Ada.Wide_Text_IO.Fixed_IO
15815 Provides input-output facilities for ordinary fixed-point types.
15817 @item Ada.Wide_Text_IO.Float_IO
15818 Provides input-output facilities for float types.  The following
15819 predefined instantiations of this generic package are available:
15821 @table @code
15822 @item Short_Float
15823 @code{Short_Float_Wide_Text_IO}
15824 @item Float
15825 @code{Float_Wide_Text_IO}
15826 @item Long_Float
15827 @code{Long_Float_Wide_Text_IO}
15828 @end table
15830 @item Ada.Wide_Text_IO.Integer_IO
15831 Provides input-output facilities for integer types.  The following
15832 predefined instantiations of this generic package are available:
15834 @table @code
15835 @item Short_Short_Integer
15836 @code{Ada.Short_Short_Integer_Wide_Text_IO}
15837 @item Short_Integer
15838 @code{Ada.Short_Integer_Wide_Text_IO}
15839 @item Integer
15840 @code{Ada.Integer_Wide_Text_IO}
15841 @item Long_Integer
15842 @code{Ada.Long_Integer_Wide_Text_IO}
15843 @item Long_Long_Integer
15844 @code{Ada.Long_Long_Integer_Wide_Text_IO}
15845 @end table
15847 @item Ada.Wide_Text_IO.Modular_IO
15848 Provides input-output facilities for modular (unsigned) types
15850 @item Ada.Wide_Text_IO.Complex_IO (G.1.3)
15851 This package is similar to @code{Ada.Text_IO.Complex_IO}, except that the
15852 external file supports wide character representations.
15854 @item Ada.Wide_Text_IO.Editing (F.3.4)
15855 This package is similar to @code{Ada.Text_IO.Editing}, except that the
15856 types are @code{Wide_Character} and @code{Wide_String} instead of
15857 @code{Character} and @code{String}.
15859 @item Ada.Wide_Text_IO.Streams (A.12.3)
15860 This package is similar to @code{Ada.Text_IO.Streams}, except that the
15861 types are @code{Wide_Character} and @code{Wide_String} instead of
15862 @code{Character} and @code{String}.
15864 @item Ada.Wide_Wide_Text_IO (A.11)
15865 This package is similar to @code{Ada.Text_IO}, except that the external
15866 file supports wide character representations, and the internal types are
15867 @code{Wide_Character} and @code{Wide_String} instead of @code{Character}
15868 and @code{String}.  It contains generic subpackages listed next.
15870 @item Ada.Wide_Wide_Text_IO.Decimal_IO
15871 Provides input-output facilities for decimal fixed-point types
15873 @item Ada.Wide_Wide_Text_IO.Enumeration_IO
15874 Provides input-output facilities for enumeration types.
15876 @item Ada.Wide_Wide_Text_IO.Fixed_IO
15877 Provides input-output facilities for ordinary fixed-point types.
15879 @item Ada.Wide_Wide_Text_IO.Float_IO
15880 Provides input-output facilities for float types.  The following
15881 predefined instantiations of this generic package are available:
15883 @table @code
15884 @item Short_Float
15885 @code{Short_Float_Wide_Wide_Text_IO}
15886 @item Float
15887 @code{Float_Wide_Wide_Text_IO}
15888 @item Long_Float
15889 @code{Long_Float_Wide_Wide_Text_IO}
15890 @end table
15892 @item Ada.Wide_Wide_Text_IO.Integer_IO
15893 Provides input-output facilities for integer types.  The following
15894 predefined instantiations of this generic package are available:
15896 @table @code
15897 @item Short_Short_Integer
15898 @code{Ada.Short_Short_Integer_Wide_Wide_Text_IO}
15899 @item Short_Integer
15900 @code{Ada.Short_Integer_Wide_Wide_Text_IO}
15901 @item Integer
15902 @code{Ada.Integer_Wide_Wide_Text_IO}
15903 @item Long_Integer
15904 @code{Ada.Long_Integer_Wide_Wide_Text_IO}
15905 @item Long_Long_Integer
15906 @code{Ada.Long_Long_Integer_Wide_Wide_Text_IO}
15907 @end table
15909 @item Ada.Wide_Wide_Text_IO.Modular_IO
15910 Provides input-output facilities for modular (unsigned) types
15912 @item Ada.Wide_Wide_Text_IO.Complex_IO (G.1.3)
15913 This package is similar to @code{Ada.Text_IO.Complex_IO}, except that the
15914 external file supports wide character representations.
15916 @item Ada.Wide_Wide_Text_IO.Editing (F.3.4)
15917 This package is similar to @code{Ada.Text_IO.Editing}, except that the
15918 types are @code{Wide_Character} and @code{Wide_String} instead of
15919 @code{Character} and @code{String}.
15921 @item Ada.Wide_Wide_Text_IO.Streams (A.12.3)
15922 This package is similar to @code{Ada.Text_IO.Streams}, except that the
15923 types are @code{Wide_Character} and @code{Wide_String} instead of
15924 @code{Character} and @code{String}.
15925 @end table
15927 @node The Implementation of Standard I/O
15928 @chapter The Implementation of Standard I/O
15930 @noindent
15931 GNAT implements all the required input-output facilities described in
15932 A.6 through A.14.  These sections of the Ada Reference Manual describe the
15933 required behavior of these packages from the Ada point of view, and if
15934 you are writing a portable Ada program that does not need to know the
15935 exact manner in which Ada maps to the outside world when it comes to
15936 reading or writing external files, then you do not need to read this
15937 chapter.  As long as your files are all regular files (not pipes or
15938 devices), and as long as you write and read the files only from Ada, the
15939 description in the Ada Reference Manual is sufficient.
15941 However, if you want to do input-output to pipes or other devices, such
15942 as the keyboard or screen, or if the files you are dealing with are
15943 either generated by some other language, or to be read by some other
15944 language, then you need to know more about the details of how the GNAT
15945 implementation of these input-output facilities behaves.
15947 In this chapter we give a detailed description of exactly how GNAT
15948 interfaces to the file system.  As always, the sources of the system are
15949 available to you for answering questions at an even more detailed level,
15950 but for most purposes the information in this chapter will suffice.
15952 Another reason that you may need to know more about how input-output is
15953 implemented arises when you have a program written in mixed languages
15954 where, for example, files are shared between the C and Ada sections of
15955 the same program.  GNAT provides some additional facilities, in the form
15956 of additional child library packages, that facilitate this sharing, and
15957 these additional facilities are also described in this chapter.
15959 @menu
15960 * Standard I/O Packages::
15961 * FORM Strings::
15962 * Direct_IO::
15963 * Sequential_IO::
15964 * Text_IO::
15965 * Wide_Text_IO::
15966 * Wide_Wide_Text_IO::
15967 * Stream_IO::
15968 * Text Translation::
15969 * Shared Files::
15970 * Filenames encoding::
15971 * Open Modes::
15972 * Operations on C Streams::
15973 * Interfacing to C Streams::
15974 @end menu
15976 @node Standard I/O Packages
15977 @section Standard I/O Packages
15979 @noindent
15980 The Standard I/O packages described in Annex A for
15982 @itemize @bullet
15983 @item
15984 Ada.Text_IO
15985 @item
15986 Ada.Text_IO.Complex_IO
15987 @item
15988 Ada.Text_IO.Text_Streams
15989 @item
15990 Ada.Wide_Text_IO
15991 @item
15992 Ada.Wide_Text_IO.Complex_IO
15993 @item
15994 Ada.Wide_Text_IO.Text_Streams
15995 @item
15996 Ada.Wide_Wide_Text_IO
15997 @item
15998 Ada.Wide_Wide_Text_IO.Complex_IO
15999 @item
16000 Ada.Wide_Wide_Text_IO.Text_Streams
16001 @item
16002 Ada.Stream_IO
16003 @item
16004 Ada.Sequential_IO
16005 @item
16006 Ada.Direct_IO
16007 @end itemize
16009 @noindent
16010 are implemented using the C
16011 library streams facility; where
16013 @itemize @bullet
16014 @item
16015 All files are opened using @code{fopen}.
16016 @item
16017 All input/output operations use @code{fread}/@code{fwrite}.
16018 @end itemize
16020 @noindent
16021 There is no internal buffering of any kind at the Ada library level. The only
16022 buffering is that provided at the system level in the implementation of the
16023 library routines that support streams. This facilitates shared use of these
16024 streams by mixed language programs. Note though that system level buffering is
16025 explicitly enabled at elaboration of the standard I/O packages and that can
16026 have an impact on mixed language programs, in particular those using I/O before
16027 calling the Ada elaboration routine (e.g.@: adainit). It is recommended to call
16028 the Ada elaboration routine before performing any I/O or when impractical,
16029 flush the common I/O streams and in particular Standard_Output before
16030 elaborating the Ada code.
16032 @node FORM Strings
16033 @section FORM Strings
16035 @noindent
16036 The format of a FORM string in GNAT is:
16038 @smallexample
16039 "keyword=value,keyword=value,@dots{},keyword=value"
16040 @end smallexample
16042 @noindent
16043 where letters may be in upper or lower case, and there are no spaces
16044 between values.  The order of the entries is not important.  Currently
16045 the following keywords defined.
16047 @smallexample
16048 TEXT_TRANSLATION=[YES|NO]
16049 SHARED=[YES|NO]
16050 WCEM=[n|h|u|s|e|8|b]
16051 ENCODING=[UTF8|8BITS]
16052 @end smallexample
16054 @noindent
16055 The use of these parameters is described later in this section. If an
16056 unrecognized keyword appears in a form string, it is silently ignored
16057 and not considered invalid.
16059 @noindent
16060 For OpenVMS additional FORM string keywords are available for use with
16061 RMS services.  The syntax is:
16063 @smallexample
16064 VMS_RMS_Keys=(keyword=value,@dots{},keyword=value)
16065 @end smallexample
16067 @noindent
16068 The following RMS keywords and values are currently defined:
16070 @smallexample
16071 Context=Force_Stream_Mode|Force_Record_Mode
16072 @end smallexample
16074 @noindent
16075 VMS RMS keys are silently ignored on non-VMS systems.  On OpenVMS
16076 unimplented RMS keywords, values, or invalid syntax will raise Use_Error.
16078 @node Direct_IO
16079 @section Direct_IO
16081 @noindent
16082 Direct_IO can only be instantiated for definite types.  This is a
16083 restriction of the Ada language, which means that the records are fixed
16084 length (the length being determined by @code{@var{type}'Size}, rounded
16085 up to the next storage unit boundary if necessary).
16087 The records of a Direct_IO file are simply written to the file in index
16088 sequence, with the first record starting at offset zero, and subsequent
16089 records following.  There is no control information of any kind.  For
16090 example, if 32-bit integers are being written, each record takes
16091 4-bytes, so the record at index @var{K} starts at offset
16092 (@var{K}@minus{}1)*4.
16094 There is no limit on the size of Direct_IO files, they are expanded as
16095 necessary to accommodate whatever records are written to the file.
16097 @node Sequential_IO
16098 @section Sequential_IO
16100 @noindent
16101 Sequential_IO may be instantiated with either a definite (constrained)
16102 or indefinite (unconstrained) type.
16104 For the definite type case, the elements written to the file are simply
16105 the memory images of the data values with no control information of any
16106 kind.  The resulting file should be read using the same type, no validity
16107 checking is performed on input.
16109 For the indefinite type case, the elements written consist of two
16110 parts.  First is the size of the data item, written as the memory image
16111 of a @code{Interfaces.C.size_t} value, followed by the memory image of
16112 the data value.  The resulting file can only be read using the same
16113 (unconstrained) type.  Normal assignment checks are performed on these
16114 read operations, and if these checks fail, @code{Data_Error} is
16115 raised.  In particular, in the array case, the lengths must match, and in
16116 the variant record case, if the variable for a particular read operation
16117 is constrained, the discriminants must match.
16119 Note that it is not possible to use Sequential_IO to write variable
16120 length array items, and then read the data back into different length
16121 arrays.  For example, the following will raise @code{Data_Error}:
16123 @smallexample @c ada
16124  package IO is new Sequential_IO (String);
16125  F : IO.File_Type;
16126  S : String (1..4);
16127  @dots{}
16128  IO.Create (F)
16129  IO.Write (F, "hello!")
16130  IO.Reset (F, Mode=>In_File);
16131  IO.Read (F, S);
16132  Put_Line (S);
16134 @end smallexample
16136 @noindent
16137 On some Ada implementations, this will print @code{hell}, but the program is
16138 clearly incorrect, since there is only one element in the file, and that
16139 element is the string @code{hello!}.
16141 In Ada 95 and Ada 2005, this kind of behavior can be legitimately achieved
16142 using Stream_IO, and this is the preferred mechanism.  In particular, the
16143 above program fragment rewritten to use Stream_IO will work correctly.
16145 @node Text_IO
16146 @section Text_IO
16148 @noindent
16149 Text_IO files consist of a stream of characters containing the following
16150 special control characters:
16152 @smallexample
16153 LF (line feed, 16#0A#) Line Mark
16154 FF (form feed, 16#0C#) Page Mark
16155 @end smallexample
16157 @noindent
16158 A canonical Text_IO file is defined as one in which the following
16159 conditions are met:
16161 @itemize @bullet
16162 @item
16163 The character @code{LF} is used only as a line mark, i.e.@: to mark the end
16164 of the line.
16166 @item
16167 The character @code{FF} is used only as a page mark, i.e.@: to mark the
16168 end of a page and consequently can appear only immediately following a
16169 @code{LF} (line mark) character.
16171 @item
16172 The file ends with either @code{LF} (line mark) or @code{LF}-@code{FF}
16173 (line mark, page mark).  In the former case, the page mark is implicitly
16174 assumed to be present.
16175 @end itemize
16177 @noindent
16178 A file written using Text_IO will be in canonical form provided that no
16179 explicit @code{LF} or @code{FF} characters are written using @code{Put}
16180 or @code{Put_Line}.  There will be no @code{FF} character at the end of
16181 the file unless an explicit @code{New_Page} operation was performed
16182 before closing the file.
16184 A canonical Text_IO file that is a regular file (i.e., not a device or a
16185 pipe) can be read using any of the routines in Text_IO@.  The
16186 semantics in this case will be exactly as defined in the Ada Reference
16187 Manual, and all the routines in Text_IO are fully implemented.
16189 A text file that does not meet the requirements for a canonical Text_IO
16190 file has one of the following:
16192 @itemize @bullet
16193 @item
16194 The file contains @code{FF} characters not immediately following a
16195 @code{LF} character.
16197 @item
16198 The file contains @code{LF} or @code{FF} characters written by
16199 @code{Put} or @code{Put_Line}, which are not logically considered to be
16200 line marks or page marks.
16202 @item
16203 The file ends in a character other than @code{LF} or @code{FF},
16204 i.e.@: there is no explicit line mark or page mark at the end of the file.
16205 @end itemize
16207 @noindent
16208 Text_IO can be used to read such non-standard text files but subprograms
16209 to do with line or page numbers do not have defined meanings.  In
16210 particular, a @code{FF} character that does not follow a @code{LF}
16211 character may or may not be treated as a page mark from the point of
16212 view of page and line numbering.  Every @code{LF} character is considered
16213 to end a line, and there is an implied @code{LF} character at the end of
16214 the file.
16216 @menu
16217 * Text_IO Stream Pointer Positioning::
16218 * Text_IO Reading and Writing Non-Regular Files::
16219 * Get_Immediate::
16220 * Treating Text_IO Files as Streams::
16221 * Text_IO Extensions::
16222 * Text_IO Facilities for Unbounded Strings::
16223 @end menu
16225 @node Text_IO Stream Pointer Positioning
16226 @subsection Stream Pointer Positioning
16228 @noindent
16229 @code{Ada.Text_IO} has a definition of current position for a file that
16230 is being read.  No internal buffering occurs in Text_IO, and usually the
16231 physical position in the stream used to implement the file corresponds
16232 to this logical position defined by Text_IO@.  There are two exceptions:
16234 @itemize @bullet
16235 @item
16236 After a call to @code{End_Of_Page} that returns @code{True}, the stream
16237 is positioned past the @code{LF} (line mark) that precedes the page
16238 mark.  Text_IO maintains an internal flag so that subsequent read
16239 operations properly handle the logical position which is unchanged by
16240 the @code{End_Of_Page} call.
16242 @item
16243 After a call to @code{End_Of_File} that returns @code{True}, if the
16244 Text_IO file was positioned before the line mark at the end of file
16245 before the call, then the logical position is unchanged, but the stream
16246 is physically positioned right at the end of file (past the line mark,
16247 and past a possible page mark following the line mark.  Again Text_IO
16248 maintains internal flags so that subsequent read operations properly
16249 handle the logical position.
16250 @end itemize
16252 @noindent
16253 These discrepancies have no effect on the observable behavior of
16254 Text_IO, but if a single Ada stream is shared between a C program and
16255 Ada program, or shared (using @samp{shared=yes} in the form string)
16256 between two Ada files, then the difference may be observable in some
16257 situations.
16259 @node Text_IO Reading and Writing Non-Regular Files
16260 @subsection Reading and Writing Non-Regular Files
16262 @noindent
16263 A non-regular file is a device (such as a keyboard), or a pipe.  Text_IO
16264 can be used for reading and writing.  Writing is not affected and the
16265 sequence of characters output is identical to the normal file case, but
16266 for reading, the behavior of Text_IO is modified to avoid undesirable
16267 look-ahead as follows:
16269 An input file that is not a regular file is considered to have no page
16270 marks.  Any @code{Ascii.FF} characters (the character normally used for a
16271 page mark) appearing in the file are considered to be data
16272 characters.  In particular:
16274 @itemize @bullet
16275 @item
16276 @code{Get_Line} and @code{Skip_Line} do not test for a page mark
16277 following a line mark.  If a page mark appears, it will be treated as a
16278 data character.
16280 @item
16281 This avoids the need to wait for an extra character to be typed or
16282 entered from the pipe to complete one of these operations.
16284 @item
16285 @code{End_Of_Page} always returns @code{False}
16287 @item
16288 @code{End_Of_File} will return @code{False} if there is a page mark at
16289 the end of the file.
16290 @end itemize
16292 @noindent
16293 Output to non-regular files is the same as for regular files.  Page marks
16294 may be written to non-regular files using @code{New_Page}, but as noted
16295 above they will not be treated as page marks on input if the output is
16296 piped to another Ada program.
16298 Another important discrepancy when reading non-regular files is that the end
16299 of file indication is not ``sticky''.  If an end of file is entered, e.g.@: by
16300 pressing the @key{EOT} key,
16301 then end of file
16302 is signaled once (i.e.@: the test @code{End_Of_File}
16303 will yield @code{True}, or a read will
16304 raise @code{End_Error}), but then reading can resume
16305 to read data past that end of
16306 file indication, until another end of file indication is entered.
16308 @node Get_Immediate
16309 @subsection Get_Immediate
16310 @cindex Get_Immediate
16312 @noindent
16313 Get_Immediate returns the next character (including control characters)
16314 from the input file.  In particular, Get_Immediate will return LF or FF
16315 characters used as line marks or page marks.  Such operations leave the
16316 file positioned past the control character, and it is thus not treated
16317 as having its normal function.  This means that page, line and column
16318 counts after this kind of Get_Immediate call are set as though the mark
16319 did not occur.  In the case where a Get_Immediate leaves the file
16320 positioned between the line mark and page mark (which is not normally
16321 possible), it is undefined whether the FF character will be treated as a
16322 page mark.
16324 @node Treating Text_IO Files as Streams
16325 @subsection Treating Text_IO Files as Streams
16326 @cindex Stream files
16328 @noindent
16329 The package @code{Text_IO.Streams} allows a Text_IO file to be treated
16330 as a stream.  Data written to a Text_IO file in this stream mode is
16331 binary data.  If this binary data contains bytes 16#0A# (@code{LF}) or
16332 16#0C# (@code{FF}), the resulting file may have non-standard
16333 format.  Similarly if read operations are used to read from a Text_IO
16334 file treated as a stream, then @code{LF} and @code{FF} characters may be
16335 skipped and the effect is similar to that described above for
16336 @code{Get_Immediate}.
16338 @node Text_IO Extensions
16339 @subsection Text_IO Extensions
16340 @cindex Text_IO extensions
16342 @noindent
16343 A package GNAT.IO_Aux in the GNAT library provides some useful extensions
16344 to the standard @code{Text_IO} package:
16346 @itemize @bullet
16347 @item function File_Exists (Name : String) return Boolean;
16348 Determines if a file of the given name exists.
16350 @item function Get_Line return String;
16351 Reads a string from the standard input file.  The value returned is exactly
16352 the length of the line that was read.
16354 @item function Get_Line (File : Ada.Text_IO.File_Type) return String;
16355 Similar, except that the parameter File specifies the file from which
16356 the string is to be read.
16358 @end itemize
16360 @node Text_IO Facilities for Unbounded Strings
16361 @subsection Text_IO Facilities for Unbounded Strings
16362 @cindex Text_IO for unbounded strings
16363 @cindex Unbounded_String, Text_IO operations
16365 @noindent
16366 The package @code{Ada.Strings.Unbounded.Text_IO}
16367 in library files @code{a-suteio.ads/adb} contains some GNAT-specific
16368 subprograms useful for Text_IO operations on unbounded strings:
16370 @itemize @bullet
16372 @item function Get_Line (File : File_Type) return Unbounded_String;
16373 Reads a line from the specified file
16374 and returns the result as an unbounded string.
16376 @item procedure Put (File : File_Type; U : Unbounded_String);
16377 Writes the value of the given unbounded string to the specified file
16378 Similar to the effect of
16379 @code{Put (To_String (U))} except that an extra copy is avoided.
16381 @item procedure Put_Line (File : File_Type; U : Unbounded_String);
16382 Writes the value of the given unbounded string to the specified file,
16383 followed by a @code{New_Line}.
16384 Similar to the effect of @code{Put_Line (To_String (U))} except
16385 that an extra copy is avoided.
16386 @end itemize
16388 @noindent
16389 In the above procedures, @code{File} is of type @code{Ada.Text_IO.File_Type}
16390 and is optional.  If the parameter is omitted, then the standard input or
16391 output file is referenced as appropriate.
16393 The package @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} in library
16394 files @file{a-swuwti.ads} and @file{a-swuwti.adb} provides similar extended
16395 @code{Wide_Text_IO} functionality for unbounded wide strings.
16397 The package @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} in library
16398 files @file{a-szuzti.ads} and @file{a-szuzti.adb} provides similar extended
16399 @code{Wide_Wide_Text_IO} functionality for unbounded wide wide strings.
16401 @node Wide_Text_IO
16402 @section Wide_Text_IO
16404 @noindent
16405 @code{Wide_Text_IO} is similar in most respects to Text_IO, except that
16406 both input and output files may contain special sequences that represent
16407 wide character values.  The encoding scheme for a given file may be
16408 specified using a FORM parameter:
16410 @smallexample
16411 WCEM=@var{x}
16412 @end smallexample
16414 @noindent
16415 as part of the FORM string (WCEM = wide character encoding method),
16416 where @var{x} is one of the following characters
16418 @table @samp
16419 @item h
16420 Hex ESC encoding
16421 @item u
16422 Upper half encoding
16423 @item s
16424 Shift-JIS encoding
16425 @item e
16426 EUC Encoding
16427 @item 8
16428 UTF-8 encoding
16429 @item b
16430 Brackets encoding
16431 @end table
16433 @noindent
16434 The encoding methods match those that
16435 can be used in a source
16436 program, but there is no requirement that the encoding method used for
16437 the source program be the same as the encoding method used for files,
16438 and different files may use different encoding methods.
16440 The default encoding method for the standard files, and for opened files
16441 for which no WCEM parameter is given in the FORM string matches the
16442 wide character encoding specified for the main program (the default
16443 being brackets encoding if no coding method was specified with -gnatW).
16445 @table @asis
16446 @item Hex Coding
16447 In this encoding, a wide character is represented by a five character
16448 sequence:
16450 @smallexample
16451 ESC a b c d
16452 @end smallexample
16454 @noindent
16455 where @var{a}, @var{b}, @var{c}, @var{d} are the four hexadecimal
16456 characters (using upper case letters) of the wide character code.  For
16457 example, ESC A345 is used to represent the wide character with code
16458 16#A345#.  This scheme is compatible with use of the full
16459 @code{Wide_Character} set.
16461 @item Upper Half Coding
16462 The wide character with encoding 16#abcd#, where the upper bit is on
16463 (i.e.@: a is in the range 8-F) is represented as two bytes 16#ab# and
16464 16#cd#.  The second byte may never be a format control character, but is
16465 not required to be in the upper half.  This method can be also used for
16466 shift-JIS or EUC where the internal coding matches the external coding.
16468 @item Shift JIS Coding
16469 A wide character is represented by a two character sequence 16#ab# and
16470 16#cd#, with the restrictions described for upper half encoding as
16471 described above.  The internal character code is the corresponding JIS
16472 character according to the standard algorithm for Shift-JIS
16473 conversion.  Only characters defined in the JIS code set table can be
16474 used with this encoding method.
16476 @item EUC Coding
16477 A wide character is represented by a two character sequence 16#ab# and
16478 16#cd#, with both characters being in the upper half.  The internal
16479 character code is the corresponding JIS character according to the EUC
16480 encoding algorithm.  Only characters defined in the JIS code set table
16481 can be used with this encoding method.
16483 @item UTF-8 Coding
16484 A wide character is represented using
16485 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
16486 10646-1/Am.2.  Depending on the character value, the representation
16487 is a one, two, or three byte sequence:
16489 @smallexample
16490 16#0000#-16#007f#: 2#0xxxxxxx#
16491 16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
16492 16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
16493 @end smallexample
16495 @noindent
16496 where the @var{xxx} bits correspond to the left-padded bits of the
16497 16-bit character value.  Note that all lower half ASCII characters
16498 are represented as ASCII bytes and all upper half characters and
16499 other wide characters are represented as sequences of upper-half
16500 (The full UTF-8 scheme allows for encoding 31-bit characters as
16501 6-byte sequences, but in this implementation, all UTF-8 sequences
16502 of four or more bytes length will raise a Constraint_Error, as
16503 will all invalid UTF-8 sequences.)
16505 @item Brackets Coding
16506 In this encoding, a wide character is represented by the following eight
16507 character sequence:
16509 @smallexample
16510 [ " a b c d " ]
16511 @end smallexample
16513 @noindent
16514 where @code{a}, @code{b}, @code{c}, @code{d} are the four hexadecimal
16515 characters (using uppercase letters) of the wide character code.  For
16516 example, @code{["A345"]} is used to represent the wide character with code
16517 @code{16#A345#}.
16518 This scheme is compatible with use of the full Wide_Character set.
16519 On input, brackets coding can also be used for upper half characters,
16520 e.g.@: @code{["C1"]} for lower case a.  However, on output, brackets notation
16521 is only used for wide characters with a code greater than @code{16#FF#}.
16523 Note that brackets coding is not normally used in the context of
16524 Wide_Text_IO or Wide_Wide_Text_IO, since it is really just designed as
16525 a portable way of encoding source files. In the context of Wide_Text_IO
16526 or Wide_Wide_Text_IO, it can only be used if the file does not contain
16527 any instance of the left bracket character other than to encode wide
16528 character values using the brackets encoding method. In practice it is
16529 expected that some standard wide character encoding method such
16530 as UTF-8 will be used for text input output.
16532 If brackets notation is used, then any occurrence of a left bracket
16533 in the input file which is not the start of a valid wide character
16534 sequence will cause Constraint_Error to be raised. It is possible to
16535 encode a left bracket as ["5B"] and Wide_Text_IO and Wide_Wide_Text_IO
16536 input will interpret this as a left bracket.
16538 However, when a left bracket is output, it will be output as a left bracket
16539 and not as ["5B"]. We make this decision because for normal use of
16540 Wide_Text_IO for outputting messages, it is unpleasant to clobber left
16541 brackets. For example, if we write:
16543 @smallexample
16544    Put_Line ("Start of output [first run]");
16545 @end smallexample
16547 @noindent
16548 we really do not want to have the left bracket in this message clobbered so
16549 that the output reads:
16551 @smallexample
16552    Start of output ["5B"]first run]
16553 @end smallexample
16555 @noindent
16556 In practice brackets encoding is reasonably useful for normal Put_Line use
16557 since we won't get confused between left brackets and wide character
16558 sequences in the output. But for input, or when files are written out
16559 and read back in, it really makes better sense to use one of the standard
16560 encoding methods such as UTF-8.
16562 @end table
16564 @noindent
16565 For the coding schemes other than UTF-8, Hex, or Brackets encoding,
16566 not all wide character
16567 values can be represented.  An attempt to output a character that cannot
16568 be represented using the encoding scheme for the file causes
16569 Constraint_Error to be raised.  An invalid wide character sequence on
16570 input also causes Constraint_Error to be raised.
16572 @menu
16573 * Wide_Text_IO Stream Pointer Positioning::
16574 * Wide_Text_IO Reading and Writing Non-Regular Files::
16575 @end menu
16577 @node Wide_Text_IO Stream Pointer Positioning
16578 @subsection Stream Pointer Positioning
16580 @noindent
16581 @code{Ada.Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
16582 of stream pointer positioning (@pxref{Text_IO}).  There is one additional
16583 case:
16585 If @code{Ada.Wide_Text_IO.Look_Ahead} reads a character outside the
16586 normal lower ASCII set (i.e.@: a character in the range:
16588 @smallexample @c ada
16589 Wide_Character'Val (16#0080#) .. Wide_Character'Val (16#FFFF#)
16590 @end smallexample
16592 @noindent
16593 then although the logical position of the file pointer is unchanged by
16594 the @code{Look_Ahead} call, the stream is physically positioned past the
16595 wide character sequence.  Again this is to avoid the need for buffering
16596 or backup, and all @code{Wide_Text_IO} routines check the internal
16597 indication that this situation has occurred so that this is not visible
16598 to a normal program using @code{Wide_Text_IO}.  However, this discrepancy
16599 can be observed if the wide text file shares a stream with another file.
16601 @node Wide_Text_IO Reading and Writing Non-Regular Files
16602 @subsection Reading and Writing Non-Regular Files
16604 @noindent
16605 As in the case of Text_IO, when a non-regular file is read, it is
16606 assumed that the file contains no page marks (any form characters are
16607 treated as data characters), and @code{End_Of_Page} always returns
16608 @code{False}.  Similarly, the end of file indication is not sticky, so
16609 it is possible to read beyond an end of file.
16611 @node Wide_Wide_Text_IO
16612 @section Wide_Wide_Text_IO
16614 @noindent
16615 @code{Wide_Wide_Text_IO} is similar in most respects to Text_IO, except that
16616 both input and output files may contain special sequences that represent
16617 wide wide character values.  The encoding scheme for a given file may be
16618 specified using a FORM parameter:
16620 @smallexample
16621 WCEM=@var{x}
16622 @end smallexample
16624 @noindent
16625 as part of the FORM string (WCEM = wide character encoding method),
16626 where @var{x} is one of the following characters
16628 @table @samp
16629 @item h
16630 Hex ESC encoding
16631 @item u
16632 Upper half encoding
16633 @item s
16634 Shift-JIS encoding
16635 @item e
16636 EUC Encoding
16637 @item 8
16638 UTF-8 encoding
16639 @item b
16640 Brackets encoding
16641 @end table
16643 @noindent
16644 The encoding methods match those that
16645 can be used in a source
16646 program, but there is no requirement that the encoding method used for
16647 the source program be the same as the encoding method used for files,
16648 and different files may use different encoding methods.
16650 The default encoding method for the standard files, and for opened files
16651 for which no WCEM parameter is given in the FORM string matches the
16652 wide character encoding specified for the main program (the default
16653 being brackets encoding if no coding method was specified with -gnatW).
16655 @table @asis
16657 @item UTF-8 Coding
16658 A wide character is represented using
16659 UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
16660 10646-1/Am.2.  Depending on the character value, the representation
16661 is a one, two, three, or four byte sequence:
16663 @smallexample
16664 16#000000#-16#00007f#: 2#0xxxxxxx#
16665 16#000080#-16#0007ff#: 2#110xxxxx# 2#10xxxxxx#
16666 16#000800#-16#00ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
16667 16#010000#-16#10ffff#: 2#11110xxx# 2#10xxxxxx# 2#10xxxxxx# 2#10xxxxxx#
16668 @end smallexample
16670 @noindent
16671 where the @var{xxx} bits correspond to the left-padded bits of the
16672 21-bit character value.  Note that all lower half ASCII characters
16673 are represented as ASCII bytes and all upper half characters and
16674 other wide characters are represented as sequences of upper-half
16675 characters.
16677 @item Brackets Coding
16678 In this encoding, a wide wide character is represented by the following eight
16679 character sequence if is in wide character range
16681 @smallexample
16682 [ " a b c d " ]
16683 @end smallexample
16685 and by the following ten character sequence if not
16687 @smallexample
16688 [ " a b c d e f " ]
16689 @end smallexample
16691 @noindent
16692 where @code{a}, @code{b}, @code{c}, @code{d}, @code{e}, and @code{f}
16693 are the four or six hexadecimal
16694 characters (using uppercase letters) of the wide wide character code.  For
16695 example, @code{["01A345"]} is used to represent the wide wide character
16696 with code @code{16#01A345#}.
16698 This scheme is compatible with use of the full Wide_Wide_Character set.
16699 On input, brackets coding can also be used for upper half characters,
16700 e.g.@: @code{["C1"]} for lower case a.  However, on output, brackets notation
16701 is only used for wide characters with a code greater than @code{16#FF#}.
16703 @end table
16705 @noindent
16706 If is also possible to use the other Wide_Character encoding methods,
16707 such as Shift-JIS, but the other schemes cannot support the full range
16708 of wide wide characters.
16709 An attempt to output a character that cannot
16710 be represented using the encoding scheme for the file causes
16711 Constraint_Error to be raised.  An invalid wide character sequence on
16712 input also causes Constraint_Error to be raised.
16714 @menu
16715 * Wide_Wide_Text_IO Stream Pointer Positioning::
16716 * Wide_Wide_Text_IO Reading and Writing Non-Regular Files::
16717 @end menu
16719 @node Wide_Wide_Text_IO Stream Pointer Positioning
16720 @subsection Stream Pointer Positioning
16722 @noindent
16723 @code{Ada.Wide_Wide_Text_IO} is similar to @code{Ada.Text_IO} in its handling
16724 of stream pointer positioning (@pxref{Text_IO}).  There is one additional
16725 case:
16727 If @code{Ada.Wide_Wide_Text_IO.Look_Ahead} reads a character outside the
16728 normal lower ASCII set (i.e.@: a character in the range:
16730 @smallexample @c ada
16731 Wide_Wide_Character'Val (16#0080#) .. Wide_Wide_Character'Val (16#10FFFF#)
16732 @end smallexample
16734 @noindent
16735 then although the logical position of the file pointer is unchanged by
16736 the @code{Look_Ahead} call, the stream is physically positioned past the
16737 wide character sequence.  Again this is to avoid the need for buffering
16738 or backup, and all @code{Wide_Wide_Text_IO} routines check the internal
16739 indication that this situation has occurred so that this is not visible
16740 to a normal program using @code{Wide_Wide_Text_IO}.  However, this discrepancy
16741 can be observed if the wide text file shares a stream with another file.
16743 @node Wide_Wide_Text_IO Reading and Writing Non-Regular Files
16744 @subsection Reading and Writing Non-Regular Files
16746 @noindent
16747 As in the case of Text_IO, when a non-regular file is read, it is
16748 assumed that the file contains no page marks (any form characters are
16749 treated as data characters), and @code{End_Of_Page} always returns
16750 @code{False}.  Similarly, the end of file indication is not sticky, so
16751 it is possible to read beyond an end of file.
16753 @node Stream_IO
16754 @section Stream_IO
16756 @noindent
16757 A stream file is a sequence of bytes, where individual elements are
16758 written to the file as described in the Ada Reference Manual.  The type
16759 @code{Stream_Element} is simply a byte.  There are two ways to read or
16760 write a stream file.
16762 @itemize @bullet
16763 @item
16764 The operations @code{Read} and @code{Write} directly read or write a
16765 sequence of stream elements with no control information.
16767 @item
16768 The stream attributes applied to a stream file transfer data in the
16769 manner described for stream attributes.
16770 @end itemize
16772 @node Text Translation
16773 @section Text Translation
16775 @noindent
16776 @samp{Text_Translation=@var{xxx}} may be used as the Form parameter
16777 passed to Text_IO.Create and Text_IO.Open:
16778 @samp{Text_Translation=@var{Yes}} is the default, which means to
16779 translate LF to/from CR/LF on Windows systems.
16780 @samp{Text_Translation=@var{No}} disables this translation; i.e. it
16781 uses binary mode. For output files, @samp{Text_Translation=@var{No}}
16782 may be used to create Unix-style files on
16783 Windows. @samp{Text_Translation=@var{xxx}} has no effect on Unix
16784 systems.
16786 @node Shared Files
16787 @section Shared Files
16789 @noindent
16790 Section A.14 of the Ada Reference Manual allows implementations to
16791 provide a wide variety of behavior if an attempt is made to access the
16792 same external file with two or more internal files.
16794 To provide a full range of functionality, while at the same time
16795 minimizing the problems of portability caused by this implementation
16796 dependence, GNAT handles file sharing as follows:
16798 @itemize @bullet
16799 @item
16800 In the absence of a @samp{shared=@var{xxx}} form parameter, an attempt
16801 to open two or more files with the same full name is considered an error
16802 and is not supported.  The exception @code{Use_Error} will be
16803 raised.  Note that a file that is not explicitly closed by the program
16804 remains open until the program terminates.
16806 @item
16807 If the form parameter @samp{shared=no} appears in the form string, the
16808 file can be opened or created with its own separate stream identifier,
16809 regardless of whether other files sharing the same external file are
16810 opened.  The exact effect depends on how the C stream routines handle
16811 multiple accesses to the same external files using separate streams.
16813 @item
16814 If the form parameter @samp{shared=yes} appears in the form string for
16815 each of two or more files opened using the same full name, the same
16816 stream is shared between these files, and the semantics are as described
16817 in Ada Reference Manual, Section A.14.
16818 @end itemize
16820 @noindent
16821 When a program that opens multiple files with the same name is ported
16822 from another Ada compiler to GNAT, the effect will be that
16823 @code{Use_Error} is raised.
16825 The documentation of the original compiler and the documentation of the
16826 program should then be examined to determine if file sharing was
16827 expected, and @samp{shared=@var{xxx}} parameters added to @code{Open}
16828 and @code{Create} calls as required.
16830 When a program is ported from GNAT to some other Ada compiler, no
16831 special attention is required unless the @samp{shared=@var{xxx}} form
16832 parameter is used in the program.  In this case, you must examine the
16833 documentation of the new compiler to see if it supports the required
16834 file sharing semantics, and form strings modified appropriately.  Of
16835 course it may be the case that the program cannot be ported if the
16836 target compiler does not support the required functionality.  The best
16837 approach in writing portable code is to avoid file sharing (and hence
16838 the use of the @samp{shared=@var{xxx}} parameter in the form string)
16839 completely.
16841 One common use of file sharing in Ada 83 is the use of instantiations of
16842 Sequential_IO on the same file with different types, to achieve
16843 heterogeneous input-output.  Although this approach will work in GNAT if
16844 @samp{shared=yes} is specified, it is preferable in Ada to use Stream_IO
16845 for this purpose (using the stream attributes)
16847 @node Filenames encoding
16848 @section Filenames encoding
16850 @noindent
16851 An encoding form parameter can be used to specify the filename
16852 encoding @samp{encoding=@var{xxx}}.
16854 @itemize @bullet
16855 @item
16856 If the form parameter @samp{encoding=utf8} appears in the form string, the
16857 filename must be encoded in UTF-8.
16859 @item
16860 If the form parameter @samp{encoding=8bits} appears in the form
16861 string, the filename must be a standard 8bits string.
16862 @end itemize
16864 In the absence of a @samp{encoding=@var{xxx}} form parameter, the
16865 encoding is controlled by the @samp{GNAT_CODE_PAGE} environment
16866 variable. And if not set @samp{utf8} is assumed.
16868 @table @samp
16869 @item CP_ACP
16870 The current system Windows ANSI code page.
16871 @item CP_UTF8
16872 UTF-8 encoding
16873 @end table
16875 This encoding form parameter is only supported on the Windows
16876 platform. On the other Operating Systems the run-time is supporting
16877 UTF-8 natively.
16879 @node Open Modes
16880 @section Open Modes
16882 @noindent
16883 @code{Open} and @code{Create} calls result in a call to @code{fopen}
16884 using the mode shown in the following table:
16886 @sp 2
16887 @center @code{Open} and @code{Create} Call Modes
16888 @smallexample
16889                                @b{OPEN }           @b{CREATE}
16890 Append_File                    "r+"             "w+"
16891 In_File                        "r"              "w+"
16892 Out_File (Direct_IO)           "r+"             "w"
16893 Out_File (all other cases)     "w"              "w"
16894 Inout_File                     "r+"             "w+"
16895 @end smallexample
16897 @noindent
16898 If text file translation is required, then either @samp{b} or @samp{t}
16899 is added to the mode, depending on the setting of Text.  Text file
16900 translation refers to the mapping of CR/LF sequences in an external file
16901 to LF characters internally.  This mapping only occurs in DOS and
16902 DOS-like systems, and is not relevant to other systems.
16904 A special case occurs with Stream_IO@.  As shown in the above table, the
16905 file is initially opened in @samp{r} or @samp{w} mode for the
16906 @code{In_File} and @code{Out_File} cases.  If a @code{Set_Mode} operation
16907 subsequently requires switching from reading to writing or vice-versa,
16908 then the file is reopened in @samp{r+} mode to permit the required operation.
16910 @node Operations on C Streams
16911 @section Operations on C Streams
16912 The package @code{Interfaces.C_Streams} provides an Ada program with direct
16913 access to the C library functions for operations on C streams:
16915 @smallexample @c adanocomment
16916 package Interfaces.C_Streams is
16917   -- Note: the reason we do not use the types that are in
16918   -- Interfaces.C is that we want to avoid dragging in the
16919   -- code in this unit if possible.
16920   subtype chars is System.Address;
16921   -- Pointer to null-terminated array of characters
16922   subtype FILEs is System.Address;
16923   -- Corresponds to the C type FILE*
16924   subtype voids is System.Address;
16925   -- Corresponds to the C type void*
16926   subtype int is Integer;
16927   subtype long is Long_Integer;
16928   -- Note: the above types are subtypes deliberately, and it
16929   -- is part of this spec that the above correspondences are
16930   -- guaranteed.  This means that it is legitimate to, for
16931   -- example, use Integer instead of int.  We provide these
16932   -- synonyms for clarity, but in some cases it may be
16933   -- convenient to use the underlying types (for example to
16934   -- avoid an unnecessary dependency of a spec on the spec
16935   -- of this unit).
16936   type size_t is mod 2 ** Standard'Address_Size;
16937   NULL_Stream : constant FILEs;
16938   -- Value returned (NULL in C) to indicate an
16939   -- fdopen/fopen/tmpfile error
16940   ----------------------------------
16941   -- Constants Defined in stdio.h --
16942   ----------------------------------
16943   EOF : constant int;
16944   -- Used by a number of routines to indicate error or
16945   -- end of file
16946   IOFBF : constant int;
16947   IOLBF : constant int;
16948   IONBF : constant int;
16949   -- Used to indicate buffering mode for setvbuf call
16950   SEEK_CUR : constant int;
16951   SEEK_END : constant int;
16952   SEEK_SET : constant int;
16953   -- Used to indicate origin for fseek call
16954   function stdin return FILEs;
16955   function stdout return FILEs;
16956   function stderr return FILEs;
16957   -- Streams associated with standard files
16958   --------------------------
16959   -- Standard C functions --
16960   --------------------------
16961   -- The functions selected below are ones that are
16962   -- available in UNIX (but not necessarily in ANSI C).
16963   -- These are very thin interfaces
16964   -- which copy exactly the C headers.  For more
16965   -- documentation on these functions, see the Microsoft C
16966   -- "Run-Time Library Reference" (Microsoft Press, 1990,
16967   -- ISBN 1-55615-225-6), which includes useful information
16968   -- on system compatibility.
16969   procedure clearerr (stream : FILEs);
16970   function fclose (stream : FILEs) return int;
16971   function fdopen (handle : int; mode : chars) return FILEs;
16972   function feof (stream : FILEs) return int;
16973   function ferror (stream : FILEs) return int;
16974   function fflush (stream : FILEs) return int;
16975   function fgetc (stream : FILEs) return int;
16976   function fgets (strng : chars; n : int; stream : FILEs)
16977       return chars;
16978   function fileno (stream : FILEs) return int;
16979   function fopen (filename : chars; Mode : chars)
16980       return FILEs;
16981   -- Note: to maintain target independence, use
16982   -- text_translation_required, a boolean variable defined in
16983   -- a-sysdep.c to deal with the target dependent text
16984   -- translation requirement.  If this variable is set,
16985   -- then  b/t should be appended to the standard mode
16986   -- argument to set the text translation mode off or on
16987   -- as required.
16988   function fputc (C : int; stream : FILEs) return int;
16989   function fputs (Strng : chars; Stream : FILEs) return int;
16990   function fread
16991      (buffer : voids;
16992       size : size_t;
16993       count : size_t;
16994       stream : FILEs)
16995       return size_t;
16996   function freopen
16997      (filename : chars;
16998       mode : chars;
16999       stream : FILEs)
17000       return FILEs;
17001   function fseek
17002      (stream : FILEs;
17003       offset : long;
17004       origin : int)
17005       return int;
17006   function ftell (stream : FILEs) return long;
17007   function fwrite
17008      (buffer : voids;
17009       size : size_t;
17010       count : size_t;
17011       stream : FILEs)
17012       return size_t;
17013   function isatty (handle : int) return int;
17014   procedure mktemp (template : chars);
17015   -- The return value (which is just a pointer to template)
17016   -- is discarded
17017   procedure rewind (stream : FILEs);
17018   function rmtmp return int;
17019   function setvbuf
17020      (stream : FILEs;
17021       buffer : chars;
17022       mode : int;
17023       size : size_t)
17024       return int;
17026   function tmpfile return FILEs;
17027   function ungetc (c : int; stream : FILEs) return int;
17028   function unlink (filename : chars) return int;
17029   ---------------------
17030   -- Extra functions --
17031   ---------------------
17032   -- These functions supply slightly thicker bindings than
17033   -- those above.  They are derived from functions in the
17034   -- C Run-Time Library, but may do a bit more work than
17035   -- just directly calling one of the Library functions.
17036   function is_regular_file (handle : int) return int;
17037   -- Tests if given handle is for a regular file (result 1)
17038   -- or for a non-regular file (pipe or device, result 0).
17039   ---------------------------------
17040   -- Control of Text/Binary Mode --
17041   ---------------------------------
17042   -- If text_translation_required is true, then the following
17043   -- functions may be used to dynamically switch a file from
17044   -- binary to text mode or vice versa.  These functions have
17045   -- no effect if text_translation_required is false (i.e.@: in
17046   -- normal UNIX mode).  Use fileno to get a stream handle.
17047   procedure set_binary_mode (handle : int);
17048   procedure set_text_mode (handle : int);
17049   ----------------------------
17050   -- Full Path Name support --
17051   ----------------------------
17052   procedure full_name (nam : chars; buffer : chars);
17053   -- Given a NUL terminated string representing a file
17054   -- name, returns in buffer a NUL terminated string
17055   -- representing the full path name for the file name.
17056   -- On systems where it is relevant the   drive is also
17057   -- part of the full path name.  It is the responsibility
17058   -- of the caller to pass an actual parameter for buffer
17059   -- that is big enough for any full path name.  Use
17060   -- max_path_len given below as the size of buffer.
17061   max_path_len : integer;
17062   -- Maximum length of an allowable full path name on the
17063   -- system, including a terminating NUL character.
17064 end Interfaces.C_Streams;
17065 @end smallexample
17067 @node Interfacing to C Streams
17068 @section Interfacing to C Streams
17070 @noindent
17071 The packages in this section permit interfacing Ada files to C Stream
17072 operations.
17074 @smallexample @c ada
17075  with Interfaces.C_Streams;
17076  package Ada.Sequential_IO.C_Streams is
17077     function C_Stream (F : File_Type)
17078        return Interfaces.C_Streams.FILEs;
17079     procedure Open
17080       (File : in out File_Type;
17081        Mode : in File_Mode;
17082        C_Stream : in Interfaces.C_Streams.FILEs;
17083        Form : in String := "");
17084  end Ada.Sequential_IO.C_Streams;
17086   with Interfaces.C_Streams;
17087   package Ada.Direct_IO.C_Streams is
17088      function C_Stream (F : File_Type)
17089         return Interfaces.C_Streams.FILEs;
17090      procedure Open
17091        (File : in out File_Type;
17092         Mode : in File_Mode;
17093         C_Stream : in Interfaces.C_Streams.FILEs;
17094         Form : in String := "");
17095   end Ada.Direct_IO.C_Streams;
17097   with Interfaces.C_Streams;
17098   package Ada.Text_IO.C_Streams is
17099      function C_Stream (F : File_Type)
17100         return Interfaces.C_Streams.FILEs;
17101      procedure Open
17102        (File : in out File_Type;
17103         Mode : in File_Mode;
17104         C_Stream : in Interfaces.C_Streams.FILEs;
17105         Form : in String := "");
17106   end Ada.Text_IO.C_Streams;
17108   with Interfaces.C_Streams;
17109   package Ada.Wide_Text_IO.C_Streams is
17110      function C_Stream (F : File_Type)
17111         return Interfaces.C_Streams.FILEs;
17112      procedure Open
17113        (File : in out File_Type;
17114         Mode : in File_Mode;
17115         C_Stream : in Interfaces.C_Streams.FILEs;
17116         Form : in String := "");
17117  end Ada.Wide_Text_IO.C_Streams;
17119   with Interfaces.C_Streams;
17120   package Ada.Wide_Wide_Text_IO.C_Streams is
17121      function C_Stream (F : File_Type)
17122         return Interfaces.C_Streams.FILEs;
17123      procedure Open
17124        (File : in out File_Type;
17125         Mode : in File_Mode;
17126         C_Stream : in Interfaces.C_Streams.FILEs;
17127         Form : in String := "");
17128  end Ada.Wide_Wide_Text_IO.C_Streams;
17130  with Interfaces.C_Streams;
17131  package Ada.Stream_IO.C_Streams is
17132     function C_Stream (F : File_Type)
17133        return Interfaces.C_Streams.FILEs;
17134     procedure Open
17135       (File : in out File_Type;
17136        Mode : in File_Mode;
17137        C_Stream : in Interfaces.C_Streams.FILEs;
17138        Form : in String := "");
17139  end Ada.Stream_IO.C_Streams;
17140 @end smallexample
17142 @noindent
17143 In each of these six packages, the @code{C_Stream} function obtains the
17144 @code{FILE} pointer from a currently opened Ada file.  It is then
17145 possible to use the @code{Interfaces.C_Streams} package to operate on
17146 this stream, or the stream can be passed to a C program which can
17147 operate on it directly.  Of course the program is responsible for
17148 ensuring that only appropriate sequences of operations are executed.
17150 One particular use of relevance to an Ada program is that the
17151 @code{setvbuf} function can be used to control the buffering of the
17152 stream used by an Ada file.  In the absence of such a call the standard
17153 default buffering is used.
17155 The @code{Open} procedures in these packages open a file giving an
17156 existing C Stream instead of a file name.  Typically this stream is
17157 imported from a C program, allowing an Ada file to operate on an
17158 existing C file.
17160 @node The GNAT Library
17161 @chapter The GNAT Library
17163 @noindent
17164 The GNAT library contains a number of general and special purpose packages.
17165 It represents functionality that the GNAT developers have found useful, and
17166 which is made available to GNAT users.  The packages described here are fully
17167 supported, and upwards compatibility will be maintained in future releases,
17168 so you can use these facilities with the confidence that the same functionality
17169 will be available in future releases.
17171 The chapter here simply gives a brief summary of the facilities available.
17172 The full documentation is found in the spec file for the package.  The full
17173 sources of these library packages, including both spec and body, are provided
17174 with all GNAT releases.  For example, to find out the full specifications of
17175 the SPITBOL pattern matching capability, including a full tutorial and
17176 extensive examples, look in the @file{g-spipat.ads} file in the library.
17178 For each entry here, the package name (as it would appear in a @code{with}
17179 clause) is given, followed by the name of the corresponding spec file in
17180 parentheses.  The packages are children in four hierarchies, @code{Ada},
17181 @code{Interfaces}, @code{System}, and @code{GNAT}, the latter being a
17182 GNAT-specific hierarchy.
17184 Note that an application program should only use packages in one of these
17185 four hierarchies if the package is defined in the Ada Reference Manual,
17186 or is listed in this section of the GNAT Programmers Reference Manual.
17187 All other units should be considered internal implementation units and
17188 should not be directly @code{with}'ed by application code.  The use of
17189 a @code{with} statement that references one of these internal implementation
17190 units makes an application potentially dependent on changes in versions
17191 of GNAT, and will generate a warning message.
17193 @menu
17194 * Ada.Characters.Latin_9 (a-chlat9.ads)::
17195 * Ada.Characters.Wide_Latin_1 (a-cwila1.ads)::
17196 * Ada.Characters.Wide_Latin_9 (a-cwila9.ads)::
17197 * Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)::
17198 * Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)::
17199 * Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)::
17200 * Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)::
17201 * Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)::
17202 * Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)::
17203 * Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)::
17204 * Ada.Containers.Formal_Vectors (a-cofove.ads)::
17205 * Ada.Command_Line.Environment (a-colien.ads)::
17206 * Ada.Command_Line.Remove (a-colire.ads)::
17207 * Ada.Command_Line.Response_File (a-clrefi.ads)::
17208 * Ada.Direct_IO.C_Streams (a-diocst.ads)::
17209 * Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)::
17210 * Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)::
17211 * Ada.Exceptions.Traceback (a-exctra.ads)::
17212 * Ada.Sequential_IO.C_Streams (a-siocst.ads)::
17213 * Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)::
17214 * Ada.Strings.Unbounded.Text_IO (a-suteio.ads)::
17215 * Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)::
17216 * Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)::
17217 * Ada.Text_IO.C_Streams (a-tiocst.ads)::
17218 * Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)::
17219 * Ada.Wide_Characters.Unicode (a-wichun.ads)::
17220 * Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)::
17221 * Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)::
17222 * Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)::
17223 * Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)::
17224 * Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)::
17225 * GNAT.Altivec (g-altive.ads)::
17226 * GNAT.Altivec.Conversions (g-altcon.ads)::
17227 * GNAT.Altivec.Vector_Operations (g-alveop.ads)::
17228 * GNAT.Altivec.Vector_Types (g-alvety.ads)::
17229 * GNAT.Altivec.Vector_Views (g-alvevi.ads)::
17230 * GNAT.Array_Split (g-arrspl.ads)::
17231 * GNAT.AWK (g-awk.ads)::
17232 * GNAT.Bounded_Buffers (g-boubuf.ads)::
17233 * GNAT.Bounded_Mailboxes (g-boumai.ads)::
17234 * GNAT.Bubble_Sort (g-bubsor.ads)::
17235 * GNAT.Bubble_Sort_A (g-busora.ads)::
17236 * GNAT.Bubble_Sort_G (g-busorg.ads)::
17237 * GNAT.Byte_Order_Mark (g-byorma.ads)::
17238 * GNAT.Byte_Swapping (g-bytswa.ads)::
17239 * GNAT.Calendar (g-calend.ads)::
17240 * GNAT.Calendar.Time_IO (g-catiio.ads)::
17241 * GNAT.Case_Util (g-casuti.ads)::
17242 * GNAT.CGI (g-cgi.ads)::
17243 * GNAT.CGI.Cookie (g-cgicoo.ads)::
17244 * GNAT.CGI.Debug (g-cgideb.ads)::
17245 * GNAT.Command_Line (g-comlin.ads)::
17246 * GNAT.Compiler_Version (g-comver.ads)::
17247 * GNAT.Ctrl_C (g-ctrl_c.ads)::
17248 * GNAT.CRC32 (g-crc32.ads)::
17249 * GNAT.Current_Exception (g-curexc.ads)::
17250 * GNAT.Debug_Pools (g-debpoo.ads)::
17251 * GNAT.Debug_Utilities (g-debuti.ads)::
17252 * GNAT.Decode_String (g-decstr.ads)::
17253 * GNAT.Decode_UTF8_String (g-deutst.ads)::
17254 * GNAT.Directory_Operations (g-dirope.ads)::
17255 * GNAT.Directory_Operations.Iteration (g-diopit.ads)::
17256 * GNAT.Dynamic_HTables (g-dynhta.ads)::
17257 * GNAT.Dynamic_Tables (g-dyntab.ads)::
17258 * GNAT.Encode_String (g-encstr.ads)::
17259 * GNAT.Encode_UTF8_String (g-enutst.ads)::
17260 * GNAT.Exception_Actions (g-excact.ads)::
17261 * GNAT.Exception_Traces (g-exctra.ads)::
17262 * GNAT.Exceptions (g-except.ads)::
17263 * GNAT.Expect (g-expect.ads)::
17264 * GNAT.Expect.TTY (g-exptty.ads)::
17265 * GNAT.Float_Control (g-flocon.ads)::
17266 * GNAT.Heap_Sort (g-heasor.ads)::
17267 * GNAT.Heap_Sort_A (g-hesora.ads)::
17268 * GNAT.Heap_Sort_G (g-hesorg.ads)::
17269 * GNAT.HTable (g-htable.ads)::
17270 * GNAT.IO (g-io.ads)::
17271 * GNAT.IO_Aux (g-io_aux.ads)::
17272 * GNAT.Lock_Files (g-locfil.ads)::
17273 * GNAT.MBBS_Discrete_Random (g-mbdira.ads)::
17274 * GNAT.MBBS_Float_Random (g-mbflra.ads)::
17275 * GNAT.MD5 (g-md5.ads)::
17276 * GNAT.Memory_Dump (g-memdum.ads)::
17277 * GNAT.Most_Recent_Exception (g-moreex.ads)::
17278 * GNAT.OS_Lib (g-os_lib.ads)::
17279 * GNAT.Perfect_Hash_Generators (g-pehage.ads)::
17280 * GNAT.Random_Numbers (g-rannum.ads)::
17281 * GNAT.Regexp (g-regexp.ads)::
17282 * GNAT.Registry (g-regist.ads)::
17283 * GNAT.Regpat (g-regpat.ads)::
17284 * GNAT.Secondary_Stack_Info (g-sestin.ads)::
17285 * GNAT.Semaphores (g-semaph.ads)::
17286 * GNAT.Serial_Communications (g-sercom.ads)::
17287 * GNAT.SHA1 (g-sha1.ads)::
17288 * GNAT.SHA224 (g-sha224.ads)::
17289 * GNAT.SHA256 (g-sha256.ads)::
17290 * GNAT.SHA384 (g-sha384.ads)::
17291 * GNAT.SHA512 (g-sha512.ads)::
17292 * GNAT.Signals (g-signal.ads)::
17293 * GNAT.Sockets (g-socket.ads)::
17294 * GNAT.Source_Info (g-souinf.ads)::
17295 * GNAT.Spelling_Checker (g-speche.ads)::
17296 * GNAT.Spelling_Checker_Generic (g-spchge.ads)::
17297 * GNAT.Spitbol.Patterns (g-spipat.ads)::
17298 * GNAT.Spitbol (g-spitbo.ads)::
17299 * GNAT.Spitbol.Table_Boolean (g-sptabo.ads)::
17300 * GNAT.Spitbol.Table_Integer (g-sptain.ads)::
17301 * GNAT.Spitbol.Table_VString (g-sptavs.ads)::
17302 * GNAT.SSE (g-sse.ads)::
17303 * GNAT.SSE.Vector_Types (g-ssvety.ads)::
17304 * GNAT.Strings (g-string.ads)::
17305 * GNAT.String_Split (g-strspl.ads)::
17306 * GNAT.Table (g-table.ads)::
17307 * GNAT.Task_Lock (g-tasloc.ads)::
17308 * GNAT.Threads (g-thread.ads)::
17309 * GNAT.Time_Stamp (g-timsta.ads)::
17310 * GNAT.Traceback (g-traceb.ads)::
17311 * GNAT.Traceback.Symbolic (g-trasym.ads)::
17312 * GNAT.UTF_32 (g-utf_32.ads)::
17313 * GNAT.UTF_32_Spelling_Checker (g-u3spch.ads)::
17314 * GNAT.Wide_Spelling_Checker (g-wispch.ads)::
17315 * GNAT.Wide_String_Split (g-wistsp.ads)::
17316 * GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)::
17317 * GNAT.Wide_Wide_String_Split (g-zistsp.ads)::
17318 * Interfaces.C.Extensions (i-cexten.ads)::
17319 * Interfaces.C.Streams (i-cstrea.ads)::
17320 * Interfaces.CPP (i-cpp.ads)::
17321 * Interfaces.Packed_Decimal (i-pacdec.ads)::
17322 * Interfaces.VxWorks (i-vxwork.ads)::
17323 * Interfaces.VxWorks.IO (i-vxwoio.ads)::
17324 * System.Address_Image (s-addima.ads)::
17325 * System.Assertions (s-assert.ads)::
17326 * System.Memory (s-memory.ads)::
17327 * System.Multiprocessors (s-multip.ads)::
17328 * System.Multiprocessors.Dispatching_Domains (s-mudido.ads)::
17329 * System.Partition_Interface (s-parint.ads)::
17330 * System.Pool_Global (s-pooglo.ads)::
17331 * System.Pool_Local (s-pooloc.ads)::
17332 * System.Restrictions (s-restri.ads)::
17333 * System.Rident (s-rident.ads)::
17334 * System.Strings.Stream_Ops (s-ststop.ads)::
17335 * System.Task_Info (s-tasinf.ads)::
17336 * System.Wch_Cnv (s-wchcnv.ads)::
17337 * System.Wch_Con (s-wchcon.ads)::
17338 @end menu
17340 @node Ada.Characters.Latin_9 (a-chlat9.ads)
17341 @section @code{Ada.Characters.Latin_9} (@file{a-chlat9.ads})
17342 @cindex @code{Ada.Characters.Latin_9} (@file{a-chlat9.ads})
17343 @cindex Latin_9 constants for Character
17345 @noindent
17346 This child of @code{Ada.Characters}
17347 provides a set of definitions corresponding to those in the
17348 RM-defined package @code{Ada.Characters.Latin_1} but with the
17349 few modifications required for @code{Latin-9}
17350 The provision of such a package
17351 is specifically authorized by the Ada Reference Manual
17352 (RM A.3.3(27)).
17354 @node Ada.Characters.Wide_Latin_1 (a-cwila1.ads)
17355 @section @code{Ada.Characters.Wide_Latin_1} (@file{a-cwila1.ads})
17356 @cindex @code{Ada.Characters.Wide_Latin_1} (@file{a-cwila1.ads})
17357 @cindex Latin_1 constants for Wide_Character
17359 @noindent
17360 This child of @code{Ada.Characters}
17361 provides a set of definitions corresponding to those in the
17362 RM-defined package @code{Ada.Characters.Latin_1} but with the
17363 types of the constants being @code{Wide_Character}
17364 instead of @code{Character}.  The provision of such a package
17365 is specifically authorized by the Ada Reference Manual
17366 (RM A.3.3(27)).
17368 @node Ada.Characters.Wide_Latin_9 (a-cwila9.ads)
17369 @section @code{Ada.Characters.Wide_Latin_9} (@file{a-cwila1.ads})
17370 @cindex @code{Ada.Characters.Wide_Latin_9} (@file{a-cwila1.ads})
17371 @cindex Latin_9 constants for Wide_Character
17373 @noindent
17374 This child of @code{Ada.Characters}
17375 provides a set of definitions corresponding to those in the
17376 GNAT defined package @code{Ada.Characters.Latin_9} but with the
17377 types of the constants being @code{Wide_Character}
17378 instead of @code{Character}.  The provision of such a package
17379 is specifically authorized by the Ada Reference Manual
17380 (RM A.3.3(27)).
17382 @node Ada.Characters.Wide_Wide_Latin_1 (a-chzla1.ads)
17383 @section @code{Ada.Characters.Wide_Wide_Latin_1} (@file{a-chzla1.ads})
17384 @cindex @code{Ada.Characters.Wide_Wide_Latin_1} (@file{a-chzla1.ads})
17385 @cindex Latin_1 constants for Wide_Wide_Character
17387 @noindent
17388 This child of @code{Ada.Characters}
17389 provides a set of definitions corresponding to those in the
17390 RM-defined package @code{Ada.Characters.Latin_1} but with the
17391 types of the constants being @code{Wide_Wide_Character}
17392 instead of @code{Character}.  The provision of such a package
17393 is specifically authorized by the Ada Reference Manual
17394 (RM A.3.3(27)).
17396 @node Ada.Characters.Wide_Wide_Latin_9 (a-chzla9.ads)
17397 @section @code{Ada.Characters.Wide_Wide_Latin_9} (@file{a-chzla9.ads})
17398 @cindex @code{Ada.Characters.Wide_Wide_Latin_9} (@file{a-chzla9.ads})
17399 @cindex Latin_9 constants for Wide_Wide_Character
17401 @noindent
17402 This child of @code{Ada.Characters}
17403 provides a set of definitions corresponding to those in the
17404 GNAT defined package @code{Ada.Characters.Latin_9} but with the
17405 types of the constants being @code{Wide_Wide_Character}
17406 instead of @code{Character}.  The provision of such a package
17407 is specifically authorized by the Ada Reference Manual
17408 (RM A.3.3(27)).
17410 @node Ada.Containers.Formal_Doubly_Linked_Lists (a-cfdlli.ads)
17411 @section @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@file{a-cfdlli.ads})
17412 @cindex @code{Ada.Containers.Formal_Doubly_Linked_Lists} (@file{a-cfdlli.ads})
17413 @cindex Formal container for doubly linked lists
17415 @noindent
17416 This child of @code{Ada.Containers} defines a modified version of the
17417 Ada 2005 container for doubly linked lists, meant to facilitate formal
17418 verification of code using such containers. The specification of this
17419 unit is compatible with SPARK 2014. Note that the API of this unit may
17420 be subject to incompatible changes as SPARK 2014 evolves.
17422 @node Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
17423 @section @code{Ada.Containers.Formal_Hashed_Maps} (@file{a-cfhama.ads})
17424 @cindex @code{Ada.Containers.Formal_Hashed_Maps} (@file{a-cfhama.ads})
17425 @cindex Formal container for hashed maps
17427 @noindent
17428 This child of @code{Ada.Containers} defines a modified version of the
17429 Ada 2005 container for hashed maps, meant to facilitate formal
17430 verification of code using such containers. The specification of this
17431 unit is compatible with SPARK 2014. Note that the API of this unit may
17432 be subject to incompatible changes as SPARK 2014 evolves.
17434 @node Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
17435 @section @code{Ada.Containers.Formal_Hashed_Sets} (@file{a-cfhase.ads})
17436 @cindex @code{Ada.Containers.Formal_Hashed_Sets} (@file{a-cfhase.ads})
17437 @cindex Formal container for hashed sets
17439 @noindent
17440 This child of @code{Ada.Containers} defines a modified version of the
17441 Ada 2005 container for hashed sets, meant to facilitate formal
17442 verification of code using such containers. The specification of this
17443 unit is compatible with SPARK 2014. Note that the API of this unit may
17444 be subject to incompatible changes as SPARK 2014 evolves.
17446 @node Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
17447 @section @code{Ada.Containers.Formal_Ordered_Maps} (@file{a-cforma.ads})
17448 @cindex @code{Ada.Containers.Formal_Ordered_Maps} (@file{a-cforma.ads})
17449 @cindex Formal container for ordered maps
17451 @noindent
17452 This child of @code{Ada.Containers} defines a modified version of the
17453 Ada 2005 container for ordered maps, meant to facilitate formal
17454 verification of code using such containers. The specification of this
17455 unit is compatible with SPARK 2014. Note that the API of this unit may
17456 be subject to incompatible changes as SPARK 2014 evolves.
17458 @node Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
17459 @section @code{Ada.Containers.Formal_Ordered_Sets} (@file{a-cforse.ads})
17460 @cindex @code{Ada.Containers.Formal_Ordered_Sets} (@file{a-cforse.ads})
17461 @cindex Formal container for ordered sets
17463 @noindent
17464 This child of @code{Ada.Containers} defines a modified version of the
17465 Ada 2005 container for ordered sets, meant to facilitate formal
17466 verification of code using such containers. The specification of this
17467 unit is compatible with SPARK 2014. Note that the API of this unit may
17468 be subject to incompatible changes as SPARK 2014 evolves.
17470 @node Ada.Containers.Formal_Vectors (a-cofove.ads)
17471 @section @code{Ada.Containers.Formal_Vectors} (@file{a-cofove.ads})
17472 @cindex @code{Ada.Containers.Formal_Vectors} (@file{a-cofove.ads})
17473 @cindex Formal container for vectors
17475 @noindent
17476 This child of @code{Ada.Containers} defines a modified version of the
17477 Ada 2005 container for vectors, meant to facilitate formal
17478 verification of code using such containers. The specification of this
17479 unit is compatible with SPARK 2014. Note that the API of this unit may
17480 be subject to incompatible changes as SPARK 2014 evolves.
17482 @node Ada.Command_Line.Environment (a-colien.ads)
17483 @section @code{Ada.Command_Line.Environment} (@file{a-colien.ads})
17484 @cindex @code{Ada.Command_Line.Environment} (@file{a-colien.ads})
17485 @cindex Environment entries
17487 @noindent
17488 This child of @code{Ada.Command_Line}
17489 provides a mechanism for obtaining environment values on systems
17490 where this concept makes sense.
17492 @node Ada.Command_Line.Remove (a-colire.ads)
17493 @section @code{Ada.Command_Line.Remove} (@file{a-colire.ads})
17494 @cindex @code{Ada.Command_Line.Remove} (@file{a-colire.ads})
17495 @cindex Removing command line arguments
17496 @cindex Command line, argument removal
17498 @noindent
17499 This child of @code{Ada.Command_Line}
17500 provides a mechanism for logically removing
17501 arguments from the argument list.  Once removed, an argument is not visible
17502 to further calls on the subprograms in @code{Ada.Command_Line} will not
17503 see the removed argument.
17505 @node Ada.Command_Line.Response_File (a-clrefi.ads)
17506 @section @code{Ada.Command_Line.Response_File} (@file{a-clrefi.ads})
17507 @cindex @code{Ada.Command_Line.Response_File} (@file{a-clrefi.ads})
17508 @cindex Response file for command line
17509 @cindex Command line, response file
17510 @cindex Command line, handling long command lines
17512 @noindent
17513 This child of @code{Ada.Command_Line} provides a mechanism facilities for
17514 getting command line arguments from a text file, called a "response file".
17515 Using a response file allow passing a set of arguments to an executable longer
17516 than the maximum allowed by the system on the command line.
17518 @node Ada.Direct_IO.C_Streams (a-diocst.ads)
17519 @section @code{Ada.Direct_IO.C_Streams} (@file{a-diocst.ads})
17520 @cindex @code{Ada.Direct_IO.C_Streams} (@file{a-diocst.ads})
17521 @cindex C Streams, Interfacing with Direct_IO
17523 @noindent
17524 This package provides subprograms that allow interfacing between
17525 C streams and @code{Direct_IO}.  The stream identifier can be
17526 extracted from a file opened on the Ada side, and an Ada file
17527 can be constructed from a stream opened on the C side.
17529 @node Ada.Exceptions.Is_Null_Occurrence (a-einuoc.ads)
17530 @section @code{Ada.Exceptions.Is_Null_Occurrence} (@file{a-einuoc.ads})
17531 @cindex @code{Ada.Exceptions.Is_Null_Occurrence} (@file{a-einuoc.ads})
17532 @cindex Null_Occurrence, testing for
17534 @noindent
17535 This child subprogram provides a way of testing for the null
17536 exception occurrence (@code{Null_Occurrence}) without raising
17537 an exception.
17539 @node Ada.Exceptions.Last_Chance_Handler (a-elchha.ads)
17540 @section @code{Ada.Exceptions.Last_Chance_Handler} (@file{a-elchha.ads})
17541 @cindex @code{Ada.Exceptions.Last_Chance_Handler} (@file{a-elchha.ads})
17542 @cindex Null_Occurrence, testing for
17544 @noindent
17545 This child subprogram is used for handling otherwise unhandled
17546 exceptions (hence the name last chance), and perform clean ups before
17547 terminating the program. Note that this subprogram never returns.
17549 @node Ada.Exceptions.Traceback (a-exctra.ads)
17550 @section @code{Ada.Exceptions.Traceback} (@file{a-exctra.ads})
17551 @cindex @code{Ada.Exceptions.Traceback} (@file{a-exctra.ads})
17552 @cindex Traceback for Exception Occurrence
17554 @noindent
17555 This child package provides the subprogram (@code{Tracebacks}) to
17556 give a traceback array of addresses based on an exception
17557 occurrence.
17559 @node Ada.Sequential_IO.C_Streams (a-siocst.ads)
17560 @section @code{Ada.Sequential_IO.C_Streams} (@file{a-siocst.ads})
17561 @cindex @code{Ada.Sequential_IO.C_Streams} (@file{a-siocst.ads})
17562 @cindex C Streams, Interfacing with Sequential_IO
17564 @noindent
17565 This package provides subprograms that allow interfacing between
17566 C streams and @code{Sequential_IO}.  The stream identifier can be
17567 extracted from a file opened on the Ada side, and an Ada file
17568 can be constructed from a stream opened on the C side.
17570 @node Ada.Streams.Stream_IO.C_Streams (a-ssicst.ads)
17571 @section @code{Ada.Streams.Stream_IO.C_Streams} (@file{a-ssicst.ads})
17572 @cindex @code{Ada.Streams.Stream_IO.C_Streams} (@file{a-ssicst.ads})
17573 @cindex C Streams, Interfacing with Stream_IO
17575 @noindent
17576 This package provides subprograms that allow interfacing between
17577 C streams and @code{Stream_IO}.  The stream identifier can be
17578 extracted from a file opened on the Ada side, and an Ada file
17579 can be constructed from a stream opened on the C side.
17581 @node Ada.Strings.Unbounded.Text_IO (a-suteio.ads)
17582 @section @code{Ada.Strings.Unbounded.Text_IO} (@file{a-suteio.ads})
17583 @cindex @code{Ada.Strings.Unbounded.Text_IO} (@file{a-suteio.ads})
17584 @cindex @code{Unbounded_String}, IO support
17585 @cindex @code{Text_IO}, extensions for unbounded strings
17587 @noindent
17588 This package provides subprograms for Text_IO for unbounded
17589 strings, avoiding the necessity for an intermediate operation
17590 with ordinary strings.
17592 @node Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads)
17593 @section @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@file{a-swuwti.ads})
17594 @cindex @code{Ada.Strings.Wide_Unbounded.Wide_Text_IO} (@file{a-swuwti.ads})
17595 @cindex @code{Unbounded_Wide_String}, IO support
17596 @cindex @code{Text_IO}, extensions for unbounded wide strings
17598 @noindent
17599 This package provides subprograms for Text_IO for unbounded
17600 wide strings, avoiding the necessity for an intermediate operation
17601 with ordinary wide strings.
17603 @node Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads)
17604 @section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@file{a-szuzti.ads})
17605 @cindex @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@file{a-szuzti.ads})
17606 @cindex @code{Unbounded_Wide_Wide_String}, IO support
17607 @cindex @code{Text_IO}, extensions for unbounded wide wide strings
17609 @noindent
17610 This package provides subprograms for Text_IO for unbounded
17611 wide wide strings, avoiding the necessity for an intermediate operation
17612 with ordinary wide wide strings.
17614 @node Ada.Text_IO.C_Streams (a-tiocst.ads)
17615 @section @code{Ada.Text_IO.C_Streams} (@file{a-tiocst.ads})
17616 @cindex @code{Ada.Text_IO.C_Streams} (@file{a-tiocst.ads})
17617 @cindex C Streams, Interfacing with @code{Text_IO}
17619 @noindent
17620 This package provides subprograms that allow interfacing between
17621 C streams and @code{Text_IO}.  The stream identifier can be
17622 extracted from a file opened on the Ada side, and an Ada file
17623 can be constructed from a stream opened on the C side.
17625 @node Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads)
17626 @section @code{Ada.Text_IO.Reset_Standard_Files} (@file{a-tirsfi.ads})
17627 @cindex @code{Ada.Text_IO.Reset_Standard_Files} (@file{a-tirsfi.ads})
17628 @cindex @code{Text_IO} resetting standard files
17630 @noindent
17631 This procedure is used to reset the status of the standard files used
17632 by Ada.Text_IO.  This is useful in a situation (such as a restart in an
17633 embedded application) where the status of the files may change during
17634 execution (for example a standard input file may be redefined to be
17635 interactive).
17637 @node Ada.Wide_Characters.Unicode (a-wichun.ads)
17638 @section @code{Ada.Wide_Characters.Unicode} (@file{a-wichun.ads})
17639 @cindex @code{Ada.Wide_Characters.Unicode} (@file{a-wichun.ads})
17640 @cindex Unicode categorization, Wide_Character
17642 @noindent
17643 This package provides subprograms that allow categorization of
17644 Wide_Character values according to Unicode categories.
17646 @node Ada.Wide_Text_IO.C_Streams (a-wtcstr.ads)
17647 @section @code{Ada.Wide_Text_IO.C_Streams} (@file{a-wtcstr.ads})
17648 @cindex @code{Ada.Wide_Text_IO.C_Streams} (@file{a-wtcstr.ads})
17649 @cindex C Streams, Interfacing with @code{Wide_Text_IO}
17651 @noindent
17652 This package provides subprograms that allow interfacing between
17653 C streams and @code{Wide_Text_IO}.  The stream identifier can be
17654 extracted from a file opened on the Ada side, and an Ada file
17655 can be constructed from a stream opened on the C side.
17657 @node Ada.Wide_Text_IO.Reset_Standard_Files (a-wrstfi.ads)
17658 @section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@file{a-wrstfi.ads})
17659 @cindex @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@file{a-wrstfi.ads})
17660 @cindex @code{Wide_Text_IO} resetting standard files
17662 @noindent
17663 This procedure is used to reset the status of the standard files used
17664 by Ada.Wide_Text_IO.  This is useful in a situation (such as a restart in an
17665 embedded application) where the status of the files may change during
17666 execution (for example a standard input file may be redefined to be
17667 interactive).
17669 @node Ada.Wide_Wide_Characters.Unicode (a-zchuni.ads)
17670 @section @code{Ada.Wide_Wide_Characters.Unicode} (@file{a-zchuni.ads})
17671 @cindex @code{Ada.Wide_Wide_Characters.Unicode} (@file{a-zchuni.ads})
17672 @cindex Unicode categorization, Wide_Wide_Character
17674 @noindent
17675 This package provides subprograms that allow categorization of
17676 Wide_Wide_Character values according to Unicode categories.
17678 @node Ada.Wide_Wide_Text_IO.C_Streams (a-ztcstr.ads)
17679 @section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@file{a-ztcstr.ads})
17680 @cindex @code{Ada.Wide_Wide_Text_IO.C_Streams} (@file{a-ztcstr.ads})
17681 @cindex C Streams, Interfacing with @code{Wide_Wide_Text_IO}
17683 @noindent
17684 This package provides subprograms that allow interfacing between
17685 C streams and @code{Wide_Wide_Text_IO}.  The stream identifier can be
17686 extracted from a file opened on the Ada side, and an Ada file
17687 can be constructed from a stream opened on the C side.
17689 @node Ada.Wide_Wide_Text_IO.Reset_Standard_Files (a-zrstfi.ads)
17690 @section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@file{a-zrstfi.ads})
17691 @cindex @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@file{a-zrstfi.ads})
17692 @cindex @code{Wide_Wide_Text_IO} resetting standard files
17694 @noindent
17695 This procedure is used to reset the status of the standard files used
17696 by Ada.Wide_Wide_Text_IO. This is useful in a situation (such as a
17697 restart in an embedded application) where the status of the files may
17698 change during execution (for example a standard input file may be
17699 redefined to be interactive).
17701 @node GNAT.Altivec (g-altive.ads)
17702 @section @code{GNAT.Altivec} (@file{g-altive.ads})
17703 @cindex @code{GNAT.Altivec} (@file{g-altive.ads})
17704 @cindex AltiVec
17706 @noindent
17707 This is the root package of the GNAT AltiVec binding. It provides
17708 definitions of constants and types common to all the versions of the
17709 binding.
17711 @node GNAT.Altivec.Conversions (g-altcon.ads)
17712 @section @code{GNAT.Altivec.Conversions} (@file{g-altcon.ads})
17713 @cindex @code{GNAT.Altivec.Conversions} (@file{g-altcon.ads})
17714 @cindex AltiVec
17716 @noindent
17717 This package provides the Vector/View conversion routines.
17719 @node GNAT.Altivec.Vector_Operations (g-alveop.ads)
17720 @section @code{GNAT.Altivec.Vector_Operations} (@file{g-alveop.ads})
17721 @cindex @code{GNAT.Altivec.Vector_Operations} (@file{g-alveop.ads})
17722 @cindex AltiVec
17724 @noindent
17725 This package exposes the Ada interface to the AltiVec operations on
17726 vector objects. A soft emulation is included by default in the GNAT
17727 library. The hard binding is provided as a separate package. This unit
17728 is common to both bindings.
17730 @node GNAT.Altivec.Vector_Types (g-alvety.ads)
17731 @section @code{GNAT.Altivec.Vector_Types} (@file{g-alvety.ads})
17732 @cindex @code{GNAT.Altivec.Vector_Types} (@file{g-alvety.ads})
17733 @cindex AltiVec
17735 @noindent
17736 This package exposes the various vector types part of the Ada binding
17737 to AltiVec facilities.
17739 @node GNAT.Altivec.Vector_Views (g-alvevi.ads)
17740 @section @code{GNAT.Altivec.Vector_Views} (@file{g-alvevi.ads})
17741 @cindex @code{GNAT.Altivec.Vector_Views} (@file{g-alvevi.ads})
17742 @cindex AltiVec
17744 @noindent
17745 This package provides public 'View' data types from/to which private
17746 vector representations can be converted via
17747 GNAT.Altivec.Conversions. This allows convenient access to individual
17748 vector elements and provides a simple way to initialize vector
17749 objects.
17751 @node GNAT.Array_Split (g-arrspl.ads)
17752 @section @code{GNAT.Array_Split} (@file{g-arrspl.ads})
17753 @cindex @code{GNAT.Array_Split} (@file{g-arrspl.ads})
17754 @cindex Array splitter
17756 @noindent
17757 Useful array-manipulation routines: given a set of separators, split
17758 an array wherever the separators appear, and provide direct access
17759 to the resulting slices.
17761 @node GNAT.AWK (g-awk.ads)
17762 @section @code{GNAT.AWK} (@file{g-awk.ads})
17763 @cindex @code{GNAT.AWK} (@file{g-awk.ads})
17764 @cindex Parsing
17765 @cindex AWK
17767 @noindent
17768 Provides AWK-like parsing functions, with an easy interface for parsing one
17769 or more files containing formatted data.  The file is viewed as a database
17770 where each record is a line and a field is a data element in this line.
17772 @node GNAT.Bounded_Buffers (g-boubuf.ads)
17773 @section @code{GNAT.Bounded_Buffers} (@file{g-boubuf.ads})
17774 @cindex @code{GNAT.Bounded_Buffers} (@file{g-boubuf.ads})
17775 @cindex Parsing
17776 @cindex Bounded Buffers
17778 @noindent
17779 Provides a concurrent generic bounded buffer abstraction.  Instances are
17780 useful directly or as parts of the implementations of other abstractions,
17781 such as mailboxes.
17783 @node GNAT.Bounded_Mailboxes (g-boumai.ads)
17784 @section @code{GNAT.Bounded_Mailboxes} (@file{g-boumai.ads})
17785 @cindex @code{GNAT.Bounded_Mailboxes} (@file{g-boumai.ads})
17786 @cindex Parsing
17787 @cindex Mailboxes
17789 @noindent
17790 Provides a thread-safe asynchronous intertask mailbox communication facility.
17792 @node GNAT.Bubble_Sort (g-bubsor.ads)
17793 @section @code{GNAT.Bubble_Sort} (@file{g-bubsor.ads})
17794 @cindex @code{GNAT.Bubble_Sort} (@file{g-bubsor.ads})
17795 @cindex Sorting
17796 @cindex Bubble sort
17798 @noindent
17799 Provides a general implementation of bubble sort usable for sorting arbitrary
17800 data items.  Exchange and comparison procedures are provided by passing
17801 access-to-procedure values.
17803 @node GNAT.Bubble_Sort_A (g-busora.ads)
17804 @section @code{GNAT.Bubble_Sort_A} (@file{g-busora.ads})
17805 @cindex @code{GNAT.Bubble_Sort_A} (@file{g-busora.ads})
17806 @cindex Sorting
17807 @cindex Bubble sort
17809 @noindent
17810 Provides a general implementation of bubble sort usable for sorting arbitrary
17811 data items.  Move and comparison procedures are provided by passing
17812 access-to-procedure values. This is an older version, retained for
17813 compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
17815 @node GNAT.Bubble_Sort_G (g-busorg.ads)
17816 @section @code{GNAT.Bubble_Sort_G} (@file{g-busorg.ads})
17817 @cindex @code{GNAT.Bubble_Sort_G} (@file{g-busorg.ads})
17818 @cindex Sorting
17819 @cindex Bubble sort
17821 @noindent
17822 Similar to @code{Bubble_Sort_A} except that the move and sorting procedures
17823 are provided as generic parameters, this improves efficiency, especially
17824 if the procedures can be inlined, at the expense of duplicating code for
17825 multiple instantiations.
17827 @node GNAT.Byte_Order_Mark (g-byorma.ads)
17828 @section @code{GNAT.Byte_Order_Mark} (@file{g-byorma.ads})
17829 @cindex @code{GNAT.Byte_Order_Mark} (@file{g-byorma.ads})
17830 @cindex UTF-8 representation
17831 @cindex Wide characte representations
17833 @noindent
17834 Provides a routine which given a string, reads the start of the string to
17835 see whether it is one of the standard byte order marks (BOM's) which signal
17836 the encoding of the string. The routine includes detection of special XML
17837 sequences for various UCS input formats.
17839 @node GNAT.Byte_Swapping (g-bytswa.ads)
17840 @section @code{GNAT.Byte_Swapping} (@file{g-bytswa.ads})
17841 @cindex @code{GNAT.Byte_Swapping} (@file{g-bytswa.ads})
17842 @cindex Byte swapping
17843 @cindex Endianness
17845 @noindent
17846 General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
17847 Machine-specific implementations are available in some cases.
17849 @node GNAT.Calendar (g-calend.ads)
17850 @section @code{GNAT.Calendar} (@file{g-calend.ads})
17851 @cindex @code{GNAT.Calendar} (@file{g-calend.ads})
17852 @cindex @code{Calendar}
17854 @noindent
17855 Extends the facilities provided by @code{Ada.Calendar} to include handling
17856 of days of the week, an extended @code{Split} and @code{Time_Of} capability.
17857 Also provides conversion of @code{Ada.Calendar.Time} values to and from the
17858 C @code{timeval} format.
17860 @node GNAT.Calendar.Time_IO (g-catiio.ads)
17861 @section @code{GNAT.Calendar.Time_IO} (@file{g-catiio.ads})
17862 @cindex @code{Calendar}
17863 @cindex Time
17864 @cindex @code{GNAT.Calendar.Time_IO} (@file{g-catiio.ads})
17866 @node GNAT.CRC32 (g-crc32.ads)
17867 @section @code{GNAT.CRC32} (@file{g-crc32.ads})
17868 @cindex @code{GNAT.CRC32} (@file{g-crc32.ads})
17869 @cindex CRC32
17870 @cindex Cyclic Redundancy Check
17872 @noindent
17873 This package implements the CRC-32 algorithm.  For a full description
17874 of this algorithm see
17875 ``Computation of Cyclic Redundancy Checks via Table Look-Up'',
17876 @cite{Communications of the ACM}, Vol.@: 31 No.@: 8, pp.@: 1008-1013,
17877 Aug.@: 1988.  Sarwate, D.V@.
17879 @node GNAT.Case_Util (g-casuti.ads)
17880 @section @code{GNAT.Case_Util} (@file{g-casuti.ads})
17881 @cindex @code{GNAT.Case_Util} (@file{g-casuti.ads})
17882 @cindex Casing utilities
17883 @cindex Character handling (@code{GNAT.Case_Util})
17885 @noindent
17886 A set of simple routines for handling upper and lower casing of strings
17887 without the overhead of the full casing tables
17888 in @code{Ada.Characters.Handling}.
17890 @node GNAT.CGI (g-cgi.ads)
17891 @section @code{GNAT.CGI} (@file{g-cgi.ads})
17892 @cindex @code{GNAT.CGI} (@file{g-cgi.ads})
17893 @cindex CGI (Common Gateway Interface)
17895 @noindent
17896 This is a package for interfacing a GNAT program with a Web server via the
17897 Common Gateway Interface (CGI)@.  Basically this package parses the CGI
17898 parameters, which are a set of key/value pairs sent by the Web server.  It
17899 builds a table whose index is the key and provides some services to deal
17900 with this table.
17902 @node GNAT.CGI.Cookie (g-cgicoo.ads)
17903 @section @code{GNAT.CGI.Cookie} (@file{g-cgicoo.ads})
17904 @cindex @code{GNAT.CGI.Cookie} (@file{g-cgicoo.ads})
17905 @cindex CGI (Common Gateway Interface) cookie support
17906 @cindex Cookie support in CGI
17908 @noindent
17909 This is a package to interface a GNAT program with a Web server via the
17910 Common Gateway Interface (CGI).  It exports services to deal with Web
17911 cookies (piece of information kept in the Web client software).
17913 @node GNAT.CGI.Debug (g-cgideb.ads)
17914 @section @code{GNAT.CGI.Debug} (@file{g-cgideb.ads})
17915 @cindex @code{GNAT.CGI.Debug} (@file{g-cgideb.ads})
17916 @cindex CGI (Common Gateway Interface) debugging
17918 @noindent
17919 This is a package to help debugging CGI (Common Gateway Interface)
17920 programs written in Ada.
17922 @node GNAT.Command_Line (g-comlin.ads)
17923 @section @code{GNAT.Command_Line} (@file{g-comlin.ads})
17924 @cindex @code{GNAT.Command_Line} (@file{g-comlin.ads})
17925 @cindex Command line
17927 @noindent
17928 Provides a high level interface to @code{Ada.Command_Line} facilities,
17929 including the ability to scan for named switches with optional parameters
17930 and expand file names using wild card notations.
17932 @node GNAT.Compiler_Version (g-comver.ads)
17933 @section @code{GNAT.Compiler_Version} (@file{g-comver.ads})
17934 @cindex @code{GNAT.Compiler_Version} (@file{g-comver.ads})
17935 @cindex Compiler Version
17936 @cindex Version, of compiler
17938 @noindent
17939 Provides a routine for obtaining the version of the compiler used to
17940 compile the program. More accurately this is the version of the binder
17941 used to bind the program (this will normally be the same as the version
17942 of the compiler if a consistent tool set is used to compile all units
17943 of a partition).
17945 @node GNAT.Ctrl_C (g-ctrl_c.ads)
17946 @section @code{GNAT.Ctrl_C} (@file{g-ctrl_c.ads})
17947 @cindex @code{GNAT.Ctrl_C} (@file{g-ctrl_c.ads})
17948 @cindex Interrupt
17950 @noindent
17951 Provides a simple interface to handle Ctrl-C keyboard events.
17953 @node GNAT.Current_Exception (g-curexc.ads)
17954 @section @code{GNAT.Current_Exception} (@file{g-curexc.ads})
17955 @cindex @code{GNAT.Current_Exception} (@file{g-curexc.ads})
17956 @cindex Current exception
17957 @cindex Exception retrieval
17959 @noindent
17960 Provides access to information on the current exception that has been raised
17961 without the need for using the Ada 95 / Ada 2005 exception choice parameter
17962 specification syntax.
17963 This is particularly useful in simulating typical facilities for
17964 obtaining information about exceptions provided by Ada 83 compilers.
17966 @node GNAT.Debug_Pools (g-debpoo.ads)
17967 @section @code{GNAT.Debug_Pools} (@file{g-debpoo.ads})
17968 @cindex @code{GNAT.Debug_Pools} (@file{g-debpoo.ads})
17969 @cindex Debugging
17970 @cindex Debug pools
17971 @cindex Memory corruption debugging
17973 @noindent
17974 Provide a debugging storage pools that helps tracking memory corruption
17975 problems.  @xref{The GNAT Debug Pool Facility,,, gnat_ugn,
17976 @value{EDITION} User's Guide}.
17978 @node GNAT.Debug_Utilities (g-debuti.ads)
17979 @section @code{GNAT.Debug_Utilities} (@file{g-debuti.ads})
17980 @cindex @code{GNAT.Debug_Utilities} (@file{g-debuti.ads})
17981 @cindex Debugging
17983 @noindent
17984 Provides a few useful utilities for debugging purposes, including conversion
17985 to and from string images of address values. Supports both C and Ada formats
17986 for hexadecimal literals.
17988 @node GNAT.Decode_String (g-decstr.ads)
17989 @section @code{GNAT.Decode_String} (@file{g-decstr.ads})
17990 @cindex @code{GNAT.Decode_String} (@file{g-decstr.ads})
17991 @cindex Decoding strings
17992 @cindex String decoding
17993 @cindex Wide character encoding
17994 @cindex UTF-8
17995 @cindex Unicode
17997 @noindent
17998 A generic package providing routines for decoding wide character and wide wide
17999 character strings encoded as sequences of 8-bit characters using a specified
18000 encoding method. Includes validation routines, and also routines for stepping
18001 to next or previous encoded character in an encoded string.
18002 Useful in conjunction with Unicode character coding. Note there is a
18003 preinstantiation for UTF-8. See next entry.
18005 @node GNAT.Decode_UTF8_String (g-deutst.ads)
18006 @section @code{GNAT.Decode_UTF8_String} (@file{g-deutst.ads})
18007 @cindex @code{GNAT.Decode_UTF8_String} (@file{g-deutst.ads})
18008 @cindex Decoding strings
18009 @cindex Decoding UTF-8 strings
18010 @cindex UTF-8 string decoding
18011 @cindex Wide character decoding
18012 @cindex UTF-8
18013 @cindex Unicode
18015 @noindent
18016 A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
18018 @node GNAT.Directory_Operations (g-dirope.ads)
18019 @section @code{GNAT.Directory_Operations} (@file{g-dirope.ads})
18020 @cindex @code{GNAT.Directory_Operations} (@file{g-dirope.ads})
18021 @cindex Directory operations
18023 @noindent
18024 Provides a set of routines for manipulating directories, including changing
18025 the current directory, making new directories, and scanning the files in a
18026 directory.
18028 @node GNAT.Directory_Operations.Iteration (g-diopit.ads)
18029 @section @code{GNAT.Directory_Operations.Iteration} (@file{g-diopit.ads})
18030 @cindex @code{GNAT.Directory_Operations.Iteration} (@file{g-diopit.ads})
18031 @cindex Directory operations iteration
18033 @noindent
18034 A child unit of GNAT.Directory_Operations providing additional operations
18035 for iterating through directories.
18037 @node GNAT.Dynamic_HTables (g-dynhta.ads)
18038 @section @code{GNAT.Dynamic_HTables} (@file{g-dynhta.ads})
18039 @cindex @code{GNAT.Dynamic_HTables} (@file{g-dynhta.ads})
18040 @cindex Hash tables
18042 @noindent
18043 A generic implementation of hash tables that can be used to hash arbitrary
18044 data.  Provided in two forms, a simple form with built in hash functions,
18045 and a more complex form in which the hash function is supplied.
18047 @noindent
18048 This package provides a facility similar to that of @code{GNAT.HTable},
18049 except that this package declares a type that can be used to define
18050 dynamic instances of the hash table, while an instantiation of
18051 @code{GNAT.HTable} creates a single instance of the hash table.
18053 @node GNAT.Dynamic_Tables (g-dyntab.ads)
18054 @section @code{GNAT.Dynamic_Tables} (@file{g-dyntab.ads})
18055 @cindex @code{GNAT.Dynamic_Tables} (@file{g-dyntab.ads})
18056 @cindex Table implementation
18057 @cindex Arrays, extendable
18059 @noindent
18060 A generic package providing a single dimension array abstraction where the
18061 length of the array can be dynamically modified.
18063 @noindent
18064 This package provides a facility similar to that of @code{GNAT.Table},
18065 except that this package declares a type that can be used to define
18066 dynamic instances of the table, while an instantiation of
18067 @code{GNAT.Table} creates a single instance of the table type.
18069 @node GNAT.Encode_String (g-encstr.ads)
18070 @section @code{GNAT.Encode_String} (@file{g-encstr.ads})
18071 @cindex @code{GNAT.Encode_String} (@file{g-encstr.ads})
18072 @cindex Encoding strings
18073 @cindex String encoding
18074 @cindex Wide character encoding
18075 @cindex UTF-8
18076 @cindex Unicode
18078 @noindent
18079 A generic package providing routines for encoding wide character and wide
18080 wide character strings as sequences of 8-bit characters using a specified
18081 encoding method. Useful in conjunction with Unicode character coding.
18082 Note there is a preinstantiation for UTF-8. See next entry.
18084 @node GNAT.Encode_UTF8_String (g-enutst.ads)
18085 @section @code{GNAT.Encode_UTF8_String} (@file{g-enutst.ads})
18086 @cindex @code{GNAT.Encode_UTF8_String} (@file{g-enutst.ads})
18087 @cindex Encoding strings
18088 @cindex Encoding UTF-8 strings
18089 @cindex UTF-8 string encoding
18090 @cindex Wide character encoding
18091 @cindex UTF-8
18092 @cindex Unicode
18094 @noindent
18095 A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
18097 @node GNAT.Exception_Actions (g-excact.ads)
18098 @section @code{GNAT.Exception_Actions} (@file{g-excact.ads})
18099 @cindex @code{GNAT.Exception_Actions} (@file{g-excact.ads})
18100 @cindex Exception actions
18102 @noindent
18103 Provides callbacks when an exception is raised. Callbacks can be registered
18104 for specific exceptions, or when any exception is raised. This
18105 can be used for instance to force a core dump to ease debugging.
18107 @node GNAT.Exception_Traces (g-exctra.ads)
18108 @section @code{GNAT.Exception_Traces} (@file{g-exctra.ads})
18109 @cindex @code{GNAT.Exception_Traces} (@file{g-exctra.ads})
18110 @cindex Exception traces
18111 @cindex Debugging
18113 @noindent
18114 Provides an interface allowing to control automatic output upon exception
18115 occurrences.
18117 @node GNAT.Exceptions (g-except.ads)
18118 @section @code{GNAT.Exceptions} (@file{g-expect.ads})
18119 @cindex @code{GNAT.Exceptions} (@file{g-expect.ads})
18120 @cindex Exceptions, Pure
18121 @cindex Pure packages, exceptions
18123 @noindent
18124 Normally it is not possible to raise an exception with
18125 a message from a subprogram in a pure package, since the
18126 necessary types and subprograms are in @code{Ada.Exceptions}
18127 which is not a pure unit. @code{GNAT.Exceptions} provides a
18128 facility for getting around this limitation for a few
18129 predefined exceptions, and for example allow raising
18130 @code{Constraint_Error} with a message from a pure subprogram.
18132 @node GNAT.Expect (g-expect.ads)
18133 @section @code{GNAT.Expect} (@file{g-expect.ads})
18134 @cindex @code{GNAT.Expect} (@file{g-expect.ads})
18136 @noindent
18137 Provides a set of subprograms similar to what is available
18138 with the standard Tcl Expect tool.
18139 It allows you to easily spawn and communicate with an external process.
18140 You can send commands or inputs to the process, and compare the output
18141 with some expected regular expression. Currently @code{GNAT.Expect}
18142 is implemented on all native GNAT ports except for OpenVMS@.
18143 It is not implemented for cross ports, and in particular is not
18144 implemented for VxWorks or LynxOS@.
18146 @node GNAT.Expect.TTY (g-exptty.ads)
18147 @section @code{GNAT.Expect.TTY} (@file{g-exptty.ads})
18148 @cindex @code{GNAT.Expect.TTY} (@file{g-exptty.ads})
18150 @noindent
18151 As GNAT.Expect but using pseudo-terminal.
18152 Currently @code{GNAT.Expect.TTY} is implemented on all native GNAT
18153 ports except for OpenVMS@. It is not implemented for cross ports, and
18154 in particular is not implemented for VxWorks or LynxOS@.
18156 @node GNAT.Float_Control (g-flocon.ads)
18157 @section @code{GNAT.Float_Control} (@file{g-flocon.ads})
18158 @cindex @code{GNAT.Float_Control} (@file{g-flocon.ads})
18159 @cindex Floating-Point Processor
18161 @noindent
18162 Provides an interface for resetting the floating-point processor into the
18163 mode required for correct semantic operation in Ada.  Some third party
18164 library calls may cause this mode to be modified, and the Reset procedure
18165 in this package can be used to reestablish the required mode.
18167 @node GNAT.Heap_Sort (g-heasor.ads)
18168 @section @code{GNAT.Heap_Sort} (@file{g-heasor.ads})
18169 @cindex @code{GNAT.Heap_Sort} (@file{g-heasor.ads})
18170 @cindex Sorting
18172 @noindent
18173 Provides a general implementation of heap sort usable for sorting arbitrary
18174 data items. Exchange and comparison procedures are provided by passing
18175 access-to-procedure values.  The algorithm used is a modified heap sort
18176 that performs approximately N*log(N) comparisons in the worst case.
18178 @node GNAT.Heap_Sort_A (g-hesora.ads)
18179 @section @code{GNAT.Heap_Sort_A} (@file{g-hesora.ads})
18180 @cindex @code{GNAT.Heap_Sort_A} (@file{g-hesora.ads})
18181 @cindex Sorting
18183 @noindent
18184 Provides a general implementation of heap sort usable for sorting arbitrary
18185 data items. Move and comparison procedures are provided by passing
18186 access-to-procedure values.  The algorithm used is a modified heap sort
18187 that performs approximately N*log(N) comparisons in the worst case.
18188 This differs from @code{GNAT.Heap_Sort} in having a less convenient
18189 interface, but may be slightly more efficient.
18191 @node GNAT.Heap_Sort_G (g-hesorg.ads)
18192 @section @code{GNAT.Heap_Sort_G} (@file{g-hesorg.ads})
18193 @cindex @code{GNAT.Heap_Sort_G} (@file{g-hesorg.ads})
18194 @cindex Sorting
18196 @noindent
18197 Similar to @code{Heap_Sort_A} except that the move and sorting procedures
18198 are provided as generic parameters, this improves efficiency, especially
18199 if the procedures can be inlined, at the expense of duplicating code for
18200 multiple instantiations.
18202 @node GNAT.HTable (g-htable.ads)
18203 @section @code{GNAT.HTable} (@file{g-htable.ads})
18204 @cindex @code{GNAT.HTable} (@file{g-htable.ads})
18205 @cindex Hash tables
18207 @noindent
18208 A generic implementation of hash tables that can be used to hash arbitrary
18209 data.  Provides two approaches, one a simple static approach, and the other
18210 allowing arbitrary dynamic hash tables.
18212 @node GNAT.IO (g-io.ads)
18213 @section @code{GNAT.IO} (@file{g-io.ads})
18214 @cindex @code{GNAT.IO} (@file{g-io.ads})
18215 @cindex Simple I/O
18216 @cindex Input/Output facilities
18218 @noindent
18219 A simple preelaborable input-output package that provides a subset of
18220 simple Text_IO functions for reading characters and strings from
18221 Standard_Input, and writing characters, strings and integers to either
18222 Standard_Output or Standard_Error.
18224 @node GNAT.IO_Aux (g-io_aux.ads)
18225 @section @code{GNAT.IO_Aux} (@file{g-io_aux.ads})
18226 @cindex @code{GNAT.IO_Aux} (@file{g-io_aux.ads})
18227 @cindex Text_IO
18228 @cindex Input/Output facilities
18230 Provides some auxiliary functions for use with Text_IO, including a test
18231 for whether a file exists, and functions for reading a line of text.
18233 @node GNAT.Lock_Files (g-locfil.ads)
18234 @section @code{GNAT.Lock_Files} (@file{g-locfil.ads})
18235 @cindex @code{GNAT.Lock_Files} (@file{g-locfil.ads})
18236 @cindex File locking
18237 @cindex Locking using files
18239 @noindent
18240 Provides a general interface for using files as locks.  Can be used for
18241 providing program level synchronization.
18243 @node GNAT.MBBS_Discrete_Random (g-mbdira.ads)
18244 @section @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads})
18245 @cindex @code{GNAT.MBBS_Discrete_Random} (@file{g-mbdira.ads})
18246 @cindex Random number generation
18248 @noindent
18249 The original implementation of @code{Ada.Numerics.Discrete_Random}.  Uses
18250 a modified version of the Blum-Blum-Shub generator.
18252 @node GNAT.MBBS_Float_Random (g-mbflra.ads)
18253 @section @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads})
18254 @cindex @code{GNAT.MBBS_Float_Random} (@file{g-mbflra.ads})
18255 @cindex Random number generation
18257 @noindent
18258 The original implementation of @code{Ada.Numerics.Float_Random}.  Uses
18259 a modified version of the Blum-Blum-Shub generator.
18261 @node GNAT.MD5 (g-md5.ads)
18262 @section @code{GNAT.MD5} (@file{g-md5.ads})
18263 @cindex @code{GNAT.MD5} (@file{g-md5.ads})
18264 @cindex Message Digest MD5
18266 @noindent
18267 Implements the MD5 Message-Digest Algorithm as described in RFC 1321.
18269 @node GNAT.Memory_Dump (g-memdum.ads)
18270 @section @code{GNAT.Memory_Dump} (@file{g-memdum.ads})
18271 @cindex @code{GNAT.Memory_Dump} (@file{g-memdum.ads})
18272 @cindex Dump Memory
18274 @noindent
18275 Provides a convenient routine for dumping raw memory to either the
18276 standard output or standard error files. Uses GNAT.IO for actual
18277 output.
18279 @node GNAT.Most_Recent_Exception (g-moreex.ads)
18280 @section @code{GNAT.Most_Recent_Exception} (@file{g-moreex.ads})
18281 @cindex @code{GNAT.Most_Recent_Exception} (@file{g-moreex.ads})
18282 @cindex Exception, obtaining most recent
18284 @noindent
18285 Provides access to the most recently raised exception.  Can be used for
18286 various logging purposes, including duplicating functionality of some
18287 Ada 83 implementation dependent extensions.
18289 @node GNAT.OS_Lib (g-os_lib.ads)
18290 @section @code{GNAT.OS_Lib} (@file{g-os_lib.ads})
18291 @cindex @code{GNAT.OS_Lib} (@file{g-os_lib.ads})
18292 @cindex Operating System interface
18293 @cindex Spawn capability
18295 @noindent
18296 Provides a range of target independent operating system interface functions,
18297 including time/date management, file operations, subprocess management,
18298 including a portable spawn procedure, and access to environment variables
18299 and error return codes.
18301 @node GNAT.Perfect_Hash_Generators (g-pehage.ads)
18302 @section @code{GNAT.Perfect_Hash_Generators} (@file{g-pehage.ads})
18303 @cindex @code{GNAT.Perfect_Hash_Generators} (@file{g-pehage.ads})
18304 @cindex Hash functions
18306 @noindent
18307 Provides a generator of static minimal perfect hash functions. No
18308 collisions occur and each item can be retrieved from the table in one
18309 probe (perfect property). The hash table size corresponds to the exact
18310 size of the key set and no larger (minimal property). The key set has to
18311 be know in advance (static property). The hash functions are also order
18312 preserving. If w2 is inserted after w1 in the generator, their
18313 hashcode are in the same order. These hashing functions are very
18314 convenient for use with realtime applications.
18316 @node GNAT.Random_Numbers (g-rannum.ads)
18317 @section @code{GNAT.Random_Numbers} (@file{g-rannum.ads})
18318 @cindex @code{GNAT.Random_Numbers} (@file{g-rannum.ads})
18319 @cindex Random number generation
18321 @noindent
18322 Provides random number capabilities which extend those available in the
18323 standard Ada library and are more convenient to use.
18325 @node GNAT.Regexp (g-regexp.ads)
18326 @section @code{GNAT.Regexp} (@file{g-regexp.ads})
18327 @cindex @code{GNAT.Regexp} (@file{g-regexp.ads})
18328 @cindex Regular expressions
18329 @cindex Pattern matching
18331 @noindent
18332 A simple implementation of regular expressions, using a subset of regular
18333 expression syntax copied from familiar Unix style utilities.  This is the
18334 simples of the three pattern matching packages provided, and is particularly
18335 suitable for ``file globbing'' applications.
18337 @node GNAT.Registry (g-regist.ads)
18338 @section @code{GNAT.Registry} (@file{g-regist.ads})
18339 @cindex @code{GNAT.Registry} (@file{g-regist.ads})
18340 @cindex Windows Registry
18342 @noindent
18343 This is a high level binding to the Windows registry.  It is possible to
18344 do simple things like reading a key value, creating a new key.  For full
18345 registry API, but at a lower level of abstraction, refer to the Win32.Winreg
18346 package provided with the Win32Ada binding
18348 @node GNAT.Regpat (g-regpat.ads)
18349 @section @code{GNAT.Regpat} (@file{g-regpat.ads})
18350 @cindex @code{GNAT.Regpat} (@file{g-regpat.ads})
18351 @cindex Regular expressions
18352 @cindex Pattern matching
18354 @noindent
18355 A complete implementation of Unix-style regular expression matching, copied
18356 from the original V7 style regular expression library written in C by
18357 Henry Spencer (and binary compatible with this C library).
18359 @node GNAT.Secondary_Stack_Info (g-sestin.ads)
18360 @section @code{GNAT.Secondary_Stack_Info} (@file{g-sestin.ads})
18361 @cindex @code{GNAT.Secondary_Stack_Info} (@file{g-sestin.ads})
18362 @cindex Secondary Stack Info
18364 @noindent
18365 Provide the capability to query the high water mark of the current task's
18366 secondary stack.
18368 @node GNAT.Semaphores (g-semaph.ads)
18369 @section @code{GNAT.Semaphores} (@file{g-semaph.ads})
18370 @cindex @code{GNAT.Semaphores} (@file{g-semaph.ads})
18371 @cindex Semaphores
18373 @noindent
18374 Provides classic counting and binary semaphores using protected types.
18376 @node GNAT.Serial_Communications (g-sercom.ads)
18377 @section @code{GNAT.Serial_Communications} (@file{g-sercom.ads})
18378 @cindex @code{GNAT.Serial_Communications} (@file{g-sercom.ads})
18379 @cindex Serial_Communications
18381 @noindent
18382 Provides a simple interface to send and receive data over a serial
18383 port. This is only supported on GNU/Linux and Windows.
18385 @node GNAT.SHA1 (g-sha1.ads)
18386 @section @code{GNAT.SHA1} (@file{g-sha1.ads})
18387 @cindex @code{GNAT.SHA1} (@file{g-sha1.ads})
18388 @cindex Secure Hash Algorithm SHA-1
18390 @noindent
18391 Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3
18392 and RFC 3174.
18394 @node GNAT.SHA224 (g-sha224.ads)
18395 @section @code{GNAT.SHA224} (@file{g-sha224.ads})
18396 @cindex @code{GNAT.SHA224} (@file{g-sha224.ads})
18397 @cindex Secure Hash Algorithm SHA-224
18399 @noindent
18400 Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3.
18402 @node GNAT.SHA256 (g-sha256.ads)
18403 @section @code{GNAT.SHA256} (@file{g-sha256.ads})
18404 @cindex @code{GNAT.SHA256} (@file{g-sha256.ads})
18405 @cindex Secure Hash Algorithm SHA-256
18407 @noindent
18408 Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3.
18410 @node GNAT.SHA384 (g-sha384.ads)
18411 @section @code{GNAT.SHA384} (@file{g-sha384.ads})
18412 @cindex @code{GNAT.SHA384} (@file{g-sha384.ads})
18413 @cindex Secure Hash Algorithm SHA-384
18415 @noindent
18416 Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3.
18418 @node GNAT.SHA512 (g-sha512.ads)
18419 @section @code{GNAT.SHA512} (@file{g-sha512.ads})
18420 @cindex @code{GNAT.SHA512} (@file{g-sha512.ads})
18421 @cindex Secure Hash Algorithm SHA-512
18423 @noindent
18424 Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3.
18426 @node GNAT.Signals (g-signal.ads)
18427 @section @code{GNAT.Signals} (@file{g-signal.ads})
18428 @cindex @code{GNAT.Signals} (@file{g-signal.ads})
18429 @cindex Signals
18431 @noindent
18432 Provides the ability to manipulate the blocked status of signals on supported
18433 targets.
18435 @node GNAT.Sockets (g-socket.ads)
18436 @section @code{GNAT.Sockets} (@file{g-socket.ads})
18437 @cindex @code{GNAT.Sockets} (@file{g-socket.ads})
18438 @cindex Sockets
18440 @noindent
18441 A high level and portable interface to develop sockets based applications.
18442 This package is based on the sockets thin binding found in
18443 @code{GNAT.Sockets.Thin}. Currently @code{GNAT.Sockets} is implemented
18444 on all native GNAT ports except for OpenVMS@.  It is not implemented
18445 for the LynxOS@ cross port.
18447 @node GNAT.Source_Info (g-souinf.ads)
18448 @section @code{GNAT.Source_Info} (@file{g-souinf.ads})
18449 @cindex @code{GNAT.Source_Info} (@file{g-souinf.ads})
18450 @cindex Source Information
18452 @noindent
18453 Provides subprograms that give access to source code information known at
18454 compile time, such as the current file name and line number.
18456 @node GNAT.Spelling_Checker (g-speche.ads)
18457 @section @code{GNAT.Spelling_Checker} (@file{g-speche.ads})
18458 @cindex @code{GNAT.Spelling_Checker} (@file{g-speche.ads})
18459 @cindex Spell checking
18461 @noindent
18462 Provides a function for determining whether one string is a plausible
18463 near misspelling of another string.
18465 @node GNAT.Spelling_Checker_Generic (g-spchge.ads)
18466 @section @code{GNAT.Spelling_Checker_Generic} (@file{g-spchge.ads})
18467 @cindex @code{GNAT.Spelling_Checker_Generic} (@file{g-spchge.ads})
18468 @cindex Spell checking
18470 @noindent
18471 Provides a generic function that can be instantiated with a string type for
18472 determining whether one string is a plausible near misspelling of another
18473 string.
18475 @node GNAT.Spitbol.Patterns (g-spipat.ads)
18476 @section @code{GNAT.Spitbol.Patterns} (@file{g-spipat.ads})
18477 @cindex @code{GNAT.Spitbol.Patterns} (@file{g-spipat.ads})
18478 @cindex SPITBOL pattern matching
18479 @cindex Pattern matching
18481 @noindent
18482 A complete implementation of SNOBOL4 style pattern matching.  This is the
18483 most elaborate of the pattern matching packages provided.  It fully duplicates
18484 the SNOBOL4 dynamic pattern construction and matching capabilities, using the
18485 efficient algorithm developed by Robert Dewar for the SPITBOL system.
18487 @node GNAT.Spitbol (g-spitbo.ads)
18488 @section @code{GNAT.Spitbol} (@file{g-spitbo.ads})
18489 @cindex @code{GNAT.Spitbol} (@file{g-spitbo.ads})
18490 @cindex SPITBOL interface
18492 @noindent
18493 The top level package of the collection of SPITBOL-style functionality, this
18494 package provides basic SNOBOL4 string manipulation functions, such as
18495 Pad, Reverse, Trim, Substr capability, as well as a generic table function
18496 useful for constructing arbitrary mappings from strings in the style of
18497 the SNOBOL4 TABLE function.
18499 @node GNAT.Spitbol.Table_Boolean (g-sptabo.ads)
18500 @section @code{GNAT.Spitbol.Table_Boolean} (@file{g-sptabo.ads})
18501 @cindex @code{GNAT.Spitbol.Table_Boolean} (@file{g-sptabo.ads})
18502 @cindex Sets of strings
18503 @cindex SPITBOL Tables
18505 @noindent
18506 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
18507 for type @code{Standard.Boolean}, giving an implementation of sets of
18508 string values.
18510 @node GNAT.Spitbol.Table_Integer (g-sptain.ads)
18511 @section @code{GNAT.Spitbol.Table_Integer} (@file{g-sptain.ads})
18512 @cindex @code{GNAT.Spitbol.Table_Integer} (@file{g-sptain.ads})
18513 @cindex Integer maps
18514 @cindex Maps
18515 @cindex SPITBOL Tables
18517 @noindent
18518 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table}
18519 for type @code{Standard.Integer}, giving an implementation of maps
18520 from string to integer values.
18522 @node GNAT.Spitbol.Table_VString (g-sptavs.ads)
18523 @section @code{GNAT.Spitbol.Table_VString} (@file{g-sptavs.ads})
18524 @cindex @code{GNAT.Spitbol.Table_VString} (@file{g-sptavs.ads})
18525 @cindex String maps
18526 @cindex Maps
18527 @cindex SPITBOL Tables
18529 @noindent
18530 A library level of instantiation of @code{GNAT.Spitbol.Patterns.Table} for
18531 a variable length string type, giving an implementation of general
18532 maps from strings to strings.
18534 @node GNAT.SSE (g-sse.ads)
18535 @section @code{GNAT.SSE} (@file{g-sse.ads})
18536 @cindex @code{GNAT.SSE} (@file{g-sse.ads})
18538 @noindent
18539 Root of a set of units aimed at offering Ada bindings to a subset of
18540 the Intel(r) Streaming SIMD Extensions with GNAT on the x86 family of
18541 targets.  It exposes vector component types together with a general
18542 introduction to the binding contents and use.
18544 @node GNAT.SSE.Vector_Types (g-ssvety.ads)
18545 @section @code{GNAT.SSE.Vector_Types} (@file{g-ssvety.ads})
18546 @cindex @code{GNAT.SSE.Vector_Types} (@file{g-ssvety.ads})
18548 @noindent
18549 SSE vector types for use with SSE related intrinsics.
18551 @node GNAT.Strings (g-string.ads)
18552 @section @code{GNAT.Strings} (@file{g-string.ads})
18553 @cindex @code{GNAT.Strings} (@file{g-string.ads})
18555 @noindent
18556 Common String access types and related subprograms. Basically it
18557 defines a string access and an array of string access types.
18559 @node GNAT.String_Split (g-strspl.ads)
18560 @section @code{GNAT.String_Split} (@file{g-strspl.ads})
18561 @cindex @code{GNAT.String_Split} (@file{g-strspl.ads})
18562 @cindex String splitter
18564 @noindent
18565 Useful string manipulation routines: given a set of separators, split
18566 a string wherever the separators appear, and provide direct access
18567 to the resulting slices. This package is instantiated from
18568 @code{GNAT.Array_Split}.
18570 @node GNAT.Table (g-table.ads)
18571 @section @code{GNAT.Table} (@file{g-table.ads})
18572 @cindex @code{GNAT.Table} (@file{g-table.ads})
18573 @cindex Table implementation
18574 @cindex Arrays, extendable
18576 @noindent
18577 A generic package providing a single dimension array abstraction where the
18578 length of the array can be dynamically modified.
18580 @noindent
18581 This package provides a facility similar to that of @code{GNAT.Dynamic_Tables},
18582 except that this package declares a single instance of the table type,
18583 while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
18584 used to define dynamic instances of the table.
18586 @node GNAT.Task_Lock (g-tasloc.ads)
18587 @section @code{GNAT.Task_Lock} (@file{g-tasloc.ads})
18588 @cindex @code{GNAT.Task_Lock} (@file{g-tasloc.ads})
18589 @cindex Task synchronization
18590 @cindex Task locking
18591 @cindex Locking
18593 @noindent
18594 A very simple facility for locking and unlocking sections of code using a
18595 single global task lock.  Appropriate for use in situations where contention
18596 between tasks is very rarely expected.
18598 @node GNAT.Time_Stamp (g-timsta.ads)
18599 @section @code{GNAT.Time_Stamp} (@file{g-timsta.ads})
18600 @cindex @code{GNAT.Time_Stamp} (@file{g-timsta.ads})
18601 @cindex Time stamp
18602 @cindex Current time
18604 @noindent
18605 Provides a simple function that returns a string YYYY-MM-DD HH:MM:SS.SS that
18606 represents the current date and time in ISO 8601 format. This is a very simple
18607 routine with minimal code and there are no dependencies on any other unit.
18609 @node GNAT.Threads (g-thread.ads)
18610 @section @code{GNAT.Threads} (@file{g-thread.ads})
18611 @cindex @code{GNAT.Threads} (@file{g-thread.ads})
18612 @cindex Foreign threads
18613 @cindex Threads, foreign
18615 @noindent
18616 Provides facilities for dealing with foreign threads which need to be known
18617 by the GNAT run-time system. Consult the documentation of this package for
18618 further details if your program has threads that are created by a non-Ada
18619 environment which then accesses Ada code.
18621 @node GNAT.Traceback (g-traceb.ads)
18622 @section @code{GNAT.Traceback} (@file{g-traceb.ads})
18623 @cindex @code{GNAT.Traceback} (@file{g-traceb.ads})
18624 @cindex Trace back facilities
18626 @noindent
18627 Provides a facility for obtaining non-symbolic traceback information, useful
18628 in various debugging situations.
18630 @node GNAT.Traceback.Symbolic (g-trasym.ads)
18631 @section @code{GNAT.Traceback.Symbolic} (@file{g-trasym.ads})
18632 @cindex @code{GNAT.Traceback.Symbolic} (@file{g-trasym.ads})
18633 @cindex Trace back facilities
18635 @node GNAT.UTF_32 (g-utf_32.ads)
18636 @section @code{GNAT.UTF_32} (@file{g-table.ads})
18637 @cindex @code{GNAT.UTF_32} (@file{g-table.ads})
18638 @cindex Wide character codes
18640 @noindent
18641 This is a package intended to be used in conjunction with the
18642 @code{Wide_Character} type in Ada 95 and the
18643 @code{Wide_Wide_Character} type in Ada 2005 (available
18644 in @code{GNAT} in Ada 2005 mode). This package contains
18645 Unicode categorization routines, as well as lexical
18646 categorization routines corresponding to the Ada 2005
18647 lexical rules for identifiers and strings, and also a
18648 lower case to upper case fold routine corresponding to
18649 the Ada 2005 rules for identifier equivalence.
18651 @node GNAT.UTF_32_Spelling_Checker (g-u3spch.ads)
18652 @section @code{GNAT.Wide_Spelling_Checker} (@file{g-u3spch.ads})
18653 @cindex @code{GNAT.Wide_Spelling_Checker} (@file{g-u3spch.ads})
18654 @cindex Spell checking
18656 @noindent
18657 Provides a function for determining whether one wide wide string is a plausible
18658 near misspelling of another wide wide string, where the strings are represented
18659 using the UTF_32_String type defined in System.Wch_Cnv.
18661 @node GNAT.Wide_Spelling_Checker (g-wispch.ads)
18662 @section @code{GNAT.Wide_Spelling_Checker} (@file{g-wispch.ads})
18663 @cindex @code{GNAT.Wide_Spelling_Checker} (@file{g-wispch.ads})
18664 @cindex Spell checking
18666 @noindent
18667 Provides a function for determining whether one wide string is a plausible
18668 near misspelling of another wide string.
18670 @node GNAT.Wide_String_Split (g-wistsp.ads)
18671 @section @code{GNAT.Wide_String_Split} (@file{g-wistsp.ads})
18672 @cindex @code{GNAT.Wide_String_Split} (@file{g-wistsp.ads})
18673 @cindex Wide_String splitter
18675 @noindent
18676 Useful wide string manipulation routines: given a set of separators, split
18677 a wide string wherever the separators appear, and provide direct access
18678 to the resulting slices. This package is instantiated from
18679 @code{GNAT.Array_Split}.
18681 @node GNAT.Wide_Wide_Spelling_Checker (g-zspche.ads)
18682 @section @code{GNAT.Wide_Wide_Spelling_Checker} (@file{g-zspche.ads})
18683 @cindex @code{GNAT.Wide_Wide_Spelling_Checker} (@file{g-zspche.ads})
18684 @cindex Spell checking
18686 @noindent
18687 Provides a function for determining whether one wide wide string is a plausible
18688 near misspelling of another wide wide string.
18690 @node GNAT.Wide_Wide_String_Split (g-zistsp.ads)
18691 @section @code{GNAT.Wide_Wide_String_Split} (@file{g-zistsp.ads})
18692 @cindex @code{GNAT.Wide_Wide_String_Split} (@file{g-zistsp.ads})
18693 @cindex Wide_Wide_String splitter
18695 @noindent
18696 Useful wide wide string manipulation routines: given a set of separators, split
18697 a wide wide string wherever the separators appear, and provide direct access
18698 to the resulting slices. This package is instantiated from
18699 @code{GNAT.Array_Split}.
18701 @node Interfaces.C.Extensions (i-cexten.ads)
18702 @section @code{Interfaces.C.Extensions} (@file{i-cexten.ads})
18703 @cindex @code{Interfaces.C.Extensions} (@file{i-cexten.ads})
18705 @noindent
18706 This package contains additional C-related definitions, intended
18707 for use with either manually or automatically generated bindings
18708 to C libraries.
18710 @node Interfaces.C.Streams (i-cstrea.ads)
18711 @section @code{Interfaces.C.Streams} (@file{i-cstrea.ads})
18712 @cindex @code{Interfaces.C.Streams} (@file{i-cstrea.ads})
18713 @cindex  C streams, interfacing
18715 @noindent
18716 This package is a binding for the most commonly used operations
18717 on C streams.
18719 @node Interfaces.CPP (i-cpp.ads)
18720 @section @code{Interfaces.CPP} (@file{i-cpp.ads})
18721 @cindex @code{Interfaces.CPP} (@file{i-cpp.ads})
18722 @cindex  C++ interfacing
18723 @cindex  Interfacing, to C++
18725 @noindent
18726 This package provides facilities for use in interfacing to C++.  It
18727 is primarily intended to be used in connection with automated tools
18728 for the generation of C++ interfaces.
18730 @node Interfaces.Packed_Decimal (i-pacdec.ads)
18731 @section @code{Interfaces.Packed_Decimal} (@file{i-pacdec.ads})
18732 @cindex @code{Interfaces.Packed_Decimal} (@file{i-pacdec.ads})
18733 @cindex  IBM Packed Format
18734 @cindex  Packed Decimal
18736 @noindent
18737 This package provides a set of routines for conversions to and
18738 from a packed decimal format compatible with that used on IBM
18739 mainframes.
18741 @node Interfaces.VxWorks (i-vxwork.ads)
18742 @section @code{Interfaces.VxWorks} (@file{i-vxwork.ads})
18743 @cindex @code{Interfaces.VxWorks} (@file{i-vxwork.ads})
18744 @cindex Interfacing to VxWorks
18745 @cindex VxWorks, interfacing
18747 @noindent
18748 This package provides a limited binding to the VxWorks API.
18749 In particular, it interfaces with the
18750 VxWorks hardware interrupt facilities.
18752 @node Interfaces.VxWorks.IO (i-vxwoio.ads)
18753 @section @code{Interfaces.VxWorks.IO} (@file{i-vxwoio.ads})
18754 @cindex @code{Interfaces.VxWorks.IO} (@file{i-vxwoio.ads})
18755 @cindex Interfacing to VxWorks' I/O
18756 @cindex VxWorks, I/O interfacing
18757 @cindex VxWorks, Get_Immediate
18758 @cindex Get_Immediate, VxWorks
18760 @noindent
18761 This package provides a binding to the ioctl (IO/Control)
18762 function of VxWorks, defining a set of option values and
18763 function codes. A particular use of this package is
18764 to enable the use of Get_Immediate under VxWorks.
18766 @node System.Address_Image (s-addima.ads)
18767 @section @code{System.Address_Image} (@file{s-addima.ads})
18768 @cindex @code{System.Address_Image} (@file{s-addima.ads})
18769 @cindex Address image
18770 @cindex Image, of an address
18772 @noindent
18773 This function provides a useful debugging
18774 function that gives an (implementation dependent)
18775 string which identifies an address.
18777 @node System.Assertions (s-assert.ads)
18778 @section @code{System.Assertions} (@file{s-assert.ads})
18779 @cindex @code{System.Assertions} (@file{s-assert.ads})
18780 @cindex Assertions
18781 @cindex Assert_Failure, exception
18783 @noindent
18784 This package provides the declaration of the exception raised
18785 by an run-time assertion failure, as well as the routine that
18786 is used internally to raise this assertion.
18788 @node System.Memory (s-memory.ads)
18789 @section @code{System.Memory} (@file{s-memory.ads})
18790 @cindex @code{System.Memory} (@file{s-memory.ads})
18791 @cindex Memory allocation
18793 @noindent
18794 This package provides the interface to the low level routines used
18795 by the generated code for allocation and freeing storage for the
18796 default storage pool (analogous to the C routines malloc and free.
18797 It also provides a reallocation interface analogous to the C routine
18798 realloc. The body of this unit may be modified to provide alternative
18799 allocation mechanisms for the default pool, and in addition, direct
18800 calls to this unit may be made for low level allocation uses (for
18801 example see the body of @code{GNAT.Tables}).
18803 @node System.Multiprocessors (s-multip.ads)
18804 @section @code{System.Multiprocessors} (@file{s-multip.ads})
18805 @cindex @code{System.Multiprocessors} (@file{s-multip.ads})
18806 @cindex Multiprocessor interface
18807 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
18808 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
18809 technically an implementation-defined addition).
18811 @node System.Multiprocessors.Dispatching_Domains (s-mudido.ads)
18812 @section @code{System.Multiprocessors.Dispatching_Domains} (@file{s-mudido.ads})
18813 @cindex @code{System.Multiprocessors.Dispatching_Domains} (@file{s-mudido.ads})
18814 @cindex Multiprocessor interface
18815 This is an Ada 2012 unit defined in the Ada 2012 Reference Manual, but
18816 in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
18817 technically an implementation-defined addition).
18819 @node System.Partition_Interface (s-parint.ads)
18820 @section @code{System.Partition_Interface} (@file{s-parint.ads})
18821 @cindex @code{System.Partition_Interface} (@file{s-parint.ads})
18822 @cindex Partition interfacing functions
18824 @noindent
18825 This package provides facilities for partition interfacing.  It
18826 is used primarily in a distribution context when using Annex E
18827 with @code{GLADE}.
18829 @node System.Pool_Global (s-pooglo.ads)
18830 @section @code{System.Pool_Global} (@file{s-pooglo.ads})
18831 @cindex @code{System.Pool_Global} (@file{s-pooglo.ads})
18832 @cindex Storage pool, global
18833 @cindex Global storage pool
18835 @noindent
18836 This package provides a storage pool that is equivalent to the default
18837 storage pool used for access types for which no pool is specifically
18838 declared. It uses malloc/free to allocate/free and does not attempt to
18839 do any automatic reclamation.
18841 @node System.Pool_Local (s-pooloc.ads)
18842 @section @code{System.Pool_Local} (@file{s-pooloc.ads})
18843 @cindex @code{System.Pool_Local} (@file{s-pooloc.ads})
18844 @cindex Storage pool, local
18845 @cindex Local storage pool
18847 @noindent
18848 This package provides a storage pool that is intended for use with locally
18849 defined access types. It uses malloc/free for allocate/free, and maintains
18850 a list of allocated blocks, so that all storage allocated for the pool can
18851 be freed automatically when the pool is finalized.
18853 @node System.Restrictions (s-restri.ads)
18854 @section @code{System.Restrictions} (@file{s-restri.ads})
18855 @cindex @code{System.Restrictions} (@file{s-restri.ads})
18856 @cindex Run-time restrictions access
18858 @noindent
18859 This package provides facilities for accessing at run time
18860 the status of restrictions specified at compile time for
18861 the partition. Information is available both with regard
18862 to actual restrictions specified, and with regard to
18863 compiler determined information on which restrictions
18864 are violated by one or more packages in the partition.
18866 @node System.Rident (s-rident.ads)
18867 @section @code{System.Rident} (@file{s-rident.ads})
18868 @cindex @code{System.Rident} (@file{s-rident.ads})
18869 @cindex Restrictions definitions
18871 @noindent
18872 This package provides definitions of the restrictions
18873 identifiers supported by GNAT, and also the format of
18874 the restrictions provided in package System.Restrictions.
18875 It is not normally necessary to @code{with} this generic package
18876 since the necessary instantiation is included in
18877 package System.Restrictions.
18879 @node System.Strings.Stream_Ops (s-ststop.ads)
18880 @section @code{System.Strings.Stream_Ops} (@file{s-ststop.ads})
18881 @cindex @code{System.Strings.Stream_Ops} (@file{s-ststop.ads})
18882 @cindex Stream operations
18883 @cindex String stream operations
18885 @noindent
18886 This package provides a set of stream subprograms for standard string types.
18887 It is intended primarily to support implicit use of such subprograms when
18888 stream attributes are applied to string types, but the subprograms in this
18889 package can be used directly by application programs.
18891 @node System.Task_Info (s-tasinf.ads)
18892 @section @code{System.Task_Info} (@file{s-tasinf.ads})
18893 @cindex @code{System.Task_Info} (@file{s-tasinf.ads})
18894 @cindex Task_Info pragma
18896 @noindent
18897 This package provides target dependent functionality that is used
18898 to support the @code{Task_Info} pragma
18900 @node System.Wch_Cnv (s-wchcnv.ads)
18901 @section @code{System.Wch_Cnv} (@file{s-wchcnv.ads})
18902 @cindex @code{System.Wch_Cnv} (@file{s-wchcnv.ads})
18903 @cindex Wide Character, Representation
18904 @cindex Wide String, Conversion
18905 @cindex Representation of wide characters
18907 @noindent
18908 This package provides routines for converting between
18909 wide and wide wide characters and a representation as a value of type
18910 @code{Standard.String}, using a specified wide character
18911 encoding method.  It uses definitions in
18912 package @code{System.Wch_Con}.
18914 @node System.Wch_Con (s-wchcon.ads)
18915 @section @code{System.Wch_Con} (@file{s-wchcon.ads})
18916 @cindex @code{System.Wch_Con} (@file{s-wchcon.ads})
18918 @noindent
18919 This package provides definitions and descriptions of
18920 the various methods used for encoding wide characters
18921 in ordinary strings.  These definitions are used by
18922 the package @code{System.Wch_Cnv}.
18924 @node Interfacing to Other Languages
18925 @chapter Interfacing to Other Languages
18926 @noindent
18927 The facilities in annex B of the Ada Reference Manual are fully
18928 implemented in GNAT, and in addition, a full interface to C++ is
18929 provided.
18931 @menu
18932 * Interfacing to C::
18933 * Interfacing to C++::
18934 * Interfacing to COBOL::
18935 * Interfacing to Fortran::
18936 * Interfacing to non-GNAT Ada code::
18937 @end menu
18939 @node Interfacing to C
18940 @section Interfacing to C
18942 @noindent
18943 Interfacing to C with GNAT can use one of two approaches:
18945 @itemize @bullet
18946 @item
18947 The types in the package @code{Interfaces.C} may be used.
18948 @item
18949 Standard Ada types may be used directly.  This may be less portable to
18950 other compilers, but will work on all GNAT compilers, which guarantee
18951 correspondence between the C and Ada types.
18952 @end itemize
18954 @noindent
18955 Pragma @code{Convention C} may be applied to Ada types, but mostly has no
18956 effect, since this is the default.  The following table shows the
18957 correspondence between Ada scalar types and the corresponding C types.
18959 @table @code
18960 @item Integer
18961 @code{int}
18962 @item Short_Integer
18963 @code{short}
18964 @item Short_Short_Integer
18965 @code{signed char}
18966 @item Long_Integer
18967 @code{long}
18968 @item Long_Long_Integer
18969 @code{long long}
18970 @item Short_Float
18971 @code{float}
18972 @item Float
18973 @code{float}
18974 @item Long_Float
18975 @code{double}
18976 @item Long_Long_Float
18977 This is the longest floating-point type supported by the hardware.
18978 @end table
18980 @noindent
18981 Additionally, there are the following general correspondences between Ada
18982 and C types:
18983 @itemize @bullet
18984 @item
18985 Ada enumeration types map to C enumeration types directly if pragma
18986 @code{Convention C} is specified, which causes them to have int
18987 length.  Without pragma @code{Convention C}, Ada enumeration types map to
18988 8, 16, or 32 bits (i.e.@: C types @code{signed char}, @code{short},
18989 @code{int}, respectively) depending on the number of values passed.
18990 This is the only case in which pragma @code{Convention C} affects the
18991 representation of an Ada type.
18993 @item
18994 Ada access types map to C pointers, except for the case of pointers to
18995 unconstrained types in Ada, which have no direct C equivalent.
18997 @item
18998 Ada arrays map directly to C arrays.
19000 @item
19001 Ada records map directly to C structures.
19003 @item
19004 Packed Ada records map to C structures where all members are bit fields
19005 of the length corresponding to the @code{@var{type}'Size} value in Ada.
19006 @end itemize
19008 @node Interfacing to C++
19009 @section Interfacing to C++
19011 @noindent
19012 The interface to C++ makes use of the following pragmas, which are
19013 primarily intended to be constructed automatically using a binding generator
19014 tool, although it is possible to construct them by hand.
19016 Using these pragmas it is possible to achieve complete
19017 inter-operability between Ada tagged types and C++ class definitions.
19018 See @ref{Implementation Defined Pragmas}, for more details.
19020 @table @code
19021 @item pragma CPP_Class ([Entity =>] @var{LOCAL_NAME})
19022 The argument denotes an entity in the current declarative region that is
19023 declared as a tagged or untagged record type. It indicates that the type
19024 corresponds to an externally declared C++ class type, and is to be laid
19025 out the same way that C++ would lay out the type.
19027 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
19028 for backward compatibility but its functionality is available
19029 using pragma @code{Import} with @code{Convention} = @code{CPP}.
19031 @item pragma CPP_Constructor ([Entity =>] @var{LOCAL_NAME})
19032 This pragma identifies an imported function (imported in the usual way
19033 with pragma @code{Import}) as corresponding to a C++ constructor.
19034 @end table
19036 A few restrictions are placed on the use of the @code{Access} attribute
19037 in conjunction with subprograms subject to convention @code{CPP}: the
19038 attribute may be used neither on primitive operations of a tagged
19039 record type with convention @code{CPP}, imported or not, nor on
19040 subprograms imported with pragma @code{CPP_Constructor}.
19042 In addition, C++ exceptions are propagated and can be handled in an
19043 @code{others} choice of an exception handler. The corresponding Ada
19044 occurrence has no message, and the simple name of the exception identity
19045 contains @samp{Foreign_Exception}. Finalization and awaiting dependent
19046 tasks works properly when such foreign exceptions are propagated.
19048 It is also possible to import a C++ exception using the following syntax:
19050 @smallexample @c ada
19051 LOCAL_NAME : exception;
19052 pragma Import (Cpp,
19053   [Entity =>] LOCAL_NAME,
19054   [External_Name =>] static_string_EXPRESSION);
19055 @end smallexample
19057 @noindent
19058 The @code{External_Name} is the name of the C++ RTTI symbol. You can then
19059 cover a specific C++ exception in an exception handler.
19061 @node Interfacing to COBOL
19062 @section Interfacing to COBOL
19064 @noindent
19065 Interfacing to COBOL is achieved as described in section B.4 of
19066 the Ada Reference Manual.
19068 @node Interfacing to Fortran
19069 @section Interfacing to Fortran
19071 @noindent
19072 Interfacing to Fortran is achieved as described in section B.5 of the
19073 Ada Reference Manual.  The pragma @code{Convention Fortran}, applied to a
19074 multi-dimensional array causes the array to be stored in column-major
19075 order as required for convenient interface to Fortran.
19077 @node Interfacing to non-GNAT Ada code
19078 @section Interfacing to non-GNAT Ada code
19080 It is possible to specify the convention @code{Ada} in a pragma
19081 @code{Import} or pragma @code{Export}.  However this refers to
19082 the calling conventions used by GNAT, which may or may not be
19083 similar enough to those used by some other Ada 83 / Ada 95 / Ada 2005
19084 compiler to allow interoperation.
19086 If arguments types are kept simple, and if the foreign compiler generally
19087 follows system calling conventions, then it may be possible to integrate
19088 files compiled by other Ada compilers, provided that the elaboration
19089 issues are adequately addressed (for example by eliminating the
19090 need for any load time elaboration).
19092 In particular, GNAT running on VMS is designed to
19093 be highly compatible with the DEC Ada 83 compiler, so this is one
19094 case in which it is possible to import foreign units of this type,
19095 provided that the data items passed are restricted to simple scalar
19096 values or simple record types without variants, or simple array
19097 types with fixed bounds.
19099 @node Specialized Needs Annexes
19100 @chapter Specialized Needs Annexes
19102 @noindent
19103 Ada 95 and Ada 2005 define a number of Specialized Needs Annexes, which are not
19104 required in all implementations.  However, as described in this chapter,
19105 GNAT implements all of these annexes:
19107 @table @asis
19108 @item Systems Programming (Annex C)
19109 The Systems Programming Annex is fully implemented.
19111 @item Real-Time Systems (Annex D)
19112 The Real-Time Systems Annex is fully implemented.
19114 @item Distributed Systems (Annex E)
19115 Stub generation is fully implemented in the GNAT compiler.  In addition,
19116 a complete compatible PCS is available as part of the GLADE system,
19117 a separate product.  When the two
19118 products are used in conjunction, this annex is fully implemented.
19120 @item Information Systems (Annex F)
19121 The Information Systems annex is fully implemented.
19123 @item Numerics (Annex G)
19124 The Numerics Annex is fully implemented.
19126 @item Safety and Security / High-Integrity Systems (Annex H)
19127 The Safety and Security Annex (termed the High-Integrity Systems Annex
19128 in Ada 2005) is fully implemented.
19129 @end table
19131 @node Implementation of Specific Ada Features
19132 @chapter Implementation of Specific Ada Features
19134 @noindent
19135 This chapter describes the GNAT implementation of several Ada language
19136 facilities.
19138 @menu
19139 * Machine Code Insertions::
19140 * GNAT Implementation of Tasking::
19141 * GNAT Implementation of Shared Passive Packages::
19142 * Code Generation for Array Aggregates::
19143 * The Size of Discriminated Records with Default Discriminants::
19144 * Strict Conformance to the Ada Reference Manual::
19145 @end menu
19147 @node Machine Code Insertions
19148 @section Machine Code Insertions
19149 @cindex Machine Code insertions
19151 @noindent
19152 Package @code{Machine_Code} provides machine code support as described
19153 in the Ada Reference Manual in two separate forms:
19154 @itemize @bullet
19155 @item
19156 Machine code statements, consisting of qualified expressions that
19157 fit the requirements of RM section 13.8.
19158 @item
19159 An intrinsic callable procedure, providing an alternative mechanism of
19160 including machine instructions in a subprogram.
19161 @end itemize
19163 @noindent
19164 The two features are similar, and both are closely related to the mechanism
19165 provided by the asm instruction in the GNU C compiler.  Full understanding
19166 and use of the facilities in this package requires understanding the asm
19167 instruction, see @ref{Extended Asm,, Assembler Instructions with C Expression
19168 Operands, gcc, Using the GNU Compiler Collection (GCC)}.
19170 Calls to the function @code{Asm} and the procedure @code{Asm} have identical
19171 semantic restrictions and effects as described below.  Both are provided so
19172 that the procedure call can be used as a statement, and the function call
19173 can be used to form a code_statement.
19175 The first example given in the GCC documentation is the C @code{asm}
19176 instruction:
19177 @smallexample
19178    asm ("fsinx %1 %0" : "=f" (result) : "f" (angle));
19179 @end smallexample
19181 @noindent
19182 The equivalent can be written for GNAT as:
19184 @smallexample @c ada
19185 Asm ("fsinx %1 %0",
19186      My_Float'Asm_Output ("=f", result),
19187      My_Float'Asm_Input  ("f",  angle));
19188 @end smallexample
19190 @noindent
19191 The first argument to @code{Asm} is the assembler template, and is
19192 identical to what is used in GNU C@.  This string must be a static
19193 expression.  The second argument is the output operand list.  It is
19194 either a single @code{Asm_Output} attribute reference, or a list of such
19195 references enclosed in parentheses (technically an array aggregate of
19196 such references).
19198 The @code{Asm_Output} attribute denotes a function that takes two
19199 parameters.  The first is a string, the second is the name of a variable
19200 of the type designated by the attribute prefix.  The first (string)
19201 argument is required to be a static expression and designates the
19202 constraint for the parameter (e.g.@: what kind of register is
19203 required).  The second argument is the variable to be updated with the
19204 result.  The possible values for constraint are the same as those used in
19205 the RTL, and are dependent on the configuration file used to build the
19206 GCC back end.  If there are no output operands, then this argument may
19207 either be omitted, or explicitly given as @code{No_Output_Operands}.
19209 The second argument of @code{@var{my_float}'Asm_Output} functions as
19210 though it were an @code{out} parameter, which is a little curious, but
19211 all names have the form of expressions, so there is no syntactic
19212 irregularity, even though normally functions would not be permitted
19213 @code{out} parameters.  The third argument is the list of input
19214 operands.  It is either a single @code{Asm_Input} attribute reference, or
19215 a list of such references enclosed in parentheses (technically an array
19216 aggregate of such references).
19218 The @code{Asm_Input} attribute denotes a function that takes two
19219 parameters.  The first is a string, the second is an expression of the
19220 type designated by the prefix.  The first (string) argument is required
19221 to be a static expression, and is the constraint for the parameter,
19222 (e.g.@: what kind of register is required).  The second argument is the
19223 value to be used as the input argument.  The possible values for the
19224 constant are the same as those used in the RTL, and are dependent on
19225 the configuration file used to built the GCC back end.
19227 If there are no input operands, this argument may either be omitted, or
19228 explicitly given as @code{No_Input_Operands}.  The fourth argument, not
19229 present in the above example, is a list of register names, called the
19230 @dfn{clobber} argument.  This argument, if given, must be a static string
19231 expression, and is a space or comma separated list of names of registers
19232 that must be considered destroyed as a result of the @code{Asm} call.  If
19233 this argument is the null string (the default value), then the code
19234 generator assumes that no additional registers are destroyed.
19236 The fifth argument, not present in the above example, called the
19237 @dfn{volatile} argument, is by default @code{False}.  It can be set to
19238 the literal value @code{True} to indicate to the code generator that all
19239 optimizations with respect to the instruction specified should be
19240 suppressed, and that in particular, for an instruction that has outputs,
19241 the instruction will still be generated, even if none of the outputs are
19242 used.  @xref{Extended Asm,, Assembler Instructions with C Expression Operands,
19243 gcc, Using the GNU Compiler Collection (GCC)}, for the full description.
19244 Generally it is strongly advisable to use Volatile for any ASM statement
19245 that is missing either input or output operands, or when two or more ASM
19246 statements appear in sequence, to avoid unwanted optimizations. A warning
19247 is generated if this advice is not followed.
19249 The @code{Asm} subprograms may be used in two ways.  First the procedure
19250 forms can be used anywhere a procedure call would be valid, and
19251 correspond to what the RM calls ``intrinsic'' routines.  Such calls can
19252 be used to intersperse machine instructions with other Ada statements.
19253 Second, the function forms, which return a dummy value of the limited
19254 private type @code{Asm_Insn}, can be used in code statements, and indeed
19255 this is the only context where such calls are allowed.  Code statements
19256 appear as aggregates of the form:
19258 @smallexample @c ada
19259 Asm_Insn'(Asm (@dots{}));
19260 Asm_Insn'(Asm_Volatile (@dots{}));
19261 @end smallexample
19263 @noindent
19264 In accordance with RM rules, such code statements are allowed only
19265 within subprograms whose entire body consists of such statements.  It is
19266 not permissible to intermix such statements with other Ada statements.
19268 Typically the form using intrinsic procedure calls is more convenient
19269 and more flexible.  The code statement form is provided to meet the RM
19270 suggestion that such a facility should be made available.  The following
19271 is the exact syntax of the call to @code{Asm}. As usual, if named notation
19272 is used, the arguments may be given in arbitrary order, following the
19273 normal rules for use of positional and named arguments)
19275 @smallexample
19276 ASM_CALL ::= Asm (
19277                  [Template =>] static_string_EXPRESSION
19278                [,[Outputs  =>] OUTPUT_OPERAND_LIST      ]
19279                [,[Inputs   =>] INPUT_OPERAND_LIST       ]
19280                [,[Clobber  =>] static_string_EXPRESSION ]
19281                [,[Volatile =>] static_boolean_EXPRESSION] )
19283 OUTPUT_OPERAND_LIST ::=
19284   [PREFIX.]No_Output_Operands
19285 | OUTPUT_OPERAND_ATTRIBUTE
19286 | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
19288 OUTPUT_OPERAND_ATTRIBUTE ::=
19289   SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
19291 INPUT_OPERAND_LIST ::=
19292   [PREFIX.]No_Input_Operands
19293 | INPUT_OPERAND_ATTRIBUTE
19294 | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
19296 INPUT_OPERAND_ATTRIBUTE ::=
19297   SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
19298 @end smallexample
19300 @noindent
19301 The identifiers @code{No_Input_Operands} and @code{No_Output_Operands}
19302 are declared in the package @code{Machine_Code} and must be referenced
19303 according to normal visibility rules. In particular if there is no
19304 @code{use} clause for this package, then appropriate package name
19305 qualification is required.
19307 @node GNAT Implementation of Tasking
19308 @section GNAT Implementation of Tasking
19310 @noindent
19311 This chapter outlines the basic GNAT approach to tasking (in particular,
19312 a multi-layered library for portability) and discusses issues related
19313 to compliance with the Real-Time Systems Annex.
19315 @menu
19316 * Mapping Ada Tasks onto the Underlying Kernel Threads::
19317 * Ensuring Compliance with the Real-Time Annex::
19318 @end menu
19320 @node Mapping Ada Tasks onto the Underlying Kernel Threads
19321 @subsection Mapping Ada Tasks onto the Underlying Kernel Threads
19323 @noindent
19324 GNAT's run-time support comprises two layers:
19326 @itemize @bullet
19327 @item GNARL (GNAT Run-time Layer)
19328 @item GNULL (GNAT Low-level Library)
19329 @end itemize
19331 @noindent
19332 In GNAT, Ada's tasking services rely on a platform and OS independent
19333 layer known as GNARL@.  This code is responsible for implementing the
19334 correct semantics of Ada's task creation, rendezvous, protected
19335 operations etc.
19337 GNARL decomposes Ada's tasking semantics into simpler lower level
19338 operations such as create a thread, set the priority of a thread,
19339 yield, create a lock, lock/unlock, etc.  The spec for these low-level
19340 operations constitutes GNULLI, the GNULL Interface.  This interface is
19341 directly inspired from the POSIX real-time API@.
19343 If the underlying executive or OS implements the POSIX standard
19344 faithfully, the GNULL Interface maps as is to the services offered by
19345 the underlying kernel.  Otherwise, some target dependent glue code maps
19346 the services offered by the underlying kernel to the semantics expected
19347 by GNARL@.
19349 Whatever the underlying OS (VxWorks, UNIX, Windows, etc.) the
19350 key point is that each Ada task is mapped on a thread in the underlying
19351 kernel.  For example, in the case of VxWorks, one Ada task = one VxWorks task.
19353 In addition Ada task priorities map onto the underlying thread priorities.
19354 Mapping Ada tasks onto the underlying kernel threads has several advantages:
19356 @itemize @bullet
19357 @item
19358 The underlying scheduler is used to schedule the Ada tasks.  This
19359 makes Ada tasks as efficient as kernel threads from a scheduling
19360 standpoint.
19362 @item
19363 Interaction with code written in C containing threads is eased
19364 since at the lowest level Ada tasks and C threads map onto the same
19365 underlying kernel concept.
19367 @item
19368 When an Ada task is blocked during I/O the remaining Ada tasks are
19369 able to proceed.
19371 @item
19372 On multiprocessor systems Ada tasks can execute in parallel.
19373 @end itemize
19375 @noindent
19376 Some threads libraries offer a mechanism to fork a new process, with the
19377 child process duplicating the threads from the parent.
19378 GNAT does not
19379 support this functionality when the parent contains more than one task.
19380 @cindex Forking a new process
19382 @node Ensuring Compliance with the Real-Time Annex
19383 @subsection Ensuring Compliance with the Real-Time Annex
19384 @cindex Real-Time Systems Annex compliance
19386 @noindent
19387 Although mapping Ada tasks onto
19388 the underlying threads has significant advantages, it does create some
19389 complications when it comes to respecting the scheduling semantics
19390 specified in the real-time annex (Annex D).
19392 For instance the Annex D requirement for the @code{FIFO_Within_Priorities}
19393 scheduling policy states:
19395 @quotation
19396 @emph{When the active priority of a ready task that is not running
19397 changes, or the setting of its base priority takes effect, the
19398 task is removed from the ready queue for its old active priority
19399 and is added at the tail of the ready queue for its new active
19400 priority, except in the case where the active priority is lowered
19401 due to the loss of inherited priority, in which case the task is
19402 added at the head of the ready queue for its new active priority.}
19403 @end quotation
19405 @noindent
19406 While most kernels do put tasks at the end of the priority queue when
19407 a task changes its priority, (which respects the main
19408 FIFO_Within_Priorities requirement), almost none keep a thread at the
19409 beginning of its priority queue when its priority drops from the loss
19410 of inherited priority.
19412 As a result most vendors have provided incomplete Annex D implementations.
19414 The GNAT run-time, has a nice cooperative solution to this problem
19415 which ensures that accurate FIFO_Within_Priorities semantics are
19416 respected.
19418 The principle is as follows.  When an Ada task T is about to start
19419 running, it checks whether some other Ada task R with the same
19420 priority as T has been suspended due to the loss of priority
19421 inheritance.  If this is the case, T yields and is placed at the end of
19422 its priority queue.  When R arrives at the front of the queue it
19423 executes.
19425 Note that this simple scheme preserves the relative order of the tasks
19426 that were ready to execute in the priority queue where R has been
19427 placed at the end.
19429 @node GNAT Implementation of Shared Passive Packages
19430 @section GNAT Implementation of Shared Passive Packages
19431 @cindex Shared passive packages
19433 @noindent
19434 GNAT fully implements the pragma @code{Shared_Passive} for
19435 @cindex pragma @code{Shared_Passive}
19436 the purpose of designating shared passive packages.
19437 This allows the use of passive partitions in the
19438 context described in the Ada Reference Manual; i.e., for communication
19439 between separate partitions of a distributed application using the
19440 features in Annex E.
19441 @cindex Annex E
19442 @cindex Distribution Systems Annex
19444 However, the implementation approach used by GNAT provides for more
19445 extensive usage as follows:
19447 @table @emph
19448 @item Communication between separate programs
19450 This allows separate programs to access the data in passive
19451 partitions, using protected objects for synchronization where
19452 needed. The only requirement is that the two programs have a
19453 common shared file system. It is even possible for programs
19454 running on different machines with different architectures
19455 (e.g.@: different endianness) to communicate via the data in
19456 a passive partition.
19458 @item Persistence between program runs
19460 The data in a passive package can persist from one run of a
19461 program to another, so that a later program sees the final
19462 values stored by a previous run of the same program.
19464 @end table
19466 @noindent
19467 The implementation approach used is to store the data in files. A
19468 separate stream file is created for each object in the package, and
19469 an access to an object causes the corresponding file to be read or
19470 written.
19472 The environment variable @code{SHARED_MEMORY_DIRECTORY} should be
19473 @cindex @code{SHARED_MEMORY_DIRECTORY} environment variable
19474 set to the directory to be used for these files.
19475 The files in this directory
19476 have names that correspond to their fully qualified names. For
19477 example, if we have the package
19479 @smallexample @c ada
19480 package X is
19481   pragma Shared_Passive (X);
19482   Y : Integer;
19483   Z : Float;
19484 end X;
19485 @end smallexample
19487 @noindent
19488 and the environment variable is set to @code{/stemp/}, then the files created
19489 will have the names:
19491 @smallexample
19492 /stemp/x.y
19493 /stemp/x.z
19494 @end smallexample
19496 @noindent
19497 These files are created when a value is initially written to the object, and
19498 the files are retained until manually deleted. This provides the persistence
19499 semantics. If no file exists, it means that no partition has assigned a value
19500 to the variable; in this case the initial value declared in the package
19501 will be used. This model ensures that there are no issues in synchronizing
19502 the elaboration process, since elaboration of passive packages elaborates the
19503 initial values, but does not create the files.
19505 The files are written using normal @code{Stream_IO} access.
19506 If you want to be able
19507 to communicate between programs or partitions running on different
19508 architectures, then you should use the XDR versions of the stream attribute
19509 routines, since these are architecture independent.
19511 If active synchronization is required for access to the variables in the
19512 shared passive package, then as described in the Ada Reference Manual, the
19513 package may contain protected objects used for this purpose. In this case
19514 a lock file (whose name is @file{___lock} (three underscores)
19515 is created in the shared memory directory.
19516 @cindex @file{___lock} file (for shared passive packages)
19517 This is used to provide the required locking
19518 semantics for proper protected object synchronization.
19520 As of January 2003, GNAT supports shared passive packages on all platforms
19521 except for OpenVMS.
19523 @node Code Generation for Array Aggregates
19524 @section Code Generation for Array Aggregates
19526 @menu
19527 * Static constant aggregates with static bounds::
19528 * Constant aggregates with unconstrained nominal types::
19529 * Aggregates with static bounds::
19530 * Aggregates with non-static bounds::
19531 * Aggregates in assignment statements::
19532 @end menu
19534 @noindent
19535 Aggregates have a rich syntax and allow the user to specify the values of
19536 complex data structures by means of a single construct.  As a result, the
19537 code generated for aggregates can be quite complex and involve loops, case
19538 statements and multiple assignments.  In the simplest cases, however, the
19539 compiler will recognize aggregates whose components and constraints are
19540 fully static, and in those cases the compiler will generate little or no
19541 executable code.  The following is an outline of the code that GNAT generates
19542 for various aggregate constructs.  For further details, you will find it
19543 useful to examine the output produced by the -gnatG flag to see the expanded
19544 source that is input to the code generator.  You may also want to examine
19545 the assembly code generated at various levels of optimization.
19547 The code generated for aggregates depends on the context, the component values,
19548 and the type.  In the context of an object declaration the code generated is
19549 generally simpler than in the case of an assignment.  As a general rule, static
19550 component values and static subtypes also lead to simpler code.
19552 @node Static constant aggregates with static bounds
19553 @subsection Static constant aggregates with static bounds
19555 @noindent
19556 For the declarations:
19557 @smallexample @c ada
19558     type One_Dim is array (1..10) of integer;
19559     ar0 : constant One_Dim := (1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
19560 @end smallexample
19562 @noindent
19563 GNAT generates no executable code: the constant ar0 is placed in static memory.
19564 The same is true for constant aggregates with named associations:
19566 @smallexample @c ada
19567     Cr1 : constant One_Dim := (4 => 16, 2 => 4, 3 => 9, 1 => 1, 5 .. 10 => 0);
19568     Cr3 : constant One_Dim := (others => 7777);
19569 @end smallexample
19571 @noindent
19572 The same is true for multidimensional constant arrays such as:
19574 @smallexample @c ada
19575     type two_dim is array (1..3, 1..3) of integer;
19576     Unit : constant two_dim := ( (1,0,0), (0,1,0), (0,0,1));
19577 @end smallexample
19579 @noindent
19580 The same is true for arrays of one-dimensional arrays: the following are
19581 static:
19583 @smallexample @c ada
19584 type ar1b  is array (1..3) of boolean;
19585 type ar_ar is array (1..3) of ar1b;
19586 None  : constant ar1b := (others => false);     --  fully static
19587 None2 : constant ar_ar := (1..3 => None);       --  fully static
19588 @end smallexample
19590 @noindent
19591 However, for multidimensional aggregates with named associations, GNAT will
19592 generate assignments and loops, even if all associations are static.  The
19593 following two declarations generate a loop for the first dimension, and
19594 individual component assignments for the second dimension:
19596 @smallexample @c ada
19597 Zero1: constant two_dim := (1..3 => (1..3 => 0));
19598 Zero2: constant two_dim := (others => (others => 0));
19599 @end smallexample
19601 @node Constant aggregates with unconstrained nominal types
19602 @subsection Constant aggregates with unconstrained nominal types
19604 @noindent
19605 In such cases the aggregate itself establishes the subtype, so that
19606 associations with @code{others} cannot be used.  GNAT determines the
19607 bounds for the actual subtype of the aggregate, and allocates the
19608 aggregate statically as well.  No code is generated for the following:
19610 @smallexample @c ada
19611     type One_Unc is array (natural range <>) of integer;
19612     Cr_Unc : constant One_Unc := (12,24,36);
19613 @end smallexample
19615 @node Aggregates with static bounds
19616 @subsection Aggregates with static bounds
19618 @noindent
19619 In all previous examples the aggregate was the initial (and immutable) value
19620 of a constant.  If the aggregate initializes a variable, then code is generated
19621 for it as a combination of individual assignments and loops over the target
19622 object.  The declarations
19624 @smallexample @c ada
19625        Cr_Var1 : One_Dim := (2, 5, 7, 11, 0, 0, 0, 0, 0, 0);
19626        Cr_Var2 : One_Dim := (others > -1);
19627 @end smallexample
19629 @noindent
19630 generate the equivalent of
19632 @smallexample @c ada
19633        Cr_Var1 (1) := 2;
19634        Cr_Var1 (2) := 3;
19635        Cr_Var1 (3) := 5;
19636        Cr_Var1 (4) := 11;
19638        for I in Cr_Var2'range loop
19639           Cr_Var2 (I) := -1;
19640        end loop;
19641 @end smallexample
19643 @node Aggregates with non-static bounds
19644 @subsection Aggregates with non-static bounds
19646 @noindent
19647 If the bounds of the aggregate are not statically compatible with the bounds
19648 of the nominal subtype  of the target, then constraint checks have to be
19649 generated on the bounds.  For a multidimensional array, constraint checks may
19650 have to be applied to sub-arrays individually, if they do not have statically
19651 compatible subtypes.
19653 @node Aggregates in assignment statements
19654 @subsection Aggregates in assignment statements
19656 @noindent
19657 In general, aggregate assignment requires the construction of a temporary,
19658 and a copy from the temporary to the target of the assignment.  This is because
19659 it is not always possible to convert the assignment into a series of individual
19660 component assignments.  For example, consider the simple case:
19662 @smallexample @c ada
19663         A := (A(2), A(1));
19664 @end smallexample
19666 @noindent
19667 This cannot be converted into:
19669 @smallexample @c ada
19670         A(1) := A(2);
19671         A(2) := A(1);
19672 @end smallexample
19674 @noindent
19675 So the aggregate has to be built first in a separate location, and then
19676 copied into the target.  GNAT recognizes simple cases where this intermediate
19677 step is not required, and the assignments can be performed in place, directly
19678 into the target.  The following sufficient criteria are applied:
19680 @itemize @bullet
19681 @item
19682 The bounds of the aggregate are static, and the associations are static.
19683 @item
19684 The components of the aggregate are static constants, names of
19685 simple variables that are not renamings, or expressions not involving
19686 indexed components whose operands obey these rules.
19687 @end itemize
19689 @noindent
19690 If any of these conditions are violated, the aggregate will be built in
19691 a temporary (created either by the front-end or the code generator) and then
19692 that temporary will be copied onto the target.
19694 @node The Size of Discriminated Records with Default Discriminants
19695 @section The Size of Discriminated Records with Default Discriminants
19697 @noindent
19698 If a discriminated type @code{T} has discriminants with default values, it is
19699 possible to declare an object of this type without providing an explicit
19700 constraint:
19702 @smallexample @c ada
19703 @group
19704 type Size is range 1..100;
19706 type Rec (D : Size := 15) is record
19707    Name : String (1..D);
19708 end T;
19710 Word : Rec;
19711 @end group
19712 @end smallexample
19714 @noindent
19715 Such an object is said to be @emph{unconstrained}.
19716 The discriminant of the object
19717 can be modified by a full assignment to the object, as long as it preserves the
19718 relation between the value of the discriminant, and the value of the components
19719 that depend on it:
19721 @smallexample @c ada
19722 @group
19723 Word := (3, "yes");
19725 Word := (5, "maybe");
19727 Word := (5, "no"); -- raises Constraint_Error
19728 @end group
19729 @end smallexample
19731 @noindent
19732 In order to support this behavior efficiently, an unconstrained object is
19733 given the maximum size that any value of the type requires. In the case
19734 above, @code{Word} has storage for the discriminant and for
19735 a @code{String} of length 100.
19736 It is important to note that unconstrained objects do not require dynamic
19737 allocation. It would be an improper implementation to place on the heap those
19738 components whose size depends on discriminants. (This improper implementation
19739 was used by some Ada83 compilers, where the @code{Name} component above
19740 would have
19741 been stored as a pointer to a dynamic string). Following the principle that
19742 dynamic storage management should never be introduced implicitly,
19743 an Ada compiler should reserve the full size for an unconstrained declared
19744 object, and place it on the stack.
19746 This maximum size approach
19747 has been a source of surprise to some users, who expect the default
19748 values of the discriminants to determine the size reserved for an
19749 unconstrained object: ``If the default is 15, why should the object occupy
19750 a larger size?''
19751 The answer, of course, is that the discriminant may be later modified,
19752 and its full range of values must be taken into account. This is why the
19753 declaration:
19755 @smallexample
19756 @group
19757 type Rec (D : Positive := 15) is record
19758    Name : String (1..D);
19759 end record;
19761 Too_Large : Rec;
19762 @end group
19763 @end smallexample
19765 @noindent
19766 is flagged by the compiler with a warning:
19767 an attempt to create @code{Too_Large} will raise @code{Storage_Error},
19768 because the required size includes @code{Positive'Last}
19769 bytes. As the first example indicates, the proper approach is to declare an
19770 index type of ``reasonable'' range so that unconstrained objects are not too
19771 large.
19773 One final wrinkle: if the object is declared to be @code{aliased}, or if it is
19774 created in the heap by means of an allocator, then it is @emph{not}
19775 unconstrained:
19776 it is constrained by the default values of the discriminants, and those values
19777 cannot be modified by full assignment. This is because in the presence of
19778 aliasing all views of the object (which may be manipulated by different tasks,
19779 say) must be consistent, so it is imperative that the object, once created,
19780 remain invariant.
19782 @node Strict Conformance to the Ada Reference Manual
19783 @section Strict Conformance to the Ada Reference Manual
19785 @noindent
19786 The dynamic semantics defined by the Ada Reference Manual impose a set of
19787 run-time checks to be generated. By default, the GNAT compiler will insert many
19788 run-time checks into the compiled code, including most of those required by the
19789 Ada Reference Manual. However, there are three checks that are not enabled
19790 in the default mode for efficiency reasons: arithmetic overflow checking for
19791 integer operations (including division by zero), checks for access before
19792 elaboration on subprogram calls, and stack overflow checking (most operating
19793 systems do not perform this check by default).
19795 Strict conformance to the Ada Reference Manual can be achieved by adding
19796 three compiler options for overflow checking for integer operations
19797 (@option{-gnato}), dynamic checks for access-before-elaboration on subprogram
19798 calls and generic instantiations (@option{-gnatE}), and stack overflow
19799 checking (@option{-fstack-check}).
19801 Note that the result of a floating point arithmetic operation in overflow and
19802 invalid situations, when the @code{Machine_Overflows} attribute of the result
19803 type is @code{False}, is to generate IEEE NaN and infinite values. This is the
19804 case for machines compliant with the IEEE floating-point standard, but on
19805 machines that are not fully compliant with this standard, such as Alpha, the
19806 @option{-mieee} compiler flag must be used for achieving IEEE confirming
19807 behavior (although at the cost of a significant performance penalty), so
19808 infinite and NaN values are properly generated.
19811 @node Implementation of Ada 2012 Features
19812 @chapter Implementation of Ada 2012 Features
19813 @cindex Ada 2012 implementation status
19815 This chapter contains a complete list of Ada 2012 features that have been
19816 implemented as of GNAT version 6.4. Generally, these features are only
19817 available if the @option{-gnat12} (Ada 2012 features enabled) flag is set
19818 @cindex @option{-gnat12} option
19819 or if the configuration pragma @code{Ada_2012} is used.
19820 @cindex pragma @code{Ada_2012}
19821 @cindex configuration pragma @code{Ada_2012}
19822 @cindex @code{Ada_2012} configuration pragma
19823 However, new pragmas, attributes, and restrictions are
19824 unconditionally available, since the Ada 95 standard allows the addition of
19825 new pragmas, attributes, and restrictions (there are exceptions, which are
19826 documented in the individual descriptions), and also certain packages
19827 were made available in earlier versions of Ada.
19829 An ISO date (YYYY-MM-DD) appears in parentheses on the description line.
19830 This date shows the implementation date of the feature. Any wavefront
19831 subsequent to this date will contain the indicated feature, as will any
19832 subsequent releases. A date of 0000-00-00 means that GNAT has always
19833 implemented the feature, or implemented it as soon as it appeared as a
19834 binding interpretation.
19836 Each feature corresponds to an Ada Issue (``AI'') approved by the Ada
19837 standardization group (ISO/IEC JTC1/SC22/WG9) for inclusion in Ada 2012.
19838 The features are ordered based on the relevant sections of the Ada
19839 Reference Manual (``RM'').  When a given AI relates to multiple points
19840 in the RM, the earliest is used.
19842 A complete description of the AIs may be found in
19843 @url{www.ada-auth.org/ai05-summary.html}.
19845 @itemize @bullet
19847 @item
19848 @emph{AI-0176 Quantified expressions (2010-09-29)}
19849 @cindex AI-0176 (Ada 2012 feature)
19851 @noindent
19852   Both universally and existentially quantified expressions are implemented.
19853   They use the new syntax for iterators proposed in AI05-139-2, as well as
19854   the standard Ada loop syntax.
19856 @noindent
19857   RM References:  1.01.04 (12)   2.09 (2/2)   4.04 (7)   4.05.09 (0)
19859 @item
19860 @emph{AI-0079 Allow @i{other_format} characters in source (2010-07-10)}
19861 @cindex AI-0079 (Ada 2012 feature)
19863 @noindent
19864   Wide characters in the unicode category @i{other_format} are now allowed in
19865   source programs between tokens, but not within a token such as an identifier.
19867 @noindent
19868   RM References:  2.01 (4/2)   2.02 (7)
19870 @item
19871 @emph{AI-0091 Do not allow @i{other_format} in identifiers (0000-00-00)}
19872 @cindex AI-0091 (Ada 2012 feature)
19874 @noindent
19875   Wide characters in the unicode category @i{other_format} are not permitted
19876   within  an identifier, since this can be a security problem. The error
19877   message for this case has been improved to be more specific, but GNAT has
19878   never allowed such characters to appear in identifiers.
19880 @noindent
19881   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)
19883 @item
19884 @emph{AI-0100 Placement of pragmas  (2010-07-01)}
19885 @cindex AI-0100 (Ada 2012 feature)
19887 @noindent
19888   This AI is an earlier version of AI-163. It simplifies the rules
19889   for legal placement of pragmas. In the case of lists that allow pragmas, if
19890   the list may have no elements, then the list may consist solely of pragmas.
19892 @noindent
19893   RM References:  2.08 (7)
19895 @item
19896 @emph{AI-0163 Pragmas in place of null (2010-07-01)}
19897 @cindex AI-0163 (Ada 2012 feature)
19899 @noindent
19900   A statement sequence may be composed entirely of pragmas. It is no longer
19901   necessary to add a dummy @code{null} statement to make the sequence legal.
19903 @noindent
19904   RM References:  2.08 (7)   2.08 (16)
19907 @item
19908 @emph{AI-0080 ``View of'' not needed if clear from context (0000-00-00)}
19909 @cindex AI-0080 (Ada 2012 feature)
19911 @noindent
19912   This is an editorial change only, described as non-testable in the AI.
19914 @noindent
19915   RM References:  3.01 (7)
19918 @item
19919 @emph{AI-0183 Aspect specifications (2010-08-16)}
19920 @cindex AI-0183 (Ada 2012 feature)
19922 @noindent
19923   Aspect specifications have been fully implemented except for pre and post-
19924   conditions, and type invariants, which have their own separate AI's. All
19925   forms of declarations listed in the AI are supported. The following is a
19926   list of the aspects supported (with GNAT implementation aspects marked)
19928 @multitable {@code{Preelaborable_Initialization}} {--GNAT}
19929 @item @code{Ada_2005} @tab                      -- GNAT
19930 @item @code{Ada_2012} @tab                      -- GNAT
19931 @item @code{Address} @tab
19932 @item @code{Alignment} @tab
19933 @item @code{Atomic} @tab
19934 @item @code{Atomic_Components} @tab
19935 @item @code{Bit_Order} @tab
19936 @item @code{Component_Size} @tab
19937 @item @code{Contract_Cases} @tab                -- GNAT
19938 @item @code{Discard_Names} @tab
19939 @item @code{External_Tag} @tab
19940 @item @code{Favor_Top_Level} @tab               -- GNAT
19941 @item @code{Inline} @tab
19942 @item @code{Inline_Always} @tab                 -- GNAT
19943 @item @code{Invariant} @tab                     -- GNAT
19944 @item @code{Machine_Radix} @tab
19945 @item @code{No_Return} @tab
19946 @item @code{Object_Size} @tab                   -- GNAT
19947 @item @code{Pack} @tab
19948 @item @code{Persistent_BSS} @tab                -- GNAT
19949 @item @code{Post} @tab
19950 @item @code{Pre} @tab
19951 @item @code{Predicate} @tab
19952 @item @code{Preelaborable_Initialization} @tab
19953 @item @code{Pure_Function} @tab                 -- GNAT
19954 @item @code{Remote_Access_Type} @tab            -- GNAT
19955 @item @code{Shared} @tab                        -- GNAT
19956 @item @code{Size} @tab
19957 @item @code{Storage_Pool} @tab
19958 @item @code{Storage_Size} @tab
19959 @item @code{Stream_Size} @tab
19960 @item @code{Suppress} @tab
19961 @item @code{Suppress_Debug_Info} @tab           -- GNAT
19962 @item @code{Test_Case} @tab                     -- GNAT
19963 @item @code{Type_Invariant} @tab
19964 @item @code{Unchecked_Union} @tab
19965 @item @code{Universal_Aliasing} @tab            -- GNAT
19966 @item @code{Unmodified} @tab                    -- GNAT
19967 @item @code{Unreferenced} @tab                  -- GNAT
19968 @item @code{Unreferenced_Objects} @tab          -- GNAT
19969 @item @code{Unsuppress} @tab
19970 @item @code{Value_Size} @tab                    -- GNAT
19971 @item @code{Volatile} @tab
19972 @item @code{Volatile_Components}
19973 @item @code{Warnings} @tab                      -- GNAT
19974 @end multitable
19976 @noindent
19977   Note that for aspects with an expression, e.g. @code{Size}, the expression is
19978   treated like a default expression (visibility is analyzed at the point of
19979   occurrence of the aspect, but evaluation of the expression occurs at the
19980   freeze point of the entity involved).
19982 @noindent
19983   RM References:  3.02.01 (3)   3.02.02 (2)   3.03.01 (2/2)   3.08 (6)
19984   3.09.03 (1.1/2)   6.01 (2/2)   6.07 (2/2)   9.05.02 (2/2)   7.01 (3)   7.03
19985   (2)   7.03 (3)   9.01 (2/2)   9.01 (3/2)   9.04 (2/2)   9.04 (3/2)
19986   9.05.02 (2/2)   11.01 (2)   12.01 (3)   12.03 (2/2)   12.04 (2/2)   12.05 (2)
19987   12.06 (2.1/2)   12.06 (2.2/2)   12.07 (2)   13.01 (0.1/2)   13.03 (5/1)
19988   13.03.01 (0)
19991 @item
19992 @emph{AI-0128 Inequality is a primitive operation (0000-00-00)}
19993 @cindex AI-0128 (Ada 2012 feature)
19995 @noindent
19996   If an equality operator ("=") is declared for a type, then the implicitly
19997   declared inequality operator ("/=") is a primitive operation of the type.
19998   This is the only reasonable interpretation, and is the one always implemented
19999   by GNAT, but the RM was not entirely clear in making this point.
20001 @noindent
20002   RM References:  3.02.03 (6)   6.06 (6)
20004 @item
20005 @emph{AI-0003 Qualified expressions as names (2010-07-11)}
20006 @cindex AI-0003 (Ada 2012 feature)
20008 @noindent
20009    In Ada 2012, a qualified expression is considered to be syntactically a name,
20010    meaning that constructs such as @code{A'(F(X)).B} are now legal. This is
20011    useful in disambiguating some cases of overloading.
20013 @noindent
20014   RM References:  3.03 (11)   3.03 (21)   4.01 (2)   4.04 (7)   4.07 (3)
20015   5.04 (7)
20017 @item
20018 @emph{AI-0120 Constant instance of protected object (0000-00-00)}
20019 @cindex AI-0120 (Ada 2012 feature)
20021 @noindent
20022   This is an RM editorial change only. The section that lists objects that are
20023   constant failed to include the current instance of a protected object
20024   within a protected function. This has always been treated as a constant
20025   in GNAT.
20027 @noindent
20028   RM References:  3.03 (21)
20030 @item
20031 @emph{AI-0008 General access to constrained objects (0000-00-00)}
20032 @cindex AI-0008 (Ada 2012 feature)
20034 @noindent
20035   The wording in the RM implied that if you have a general access to a
20036   constrained object, it could be used to modify the discriminants. This was
20037   obviously not intended. @code{Constraint_Error} should be raised, and GNAT
20038   has always done so in this situation.
20040 @noindent
20041   RM References:  3.03 (23)   3.10.02 (26/2)   4.01 (9)   6.04.01 (17)   8.05.01 (5/2)
20044 @item
20045 @emph{AI-0093 Additional rules use immutably limited (0000-00-00)}
20046 @cindex AI-0093 (Ada 2012 feature)
20048 @noindent
20049   This is an editorial change only, to make more widespread use of the Ada 2012
20050   ``immutably limited''.
20052 @noindent
20053   RM References:  3.03 (23.4/3)
20057 @item
20058 @emph{AI-0096 Deriving from formal private types (2010-07-20)}
20059 @cindex AI-0096 (Ada 2012 feature)
20061 @noindent
20062   In general it is illegal for a type derived from a formal limited type to be
20063   nonlimited.  This AI makes an exception to this rule: derivation is legal
20064   if it appears in the private part of the generic, and the formal type is not
20065   tagged. If the type is tagged, the legality check must be applied to the
20066   private part of the package.
20068 @noindent
20069   RM References:  3.04 (5.1/2)   6.02 (7)
20072 @item
20073 @emph{AI-0181 Soft hyphen is a non-graphic character (2010-07-23)}
20074 @cindex AI-0181 (Ada 2012 feature)
20076 @noindent
20077   From Ada 2005 on, soft hyphen is considered a non-graphic character, which
20078   means that it has a special name (@code{SOFT_HYPHEN}) in conjunction with the
20079   @code{Image} and @code{Value} attributes for the character types. Strictly
20080   speaking this is an inconsistency with Ada 95, but in practice the use of
20081   these attributes is so obscure that it will not cause problems.
20083 @noindent
20084   RM References:  3.05.02 (2/2)   A.01 (35/2)   A.03.03 (21)
20087 @item
20088 @emph{AI-0182 Additional forms for @code{Character'Value} (0000-00-00)}
20089 @cindex AI-0182 (Ada 2012 feature)
20091 @noindent
20092   This AI allows @code{Character'Value} to accept the string @code{'?'} where
20093   @code{?} is any character including non-graphic control characters. GNAT has
20094   always accepted such strings. It also allows strings such as
20095   @code{HEX_00000041} to be accepted, but GNAT does not take advantage of this
20096   permission and raises @code{Constraint_Error}, as is certainly still
20097   permitted.
20099 @noindent
20100   RM References:  3.05 (56/2)
20103 @item
20104 @emph{AI-0214 Defaulted discriminants for limited tagged (2010-10-01)}
20105 @cindex AI-0214 (Ada 2012 feature)
20107 @noindent
20108   Ada 2012 relaxes the restriction that forbids discriminants of tagged types
20109   to have default expressions by allowing them when the type is limited. It
20110   is often useful to define a default value for a discriminant even though
20111   it can't be changed by assignment.
20113 @noindent
20114   RM References:  3.07 (9.1/2)   3.07.02 (3)
20117 @item
20118 @emph{AI-0102 Some implicit conversions are illegal (0000-00-00)}
20119 @cindex AI-0102 (Ada 2012 feature)
20121 @noindent
20122   It is illegal to assign an anonymous access constant to an anonymous access
20123   variable. The RM did not have a clear rule to prevent this, but GNAT has
20124   always generated an error for this usage.
20126 @noindent
20127   RM References:  3.07 (16)   3.07.01 (9)   6.04.01 (6)   8.06 (27/2)
20130 @item
20131 @emph{AI-0158 Generalizing membership tests (2010-09-16)}
20132 @cindex AI-0158 (Ada 2012 feature)
20134 @noindent
20135   This AI extends the syntax of membership tests to simplify complex conditions
20136   that can be expressed as membership in a subset of values of any type. It
20137   introduces syntax for a list of expressions that may be used in loop contexts
20138   as well.
20140 @noindent
20141   RM References:  3.08.01 (5)   4.04 (3)   4.05.02 (3)   4.05.02 (5)   4.05.02 (27)
20144 @item
20145 @emph{AI-0173 Testing if tags represent abstract types (2010-07-03)}
20146 @cindex AI-0173 (Ada 2012 feature)
20148 @noindent
20149   The function @code{Ada.Tags.Type_Is_Abstract} returns @code{True} if invoked
20150   with the tag of an abstract type, and @code{False} otherwise.
20152 @noindent
20153   RM References:  3.09 (7.4/2)   3.09 (12.4/2)
20157 @item
20158 @emph{AI-0076 function with controlling result (0000-00-00)}
20159 @cindex AI-0076 (Ada 2012 feature)
20161 @noindent
20162   This is an editorial change only. The RM defines calls with controlling
20163   results, but uses the term ``function with controlling result'' without an
20164   explicit definition.
20166 @noindent
20167   RM References:  3.09.02 (2/2)
20170 @item
20171 @emph{AI-0126 Dispatching with no declared operation (0000-00-00)}
20172 @cindex AI-0126 (Ada 2012 feature)
20174 @noindent
20175   This AI clarifies dispatching rules, and simply confirms that dispatching
20176   executes the operation of the parent type when there is no explicitly or
20177   implicitly declared operation for the descendant type. This has always been
20178   the case in all versions of GNAT.
20180 @noindent
20181   RM References:  3.09.02 (20/2)   3.09.02 (20.1/2)   3.09.02 (20.2/2)
20184 @item
20185 @emph{AI-0097 Treatment of abstract null extension (2010-07-19)}
20186 @cindex AI-0097 (Ada 2012 feature)
20188 @noindent
20189   The RM as written implied that in some cases it was possible to create an
20190   object of an abstract type, by having an abstract extension inherit a non-
20191   abstract constructor from its parent type. This mistake has been corrected
20192   in GNAT and in the RM, and this construct is now illegal.
20194 @noindent
20195   RM References:  3.09.03 (4/2)
20198 @item
20199 @emph{AI-0203 Extended return cannot be abstract (0000-00-00)}
20200 @cindex AI-0203 (Ada 2012 feature)
20202 @noindent
20203   A return_subtype_indication cannot denote an abstract subtype. GNAT has never
20204   permitted such usage.
20206 @noindent
20207   RM References:  3.09.03 (8/3)
20210 @item
20211 @emph{AI-0198 Inheriting abstract operators  (0000-00-00)}
20212 @cindex AI-0198 (Ada 2012 feature)
20214 @noindent
20215   This AI resolves a conflict between two rules involving inherited abstract
20216   operations and predefined operators. If a derived numeric type inherits
20217   an abstract operator, it overrides the predefined one. This interpretation
20218   was always the one implemented in GNAT.
20220 @noindent
20221   RM References:  3.09.03 (4/3)
20223 @item
20224 @emph{AI-0073 Functions returning abstract types (2010-07-10)}
20225 @cindex AI-0073 (Ada 2012 feature)
20227 @noindent
20228   This AI covers a number of issues regarding returning abstract types. In
20229   particular generic functions cannot have abstract result types or access
20230   result types designated an abstract type. There are some other cases which
20231   are detailed in the AI. Note that this binding interpretation has not been
20232   retrofitted to operate before Ada 2012 mode, since it caused a significant
20233   number of regressions.
20235 @noindent
20236   RM References:  3.09.03 (8)   3.09.03 (10)   6.05 (8/2)
20239 @item
20240 @emph{AI-0070 Elaboration of interface types (0000-00-00)}
20241 @cindex AI-0070 (Ada 2012 feature)
20243 @noindent
20244   This is an editorial change only, there are no testable consequences short of
20245   checking for the absence of generated code for an interface declaration.
20247 @noindent
20248   RM References:  3.09.04 (18/2)
20251 @item
20252 @emph{AI-0208 Characteristics of incomplete views (0000-00-00)}
20253 @cindex AI-0208 (Ada 2012 feature)
20255 @noindent
20256   The wording in the Ada 2005 RM concerning characteristics of incomplete views
20257   was incorrect and implied that some programs intended to be legal were now
20258   illegal. GNAT had never considered such programs illegal, so it has always
20259   implemented the intent of this AI.
20261 @noindent
20262   RM References:  3.10.01 (2.4/2)   3.10.01 (2.6/2)
20265 @item
20266 @emph{AI-0162 Incomplete type completed by partial view (2010-09-15)}
20267 @cindex AI-0162 (Ada 2012 feature)
20269 @noindent
20270   Incomplete types are made more useful by allowing them to be completed by
20271   private types and private extensions.
20273 @noindent
20274   RM References:  3.10.01 (2.5/2)   3.10.01 (2.6/2)   3.10.01 (3)   3.10.01 (4/2)
20278 @item
20279 @emph{AI-0098 Anonymous subprogram access restrictions (0000-00-00)}
20280 @cindex AI-0098 (Ada 2012 feature)
20282 @noindent
20283   An unintentional omission in the RM implied some inconsistent restrictions on
20284   the use of anonymous access to subprogram values. These restrictions were not
20285   intentional, and have never been enforced by GNAT.
20287 @noindent
20288   RM References:  3.10.01 (6)   3.10.01 (9.2/2)
20291 @item
20292 @emph{AI-0199 Aggregate with anonymous access components (2010-07-14)}
20293 @cindex AI-0199 (Ada 2012 feature)
20295 @noindent
20296   A choice list in a record aggregate can include several components of
20297   (distinct) anonymous access types as long as they have matching designated
20298   subtypes.
20300 @noindent
20301   RM References:  4.03.01 (16)
20304 @item
20305 @emph{AI-0220 Needed components for aggregates (0000-00-00)}
20306 @cindex AI-0220 (Ada 2012 feature)
20308 @noindent
20309   This AI addresses a wording problem in the RM that appears to permit some
20310   complex cases of aggregates with non-static discriminants. GNAT has always
20311   implemented the intended semantics.
20313 @noindent
20314   RM References:  4.03.01 (17)
20316 @item
20317 @emph{AI-0147 Conditional expressions (2009-03-29)}
20318 @cindex AI-0147 (Ada 2012 feature)
20320 @noindent
20321   Conditional expressions are permitted. The form of such an expression is:
20323 @smallexample
20324     (@b{if} @i{expr} @b{then} @i{expr} @{@b{elsif} @i{expr} @b{then} @i{expr}@} [@b{else} @i{expr}])
20325 @end smallexample
20327   The parentheses can be omitted in contexts where parentheses are present
20328   anyway, such as subprogram arguments and pragma arguments. If the @b{else}
20329   clause is omitted, @b{else True} is assumed;
20330   thus @code{(@b{if} A @b{then} B)} is a way to conveniently represent
20331   @emph{(A implies B)} in standard logic.
20333 @noindent
20334   RM References:  4.03.03 (15)   4.04 (1)   4.04 (7)   4.05.07 (0)   4.07 (2)
20335   4.07 (3)   4.09 (12)   4.09 (33)   5.03 (3)   5.03 (4)   7.05 (2.1/2)
20338 @item
20339 @emph{AI-0037 Out-of-range box associations in aggregate (0000-00-00)}
20340 @cindex AI-0037 (Ada 2012 feature)
20342 @noindent
20343   This AI confirms that an association of the form @code{Indx => <>} in an
20344   array aggregate must raise @code{Constraint_Error} if @code{Indx}
20345   is out of range. The RM specified a range check on other associations, but
20346   not when the value of the association was defaulted. GNAT has always inserted
20347   a constraint check on the index value.
20349 @noindent
20350   RM References:  4.03.03 (29)
20353 @item
20354 @emph{AI-0123 Composability of equality (2010-04-13)}
20355 @cindex AI-0123 (Ada 2012 feature)
20357 @noindent
20358   Equality of untagged record composes, so that the predefined equality for a
20359   composite type that includes a component of some untagged record type
20360   @code{R} uses the equality operation of @code{R} (which may be user-defined
20361   or predefined). This makes the behavior of untagged records identical to that
20362   of tagged types in this respect.
20364   This change is an incompatibility with previous versions of Ada, but it
20365   corrects a non-uniformity that was often a source of confusion. Analysis of
20366   a large number of industrial programs indicates that in those rare cases
20367   where a composite type had an untagged record component with a user-defined
20368   equality, either there was no use of the composite equality, or else the code
20369   expected the same composability as for tagged types, and thus had a bug that
20370   would be fixed by this change.
20372 @noindent
20373   RM References:  4.05.02 (9.7/2)   4.05.02 (14)   4.05.02 (15)   4.05.02 (24)
20374   8.05.04 (8)
20377 @item
20378 @emph{AI-0088 The value of exponentiation (0000-00-00)}
20379 @cindex AI-0088 (Ada 2012 feature)
20381 @noindent
20382   This AI clarifies the equivalence rule given for the dynamic semantics of
20383   exponentiation: the value of the operation can be obtained by repeated
20384   multiplication, but the operation can be implemented otherwise (for example
20385   using the familiar divide-by-two-and-square algorithm, even if this is less
20386   accurate), and does not imply repeated reads of a volatile base.
20388 @noindent
20389   RM References:  4.05.06 (11)
20391 @item
20392 @emph{AI-0188 Case expressions (2010-01-09)}
20393 @cindex AI-0188 (Ada 2012 feature)
20395 @noindent
20396   Case expressions are permitted. This allows use of constructs such as:
20397 @smallexample
20398   X := (@b{case} Y @b{is when} 1 => 2, @b{when} 2 => 3, @b{when others} => 31)
20399 @end smallexample
20401 @noindent
20402   RM References:  4.05.07 (0)   4.05.08 (0)   4.09 (12)   4.09 (33)
20404 @item
20405 @emph{AI-0104 Null exclusion and uninitialized allocator (2010-07-15)}
20406 @cindex AI-0104 (Ada 2012 feature)
20408 @noindent
20409   The assignment @code{Ptr := @b{new not null} Some_Ptr;} will raise
20410   @code{Constraint_Error} because the default value of the allocated object is
20411   @b{null}. This useless construct is illegal in Ada 2012.
20413 @noindent
20414   RM References:  4.08 (2)
20416 @item
20417 @emph{AI-0157 Allocation/Deallocation from empty pool (2010-07-11)}
20418 @cindex AI-0157 (Ada 2012 feature)
20420 @noindent
20421   Allocation and Deallocation from an empty storage pool (i.e. allocation or
20422   deallocation of a pointer for which a static storage size clause of zero
20423   has been given) is now illegal and is detected as such. GNAT
20424   previously gave a warning but not an error.
20426 @noindent
20427   RM References:  4.08 (5.3/2)   13.11.02 (4)   13.11.02 (17)
20429 @item
20430 @emph{AI-0179 Statement not required after label (2010-04-10)}
20431 @cindex AI-0179 (Ada 2012 feature)
20433 @noindent
20434   It is not necessary to have a statement following a label, so a label
20435   can appear at the end of a statement sequence without the need for putting a
20436   null statement afterwards, but it is not allowable to have only labels and
20437   no real statements in a statement sequence.
20439 @noindent
20440   RM References:  5.01 (2)
20443 @item
20444 @emph{AI-139-2 Syntactic sugar for iterators (2010-09-29)}
20445 @cindex AI-139-2 (Ada 2012 feature)
20447 @noindent
20448   The new syntax for iterating over arrays and containers is now implemented.
20449   Iteration over containers is for now limited to read-only iterators. Only
20450   default iterators are supported, with the syntax:  @code{@b{for} Elem @b{of} C}.
20452 @noindent
20453   RM References:  5.05
20455 @item
20456 @emph{AI-0134 Profiles must match for full conformance (0000-00-00)}
20457 @cindex AI-0134 (Ada 2012 feature)
20459 @noindent
20460   For full conformance, the profiles of anonymous-access-to-subprogram
20461   parameters must match. GNAT has always enforced this rule.
20463 @noindent
20464   RM References:  6.03.01 (18)
20466 @item
20467 @emph{AI-0207 Mode conformance and access constant (0000-00-00)}
20468 @cindex AI-0207 (Ada 2012 feature)
20470 @noindent
20471   This AI confirms that access_to_constant indication must match for mode
20472   conformance. This was implemented in GNAT when the qualifier was originally
20473   introduced in Ada 2005.
20475 @noindent
20476   RM References:  6.03.01 (16/2)
20479 @item
20480 @emph{AI-0046 Null exclusion match for full conformance (2010-07-17)}
20481 @cindex AI-0046 (Ada 2012 feature)
20483 @noindent
20484   For full conformance, in the case of access parameters, the null exclusion
20485   must match (either both or neither must have @code{@b{not null}}).
20487 @noindent
20488   RM References:  6.03.02 (18)
20491 @item
20492 @emph{AI-0118 The association of parameter associations (0000-00-00)}
20493 @cindex AI-0118 (Ada 2012 feature)
20495 @noindent
20496   This AI clarifies the rules for named associations in subprogram calls and
20497   generic instantiations. The rules have been in place since Ada 83.
20499 @noindent
20500   RM References:  6.04.01 (2)   12.03 (9)
20503 @item
20504 @emph{AI-0196 Null exclusion tests for out parameters (0000-00-00)}
20505 @cindex AI-0196 (Ada 2012 feature)
20507 @noindent
20508   Null exclusion checks are not made for @code{@b{out}} parameters when
20509   evaluating the actual parameters. GNAT has never generated these checks.
20511 @noindent
20512   RM References:  6.04.01 (13)
20514 @item
20515 @emph{AI-0015 Constant return objects (0000-00-00)}
20516 @cindex AI-0015 (Ada 2012 feature)
20518 @noindent
20519   The return object declared in an @i{extended_return_statement} may be
20520   declared constant. This was always intended, and GNAT has always allowed it.
20522 @noindent
20523   RM References:  6.05 (2.1/2)   3.03 (10/2)   3.03 (21)   6.05 (5/2)
20524   6.05 (5.7/2)
20527 @item
20528 @emph{AI-0032 Extended return for class-wide functions (0000-00-00)}
20529 @cindex AI-0032 (Ada 2012 feature)
20531 @noindent
20532   If a function returns a class-wide type, the object of an extended return
20533   statement can be declared with a specific type that is covered by the class-
20534   wide type. This has been implemented in GNAT since the introduction of
20535   extended returns. Note AI-0103 complements this AI by imposing matching
20536   rules for constrained return types.
20538 @noindent
20539   RM References:  6.05 (5.2/2)   6.05 (5.3/2)   6.05 (5.6/2)   6.05 (5.8/2)
20540   6.05 (8/2)
20542 @item
20543 @emph{AI-0103 Static matching for extended return (2010-07-23)}
20544 @cindex AI-0103 (Ada 2012 feature)
20546 @noindent
20547   If the return subtype of a function is an elementary type or a constrained
20548   type, the subtype indication in an extended return statement must match
20549   statically this return subtype.
20551 @noindent
20552   RM References:  6.05 (5.2/2)
20555 @item
20556 @emph{AI-0058 Abnormal completion of an extended return (0000-00-00)}
20557 @cindex AI-0058 (Ada 2012 feature)
20559 @noindent
20560   The RM had some incorrect wording implying wrong treatment of abnormal
20561   completion in an extended return. GNAT has always implemented the intended
20562   correct semantics as described by this AI.
20564 @noindent
20565   RM References:  6.05 (22/2)
20568 @item
20569 @emph{AI-0050 Raising Constraint_Error early for function call (0000-00-00)}
20570 @cindex AI-0050 (Ada 2012 feature)
20572 @noindent
20573   The implementation permissions for raising @code{Constraint_Error} early on a function call when it was clear an exception would be raised were over-permissive and allowed mishandling of discriminants in some cases. GNAT did
20574   not take advantage of these incorrect permissions in any case.
20576 @noindent
20577   RM References:  6.05 (24/2)
20580 @item
20581 @emph{AI-0125 Nonoverridable operations of an ancestor (2010-09-28)}
20582 @cindex AI-0125 (Ada 2012 feature)
20584 @noindent
20585   In Ada 2012, the declaration of a primitive operation of a type extension
20586   or private extension can also override an inherited primitive that is not
20587   visible at the point of this declaration.
20589 @noindent
20590   RM References:  7.03.01 (6)   8.03 (23)   8.03.01 (5/2)   8.03.01 (6/2)
20592 @item
20593 @emph{AI-0062 Null exclusions and deferred constants (0000-00-00)}
20594 @cindex AI-0062 (Ada 2012 feature)
20596 @noindent
20597   A full constant may have a null exclusion even if its associated deferred
20598   constant does not. GNAT has always allowed this.
20600 @noindent
20601   RM References:  7.04 (6/2)   7.04 (7.1/2)
20604 @item
20605 @emph{AI-0178 Incomplete views are limited (0000-00-00)}
20606 @cindex AI-0178 (Ada 2012 feature)
20608 @noindent
20609   This AI clarifies the role of incomplete views and plugs an omission in the
20610   RM. GNAT always correctly restricted the use of incomplete views and types.
20612 @noindent
20613   RM References:  7.05 (3/2)   7.05 (6/2)
20615 @item
20616 @emph{AI-0087 Actual for formal nonlimited derived type (2010-07-15)}
20617 @cindex AI-0087 (Ada 2012 feature)
20619 @noindent
20620   The actual for a formal nonlimited derived type cannot be limited. In
20621   particular, a formal derived type that extends a limited interface but which
20622   is not explicitly limited cannot be instantiated with a limited type.
20624 @noindent
20625   RM References:  7.05 (5/2)   12.05.01 (5.1/2)
20627 @item
20628 @emph{AI-0099 Tag determines whether finalization needed (0000-00-00)}
20629 @cindex AI-0099 (Ada 2012 feature)
20631 @noindent
20632   This AI clarifies that ``needs finalization'' is part of dynamic semantics,
20633   and therefore depends on the run-time characteristics of an object (i.e. its
20634   tag) and not on its nominal type. As the AI indicates: ``we do not expect
20635   this to affect any implementation''.
20637 @noindent
20638   RM References:  7.06.01 (6)   7.06.01 (7)   7.06.01 (8)   7.06.01 (9/2)
20642 @item
20643 @emph{AI-0064 Redundant finalization rule (0000-00-00)}
20644 @cindex AI-0064 (Ada 2012 feature)
20646 @noindent
20647   This is an editorial change only. The intended behavior is already checked
20648   by an existing ACATS test, which GNAT has always executed correctly.
20650 @noindent
20651   RM References:  7.06.01 (17.1/1)
20653 @item
20654 @emph{AI-0026 Missing rules for Unchecked_Union (2010-07-07)}
20655 @cindex AI-0026 (Ada 2012 feature)
20657 @noindent
20658   Record representation clauses concerning Unchecked_Union types cannot mention
20659   the discriminant of the type. The type of a component declared in the variant
20660   part of an Unchecked_Union cannot be controlled, have controlled components,
20661   nor have protected or task parts. If an Unchecked_Union type is declared
20662   within the body of a generic unit or its descendants, then the type of a
20663   component declared in the variant part cannot be a formal private type or a
20664   formal private extension declared within the same generic unit.
20666 @noindent
20667   RM References:  7.06 (9.4/2)   B.03.03 (9/2)   B.03.03 (10/2)
20670 @item
20671 @emph{AI-0205 Extended return declares visible name (0000-00-00)}
20672 @cindex AI-0205 (Ada 2012 feature)
20674 @noindent
20675   This AI corrects a simple omission in the RM. Return objects have always
20676   been visible within an extended return statement.
20678 @noindent
20679   RM References:  8.03 (17)
20682 @item
20683 @emph{AI-0042 Overriding versus implemented-by (0000-00-00)}
20684 @cindex AI-0042 (Ada 2012 feature)
20686 @noindent
20687   This AI fixes a wording gap in the RM. An operation of a synchronized
20688   interface can be implemented by a protected or task entry, but the abstract
20689   operation is not being overridden in the usual sense, and it must be stated
20690   separately that this implementation is legal. This has always been the case
20691   in GNAT.
20693 @noindent
20694   RM References:  9.01 (9.2/2)   9.04 (11.1/2)
20696 @item
20697 @emph{AI-0030 Requeue on synchronized interfaces (2010-07-19)}
20698 @cindex AI-0030 (Ada 2012 feature)
20700 @noindent
20701   Requeue is permitted to a protected, synchronized or task interface primitive
20702   providing it is known that the overriding operation is an entry. Otherwise
20703   the requeue statement has the same effect as a procedure call. Use of pragma
20704   @code{Implemented} provides a way to impose a static requirement on the
20705   overriding operation by adhering to one of the implementation kinds: entry,
20706   protected procedure or any of the above.
20708 @noindent
20709   RM References:  9.05 (9)   9.05.04 (2)   9.05.04 (3)   9.05.04 (5)
20710   9.05.04 (6)   9.05.04 (7)   9.05.04 (12)
20713 @item
20714 @emph{AI-0201 Independence of atomic object components (2010-07-22)}
20715 @cindex AI-0201 (Ada 2012 feature)
20717 @noindent
20718   If an Atomic object has a pragma @code{Pack} or a @code{Component_Size}
20719   attribute, then individual components may not be addressable by independent
20720   tasks. However, if the representation clause has no effect (is confirming),
20721   then independence is not compromised. Furthermore, in GNAT, specification of
20722   other appropriately addressable component sizes (e.g. 16 for 8-bit
20723   characters) also preserves independence. GNAT now gives very clear warnings
20724   both for the declaration of such a type, and for any assignment to its components.
20726 @noindent
20727   RM References:  9.10 (1/3)   C.06 (22/2)   C.06 (23/2)
20729 @item
20730 @emph{AI-0009 Pragma Independent[_Components] (2010-07-23)}
20731 @cindex AI-0009 (Ada 2012 feature)
20733 @noindent
20734   This AI introduces the new pragmas @code{Independent} and
20735   @code{Independent_Components},
20736   which control guaranteeing independence of access to objects and components.
20737   The AI also requires independence not unaffected by confirming rep clauses.
20739 @noindent
20740   RM References:  9.10 (1)   13.01 (15/1)   13.02 (9)   13.03 (13)   C.06 (2)
20741   C.06 (4)   C.06 (6)   C.06 (9)   C.06 (13)   C.06 (14)
20744 @item
20745 @emph{AI-0072 Task signalling using 'Terminated (0000-00-00)}
20746 @cindex AI-0072 (Ada 2012 feature)
20748 @noindent
20749   This AI clarifies that task signalling for reading @code{'Terminated} only
20750   occurs if the result is True. GNAT semantics has always been consistent with
20751   this notion of task signalling.
20753 @noindent
20754   RM References:  9.10 (6.1/1)
20756 @item
20757 @emph{AI-0108 Limited incomplete view and discriminants (0000-00-00)}
20758 @cindex AI-0108 (Ada 2012 feature)
20760 @noindent
20761   This AI confirms that an incomplete type from a limited view does not have
20762   discriminants. This has always been the case in GNAT.
20764 @noindent
20765   RM References:  10.01.01 (12.3/2)
20767 @item
20768 @emph{AI-0129 Limited views and incomplete types (0000-00-00)}
20769 @cindex AI-0129 (Ada 2012 feature)
20771 @noindent
20772   This AI clarifies the description of limited views: a limited view of a
20773   package includes only one view of a type that has an incomplete declaration
20774   and a full declaration (there is no possible ambiguity in a client package).
20775   This AI also fixes an omission: a nested package in the private part has no
20776   limited view. GNAT always implemented this correctly.
20778 @noindent
20779   RM References:  10.01.01 (12.2/2)   10.01.01 (12.3/2)
20783 @item
20784 @emph{AI-0077 Limited withs and scope of declarations (0000-00-00)}
20785 @cindex AI-0077 (Ada 2012 feature)
20787 @noindent
20788   This AI clarifies that a declaration does not include a context clause,
20789   and confirms that it is illegal to have a context in which both a limited
20790   and a nonlimited view of a package are accessible. Such double visibility
20791   was always rejected by GNAT.
20793 @noindent
20794   RM References:  10.01.02 (12/2)   10.01.02 (21/2)   10.01.02 (22/2)
20796 @item
20797 @emph{AI-0122 Private with and children of generics (0000-00-00)}
20798 @cindex AI-0122 (Ada 2012 feature)
20800 @noindent
20801   This AI clarifies the visibility of private children of generic units within
20802   instantiations of a parent. GNAT has always handled this correctly.
20804 @noindent
20805   RM References:  10.01.02 (12/2)
20809 @item
20810 @emph{AI-0040 Limited with clauses on descendant (0000-00-00)}
20811 @cindex AI-0040 (Ada 2012 feature)
20813 @noindent
20814   This AI confirms that a limited with clause in a child unit cannot name
20815   an ancestor of the unit. This has always been checked in GNAT.
20817 @noindent
20818   RM References:  10.01.02 (20/2)
20820 @item
20821 @emph{AI-0132 Placement of library unit pragmas (0000-00-00)}
20822 @cindex AI-0132 (Ada 2012 feature)
20824 @noindent
20825   This AI fills a gap in the description of library unit pragmas. The pragma
20826   clearly must apply to a library unit, even if it does not carry the name
20827   of the enclosing unit. GNAT has always enforced the required check.
20829 @noindent
20830   RM References:  10.01.05 (7)
20833 @item
20834 @emph{AI-0034 Categorization of limited views (0000-00-00)}
20835 @cindex AI-0034 (Ada 2012 feature)
20837 @noindent
20838   The RM makes certain limited with clauses illegal because of categorization
20839   considerations, when the corresponding normal with would be legal. This is
20840   not intended, and GNAT has always implemented the recommended behavior.
20842 @noindent
20843   RM References:  10.02.01 (11/1)   10.02.01 (17/2)
20846 @item
20847 @emph{AI-0035 Inconsistencies with Pure units (0000-00-00)}
20848 @cindex AI-0035 (Ada 2012 feature)
20850 @noindent
20851   This AI remedies some inconsistencies in the legality rules for Pure units.
20852   Derived access types are legal in a pure unit (on the assumption that the
20853   rule for a zero storage pool size has been enforced on the ancestor type).
20854   The rules are enforced in generic instances and in subunits. GNAT has always
20855   implemented the recommended behavior.
20857 @noindent
20858   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)
20861 @item
20862 @emph{AI-0219 Pure permissions and limited parameters (2010-05-25)}
20863 @cindex AI-0219 (Ada 2012 feature)
20865 @noindent
20866   This AI refines the rules for the cases with limited parameters which do not
20867   allow the implementations to omit ``redundant''. GNAT now properly conforms
20868   to the requirements of this binding interpretation.
20870 @noindent
20871   RM References:  10.02.01 (18/2)
20873 @item
20874 @emph{AI-0043 Rules about raising exceptions (0000-00-00)}
20875 @cindex AI-0043 (Ada 2012 feature)
20877 @noindent
20878   This AI covers various omissions in the RM regarding the raising of
20879   exceptions. GNAT has always implemented the intended semantics.
20881 @noindent
20882   RM References:  11.04.01 (10.1/2)   11 (2)
20885 @item
20886 @emph{AI-0200 Mismatches in formal package declarations (0000-00-00)}
20887 @cindex AI-0200 (Ada 2012 feature)
20889 @noindent
20890   This AI plugs a gap in the RM which appeared to allow some obviously intended
20891   illegal instantiations. GNAT has never allowed these instantiations.
20893 @noindent
20894   RM References:  12.07 (16)
20897 @item
20898 @emph{AI-0112 Detection of duplicate pragmas (2010-07-24)}
20899 @cindex AI-0112 (Ada 2012 feature)
20901 @noindent
20902   This AI concerns giving names to various representation aspects, but the
20903   practical effect is simply to make the use of duplicate
20904   @code{Atomic}[@code{_Components}],
20905   @code{Volatile}[@code{_Components}] and
20906   @code{Independent}[@code{_Components}] pragmas illegal, and GNAT
20907   now performs this required check.
20909 @noindent
20910   RM References:  13.01 (8)
20912 @item
20913 @emph{AI-0106 No representation pragmas on generic formals (0000-00-00)}
20914 @cindex AI-0106 (Ada 2012 feature)
20916 @noindent
20917   The RM appeared to allow representation pragmas on generic formal parameters,
20918   but this was not intended, and GNAT has never permitted this usage.
20920 @noindent
20921   RM References:  13.01 (9.1/1)
20924 @item
20925 @emph{AI-0012 Pack/Component_Size for aliased/atomic (2010-07-15)}
20926 @cindex AI-0012 (Ada 2012 feature)
20928 @noindent
20929   It is now illegal to give an inappropriate component size or a pragma
20930   @code{Pack} that attempts to change the component size in the case of atomic
20931   or aliased components. Previously GNAT ignored such an attempt with a
20932   warning.
20934 @noindent
20935   RM References:  13.02 (6.1/2)   13.02 (7)   C.06 (10)   C.06 (11)   C.06 (21)
20938 @item
20939 @emph{AI-0039 Stream attributes cannot be dynamic (0000-00-00)}
20940 @cindex AI-0039 (Ada 2012 feature)
20942 @noindent
20943   The RM permitted the use of dynamic expressions (such as @code{ptr.@b{all})}
20944   for stream attributes, but these were never useful and are now illegal. GNAT
20945   has always regarded such expressions as illegal.
20947 @noindent
20948   RM References:  13.03 (4)   13.03 (6)   13.13.02 (38/2)
20951 @item
20952 @emph{AI-0095 Address of intrinsic subprograms (0000-00-00)}
20953 @cindex AI-0095 (Ada 2012 feature)
20955 @noindent
20956   The prefix of @code{'Address} cannot statically denote a subprogram with
20957   convention @code{Intrinsic}. The use of the @code{Address} attribute raises
20958   @code{Program_Error} if the prefix denotes a subprogram with convention
20959   @code{Intrinsic}.
20961 @noindent
20962   RM References:  13.03 (11/1)
20965 @item
20966 @emph{AI-0116 Alignment of class-wide objects (0000-00-00)}
20967 @cindex AI-0116 (Ada 2012 feature)
20969 @noindent
20970   This AI requires that the alignment of a class-wide object be no greater
20971   than the alignment of any type in the class. GNAT has always followed this
20972   recommendation.
20974 @noindent
20975   RM References:  13.03 (29)   13.11 (16)
20978 @item
20979 @emph{AI-0146 Type invariants (2009-09-21)}
20980 @cindex AI-0146 (Ada 2012 feature)
20982 @noindent
20983   Type invariants may be specified for private types using the aspect notation.
20984   Aspect @code{Type_Invariant} may be specified for any private type,
20985   @code{Type_Invariant'Class} can
20986   only be specified for tagged types, and is inherited by any descendent of the
20987   tagged types. The invariant is a boolean expression that is tested for being
20988   true in the following situations: conversions to the private type, object
20989   declarations for the private type that are default initialized, and
20990   [@b{in}] @b{out}
20991   parameters and returned result on return from any primitive operation for
20992   the type that is visible to a client.
20993   GNAT defines the synonyms @code{Invariant} for @code{Type_Invariant} and
20994   @code{Invariant'Class} for @code{Type_Invariant'Class}.
20996 @noindent
20997   RM References:  13.03.03 (00)
20999 @item
21000 @emph{AI-0078 Relax Unchecked_Conversion alignment rules (0000-00-00)}
21001 @cindex AI-0078 (Ada 2012 feature)
21003 @noindent
21004   In Ada 2012, compilers are required to support unchecked conversion where the
21005   target alignment is a multiple of the source alignment. GNAT always supported
21006   this case (and indeed all cases of differing alignments, doing copies where
21007   required if the alignment was reduced).
21009 @noindent
21010   RM References:  13.09 (7)
21013 @item
21014 @emph{AI-0195 Invalid value handling is implementation defined (2010-07-03)}
21015 @cindex AI-0195 (Ada 2012 feature)
21017 @noindent
21018   The handling of invalid values is now designated to be implementation
21019   defined. This is a documentation change only, requiring Annex M in the GNAT
21020   Reference Manual to document this handling.
21021   In GNAT, checks for invalid values are made
21022   only when necessary to avoid erroneous behavior. Operations like assignments
21023   which cannot cause erroneous behavior ignore the possibility of invalid
21024   values and do not do a check. The date given above applies only to the
21025   documentation change, this behavior has always been implemented by GNAT.
21027 @noindent
21028   RM References:  13.09.01 (10)
21030 @item
21031 @emph{AI-0193 Alignment of allocators (2010-09-16)}
21032 @cindex AI-0193 (Ada 2012 feature)
21034 @noindent
21035   This AI introduces a new attribute @code{Max_Alignment_For_Allocation},
21036   analogous to @code{Max_Size_In_Storage_Elements}, but for alignment instead
21037   of size.
21039 @noindent
21040   RM References:  13.11 (16)   13.11 (21)   13.11.01 (0)   13.11.01 (1)
21041   13.11.01 (2)   13.11.01 (3)
21044 @item
21045 @emph{AI-0177 Parameterized expressions (2010-07-10)}
21046 @cindex AI-0177 (Ada 2012 feature)
21048 @noindent
21049   The new Ada 2012 notion of parameterized expressions is implemented. The form
21050   is:
21051 @smallexample
21052   @i{function specification} @b{is} (@i{expression})
21053 @end smallexample
21055 @noindent
21056   This is exactly equivalent to the
21057   corresponding function body that returns the expression, but it can appear
21058   in a package spec. Note that the expression must be parenthesized.
21060 @noindent
21061   RM References:  13.11.01 (3/2)
21063 @item
21064 @emph{AI-0033 Attach/Interrupt_Handler in generic (2010-07-24)}
21065 @cindex AI-0033 (Ada 2012 feature)
21067 @noindent
21068   Neither of these two pragmas may appear within a generic template, because
21069   the generic might be instantiated at other than the library level.
21071 @noindent
21072   RM References:  13.11.02 (16)   C.03.01 (7/2)   C.03.01 (8/2)
21075 @item
21076 @emph{AI-0161 Restriction No_Default_Stream_Attributes (2010-09-11)}
21077 @cindex AI-0161 (Ada 2012 feature)
21079 @noindent
21080   A new restriction @code{No_Default_Stream_Attributes} prevents the use of any
21081   of the default stream attributes for elementary types. If this restriction is
21082   in force, then it is necessary to provide explicit subprograms for any
21083   stream attributes used.
21085 @noindent
21086   RM References:  13.12.01 (4/2)   13.13.02 (40/2)   13.13.02 (52/2)
21088 @item
21089 @emph{AI-0194 Value of Stream_Size attribute (0000-00-00)}
21090 @cindex AI-0194 (Ada 2012 feature)
21092 @noindent
21093   The @code{Stream_Size} attribute returns the default number of bits in the
21094   stream representation of the given type.
21095   This value is not affected by the presence
21096   of stream subprogram attributes for the type. GNAT has always implemented
21097   this interpretation.
21099 @noindent
21100   RM References:  13.13.02 (1.2/2)
21102 @item
21103 @emph{AI-0109 Redundant check in S'Class'Input (0000-00-00)}
21104 @cindex AI-0109 (Ada 2012 feature)
21106 @noindent
21107   This AI is an editorial change only. It removes the need for a tag check
21108   that can never fail.
21110 @noindent
21111   RM References:  13.13.02 (34/2)
21113 @item
21114 @emph{AI-0007 Stream read and private scalar types (0000-00-00)}
21115 @cindex AI-0007 (Ada 2012 feature)
21117 @noindent
21118   The RM as written appeared to limit the possibilities of declaring read
21119   attribute procedures for private scalar types. This limitation was not
21120   intended, and has never been enforced by GNAT.
21122 @noindent
21123   RM References:  13.13.02 (50/2)   13.13.02 (51/2)
21126 @item
21127 @emph{AI-0065 Remote access types and external streaming (0000-00-00)}
21128 @cindex AI-0065 (Ada 2012 feature)
21130 @noindent
21131   This AI clarifies the fact that all remote access types support external
21132   streaming. This fixes an obvious oversight in the definition of the
21133   language, and GNAT always implemented the intended correct rules.
21135 @noindent
21136   RM References:  13.13.02 (52/2)
21138 @item
21139 @emph{AI-0019 Freezing of primitives for tagged types (0000-00-00)}
21140 @cindex AI-0019 (Ada 2012 feature)
21142 @noindent
21143   The RM suggests that primitive subprograms of a specific tagged type are
21144   frozen when the tagged type is frozen. This would be an incompatible change
21145   and is not intended. GNAT has never attempted this kind of freezing and its
21146   behavior is consistent with the recommendation of this AI.
21148 @noindent
21149   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)
21151 @item
21152 @emph{AI-0017 Freezing and incomplete types (0000-00-00)}
21153 @cindex AI-0017 (Ada 2012 feature)
21155 @noindent
21156   So-called ``Taft-amendment types'' (i.e., types that are completed in package
21157   bodies) are not frozen by the occurrence of bodies in the
21158   enclosing declarative part. GNAT always implemented this properly.
21160 @noindent
21161   RM References:  13.14 (3/1)
21164 @item
21165 @emph{AI-0060 Extended definition of remote access types (0000-00-00)}
21166 @cindex AI-0060 (Ada 2012 feature)
21168 @noindent
21169   This AI extends the definition of remote access types to include access
21170   to limited, synchronized, protected or task class-wide interface types.
21171   GNAT already implemented this extension.
21173 @noindent
21174   RM References:  A (4)   E.02.02 (9/1)   E.02.02 (9.2/1)   E.02.02 (14/2)   E.02.02 (18)
21176 @item
21177 @emph{AI-0114 Classification of letters (0000-00-00)}
21178 @cindex AI-0114 (Ada 2012 feature)
21180 @noindent
21181   The code points 170 (@code{FEMININE ORDINAL INDICATOR}),
21182   181 (@code{MICRO SIGN}), and
21183   186 (@code{MASCULINE ORDINAL INDICATOR}) are technically considered
21184   lower case letters by Unicode.
21185   However, they are not allowed in identifiers, and they
21186   return @code{False} to @code{Ada.Characters.Handling.Is_Letter/Is_Lower}.
21187   This behavior is consistent with that defined in Ada 95.
21189 @noindent
21190   RM References:  A.03.02 (59)   A.04.06 (7)
21193 @item
21194 @emph{AI-0185 Ada.Wide_[Wide_]Characters.Handling (2010-07-06)}
21195 @cindex AI-0185 (Ada 2012 feature)
21197 @noindent
21198   Two new packages @code{Ada.Wide_[Wide_]Characters.Handling} provide
21199   classification functions for @code{Wide_Character} and
21200   @code{Wide_Wide_Character}, as well as providing
21201   case folding routines for @code{Wide_[Wide_]Character} and
21202   @code{Wide_[Wide_]String}.
21204 @noindent
21205   RM References:  A.03.05 (0)   A.03.06 (0)
21208 @item
21209 @emph{AI-0031 Add From parameter to Find_Token (2010-07-25)}
21210 @cindex AI-0031 (Ada 2012 feature)
21212 @noindent
21213   A new version of @code{Find_Token} is added to all relevant string packages,
21214   with an extra parameter @code{From}. Instead of starting at the first
21215   character of the string, the search for a matching Token starts at the
21216   character indexed by the value of @code{From}.
21217   These procedures are available in all versions of Ada
21218   but if used in versions earlier than Ada 2012 they will generate a warning
21219   that an Ada 2012 subprogram is being used.
21221 @noindent
21222   RM References:  A.04.03 (16)   A.04.03 (67)   A.04.03 (68/1)   A.04.04 (51)
21223   A.04.05 (46)
21226 @item
21227 @emph{AI-0056 Index on null string returns zero (0000-00-00)}
21228 @cindex AI-0056 (Ada 2012 feature)
21230 @noindent
21231   The wording in the Ada 2005 RM implied an incompatible handling of the
21232   @code{Index} functions, resulting in raising an exception instead of
21233   returning zero in some situations.
21234   This was not intended and has been corrected.
21235   GNAT always returned zero, and is thus consistent with this AI.
21237 @noindent
21238   RM References:  A.04.03 (56.2/2)   A.04.03 (58.5/2)
21241 @item
21242 @emph{AI-0137 String encoding package (2010-03-25)}
21243 @cindex AI-0137 (Ada 2012 feature)
21245 @noindent
21246   The packages @code{Ada.Strings.UTF_Encoding}, together with its child
21247   packages, @code{Conversions}, @code{Strings}, @code{Wide_Strings},
21248   and @code{Wide_Wide_Strings} have been
21249   implemented. These packages (whose documentation can be found in the spec
21250   files @file{a-stuten.ads}, @file{a-suenco.ads}, @file{a-suenst.ads},
21251   @file{a-suewst.ads}, @file{a-suezst.ads}) allow encoding and decoding of
21252   @code{String}, @code{Wide_String}, and @code{Wide_Wide_String}
21253   values using UTF coding schemes (including UTF-8, UTF-16LE, UTF-16BE, and
21254   UTF-16), as well as conversions between the different UTF encodings. With
21255   the exception of @code{Wide_Wide_Strings}, these packages are available in
21256   Ada 95 and Ada 2005 mode as well as Ada 2012 mode.
21257   The @code{Wide_Wide_Strings package}
21258   is available in Ada 2005 mode as well as Ada 2012 mode (but not in Ada 95
21259   mode since it uses @code{Wide_Wide_Character}).
21261 @noindent
21262   RM References:  A.04.11
21264 @item
21265 @emph{AI-0038 Minor errors in Text_IO (0000-00-00)}
21266 @cindex AI-0038 (Ada 2012 feature)
21268 @noindent
21269   These are minor errors in the description on three points. The intent on
21270   all these points has always been clear, and GNAT has always implemented the
21271   correct intended semantics.
21273 @noindent
21274   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)
21276 @item
21277 @emph{AI-0044 Restrictions on container instantiations (0000-00-00)}
21278 @cindex AI-0044 (Ada 2012 feature)
21280 @noindent
21281   This AI places restrictions on allowed instantiations of generic containers.
21282   These restrictions are not checked by the compiler, so there is nothing to
21283   change in the implementation. This affects only the RM documentation.
21285 @noindent
21286   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)
21288 @item
21289 @emph{AI-0127 Adding Locale Capabilities (2010-09-29)}
21290 @cindex AI-0127 (Ada 2012 feature)
21292 @noindent
21293   This package provides an interface for identifying the current locale.
21295 @noindent
21296   RM References:  A.19    A.19.01    A.19.02    A.19.03    A.19.05    A.19.06
21297   A.19.07    A.19.08    A.19.09    A.19.10    A.19.11    A.19.12    A.19.13
21301 @item
21302 @emph{AI-0002 Export C with unconstrained arrays (0000-00-00)}
21303 @cindex AI-0002 (Ada 2012 feature)
21305 @noindent
21306   The compiler is not required to support exporting an Ada subprogram with
21307   convention C if there are parameters or a return type of an unconstrained
21308   array type (such as @code{String}). GNAT allows such declarations but
21309   generates warnings. It is possible, but complicated, to write the
21310   corresponding C code and certainly such code would be specific to GNAT and
21311   non-portable.
21313 @noindent
21314   RM References:  B.01 (17)   B.03 (62)   B.03 (71.1/2)
21317 @item
21318 @emph{AI-0216 No_Task_Hierarchy forbids local tasks (0000-00-00)}
21319 @cindex AI05-0216 (Ada 2012 feature)
21321 @noindent
21322   It is clearly the intention that @code{No_Task_Hierarchy} is intended to
21323   forbid tasks declared locally within subprograms, or functions returning task
21324   objects, and that is the implementation that GNAT has always provided.
21325   However the language in the RM was not sufficiently clear on this point.
21326   Thus this is a documentation change in the RM only.
21328 @noindent
21329   RM References:  D.07 (3/3)
21331 @item
21332 @emph{AI-0211 No_Relative_Delays forbids Set_Handler use (2010-07-09)}
21333 @cindex AI-0211 (Ada 2012 feature)
21335 @noindent
21336   The restriction @code{No_Relative_Delays} forbids any calls to the subprogram
21337   @code{Ada.Real_Time.Timing_Events.Set_Handler}.
21339 @noindent
21340   RM References:  D.07 (5)   D.07 (10/2)   D.07 (10.4/2)   D.07 (10.7/2)
21342 @item
21343 @emph{AI-0190 pragma Default_Storage_Pool (2010-09-15)}
21344 @cindex AI-0190 (Ada 2012 feature)
21346 @noindent
21347   This AI introduces a new pragma @code{Default_Storage_Pool}, which can be
21348   used to control storage pools globally.
21349   In particular, you can force every access
21350   type that is used for allocation (@b{new}) to have an explicit storage pool,
21351   or you can declare a pool globally to be used for all access types that lack
21352   an explicit one.
21354 @noindent
21355   RM References:  D.07 (8)
21357 @item
21358 @emph{AI-0189 No_Allocators_After_Elaboration (2010-01-23)}
21359 @cindex AI-0189 (Ada 2012 feature)
21361 @noindent
21362   This AI introduces a new restriction @code{No_Allocators_After_Elaboration},
21363   which says that no dynamic allocation will occur once elaboration is
21364   completed.
21365   In general this requires a run-time check, which is not required, and which
21366   GNAT does not attempt. But the static cases of allocators in a task body or
21367   in the body of the main program are detected and flagged at compile or bind
21368   time.
21370 @noindent
21371   RM References:  D.07 (19.1/2)   H.04 (23.3/2)
21373 @item
21374 @emph{AI-0171 Pragma CPU and Ravenscar Profile (2010-09-24)}
21375 @cindex AI-0171 (Ada 2012 feature)
21377 @noindent
21378   A new package @code{System.Multiprocessors} is added, together with the
21379   definition of pragma @code{CPU} for controlling task affinity. A new no
21380   dependence restriction, on @code{System.Multiprocessors.Dispatching_Domains},
21381   is added to the Ravenscar profile.
21383 @noindent
21384   RM References:  D.13.01 (4/2)   D.16
21387 @item
21388 @emph{AI-0210 Correct Timing_Events metric (0000-00-00)}
21389 @cindex AI-0210 (Ada 2012 feature)
21391 @noindent
21392   This is a documentation only issue regarding wording of metric requirements,
21393   that does not affect the implementation of the compiler.
21395 @noindent
21396   RM References:  D.15 (24/2)
21399 @item
21400 @emph{AI-0206 Remote types packages and preelaborate (2010-07-24)}
21401 @cindex AI-0206 (Ada 2012 feature)
21403 @noindent
21404   Remote types packages are now allowed to depend on preelaborated packages.
21405   This was formerly considered illegal.
21407 @noindent
21408   RM References:  E.02.02 (6)
21412 @item
21413 @emph{AI-0152 Restriction No_Anonymous_Allocators (2010-09-08)}
21414 @cindex AI-0152 (Ada 2012 feature)
21416 @noindent
21417   Restriction @code{No_Anonymous_Allocators} prevents the use of allocators
21418   where the type of the returned value is an anonymous access type.
21420 @noindent
21421   RM References:  H.04 (8/1)
21422 @end itemize
21425 @node Obsolescent Features
21426 @chapter Obsolescent Features
21428 @noindent
21429 This chapter describes features that are provided by GNAT, but are
21430 considered obsolescent since there are preferred ways of achieving
21431 the same effect. These features are provided solely for historical
21432 compatibility purposes.
21434 @menu
21435 * pragma No_Run_Time::
21436 * pragma Ravenscar::
21437 * pragma Restricted_Run_Time::
21438 @end menu
21440 @node pragma No_Run_Time
21441 @section pragma No_Run_Time
21443 The pragma @code{No_Run_Time} is used to achieve an affect similar
21444 to the use of the "Zero Foot Print" configurable run time, but without
21445 requiring a specially configured run time. The result of using this
21446 pragma, which must be used for all units in a partition, is to restrict
21447 the use of any language features requiring run-time support code. The
21448 preferred usage is to use an appropriately configured run-time that
21449 includes just those features that are to be made accessible.
21451 @node pragma Ravenscar
21452 @section pragma Ravenscar
21454 The pragma @code{Ravenscar} has exactly the same effect as pragma
21455 @code{Profile (Ravenscar)}. The latter usage is preferred since it
21456 is part of the new Ada 2005 standard.
21458 @node pragma Restricted_Run_Time
21459 @section pragma Restricted_Run_Time
21461 The pragma @code{Restricted_Run_Time} has exactly the same effect as
21462 pragma @code{Profile (Restricted)}. The latter usage is
21463 preferred since the Ada 2005 pragma @code{Profile} is intended for
21464 this kind of implementation dependent addition.
21466 @include fdl.texi
21467 @c GNU Free Documentation License
21469 @node Index,,GNU Free Documentation License, Top
21470 @unnumbered Index
21472 @printindex cp
21474 @contents
21476 @bye
21477 tablishes the following set of restrictions:
21478 Pragma Shared